/* MILORIA · a compact, photographic way to explore the mobile catalogue. */
body.storefront .mobile-discovery {
  display: none;
}

@media (max-width: 900px) {
  body.storefront {
    --catalog-ground: #f7f1eb;
    --catalog-surface: #fffaf5;
    --line: #e3d6cc;
    --mobile-audience-card-width: clamp(150px, calc((100vw - 40px) / 2), 190px);
    --mobile-category-card-width: clamp(104px, calc((100vw - 52px) / 3), 168px);
    background: var(--catalog-ground);
  }

  body.storefront .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding-block: 5px;
    gap: 6px 12px;
    background: rgb(255 250 245 / 97%);
    border-bottom-color: #dfd0c4;
  }

  body.storefront .header .brand img {
    width: 76px;
  }

  body.storefront .header > .brand {
    order: 1;
    margin-right: auto;
  }

  body.storefront .header nav {
    order: 3;
    flex: 1 0 100%;
    justify-content: space-between;
    gap: 4px;
    width: 100%;
    min-width: 0;
    border-top: 1px solid var(--line);
  }

  body.storefront .header nav a,
  body.storefront .header nav button {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 8px 3px;
    font-size: .76rem;
    text-align: center;
    line-height: 1.2;
    white-space: normal;
  }

  body.storefront #bag-button {
    order: 2;
    min-height: 44px;
    background: #f1e4eb;
    border-color: #d8bdcd;
  }

  body.storefront .hero-band {
    padding-top: 14px;
  }

  body.storefront .hero {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr);
    gap: 16px;
    min-height: 0;
    padding: 14px 18px;
    border: 0;
    border-radius: 18px;
    background: #4e3443;
    box-shadow: none;
  }

  body.storefront .hero-copy {
    min-width: 0;
    max-width: none;
    padding-block: 0;
  }

  body.storefront .hero-copy::before {
    display: none;
  }

  body.storefront .hero .hero-kicker {
    margin: 0 0 6px;
    color: #e5cbb9;
    font-size: .6rem;
    line-height: 1.4;
    letter-spacing: .1em;
  }

  body.storefront .hero h1 {
    max-width: 18ch;
    margin: 0 0 8px;
    color: #fff8f0;
    font-size: clamp(1.45rem, 5.7vw, 2rem);
    line-height: 1.08;
    letter-spacing: -.025em;
  }

  body.storefront #hero-text {
    margin: 0 0 10px;
    color: #efdfd8;
    font-size: .76rem;
    line-height: 1.4;
  }

  body.storefront .hero-actions {
    margin: 0;
  }

  body.storefront .hero-actions .button {
    flex: 0 1 auto;
    min-height: 44px;
    padding: 9px 13px;
    border-color: transparent;
    background: #f5e7d8;
    color: #4e3443;
    font-size: .76rem;
    font-weight: 650;
    box-shadow: none;
  }

  body.storefront .hero-photo {
    justify-self: end;
    align-self: center;
    width: 100%;
    max-width: 126px;
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
  }

  body.storefront .hero-photo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 168px;
    aspect-ratio: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: none;
  }

  body.storefront .service-strip {
    padding-block: 10px;
    margin-bottom: 0;
    border-color: #e3d6cc;
  }

  body.storefront .service-note {
    color: #6b4f5e;
    font-size: .72rem;
  }

  body.storefront #coleccion {
    padding-top: 20px;
  }

  body.storefront .mobile-discovery {
    display: block;
    min-width: 0;
    margin-bottom: 22px;
    max-width: 100%;
    overflow-x: clip;
  }

  /* Let the audience cards be the first decision on a phone. The product
     catalogue appears only after a customer chooses a product family inside
     that public, so the first screen stays calm and scannable. */
  body.storefront:not(.mobile-browse-ready) .catalog-toolbar,
  body.storefront:not(.mobile-browse-ready) #catalog-filter-summary,
  body.storefront:not(.mobile-browse-ready) #collection-type-field,
  body.storefront:not(.mobile-browse-ready) #filters,
  body.storefront:not(.mobile-browse-ready) #catalog-results {
    display: none !important;
  }
  body.storefront .mobile-discovery-empty-note {
    margin: 18px 0 0;
    color: #806d75;
    font-size: .82rem;
    text-align: center;
  }
  body.storefront .mobile-discovery-empty-note[hidden] { display: none; }

  body.storefront .mobile-discovery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    margin-bottom: 6px;
  }

  body.storefront .mobile-discovery-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
  }

  body.storefront .mobile-reset-selection {
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid #d8bdcd;
    border-radius: 999px;
    background: #fffaf5;
    color: #67475a;
    font-size: .68rem;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
  }

  body.storefront .mobile-reset-selection[hidden] { display: none; }

  body.storefront .mobile-discovery-header h2 {
    margin: 0;
    color: var(--deep);
    font: 400 1.6rem/1.15 var(--serif);
    letter-spacing: -.015em;
  }

  body.storefront.catalog-navigation-ready .mobile-discovery #catalog-browse-toggle {
    display: none;
    flex: 0 0 auto;
    justify-content: center;
    gap: 9px;
    width: auto;
    min-height: 44px;
    margin: 0;
    padding: 8px 0 8px 10px;
    border: 0;
    background: transparent;
    color: #67475a;
    font-size: .76rem;
    font-weight: 550;
  }

  body.storefront .mobile-discovery #catalog-browse-selection {
    display: none;
  }

  body.storefront #mobile-audiences {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--mobile-audience-card-width);
    justify-content: start;
    gap: 10px;
    margin: 0 -4px 16px;
    padding: 4px 4px 11px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 4px;
    scrollbar-width: thin;
    scrollbar-color: #c5a8b8 transparent;
    -webkit-overflow-scrolling: touch;
  }

  body.storefront #mobile-audiences button,
  body.storefront #mobile-audiences .mobile-audience-card {
    display: grid;
    grid-template-rows: auto auto;
    align-content: start;
    gap: 6px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    min-height: 0;
    aspect-ratio: auto;
    padding: 0;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: #725765;
    font-size: .76rem;
    font-weight: 550;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    box-shadow: none;
    scroll-snap-align: start;
  }

  body.storefront #mobile-audiences button[aria-pressed="true"],
  body.storefront #mobile-audiences .mobile-audience-card.is-selected {
    color: var(--deep);
    font-weight: 700;
  }

  body.storefront .mobile-rail-label,
  body.storefront .mobile-subcategory-label {
    margin: 0 0 5px;
    color: #806b73;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .11em;
    line-height: 1.2;
    text-transform: uppercase;
  }

  body.storefront .mobile-subcategory-label[hidden] { display: none; }

  body.storefront .mobile-audience-image {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    min-width: 0;
    height: auto;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 10px;
    background: transparent;
  }

  body.storefront .mobile-audience-image::before {
    content: '✦';
    color: #937989;
    font: 400 1.25rem/1 var(--serif);
  }

  body.storefront .mobile-audience-image img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
  }

  /* A portrait frame preserves the entire original photo, including future
     admin uploads. Fallback symbols must not show through the spare space
     around a photo whose proportions differ from the frame. */
  body.storefront .mobile-audience-image:has(img)::before,
  body.storefront .mobile-category-image:has(img) .mobile-category-symbol {
    display: none;
  }

  body.storefront .mobile-audience-name {
    display: block;
    min-width: 0;
    padding-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.storefront #mobile-category-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--mobile-category-card-width);
    justify-content: start;
    gap: 12px;
    margin-inline: -4px;
    padding: 4px 4px 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 4px;
    scrollbar-width: thin;
    scrollbar-color: #c5a8b8 transparent;
    -webkit-overflow-scrolling: touch;
  }

  body.storefront .mobile-category-card {
    display: grid;
    align-content: start;
    justify-items: center;
    gap: 9px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #674c5b;
    text-align: center;
    scroll-snap-align: start;
  }

  body.storefront #mobile-category-rail.is-looping {
    display: block;
    scroll-snap-type: none;
    scroll-behavior: auto;
    overflow-anchor: none;
    scrollbar-width: none;
    overscroll-behavior-x: none;
  }

  body.storefront #mobile-audiences.is-looping {
    display: block;
    scroll-snap-type: none;
    scroll-behavior: auto;
    overflow-anchor: none;
    scrollbar-width: none;
    overscroll-behavior-x: none;
  }

  body.storefront #mobile-audiences.is-looping::-webkit-scrollbar {
    display: none;
  }

  body.storefront .mobile-carousel-track {
    position: relative;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--mobile-category-card-width);
    gap: 12px;
    width: max-content;
  }

  /* Release the promoted layer whenever the customer scrolls or the rail is
     offscreen, so Safari paints the cards through native scrolling. */
  body.storefront .is-auto-moving > .mobile-carousel-track {
    will-change: transform;
  }

  /* Keep the audience cards the same comfortable width while their duplicated
     track is moving. */
  body.storefront #mobile-audiences.is-looping .mobile-carousel-track {
    grid-auto-columns: var(--mobile-audience-card-width);
    gap: 10px;
  }

  body.storefront #mobile-category-rail.is-looping::-webkit-scrollbar {
    display: none;
  }

  body.storefront [data-carousel-kind] {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
  }

  body.storefront .mobile-category-image {
    display: grid;
    place-items: center;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    background: transparent;
  }

  body.storefront .mobile-category-image > * {
    grid-area: 1 / 1;
  }

  body.storefront .mobile-category-image img {
    display: block;
    z-index: 1;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
    object-position: center;
    border-radius: 10px;
    background: transparent;
  }

  body.storefront .mobile-category-symbol {
    display: block;
    width: 38px;
    height: 38px;
    color: #8c667d;
  }

  body.storefront .mobile-category-name {
    display: block;
    max-width: 100%;
    padding-inline: 1px;
    padding-bottom: 6px;
    font-size: .78rem;
    font-weight: 550;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  body.storefront .mobile-category-card:first-child .mobile-category-name {
    font-size: .73rem;
    line-height: 1.22;
  }

  body.storefront .mobile-category-card[aria-pressed="true"],
  body.storefront .mobile-category-card.is-selected {
    color: var(--deep);
  }

  /* The photograph is the reference: no card panel or selected fill. A
     persistent underline identifies the current choice, including clones. */
  body.storefront #mobile-audiences button[aria-pressed="true"] .mobile-audience-name,
  body.storefront #mobile-audiences .mobile-audience-card.is-selected .mobile-audience-name,
  body.storefront .mobile-category-card[aria-pressed="true"] .mobile-category-name,
  body.storefront .mobile-category-card.is-selected .mobile-category-name {
    font-weight: 750;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
  }

  body.storefront #mobile-subcategories {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 12px -4px 0;
    padding: 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 4px;
    scrollbar-width: thin;
    scrollbar-color: #c5a8b8 transparent;
  }

  body.storefront #mobile-subcategories button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 9px 14px;
    border: 1px solid #d9c7bc;
    border-radius: 999px;
    background: #fffaf5;
    color: #684b5c;
    font-size: .74rem;
    line-height: 1.35;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  body.storefront #mobile-subcategories button[aria-pressed="true"] {
    border-color: var(--deep);
    background: var(--deep);
    color: #fff9f3;
  }

  body.storefront .mobile-discovery button:focus-visible {
    outline: 2px solid #79556d;
    outline-offset: 2px;
  }

  body.storefront .catalog-content .catalog-toolbar {
    gap: 12px;
    margin-bottom: 18px;
  }

  body.storefront .catalog-content .section-title {
    gap: 4px 10px;
    padding-bottom: 0;
  }

  body.storefront .catalog-content .collection-kicker,
  body.storefront .catalog-content .catalog-intro {
    display: none;
  }

  body.storefront .catalog-content .section-title h2 {
    margin: 0;
    color: var(--deep);
    font-size: 1.55rem;
  }

  body.storefront .catalog-content #result-count {
    color: #7c6270;
    font-size: .74rem;
  }

  body.storefront .catalog-content .searchbar {
    gap: 8px;
  }

  body.storefront .catalog-content .search input {
    min-height: 44px;
    padding-block: 10px;
    border-color: #d9c7bc;
    background: #fffaf6;
    font-size: 16px;
  }

  body.storefront .catalog-content #filter-toggle,
  body.storefront .catalog-content #favorites-toggle,
  body.storefront .catalog-content .sort-trigger {
    min-height: 44px;
    border-color: #d9c7bc;
    background: #fffaf6;
    font-size: .76rem;
  }

  body.storefront .catalog-content #filter-toggle[aria-expanded="true"],
  body.storefront .catalog-content .sort-trigger[aria-expanded="true"] {
    border-color: #b491a6;
    background: #efdee8;
    color: var(--deep);
  }

  body.storefront .catalog-content .active-filter-chips {
    margin-bottom: 16px;
  }
}

