/* 念誠's page, in the 共振 Resonance site's language: warm paper, one ink, soft drifting blobs, the
   Paper Pals, hand-drawn edges and rules. Flat — no shadows anywhere. The mission and Resonance share one
   sheet of paper (their blobs drift across where one meets the other); only the dark foot rises over it on
   its wavy edge. The palette is the Resonance repo's src/styles/tokens.css. */
:root {
  --cream: oklch(96.5% 0.015 75);
  --cream-dark: oklch(93% 0.018 75);
  --paper: oklch(97.5% 0.01 80);
  --ink: oklch(26% 0.03 60);
  /* The site's muted ink is 52 %; a little deeper so small type holds 4.5:1 over the blobs too. */
  --ink-soft: oklch(46% 0.04 70);
  --terracotta: oklch(62% 0.14 45);
  --terracotta-light: oklch(88% 0.08 55);
  --night: oklch(25% 0.028 55);
  --on-night: oklch(93% 0.015 75);
  --on-night-soft: oklch(85% 0.015 75 / 0.72);

  /* What css/organic.css reads. */
  --accent: color-mix(in oklch, var(--terracotta), black 12%); /* --button-fill */
  --accent-on: var(--cream);
  --accent-tint: color-mix(in oklch, var(--terracotta-light) 75%, var(--cream-dark)); /* --button-tonal */
  --accent-ink: oklch(48% 0.11 45);
  --focus: var(--terracotta);

  --font-display: 'Playfair Display', 'Noto Serif TC', Georgia, serif;
  --font-serif-zh: 'Noto Serif TC', 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', 'Noto Sans TC', system-ui, sans-serif;

  --pad-x: clamp(20px, 5vw, 64px);
  --max-w: 1200px;
  --ease-out: cubic-bezier(0.22, 0.8, 0.25, 1);
  --edge-h: clamp(18px, 2.4vw, 30px);
}

