/* ==========================================================================
   BILORAUX — components.css
   Buttons, header, nav, footer, cart drawer, forms, badges, dividers.
   Shared across every page. Header / footer / cart-drawer markup is
   byte-identical per page (see TEMPLATE-PART comments in the HTML).
   ========================================================================== */

/* ==========================================================================
   1. BUTTONS  (contrast law: ink bg / white text. Gold never carries text
      on light. Every state passes WCAG AA. Min target 44px.)
   ========================================================================== */
.btn {
  --_bg: var(--ink);
  --_fg: var(--on-ink);
  --_bd: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 500;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  color: var(--_fg);
  background: var(--_bg);
  border: 1.5px solid var(--_bd);
  border-radius: var(--radius);
  touch-action: manipulation;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition),
              transform var(--transition);
}
.btn:hover { box-shadow: inset 0 0 0 1.5px var(--line-gold); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Secondary — transparent, ink outline, ink text */
.btn--secondary {
  --_bg: transparent;
  --_fg: var(--ink);
  --_bd: var(--ink);
}
.btn--secondary:hover {
  --_bg: var(--ink);
  --_fg: var(--on-ink);
  box-shadow: inset 0 0 0 1.5px var(--line-gold);
}

/* Ghost — text-only, for tertiary links styled as buttons */
.btn--ghost {
  --_bg: transparent;
  --_fg: var(--ink);
  --_bd: transparent;
  padding-inline: 0.5rem;
}
.btn--ghost:hover { box-shadow: none; text-decoration: underline; text-underline-offset: 0.2em; }

/* On dark bands, invert */
.band--ink .btn--secondary { --_fg: var(--on-ink); --_bd: var(--on-ink); }
.band--ink .btn--secondary:hover { --_bg: var(--on-ink); --_fg: var(--ink); }

.btn--block { width: 100%; }
.btn--lg { min-height: 52px; padding: 0.9rem 2rem; font-size: var(--step-1); }

/* ==========================================================================
   2. ANNOUNCEMENT BAR
   ========================================================================== */
.announce {
  background: var(--ink);
  color: var(--on-ink);
  font-size: var(--step--1);
  letter-spacing: 0.02em;
}
.announce__viewport {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding-block: 0.5rem;
  text-align: center;
}
.announce__msg {
  margin: 0;
  color: var(--on-ink);
}
.announce__msg b { color: var(--gold-soft); font-weight: 600; }
/* Rotator crossfade (JS-driven). Reduced-motion: JS shows one static msg. */
.announce__msg[hidden] { display: none; }
.announce__msg {
  animation: announceIn 400ms var(--ease-out);
}
@keyframes announceIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   3. HEADER  (sticky, compresses on scroll)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: 76px;
  transition: min-height var(--transition);
}
.site-header.is-scrolled .header__inner { min-height: 60px; }

/* Brand wordmark */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
  flex: 0 0 auto;
}
.brand__leaf { width: 20px; height: 24px; color: var(--gold); flex: 0 0 auto; }
.brand__logo { height: 30px; width: auto; display: block; }
.site-header.is-scrolled .brand__logo { height: 26px; transition: height var(--transition); }
.footer__brandcol .brand__logo { height: 34px; }
.brand__word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  line-height: 1;
}

/* Primary nav (desktop) */
.primary-nav { display: none; }
@media (min-width: 900px) {
  .primary-nav {
    display: flex;
    gap: clamp(1rem, 2.4vw, 2rem);
  }
  .primary-nav a {
    position: relative;
    padding: 0.5rem 0.25rem;
    font-size: var(--step-0);
    text-decoration: none;
    color: var(--ink);
  }
  .primary-nav a::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0.1rem;
    height: 1.5px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
  }
  .primary-nav a:hover::after,
  .primary-nav a[aria-current="page"]::after { transform: scaleX(1); }
}

/* Header actions */
.header__actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--ink);
  touch-action: manipulation;
  transition: background var(--transition);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

/* Cart button + count badge */
.cart-btn { position: relative; }
.cart-count {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--on-ink);
  background: var(--ink);
  border: 1.5px solid var(--bg);
  border-radius: var(--radius-pill);
}
.cart-count[data-count="0"] { display: none; }

