/* ==========================================================================
   SAME DREAM PROJECT — DESIGN SYSTEM
   Warm-paper canvas · paint accents · editorial typography
   ========================================================================== */

/* ---------------------------------------------------------------- fonts --- */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 900;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/Fraunces-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('../fonts/Fraunces-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Archivo-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Archivo-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --------------------------------------------------------------- tokens --- */
:root {
  /* paper */
  --paper:        #FBF8F2;
  --paper-warm:   #F6F1E7;
  --paper-deep:   #EFE8DA;
  --paper-frame:  #FFFFFF;

  /* ink */
  --ink:          #1B1815;
  --ink-soft:     #524B43;
  --ink-mute:     #7C746A;
  --ink-faint:    #B4ABA0;
  --ink-line:     #E2DACC;

  /* paint — restrained artistic accents */
  --paint-yellow:    #E5B23C;
  --paint-vermilion: #D4532B;
  --paint-cobalt:    #2F53A8;
  --paint-green:     #6E9C63;
  --paint-pink:      #D98793;
  --paint-black:     #14110F;

  /* unit voices */
  --unit-01: #D4532B;   /* colour & emotion        */
  --unit-02: #2F53A8;   /* composition & perspective */
  --unit-03: #1B1815;   /* point line plane        */
  --unit-04: #6E9C63;   /* creative storytelling   */

  /* type */
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, 'Songti SC', serif;
  --font-ui: 'Archivo', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-ui-zh: 'Archivo', 'Noto Sans SC', -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-display-zh: 'Fraunces', Georgia, 'Noto Serif SC', 'Songti SC', serif;

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0.0, 0.2, 1);
  --dur-1: 0.4s;
  --dur-2: 0.8s;
  --dur-3: 1.4s;

  /* layout */
  --gutter: clamp(1.25rem, 5vw, 5.5rem);
  --measure: 62ch;
  --nav-h: 4.5rem;

  --paper-grain: 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.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.42'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- reset --- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  font-weight: 500;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  font-size: clamp(0.98rem, 0.35vw + 0.9rem, 1.0625rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
}
html[lang="zh"] body { font-family: var(--font-ui-zh); line-height: 1.85; }
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
h1,h2,h3,h4,h5,h6 { line-height: 1.1; font-weight: 700; letter-spacing: -0.015em; }
p a, li a { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: var(--ink-faint); }
p a:hover, li a:hover { text-decoration-color: var(--paint-vermilion); }
.nav a, .mobile-menu a, .footer a, .check-list a, .flow-band a, .lesson-row, .archive-lesson, .res-card a, .home-unit-list a { text-decoration: none; }

::selection { background: var(--paint-yellow); color: var(--paint-black); }

:focus-visible {
  outline: 2.5px solid var(--paint-cobalt);
  outline-offset: 3px;
  border-radius: 2px;
}

/* subtle paper grain — sits above background, below content */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--paper-grain);
  opacity: 0.045;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: multiply;
}

/* ------------------------------------------------------------ typography --- */
.display-xl {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 62, 'WONK' 1;
  font-weight: 780;
  letter-spacing: -0.03em;
  line-height: 0.94;
  font-size: clamp(2.9rem, 9.2vw, 8.4rem);
}
html[lang="zh"] .display-xl {
  font-family: var(--font-display-zh);
  font-variation-settings: 'opsz' 144, 'SOFT' 40, 'WONK' 0;
  letter-spacing: 0.01em;
  line-height: 1.12;
  font-size: clamp(2.3rem, 7.4vw, 6rem);
}
.display-lg {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 100, 'SOFT' 50, 'WONK' 1;
  font-weight: 740;
  letter-spacing: -0.025em;
  line-height: 1.02;
  font-size: clamp(2.1rem, 5.4vw, 4.4rem);
}
html[lang="zh"] .display-lg {
  font-family: var(--font-display-zh);
  font-variation-settings: 'opsz' 100, 'SOFT' 30, 'WONK' 0;
  line-height: 1.22;
  font-size: clamp(1.8rem, 4.4vw, 3.4rem);
}
.display-md {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 60, 'SOFT' 40, 'WONK' 1;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.08;
  font-size: clamp(1.5rem, 2.9vw, 2.5rem);
}
html[lang="zh"] .display-md { line-height: 1.32; font-size: clamp(1.35rem, 2.5vw, 2.1rem); }

