/* ==========================================================================
   AURELIA — Responsive layer
   Everything breakpoint-specific lives here so style.css stays declarative.
   Order: widest override first, narrowing downward.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Large desktop trim
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .nav__list { gap: .8rem; }
  .nav__link { font-size: 11px; letter-spacing: .07em; }
  .brand__tag { display: none; }
  .p-grid--4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shop-layout { grid-template-columns: 230px 1fr; }
}

@media (max-width: 1160px) {
  /* Nav no longer fits comfortably — trim the deep category links. */
  .nav__item--optional { display: none; }
  .rail--5 { grid-auto-columns: calc((100% - 3 * 1.4rem) / 4); }
}

/* --------------------------------------------------------------------------
   Tablet — the desktop chrome gives way to drawer navigation
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  :root { --header-h: 66px; --announce-h: 34px; }

  body { padding-bottom: 62px; }           /* clears the fixed tab bar */

  .header { grid-template-columns: auto 1fr auto; }
  .header__burger { display: inline-flex; }
  .nav { display: none; }
  .brand { justify-self: center; }
  .header__actions .icon-btn--account { display: none; }

  .tabbar { display: block; }
  .float-stack { bottom: calc(62px + 1rem); }
  .toast-stack { bottom: calc(62px + 1rem); }
  .cookie { bottom: calc(62px + 1rem); }

  /* Hero stacks into an image-first editorial block */
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero__media { aspect-ratio: 4 / 3.4; order: -1; }
  .hero__copy { margin-inline: auto; padding-block: clamp(2.25rem, 6vw, 3.5rem); max-width: 100%; }
  .hero__title { font-size: clamp(2.1rem, 7vw, 3rem); }
  .hero__caption { display: none; }

  .trust-strip__list { grid-template-columns: repeat(2, 1fr); }
  .trust-strip__item:nth-child(2) { border-right: 0; }
  .trust-strip__item:nth-child(-n+2) { border-bottom: 1px solid var(--color-border); }

  .aud-grid { grid-template-columns: 1fr; }
  .aud-card { aspect-ratio: 16 / 10; }

  .coll-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: clamp(220px, 30vw, 300px); }
  .coll-card--lg { grid-column: span 4; }

  .why-grid { grid-template-columns: repeat(2, 1fr); }
  .offer-grid { grid-template-columns: repeat(2, 1fr); }
  .offer:nth-child(2) { border-right: 0; }
  .offer:nth-child(-n+2) { border-bottom: 1px solid var(--color-border); }

  .insta-grid { grid-template-columns: repeat(4, 1fr); }

  .newsletter__inner { grid-template-columns: 1fr; gap: 2rem; }
  .footer__top { grid-template-columns: 1fr 1fr; gap: 2.25rem; }
  .footer__brand { grid-column: 1 / -1; }

  .search-ov__body { grid-template-columns: 1fr; }
  .search-results { grid-template-columns: 1fr 1fr; }

  /* Product detail collapses to a single column */
  .pdp { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .gallery__thumbs { flex-direction: row; order: 2; }
  .gallery__thumb { width: 74px; flex: none; }
  .gallery__stage { cursor: default; }
  .rev-summary { grid-template-columns: 1fr; gap: 1.75rem; }
  .rev-grid { grid-template-columns: 1fr; }

  /* Cart + checkout stack, summary drops below the items */
  .cart-layout { grid-template-columns: 1fr; }
  .summary { position: static; }

  .editorial { grid-template-columns: 1fr; }
  .editorial__media { aspect-ratio: 16/10; }
  .contact-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--color-border); }

  /* Filters move into a drawer, triggered by a floating button */
  .shop-layout { grid-template-columns: 1fr; }
  .filters-desktop { display: none; }
  .filter-fab {
    display: inline-flex;
    position: fixed;
    left: 50%; transform: translateX(-50%);
    bottom: calc(62px + 1rem);
    z-index: 305;
    align-items: center; gap: .55rem;
    padding: 13px 24px;
    background: var(--color-primary); color: #fff;
    border-radius: 40px;
    box-shadow: var(--shadow-lg);
    font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600;
  }
  .filter-fab svg { width: 15px; height: 15px; }
  .filter-fab__count {
    min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--color-gold); border-radius: 10px;
    display: grid; place-items: center; font-size: 10px;
  }
}

/* --------------------------------------------------------------------------
   Small tablet / large phone
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .section-head { flex-direction: column; align-items: flex-start; gap: 1.1rem; }
  .qv { grid-template-columns: 1fr; }
  .qv__media { padding: 1rem; }
  .qv__main { aspect-ratio: 1 / 1; }
  .p-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flash__inner { flex-direction: column; align-items: flex-start; }
  .promo { min-height: 420px; }
  .cart-line { grid-template-columns: 86px 1fr; }
  .cart-line__price { grid-column: 2; text-align: left; }
}

/* --------------------------------------------------------------------------
   Phone — the layout is rebuilt, not merely narrowed
   -------------------------------------------------------------------------- */
