/* ==========================================================================
   BONACIEUX: Layout: header, nav, drawer, footer, grids
   ========================================================================== */

/* --- Header ---------------------------------------------------------------
   Three columns: nav, centred wordmark, actions. The wordmark is optically
   centred on the page, not on the space left over by the nav. */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(245, 241, 235, 0.92);
  backdrop-filter: saturate(130%) blur(10px);
  border-bottom: 1px solid rgba(20, 17, 15, 0.13);
}
.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4);
  min-height: 5.5rem;
}

/* Brand lockup */
.brand {
  justify-self: center;
  font-family: var(--font-script);
  font-size: clamp(1.9rem, 1.5rem + 1.4vw, 2.4rem);
  line-height: 1;
  padding-bottom: 6px;   /* the script's descenders need the room */
}
.brand:hover { color: var(--ink); }

/* Primary nav (desktop) */
.nav { justify-self: start; }
.nav__list { display: flex; align-items: center; gap: var(--space-5); list-style: none; }
.nav__link {
  position: relative;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding-block: 0.5rem;
  white-space: nowrap;
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.nav__link:hover::after,
.nav__link[aria-current="page"]::after { transform: scaleX(1); }

/* Dropdown */
.nav__item--has-menu { position: relative; }
.nav__menu {
  position: absolute;
  top: 100%; left: 0;
  transform: translateY(6px);
  min-width: 13rem;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  padding: var(--space-2) 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.nav__item--has-menu:hover .nav__menu,
.nav__item--has-menu:focus-within .nav__menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.nav__menu a {
  display: block;
  padding: 0.6rem var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav__menu a:hover { background: var(--paper-2); color: var(--gold-deep); }

/* Header actions */
.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.icon-btn {
  position: relative;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  transition: background var(--dur) var(--ease);
}
.icon-btn:hover { background: rgba(20, 17, 15, 0.06); }
.icon-btn svg { width: 19px; height: 19px; }
.nav-toggle { display: none; }

/* --- Mobile drawer -------------------------------------------------------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(20, 17, 15, 0.5);
  z-index: var(--z-overlay);
  opacity: 0; visibility: hidden;
  transition: opacity var(--dur) var(--ease);
}
.overlay.is-open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(86vw, 380px);
  height: 100dvh;
  z-index: var(--z-drawer);
  background: var(--paper);
  border-left: 1px solid var(--line);
  padding: var(--space-4);
  transform: translateX(100%);
  /* visibility, not transform alone: a translated-off drawer keeps its links
     and steppers in the tab order, so a keyboard user lands inside an element
     the a11y tree has already hidden with aria-hidden. Same reasoning as the
     shop filter rail in pages.css. */
  visibility: hidden;
  transition: transform var(--dur) var(--ease), visibility var(--dur);
  overflow-y: auto;
}
.drawer.is-open { transform: translateX(0); visibility: visible; }
.drawer__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.drawer__title { font-family: var(--font-script); font-size: 1.9rem; line-height: 1; }
.drawer__label {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.drawer__list { list-style: none; display: flex; flex-direction: column; }
.drawer__list a {
  display: block;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: var(--step-2);
}
.drawer__sub a {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-left: var(--space-3);
}

/* --- Mini-cart drawer ----------------------------------------------------- */
.drawer--cart { width: min(92vw, 440px); display: flex; flex-direction: column; padding: 0; }
.mini-cart__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--line);
}
.mini-cart__items { flex: 1 1 auto; overflow-y: auto; padding: 0 var(--space-4); }
.mini-cart__line {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--line);
}
.mini-cart__media { aspect-ratio: 4/5; background: var(--paper-2); overflow: hidden; }
.mini-cart__media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.mini-cart__name { font-family: var(--font-display); font-size: var(--step-1); line-height: 1.15; }
.mini-cart__meta {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}
.mini-cart__line .qty { margin-top: var(--space-2); }
.mini-cart__aside {
  display: flex; flex-direction: column; justify-content: space-between;
  align-items: flex-end; text-align: right;
  font-family: var(--font-ui); font-size: var(--step--1);
}
.mini-cart__remove {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.mini-cart__remove:hover { color: var(--danger); }
.mini-cart__foot { padding: var(--space-4); border-top: 1px solid var(--line); background: var(--paper); }
.mini-cart__ship {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}
.mini-cart__subtotal {
  display: flex; justify-content: space-between;
  font-size: var(--step-2); margin-bottom: var(--space-3);
}
.mini-cart__foot .center { margin-top: var(--space-3); }
.mini-cart__empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

/* --- Footer --------------------------------------------------------------- */
.site-footer {
  background: var(--ink);
  color: rgba(245, 241, 235, 0.78);
  padding: var(--space-6) 0 var(--space-4);
  font-family: var(--font-ui);
  font-weight: 300;
}
.site-footer a { color: rgba(245, 241, 235, 0.78); }
.site-footer a:hover { color: var(--gold); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: var(--space-6);
}
.footer-brand { display: flex; flex-direction: column; gap: var(--space-3); }
.footer-brand__word { font-family: var(--font-script); font-size: 2.6rem; line-height: 1; color: var(--paper); }
.footer-brand__tag { font-family: var(--font-display); font-style: italic; font-size: var(--step-1); }
.footer-col h2 {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--space-3);
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.footer-col ul a,
.footer-col ul span { font-size: var(--step--1); letter-spacing: 0.12em; }
.footer-col ul span { opacity: 0.65; }
.newsletter__note {
  font-family: var(--font-display);
  font-size: var(--step-0);
  letter-spacing: 0;
  opacity: 0.7;
  margin-bottom: var(--space-2);
}
.newsletter { display: flex; gap: var(--space-2); align-items: flex-end; }
.newsletter .input {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  border-bottom-color: rgba(245, 241, 235, 0.3);
  color: var(--paper);
}
.newsletter .input::placeholder { color: rgba(245, 241, 235, 0.5); }
.newsletter .input:focus { border-bottom-color: var(--gold); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(245, 241, 235, 0.14);
  font-size: var(--step--1);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(245, 241, 235, 0.5);
}
.footer-bottom__links { display: flex; gap: var(--space-4); flex-wrap: wrap; }

/* --- Product grid --------------------------------------------------------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6) var(--space-4);
}
.product-grid--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.product-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* --- Breadcrumb ----------------------------------------------------------- */
.breadcrumb {
  padding-block: var(--space-4) 0;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 300;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; color: var(--text-muted); }
.breadcrumb li:not(:last-child)::after { content: "/"; margin-left: 0.5rem; color: var(--line); }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 980px) {
  .nav { display: none; }
  .nav-toggle { display: grid; }
  .site-header__inner { grid-template-columns: auto 1fr auto; gap: var(--space-2); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-5); }
  .product-grid--four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  /* One-up product cards turn any grid into a ~700px-per-item scroll; two-up is
     the shape shoppers expect on a phone and keeps four cards on screen. */
  .product-grid,
  .product-grid--three { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5) var(--space-2); }
  .container { padding-inline: var(--space-4); }
  /* Drawer links: real 48px rows rather than text-height hit areas. */
  .drawer__list a { padding: var(--space-3) var(--space-1); min-height: 48px; }
  .footer-col ul { gap: 0; }
  .footer-col ul a { display: block; padding-block: 0.55rem; }
  .footer-bottom { justify-content: flex-start; gap: var(--space-2); }
}

@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .site-header__inner { min-height: 4.25rem; }
  .container { padding-inline: var(--space-3); }
  /* Keep the 44px touch target but let the buttons overlap the header's own
     inline padding, so both still fit beside the wordmark. */
  .header-actions { gap: 0; margin-right: calc(var(--space-2) * -1); }
  .icon-btn { width: 44px; height: 44px; }
  .nav-toggle { margin-left: calc(var(--space-2) * -1); }
  .header-actions .icon-btn--search { display: none; }
  /* The badge hangs outside its button, which clears the viewport once the
     actions are pulled into the header's padding; tuck it back inside. */
  .header-actions .badge { top: 2px; right: 2px; }
  .brand { font-size: 1.7rem; }
}
