/* ==========================================================================
   Winfrey Publishing — Reset, typography, layout primitives
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--parchment);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Contain the off-canvas drawers, which are parked past the right edge.
   `clip` is used in preference to `hidden` because `hidden` turns the element
   into a scroll container, which breaks `position: sticky` descendants — and
   this site relies on sticky for the header, filter panels, article contents
   and order summaries. `hidden` is declared first as a fallback for engines
   that do not support `clip`. */
html, body {
  overflow-x: hidden;
  overflow-x: clip;
}

body.is-locked { overflow: hidden; }

img, svg, video, canvas, picture { display: block; max-width: 100%; }
img, video { height: auto; }

h1, h2, h3, h4, h5, h6 { margin: 0 0 var(--sp-4); }
p, ul, ol, dl, figure, blockquote, table { margin: 0 0 var(--sp-5); }
:is(h1,h2,h3,h4,h5,h6) + :is(p,ul,ol) { margin-top: 0; }
:last-child { margin-bottom: 0; }

h1, .h1, h2, .h2, h3, .h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-tight);
  color: var(--text);
  text-wrap: balance;
}

h1, .h1 { font-size: var(--fs-4xl); }
h2, .h2 { font-size: var(--fs-3xl); }
h3, .h3 { font-size: var(--fs-xl); line-height: var(--lh-snug); }

h4, .h4 {
  font-family: var(--font-body);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: var(--ls-snug);
  line-height: var(--lh-snug);
}

h5, h6 {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: 0;
}

.display {
  font-family: var(--font-display);
  font-size: var(--fs-5xl);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: var(--ls-tight);
}

.lede {
  font-size: var(--fs-md);
  line-height: var(--lh-loose);
  color: var(--text-muted);
  max-width: 62ch;
  text-wrap: pretty;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--bronze-700);
  margin-bottom: var(--sp-3);
}

.on-dark .eyebrow { color: var(--lantern-300); }

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: .6;
  flex: none;
}

.text-muted { color: var(--text-muted); }
.text-small { font-size: var(--fs-sm); }
.text-xs    { font-size: var(--fs-xs); }
.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }
.measure { max-width: var(--container-text); }

/* Drop-cap for editorial long-form openers */
.has-dropcap > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 3.6em;
  line-height: .82;
  float: left;
  margin: .08em .12em 0 0;
  color: var(--bronze-700);
}

/* ------------------------------------------------------------------ Links */
a { color: var(--bronze-700); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ember); }
.on-dark a { color: var(--lantern-300); }
.on-dark a:hover { color: var(--lantern); }

/* Declared after `.on-dark a` so a light island nested inside a dark section
   wins the tie on source order and gets readable link colours back. */
.on-light a { color: var(--bronze-700); }
.on-light a:hover { color: var(--ember); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  font-weight: 600;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size var(--dur) var(--ease);
}
.link-arrow:hover { background-size: 100% 1px; }
.link-arrow svg { transition: transform var(--dur) var(--ease); }
.link-arrow:hover svg { transform: translateX(3px); }

/* --------------------------------------------------------------- A11y */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-xs);
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  z-index: var(--z-toast);
  padding: var(--sp-3) var(--sp-5);
  background: var(--ink);
  color: var(--text-invert);
  font-weight: 600;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  text-decoration: none;
}
.skip-link:focus { top: 0; color: var(--text-invert); }

/* Honeypot — visually hidden but not display:none, so bots still fill it. */
.hp-field {
  position: absolute !important;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* --------------------------------------------------------------- Layout */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: var(--container-wide); }
.container--text { max-width: var(--container-text); }

.section { padding-block: var(--section-y); position: relative; }
.section--lg { padding-block: var(--section-y-lg); }
.section--sm { padding-block: var(--section-y-sm); }
.section--flush-top { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }

/* Section surfaces — deliberate variety, never every band identical. */
.surface-paper     { background: var(--paper); }
.surface-parchment { background: var(--parchment); }
.surface-muted     { background: var(--parchment-200); }
.surface-warm      { background: var(--grad-warm); }
.surface-ink       { background: var(--grad-ink); }
.surface-bronze    { background: linear-gradient(160deg, #7d4f24 0%, #5d3a1b 100%); }

.surface-ink, .surface-bronze { color: var(--text-invert); }

/* Hairline separator between same-coloured bands */
.section--ruled { border-top: 1px solid var(--line); }

/* Paper-grain texture for warm bands — pure CSS, no image request. */
.has-grain { position: relative; isolation: isolate; }
.has-grain::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .5;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(185, 121, 63, .045) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 65%, rgba(185, 121, 63, .04) 0 1px, transparent 1px);
  background-size: 44px 44px, 62px 62px;
  pointer-events: none;
}

