/* ==========================================================================
   Dutchess Beauty & Butters — hero
   Sizes are expressed in "reference pixels" from the design comps:
     desktop comp 1672 × 941  → 1 ref px = var(--u)
     mobile  comp  851 × 1848 → 1 ref px = var(--m)
   so the layout scales like the comp, with min() floors for legibility.
   ========================================================================== */

:root {
  --cream: #f7efe5;
  --ink: #23160f;
  --ink-soft: #3a2a20;
  --brown: #42291d;
  --brown-hover: #5a3a2a;
  --olive: #5f5a37;
  --eyebrow: #5a5444;
  --rule: rgba(58, 38, 28, 0.45);

  --serif-display: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --serif: "EB Garamond", Garamond, "Times New Roman", serif;
  --sans: "Mulish", "Avenir Next", "Helvetica Neue", Arial, sans-serif;

  --vh: 100vh;
}
@supports (height: 100svh) {
  :root { --vh: 100svh; }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
p, h1, ul { margin: 0; }
ul { padding: 0; list-style: none; }
svg { display: block; }

:focus-visible { outline: 2px solid var(--brown); outline-offset: 4px; }

/* ==========================================================================
   Desktop (default)
   ========================================================================== */

.hero {
  /* --h is the image "stage": the viewport height, but never taller than the
     image's own 1672 × 941 ratio. Wider screens get extra cream on the left
     (where the copy sits); taller ones get extra space above the feature bar. */
  --h: min(var(--vh), 56.28vw);
  --img-w: calc(var(--h) * 1.7768);
  --u: calc(var(--h) / 941);
  --header-h: max(64px, calc(98 * var(--u)));
  --features-h: max(56px, calc(92 * var(--u)));

  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: max(var(--h), var(--vh));
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--h);
  z-index: -1;
  /* soften the bottom edge into the page colour when the hero runs taller */
  -webkit-mask-image: linear-gradient(to bottom, #000 84%, transparent);
  mask-image: linear-gradient(to bottom, #000 84%, transparent);
}
.hero__bg img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 100% 50%;
  /* on wide screens, fade the image's left edge into the page colour */
  -webkit-mask-image: linear-gradient(to right, transparent calc(100% - var(--img-w)), #000 calc(100% - var(--img-w) * 0.82));
  mask-image: linear-gradient(to right, transparent calc(100% - var(--img-w)), #000 calc(100% - var(--img-w) * 0.82));
}

.only-mobile { display: none; }

/* ---- Header ---------------------------------------------------------- */

.site-header {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--header-h);
  margin-inline: 2.15vw;
  padding-inline: 1.85vw;
  border-bottom: 1px solid var(--rule);
}

.logo {
  justify-self: start;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  color: var(--ink);
  line-height: 1;
}
.logo__name {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: max(22px, calc(47 * var(--u)));
  letter-spacing: 0.085em;
  margin-right: -0.085em; /* cancel trailing tracking so the lockup centres */
  text-transform: uppercase;
}
.logo__sub {
  margin-top: 0.5em;
  font-family: var(--sans);
  font-weight: 500;
  font-size: max(8.5px, calc(15 * var(--u)));
  letter-spacing: 0.32em;
  margin-right: -0.32em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  gap: calc(62 * var(--u));
  font-family: var(--serif);
  font-size: max(15px, calc(23 * var(--u)));
  color: var(--ink);
}
.site-nav a {
  position: relative;
  padding-block: 0.3em;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.1em;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.site-nav a:hover::after,
.site-nav a:focus-visible::after { transform: scaleX(1); }

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: calc(40 * var(--u));
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  padding: 4px;
  margin: -4px;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
}
.icon-btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.2s ease;
}
.icon-btn:hover svg { opacity: 0.65; }
.icon-btn--search svg { width: max(20px, calc(29 * var(--u))); }
.icon-btn--bag svg { width: max(20px, calc(28 * var(--u))); }
.menu-toggle { display: none; }

/* ---- Hero copy ------------------------------------------------------- */

.hero__body {
  position: relative;
  min-height: calc(var(--h) - var(--header-h) - var(--features-h));
  display: flex;
  align-items: center;
  padding: calc(40 * var(--u)) 4vw calc(110 * var(--u));
}

.eyebrow {
  font-family: var(--sans);
  font-weight: 400;
  font-size: max(11px, calc(18.5 * var(--u)));
  letter-spacing: 0.275em;
  text-transform: uppercase;
  color: var(--eyebrow);
}

.hero__title {
  margin-top: calc(26 * var(--u));
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: max(40px, calc(114 * var(--u)));
  line-height: 0.89;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.hero__title em {
  font-style: italic;
  letter-spacing: -0.03em;
}

.hero__lede {
  margin-top: calc(34 * var(--u));
  font-size: max(15px, calc(23 * var(--u)));
  line-height: 1.52;
  color: var(--ink-soft);
}

.hero__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(38 * var(--u));
  margin-top: calc(42 * var(--u));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(30 * var(--u));
  height: max(44px, calc(62 * var(--u)));
  padding-inline: max(20px, calc(34 * var(--u)));
  min-width: max(220px, calc(301 * var(--u)));
  background: var(--brown);
  color: var(--cream);
  font-family: var(--serif);
  font-size: max(15px, calc(21.5 * var(--u)));
  letter-spacing: 0.005em;
  transition: background-color 0.25s ease;
}
.btn:hover { background: var(--brown-hover); }
.btn__arrow {
  width: max(22px, calc(29 * var(--u)));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s ease;
}
.btn:hover .btn__arrow { transform: translateX(4px); }

.text-link {
  font-size: max(14px, calc(18.5 * var(--u)));
  color: var(--ink);
  padding-bottom: calc(6 * var(--u));
  border-bottom: 1px solid currentColor;
  transition: opacity 0.2s ease;
}
.text-link:hover { opacity: 0.65; }

.tagline {
  position: absolute;
  left: max(0px, calc(100% - var(--img-w))); /* centred under the image */
  right: 0;
  bottom: calc(24 * var(--u));
  text-align: center;
  font-family: var(--serif);
  font-size: max(13px, calc(18 * var(--u)));
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

/* ---- Feature bar ----------------------------------------------------- */

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  height: var(--features-h);
  margin-top: auto;
  margin-inline: 2.15vw;
  border-top: 1px solid var(--rule);
}

.feature {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(28 * var(--u));
  font-family: var(--serif);
  font-size: max(13px, calc(20 * var(--u)));
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}
.feature + .feature::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  height: calc(36 * var(--u));
  min-height: 24px;
  transform: translateY(-50%);
  border-left: 1px solid var(--rule);
}
.feature__icon {
  flex: none;
  width: max(28px, calc(50 * var(--u)));
  fill: none;
  stroke: var(--olive);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   Mobile & portrait  (keep in sync with <picture> media queries in index.html)
   ========================================================================== */

@media (max-width: 767px), (max-aspect-ratio: 1/1) {
  .hero {
    --m: min(100vw / 851, 1px);
    --stage-h: max(var(--vh), 217.16vw); /* the mobile comp's 851 × 1848 ratio */
    display: block;
    min-height: 0;
  }

  .hero__bg { height: var(--stage-h); }
  .hero__bg img {
    object-fit: cover;
    object-position: 50% 0;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .only-desktop { display: none; }
  .only-mobile { display: inline; }

  /* ---- Header ---- */
  .site-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    height: calc(109 * var(--m));
    min-height: 52px;
    margin-inline: calc(38 * var(--m));
    padding-inline: calc(17 * var(--m)) calc(13 * var(--m));
  }

  .logo__name { font-size: max(19px, calc(47 * var(--m))); }
  .logo__sub { font-size: max(7.5px, calc(16.5 * var(--m))); }

  .header-actions { gap: calc(46 * var(--m)); }
  .icon-btn--search { display: none; }
  .icon-btn--bag svg { width: max(19px, calc(34 * var(--m))); }
  .menu-toggle { display: inline-grid; }
  .menu-toggle svg {
    width: max(21px, calc(38 * var(--m)));
    stroke-width: 1.4;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: calc(-38 * var(--m));
    right: calc(-38 * var(--m));
    flex-direction: column;
    gap: 0;
    padding: 8px calc(55 * var(--m)) 16px;
    background: var(--cream);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 18px 30px -24px rgba(35, 22, 15, 0.35);
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
  }
  .site-nav a {
    padding-block: 14px;
    border-bottom: 1px solid rgba(58, 38, 28, 0.12);
  }
  .site-nav a:last-child { border-bottom: 0; }
  .site-nav a::after { display: none; }

  .site-header.is-open .site-nav {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  /* ---- Copy: eyebrow pinned to the top, the rest anchored to the bottom ---- */
  .hero__body {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: var(--stage-h);
    padding: 0 calc(50 * var(--m)) calc(70 * var(--m));
    text-align: center;
  }
  .hero__copy { width: 100%; }

  .hero .eyebrow {
    position: absolute;
    top: max(64px, calc(150 * var(--m)));
    left: 0;
    right: 0;
    font-size: max(10px, calc(22 * var(--m)));
    letter-spacing: 0.32em;
    margin-right: -0.32em;
  }

  .hero__title {
    margin-top: 0;
    font-size: max(44px, calc(112 * var(--m)));
    line-height: 0.86;
  }

  .hero__lede {
    margin-top: calc(26 * var(--m));
    font-size: max(14px, calc(30 * var(--m)));
    line-height: 1.4;
  }

  .hero__actions {
    flex-direction: column;
    gap: calc(38 * var(--m));
    margin-top: calc(30 * var(--m));
  }

  .btn {
    width: 100%;
    height: max(50px, calc(96 * var(--m)));
    gap: calc(42 * var(--m));
    font-size: max(17px, calc(34 * var(--m)));
  }
  .btn__arrow { width: max(24px, calc(42 * var(--m))); }

  .text-link {
    font-size: max(14px, calc(27 * var(--m)));
    padding-bottom: calc(10 * var(--m));
  }

  .tagline { display: none; }

  /* ---- Feature bar sits below the hero image on mobile ---- */
  .features {
    height: auto;
    margin-inline: calc(38 * var(--m));
    padding-block: 22px 26px;
    align-items: start;
  }
  .feature {
    flex-direction: column;
    gap: 10px;
    padding-inline: 6px;
    text-align: center;
    font-size: 13px;
    letter-spacing: 0.05em;
    line-height: 1.3;
  }
  .feature + .feature::before {
    top: 4px;
    bottom: 4px;
    height: auto;
    transform: none;
  }
  .feature__icon { width: 30px; }
}

/* ==========================================================================
   Scroll story — a 3D jar standing in photographic "story worlds"
   (js/story.js; the photos are drawn in the jar's WebGL scene, js/backdrop.js)
   ========================================================================== */

.story {
  /* .btn and .eyebrow sizing: a size up from the hero, as in the story comps */
  --u: clamp(0.75px, calc(100vw / 1340), 1.2px);
  --stage-h: 100vh;
  position: relative;
  background: var(--cream);
}
@supports (height: 100svh) {
  .story { --stage-h: 100svh; }
}

.story__stage {
  position: sticky;
  top: 0;
  height: var(--stage-h);
  margin-bottom: calc(-1 * var(--stage-h));
  overflow: hidden;
}
.story__canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y; /* vertical swipes scroll; horizontal drags turn the jar */
  opacity: 0;
  transition: opacity 0.8s ease;
}
.story.is-ready .story__canvas { opacity: 1; }
.story__canvas.is-grabbable { cursor: grab; }
.story__canvas.is-dragging { cursor: grabbing; }
.story--no-webgl .story__stage { display: none; }

.story__chapters {
  position: relative;
  z-index: 1;
  pointer-events: none; /* let drags reach the canvas; copy and buttons opt back in */
}

.chapter {
  --chapter-ink: var(--ink);
  --chapter-ink-soft: var(--ink-soft);
  --chapter-muted: var(--eyebrow);
  display: flex;
  align-items: center;
  min-height: var(--stage-h);
  padding: 12vh 8vw;
}
.chapter--right { justify-content: flex-end; }
.chapter--left { justify-content: flex-start; }
/* Light copy on a dark world (cream on the olive forest) */
.story.is-ready .chapter--dark {
  --chapter-ink: var(--cream);
  --chapter-ink-soft: rgba(247, 239, 229, 0.88);
  --chapter-muted: rgba(247, 239, 229, 0.74);
}

.chapter__card {
  width: min(720px, 44vw);
  pointer-events: none;
}
.chapter__copy,
.chapter .btn { pointer-events: auto; }
.chapter .eyebrow { color: var(--chapter-muted); }
.chapter__title {
  margin: 22px 0 0;
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: clamp(48px, 7.2vw, 124px);
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--chapter-ink);
}
.chapter__title:first-child { margin-top: 0; }
.chapter__title em { display: block; font-style: italic; }
.chapter:first-child .chapter__title em,
.chapter--finale .chapter__title em { display: inline; }
.chapter__text {
  margin-top: 26px;
  max-width: 27em;
  font-size: clamp(16px, 1.55vw, 24px);
  line-height: 1.55;
  color: var(--chapter-ink-soft);
}
/* the forest chapter's single line, set larger in the serif (as in the comp) */
.chapter--dark .chapter__text {
  max-width: 15em;
  font-family: var(--serif);
  font-size: clamp(20px, 2.15vw, 34px);
  line-height: 1.3;
}
.chapter__count,
.chapter__sub { display: none; }
/* the finale keeps its original setting */
.chapter--finale { --u: clamp(0.7px, calc(100vw / 1672), 1px); }
.chapter--finale .chapter__card { width: min(560px, 40vw); }
.chapter--finale .chapter__title { font-size: clamp(44px, 5vw, 84px); }
.chapter--finale .chapter__text { margin-top: 24px; max-width: 34em; font-size: clamp(16px, 1.25vw, 19px); line-height: 1.6; }
.chapter--finale .btn { margin-top: 34px; }
.chapter .btn { margin-top: 38px; }
.chapter--dark .btn {
  background: #3a2319;
  box-shadow: inset 0 0 0 1px rgba(247, 239, 229, 0.42);
}
.chapter--dark .btn:hover { background: var(--brown-hover); }