/* Add-to-cart feedback: the badge pops and the cart icon gives a quick nudge,
   so a "+1" is felt, not just silently updated. Triggered from cart.js on
   cart:add; disabled under prefers-reduced-motion (both the media query below
   and the JS guard). */
@keyframes cartPop {
  0%   { transform: scale(1); }
  32%  { transform: scale(1.24); }
  64%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
.cart-count.is-bump { animation: cartPop 360ms var(--ease-out); }
@keyframes cartNudge {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  45%      { transform: translateY(-2px) rotate(-3deg); }
}
.cart-btn.is-bump svg { animation: cartNudge 340ms var(--ease-out); }

/* Hamburger — hidden on desktop */
.nav-toggle { display: inline-flex; }
@media (min-width: 900px) { .nav-toggle { display: none; } }

/* ==========================================================================
   4. MOBILE MENU (full-height slide-in)
   ========================================================================== */
.mobile-menu {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(88vw, 360px);
  z-index: var(--z-drawer);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 260ms var(--ease-out);
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
  visibility: hidden;
}
.mobile-menu.is-open { transform: translateX(0); visibility: visible; }
.mobile-menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
}
.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  padding: var(--s-3) var(--s-4);
  gap: 0.25rem;
  overflow-y: auto;
}
.mobile-menu__nav a {
  padding: 0.9rem 0.5rem;
  font-size: var(--step-1);
  font-family: var(--font-display);
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.mobile-menu__nav a:hover { color: var(--gold-deep); }

/* Shared overlay for menu + cart drawer */
.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgb(26 26 26 / 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease;
}
.overlay.is-open { opacity: 1; visibility: visible; }

/* Lock body scroll when a panel is open */
body.is-locked { overflow: hidden; }

/* ==========================================================================
   5. CART DRAWER (slide-in from right)
   ========================================================================== */
.cart-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(100vw, 420px);
  z-index: var(--z-drawer);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 280ms var(--ease-out);
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
  visibility: hidden;
}
.cart-drawer.is-open { transform: translateX(0); visibility: visible; }

.cart-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
}
.cart-drawer__title {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
}

/* Free-shipping progress */
.ship-progress { padding: var(--s-3) var(--s-4) 0; }
.ship-progress__label { font-size: var(--step--1); color: var(--ink-soft); margin-bottom: 0.5rem; }
.ship-progress__label b { color: var(--gold-deep); font-weight: 600; }
.ship-progress__track {
  position: relative;
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
/* Crossing the free-shipping line is a real reward: a one-time light sweeps
   the bar and a soft gold halo pulses. Fired from cart.js only on the crossing;
   the JS also guards prefers-reduced-motion. */
.ship-progress.is-unlocked .ship-progress__track { animation: shipHalo 1200ms var(--ease-out); }
.ship-progress.is-unlocked .ship-progress__track::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgb(216 188 110 / 0.5) 50%, transparent 100%);
  transform: translateX(-120%);
  animation: shipSweep 1000ms var(--ease-out) 60ms;
}
@keyframes shipSweep { to { transform: translateX(120%); } }
@keyframes shipHalo {
  0%, 100% { box-shadow: 0 0 0 0 rgb(201 162 39 / 0); }
  40%      { box-shadow: 0 0 0 3px rgb(201 162 39 / 0.16); }
}
.ship-tick { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; color: var(--gold-deep); }
@media (prefers-reduced-motion: reduce) {
  .ship-progress.is-unlocked .ship-progress__track { animation: none; }
  .ship-progress.is-unlocked .ship-progress__track::after { display: none; }
}
.ship-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  border-radius: inherit;
  transition: width 300ms var(--ease-out);
}