/* Compact, image-led rails for phones. They mirror the reference storefront:
   choose a public first, then reveal only the product families for it. */
@media (max-width: 900px) {
  body.storefront .mobile-discovery {
    margin-bottom: 24px;
  }
  body.storefront .mobile-discovery-header {
    min-height: 48px;
    margin-bottom: 8px;
  }
  body.storefront .mobile-discovery-header h2 {
    font-size: clamp(1.7rem, 7.2vw, 2.1rem);
    letter-spacing: -.025em;
  }
  body.storefront #mobile-audiences {
    grid-auto-columns: var(--mobile-audience-card-width);
    gap: 12px;
    margin-inline: -6px;
    padding: 4px 6px 13px;
  }
  body.storefront #mobile-audiences button,
  body.storefront #mobile-audiences .mobile-audience-card {
    gap: 8px;
    border-radius: 19px;
    color: #67475a;
    font-size: .79rem;
  }
  body.storefront .mobile-audience-image {
    border-radius: 13px;
  }
  body.storefront .mobile-rail-label,
  body.storefront .mobile-subcategory-label {
    margin-top: 4px;
    margin-bottom: 7px;
    color: #735c67;
    font-size: .66rem;
    letter-spacing: .14em;
  }
  body.storefront #mobile-category-rail {
    grid-auto-columns: var(--mobile-category-card-width);
    gap: 12px;
    margin-inline: -6px;
    padding: 4px 6px 12px;
  }
  body.storefront .mobile-category-card {
    gap: 8px;
    min-height: 0;
    border-radius: 17px;
    box-shadow: none;
  }
  body.storefront .mobile-category-image {
    width: 100%;
    height: auto;
    border: 0;
    border-radius: 13px;
    background: transparent;
  }
  body.storefront .mobile-category-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 10px;
  }
  body.storefront .mobile-category-name {
    color: #67475a;
    font-size: .77rem;
    font-weight: 650;
  }
  /* A compact social row keeps the mobile entrance useful even before the
     account URLs are configured in the admin panel. Placeholder labels turn
     into links automatically once a profile is published. */
  body.storefront .mobile-socials {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: -2px 0 24px;
    padding: 12px 0 0;
    border-top: 1px solid #e3d6cc;
  }
  body.storefront .mobile-socials[hidden] { display: none; }
  body.storefront .mobile-socials a,
  body.storefront .mobile-socials .social-placeholder {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid #dccbc0;
    border-radius: 999px;
    background: #fffaf5;
    color: #67475a;
    font-size: .7rem;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 7px 16px -16px rgb(63 39 54 / 80%);
  }
  body.storefront .mobile-socials a:hover,
  body.storefront .mobile-socials a:focus-visible {
    border-color: #725064;
    background: #f0e4eb;
    outline: 2px solid #b491a6;
    outline-offset: 2px;
  }
  body.storefront .mobile-socials .social-placeholder {
    color: #8c7780;
    cursor: default;
  }
}

