/* ---------- Fonts ---------- */
@font-face { font-family: 'Danmark'; src: url('assets/fonts/danmark-light.ttf') format('truetype'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Danmark'; src: url('assets/fonts/danmark-medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Danmark'; src: url('assets/fonts/danmark-bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Jost'; src: url('assets/fonts/jost-latin.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }

/* ---------- Tokens (from the brand book) ---------- */
:root {
  --brown: #7A4E2D;   /* Wholewheat */
  --olive: #5B6530;   /* Seeded */
  --mustard: #C49A2C; /* Buckwheat */
  --sky: #8DB4D3;     /* Plain */
  --rust: #A4452A;    /* Accent */
  --ink: #151515;     /* Type */
  --cream: #FCFDF4;   /* Ground */

  --display: 'Danmark', 'Jost', sans-serif;
  --text: 'Jost', system-ui, sans-serif;

  --gutter: clamp(16px, 4vw, 56px);
  --rule: 1.5px solid currentColor;
  --header-h: 64px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--text);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--cream); padding: 10px 16px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* slice colours */
.c-olive { fill: var(--olive); }
.c-mustard { fill: var(--mustard); }
.c-sky { fill: var(--sky); }
.c-brown { fill: var(--brown); }

/* labels: caps tracked +300, as the book says — used sparingly */
.label, .hero-meta, .panel-index, .slice-labels, .step-when, .scroll-hint, .panel-facts dt, .order-facts dt, .footer-row {
  font-family: var(--text);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.display {
  font-family: var(--display);
  font-weight: 300;
  line-height: .92;
  letter-spacing: -.01em;
  text-wrap: balance;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 var(--gutter);
  color: var(--ink);
  transition: color .5s var(--ease), background-color .5s var(--ease);
}
.site-header.on-dark { color: var(--cream); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.mini-loaf { width: 44px; height: auto; overflow: visible; }
.mini-loaf use { transition: opacity .4s var(--ease), transform .4s var(--ease); transform-box: fill-box; transform-origin: 50% 100%; }
.mini-loaf.focus use { opacity: .22; }
.mini-loaf.focus use.is-current { opacity: 1; transform: translateY(-10%); }
.site-header.on-dark .mini-loaf.focus use { fill: var(--cream); }
.brand-name { font-family: var(--display); font-weight: 300; font-size: 20px; line-height: 1; white-space: nowrap; }
.site-header nav a { white-space: nowrap; }
.site-header nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 32px); font-size: 15px; font-weight: 500; }
.site-header nav a { text-decoration: none; position: relative; padding: 6px 0; }
.site-header nav a:not(.nav-cta)::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 2px; height: 1.5px;
  background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease);
}
.site-header nav a:not(.nav-cta):hover::after { transform: scaleX(1); transform-origin: left; }
.nav-cta { border: var(--rule); padding: 8px 14px !important; transition: background-color .25s, color .25s; }
.nav-cta:hover { background: var(--ink); color: var(--cream); }
.site-header.on-dark .nav-cta:hover { background: var(--cream); color: var(--ink); }

/* ---------- Hero ---------- */
.hero { position: relative; }
.hero-stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: calc(var(--header-h) + 8px) var(--gutter) 28px;
  gap: 16px;
}
.hero-meta {
  display: flex; justify-content: space-between; gap: 20px;
  border-bottom: var(--rule); padding-bottom: 10px;
}
.loaf-wrap {
  position: relative;
  align-self: center; justify-self: center;
  width: min(100%, 1000px, 120svh);
}
.loaf { width: 100%; height: auto; overflow: visible; }
.slice { transform-box: fill-box; transform-origin: 50% 100%; }

