/* Reversible BILS CUSTOM mobile trial. Desktop styles remain in personaliza.css. */
@media (max-width: 640px) {
  html:has(body.bils-custom-mobile) {
    scroll-padding-block: 64px calc(var(--customization-dock-height, 80px) + 16px);
  }
  body.bils-custom-mobile {
    --header-h: 64px;
    scroll-padding-bottom: calc(var(--customization-dock-height, 80px) + 16px);
  }

  body.bils-custom-mobile .site-header {
    height: 64px;
    gap: 8px;
    padding-inline: 16px;
    background: #080808;
    border-bottom-color: #252525;
    box-shadow: none;
    backdrop-filter: none;
  }

  body.bils-custom-mobile .brand {
    width: 102px;
    min-width: 80px;
  }

  body.bils-custom-mobile .brand img {
    width: 100%;
    height: auto;
  }

  body.bils-custom-mobile .header-actions { gap: 0; }

  body.bils-custom-mobile .header-actions :is(.icon-button, .cart-trigger, .account-trigger) {
    width: 44px;
    height: 44px;
    background: transparent;
    border-color: transparent;
    backdrop-filter: none;
    transform: none;
  }

  #personaliza:has(.customization-mobile-ready:not([hidden])) {
    background: #080808;
  }

  #personaliza .customization-mobile-ready {
    --studio-gold: #cabb98;
    --studio-cream: #f2f0ec;
    --mobile-secondary: #b6b1a8;
    margin-top: 24px;
    padding: 0;
    border: 0;
    background: #080808;
    box-shadow: none;
    backdrop-filter: none;
  }

  .customization-mobile-ready > .customization-form-head { display: none; }

  .customization-mobile-ready .customization-studio {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: #080808;
    box-shadow: none;
    scroll-margin-top: 8px;
  }

  .customization-mobile-ready .customization-mobile-identity {
    display: flex;
    min-height: 36px;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-bottom: 8px;
    color: var(--mobile-secondary);
    font-size: 13px;
    line-height: 1.4;
  }

  .customization-mobile-ready .customization-stepper {
    margin-bottom: 12px;
    border: 0;
    background: transparent;
  }

  .customization-mobile-ready .customization-stepper::before { content: none; }

  .customization-mobile-ready .customization-stepper button {
    min-height: 48px;
    gap: 3px;
    padding: 4px 0 8px;
    color: var(--mobile-secondary);
    transition: color 180ms ease;
  }

  .customization-mobile-ready .customization-stepper span {
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 0;
  }

  .customization-mobile-ready .customization-stepper small {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
  }

  .customization-mobile-ready .customization-stepper button::after {
    right: 8px;
    bottom: 0;
    left: 8px;
    width: auto;
    height: 2px;
    border: 0;
    border-radius: 0;
    background: #454545;
    box-shadow: none;
    transform: none;
    transition: background-color 180ms ease;
  }

  .customization-mobile-ready .customization-stepper button[aria-current="step"] {
    color: var(--studio-cream);
  }

  .customization-mobile-ready .customization-stepper button[aria-current="step"]::after {
    background: var(--studio-gold);
  }

  .customization-mobile-ready .customization-stepper .is-complete span::after { content: " ✓"; }

  .customization-mobile-ready .customization-viewer {
    /* Restore the original mobile frame; keep view controls below the garment. */
    height: 574px;
    min-height: 574px;
    grid-template-rows: minmax(0, 1fr) auto auto;
    overflow: hidden;
    border-radius: 4px;
    background: #151515;
  }

  .customization-mobile-ready .customization-viewer-stage {
    height: auto;
    background: linear-gradient(150deg, #303030, #2c2c2c 55%, #282828);
  }

  .customization-mobile-ready .customization-viewer-grid { display: none; }

  .customization-mobile-ready .customization-viewer-toolbar {
    display: flex;
    width: calc(100% - 16px);
    margin: 8px 8px 0;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: transparent;
    backdrop-filter: none;
  }

  .customization-mobile-ready .customization-viewer-toolbar button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding-inline: 4px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: var(--mobile-secondary);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease;
  }

  .customization-mobile-ready .customization-viewer-toolbar button.is-active {
    border-color: var(--studio-gold);
    background: #292720;
    color: var(--studio-cream);
  }

  .customization-mobile-ready .customization-viewer-toolbar button:disabled {
    color: #77736d;
    border-color: transparent;
    background: transparent;
    cursor: not-allowed;
  }

  .customization-mobile-ready .customization-viewer-hint {
    min-height: 0;
    padding: 8px 12px 12px;
    border: 0;
    background: transparent;
    color: var(--mobile-secondary);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: 0;
  }

  .customization-mobile-ready .customization-studio-controls {
    display: block;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .customization-mobile-ready .customization-step-shell {
    overflow: visible;
    padding-bottom: calc(var(--customization-dock-height, 80px) + 24px);
    scrollbar-gutter: auto;
  }

  .customization-mobile-ready .customization-step-panel {
    min-height: 0;
    padding-bottom: 0;
    animation: customization-mobile-step-in 200ms ease-out both;
  }

  .customization-mobile-ready .customization-step-head {
    padding: 20px 0 12px;
  }

  .customization-mobile-ready .customization-step-head > span { display: none; }

  .customization-mobile-ready .customization-step-head h5 {
    font-size: 28px;
    line-height: 1.1;
    scroll-margin-top: 8px;
  }

  .customization-mobile-ready .customization-step-head p {
    margin-top: 8px;
    color: var(--mobile-secondary);
    font-size: 15px;
    line-height: 1.5;
  }

  .customization-mobile-ready [data-step-panel="1"] .customization-step-head p { display: none; }

  .customization-mobile-ready .customization-control-block,
  .customization-mobile-ready .customization-step-panel .customization-control-block:first-of-type {
    padding: 16px 0;
    border: 0;
  }

  .customization-mobile-ready .customization-step-panel--compact-intro .customization-garment-control {
    padding: 0 0 8px;
  }

  .customization-mobile-ready .customization-selected-garment {
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 4px;
    padding: 12px;
    border: 1px solid #555149;
    border-radius: 4px;
    background: #151515;
    box-shadow: none;
    transform: none;
    transition: border-color 180ms ease, background-color 180ms ease;
  }

  .customization-mobile-ready .customization-selected-garment-copy { gap: 4px; }
  .customization-mobile-ready .customization-selected-garment-copy small { display: none; }

  .customization-mobile-ready .customization-selected-garment-copy strong {
    font-family: inherit;
    font-size: 16px;
    font-weight: 650;
    line-height: 1.35;
  }

  .customization-mobile-ready .customization-selected-garment-copy > span {
    color: var(--mobile-secondary);
    font-size: 13px;
    line-height: 1.4;
  }

  .customization-mobile-ready .customization-selected-garment-action {
    grid-column: 2;
    justify-content: flex-start;
    color: var(--studio-gold);
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
  }

  .customization-mobile-ready .customization-garment-icon {
    grid-row: 1 / span 2;
    border-color: #555149;
    background: transparent;
  }

  .customization-mobile-ready .customization-control-heading { grid-template-columns: 1fr; }
  .customization-mobile-ready .customization-control-heading > span { display: none; }

  .customization-mobile-ready .customization-control-heading strong {
    color: var(--studio-cream);
    font-size: 14px;
    letter-spacing: 0;
    text-transform: none;
  }

  .customization-mobile-ready .customization-control-heading small {
    color: var(--mobile-secondary);
    font-size: 14px;
  }

  .customization-mobile-ready .customization-color-swatches {
    gap: 12px;
    margin-top: 12px;
  }

  .customization-mobile-ready .customization-color-swatches button {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-color: #77736d;
  }

  .customization-mobile-ready .customization-color-swatches button::after {
    inset: -3px;
    border-width: 2px;
    transition: border-color 180ms ease;
  }

  .customization-mobile-ready .customization-color-swatches button.is-active::before {
    content: "✓";
    position: absolute;
    z-index: 1;
    right: -2px;
    bottom: -2px;
    display: grid;
    width: 17px;
    height: 17px;
    place-items: center;
    border: 1px solid var(--studio-gold);
    border-radius: 50%;
    background: #080808;
    color: #f2f0ec;
    font-size: 12px;
  }

  .customization-mobile-ready .customization-size-options {
    gap: 8px;
    margin-top: 12px;
  }

  .customization-mobile-ready .customization-size-options button {
    position: relative;
    min-height: 48px;
    border-color: #77736d;
    background: #151515;
    color: var(--studio-cream);
    font-size: 14px;
  }

  .customization-mobile-ready .customization-size-options button.is-active {
    border-color: var(--studio-gold);
    background: #292720;
    box-shadow: inset 0 -2px var(--studio-gold);
  }

  .customization-mobile-ready .customization-size-options button.is-active::after {
    content: "✓";
    position: absolute;
    top: 2px;
    right: 4px;
    color: var(--studio-gold);
    font-size: 11px;
  }

  .customization-mobile-ready .customization-size-options button:disabled {
    color: #77736d;
    background: #101010;
    border-style: dashed;
    box-shadow: none;
    cursor: not-allowed;
  }

  .customization-mobile-ready .customization-field { font-size: 15px; }

  .customization-mobile-ready :is(.customization-field > span, .customization-contact-fields .customization-field > span, .customization-design-description > span) {
    color: var(--studio-cream);
    font-size: 14px;
    letter-spacing: 0;
  }

  .customization-mobile-ready :is(.customization-field input, .customization-field select, .customization-field textarea) {
    min-height: 48px;
    border-color: #77736d;
    background: #151515;
    color: var(--studio-cream);
    font-size: 16px;
    scroll-margin-block: 84px calc(var(--customization-dock-height, 80px) + 20px);
  }

  .customization-mobile-ready :is(.customization-contact-fields, .customization-design-description) {
    margin: 16px 0;
    padding: 0;
  }

  .customization-mobile-ready :is(.customization-field-error, .customization-file-summary, .customization-data-note, .customization-studio-note p, .customization-garment-change-note, .customization-final-preview p, .customization-final-preview > small, .customization-submit-card p) {
    color: var(--mobile-secondary);
    font-size: 14px;
    line-height: 1.5;
  }

  .customization-mobile-ready .customization-field-error:not(:empty) { color: #ffaaa6; }

  .customization-mobile-ready :is(.customization-file-summary, .customization-studio-note, .customization-data-note, .customization-submit-card, .customization-step-panel .customization-status) {
    margin-inline: 0;
  }

  .customization-mobile-ready .customization-upload-consent {
    gap: 12px;
    margin: 12px 0;
    padding: 12px;
    border-color: #454545;
    color: var(--studio-cream);
    font-size: 14px;
  }

  .customization-mobile-ready .customization-upload-consent input { flex: 0 0 18px; }

  .customization-mobile-ready .customization-design-upload {
    margin-top: 0;
    padding: 16px;
    border-color: #77736d;
    background: #151515;
  }

  .customization-mobile-ready .customization-design-upload strong { font-size: 14px; }

  .customization-mobile-ready :is(.customization-design-upload small, .customization-design-layers > p, .customization-design-layer strong, .customization-transform-controls label, .customization-transform-actions button) {
    color: var(--mobile-secondary);
    font-size: 14px;
    line-height: 1.5;
  }

  .customization-mobile-ready .customization-final-preview { margin-inline: 0; }
  .customization-mobile-ready .customization-final-preview-controls { grid-template-columns: minmax(0, 1fr); }
  .customization-mobile-ready .customization-final-preview-controls [data-shirt-view] { display: none; }
  .customization-mobile-ready .customization-final-preview-controls button { min-height: 44px; font-size: 14px; }
  .customization-mobile-ready .customization-review { padding-inline: 0; }
  .customization-mobile-ready .customization-review strong { font-size: 16px; }
  .customization-mobile-ready .customization-review small { font-size: 14px; color: var(--mobile-secondary); }
  .customization-mobile-ready .customization-before-production { margin-inline: 0; }
  .customization-mobile-ready .customization-before-production p { font-size: 14px; color: var(--mobile-secondary); }

  .customization-mobile-ready .customization-mobile-dock {
    position: fixed;
    z-index: 45;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 12px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border-top: 1px solid #353535;
    background: #0b0b0b;
  }

  .customization-mobile-ready .customization-mobile-dock[hidden] { display: none; }

  .customization-mobile-ready .customization-mobile-dock .customization-step-actions {
    position: static;
    display: flex;
    gap: 12px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .customization-mobile-ready .customization-mobile-dock button {
    position: relative;
    min-height: 52px;
    margin: 0;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: 0;
  }

  .customization-mobile-ready .customization-mobile-dock :is(.customization-step-next, #submitCustomization) {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: auto;
    padding: 12px;
    border: 1px solid var(--studio-gold);
    background: var(--studio-gold);
    color: #080808;
    box-shadow: none;
  }

  .customization-mobile-ready .customization-mobile-dock .customization-step-back {
    flex: 0 0 auto;
    padding-inline: 12px;
    color: var(--studio-cream);
    border-color: #77736d;
  }

  .customization-mobile-ready .customization-mobile-dock button:disabled {
    background: #353535;
    color: #aaa69e;
    border-color: #555;
    cursor: not-allowed;
  }

  /* Press feedback lives on a visual overlay, leaving the hit target stable. */
  .customization-mobile-ready :is(.customization-mobile-dock button, .customization-viewer-toolbar button)::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    border-radius: inherit;
    pointer-events: none;
    transform: scale(1);
    transition: transform 120ms ease-out, background-color 120ms ease-out, border-color 120ms ease-out;
  }

  .customization-mobile-ready .customization-viewer-toolbar button { position: relative; }

  .customization-mobile-ready :is(.customization-mobile-dock button, .customization-viewer-toolbar button):not(:disabled):active::before {
    border-color: currentColor;
    background: rgba(255, 255, 255, 0.06);
    transform: scale(0.98);
  }

  .customization-mobile-ready :is(button, [role="button"]) { touch-action: manipulation; }

  .customization-mobile-ready [aria-invalid="true"] {
    scroll-margin-block: 84px calc(var(--customization-dock-height, 80px) + 20px);
  }

  .customization-mobile-ready :is(button, a, input, textarea, select, [role="button"]):focus-visible {
    outline: 2px solid #f2f0ec;
    outline-offset: 3px;
  }

  /* Neutralize desktop hover lifts on touch; actual hover is opt-in below. */
  .customization-mobile-ready :is(.customization-selected-garment, .customization-garment-category-card, .customization-garment-product-card):hover {
    transform: none;
  }

  .customization-mobile-ready :is(.customization-garment-category-card, .customization-garment-product-card) {
    transform: none;
    border-color: #555149;
    background: #151515;
    transition: border-color 180ms ease, background-color 180ms ease;
  }

  .customization-mobile-ready .customization-garment-product-card.is-active { border-color: var(--studio-gold); }

  .customization-mobile-ready :is(.customization-garment-category-card, .customization-garment-product-card) img,
  .customization-mobile-ready :is(.customization-garment-category-card, .customization-garment-product-card):hover img {
    filter: none;
    transform: none;
    transition: none;
  }

  .customization-mobile-ready .customization-garment-picker {
    background: #080808;
    color: var(--studio-cream);
  }

  .customization-mobile-ready .customization-garment-picker-panel > header { padding: 16px; background: #151515; }
  .customization-mobile-ready .customization-garment-picker-panel > header h5 { font-size: 28px; }
  .customization-mobile-ready .customization-garment-picker-panel > header p { font-size: 14px; color: var(--mobile-secondary); }
  .customization-mobile-ready .customization-garment-picker-panel > header .customization-garment-picker-back { font-size: 13px; }
  .customization-mobile-ready .customization-garment-picker-groups { padding: 16px; }
  .customization-mobile-ready .customization-garment-category-grid { gap: 12px; }
  .customization-mobile-ready .customization-garment-category-card { min-height: 260px; }
  .customization-mobile-ready .customization-garment-category-copy { padding: 12px; }
  .customization-mobile-ready .customization-garment-category-copy strong { font-size: 23px; }
  .customization-mobile-ready .customization-garment-category-copy > span { font-size: 13px; color: var(--mobile-secondary); }
  .customization-mobile-ready .customization-garment-category-copy :is(small, b) { font-size: 12px; letter-spacing: 0; }
  .customization-mobile-ready .customization-garment-product-heading { flex-wrap: wrap; gap: 4px; }
  .customization-mobile-ready .customization-garment-product-heading strong { font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1.35; }
  .customization-mobile-ready .customization-garment-product-selected { font-size: 13px; letter-spacing: 0; }
  .customization-mobile-ready .customization-garment-product-detail { font-size: 13px; color: var(--mobile-secondary); }
  .customization-mobile-ready .customization-garment-product-facts { font-size: 13px; }
  .customization-mobile-ready .customization-garment-product-facts :is(small, strong, b) { font-size: 13px; color: var(--mobile-secondary); }
  .customization-mobile-ready .customization-garment-product-price { font-size: 13px; color: var(--studio-cream); white-space: normal; }
  .customization-mobile-ready .customization-garment-product-badge,
  .customization-mobile-ready .customization-garment-product-preview { font-size: 11px; letter-spacing: 0; backdrop-filter: none; }
  .customization-mobile-ready .customization-garment-picker-footer { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); background: #151515; }
  .customization-mobile-ready .customization-garment-picker-footer :is(p strong, button) { font-size: 13px; letter-spacing: 0; }
}

@media (min-width: 360px) and (max-width: 640px) {
  .customization-mobile-ready .customization-garment-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .customization-mobile-ready .customization-garment-product-card { grid-template-columns: 1fr; }
  .customization-mobile-ready .customization-garment-product-media { min-height: 0; height: auto; aspect-ratio: 1.15; }
  .customization-mobile-ready .customization-garment-product-copy { padding: 12px; align-content: start; }
  .customization-mobile-ready .customization-garment-product-footer { flex-wrap: wrap; gap: 8px; }
  .customization-mobile-ready .customization-garment-product-price { flex: 1 1 100%; min-width: 0; }
}

@media (max-width: 640px) and (hover: hover) and (pointer: fine) {
  .customization-mobile-ready :is(.customization-selected-garment, .customization-garment-category-card, .customization-garment-product-card):not(:disabled):hover { border-color: var(--studio-gold); }
}

@keyframes customization-mobile-step-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .customization-mobile-ready .customization-step-panel { animation: none; }
  .customization-mobile-ready .customization-studio :is(button, a, input, textarea, select),
  .customization-mobile-ready .customization-studio button::before,
  .customization-mobile-ready .customization-studio button::after { transition: none; }
  .customization-mobile-ready :is(.customization-mobile-dock button, .customization-viewer-toolbar button):not(:disabled):active::before { transform: none; }
}