@media (min-width: 901px) {
  body.storefront .mobile-socials { display: none; }
}

@media (max-width: 360px) {
  body.storefront .hero {
    gap: 12px;
    padding: 12px 14px;
  }
  body.storefront .hero .hero-kicker { font-size: .56rem; }
  body.storefront .hero h1 { font-size: 1.45rem; }
  body.storefront #hero-text { font-size: .71rem; }
  body.storefront .hero-actions .button { padding-inline: 10px; font-size: .72rem; }
  body.storefront #mobile-audiences button { font-size: .7rem; }
  body.storefront #mobile-category-rail { grid-auto-columns: var(--mobile-category-card-width); gap: 12px; }
}

/* Preserve portrait photo proportions at every phone width. Card height
   follows the image frame instead of forcing a landscape crop. */
@media (max-width: 600px) {
  body.storefront #mobile-audiences {
    grid-auto-columns: var(--mobile-audience-card-width);
    gap: 12px;
    padding-inline: 7px;
    scroll-padding-inline: 7px;
  }
  body.storefront #mobile-audiences.is-looping .mobile-carousel-track {
    grid-auto-columns: var(--mobile-audience-card-width);
    gap: 12px;
  }
  body.storefront #mobile-audiences button,
  body.storefront #mobile-audiences .mobile-audience-card {
    border-radius: 20px;
    font-size: .84rem;
  }
  body.storefront .mobile-audience-image {
    border-radius: 14px;
  }
}