.lede {
  font-size: clamp(1.08rem, 1.15vw + 0.8rem, 1.4rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 44ch;
}
html[lang="zh"] .lede { line-height: 1.95; max-width: 40ch; }

.body-copy { color: var(--ink-soft); max-width: var(--measure); }
.small { font-size: 0.84rem; color: var(--ink-mute); }

.eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
html[lang="zh"] .eyebrow { letter-spacing: 0.34em; }

.index-number {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 1;
  font-weight: 300;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 0.8;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* hand-annotated accents */
.hand-note {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 30, 'SOFT' 100, 'WONK' 1;
  font-style: italic;
  font-weight: 560;
  color: var(--paint-vermilion);
  font-size: 0.95em;
}

/* ---------------------------------------------------------------- layout --- */
.shell { position: relative; z-index: 2; }
.wrap {
  width: 100%;
  max-width: 1480px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap-narrow { max-width: 1080px; }
.section { position: relative; padding-block: clamp(4.5rem, 11vw, 11rem); }
.section-tight { padding-block: clamp(3rem, 7vw, 6.5rem); }

.rule { border: 0; border-top: 1px solid var(--ink-line); margin: 0; }

/* asymmetric editorial grid */
.grid-editorial {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(1rem, 2.4vw, 2.5rem);
  align-items: start;
}
.grid-editorial > * { grid-column: span 6; }
.grid-editorial > *:first-child:nth-last-child(3),
.grid-editorial > *:first-child:nth-last-child(3) ~ * { grid-column: span 4; }

/* ----------------------------------------------------------------- paint --- */
.paint-dot {
  display: inline-block;
  border-radius: 50% 46% 52% 48% / 48% 52% 46% 52%;
  background: var(--c, var(--paint-vermilion));
  width: var(--s, 1em);
  height: var(--s, 1em);
  transform: rotate(var(--r, 0deg));
}

/* brush underline drawn under key words */
.brush-underline { position: relative; display: inline-block; }
.brush-underline > svg {
  position: absolute;
  left: -0.08em; right: -0.08em;
  bottom: -0.18em;
  width: 116%;
  height: 0.42em;
  overflow: visible;
  pointer-events: none;
}
.brush-underline > svg path {
  fill: none;
  stroke: var(--paint-yellow);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  pathLength: 1;
}

/* paint swatch tab, used beside unit titles */
.swatch {
  width: 0.85em; height: 0.85em;
  border-radius: 50% 44% 54% 46% / 46% 56% 44% 54%;
  display: inline-block;
  background: var(--c, var(--ink));
  flex: none;
}

/* ---------------------------------------------------------------- button --- */
.btn {
  --btn-ink: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.65em;
  padding: 0.95em 1.7em;
  border: 1.5px solid var(--btn-ink);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  background: transparent;
  color: var(--btn-ink);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--btn-ink);
  transform: translateY(101%);
  transition: transform var(--dur-1) var(--ease-out);
  border-radius: inherit;
  z-index: 0;
}
.btn > * { position: relative; z-index: 1; }
.btn:hover, .btn:focus-visible { color: var(--paper); }
.btn:hover::before, .btn:focus-visible::before { transform: translateY(0); }
.btn--fill { background: var(--btn-ink); color: var(--paper); }
.btn--fill::before { background: var(--paint-vermilion); }
.btn--fill:hover, .btn--fill:focus-visible { color: var(--paper); border-color: var(--paint-vermilion); }
.btn--sm { padding: 0.6em 1.15em; font-size: 0.83rem; }
.btn .arrow { transition: transform var(--dur-1) var(--ease-out); }
.btn:hover .arrow { transform: translateX(0.28em); }
html[lang="zh"] .btn:hover .arrow { transform: translateX(0.2em); }

.textlink {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-weight: 700; border-bottom: 2px solid var(--ink);
  padding-bottom: 2px; transition: color var(--dur-1), border-color var(--dur-1);
}
.textlink:hover { color: var(--paint-vermilion); border-color: var(--paint-vermilion); }

/* --------------------------------------------------------------- reveal ---- */
/* Motion engine adds .in when a block enters; base state hides only what is safe */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
[data-reveal].in { opacity: 1; transform: none; }
[data-reveal="fade"] { transform: none; }
[data-reveal="left"] { transform: translateX(-34px); }
[data-reveal="right"] { transform: translateX(34px); }
[data-reveal="scale"] { transform: scale(0.92); }
[data-reveal="blur"] { filter: blur(9px); transform: none; }
[data-reveal="blur"].in { filter: blur(0); }

/* no-motion / reduced-motion fallback */
html.no-motion [data-reveal],
html.no-motion [data-reveal].in { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }

/* Hide translated strings for one frame so Chinese users never see English flash.
   Only active when JS is running (html.js), so no-JS visitors always see content. */
html.js[data-pending="zh"] [data-i18n] { visibility: hidden; }

/* ------------------------------------------------------------- utilities --- */
.u-hide { display: none !important; }
.u-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.u-center { text-align: center; }
.u-stack > * + * { margin-top: var(--gap, 1rem); }
.tape {
  position: relative;
}
.tape::after {
  content: '';
  position: absolute;
  top: -0.6rem; left: 50%;
  width: 5.5rem; height: 1.5rem;
  transform: translateX(-50%) rotate(-2.2deg);
  background: rgba(229, 178, 60, 0.42);
  border-inline: 1px dashed rgba(20, 17, 15, 0.16);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