/* ---------------------------------------------------------------- Grid */
.grid { display: grid; gap: var(--sp-6); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.grid--auto-lg { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }

/* Asymmetric editorial splits */
.split { display: grid; gap: clamp(2rem, 4vw, 4.5rem); align-items: center; }
.split--7-5 { grid-template-columns: 7fr 5fr; }
.split--5-7 { grid-template-columns: 5fr 7fr; }
.split--6-6 { grid-template-columns: 1fr 1fr; }
.split--8-4 { grid-template-columns: 8fr 4fr; }
.split--4-8 { grid-template-columns: 4fr 8fr; }
.split--top { align-items: start; }

/* Grid and flex children default to min-width:auto, which lets intrinsically
   wide content (long words, tables, book covers) push a track past its share
   and scroll the whole page sideways. Resetting it to 0 is what makes the
   layouts genuinely fluid down to 360px. */
.grid > *,
.split > *,
.book-detail > *,
.store-layout > *,
.checkout-layout > *,
.dash-layout > *,
.article-layout > *,
.legal-layout > *,
.consult-layout > * { min-width: 0; }

.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack--lg { gap: var(--sp-6); }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--center { justify-content: center; }

@media (max-width: 1023px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split--7-5, .split--5-7, .split--6-6, .split--8-4, .split--4-8 {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Keep the visual lead image above copy when the split collapses. */
  .split--5-7 > .split__media, .split--4-8 > .split__media { order: -1; }
}

@media (max-width: 639px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
}

/* --------------------------------------------------- Section headings */
.section-head { max-width: 68ch; margin-bottom: clamp(2rem, 3.5vw, 3.5rem); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .eyebrow { justify-content: center; }
.section-head--center .lede { margin-inline: auto; }
.section-head--split {
  display: flex;
  gap: var(--sp-6);
  align-items: flex-end;
  justify-content: space-between;
  max-width: none;
  flex-wrap: wrap;
}
.section-head--split > div:first-child { max-width: 62ch; }

/* Ornamental divider that echoes the lantern glow */
.rule-glow {
  height: 1px;
  border: 0;
  background: var(--grad-rule);
  margin-block: var(--sp-7);
}

/* --------------------------------------------------------- Prose blocks */
.prose { max-width: 72ch; }
.prose h2 { font-size: var(--fs-2xl); margin-top: var(--sp-8); }
.prose h3 { font-size: var(--fs-lg); margin-top: var(--sp-6); }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li { margin-bottom: var(--sp-2); }
.prose li::marker { color: var(--bronze); }
.prose blockquote {
  margin: var(--sp-7) 0;
  padding: var(--sp-5) var(--sp-6);
  border-left: 3px solid var(--bronze);
  background: var(--bronze-50);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  line-height: 1.5;
  color: var(--ink-700);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose img { border-radius: var(--r-lg); box-shadow: var(--sh-md); margin-block: var(--sp-7); }
.prose figcaption {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  text-align: center;
  margin-top: calc(var(--sp-5) * -1 + var(--sp-3));
}
.prose a { font-weight: 500; }
.prose hr { border: 0; height: 1px; background: var(--line); margin-block: var(--sp-8); }

/* ----------------------------------------------------------- Utilities */
.hide { display: none !important; }
@media (max-width: 1023px) { .hide-md-down { display: none !important; } }
@media (min-width: 1024px) { .hide-lg-up { display: none !important; } }
@media (max-width: 639px)  { .hide-sm-down { display: none !important; } }

.no-print { }
@media print {
  .no-print, .site-header, .site-footer, .sticky-cta, .cart-drawer, .search-overlay { display: none !important; }
  body { background: #fff; }
  .section { padding-block: 1rem; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}

/* ------------------------------------------------------- Scroll reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
[data-reveal].is-visible { opacity: 1; transform: none; }
[data-reveal][data-reveal-delay="1"] { transition-delay: 80ms; }
[data-reveal][data-reveal-delay="2"] { transition-delay: 160ms; }
[data-reveal][data-reveal-delay="3"] { transition-delay: 240ms; }
[data-reveal][data-reveal-delay="4"] { transition-delay: 320ms; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* Selection */
::selection { background: var(--lantern-300); color: var(--ink); }

/* Scrollbar — subtle, brand-tinted, desktop only */
@media (pointer: fine) {
  * { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
  *::-webkit-scrollbar { width: 10px; height: 10px; }
  *::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: var(--r-pill);
    border: 3px solid transparent;
    background-clip: content-box;
  }
  *::-webkit-scrollbar-thumb:hover { background: var(--bronze-400); background-clip: content-box; }
}