/* Turning the phone changes card widths, never the photo proportions. */
@media (max-width: 900px) and (orientation: landscape) {
  body.storefront {
    --mobile-audience-card-width: clamp(132px, 36vh, 168px);
    --mobile-category-card-width: clamp(116px, 32vh, 144px);
  }

  body.storefront #mobile-audiences,
  body.storefront #mobile-category-rail {
    scroll-snap-type: x proximity;
    scroll-padding-inline: 8px;
  }

}

@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  body.storefront #mobile-category-rail,
  body.storefront #mobile-subcategories {
    scroll-behavior: smooth;
  }

  body.storefront .mobile-discovery button,
  body.storefront .mobile-category-image {
    transition: transform 180ms ease, background-color 250ms ease,
      border-color 250ms ease, color 250ms ease;
  }

  body.storefront .mobile-discovery button:not(.mobile-category-card):not(:disabled):active {
    transform: scale(.97);
  }
}

@media (max-width: 900px) and (forced-colors: active) {
  body.storefront .mobile-category-image { border-color: CanvasText; }
  body.storefront .mobile-discovery button[aria-pressed="true"] {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
}

/* Keep the mobile masthead visually centered like the reference storefront.
   The grid reserves equal space on both sides of the brand, so the bag can
   remain on the right without nudging the logo off the optical centre. */
@media (max-width: 900px) {
  body.storefront .header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    justify-content: initial;
    gap: 5px 10px;
    padding-inline: clamp(12px, 4vw, 20px);
  }

  body.storefront .header > .brand {
    grid-column: 2;
    grid-row: 1;
    order: initial;
    justify-self: center;
    margin: 0;
    min-width: 0;
  }

  body.storefront .header > .brand img {
    display: block;
    width: clamp(92px, 24vw, 122px);
    height: auto;
  }

  body.storefront .header > #bag-button {
    grid-column: 3;
    grid-row: 1;
    order: initial;
    justify-self: end;
    max-width: min(160px, 40vw);
    min-width: 0;
  }

  body.storefront .header nav {
    grid-column: 1 / -1;
    grid-row: 2;
    order: initial;
    flex: initial;
    width: 100%;
  }
}

@media (max-width: 360px) {
  body.storefront .header {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    padding-inline: 12px;
  }

  body.storefront .header > .brand img { width: 92px; }
  body.storefront .header > #bag-button {
    max-width: 128px;
    padding-inline: 8px;
    gap: 6px;
  }
}

/* A compact bag leaves the centered brand clear on narrow phones. */
@media(max-width:480px){.storefront .header #bag-button{min-height:44px;padding:9px 12px;gap:7px}.storefront .header #bag-button .bag-label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}