/* ── the two languages: both are in the page, one shows ─────────────── */
html:not([data-lang='en']) [data-l='en'],
html[data-lang='en'] [data-l='zh'] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
/* The paper's grain: fine sand over everything, the site's --grain-opacity. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.1;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.33 0 0 0 0 0.23 0 0 0 0 0.15 0 0 0 1.4 -0.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 300;
  padding: 8px 14px;
  background: var(--paper);
  border-radius: 10px;
  text-decoration: none;
}
.skip:focus-visible { top: 12px; }

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-inline: var(--pad-x);
}

/* ── the bar ─────────────────────────────────────────────────────────── */
.top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top, 0px)) var(--pad-x) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.wordmark {
  font-family: var(--font-serif-zh);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
html[data-lang='en'] .wordmark { font-family: var(--font-display); letter-spacing: -0.01em; font-size: 21px; }
.lang {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  border-radius: 10px;
  padding: 10px 12px;
  margin-right: -12px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.lang-globe, .lang-globe svg { display: block; width: 18px; height: 18px; }

/* ── bands ───────────────────────────────────────────────────────────── */
main { position: relative; isolation: isolate; }
.band { position: relative; isolation: isolate; }
/* One blob layer under both bands, so a blob near where they meet is never cut at the seam. */
.blobs { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blobs canvas { opacity: 0; transition: opacity 900ms ease-out; }
.blobs[data-ready] canvas { opacity: 1; }
/* A band's wavy top edge: its own paper reaching up over the band above. */
.edge {
  position: absolute;
  left: 0;
  bottom: calc(100% - 1px);
  width: 100%;
  height: var(--edge-h);
  display: block;
  z-index: 2;
}
.band--foot { background: var(--night); color: var(--on-night); }
.band--foot .edge { fill: var(--night); }

/* ── 1. the mission ──────────────────────────────────────────────────── */
.band--mission {
  min-height: min(100svh, 980px);
  display: grid;
  align-items: center;
  padding-block: clamp(96px, 14vh, 140px) clamp(72px, 10vh, 120px);
}
.mission {
  width: 100%;
  display: grid;
  /* 摺摺 gets a column its own width, and a wide gap keeps its waving hand well clear of the title. */
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: clamp(48px, 7vw, 120px);
}
.kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: clamp(18px, 2.4vw, 28px);
}
.mission-title {
  font-family: var(--font-serif-zh);
  font-weight: 700;
  font-size: clamp(30px, 3.6vw, 52px);
  line-height: 1.36;
  letter-spacing: 0.02em;
}
/* Chinese breaks only at its comma, never inside a word: on a phone the size is set so the longer half
   (11 characters) always fits the column. */
.mission-title [data-l='zh'] { word-break: keep-all; }
.mission-title [lang='en'] {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.94em;
  line-height: 1.14;
  letter-spacing: -0.02em;
}
.motto {
  margin-top: clamp(20px, 2.6vw, 32px);
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(18px, 1.7vw, 22px);
  color: var(--ink-soft);
}
.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: clamp(28px, 3.6vw, 44px) 0 0 -12px;
  padding: 0;
  list-style: none;
}
.socials li { display: contents; }
.socials a {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  color: var(--ink-soft);
  transition: color 0.3s var(--ease-out);
}
.socials a:hover, .socials a:focus-visible { color: var(--accent-ink); }
.icon, .icon svg { display: block; width: 24px; height: 24px; }

/* The pen's mark under a word: a wavy terracotta stroke, drawn in once the page has loaded. */
.pen-mark { position: relative; white-space: nowrap; }
.pen-mark > svg {
  position: absolute;
  left: -2%;
  width: 104%;
  top: 100%;
  height: 0.22em;
  margin-top: -0.12em;
  overflow: visible;
  color: color-mix(in oklch, var(--terracotta) 85%, var(--terracotta-light));
  pointer-events: none;
}
.pen-mark path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.pen-mark[data-drawn] path { stroke-dashoffset: 0; transition: stroke-dashoffset 1100ms var(--ease-out) 450ms; }

/* ── the Paper Pals ──────────────────────────────────────────────────── */
.stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  /* One rig "mm" is a CSS px at this scale: the puppets grow with the window, within reason. */
  --mm: clamp(0.62px, 0.06vw + 0.5px, 0.95px);
}
.ground {
  position: absolute;
  left: 50%;
  bottom: 0;
  translate: -50% 50%;
  width: min(100%, 300px);
  height: 8px;
  color: color-mix(in oklch, var(--ink) 55%, transparent);
}
.ground svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pal { position: relative; flex: none; }
.pal .pup { position: absolute; }
.pal .pup__body, .pal .pup__face { position: absolute; inset: 0; }
.pal .pup__part { position: absolute; display: block; max-width: none; user-select: none; -webkit-user-select: none; }
.pal .pup__eye-shut { opacity: 0; }
.pal:not([data-loaded]) { visibility: hidden; }
.pal[data-loaded] { animation: pal-in 700ms var(--ease-out) both; }
@keyframes pal-in { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
/* A blink every few seconds, never two together. */
.pal[data-live] .pup__eye-open { animation: blink-open 5.2s steps(1) var(--blink-delay, 0s) infinite; }
.pal[data-live] .pup__eye-shut { animation: blink-shut 5.2s steps(1) var(--blink-delay, 0s) infinite; }
@keyframes blink-open { 0%, 93% { opacity: 1; } 94.5%, 97% { opacity: 0; } 98.5% { opacity: 1; } }
@keyframes blink-shut { 0%, 93% { opacity: 0; } 94.5%, 97% { opacity: 1; } 98.5% { opacity: 0; } }
/* Hello: three waves when it arrives, and again when a pointer comes by. */
.pal[data-hello] .pup__wave { animation: wave 0.62s ease-in-out 6 alternate both; }
@keyframes wave { from { transform: rotate(var(--from)); } to { transform: rotate(var(--to)); } }

.stage--mission {
  /* A little smaller than the pals further down: here it shares the row with the title. */
  --mm: clamp(0.56px, 0.04vw + 0.25px, 0.82px);
  min-height: calc(var(--mm) * 470);
  margin-bottom: 6px;
}

/* ── 2. Resonance ────────────────────────────────────────────────────── */
.band--resonance { padding-block: clamp(72px, 9vw, 128px) clamp(64px, 8vw, 112px); }
.resonance {
  display: grid;
  /* The pals get a column their own width, as 摺摺 does above: never spilling past the page or onto the lead. */
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    'brand  stage'
    'title  stage'
    'lead   stage'
    'body   body';
  column-gap: clamp(48px, 7vw, 120px);
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; margin-bottom: clamp(20px, 2.6vw, 32px); }
.brand-mark, .brand-mark svg { display: block; width: 30px; height: 30px; color: var(--terracotta); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; line-height: 1; }
.brand-name [data-l='zh'] { font-family: var(--font-serif-zh); margin-right: 2px; }
.resonance-title {
  grid-area: title;
  font-family: var(--font-serif-zh);
  font-weight: 700;
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.3;
  letter-spacing: 0.02em;
}
.resonance-title [lang='en'] { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.12; }
.lead {
  grid-area: lead;
  margin-top: clamp(14px, 1.8vw, 22px);
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 34em;
  text-wrap: pretty;
}
.stage--meet {
  grid-area: stage;
  align-self: center;
  /* A little smaller than before, with room between the two of them and their waves. */
  --mm: clamp(0.5px, 0.04vw + 0.22px, 0.74px);
  gap: clamp(14px, 2vw, 32px);
  min-height: calc(var(--mm) * 560);
}
.meet-waves {
  flex: none;
  align-self: center;
  margin-bottom: calc(var(--mm) * 120);
  width: max(30px, calc(var(--mm) * 64));
  height: max(30px, calc(var(--mm) * 64));
  color: var(--terracotta);
}
.meet-waves svg { display: block; width: 100%; height: 100%; }
.meet-waves path { animation: ripple 2.6s ease-in-out infinite; }
.meet-waves path:nth-child(2) { animation-delay: 0.22s; }
.meet-waves path:nth-child(3) { animation-delay: 0.44s; }
@keyframes ripple { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.resonance-body {
  grid-area: body;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(32px, 5vw, 80px);
  margin-top: clamp(48px, 6vw, 80px);
}
.why {
  font-family: var(--font-serif-zh);
  font-size: 17px;
  line-height: 2;
  letter-spacing: 0.03em;
  text-wrap: pretty;
}
html[data-lang='en'] .why { font-family: var(--font-display); font-size: 18px; letter-spacing: 0; line-height: 1.7; }

/* The way in, where the three beliefs used to be: beside the paragraph, the button over the stores. */
.cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  padding-top: 6px;
}
.visit {
  min-height: 52px;
  padding: 14px 30px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
}
.visit .arrow { display: block; flex: none; width: 13px; height: 13px; transition: transform 0.2s var(--ease-out); }
.visit .arrow svg { display: block; width: 100%; height: 100%; }
.visit:hover .arrow { transform: translate(2px, -2px); }
.stores { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 15px; color: var(--ink-soft); }

/* ── the foot ────────────────────────────────────────────────────────── */
.band--foot { padding-block: clamp(48px, 6vw, 72px) max(32px, env(safe-area-inset-bottom, 0px)); }
.foot { display: grid; justify-items: center; text-align: center; gap: 20px; }
.foot-motto { font-family: var(--font-serif-zh); font-size: clamp(20px, 2vw, 26px); font-weight: 600; letter-spacing: 0.04em; }
html[data-lang='en'] .foot-motto { font-family: var(--font-display); font-style: italic; font-weight: 500; letter-spacing: 0; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; font-size: 15px; }
.band--foot .o-link { --o-link: var(--on-night); }
.copy { font-size: 13px; color: var(--on-night-soft); letter-spacing: 0.04em; }

/* ── narrower windows ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .resonance-body { grid-template-columns: minmax(0, 1fr); }
  /* Too narrow for the pals beside the title: they stand under the lead instead. */
  .resonance {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: 'brand' 'title' 'lead' 'stage' 'body';
  }
  .stage--meet { --mm: 0.7px; margin-top: 40px; min-height: calc(var(--mm) * 470); }
}
@media (max-width: 720px) {
  .stage { --mm: clamp(0.4px, 0.135vw, 0.56px); }
  .mission-title { font-size: min(30px, calc((100vw - 2 * var(--pad-x)) / 11.5)); }
  /* With one paper and no edge between them, the space is what tells the two bands apart. */
  .band--mission { min-height: 0; align-items: start; padding-top: 76px; padding-bottom: 104px; }
  .band--resonance { padding-top: 96px; }
  .mission { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .stage--mission { order: -1; justify-self: end; margin-right: 4px; min-height: calc(var(--mm) * 380); }
  .stage--meet { --mm: clamp(0.36px, 0.11vw, 0.46px); gap: 14px; margin-top: 32px; min-height: calc(var(--mm) * 470); }
  .resonance-body { margin-top: 40px; }
  .cta { align-items: stretch; }
  .stores { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .blobs canvas { transition: none; }
  .pal[data-loaded] { animation: none; }
  .pal .pup__eye-open, .pal .pup__eye-shut, .pal .pup__wave, .meet-waves path { animation: none !important; }
  .pen-mark[data-drawn] path { transition: none; }
  .visit .arrow { transition: none; }
}
