/* assets/base.css — shared by every template, like Dawn's base.css.
   Tokens map 1:1 to settings_schema.json (colors, type) in the future theme. */

:root {
  /* Brand colours (concept values, final hex comes with the brand kit · Q12) */
  --color-charcoal: #211c18;
  --color-cream: #efe9de;
  --color-paper: #fbfaf6;
  --color-muted: #6b625a;
  --color-line: #ddd5c7;
  --color-energy: #472e19;
  --color-power: #727a5d;
  --color-hydrate: #c99250;

  /* Type */
  --font-heading: "Merriweather", Georgia, serif;
  --font-body: "Public Sans", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, monospace;

  /* Polaris shadow scale */
  --shadow-100: 0 1px 0 0 rgba(26, 26, 26, 0.07);
  --shadow-200: 0 3px 1px -1px rgba(26, 26, 26, 0.07);
  --shadow-300: 0 4px 6px -2px rgba(26, 26, 26, 0.2);
  --shadow-400: 0 8px 16px -4px rgba(26, 26, 26, 0.22);
  --shadow-500: 0 12px 20px -8px rgba(26, 26, 26, 0.24);
  --shadow-600: 0 20px 20px -8px rgba(26, 26, 26, 0.28);
  --shadow-button: 0 -1px 0 0 rgba(0, 0, 0, 0.8) inset, 0 0 0 1px rgba(0, 0, 0, 0.3) inset, 0 0.5px 0 1.5px rgba(255, 255, 255, 0.25) inset;
  --shadow-button-secondary: 0 -1px 0 0 #b5b5b5 inset, 0 0 0 1px rgba(0, 0, 0, 0.1) inset, 0 0.5px 0 1.5px #fff inset;

  --radius: 12px;
  --page-width: 1320px;
  --gutter: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-charcoal);
  background: var(--color-cream);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
/* No single word left alone on the last line: balance short headings, "pretty" for running copy. */
h1, h2, h3, h4, h5, h6, blockquote, figcaption { text-wrap: balance; }
p, li, dd, dt, summary, label, .caption { text-wrap: pretty; }
p { margin: 0; }
em, .italic { font-style: italic; }

.page-width { max-width: var(--page-width); margin: 0 auto; padding: 0 var(--gutter); }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 200; padding: 12px 16px; background: var(--color-charcoal); color: var(--color-paper); border-radius: 4px; }
.skip-link:focus { top: 16px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--color-hydrate); outline-offset: 3px; }

/* Labels (DM Mono, caps) */
.caption {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tbc {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(201, 146, 80, 0.18);
  color: inherit;
  white-space: nowrap;
  vertical-align: middle;
}

/* Buttons (snippets/button.liquid) */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px;
  border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--font-body); font-weight: 500; font-size: 16px; text-decoration: none;
  background: var(--color-charcoal); color: var(--color-paper);
  box-shadow: var(--shadow-button), var(--shadow-300);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.button:hover { transform: translateY(-1px); box-shadow: var(--shadow-button), var(--shadow-400); }
.button:active { transform: translateY(0); box-shadow: var(--shadow-button), var(--shadow-100); }
.button--secondary { background: var(--color-paper); color: var(--color-charcoal); box-shadow: var(--shadow-button-secondary), var(--shadow-200); }
.button--secondary:hover { box-shadow: var(--shadow-button-secondary), var(--shadow-300); }
.button--light { background: var(--color-cream); color: var(--color-charcoal); box-shadow: var(--shadow-button-secondary), var(--shadow-300); }
.button--full { width: 100%; }
.link-arrow { font-weight: 500; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px; }