/* Phones and portrait tablets: copy at the top, the jar standing on the
   photo's surface below it, the button at the bottom */
@media (max-width: 767px), (max-aspect-ratio: 1/1) {
  .story { --m: min(100vw / 851, 1px); }

  .chapter {
    flex-direction: column;
    align-items: center;
    padding: max(64px, 11svh) 0 max(24px, 4.5svh);
  }
  .chapter--right,
  .chapter--left { justify-content: flex-start; }

  .chapter__card {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    max-width: 640px;
  }
  .chapter__copy { padding: 0 max(28px, 11vw); }
  .chapter__count {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--sans);
    font-size: 13px;
    letter-spacing: 0.16em;
    color: var(--chapter-muted);
  }
  .chapter__count::after {
    content: "";
    width: 40px;
    height: 1px;
    background: currentColor;
    opacity: 0.8;
  }
  .chapter .eyebrow { display: none; }
  .chapter__title {
    margin-top: 16px;
    font-size: clamp(40px, 13vw, 76px);
    line-height: 0.94;
  }
  .chapter:first-child .chapter__title em,
  .chapter--finale .chapter__title em { display: block; }
  .chapter__text { display: none; }
  .chapter__sub {
    display: block;
    margin-top: 14px;
    font-size: clamp(17px, 4.9vw, 25px);
    line-height: 1.35;
    color: var(--chapter-ink-soft);
  }
  /* plate 1's plant fills the left edge: the copy steps in, as in the comp */
  .chapter[data-world="atelier"] .chapter__copy { padding-left: 25vw; }
  /* the finale keeps its full copy (and its original title size) */
  .chapter--finale .chapter__card { width: 100%; }
  .chapter--finale .chapter__title { font-size: clamp(38px, 10.5vw, 64px); }
  .chapter--finale .eyebrow { display: block; margin-top: 14px; }
  .chapter--finale .chapter__text {
    display: block;
    margin-top: 14px;
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
  }
  .chapter .btn,
  .chapter--finale .btn {
    margin: 0 auto;
    width: min(76vw, 480px);
    white-space: nowrap;
  }
  /* js/story.js fades the copy and button while they scroll across the jar */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