.slice-labels { position: absolute; inset: auto 0 -8px 0; height: 0; }
.slice-labels li {
  position: absolute; left: var(--x); top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  opacity: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.slice-labels li::before { content: ''; width: 1.5px; height: 18px; background: currentColor; }

.hero-words { display: grid; justify-items: center; gap: 10px; position: relative; min-height: 120px; }
.hero-wordmark img { width: clamp(220px, 30vw, 380px); height: auto; }
.hero-line {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--display); font-weight: 300;
  font-size: clamp(40px, 7vw, 104px); line-height: .92; text-align: center; text-wrap: balance;
  opacity: 0;
}
.scroll-hint { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 11px; }
.scroll-hint span { width: 40px; height: 1.5px; background: currentColor; position: relative; overflow: hidden; }
.scroll-hint span::after {
  content: ''; position: absolute; inset: 0; background: var(--rust);
  transform: translateX(-100%); animation: knife 1.8s var(--ease) infinite;
}
@keyframes knife { 60%, 100% { transform: translateX(100%); } }

/* no-JS / reduced motion: show the sliced state */
html:not(.anim) .slice[data-slice="seeded"] { transform: translateX(-40px); }
html:not(.anim) .slice[data-slice="buckwheat"] { transform: translateX(-12px); }
html:not(.anim) .slice[data-slice="plain"] { transform: translateX(12px); }
html:not(.anim) .slice[data-slice="wholewheat"] { transform: translateX(40px); }
html:not(.anim) .slice-labels li { opacity: 1; }
html:not(.anim) .scroll-hint { display: none; }

/* ---------- Loaf panels ---------- */
.loaves { position: relative; }
.loaf-panel {
  position: sticky; top: 0;
  min-height: 100svh;
  background: var(--bg); color: var(--fg);
  overflow: hidden;
}
.panel-inner {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: center;
  gap: clamp(24px, 5vw, 80px);
  padding: calc(var(--header-h) + 24px) var(--gutter) 48px;
}
.panel-art { position: relative; height: min(72svh, 720px); }
.panel-art svg { position: absolute; inset: 0; height: 100%; width: 100%; fill: var(--cream); overflow: visible; }
/* the whole loaf, with this panel's slice lifted out and the rest faded back */
.panel-art use:not(.is-current) { opacity: .2; }
.panel-art use.is-current { transform: translateY(-10px); }
.panel-text { max-width: 640px; width: 100%; container-type: inline-size; }
.panel-index { padding-bottom: 12px; border-bottom: var(--rule); margin-bottom: clamp(20px, 3vw, 36px); }
.panel-name {
  font-family: var(--display); font-weight: 300;
  font-size: min(150px, 17.5cqi); line-height: .86; letter-spacing: -.02em;
  white-space: nowrap;
  margin-bottom: clamp(20px, 3vw, 36px);
}
.panel-name .ch { display: inline-block; }
.panel-name .ch-mask { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.panel-lede { font-size: clamp(18px, 1.5vw, 21px); line-height: 1.55; max-width: 34em; margin-bottom: clamp(24px, 3vw, 40px); }
.panel-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.panel-facts div { border-top: var(--rule); padding-top: 10px; }
.panel-facts dt { font-size: 11px; margin-bottom: 6px; }
.panel-facts dd { font-size: 16px; line-height: 1.4; }

/* ---------- Method ---------- */
.method { position: relative; z-index: 2; background: var(--cream); padding: clamp(96px, 14vw, 180px) var(--gutter) clamp(72px, 10vw, 140px); }
.method-head {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 80px); align-items: end;
  margin-bottom: clamp(56px, 8vw, 110px);
}
.method-head .display { font-size: clamp(52px, 8.4vw, 140px); }
.method-head p { max-width: 26em; font-size: 19px; }

.steps {
  position: relative;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 24px;
  counter-reset: step;
  padding-top: 44px;
}
.steps::before { /* the track */
  content: ''; position: absolute; left: 0; right: 0; top: 11px; height: 1.5px; background: rgba(21, 21, 21, .15);
}
.steps::after { /* the drawn line */
  content: ''; position: absolute; left: 0; right: 0; top: 11px; height: 1.5px; background: var(--ink);
  transform-origin: left; transform: scaleX(var(--progress, 1));
}
.steps li { position: relative; counter-increment: step; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; top: -44px; left: 0;
  width: 26px; height: 26px; display: grid; place-items: center;
  background: var(--cream); border: 1.5px solid var(--ink); border-radius: 50%;
  font-size: 10px; font-weight: 600; letter-spacing: 0;
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}
.steps li.lit::before { background: var(--rust); border-color: var(--rust); color: var(--cream); }
.step-when { display: block; font-size: 11px; color: var(--rust); margin-bottom: 10px; }
.steps h3 { font-family: var(--display); font-weight: 300; font-size: clamp(24px, 2.2vw, 32px); line-height: 1; margin-bottom: 10px; }
.steps p { font-size: 16px; line-height: 1.5; }