/* ── snippets/sachet.liquid — CSS packshot until final packshots arrive ── */
.sachet {
  --sku: var(--color-energy);
  position: relative;
  width: var(--sachet-w, 120px);
  aspect-ratio: 1 / 2.35;
  background: linear-gradient(100deg, #2b2520 0%, var(--color-charcoal) 45%, #15110e 100%);
  border-radius: 6px 6px 10px 10px;
  box-shadow: var(--shadow-600), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  display: grid; grid-template-columns: 30% 1fr;
  overflow: hidden;
  color: var(--color-paper);
  flex: none;
}
.sachet[data-sku="power"] { --sku: var(--color-power); }
.sachet[data-sku="hydrate"] { --sku: var(--color-hydrate); }
.sachet::before { /* crimped seal */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 7%;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.10) 0 2px, transparent 2px 5px), #1a1613;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 2;
}
.sachet::after { /* foil sheen */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.10) 42%, transparent 55%);
  pointer-events: none;
}
.sachet__spine {
  background: var(--sku);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 14%;
}
.sachet__wordmark {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--font-heading); font-weight: 700;
  font-size: calc(var(--sachet-w, 120px) * 0.2);
  letter-spacing: -0.02em; line-height: 1;
}
.sachet[data-sku="hydrate"] .sachet__spine { color: var(--color-charcoal); }
.sachet__column {
  padding: 22% 10% 12% 12%;
  display: flex; flex-direction: column; justify-content: space-between;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.sachet__meta { font-family: var(--font-mono); font-size: calc(var(--sachet-w, 120px) * 0.055); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; line-height: 1.4; }
.sachet__name { font-family: var(--font-heading); font-size: calc(var(--sachet-w, 120px) * 0.15); line-height: 1; color: var(--sku); }
.sachet[data-sku="energy"] .sachet__name { color: #b88a5e; }
.sachet__rule { height: 1px; background: rgba(255,255,255,0.18); margin: 6px 0; }

/* ── Cart drawer (sections/cart-drawer.liquid) ── */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(33, 28, 24, 0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease); z-index: 90;
}
.cart-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(440px, 100%);
  background: var(--color-paper); color: var(--color-charcoal);
  box-shadow: var(--shadow-600);
  transform: translateX(100%); transition: transform 0.35s var(--ease);
  z-index: 100; display: flex; flex-direction: column;
}
.cart-open .cart-overlay { opacity: 1; pointer-events: auto; }
.cart-open .cart-drawer { transform: translateX(0); }
.cart-drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--color-line); }
.cart-drawer__head h2 { font-size: 22px; }
.cart-drawer__items { flex: 1; overflow: auto; padding: 8px 24px; }
.cart-drawer__empty { padding: 48px 0; text-align: center; color: var(--color-muted); }
.cart-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--color-line); }
.cart-item__img { width: 64px; height: auto; border-radius: 4px; background: var(--color-paper); }
.cart-item__title { font-family: var(--font-heading); font-size: 18px; }
.cart-item__variant { color: var(--color-muted); font-size: 14px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--color-line); border-radius: 999px; margin-top: 8px; }
.qty button { width: 44px; height: 44px; border: 0; background: none; cursor: pointer; font-size: 16px; }
.qty span { min-width: 22px; text-align: center; font-size: 14px; }
.cart-item__price { font-weight: 500; font-size: 16px; font-variant-numeric: tabular-nums; }
.cart-drawer__foot { padding: 20px 24px 24px; border-top: 1px solid var(--color-line); display: grid; gap: 12px; }
.cart-drawer__total { display: flex; justify-content: space-between; font-weight: 500; }
.cart-drawer__note { font-size: 14px; color: var(--color-muted); }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: none; cursor: pointer; border-radius: 999px; position: relative; }
.icon-button:hover { background: rgba(33, 28, 24, 0.06); }
.icon-button svg { width: 20px; height: 20px; }
.cart-count {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--color-hydrate); color: var(--color-charcoal);
  font-size: 12px; font-weight: 500; display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.cart-count[hidden] { display: none; }

/* Pack size selector (snippets/variant-picker.liquid) */
.variant-picker { display: flex; gap: 8px; flex-wrap: wrap; border: 0; padding: 0; margin: 0; }
.variant-picker legend { margin-bottom: 8px; }
.variant-picker input { position: absolute; opacity: 0; pointer-events: none; }
.variant-picker label {
  cursor: pointer; padding: 8px 14px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--color-line); background: transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.variant-picker input:checked + label { background: var(--color-charcoal); color: var(--color-paper); border-color: var(--color-charcoal); }
.variant-picker input:focus-visible + label { outline: 2px solid var(--color-hydrate); outline-offset: 2px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%);
  background: var(--color-charcoal); color: var(--color-paper); padding: 12px 20px; border-radius: 999px;
  box-shadow: var(--shadow-500); font-size: 14px; z-index: 120; transition: transform 0.35s var(--ease);
}
.toast.is-visible { transform: translate(-50%, 0); }

/* Prototype switcher (not part of the theme) */
.proto-bar {
  position: fixed; left: 16px; bottom: 16px; z-index: 80;
  display: flex; gap: 4px; padding: 4px; border-radius: 999px;
  background: rgba(251, 250, 246, 0.92); backdrop-filter: blur(8px);
  box-shadow: var(--shadow-400); font-size: 12px;
}
.proto-bar a { padding: 6px 12px; border-radius: 999px; text-decoration: none; font-family: var(--font-mono); letter-spacing: 0.06em; color: var(--color-charcoal); }
.proto-bar a[aria-current="page"] { background: var(--color-charcoal); color: var(--color-paper); }

/* Reveal on scroll */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
[data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  [data-reveal] { opacity: 1; transform: none; }
}

/* Prototype switcher stays out of the way on phones (it is not part of the theme) */
@media (max-width: 520px) { .proto-bar { display: none; } }
