:root {
  --paper: #ecede8;
  --paper-raised: #f7f7f4;
  --ink: #1b1d22;
  --graphite: #62666e;
  --rule: #c9cbc4;
  --leth: #0050dc;
  --menu: #e8501a;
  --focus: #0050dc;
  --panel: #e2e3dc;   /* behind product pictures: a shade under the paper, not white */

  --font: "Schibsted Grotesk", "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1240px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15161a;
    --paper-raised: #1d1f24;
    --ink: #e7e8e3;
    --graphite: #9a9ea6;
    --rule: #33363d;
    --leth: #5b93ff;
    --menu: #ff7a45;
    --focus: #8fb3ff;
    --panel: #24262b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15161a;
  --paper-raised: #1d1f24;
  --ink: #e7e8e3;
  --graphite: #9a9ea6;
  --rule: #33363d;
  --leth: #5b93ff;
  --menu: #ff7a45;
  --focus: #8fb3ff;
  --panel: #24262b;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-feature-settings: "ss01", "tnum" 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

/* Bilingual: both languages live in the markup, the root decides which shows. */
html[data-lang="en"] [data-l="zh"],
html[data-lang="zh"] [data-l="en"] { display: none; }
html[data-lang="zh"] body { line-height: 1.75; letter-spacing: 0.01em; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--gutter); top: 12px; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 8px 12px; text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ---------- header ---------- */
.bar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px var(--gutter);
  display: flex;
  align-items: center;
  gap: 32px;
}
.mark {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; font-weight: 800; font-size: 1.125rem; letter-spacing: -0.02em;
}
/* the viewBox frames only the E so it centres on the wordmark; the orange piece overhangs */
.mark svg { width: 18.6px; height: 21px; overflow: visible; }

.lang { margin-left: auto; display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 3px; }
.lang button {
  font: inherit; font-size: 0.8125rem; font-weight: 600; line-height: 1;
  color: var(--graphite); background: none; border: 0; border-radius: 999px;
  padding: 7px 12px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- hero ---------- */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.field {
  position: relative;
  /* fill the first screen below the header (--bar-h is set from the real header height in main.js) */
  height: calc(100svh - var(--bar-h, 88px));
  min-height: 320px;
  margin: 0;
  touch-action: pan-y;
}
.field canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- sections ---------- */
.products, .about, .contact {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(72px, 10vw, 140px) var(--gutter) 0;
}
.section-title {
  margin: 0 0 clamp(32px, 5vw, 56px);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--graphite);
  letter-spacing: 0;
  display: flex; align-items: center; gap: 16px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* ---------- products ---------- */
.product {
  --accent: var(--ink);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(16px, 2.5vw, 32px);
  row-gap: 40px;
  align-items: center;
}
.product + .product { margin-top: clamp(112px, 13vw, 180px); }
.product--lethenaut { --accent: var(--leth); }
.product--menu { --accent: var(--menu); }

/* text and picture sit side by side; the second product mirrors the first */
.product-body { grid-column: 1 / span 5; grid-row: 1; }
.shot { grid-column: 7 / span 6; grid-row: 1; margin: 0; }
.product--menu .product-body { grid-column: 8 / span 5; }
.product--menu .shot { grid-column: 1 / span 6; }

.shot--leth { background: var(--panel); border-radius: 10px; overflow: hidden; }
.loop-video { display: block; width: 100%; height: auto; }

/* MenuFactory: four separate drink photos fly together and fuse into one group shot
   (ported from menufactory.ai). main.js steps data-phase: sources -> fusing -> result. */
.fusion {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}
.fusion-photo {
  position: absolute;
  top: 50%; left: 50%;
  width: 31%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 3px solid #fff;
  border-radius: 10px;
  box-shadow: rgba(45, 42, 38, 0.1) 0 0 0 1px, rgba(45, 42, 38, 0.08) 0 4px 12px;
  opacity: 0;
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}
.fusion-photo:nth-child(1) { transform: translate(-124%, -80%) rotate(-8deg); }
.fusion-photo:nth-child(2) { transform: translate(22%, -86%) rotate(7deg); }
.fusion-photo:nth-child(3) { transform: translate(-118%, -8%) rotate(-5deg); }
.fusion-photo:nth-child(4) { transform: translate(28%, -4%) rotate(6deg); }
.fusion[data-phase="sources"] .fusion-photo { opacity: 1; }
.fusion[data-phase="sources"] .fusion-photo:nth-child(2) { transition-delay: 160ms; }
.fusion[data-phase="sources"] .fusion-photo:nth-child(3) { transition-delay: 320ms; }
.fusion[data-phase="sources"] .fusion-photo:nth-child(4) { transition-delay: 480ms; }
.fusion[data-phase="fusing"] .fusion-photo { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }

.fusion-spark {
  position: absolute; inset: 0; margin: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.05em; color: var(--graphite);
  opacity: 0; transform: scale(0.7);
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.fusion-spark span:first-child { font-size: 2rem; line-height: 1; color: var(--menu); }
.fusion[data-phase="fusing"] .fusion-spark { opacity: 1; transform: none; }

.fusion-result {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(0.88);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.fusion[data-phase="result"] .fusion-result { opacity: 1; transform: none; }

.product-detail { margin-top: 22px; }

.product-id {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.product-id img { width: 36px; height: 36px; border-radius: 9px; }
.product-name { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }

.tagline {
  margin: 22px 0 0;
  font-size: clamp(1.875rem, 3.1vw, 2.75rem);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-wrap: balance;
  max-width: 14em;
}
html[data-lang="zh"] .tagline { letter-spacing: 0.02em; line-height: 1.25; max-width: 11em; }

.product-detail p { margin: 0; }

.visit {
  display: inline-block;
  margin-top: 24px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  padding-bottom: 3px;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 100% 2px no-repeat;
  transition: background-size 0.25s ease;
}
.visit:hover { background-size: 40% 2px; }

/* ---------- about ---------- */
.about-body {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(16px, 2.5vw, 32px);
}
.about-big {
  grid-column: 1 / span 10;
  margin: 0;
  font-size: clamp(1.75rem, 4.2vw, 3.5rem);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
html[data-lang="zh"] .about-big { letter-spacing: 0.04em; line-height: 1.45; font-weight: 500; }

/* ---------- contact ---------- */
.contact { padding-bottom: clamp(72px, 10vw, 140px); }
.contact-line { margin: 0; }
.contact-line a {
  font-size: clamp(1.75rem, 5.6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--ink), var(--ink)) left 100% / 0 3px no-repeat;
  transition: background-size 0.3s ease;
  padding-bottom: 4px;
}
.contact-line a:hover { background-size: 100% 3px; }
.contact-note { margin: 24px 0 0; color: var(--graphite); font-size: 0.9375rem; max-width: 40em; }

/* ---------- footer ---------- */
.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
  border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 0.875rem; color: var(--graphite);
}
.foot p { margin: 0; }
.foot-links { display: flex; gap: 20px; }
.foot-links a { text-decoration: none; }
.foot-links a:hover { color: var(--ink); }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .bar { gap: 16px; }
  .product-body, .shot,
  .product--menu .product-body,
  .product--menu .shot { grid-column: 1 / -1; grid-row: auto; }
  .about-big { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .visit, .contact-line a { transition: none; }
}

/* Chinese headlines break only between phrases, never inside a word. */
.ph { display: inline-block; }
html[data-lang="zh"] .tagline,
html[data-lang="zh"] .about-big { text-wrap: wrap; }

/* about headline, split into characters by main.js */
.about-big .w { display: inline-block; white-space: nowrap; }
.about-big .ch { display: inline-block; will-change: transform; }
