/* Hank Chen, personal site.
   Palette from 生逢三國's ink register: cool paper, ink, one 朱砂 (cinnabar) accent.
   Shape rule: buttons and keycaps are pills or 6px; media and panels are 6px; nothing else rounds.
   Layers: nav 10, stage overlay 2. */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/fonts/geist-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: "Geist";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/fonts/geist-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, 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;
}
/* Noto Serif TC (SIL OFL), subset to the Chinese this site uses (tools/subset_site_cjk.py) */
@font-face {
  font-family: "Sanguo Serif";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/noto-serif-tc-site.woff2") format("woff2");
}

:root {
  --paper: #eef0eb;
  --paper-2: #f6f7f3;
  --paper-3: #e2e6df;
  --ink: #1d2423;
  --ink-2: #47504d;
  --ink-3: #5c6662;
  --rule: rgba(29, 36, 35, 0.13);
  --rule-strong: rgba(29, 36, 35, 0.26);
  --accent: #b23e2c;
  --accent-hover: #9c3324;
  --accent-wash: rgba(178, 62, 44, 0.08);
  --on-accent: #fbf8f5;
  --shadow: 0 1px 2px rgba(29, 36, 35, 0.06), 0 12px 32px -12px rgba(29, 36, 35, 0.18);
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-cjk: "Sanguo Serif", "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --wrap: 1180px;
  --gutter: clamp(16px, 4.5vw, 44px);
  --section: clamp(72px, 10vw, 128px);
  --radius: 6px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111514;
    --paper-2: #171c1b;
    --paper-3: #1f2524;
    --ink: #e6e9e4;
    --ink-2: #b6bdb9;
    --ink-3: #96a09b;
    --rule: rgba(230, 233, 228, 0.12);
    --rule-strong: rgba(230, 233, 228, 0.24);
    --accent: #e26a53;
    --accent-hover: #ec8470;
    --accent-wash: rgba(226, 106, 83, 0.1);
    --on-accent: #1a0d09;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 84px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "ss01" on;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* paper fibre, on a fixed layer so scrolling never repaints it */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.11 0 0 0 0 0.14 0 0 0 0 0.13 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img,
video,
svg {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

a {
  color: inherit;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cjk {
  font-family: var(--font-cjk);
  font-weight: 500;
  letter-spacing: 0.04em;
  font-synthesis: none;
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.icon {
  width: 1.05em;
  height: 1.05em;
  flex: none;
}

.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: 12px;
  top: -60px;
  z-index: 20;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

/* ------------------------------------------------------------------ nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}

.nav.is-scrolled {
  border-bottom-color: var(--rule);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.seal {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 3px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-cjk);
  font-size: 16px;
  line-height: 1;
  font-weight: 500;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
  font-size: 15px;
}

.nav-links a {
  color: var(--ink-2);
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink);
}

.nav-links .nav-demo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--ink);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.nav-links .nav-demo:hover {
  border-color: var(--ink);
}

@media (max-width: 760px) {
  .nav-links .nav-section {
    display: none;
  }
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 16px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  border-color: var(--rule-strong);
  color: var(--ink);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--ink);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 550;
  text-decoration: none;
  color: var(--ink);
}

.text-link .icon {
  transition: transform 0.2s ease;
}

.text-link:hover .icon {
  transform: translate(2px, -2px);
}

.text-link:hover .icon.icon-right {
  transform: translateX(3px);
}

/* ------------------------------------------------------------------ hero */

.hero {
  padding: clamp(40px, 7vw, 88px) 0 clamp(56px, 8vw, 104px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

.hero h1 {
  font-size: clamp(48px, 8.4vw, 104px);
  letter-spacing: -0.045em;
  line-height: 0.95;
}

.hero-lede {
  margin-top: clamp(22px, 3vw, 32px);
  max-width: 21em;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.hero-sub {
  margin-top: 18px;
  max-width: 34em;
  color: var(--ink-2);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.portrait {
  position: relative;
  margin: 0;
  justify-self: end;
  width: 100%;
  max-width: 420px;
}

.portrait picture,
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
}

.portrait img {
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .portrait {
    order: -1;
    justify-self: start;
    max-width: 240px;
  }

}

/* ------------------------------------------------------------------ sections */

.section {
  padding: var(--section) 0;
  border-top: 1px solid var(--rule);
}

.section-head {
  max-width: 760px;
  margin-bottom: clamp(36px, 5vw, 60px);
}

.section-head h2 {
  font-size: clamp(36px, 5.2vw, 60px);
}

.section-head p {
  margin-top: 18px;
  font-size: clamp(18px, 1.7vw, 20px);
  color: var(--ink-2);
}

.eyebrow {
  display: block;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 550;
  letter-spacing: 0.02em;
  color: var(--accent);
}

/* ------------------------------------------------------------------ beatdapp */

.feature-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
  margin-bottom: clamp(40px, 6vw, 72px);
}

.feature-head h2 {
  font-size: clamp(48px, 8vw, 96px);
  letter-spacing: -0.045em;
}

.roles {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.roles li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.roles strong {
  font-weight: 600;
}

.roles span {
  color: var(--ink-3);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.feature-lede {
  font-size: clamp(19px, 1.9vw, 22px);
  line-height: 1.5;
  color: var(--ink-2);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
}

.metric {
  padding: clamp(24px, 3.4vw, 40px) clamp(16px, 2.4vw, 32px) clamp(24px, 3.4vw, 40px) 0;
}

.metric + .metric {
  padding-left: clamp(16px, 2.4vw, 32px);
  border-left: 1px solid var(--rule);
}

.metric-value {
  display: flex;
  align-items: flex-end;
  min-height: clamp(44px, 6.4vw, 80px);
  font-size: clamp(44px, 6.4vw, 80px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.metric-value.metric-word {
  font-size: clamp(40px, 5.2vw, 66px);
  letter-spacing: -0.045em;
}

.metric-value .accent {
  color: var(--accent);
}

.metric p {
  margin-top: 14px;
  max-width: 17em;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.45;
}

.clients {
  padding: 22px 0 24px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(40px, 6vw, 72px);
}

.clients-label {
  color: var(--ink-3);
  font-size: 15px;
  margin-bottom: 10px;
}

.clients ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px clamp(18px, 2.6vw, 34px);
}

.clients-note {
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 15px;
}

.clients li {
  font-size: clamp(16px, 1.6vw, 19px);
  font-weight: 550;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}

.focus {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.focus-item {
  grid-column: span 4;
  padding: clamp(22px, 2.6vw, 30px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.focus-item.wide {
  grid-column: span 8;
}

.focus-item.full {
  grid-column: span 12;
}

.focus-item.tint {
  background: var(--paper-3);
  border-color: transparent;
}

.focus-item.mark {
  background: var(--accent-wash);
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
}

.focus-item h3 {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.focus-item p {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.55;
}

.focus-item.wide p,
.focus-item.full p {
  max-width: 40em;
}

@media (max-width: 960px) {
  .feature-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .focus-item,
  .focus-item.wide {
    grid-column: span 6;
  }

  .focus-item.full {
    grid-column: span 12;
  }
}

@media (max-width: 680px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .metric,
  .metric + .metric {
    padding: 22px 0;
    border-left: 0;
  }

  .metric + .metric {
    border-top: 1px solid var(--rule);
  }

  .focus-item,
  .focus-item.wide,
  .focus-item.full {
    grid-column: span 12;
  }
}

/* ------------------------------------------------------------------ experience */

.timeline {
  display: grid;
}

.timeline > li {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: clamp(18px, 4vw, 56px);
  padding: 30px 0;
  border-top: 1px solid var(--rule);
}

.timeline > li:last-child {
  border-bottom: 1px solid var(--rule);
}

.when {
  color: var(--ink-3);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  padding-top: 4px;
}

.timeline h3 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.where {
  margin-top: 4px;
  color: var(--ink-2);
}

.timeline p.what {
  margin-top: 12px;
  max-width: 44em;
  color: var(--ink-2);
}

.exp-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  margin-top: clamp(48px, 6vw, 80px);
}

.exp-split h3 {
  font-size: 15px;
  font-weight: 550;
  letter-spacing: 0.01em;
  color: var(--ink-3);
  margin-bottom: 16px;
}

.edu li + li {
  margin-top: 18px;
}

.edu strong {
  display: block;
  font-weight: 600;
}

.edu span {
  display: block;
  color: var(--ink-2);
  font-size: 16px;
}

.toolkit {
  display: grid;
  gap: 14px;
}

.toolkit li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  font-size: 16px;
}

.toolkit li > span:first-child {
  color: var(--ink-3);
}

.toolkit li > span:last-child {
  color: var(--ink-2);
}

@media (max-width: 760px) {
  .timeline > li {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .exp-split {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ research */

.research-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

.paper-feature {
  position: sticky;
  top: 96px;
  padding: clamp(26px, 3vw, 36px);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
}

.paper-feature .venue {
  font-size: 14px;
  font-weight: 550;
  color: color-mix(in srgb, var(--paper) 70%, transparent);
}

.paper-feature h3 {
  margin-top: 14px;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.paper-feature h3 a {
  text-decoration-color: color-mix(in srgb, var(--paper) 35%, transparent);
}

.paper-feature .authors {
  margin-top: 14px;
  font-size: 15px;
  color: color-mix(in srgb, var(--paper) 78%, transparent);
}

.scholar-stats {
  display: flex;
  gap: 32px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid color-mix(in srgb, var(--paper) 22%, transparent);
}

.scholar-stats strong {
  display: block;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.scholar-stats span {
  font-size: 14px;
  color: color-mix(in srgb, var(--paper) 70%, transparent);
}

.paper-feature .text-link {
  margin-top: 26px;
  color: var(--paper);
}

.pub-group + .pub-group {
  margin-top: 40px;
}

.pub-group h3 {
  font-size: 15px;
  font-weight: 550;
  letter-spacing: 0.01em;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.pubs li {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}

.pubs .t {
  display: block;
  font-weight: 550;
  line-height: 1.4;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.pubs .t:hover {
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
}

.pubs .m {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  color: var(--ink-3);
}

.pubs .m b,
.paper-feature .authors b {
  font-weight: 600;
  color: var(--ink);
}

.paper-feature .authors b {
  color: var(--paper);
}

.pubs .m i {
  font-style: italic;
}

@media (max-width: 900px) {
  .research-grid {
    grid-template-columns: 1fr;
  }

  .paper-feature {
    position: static;
  }
}

/* ------------------------------------------------------------------ projects */

.project {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}

.project + .project {
  margin-top: clamp(64px, 9vw, 112px);
}

.project.flip {
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
}

.project.flip .project-media {
  order: 2;
}

.project-media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--paper-3);
  box-shadow: var(--shadow);
}

.project-media video,
.project-media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.project-media.browser {
  aspect-ratio: auto;
  border: 1px solid var(--rule);
}

.project-media.browser img {
  aspect-ratio: 1440 / 900;
  object-position: top;
}

.project-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
}

.project-title .cjk {
  font-size: clamp(40px, 5vw, 60px);
  line-height: 1;
}

.project-title .latin {
  font-size: clamp(22px, 2.2vw, 26px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-2);
}

.project h3.project-name {
  font-size: clamp(36px, 4.4vw, 52px);
  letter-spacing: -0.04em;
}

.project-tag {
  margin-top: 16px;
  font-size: clamp(19px, 1.8vw, 21px);
  line-height: 1.4;
  color: var(--ink);
}

.project-body {
  margin-top: 14px;
  color: var(--ink-2);
}

.ticks {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.ticks li {
  position: relative;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.55;
}

.ticks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 9px;
  height: 2px;
  background: var(--accent);
}

.project .cta-row {
  margin-top: 28px;
}

@media (max-width: 900px) {
  .project,
  .project.flip {
    grid-template-columns: 1fr;
  }

  .project.flip .project-media {
    order: 0;
  }
}

/* ------------------------------------------------------------------ contact & footer */

.contact {
  padding: var(--section) 0 calc(var(--section) * 0.8);
  border-top: 1px solid var(--rule);
}

.contact h2 {
  font-size: clamp(44px, 7vw, 88px);
  letter-spacing: -0.045em;
}

.contact p {
  margin-top: 22px;
  max-width: 34em;
  font-size: clamp(18px, 1.8vw, 21px);
  color: var(--ink-2);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 40px;
  margin-top: 40px;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 550;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.contact-links a .icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.contact-links a span {
  border-bottom: 1px solid var(--rule-strong);
  transition: border-color 0.2s ease;
}

.contact-links a:hover span {
  border-color: currentColor;
}

.footer {
  padding: 28px 0 40px;
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 14px;
}

.footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

.footer a {
  color: var(--ink-2);
}

/* ------------------------------------------------------------------ battle demo page */

.demo-intro {
  padding: clamp(36px, 6vw, 72px) 0 clamp(28px, 4vw, 44px);
}

.demo-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 22px;
}

.demo-title h1 {
  font-size: clamp(52px, 8vw, 96px);
  line-height: 1;
}

.demo-title .latin {
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-2);
}

.demo-intro p {
  margin-top: 18px;
  max-width: 40em;
  font-size: clamp(18px, 1.8vw, 20px);
  color: var(--ink-2);
}

.stage-wrap {
  position: relative;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: #e9ebe6;
  box-shadow: var(--shadow);
}

.stage:fullscreen {
  border-radius: 0;
  background: #e9ebe6;
}

.stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.stage-poster {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
}

.stage-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(17, 21, 20, 0.1), rgba(17, 21, 20, 0.5));
}

.stage-start {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: #f4f5f1;
}

.stage-start .btn {
  min-height: 54px;
  padding: 0 28px;
  font-size: 17px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.lang-start {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn-light {
  background: rgba(246, 247, 243, 0.94);
  color: #1d2423;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.btn-light:hover {
  background: #ffffff;
}

.lang-toggle {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-2);
}

.lang-toggle button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-toggle button:hover {
  color: var(--ink);
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.stage-note {
  max-width: 30em;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(17, 21, 20, 0.66);
  font-size: 15px;
  line-height: 1.45;
}

/* phones: the note sits under the stage, where it has room and full contrast */
.stage-note-below {
  display: none;
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 14px;
}

.stage-wrap.is-live + .stage-note-below {
  display: none;
}

/* touch devices only watch: swipes scroll the page and no focus chip is offered */
.stage-wrap.watch-only iframe {
  pointer-events: none;
}

.stage-wrap.watch-only .stage-focus {
  display: none !important;
}

.video-toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 21, 20, 0.62);
  color: #f4f5f1;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.video-toggle:hover {
  background: rgba(17, 21, 20, 0.8);
}

.video-toggle[hidden] {
  display: none;
}

.stage-focus {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 2;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 21, 20, 0.82);
  color: #f4f5f1;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.stage-wrap.is-live.is-blurred .stage-focus {
  display: inline-flex;
}

.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.scene-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-2);
}

.scene-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.scene-tab .cjk {
  font-size: 17px;
  letter-spacing: 0.02em;
}

.scene-tab:hover {
  color: var(--ink);
}

.scene-tab[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.demo-tools {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.chip:hover {
  border-color: var(--ink);
}

.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.chip[hidden] {
  display: none;
}

.heroes {
  margin-top: 28px;
}

.heroes-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 20px;
  margin-bottom: 14px;
}

.heroes-head h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.heroes-head p {
  color: var(--ink-3);
  font-size: 15px;
}

.hero-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.hero-pick {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.hero-pick:hover {
  border-color: var(--rule-strong);
}

.hero-pick[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.hero-pick img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(0.35) contrast(1.05);
}

.hero-pick .name {
  display: block;
  font-family: var(--font-cjk);
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.hero-pick .jj {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-pick .jj .cjk {
  display: inline-block;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

@media (max-width: 1000px) {
  .hero-list {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}

.keys {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.key-group {
  padding: 22px 24px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.key-group h3 {
  font-size: 15px;
  font-weight: 550;
  letter-spacing: 0.01em;
  color: var(--ink-3);
  margin-bottom: 12px;
}

.key-group li {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 6px 0;
  font-size: 15px;
  color: var(--ink-2);
}

kbd {
  display: inline-block;
  min-width: 26px;
  padding: 2px 7px;
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

kbd + kbd {
  margin-left: 3px;
}

@media (max-width: 760px) {
  .keys {
    grid-template-columns: 1fr;
  }
}

.scenes {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.scene-card {
  grid-column: span 4;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.scene-card.lead {
  grid-column: span 6;
}

.scene-card.lead + .scene-card {
  grid-column: span 6;
}

.scene-card.wide {
  grid-column: span 12;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.scene-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.scene-card.wide img {
  height: 100%;
}

.scene-card .body {
  padding: 22px 24px 26px;
}

.scene-card h3 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.scene-card h3 .cjk {
  font-size: 22px;
}

.scene-card p {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 16px;
}

@media (max-width: 860px) {
  .scene-card,
  .scene-card.lead,
  .scene-card.lead + .scene-card {
    grid-column: span 12;
  }

  .scene-card.wide {
    grid-template-columns: 1fr;
  }
}

.notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 48px);
}

.notes h3 {
  font-size: 19px;
  letter-spacing: -0.02em;
}

.notes p {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 16px;
}

@media (max-width: 860px) {
  .notes {
    grid-template-columns: 1fr;
  }
}

.back-link {
  margin-top: 48px;
}

@media (max-width: 600px) {
  .scene-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    border-radius: 14px;
  }

  .scene-tab {
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 8px 4px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
  }

  .demo-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .hero-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-pick {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 10px;
  }

  .hero-pick img {
    width: 36px;
    height: 36px;
  }

  .hero-pick .jj {
    white-space: normal;
  }

  .key-group {
    padding: 18px 16px;
  }

  .key-group li {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 8px;
  }

  kbd {
    min-width: 22px;
    padding: 1px 5px;
    font-size: 12px;
  }

  .stage-start {
    gap: 8px;
    padding: 12px;
  }

  .stage-start .btn {
    min-height: 44px;
    padding: 0 20px;
    font-size: 15px;
  }

  .stage-note {
    display: none;
  }

  .stage-note-below {
    display: block;
  }
}

/* ------------------------------------------------------------------ 404 */

.lost {
  min-height: 70vh;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 18px;
  padding-top: 80px;
  padding-bottom: 80px;
}

.lost .cjk {
  font-size: clamp(64px, 12vw, 140px);
  line-height: 1;
  color: var(--accent);
}

.lost h1 {
  font-size: clamp(30px, 4vw, 44px);
}

.lost p {
  color: var(--ink-2);
  max-width: 32em;
}

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: calc(var(--i, 0) * 70ms);
  }

  .js .reveal.is-in,
  .reveal-all .reveal {
    opacity: 1;
    transform: none;
  }
}