/* ---------- Marquee ---------- */
.marquee {
  position: relative; z-index: 2;
  background: var(--cream);
  border-top: var(--rule); border-bottom: var(--rule);
  overflow: hidden;
  padding: clamp(14px, 2vw, 24px) 0;
}
.marquee-track {
  display: flex; align-items: center; width: max-content;
  gap: clamp(20px, 3vw, 44px);
  font-family: var(--display); font-weight: 300;
  font-size: clamp(56px, 9vw, 150px); line-height: 1;
  animation: marquee 32s linear infinite;
}
.marquee-track i { width: .28em; height: .28em; background: var(--ink); border-radius: 50%; flex: none; }
.t-olive { color: var(--olive); }
.t-mustard { color: var(--mustard); }
.t-sky { color: var(--sky); }
.t-brown { color: var(--brown); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Order ---------- */
.order { position: relative; z-index: 2; background: var(--ink); color: var(--cream); padding: clamp(96px, 14vw, 180px) var(--gutter); }
.order-inner {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px); align-items: end;
}
.order .display { font-size: clamp(72px, 14vw, 240px); }
.order-body { display: grid; gap: 32px; max-width: 520px; }
.order-body > p { font-size: 20px; }
.order-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; min-height: 52px; padding: 0 24px;
  font-weight: 500; font-size: 16px; text-decoration: none;
  border: 1.5px solid var(--cream);
  transition: background-color .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn-cream { background: var(--cream); color: var(--ink); }
.btn-cream:hover { background: var(--rust); border-color: var(--rust); color: var(--cream); }
.btn-line:hover { background: var(--cream); color: var(--ink); }
.order-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.order-facts div { border-top: var(--rule); padding-top: 10px; }
.order-facts dt { font-size: 11px; margin-bottom: 6px; opacity: .7; }

/* ---------- Footer ---------- */
.site-footer {
  position: relative; z-index: 2;
  background: var(--rust); color: var(--cream);
  padding: clamp(64px, 10vw, 120px) var(--gutter) 28px;
  display: grid; gap: clamp(48px, 8vw, 96px);
}
.footer-lockup { width: clamp(200px, 26vw, 340px); height: auto; justify-self: center; }
.footer-row { display: flex; justify-content: space-between; gap: 16px; border-top: var(--rule); padding-top: 12px; font-size: 11px; }
.footer-row a { text-decoration: none; }
.footer-row a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .panel-inner { grid-template-columns: 1fr; align-content: center; gap: 20px; }
  .panel-art { height: 30svh; }
  .panel-facts { grid-template-columns: 1fr; gap: 10px; }
  .panel-facts div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
  .method-head, .order-inner { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; row-gap: 40px; padding-top: 0; }
  .steps::before, .steps::after { display: none; }
  .steps li { padding-top: 40px; }
  .steps li::before { top: 0; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .site-header nav a:not(.nav-cta) { display: none; }
  .brand { gap: 10px; }
  .mini-loaf { width: 38px; }
  .brand-name { font-size: 17px; }
  .nav-cta { font-size: 14px; padding: 7px 10px !important; }
  .hero-stage { grid-template-rows: auto minmax(0, 1fr) auto auto; }
  .loaf-wrap { width: 100%; }
  .hero-meta-right { display: none; }
  .slice-labels li { font-size: 10px; letter-spacing: .16em; }
  .slice-labels li:nth-child(even)::before { height: 44px; }
  .panel-lede { margin-bottom: 20px; }
  .panel-facts dd { font-size: 15px; }
  .steps { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .marquee-track { animation: none; }
}
