/* Open Palate project site. Colors and fonts match the app's light theme (frontend/src/theme.js). */

@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --page: #FBF7F2;
  --paper: #FFFFFF;
  --ink: #2B1B14;
  --ink-soft: #6B5A4E;
  --link: #B35512;
  --link-hover: #8F420C;
  --fill: #D9711F;
  --line: #EFE4D8;
  --field: #E3D3C4;
  --band: #1C130E;
  --band-ink: #F4EDE4;
  --band-soft: #BFAE9E;
  --band-accent: #E0A526;
  --display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
}

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--link); }
a:hover { color: var(--link-hover); }

h1, h2, h3 { font-family: var(--display); margin: 0; }
p { margin: 0; }

.wrap { max-width: 1200px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

/* Header */
.header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-top: 20px; padding-bottom: 20px; }
.brand { flex-grow: 1; display: flex; align-items: center; }
.brand img { display: block; height: 32px; width: auto; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; font-size: 15px; font-weight: 500; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover { text-decoration: underline; }

/* Hero */
.status { font-size: 15px; font-weight: 600; color: var(--link-hover); }
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 48px; padding-top: 40px; padding-bottom: 80px; }
.hero-text { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.hero h1 { font-weight: 800; font-size: clamp(38px, 6vw, 64px); line-height: 1.04; letter-spacing: -0.035em; }
.lede { font-size: 19px; color: var(--ink-soft); max-width: 34rem; }
.hero-photo { flex: 1 1 360px; min-width: 0; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 20px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 24px; padding-bottom: 96px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.card img { width: 100%; height: 240px; object-fit: cover; }
.card-body { padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.card h2 { font-weight: 700; font-size: 24px; letter-spacing: -0.02em; }
.card p { font-size: 16px; color: var(--ink-soft); }
/* Keeps the glasses' printed name out of frame. */
.card img.crop-low { object-position: center 85%; }

/* How it works */
.band { background: var(--band); color: var(--band-ink); }
.band .wrap { padding-top: 80px; padding-bottom: 80px; display: flex; flex-direction: column; gap: 40px; }
.band h2 { font-weight: 800; font-size: 40px; letter-spacing: -0.03em; }
.how-row { display: flex; flex-wrap: wrap; align-items: center; gap: 40px; }
.how-row .steps { flex: 2 1 480px; min-width: 0; }
.how-photo { flex: 1 1 240px; min-width: 0; width: 100%; max-height: 420px; object-fit: cover; border-radius: 20px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 32px; }
.steps li { counter-increment: step; display: flex; flex-direction: column; gap: 10px; }
.steps li::before { content: counter(step); font-family: var(--display); font-weight: 800; font-size: 48px; line-height: 1; color: var(--band-accent); }
.steps h3 { font-family: var(--body); font-weight: 600; font-size: 20px; }
.steps p { font-size: 16px; color: var(--band-soft); }

/* Running it */
.running { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding-top: 80px; padding-bottom: 80px; }
.running-text { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.running h2 { font-weight: 800; font-size: 36px; letter-spacing: -0.03em; }
.running p { color: var(--ink-soft); }

/* Footer */
.footer { border-top: 1px solid var(--line); }
.footer-row { display: flex; flex-wrap: wrap; gap: 12px 32px; padding-top: 32px; padding-bottom: 32px; font-size: 14px; color: var(--ink-soft); }
/* The brand link color is 4.39:1 on the cream page; the darker shade clears 4.5:1 for small text. */
.footer-row a { color: var(--link-hover); }
.credits { flex: 1 1 100%; margin: 0; line-height: 1.5; }
.footer-row a:hover { color: var(--ink); }

/* Scroll intro. Decorative progressive enhancement: hidden unless scroll-driven animations
   are supported and the visitor allows motion, so no fallback is needed. The intro is
   240vh tall; its stage sticks for the extra 140vh while the ring assembles. */
.intro { display: none; }

@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
  @media (prefers-reduced-motion: no-preference) {
    /* 300vh: the stage sticks for 200vh. Timeline in "contain" %: segments assemble 0-42,
       wordmark 36-48, coffee pours 42-55, swirls into wine 58-80, stage leaves from 88. */
    .intro { display: block; height: 300vh; view-timeline: --intro block; }
    .intro-stage {
      position: sticky; top: 0; height: 100vh; overflow: clip;
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
    }
    .intro-ring { width: min(56vw, 46vh, 340px); height: auto; overflow: visible; }
    .intro-words { display: flex; flex-direction: column; align-items: center; gap: 10px; }
    .intro-wordmark {
      font-family: var(--display); font-weight: 800; letter-spacing: -0.035em;
      font-size: clamp(40px, 8vw, 84px); line-height: 1;
    }
    /* The two lines share one grid cell and crossfade. */
    .intro-line { display: grid; font-size: clamp(18px, 2.6vw, 24px); font-weight: 600; color: var(--ink-soft); }
    .intro-line > span { grid-area: 1 / 1; text-align: center; }
    .intro-hint {
      position: absolute; bottom: 32px; font-size: 14px; font-weight: 600;
      letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft);
    }
    .intro-hint::after { content: ""; display: block; width: 1px; height: 32px; margin: 10px auto 0; background: currentColor; }

    .seg, .ring-spin, .pour, .coffee, .wine { transform-box: view-box; transform-origin: 50% 50%; }

    /* Each segment starts pushed out along its own angle (--a) and spun, and lands in
       place; --i staggers them around the ring. */
    .seg {
      animation: seg-assemble linear both;
      animation-timeline: --intro;
      animation-range: contain calc(var(--i) * 2%) contain calc(28% + var(--i) * 2%);
    }
    .ring-spin {
      animation: ring-spin linear both;
      animation-timeline: --intro;
      animation-range: contain 0% contain 45%;
    }
    .intro-wordmark {
      animation: rise-in linear both;
      animation-timeline: --intro;
      animation-range: contain 36% contain 48%;
    }
    .coffee {
      animation: pour-in ease-out both;
      animation-timeline: --intro;
      animation-range: contain 42% contain 55%;
    }
    .glint {
      animation: fade-in linear both;
      animation-timeline: --intro;
      animation-range: contain 50% contain 56%;
    }
    /* The swirl: the whole pool turns (the glint shows it) while wine spreads from the middle. */
    .pour {
      animation: swirl ease-in-out both;
      animation-timeline: --intro;
      animation-range: contain 56% contain 82%;
    }
    .wine {
      animation: pour-in ease-in-out both;
      animation-timeline: --intro;
      animation-range: contain 60% contain 76%;
    }
    .line-coffee {
      animation: rise-in linear both, fade-out linear forwards;
      animation-timeline: --intro, --intro;
      animation-range: contain 44% contain 52%, contain 62% contain 67%;
    }
    .line-wine {
      animation: rise-in linear both;
      animation-timeline: --intro;
      animation-range: contain 67% contain 74%;
    }
    .intro-hint {
      animation: fade-out linear both;
      animation-timeline: --intro;
      animation-range: contain 0% contain 6%;
    }
    .intro-stage {
      animation: stage-out linear both;
      animation-timeline: --intro;
      animation-range: contain 88% exit 40%;
    }
  }
}

/* Set by intro.js once the intro has played (this session), so the header is the top again. */
html.intro-seen .intro { display: none; }

@keyframes seg-assemble {
  from {
    opacity: 0.85;
    transform: rotate(var(--a)) translateY(-70px) rotate(calc(-1 * var(--a))) rotate(-120deg) scale(0.55);
  }
}
@keyframes ring-spin { from { transform: rotate(-135deg); } }
@keyframes pour-in { from { transform: scale(0); } }
@keyframes swirl { to { transform: rotate(540deg); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes stage-out { to { opacity: 0; transform: scale(0.9); } }