@media (max-width: 700px) {
  :root { --gutter: 1.15rem; }

  body { font-size: 14.5px; }

  .announce__inner { font-size: 9px; letter-spacing: .12em; gap: .5rem; }
  .announce__inner span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Two-up product grid with the quick-add promoted into the card body,
     because hover-revealed actions are unreachable on touch. */
  .p-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem .8rem; }
  .p-card__actions { display: none; }
  .p-card__quick { display: block; }
  .p-card__desc { display: none; }
  .p-card__name { font-size: 14.5px; }
  .p-card__wish { width: 30px; height: 30px; }
  .p-card__wish svg { width: 14px; height: 14px; }

  /* List view is a desktop affordance and its toggle is hidden here, so a
     saved list preference must not strand phone users in a stretched layout. */
  .p-grid.is-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem .8rem; }
  .p-grid.is-list .p-card {
    display: flex; flex-direction: column; align-items: stretch;
    grid-template-columns: none;
    padding-block: 0; border-bottom: 0;
  }
  .p-grid.is-list .p-card__body { padding-top: .95rem; }
  .p-grid.is-list .p-card__desc { display: none; }
  .p-grid.is-list .p-card__quick { display: block; width: auto; padding-inline: 0; }

  /* Rails stay horizontal — they read as intentional on a phone.
     Capped so the same rule does not produce giant cards on a small tablet. */
  .rail, .rail--4, .rail--5 { grid-auto-columns: min(62vw, 272px); }
  .rail-nav { display: none; }

  .cat-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: min(42vw, 190px);
    gap: .7rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
  }
  .cat-grid::-webkit-scrollbar { display: none; }
  .cat-grid > * { scroll-snap-align: start; }
  .cat-card__go { opacity: 1; transform: none; }

  .coll-grid { grid-template-columns: 1fr 1fr; grid-auto-rows: clamp(190px, 44vw, 260px); }
  .coll-card { grid-column: span 1; }
  .coll-card--lg { grid-column: span 2; }
  .coll-card__go { opacity: 1; transform: none; }

  .gift-grid { grid-template-columns: 1fr 1fr; }
  .gift-card { flex-direction: column; align-items: flex-start; gap: .65rem; padding: .6rem; }
  .gift-card__thumb { width: 100%; height: 96px; }

  .why-grid { grid-template-columns: 1fr; }
  .offer-grid { grid-template-columns: 1fr; }
  .offer { border-right: 0; border-bottom: 1px solid var(--color-border); }
  .offer:last-child { border-bottom: 0; }

  .insta-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }

  .trust-strip__item { font-size: 9.5px; letter-spacing: .06em; padding: .9rem .6rem; gap: .45rem; }

  .hero__cta { flex-direction: column; align-items: stretch; }
  .hero__cta .btn { width: 100%; }
  .hero__stats { gap: 1.25rem; }
  .hero__stat strong { font-size: 1.15rem; }
  .hero__stat span { font-size: 9px; letter-spacing: .1em; }

  .countdown__unit { min-width: 60px; padding: .65rem .35rem; }
  .countdown__num { font-size: 1.4rem; }

  .search-results { grid-template-columns: 1fr; }
  .search-ov__field input { font-size: 1.35rem; }

  .modal { padding: 0; align-items: flex-end; }
  .modal__panel {
    max-height: 92vh;
    border-radius: 10px 10px 0 0;
    transform: translateY(40px);
  }
  .modal.is-open .modal__panel { transform: translateY(0); }

  .drawer { width: 100vw; }

  /* A full-width drawer leaves nowhere to step aside to, so toasts move up top. */
  body:has(.drawer.is-open) .toast-stack {
    left: 1rem; right: 1rem; bottom: auto;
    top: calc(var(--header-h) + 1rem);
  }
  body:has(.drawer.is-open) .toast { width: 100%; min-width: 0; }

  .field-row { grid-template-columns: 1fr; }
  .trust-list { grid-template-columns: 1fr; }
  .spec { grid-template-columns: 120px 1fr; }

  .pdp__buy { flex-wrap: wrap; }
  .pdp__buy .btn { flex: 1 1 100%; }
  .wish-btn { width: 100%; height: 50px; }

  .footer__top { grid-template-columns: 1fr; gap: 2rem; }
  .footer__bottom { flex-direction: column; align-items: flex-start; gap: 1rem; padding-right: 0; }

  .shop-bar { gap: .6rem; }
  .shop-bar__tools { width: 100%; }
  .select-wrap, .select-wrap select { flex: 1; width: 100%; }
  .view-toggle { display: none; }

  .stat-grid { grid-template-columns: 1fr 1fr; }
  .section-title { font-size: clamp(1.5rem, 6.5vw, 2rem); }
}

/* --------------------------------------------------------------------------
   Very small phones
   -------------------------------------------------------------------------- */
@media (max-width: 400px) {
  .p-grid { gap: 1.25rem .6rem; }
  .rail, .rail--4, .rail--5 { grid-auto-columns: 70vw; }
  .cat-grid { grid-auto-columns: 52vw; }
  .brand__mark { font-size: 1.2rem; letter-spacing: .22em; }
  .btn { padding: 14px 22px; font-size: 10.5px; }
  .toast { min-width: 0; width: calc(100vw - 2rem); }
}

/* --------------------------------------------------------------------------
   Touch devices — hover states are unreliable, so surface actions permanently
   -------------------------------------------------------------------------- */
@media (hover: none) {
  .p-card__actions { opacity: 1; transform: none; }
  .cat-card__go, .coll-card__go { opacity: 1; transform: none; }
  .p-card:hover { transform: none; }
}

/* --------------------------------------------------------------------------
   Print — a clean order/product sheet
   -------------------------------------------------------------------------- */
@media print {
  .header-shell, .tabbar, .float-stack, .cookie, .toast-stack,
  .drawer, .scrim, .modal, .search-ov, .newsletter, .filter-fab { display: none !important; }
  body { background: #fff; padding: 0; }
  .section { padding-block: 1rem; }
  a { text-decoration: none; color: #000; }
}