.cart-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* Line item */
.line-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
}
.line-item__thumb {
  width: 64px; height: 64px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
  object-fit: cover;
}
.line-item__name { font-size: var(--step-0); font-weight: 500; line-height: 1.25; }
.line-item__meta { font-size: var(--step--1); color: var(--ink-mute); margin-top: 0.15rem; }
.line-item__price { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Quantity stepper */
.qty {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius);
  margin-top: 0.5rem;
}
.qty__btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink);
}
.qty__btn:hover { background: var(--surface-2); }
.qty__val {
  min-width: 2ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.line-item__remove {
  background: none;
  border: none;
  padding: 0.25rem;
  margin-top: 0.5rem;
  font-size: var(--step--1);
  color: var(--ink-mute);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.line-item__remove:hover { color: var(--error); }

/* Empty state */
.cart-empty { text-align: center; padding: var(--s-5) var(--s-3); color: var(--ink-soft); }
.cart-empty h3 { margin-bottom: var(--s-3); }

/* Drawer footer */
.cart-drawer__foot {
  padding: var(--s-4);
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.cart-subtotal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: var(--step-1);
}
.cart-subtotal b { font-weight: 600; font-variant-numeric: tabular-nums; }
.cart-drawer__foot .link-quiet {
  text-align: center;
  font-size: var(--step--1);
  color: var(--ink-soft);
}

/* ==========================================================================
   6. FOOTER
   ========================================================================== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  margin-top: var(--s-6);
}
.footer__trust {
  border-bottom: 1px solid var(--line);
}
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-5);
  justify-content: center;
  padding-block: var(--s-4);
}
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.trust-badge svg { width: 20px; height: 20px; color: var(--gold-deep); }

.footer__cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-5);
  padding-block: var(--s-5);
}
@media (min-width: 640px) { .footer__cols { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .footer__cols { grid-template-columns: 1.4fr repeat(4, 1fr); } }

.footer__brandcol .brand { margin-bottom: var(--s-3); }
.footer__tag { font-size: var(--step--1); color: var(--ink-soft); max-width: 32ch; }

.footer__col h3 {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--ink-mute);
  margin-bottom: var(--s-3);
}
.footer__col ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.footer__col a { font-size: var(--step-0); text-decoration: none; color: var(--ink-soft); }
.footer__col a:hover { color: var(--gold-deep); text-decoration: underline; text-underline-offset: 0.15em; }

/* Email capture */
.email-capture { display: flex; flex-direction: column; gap: 0.5rem; margin-top: var(--s-3); }
.email-capture__row { display: flex; gap: 0.5rem; }
.email-capture__done { display: none; align-items: center; gap: 0.5rem; margin: 0; font-size: var(--step--1); font-weight: 500; }
.email-capture__done.is-shown { display: flex; }
.email-capture__done svg { flex: none; width: 16px; height: 16px; }
.email-capture input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius);
}
.email-capture input:focus-visible { border-color: var(--gold-deep); }

/* Entity + disclaimer */
.footer__entity {
  border-top: 1px solid var(--line);
  padding-block: var(--s-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-5);
  align-items: center;
  justify-content: space-between;
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.footer__social { display: flex; gap: 0.5rem; }
.footer__disclaimer {
  border-top: 1px solid var(--line);
  padding-block: var(--s-4);
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--ink-mute);
}
.footer__disclaimer strong { color: var(--ink-soft); }

/* ==========================================================================
   7. DIVIDER BAND (label motif: ink band + gold keylines)
   ========================================================================== */
.band--ink {
  background: var(--ink);
  color: var(--on-ink);
  border-block: 1px solid var(--line-gold);
}
.band--ink h1, .band--ink h2, .band--ink h3 { color: var(--on-ink); }
/* Ink primary button on an ink band needs a gold keyline so it isn't black-on-black */
.band--ink .btn--primary { --_bd: var(--line-gold); }
.band__label {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--gold-soft);
  font-size: var(--step--1);
  font-weight: 500;
}

/* ==========================================================================
   8. BADGES / CHIPS
   ========================================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  font-size: var(--step--1);
  font-weight: 500;
  border-radius: var(--radius-pill);
  background: var(--gold-wash);
  color: var(--gold-deep);
}
.chip--rasp { background: var(--raspberry-wash); color: var(--raspberry-deep); }

/* ==========================================================================
   9. FORMS (shared field styling)
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: var(--s-3); }
.field > label { font-size: var(--step--1); font-weight: 500; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  min-height: 44px;
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible { border-color: var(--gold-deep); }
.field__error { font-size: var(--step--1); color: var(--error); min-height: 1.2em; }
.field input[aria-invalid="true"],
.field select[aria-invalid="true"] { border-color: var(--error); }
