/* ==========================================================================
   Theme design tokens + shared primitives (brand-neutral, role-based).
   Loaded once from layout/theme.html after the platform base stylesheet.
   Section files own their own component rules; this file holds only the
   shared scale (type, spacing, layout, radii, motion) and the small set of
   primitives every section composes: containers, stacks, type utilities,
   buttons, fields, media frames, surfaces. Class names avoid the platform's
   own (.grid/.field/.section/.button) — see docs/craft/components-sections-blocks.md §6.6.
   ========================================================================== */
:root {
  /* palette roles (RGB triplets for rgba(var()) + hex convenience) */
  --ink:          #1A1A1A;
  --ink-soft:     #3C3C36;
  --body:         #5A5A52;
  --body-soft:    #6A6A62;
  --mute:         #70706A;
  --mute-soft:    #7A7A70;
  --mute-faint:   #6C6C64;
  --mute-on-dark: #9A9A90;
  --accent:       #6B7A5A;
  --accent-text:  #5F6D50;
  --accent-deep:  #4C5A40;
  --accent-tint:  #E7EADF;
  --accent-pale:  #C7D2BC;
  --accent-mid:   #A8B49A;
  --bone:         #F2F2F0;
  --bone-soft:    #FAFAF8;
  --line:         #E4E2DC;
  --line-soft:    #EFEEE9;
  --sand:         #D9D2C4;
  --sand-deep:    #C9C4B6;
  --white:        #FFFFFF;
  --alert:        #8A5A3A;
  --dark-line:    #333330;
  --dark-body:    #C4C4BC;
  --dark-fill:    #2A2A28;

  /* type */
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-ui:      'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --fs-display-xl: clamp(2.75rem, 1.35rem + 5.6vw, 5.5rem);
  --fs-display-lg: clamp(2.5rem,  1.35rem + 4.8vw, 4.875rem);
  --fs-display-md: clamp(2.25rem, 1.4rem + 3.6vw, 4rem);
  --fs-display-sm: clamp(2rem,    1.35rem + 2.8vw, 3.625rem);
  --fs-h2-xl:      clamp(1.875rem, 1.3rem + 2.4vw, 3rem);
  --fs-h2:         clamp(1.625rem, 1.25rem + 1.7vw, 2.625rem);
  --fs-h2-sm:      clamp(1.5rem,   1.2rem + 1.3vw, 2.375rem);
  --fs-h3:         clamp(1.375rem, 1.15rem + 0.9vw, 2rem);
  --fs-h4:         clamp(1.25rem,  1.1rem + 0.6vw, 1.75rem);
  --fs-h5:         clamp(1.15rem,  1.05rem + 0.4vw, 1.5rem);
  --fs-card-title: clamp(1.125rem, 1.03rem + 0.35vw, 1.375rem);
  --fs-lead:    clamp(1rem,     0.96rem + 0.2vw, 1.1875rem);
  --fs-body-lg: clamp(0.9688rem, 0.94rem + 0.15vw, 1.0625rem);
  --fs-body:    1rem;
  --fs-body-sm: 0.9375rem;
  --fs-sm:      0.875rem;
  --fs-xs:      0.8125rem;
  --fs-2xs:     0.75rem;
  --fs-mono:    0.90625rem;
  --fs-eyebrow: 0.65625rem;
  --fs-eyebrow-sm: 0.59375rem;
  --lh-tight:  1.06;
  --lh-snug:   1.25;
  --lh-normal: 1.55;
  --lh-relaxed: 1.7;
  --lh-loose:  1.8;
  --ls-display: -0.025em;
  --ls-eyebrow: 0.18em;
  --ls-button:  0.1em;
  --ls-nav:     0.09em;

  /* layout */
  --container: 1400px;
  --container-md: 1240px;
  --container-sm: 1000px;
  --container-xs: 760px;
  --gutter: clamp(1.25rem, 3.4vw, 2.25rem);
  --section-y:    clamp(3rem, 6.5vw, 5.5rem);
  --section-y-sm: clamp(2.25rem, 4.5vw, 4rem);
  --space-none: 0px;
  --space-section: var(--section-y);
  --space-section-sm: var(--section-y-sm);
  --gap-grid:     clamp(1.125rem, 2vw, 1.75rem);
  --gap-split:    clamp(2rem, 5vw, 4.5rem);
  --header-h: 76px;
  --header-h-mobile: 62px;
  --chrome-h: 151px;
  --chrome-h-mobile: 137px;
  --sticky-top: 140px;

  /* controls */
  --radius-pill: 999px;
  --radius-sm: 2px;
  --control-h: 56px;
  --tap: 44px;
  --shadow-drawer: 0 8px 30px rgba(0, 0, 0, .18);
  --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, .14);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: .22s;
  color-scheme: light;
}

/* ---------- base ---------- */
/* The platform's base sheet paints BOTH html and body with
   --color-page-background, and that variable is still the vendor's demo cream.
   Overriding body alone leaves html cream, so pulling the page past either end
   flashes cream against the dark announcement bar and footer (playbook §11.6).
   Both extremes are the ink band on every template, so html matches it. */
html {
  background-color: var(--ink);
}

body {
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; color: inherit; }
img, video { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------- layout primitives ---------- */
.container    { max-width: var(--container);    margin-inline: auto; padding-inline: var(--gutter); }
.container-md { max-width: var(--container-md); margin-inline: auto; padding-inline: var(--gutter); }
.container-sm { max-width: var(--container-sm); margin-inline: auto; padding-inline: var(--gutter); }
.container-xs { max-width: var(--container-xs); margin-inline: auto; padding-inline: var(--gutter); }
.pad-y  { padding-block: var(--section-y); }
.pad-t  { padding-top: var(--section-y); }
.pad-b  { padding-bottom: var(--section-y); }
.pad-y-sm { padding-block: var(--section-y-sm); }

.stack { display: flex; flex-direction: column; }
.stack-4  { gap: 4px; }  .stack-6  { gap: 6px; }  .stack-8  { gap: 8px; }
.stack-10 { gap: 10px; } .stack-12 { gap: 12px; } .stack-14 { gap: 14px; }
.stack-16 { gap: 16px; } .stack-20 { gap: 20px; } .stack-22 { gap: 22px; }
.stack-24 { gap: 24px; } .stack-28 { gap: 28px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.push { margin-left: auto; }

.ui-grid { display: grid; gap: var(--gap-grid); }
.ui-grid-2 { grid-template-columns: repeat(2, 1fr); }
.ui-grid-3 { grid-template-columns: repeat(3, 1fr); }
.ui-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) {
  .ui-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .ui-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .ui-grid-3, .ui-grid-4 { grid-template-columns: 1fr; }
  .ui-grid-2 { grid-template-columns: 1fr; }
  .ui-grid-products { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

/* ---------- type utilities ---------- */
.display   { font-family: var(--font-display); font-weight: 200; line-height: var(--lh-tight); letter-spacing: var(--ls-display); text-wrap: balance; }
.display-3 { font-family: var(--font-display); font-weight: 300; line-height: var(--lh-snug); }
.t-xl  { font-size: var(--fs-display-xl); }
.t-lg  { font-size: var(--fs-display-lg); }
.t-md  { font-size: var(--fs-display-md); }
.t-sm  { font-size: var(--fs-display-sm); }
.t-h2  { font-size: var(--fs-h2); }
.t-h2xl{ font-size: var(--fs-h2-xl); }
.t-h2sm{ font-size: var(--fs-h2-sm); }
.t-h3  { font-size: var(--fs-h3); }
.t-h4  { font-size: var(--fs-h4); }
.t-h5  { font-size: var(--fs-h5); }
h1.display, h2.display, h3.display, h1.display-3, h2.display-3, h3.display-3 { color: inherit; letter-spacing: var(--ls-display); text-transform: none; }
h1.display-3, h2.display-3, h3.display-3 { letter-spacing: normal; }

.eyebrow { font-family: var(--font-mono); font-size: var(--fs-eyebrow); letter-spacing: var(--ls-eyebrow); text-transform: uppercase; color: var(--mute); line-height: 1.4; }
.eyebrow-accent { color: var(--accent-text); }
.eyebrow-sm { font-size: var(--fs-eyebrow-sm); letter-spacing: 0.16em; }
.mono { font-family: var(--font-mono); }
.lead { font-size: var(--fs-lead); line-height: var(--lh-relaxed); color: var(--body); text-wrap: pretty; }
.prose-p { font-size: var(--fs-body-lg); line-height: var(--lh-relaxed); color: var(--body); text-wrap: pretty; }
.muted { color: var(--body-soft); }
.faint { color: var(--mute); }
.strike { color: var(--mute-faint); text-decoration: line-through; }

/* ---------- controls (anchors need ≥ (0,1,1) to beat the platform's a:not(.button)) ---------- */
.btn, a.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: var(--tap); padding: 15px 30px;
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: var(--fs-2xs); letter-spacing: var(--ls-button);
  text-transform: uppercase; font-weight: 600; text-align: center; text-decoration: none;
  border: 1px solid transparent; cursor: pointer; background: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn-dark, a.btn-dark { background: var(--ink); color: var(--white); font-weight: 700; }
.btn-dark:hover, a.btn-dark:hover { background: var(--accent); color: var(--white); }
.btn-outline, a.btn-outline { background: transparent; color: var(--ink); border-color: var(--sand); }
.btn-outline:hover, a.btn-outline:hover { background: var(--ink); color: var(--white); border-color: var(--ink); }
.btn-ghost, a.btn-ghost { background: transparent; color: var(--ink); border-color: var(--sand); }
.btn-ghost:hover, a.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-light, a.btn-light { background: var(--white); color: var(--ink); font-weight: 700; }
.btn-light:hover, a.btn-light:hover { background: var(--accent); color: var(--white); }
.btn-on-dark, a.btn-on-dark { background: transparent; color: var(--white); border-color: #4A4A44; }
.btn-on-dark:hover, a.btn-on-dark:hover { background: var(--white); color: var(--ink); }
.btn-block { width: 100%; }
.btn-lg { padding: 17px 34px; }
.btn-sm { padding: 11px 20px; min-height: 38px; font-size: 0.6875rem; }

.link-underline, a.link-underline {
  display: inline-block; font-size: var(--fs-2xs); letter-spacing: var(--ls-button);
  text-transform: uppercase; font-weight: 600; color: var(--ink); text-decoration: none;
  /* border:0 and explicit side padding so this reads the same on a <button> as on
     an <a>. Without them the browser's default button border and side padding
     survive, and the link renders as a thin box. */
  border: 0; border-bottom: 1px solid var(--sand); padding: 0 0 4px;
  background: none; cursor: pointer;
}
.link-underline:hover, a.link-underline:hover { border-color: var(--accent); }

.ui-field {
  width: 100%; background: var(--white); border: 1px solid var(--line);
  padding: 15px 18px; font-family: var(--font-ui); font-size: var(--fs-body-sm); color: var(--ink); outline: none;
  border-radius: 0; min-height: var(--tap); line-height: normal;
  transition: border-color var(--dur) var(--ease);
}
.ui-field:focus { border-color: var(--ink); }
.ui-field-pill { border-radius: var(--radius-pill); border-color: var(--sand); padding: 17px 24px; }
textarea.ui-field { resize: vertical; min-height: 120px; }
select.ui-field { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235A5A52' stroke-width='1.5' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 18px center; padding-right: 44px; }
.ui-field-label { font-family: var(--font-mono); font-size: var(--fs-eyebrow-sm); letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); display: block; margin-bottom: 8px; }

/* ---------- media ---------- */
.media { position: relative; overflow: hidden; background: var(--bone); }
.media > img, .media > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media-contain > img { object-fit: contain; padding: 8%; }
.ar-1  { aspect-ratio: 1 / 1; }
.ar-4-3 { aspect-ratio: 4 / 3; }
.ar-3-4 { aspect-ratio: 3 / 4; }
.ar-4-5 { aspect-ratio: 4 / 5; }
.ar-16-9 { aspect-ratio: 16 / 9; }
.ar-21-9 { aspect-ratio: 21 / 9; }

/* ---------- surfaces ---------- */
.panel-soft { background: var(--bone); }
.panel-dark { background: var(--ink); color: var(--white); }
.panel-dark h1, .panel-dark h2, .panel-dark h3 { color: var(--white); }
.panel-dark p { color: var(--dark-body); }
.rule-top { border-top: 1px solid var(--line); }
.rule-top-ink { border-top: 1px solid var(--ink); }
.rule-bottom { border-bottom: 1px solid var(--line); }
.chip { display: inline-flex; align-items: center; border-radius: var(--radius-pill); padding: 9px 14px; font-size: var(--fs-2xs); border: 1px solid var(--line); background: transparent; color: var(--ink-soft); font-family: var(--font-ui); line-height: var(--lh-normal); cursor: pointer; transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--white); border-color: var(--ink); }
.demo-note { display: flex; gap: 10px; align-items: flex-start; background: var(--bone); border-left: 2px solid var(--sand); padding: 14px 18px; font-size: var(--fs-xs); line-height: var(--lh-normal); color: var(--body-soft); }
.stars { color: var(--accent); letter-spacing: .24em; font-size: var(--fs-xs); }

/* ---------- motion ---------- */
@keyframes ui-up     { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ui-drawer { from { transform: translateX(30px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes ui-sheet  { from { transform: translateY(100%); } to { transform: none; } }
@keyframes ui-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- product card (shared by product grids / collections / cross-sells) ---------- */
.pcard { display: flex; flex-direction: column; gap: 11px; }
.pcard__media { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--bone); overflow: hidden; }
.pcard__media img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; transition: transform .6s var(--ease); }
.pcard:hover .pcard__media img { transform: scale(1.04); }
.pcard__badge { position: absolute; top: 12px; left: 12px; z-index: 2; background: var(--ink); color: var(--white); font-family: var(--font-mono); font-size: 0.5625rem; letter-spacing: 0.14em; text-transform: uppercase; padding: 5px 9px; }
.pcard__low { position: absolute; bottom: 12px; left: 12px; z-index: 2; background: rgba(255,255,255,.94); color: var(--alert); font-family: var(--font-mono); font-size: 0.5625rem; letter-spacing: 0.14em; text-transform: uppercase; padding: 5px 9px; }
.pcard__concern { font-family: var(--font-mono); font-size: var(--fs-eyebrow-sm); letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); }
.pcard__title, a.pcard__title { font-family: var(--font-display); font-weight: 300; font-size: var(--fs-card-title); line-height: var(--lh-snug); display: block; text-align: left; color: var(--ink); text-decoration: none; }
.pcard__title:hover, a.pcard__title:hover { color: var(--accent); }
.pcard__short { font-size: var(--fs-xs); line-height: var(--lh-normal); color: var(--body-soft); margin: 0; }
.pcard__price { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-top: auto; } /* price + add button sit together at the card foot, level across a row */
.pcard__price .price { font-family: var(--font-mono); font-size: var(--fs-mono); }
.pcard__price .compare { font-family: var(--font-mono); font-size: 0.78125rem; }
.pcard__price .save { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--accent); margin-left: auto; }
.pcard theme-product-form, .pcard .pcard__form { display: block; }
.pcard .pcard__add { width: 100%; }
.pcard--grid .pcard__title { min-height: 2.6em; }
@media (max-width: 560px) {
  .pcard--grid .pcard__title { min-height: 0; }
  .pcard__short { display: none; }
  .pcard__price .save { margin-left: 0; width: 100%; }
}
.pcard-mini { display: flex; gap: 16px; align-items: center; }
.pcard-mini__media { position: relative; width: 104px; height: 104px; flex: none; background: var(--bone); overflow: hidden; }
.pcard-mini__media img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.pcard-mini__title, a.pcard-mini__title { font-family: var(--font-display); font-weight: 300; font-size: 1.1875rem; line-height: var(--lh-snug); text-align: left; color: var(--ink); text-decoration: none; }
.pcard-mini__title:hover { color: var(--accent); }
@media (max-width: 420px) { .pcard-mini__media { width: 84px; height: 84px; } }
