/* Sean Syue — portfolio. Editorial layout with the Heart Apartment palette. */

:root {
  --ground: #f3ede2;
  --paper: #fbf8f2;
  --ink: #23271f;
  --ink-2: #4a4d44;
  --ink-3: #6b6a5e;
  --rule: #ddd3c2;
  --rule-strong: #23271f;
  --sage: #3f6b56;
  --sage-deep: #2c4f3f;
  --sage-wash: #e3eadf;
  --sage-rule: #c7d3c9;
  --forest: #26352d;
  --forest-2: #45574c;
  --forest-text: #bccabf;
  --terracotta: #a8472a;
  --wood: #7a5a3a;
  --forest-on: #f3ede2;
  --shadow-soft: 0 2px 0 #e2d8c6;
  --shadow-lift: 0 20px 40px rgba(72, 58, 40, .16);

  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Public Sans', system-ui, sans-serif;
  --round: 'Zen Maru Gothic', 'Noto Sans TC', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --max: 1320px;
  --gutter: 16px;
  --header-h: 72px;
}
@media (min-width: 720px) { :root { --gutter: 40px; } }
@media (min-width: 1100px) { :root { --gutter: 56px; } }
/* wide monitors: use the room instead of leaving the page marooned in the middle */
@media (min-width: 1600px) { :root { --max: 1560px; --gutter: 64px; } body { font-size: 18px; } }
@media (min-width: 1920px) { :root { --max: 1720px; } }

/* Night mode: same warm palette after dark. Follows the system unless the
   visitor picks a side with the header toggle (stored in localStorage). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #13161a;
    --paper: #1b1f24;
    --ink: #e9edf1;
    --ink-2: #b6bdc6;
    --ink-3: #868d97;
    --rule: #2b313a;
    --rule-strong: #68707c;
    --sage: #7fc3a4;
    --sage-deep: #a8dbc1;
    --sage-wash: #1d2630;
    --sage-rule: #33404c;
    --forest: #0e1114;
    --forest-2: #333c46;
    --forest-text: #a4aeb9;
    --terracotta: #e79878;
    --wood: #c9a97e;
    --forest-on: #e9edf1;
    --shadow-soft: 0 1px 0 #262c34;
    --shadow-lift: 0 20px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #13161a;
  --paper: #1b1f24;
  --ink: #e9edf1;
  --ink-2: #b6bdc6;
  --ink-3: #868d97;
  --rule: #2b313a;
  --rule-strong: #68707c;
  --sage: #7fc3a4;
  --sage-deep: #a8dbc1;
  --sage-wash: #1d2630;
  --sage-rule: #33404c;
  --forest: #0e1114;
  --forest-2: #333c46;
  --forest-text: #a4aeb9;
  --terracotta: #e79878;
  --wood: #c9a97e;
  --shadow-soft: 0 1px 0 #262c34;
  --shadow-lift: 0 20px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; height: auto; display: block; }
/* grid and flex children may shrink below their content width */
main * { min-width: 0; }
h1, h2, h3, p, li, td { overflow-wrap: break-word; }
a { color: var(--sage); text-underline-offset: 3px; }
a:hover { color: var(--sage-deep); }
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 3px; border-radius: 4px; }
[lang="zh-Hant"] { font-family: var(--round); font-weight: 500; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--ground) 92%, transparent); backdrop-filter: blur(8px); }
.site-header .wrap { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { font-family: var(--serif); font-size: 22px; font-weight: 500; color: var(--ink); text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 2px; min-width: 0; }
@media (max-width: 720px) { /* two rows: name and theme button, then all four links in full */
  :root { --header-h: 100px; }
  .site-header .wrap { flex-wrap: wrap; align-content: center; row-gap: 4px; padding-block: 8px; }
  .brand { order: 0; }
  .theme-toggle { order: 1; margin-left: auto; }
  .nav { order: 2; flex-basis: 100%; justify-content: space-between; }
}
.nav a { color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; padding: 9px 12px; border-radius: 999px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--sage-wash); color: var(--ink); }
@media (max-width: 520px) { .nav a { padding: 8px 6px; font-size: 15px; } .brand { font-size: 19px; } .theme-toggle { width: 36px; height: 36px; flex: none; } }

/* Work menu: opens on hover, and on keyboard focus for anyone tabbing through */
.nav-item { position: relative; display: inline-flex; }
.nav-menu {
  position: absolute; top: calc(100% - 6px); left: 0; z-index: 20;
  min-width: 250px; padding: 8px; border: 1px solid var(--rule); border-radius: 16px;
  background: var(--paper); box-shadow: var(--shadow-lift);
  display: grid; gap: 2px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.nav-item:hover .nav-menu, .nav-item:focus-within .nav-menu { opacity: 1; visibility: visible; transform: none; }
.nav-menu a { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; font-size: 15px; font-weight: 500; color: var(--ink); text-decoration: none; }
.nav-menu a:hover { background: var(--sage-wash); color: var(--ink); }
.nav-menu small { font-size: 12px; font-weight: 400; color: var(--ink-3); }
@media (max-width: 720px) { .nav-menu { display: none; } }
@media (prefers-reduced-motion: reduce) { .nav-menu { transition: none; } }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-left: 6px; padding: 0;
  background: transparent; border: 1px solid var(--rule); border-radius: 999px;
  color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { background: var(--sage-wash); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(44px, 8vw, 100px); line-height: 1; letter-spacing: -0.035em; }
h2 { font-size: clamp(34px, 4.6vw, 56px); line-height: 1.04; }
h3 { font-size: clamp(24px, 2.6vw, 30px); line-height: 1.2; }
h1 em, h2 em { color: var(--terracotta); }
p { margin: 0; }
.lede { font-size: clamp(17px, 1.6vw, 19px); color: var(--ink-2); max-width: 60ch; }
.eyebrow { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.pill { display: inline-block; background: var(--paper); border-radius: 999px; padding: 7px 15px; font-size: 14px; font-weight: 600; color: var(--wood); box-shadow: var(--shadow-soft); }
.muted { color: var(--ink-3); }
code { font-family: var(--mono); font-size: .88em; background: var(--paper); padding: 1px 6px; border-radius: 5px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 12px 20px; border-radius: 14px; font-weight: 600; font-size: 16px; text-decoration: none; }
.btn-primary { background: var(--sage); color: var(--paper); }
.btn-primary:hover { background: var(--sage-deep); color: var(--paper); }
.btn-quiet { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-soft); }
.btn-quiet:hover { color: var(--sage-deep); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.text-link { font-weight: 600; }

/* ---------- motion (interface feedback only) ---------- */
.lift { transition: transform .25s ease, box-shadow .25s ease; }
.lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.reveal { transition: opacity .5s ease, transform .5s ease; }
.js .reveal:not(.is-in) { opacity: 0; transform: translateY(14px); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lift, .reveal { transition: none; }
  .lift:hover { transform: none; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- home ---------- */
.hero { padding: clamp(48px, 9vw, 96px) 0 clamp(56px, 9vw, 96px); border-bottom: 1px solid var(--rule-strong); display: grid; gap: 32px; }
.hero h1 { max-width: 14ch; }
.hero-sub { display: grid; gap: 20px 64px; align-items: end; }
@media (min-width: 900px) { .hero-sub { grid-template-columns: minmax(0, 520px) minmax(0, 380px); } }

.work-list { padding-top: 64px; display: grid; gap: clamp(64px, 9vw, 96px); }
.work-intro { display: grid; gap: 12px; max-width: 680px; }
.work-intro p { font-family: var(--serif); font-size: clamp(20px, 2vw, 24px); line-height: 1.45; color: var(--ink-2); }
.work-item { display: grid; gap: 24px 32px; }
.work-meta { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--ink-3); border-bottom: 1px solid var(--rule); padding-bottom: 14px; }
.work-body { display: grid; gap: 28px 32px; align-items: center; }
@media (min-width: 900px) { .work-body { grid-template-columns: 5fr 6fr; } .work-item.flip .work-text { order: 2; } }
.work-text { display: grid; gap: 18px; align-content: start; }
.work-text .work-title { font-size: clamp(34px, 4.6vw, 56px); line-height: 1.04; }
.work-text h2 small, .work-text .work-title small { display: block; margin-top: 8px; font-family: var(--round); font-weight: 700; font-size: 20px; color: var(--sage); letter-spacing: 0; }
.contrib { font-size: 15px; color: var(--ink-2); border-left: 0; background: var(--paper); border-radius: 12px; padding: 12px 16px; }
.contrib b { color: var(--ink); }
.work-item.warm { background: var(--sage-wash); border-radius: 32px; padding: clamp(20px, 4vw, 48px); margin: 0 calc(var(--gutter) * -0.5); }
.work-item.warm .work-meta { border-color: var(--sage-rule); color: var(--ink-2); }

.shot { width: 100%; border-radius: 20px; border: 6px solid var(--paper); box-shadow: 0 12px 30px rgba(72, 58, 40, .14); aspect-ratio: 16 / 9; object-fit: cover; }
.shot-wrap { position: relative; }
.bubble { position: absolute; left: 20px; bottom: -18px; background: var(--paper); border-radius: 16px; padding: 10px 16px; font-size: 15px; box-shadow: 0 8px 20px rgba(72, 58, 40, .14); max-width: calc(100% - 40px); }

.panel-dark { background: var(--forest); color: var(--forest-on); border-radius: 20px; padding: clamp(24px, 3.5vw, 40px); display: grid; gap: 28px; }
.panel-dark blockquote { margin: 0; font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.4vw, 30px); line-height: 1.3; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 20px; border-top: 1px solid var(--forest-2); padding-top: 22px; }
.stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 3.4vw, 44px); line-height: 1.1; }
.stat span { font-size: 14px; color: var(--forest-text); }
.stat-note { font-size: 13px; color: var(--forest-text); }

.chips { display: grid; gap: 10px; }
.chip-row { display: flex; justify-content: space-between; gap: 16px; padding: 16px 20px; background: var(--paper); border-radius: 14px; box-shadow: var(--shadow-soft); font-size: 16px; }
.chip-row span:last-child { color: var(--wood); font-weight: 600; white-space: nowrap; }

.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; }
.flow span { background: var(--paper); border-radius: 10px; padding: 8px 12px; box-shadow: var(--shadow-soft); }
.flow i { font-style: normal; color: var(--ink-3); }
.flow .human { background: #f3d9a4; color: #23271f; }

.intro-band { margin-top: clamp(72px, 10vw, 112px); padding: 48px 0; border-top: 1px solid var(--rule-strong); display: grid; gap: 24px; }
@media (min-width: 900px) { .intro-band { grid-template-columns: 1fr 1.6fr; } }
.intro-band p { font-family: var(--serif); font-size: clamp(22px, 2.4vw, 28px); line-height: 1.4; }

.site-footer { border-top: 1px solid var(--rule); padding: 40px 0 56px; margin-top: 24px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; align-items: center; }
.site-footer small { color: var(--ink-3); font-size: 14px; }

/* ---------- project page ---------- */
.crumbs { font-size: 14px; color: var(--ink-3); padding-top: 32px; }
.crumbs a { color: var(--ink-3); }
.proj-head { padding: 24px 0 48px; display: grid; gap: 28px; }
.proj-head h1 { font-size: clamp(44px, 7vw, 88px); }
.proj-head h1 small { display: block; margin-top: 10px; font-family: var(--round); font-weight: 700; font-size: clamp(22px, 2.6vw, 30px); color: var(--sage); letter-spacing: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 16px; overflow: hidden; }
.facts div { background: var(--paper); padding: 14px 18px; }
.facts dt { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.facts dd { margin: 4px 0 0; font-size: 15px; font-weight: 500; }
.facts dl { margin: 0; display: contents; }

.status { display: inline-flex; align-items: center; gap: 7px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.status.dev::before { background: #c9922e; }
.status.works::before { background: var(--sage); }
.status.open::before { background: var(--terracotta); }

.section-nav { position: sticky; top: var(--header-h); z-index: 5; background: color-mix(in srgb, var(--ground) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule); }
.section-nav .wrap { display: flex; gap: 4px; overflow-x: auto; padding-top: 8px; padding-bottom: 8px; scrollbar-width: none; }
.section-nav a { flex: none; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; padding: 10px 14px; border-radius: 999px; }
.section-nav a:hover { background: var(--sage-wash); }

.block { padding: clamp(56px, 8vw, 88px) 0 0; display: grid; gap: 40px; }
.block-head { display: grid; gap: 14px; border-bottom: 1px solid var(--rule); padding-bottom: 20px; }
.two { display: grid; gap: 28px 48px; }
@media (min-width: 900px) { .two { grid-template-columns: 1fr 1fr; } .two.wide-left { grid-template-columns: 1.3fr 1fr; } }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; } /* a single track that never grows to an image's intrinsic width */

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.card { background: var(--paper); border-radius: 18px; padding: 24px; box-shadow: var(--shadow-soft); display: grid; gap: 10px; align-content: start; }
.card h3 { font-size: 24px; }
.card .num { font-family: var(--serif); font-size: 15px; color: var(--terracotta); }

.decision { display: grid; gap: 8px; padding: 22px 0; border-top: 1px solid var(--rule); }
.decision h3 { font-size: 26px; }

.chapter-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.chapter-nav a { background: var(--paper); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none; box-shadow: var(--shadow-soft); }
.chapter-nav a:hover { color: var(--sage-deep); }

.chapter { display: grid; gap: 20px; align-content: start; padding-top: 36px; border-top: 1px solid var(--rule); } /* side by side, a shorter chapter keeps its text under its heading */
.chapter > h3 { font-size: clamp(26px, 3vw, 34px); }
.four { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.four > div { background: var(--paper); border-radius: 14px; padding: 18px; display: grid; gap: 6px; align-content: start; }
.four > div > b { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--wood); }

.steps { counter-reset: s; display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 40px 1fr; gap: 14px; background: var(--paper); border-radius: 14px; padding: 16px 18px; }
.steps li::before { content: counter(s, decimal-leading-zero); font-family: var(--serif); color: var(--terracotta); font-size: 18px; }

.ledger { display: grid; gap: 12px; }
@media (min-width: 900px) { .ledger { grid-template-columns: repeat(3, 1fr); } }
.ledger > div { border-radius: 16px; padding: 20px; display: grid; gap: 10px; align-content: start; }
.ledger ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 15px; }
.ledger .done { background: var(--sage-wash); }
.ledger .verified { background: var(--paper); }
.ledger .notyet { background: transparent; border: 1px dashed var(--ink-3); }
.ledger h3 { font-size: 22px; }

.next { margin-top: clamp(64px, 9vw, 96px); padding: 40px 0; border-top: 1px solid var(--rule-strong); display: grid; gap: 18px; }

.quote-prompt { font-family: var(--mono); font-size: 14px; line-height: 1.6; background: var(--forest); color: #e7efe9; border-radius: 14px; padding: 18px 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
table.plain { width: 100%; border-collapse: collapse; font-size: 15px; }
table.plain th, table.plain td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.plain th { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.table-scroll { overflow-x: auto; }

/* ---------- game page ---------- */
video.shot { background: var(--paper); }
.loop3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.loop-panel { margin: 0; background: var(--paper); border-radius: 20px; padding: 12px; box-shadow: var(--shadow-soft); display: grid; gap: 14px; align-content: start; }
.loop-media { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; }
.loop-panel figcaption { padding: 0 8px 8px; display: grid; gap: 8px; }
.loop-panel .num { font-family: var(--serif); font-size: 15px; color: var(--terracotta); }
.loop-panel h3 { font-size: 24px; }
.loop-panel p { font-size: 15px; color: var(--ink-2); }
.memory-card { background: var(--sage-wash); padding: 16px; display: grid; gap: 10px; align-content: center; font-size: 14px; }
.memory-card p { display: grid; gap: 2px; color: var(--ink); }
.memory-card b { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--sage); }
.memory-card .memory-label { font-size: 12px; color: var(--ink-3); }
.numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.numbers div { background: var(--forest); color: var(--forest-on); border-radius: 16px; padding: 18px 20px; display: grid; }
.numbers b { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.1; }
.numbers span { font-size: 14px; color: var(--forest-text); }
.lead-card { grid-template-columns: minmax(120px, 38%) 1fr; gap: 20px; align-items: center; }
.portrait { width: 100%; height: auto; mix-blend-mode: multiply; } /* white art background takes the card colour */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .portrait { mix-blend-mode: normal; background: #fbf8f2; border-radius: 12px; } }
:root[data-theme="dark"] .portrait { mix-blend-mode: normal; background: #fbf8f2; border-radius: 12px; }
@media (max-width: 480px) { .lead-card { grid-template-columns: 1fr; } .portrait { max-width: 200px; margin: 0 auto; } }
.places { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.places figure { margin: 0; display: grid; gap: 8px; }
.places img { width: 100%; border-radius: 14px; border: 4px solid var(--paper); box-shadow: var(--shadow-soft); }
.places figcaption { font-size: 14px; color: var(--ink-3); }

/* ---------- home v2: visual first ---------- */
.hero2 { padding: clamp(40px, 7vw, 80px) 0 clamp(48px, 7vw, 80px); border-bottom: 1px solid var(--rule-strong); display: grid; gap: 40px; align-items: center; }
@media (min-width: 960px) { .hero2 { grid-template-columns: 1.05fr 1fr; gap: 56px; } }
.hero2-text { display: grid; gap: 24px; justify-items: start; }
.hero2 h1 { font-size: clamp(42px, 5.6vw, 72px); max-width: 14ch; }
.collage { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 150px 150px; gap: 12px; }
@media (min-width: 560px) { .collage { grid-template-rows: 190px 190px; } }
@media (min-width: 1600px) { .collage { grid-template-rows: 240px 240px; gap: 14px; } .hero2 { gap: 72px; } }
.tile { position: relative; display: block; border-radius: 18px; overflow: hidden; background: var(--paper); box-shadow: var(--shadow-soft); color: var(--ink); text-decoration: none; transition: transform .25s ease, box-shadow .25s ease; }
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); color: var(--ink); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile span { position: absolute; left: 10px; bottom: 10px; font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 999px; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(6px); color: var(--ink); }
.tile-wide { grid-column: 1 / 3; }
.tile-tall { grid-column: 3; grid-row: 1 / 3; }
.tile-dark { background: var(--forest); color: var(--forest-on); display: grid; place-items: center; padding: 14px; }
.tile-dark svg { width: 100%; max-width: 200px; }
.tile-dark span { background: color-mix(in srgb, var(--forest) 70%, transparent); color: var(--forest-on); }
.tile-music { display: grid; align-items: end; padding: 14px 14px 40px; }
.bars-mini { display: flex; align-items: flex-end; gap: 6px; height: 100%; }
.bars-mini i { flex: 1; background: var(--sage); border-radius: 4px 4px 0 0; opacity: .85; }
@media (prefers-reduced-motion: reduce) { .tile { transition: none; } .tile:hover { transform: none; } }

.facts-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 16px; color: var(--ink-2); }
.facts-list li { padding-left: 18px; position: relative; }
.facts-list li::before { content: ""; position: absolute; left: 0; top: .62em; width: 7px; height: 7px; border-radius: 50%; background: var(--terracotta); }
.facts-list b { color: var(--ink); font-weight: 600; }

.diagram { margin: 0; background: var(--paper); border-radius: 20px; padding: 18px; box-shadow: var(--shadow-soft); }
.diagram svg { width: 100%; height: auto; display: block; font-family: var(--sans); }
.d-box rect { fill: var(--ground); stroke: var(--rule); stroke-width: 1.5; }
.d-gate path { fill: #f3d9a4; stroke: none; }
.d-gate .d-t, .d-gate .d-s { fill: #23271f; }
.d-lock rect { fill: var(--sage); }
.d-lock path, .d-lock circle { stroke: var(--paper); stroke-width: 3; fill: none; }
.d-lock circle { fill: var(--paper); stroke: none; }
.d-deny rect { fill: #f5d8cc; }
.d-deny .d-t, .d-deny .d-s { fill: #6b2a13; }
.d-t { font-size: 15px; font-weight: 600; fill: var(--ink); }
.d-s { font-size: 12px; fill: var(--ink-3); }
.d-arrow { fill: none; stroke: var(--ink-3); stroke-width: 1.8; }
.d-loop { stroke-dasharray: 5 5; stroke: var(--terracotta); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .d-deny rect { fill: #3a221a; } :root:not([data-theme="light"]) .d-deny .d-t, :root:not([data-theme="light"]) .d-deny .d-s { fill: #f0c3ad; } }
:root[data-theme="dark"] .d-deny rect { fill: #3a221a; } :root[data-theme="dark"] .d-deny .d-t, :root[data-theme="dark"] .d-deny .d-s { fill: #f0c3ad; }

.d-stamps circle { fill: var(--sage); }
.d-stamps path { stroke: var(--sage); stroke-width: 2; stroke-dasharray: 3 4; }
.d-rule { stroke: var(--rule); stroke-width: 1; }
.d-green { fill: #cfe5d6; } .d-red { fill: #f3c9bb; } .d-mut { fill: var(--ground); stroke: var(--rule); }
.d-tag { font-size: 12px; font-weight: 600; fill: #23271f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .d-green { fill: #2b4a37; } :root:not([data-theme="light"]) .d-red { fill: #5a2f24; } :root:not([data-theme="light"]) .d-tag { fill: #ece7db; } }
:root[data-theme="dark"] .d-green { fill: #2b4a37; } :root[data-theme="dark"] .d-red { fill: #5a2f24; } :root[data-theme="dark"] .d-tag { fill: #ece7db; }

.media-card { margin: 0; background: var(--paper); border-radius: 20px; padding: 14px; box-shadow: var(--shadow-soft); display: grid; gap: 12px; }
.media-card img { width: 100%; border-radius: 12px; }
.media-card figcaption { display: grid; gap: 6px; padding: 0 4px 4px; }
.media-card audio { width: 100%; }

/* ---------- visual-first project pages ---------- */
.diagram.wide { padding: 24px; }
.d-tiny { font-size: 10px; fill: var(--ink-3); }
.d-strong { font-weight: 600; fill: var(--ink); }
.d-stamp circle { fill: var(--sage-wash); stroke: var(--sage); stroke-width: 2; }
.d-stamp .d-tag { fill: var(--ink); }
.d-human circle { fill: #f3d9a4; stroke: #c9922e; }
.d-human .d-tag, .d-human .d-tiny { fill: #23271f; }
.d-expired circle { fill: var(--ground); stroke: var(--rule); stroke-dasharray: 4 3; }
.d-expired .d-tag { fill: var(--ink-3); }
.d-ring rect { fill: var(--paper); stroke: var(--rule); stroke-width: 1.5; }
.d-ring:nth-child(2) rect { fill: var(--ground); } .d-ring:nth-child(4) rect { fill: var(--ground); }
.d-core rect { fill: var(--sage); stroke: none; } .d-core .d-tag { fill: var(--paper); }
.d-open rect:first-child { stroke: var(--sage); stroke-width: 2; }
.d-inner { fill: var(--sage-wash); stroke: none; }
table.compare td:first-child { color: var(--ink-3); }
table.compare td:last-child b { color: var(--ink); }
table.matrix td { text-align: center; }
table.matrix td.yes { color: var(--sage); font-weight: 600; }
table.matrix td.no { color: var(--ink-3); }
table.matrix td.only { background: var(--sage-wash); border-radius: 8px; }
details.more { border: 1px solid var(--rule); border-radius: 14px; padding: 0; }
details.more summary { cursor: pointer; padding: 14px 18px; font-weight: 600; color: var(--sage); list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+"; display: inline-block; width: 18px; color: var(--ink-3); }
details.more[open] summary::before { content: "–"; }
details.more > *:not(summary) { padding: 0 18px 18px; }
details.more p { font-size: 15px; color: var(--ink-2); }

/* ---------- image page ---------- */
.portraits { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.portraits figure { margin: 0; display: grid; gap: 8px; }
.portraits img { width: 100%; border-radius: 18px; background: #fbf8f2; box-shadow: var(--shadow-soft); }
.portraits.home { grid-template-columns: 1fr 1fr; }

/* ---------- music page ---------- */
.proj-head .numbers span { font-size: 13px; }
.bars { background: var(--paper); border-radius: 16px; padding: 20px; display: grid; gap: 14px; max-width: 760px; }
.bar-row { display: grid; grid-template-columns: 200px 1fr 84px; gap: 14px; align-items: center; } /* value column fits "19–20.3" on one line; same width in every row so bars stay comparable */
.bar-row span { font-weight: 500; font-size: 15px; display: grid; }
.bar-row small { font-weight: 400; font-size: 12px; color: var(--ink-3); }
.bar-row b { font-family: var(--serif); font-weight: 400; font-size: 22px; white-space: nowrap; }
.bar-track { position: relative; height: 26px; background: var(--ground); border-radius: 6px; }
.bar-fill { height: 100%; background: var(--sage); border-radius: 6px; }
.bar-ref { position: absolute; top: -4px; bottom: -4px; border-left: 2px dashed var(--ink-2); }
@media (max-width: 560px) { .bar-row { grid-template-columns: 1fr 80px; } .bar-row span { grid-column: 1 / -1; } }
.players { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.players.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.player { margin: 0; background: var(--paper); border-radius: 18px; padding: 20px; box-shadow: var(--shadow-soft); display: grid; gap: 14px; align-content: space-between; }
.player figcaption { display: grid; gap: 6px; }
.player h3 { font-size: 22px; }
.player audio { width: 100%; }
table.plain th[scope="row"] { white-space: nowrap; color: var(--wood); letter-spacing: 0; text-transform: none; font-size: 14px; }

.note-band { background: var(--sage-wash); border-radius: 14px; padding: 14px 18px; font-size: 15px; color: var(--ink-2); }
.flow .deny { background: #f5d8cc; color: #6b2a13; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .flow .deny { background: #3a221a; color: #f0c3ad; } }
:root[data-theme="dark"] .flow .deny { background: #3a221a; color: #f0c3ad; }

/* ---------- night-mode touch-ups ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .panel-dark,
  :root:not([data-theme="light"]) .numbers div { border: 1px solid var(--rule); }
  :root:not([data-theme="light"]) .chart-plate { background: #fbf8f2; padding: 10px; }
}
:root[data-theme="dark"] .panel-dark,
:root[data-theme="dark"] .numbers div { border: 1px solid var(--rule); }
:root[data-theme="dark"] .chart-plate { background: #fbf8f2; padding: 10px; }

/* ---------- résumé ---------- */
.contact-line { font-size: 15px; color: var(--ink-2); }
.resume .block { padding-top: clamp(36px, 5vw, 56px); gap: 24px; }
.role { display: grid; gap: 10px; padding-bottom: 8px; }
.role-head { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; justify-content: space-between; }
.role-head h3 { font-size: clamp(20px, 2.2vw, 24px); }
.role-head span { font-size: 14px; }
.role ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 16px; color: var(--ink-2); }
.role li b { color: var(--ink); }
.skills { margin: 0; display: grid; gap: 14px; }
.skills > div { display: grid; gap: 4px; }
@media (min-width: 760px) { .skills > div { grid-template-columns: 220px 1fr; gap: 20px; } }
.skills dt { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--wood); }
.skills dd { margin: 0; font-size: 16px; color: var(--ink-2); }

/* printing the résumé page produces the downloadable PDF: one column, black on white */
@media print {
  @page { size: A4; margin: 11mm 12mm; }
  :root, :root[data-theme] { color-scheme: light; --ground: #fff; --paper: #fff; --ink: #000; --ink-2: #1a1a1a; --ink-3: #444; --rule: #bbb; --sage: #000; --wood: #333; --shadow-soft: none; }
  .site-header, .section-nav, .site-footer, .no-print, .theme-toggle { display: none !important; }
  body { font-size: 9.5pt; line-height: 1.35; background: #fff; color: #000; }
  html { background: #fff; }
  body, .lede, .role ul, .skills dd, .contact-line { font-family: Arial, "Segoe UI", Helvetica, sans-serif; }
  h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; }
  .block-head { break-after: avoid; page-break-after: avoid; }
  .block-head + * { break-before: avoid; page-break-before: avoid; }
  .wrap { max-width: none; padding: 0; }
  .resume .block { padding-top: 9pt; gap: 6pt; }
  .block-head { border-bottom: 1px solid #000; padding-bottom: 2pt; gap: 0; }
  .block-head h2 { font-size: 12pt; }
  .proj-head { padding: 0 0 2pt; gap: 3pt; }
  .proj-head .eyebrow { display: none; }
  h1 { font-size: 19pt; }
  .lede { font-size: 9.5pt; max-width: none; }
  .contact-line { font-size: 9pt; }
  .role { break-inside: avoid; gap: 3pt; padding-bottom: 2pt; }
  .role-head h3 { font-size: 10.5pt; }
  .role-head span { font-size: 9pt; }
  .role ul { font-size: 9.5pt; gap: 2pt; color: #000; padding-left: 14pt; }
  .skills { gap: 4pt; }
  .skills > div { grid-template-columns: 150px 1fr; gap: 10pt; }
  .skills dt { font-size: 8.5pt; }
  .skills dd { font-size: 9.5pt; }
  .skills dd, .contact-line { color: #000; }
  a { color: #000; text-decoration: none; }
}

/* ---------- inline diagrams on phones: readable size, sideways scroll, a visible hint ---------- */
.scroll-hint { display: none; margin: 6px 0 0; font-size: 13px; color: var(--ink-3); }
@media (max-width: 640px) {
  .diagram { overflow-x: auto; }
  .diagram svg { min-width: var(--diagram-min, 560px); }
  .scroll-hint { display: block; }
}

/* ---------- home v3 (2026-09-27): AICC leads the collage, work in three groups ---------- */
.nav-group { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding: 12px 12px 2px; }
.nav-group:first-child { padding-top: 4px; }

@media (min-width: 960px) { .hero2 { grid-template-columns: 1fr 1.15fr; } }
.collage { grid-template-columns: 2fr 1fr; grid-template-rows: repeat(3, minmax(0, 1fr)); grid-template-areas: "aicc game" "aicc image" "aicc music"; height: auto; }
.tile-aicc { grid-area: aicc; background: #0A0E24; aspect-ratio: 400 / 420; } /* the drawing sets the height; the three small tiles share it */
.tile-game img, .tile-image img { position: absolute; inset: 0; }
.tile-aicc svg { width: 100%; height: 100%; display: block; }
.tile-aicc span { background: rgba(17, 22, 47, .85); color: #F0F3FF; }
.tile-game { grid-area: game; }
.tile-image { grid-area: image; }
.tile-image img { object-position: 50% 15%; }
.tile-music { grid-area: music; }
@media (max-width: 559px) {
  .collage { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto 110px; grid-template-areas: "aicc aicc aicc" "game image music"; height: auto; }
  .tile-aicc svg { height: auto; }
  .tile-music { padding-bottom: 36px; }
  .tile-game span, .tile-image span, .tile-music span { font-size: 11px; left: 6px; bottom: 6px; padding: 4px 7px; }
}

.exp-strip { padding: 44px 0 8px; display: grid; gap: 20px 40px; }
@media (min-width: 960px) { .exp-strip { grid-template-columns: minmax(0, 1fr) minmax(0, 2.6fr); align-items: start; } }
.exp-head { display: grid; gap: 10px; justify-items: start; align-content: start; }
.exp-head h2 { font-size: clamp(26px, 2.6vw, 34px); line-height: 1.12; }
.exp-cells { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.exp-cell { background: var(--paper); border-radius: 16px; padding: 18px 20px; display: grid; gap: 8px; align-content: start; box-shadow: var(--shadow-soft); }
.exp-cell svg { width: 32px; height: 32px; fill: none; stroke: var(--sage); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.exp-cell h3 { font-family: var(--sans); font-size: 16px; font-weight: 600; letter-spacing: 0; line-height: 1.3; }
.exp-cell p { font-size: 15px; color: var(--ink-2); line-height: 1.55; }

.group-head { display: grid; gap: 8px; padding-top: 22px; border-top: 2px solid var(--rule-strong); margin-bottom: calc(-1 * clamp(24px, 4vw, 44px)); }
.group-head h2 { font-size: clamp(30px, 3.6vw, 44px); }
.group-head p { color: var(--ink-2); max-width: 64ch; }
.work-list > .group-head:first-of-type { margin-top: 8px; }

.term { margin: 0; background: #0f1419; border: 1px solid #2b313a; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-soft); }
.term-bar { display: flex; gap: 6px; align-items: center; padding: 10px 14px; background: #1b1f24; }
.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: #333c46; flex: none; }
.term-bar span { margin-left: 8px; font: 12px var(--mono); color: #868d97; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term pre { margin: 0; padding: 18px 20px; font: 13.5px/1.7 var(--mono); color: #d7dde4; overflow-x: auto; white-space: pre; }
.t-red { color: #ff9a86; font-weight: 600; }
.t-green { color: #8fd6ae; font-weight: 600; }
.t-dim { color: #868d97; }

.site-footer .contact-text { display: grid; gap: 6px; flex-basis: 100%; }
.contact-text p { font-family: var(--serif); font-size: clamp(20px, 2vw, 24px); line-height: 1.4; max-width: 44ch; }

/* ---------- ready-made diagrams (Tetherlock): a dark and a light file, shown by theme ---------- */
.diagram-img { margin: 0; display: grid; gap: 10px; }
.diagram-img figcaption { font-size: 14px; color: var(--ink-3); }
.theme-img { display: block; border-radius: 16px; overflow: hidden; }
.theme-img img { width: 100%; height: auto; display: block; }
.theme-img .on-light { display: none; }
:root[data-theme="light"] .theme-img .on-dark { display: none; }
:root[data-theme="light"] .theme-img .on-light { display: block; }

/* ---------- slideshow (Tetherlock screens): a swipeable row; buttons appear once site.js is running ---------- */
.slideshow { display: grid; gap: 14px; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; border-radius: 16px; }
.slideshow.is-ready .slides { scrollbar-width: none; }
.slideshow.is-ready .slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; margin: 0; display: grid; gap: 12px; align-content: start; }
.slide-zoom { display: block; border-radius: 14px; }
.slide img { width: 100%; height: auto; border-radius: 14px; background: #12151a; box-shadow: var(--shadow-soft); }
.slide figcaption { font-size: 16px; color: var(--ink-2); }
.slide figcaption b { font-family: var(--serif); font-weight: 400; color: var(--terracotta); margin-right: 10px; }
.slide-controls { display: none; align-items: center; justify-content: center; gap: 14px; }
.slideshow.is-ready .slide-controls { display: flex; }
.slide-controls button { min-width: 44px; min-height: 44px; border-radius: 999px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); font-size: 18px; cursor: pointer; }
.slide-controls button:hover:not(:disabled) { background: var(--sage-wash); }
.slide-controls button:disabled { opacity: .35; cursor: default; }
.slide-count { min-width: 5ch; text-align: center; font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .slides { scroll-behavior: auto; } }

/* ---------- other languages: Chinese (Taiwan) and Japanese ---------- */
/* Headlines keep the site's serif for Latin letters; body text uses Noto first so CJK punctuation (——, 「」) stays in one face. */
:root:lang(zh-Hant-TW) { --serif: 'Newsreader', 'Noto Serif TC', serif; --sans: 'Noto Sans TC', 'Public Sans', sans-serif; }
:root:lang(ja) { --serif: 'Newsreader', 'Noto Serif JP', serif; --sans: 'Noto Sans JP', 'Public Sans', sans-serif; }
:root:is(:lang(zh-Hant-TW), :lang(ja)) body { line-height: 1.8; line-break: strict; }
:root:is(:lang(zh-Hant-TW), :lang(ja)) :is(h1, h2, h3) { letter-spacing: 0; line-height: 1.3; font-weight: 500; text-wrap: balance; }
:root:is(:lang(zh-Hant-TW), :lang(ja)) .hero2 h1 { font-size: clamp(34px, 4.4vw, 58px); max-width: 13em; }
:root:is(:lang(zh-Hant-TW), :lang(ja)) .proj-head h1 { font-size: clamp(34px, 5vw, 64px); }
:root:is(:lang(zh-Hant-TW), :lang(ja)) h2 { font-size: clamp(26px, 3.4vw, 42px); }
:root:is(:lang(zh-Hant-TW), :lang(ja)) .work-text .work-title { font-size: clamp(28px, 3.6vw, 44px); }
:root:is(:lang(zh-Hant-TW), :lang(ja)) .lede { max-width: 38em; }
:root:lang(ja) body { word-break: auto-phrase; } /* break Japanese between phrases, never inside a word (Chrome / Edge; others ignore it) */
:root:is(:lang(zh-Hant-TW), :lang(ja)) .keep { white-space: nowrap; } /* a clause that must stay on one line, e.g. 不代表做對了。 */
:root:is(:lang(zh-Hant-TW), :lang(ja)) :is(em, i, blockquote) { font-style: normal; } /* Chinese and Japanese have no italics; browsers would slant the glyphs */
:root:is(:lang(zh-Hant-TW), :lang(ja)) .date { white-space: nowrap; } /* 2026-09-14 never splits at a hyphen */

/* ---------- language menu (only rendered when a page exists in more than one language) ---------- */
.lang-switch { position: relative; flex: none; }
.site-header .wrap:has(.lang-switch) .nav { margin-left: auto; }
.lang-switch { margin-left: auto; }
.lang-switch + .theme-toggle { margin-left: 8px; }
.lang-switch summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); }
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary:hover { background: var(--sage-wash); }
.lang-switch svg { width: 16px; height: 16px; }
.lang-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 150px; padding: 6px; display: grid; gap: 2px; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow-lift); }
.lang-menu a { padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 15px; }
.lang-menu a:hover { background: var(--sage-wash); color: var(--ink); }
.lang-menu a[aria-current] { font-weight: 700; }
.lang-menu a[aria-current]::after { content: " ✓"; color: var(--sage); }
@media (max-width: 720px) { .lang-switch { order: 1; } .lang-switch summary { height: 36px; padding: 0 10px; } }
@media (max-width: 380px) { :root:lang(ja) .nav a { font-size: 13.5px; padding: 8px 4px; } } /* four Japanese labels fit one row at 320 px */

/* résumé: company · place · dates wrap only at the separators, so "2025年3月" never splits */
:root:is(:lang(zh-Hant-TW), :lang(ja)) .role-head span { word-break: keep-all; }

/* résumé: links to the PDF in the other languages */
.pdf-langs { margin: 0; font-size: 14px; color: var(--ink-3); }
.pdf-langs a { color: var(--ink-2); }

/* the Japanese middle dot "・" from the Noto web font copies out of a PDF as "‧"; take that one character from a system font */
@font-face { font-family: "Print JP Dot"; src: local("Yu Gothic Regular"), local("YuGothic-Regular"), local("Meiryo"), local("Hiragino Sans"); unicode-range: U+30FB; }
/* Chinese / Japanese résumé PDF: Latin text and punctuation in Arial like the English one; Chinese and Japanese in the
   page's Noto web font. System CJK fonts (Microsoft JhengHei, Yu Gothic) copy out of the PDF as look-alike radicals
   (⾃ instead of 自), which breaks search and applicant-tracking systems. */
@media print {
  :root:lang(zh-Hant-TW) :is(body, .lede, .role ul, .skills dd, .contact-line) { font-family: Arial, "Noto Sans TC", sans-serif; }
  :root:lang(zh-Hant-TW) :is(h1, h2, h3) { font-family: Georgia, "Noto Sans TC", sans-serif; font-weight: 700; }
  :root:lang(ja) :is(body, .lede, .role ul, .skills dd, .contact-line) { font-family: Arial, "Print JP Dot", "Noto Sans JP", sans-serif; }
  :root:lang(ja) :is(h1, h2, h3) { font-family: Georgia, "Print JP Dot", "Noto Sans JP", sans-serif; font-weight: 700; }
  :root:is(:lang(zh-Hant-TW), :lang(ja)) body { line-height: 1.5; }
  :root:is(:lang(zh-Hant-TW), :lang(ja)) .proj-head h1 { font-size: 19pt; }
  :root:is(:lang(zh-Hant-TW), :lang(ja)) h2 { font-size: 12pt; }
  :root:is(:lang(zh-Hant-TW), :lang(ja)) .lede { max-width: none; }
}

/* ---------- drafts: visible only while building ---------- */
.todo {
  border: 2px dashed var(--terracotta); border-radius: 16px; padding: 18px 20px;
  background: repeating-linear-gradient(-45deg, rgba(168, 71, 42, .05) 0 12px, transparent 12px 24px);
  color: var(--terracotta); font-size: 15px; display: grid; gap: 6px; align-content: center;
}
.todo::before { content: "TODO"; font-weight: 700; font-size: 12px; letter-spacing: .14em; }
.todo.media { aspect-ratio: 16 / 9; }
.todo.inline { display: inline; padding: 1px 8px; border-width: 1px; border-radius: 6px; }
.todo.inline::before { content: "TODO · "; font-size: 11px; }

/* Personal portfolio, October 2026. Screen-only: the résumé print contract
   above remains unchanged. Components use the same tokens in both themes. */
@media screen {
  :root {
    --max: 1380px; --ground: #f3f2ec; --paper: #fbfaf6;
    --ink: #222b25; --ink-2: #515f55; --ink-3: #647066;
    --rule: #d1d7cc; --rule-strong: #89978b;
    --sage: #3d6149; --sage-deep: #254b34; --sage-wash: #e6ecdf; --sage-rule: #c1cfb8;
    --terracotta: #74578b; --wood: #536446;
    --forest: #202d27; --forest-2: #45574c; --forest-on: #f3f4ed; --forest-text: #c2cfc2;
    --shadow-soft: none; --shadow-lift: 0 16px 48px #182b2414;
  }
  :root[data-theme="dark"] {
    --ground: #121715; --paper: #1b2320; --ink: #f0f2e9;
    --ink-2: #bcc8bd; --ink-3: #99a79b; --rule: #354238; --rule-strong: #667969;
    --sage: #c6dca9; --sage-deep: #e0edce; --sage-wash: #273529; --sage-rule: #475a3d;
    --terracotta: #d4b9e5; --wood: #b7c69f;
    --forest: #0b100d; --forest-2: #394b3e; --forest-on: #f0f2e9; --forest-text: #afc0b1;
    --shadow-soft: none; --shadow-lift: 0 16px 48px #0003;
  }
  body { font-size: 16px; }
  h1,h2,h3 { text-wrap: balance; }
  .wrap { max-width: var(--max); }
  a { transition: color .18s ease, background-color .18s ease; }
  .site-header { border-bottom: 1px solid var(--rule); backdrop-filter: blur(18px); }
  .site-header .wrap { gap: 12px; }
  .brand { font-family: var(--sans); font-weight: 600; font-size: 18px; letter-spacing: -.03em; }
  .brand::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 10px; background: var(--sage); border-radius: 50%; }
  .nav { gap: 1px; }
  .nav a { font-size: 13px; padding: 8px 10px; }
  .lang-switch { margin-left: 10px; }
  .lang-switch summary { font-size: 12px; border-radius: 6px; }
  .theme-toggle { border-radius: 6px; }
  .btn { border-radius: 5px; padding: 12px 18px; font-size: 14px; min-height: 46px; }
  .btn-quiet { background: transparent; border: 1px solid var(--rule-strong); }
  .btn-primary { color: var(--ground); }
  .btn-primary:hover { color: var(--ground); }
  .eyebrow { font: 11px/1.7 var(--mono); letter-spacing: .12em; color: var(--ink-3); }
  .skip-link { position: fixed; top: 12px; left: 16px; transform: translateY(-180%); z-index: 200; padding: 12px 18px; background: var(--sage); color: var(--ground); border-radius: 4px; }
  .skip-link:focus { transform: none; }

  /* One identity, then a field of capabilities. No portrait is needed. */
  .personal-hero { position: relative; display: grid; grid-template-columns: 1.25fr 1fr; gap: 24px 5%; padding: 88px 0 0; min-height: 680px; }
  .hero-identity { align-self: center; display: grid; justify-items: start; gap: 26px; padding-bottom: 38px; }
  .hero-identity > .eyebrow { color: var(--sage); letter-spacing: .1em; }
  .personal-hero .hero-position { font: 400 clamp(54px,6.2vw,89px)/1.01 var(--serif); letter-spacing: -.04em; max-width: 11em; text-wrap: initial; }
  .hero-position em { font-weight: 400; color: var(--sage); }
  .hero-summary { max-width: 51ch; color: var(--ink-2); line-height: 1.8; font-size: 16px; }
  .hero-caption { grid-column: 1/-1; display: flex; justify-content: space-between; align-items: baseline; gap: 20px; border-top: 1px solid var(--rule); padding: 24px 0; font-size: 12px; color: var(--ink-3); }
  .hero-caption a { white-space: nowrap; text-decoration: none; }
  .intro-replay { display: none; font: 11px var(--mono); background: none; border: 0; padding: 8px 0; color: var(--ink-3); cursor: pointer; text-decoration: underline; text-underline-offset: 5px; }
  .js .intro-replay { display: inline-block; }
  .capability-cloud { position: relative; align-self: center; height: 440px; isolation: isolate; }
  .capability-cloud::before,.capability-cloud::after { content: ""; position: absolute; border: 1px solid var(--rule); border-radius: 50%; z-index: -1; pointer-events: none; }
  .capability-cloud::before { inset: 8% 4%; transform: rotate(-16deg); }
  .capability-cloud::after { inset: 28% -3%; transform: rotate(-35deg); }
  .cloud-kicker { position: absolute; top: 0; left: 10%; font: 10px var(--mono); text-transform: uppercase; letter-spacing: .16em; color: var(--ink-3); }
  .cloud-word { position: absolute; display: block; max-width: 88%; text-decoration: none; line-height: 1.35; padding: 10px 12px; background: var(--ground); color: var(--ink-2); font: 500 clamp(16px,1.6vw,23px)/1.4 var(--sans); transition: color .2s, transform .2s; }
  .cloud-word:hover,.cloud-word:focus-visible { color: var(--sage); transform: translateY(-4px); }
  .cloud-word:nth-of-type(1) { top: 13%; left: 5%; }
  .cloud-word:nth-of-type(2) { top: 31%; right: 0; font-size: clamp(22px,2.2vw,31px); color: var(--ink); }
  .cloud-word:nth-of-type(3) { top: 50%; left: 0; color: var(--sage); }
  .cloud-word:nth-of-type(4) { top: 67%; right: 2%; font-size: clamp(16px,1.5vw,21px); }
  .cloud-word:nth-of-type(5) { top: 82%; left: 8%; font-size: clamp(17px,1.7vw,24px); color: var(--ink); }
  .cloud-note { position: absolute; bottom: -20px; right: 0; color: var(--ink-3); font: 10px/1.6 var(--mono); max-width: 32ch; }

  /* The five areas share one document, accessible through links or scrolling. */
  .capabilities,.project-collection { padding: 92px 0 32px; }
  .section-heading { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px 48px; margin-bottom: 54px; }
  .section-heading > .eyebrow { grid-column: 1/-1; }
  .section-heading h2 { font-size: clamp(34px,4vw,54px); line-height: 1.1; max-width: 17ch; }
  .section-heading > p { max-width: 58ch; color: var(--ink-2); align-self: end; font-size: 15px; }
  .capability-layout { display: grid; grid-template-columns: 260px minmax(0,1fr); gap: 6%; align-items: start; }
  .capability-nav { position: sticky; top: calc(var(--header-h) + 36px); display: grid; gap: 4px; padding: 0 0 28px; }
  .capability-nav a { display: flex; align-items: baseline; gap: 14px; text-decoration: none; padding: 14px 10px 14px 14px; color: var(--ink-3); border-left: 2px solid var(--rule); font: 11px/1.55 var(--mono); }
  .capability-nav a span { font: 500 14px/1.55 var(--sans); }
  .capability-nav a:hover,.capability-nav a[aria-current="true"] { color: var(--ink); background: var(--sage-wash); border-color: var(--sage); }
  .capability-panel { padding: 0 0 66px; scroll-margin-top: 16px; }
  .capability-panel + .capability-panel { padding-top: 48px; border-top: 1px solid var(--rule); }
  .cap-index { display: block; color: var(--sage); font: 11px/1.6 var(--mono); margin-bottom: 16px; }
  .capability-panel h3 { font: 500 clamp(26px,3vw,38px)/1.18 var(--serif); max-width: 26ch; }
  .cap-description { color: var(--ink-2); font-size: 15px; margin: 20px 0; max-width: 64ch; }
  .skill-keywords { display: flex; flex-wrap: wrap; gap: 7px 16px; padding: 0; margin: 0 0 26px; list-style: none; }
  .skill-keywords li { color: var(--ink-3); font-size: 11px; padding: 2px 0; }
  .skill-keywords li::before { content: "+"; color: var(--sage); margin-right: 6px; }
  .evidence-list { border-top: 1px solid var(--rule); }
  .evidence-row { display: grid; grid-template-columns: minmax(0,1fr) 24px; gap: 7px 18px; padding: 20px 12px 20px 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
  .evidence-row .evidence-type { grid-column: 1; color: var(--ink-3); font: 10px/1.5 var(--mono); }
  .evidence-row strong { grid-column: 1; font-weight: 500; font-size: 17px; }
  .evidence-row > span:not([class]) { grid-column: 1; color: var(--ink-2); font-size: 13px; max-width: 70ch; }
  .evidence-arrow { grid-column: 2; grid-row: 1/4; align-self: center; color: var(--sage); font-size: 23px; transition: transform .18s; }
  .evidence-row:hover .evidence-arrow { transform: translate(3px,-3px); }
  .evidence-row:hover { color: var(--sage); background: color-mix(in srgb,var(--sage-wash) 48%,transparent); }

  /* An image-led index follows the evidence; each case keeps its own purpose. */
  .project-collection { border-top: 1px solid var(--rule); }
  .project-group { display: flex; align-items: baseline; gap: 24px; padding: 28px 0 20px; border-top: 1px solid var(--rule); margin-top: 42px; }
  .project-group h2,.project-group h3 { font: 500 22px/1.4 var(--sans); }
  .project-group p { max-width: 65ch; font-size: 13px; color: var(--ink-3); }
  .project-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 32px; }
  .project-card { display: grid; align-content: start; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--paper); }
  .project-visual { position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; aspect-ratio: 16/10; background: var(--sage-wash); border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
  .project-visual > img,.project-visual > svg { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
  .project-visual > img { object-position: center 25%; }
  .project-visual:hover > img { transform: scale(1.025); }
  .project-visual .theme-img { width: 100%; border-radius: 0; }
  .project-visual.theme-img > img,.project-visual > .chart-plate { object-fit: contain; }
  .project-visual > .chart-plate { background: #fbf8f2; }
  .project-copy { padding: 28px; display: grid; gap: 13px; }
  .project-copy h3 { font-size: 30px; }
  .project-copy p { font-size: 14px; color: var(--ink-2); }
  .project-copy .project-role { color: var(--ink-3); font-size: 12px; }
  .project-copy .text-link { justify-self: start; margin-top: 6px; font-size: 13px; }
  @media(min-width:1000px) {
    .project-grid:has(> .project-card:nth-child(3)) { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 22px; }
    .project-grid:has(> .project-card:nth-child(3)) .project-copy { padding: 22px; }
    .project-grid:has(> .project-card:nth-child(3)) .project-copy h3 { font-size: 26px; }
    .project-grid > .project-card:only-child { grid-column: 1/-1; grid-template-columns: 1.2fr 1fr; }
    .project-card:only-child .project-visual { height: 100%; border-bottom: 0; border-right: 1px solid var(--rule); }
    .project-card:only-child .project-copy { align-content: center; padding: 38px; }
  }
  .about-timeline { border-left: 1px solid var(--rule); padding-left: 28px; }
  .about-timeline > p { padding-bottom: 20px; border-bottom: 1px solid var(--rule); font-size: 14px; color: var(--ink-2); }
  .about-timeline strong { display: inline-block; color: var(--ink); margin: 8px 0; }
  .working-note { display: grid; grid-template-columns: 1fr 1.3fr; gap: 36px 8%; padding: 90px 0; margin-top: 60px; border-top: 1px solid var(--rule); }
  .working-note h2 { max-width: 18ch; font-size: clamp(32px,4vw,52px); }
  .working-note p { color: var(--ink-2); max-width: 62ch; }
  .working-note .eyebrow { grid-column: 1/-1; }
  .working-note .text-link { font-size: 14px; }

  /* Shared case and background pages. Their substantive diagrams remain. */
  .crumbs { font: 11px/1.7 var(--mono); margin-top: 36px; color: var(--ink-3); }
  .proj-head { padding: 54px 0 48px; gap: 24px; }
  .proj-head h1 { max-width: 17ch; font-size: clamp(42px,5.4vw,74px); line-height: 1.05; }
  .proj-head > .lede { max-width: 76ch; font-size: 17px; line-height: 1.8; }
  .case-brief { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 32px; padding: 28px 0; border-block: 1px solid var(--rule); margin-top: 6px; }
  .case-brief > div { display: grid; gap: 12px; align-content: start; }
  .case-brief p { color: var(--ink-2); font-size: 14px; line-height: 1.8; }
  .case-brief a { text-underline-offset: 5px; }
  .case-capabilities { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .case-capabilities a { border: 1px solid var(--rule); padding: 7px 12px; text-decoration: none; border-radius: 4px; font-size: 12px; }
  .case-capabilities a:hover { border-color: var(--sage); background: var(--sage-wash); }
  .facts { gap: 1px; border-radius: 6px; }
  .facts dt { font: 10px/1.6 var(--mono); color: var(--ink-3); }
  .facts dd { font-size: 13px; }
  .numbers { gap: 0; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
  .numbers div,.numbers > div { box-shadow: none; border: 0; border-radius: 0; background: var(--paper); padding: 22px; }
  .numbers > div + div { border-left: 1px solid var(--rule); }
  .numbers b { color: var(--sage); }
  .numbers div { color: var(--ink); }
  .numbers span { color: var(--ink-2); }
  .block { padding-top: 68px; }
  .block-head { border-color: var(--rule); }
  .block-head h2 { font-size: clamp(30px,3.5vw,46px); }
  .section-nav { background: var(--ground); border-block: 1px solid var(--rule); }
  .section-nav a { font-size: 12px; border-radius: 3px; }
  .section-nav a[aria-current="true"] { background: var(--sage-wash); color: var(--sage); }
  .cards { gap: 20px; }
  .card { border: 1px solid var(--rule); border-radius: 6px; box-shadow: none; }
  .card .num { color: var(--sage); }
  .diagram,.panel-dark,.term,.player,.bars,.theme-img { border-radius: 8px; }
  .term { border-color: var(--rule); background: var(--paper); }
  .term-bar { background: var(--sage-wash); }
  .term-bar span,.t-dim { color: var(--ink-3); }
  .term pre { color: var(--ink); }
  :root[data-theme="light"] .t-red { color: #a43c2a; }
  :root[data-theme="light"] .t-green { color: #25613b; }
  .site-footer { margin-top: 64px; padding: 56px 0 32px; border-top: 1px solid var(--rule); background: var(--ground); }
  .site-footer .wrap { gap: 28px; }
  .site-footer .contact-text { gap: 16px; }
  .site-footer .contact-text p { max-width: 32ch; font-size: clamp(28px,3.3vw,44px); color: var(--ink); }
  .site-footer small { color: var(--ink-3); }

  /* Intro is progressive enhancement: the real heading is always in the DOM.
     JS adds a temporary duplicate, then moves it to the real heading's rect. */
  .intro-overlay { position: fixed; inset: 0; z-index: 100; pointer-events: none; background: var(--ground); }
  .intro-greeting { position: absolute; inset: 0; display: grid; place-content: center; padding: 28px; text-align: center; font: 400 clamp(32px,5vw,68px)/1.2 var(--serif); color: var(--ink); }
  .intro-greeting small { display: block; font: 400 15px/1.8 var(--sans); letter-spacing: .15em; color: var(--ink-3); margin-top: 22px; }
  .intro-flight { position: fixed; margin: 0; transform-origin: 0 0; pointer-events: none; }
  .intro-skip { position: absolute; top: 24px; right: max(24px,calc((100vw - var(--max))/2)); z-index: 1; pointer-events: auto; font: 12px var(--sans); border: 1px solid var(--rule-strong); padding: 12px 16px; background: var(--ground); color: var(--ink); border-radius: 4px; cursor: pointer; }
  .intro-running [data-intro-target] { visibility: hidden; }
  .intro-running .capability-cloud,.intro-running .hero-summary { opacity: 0; }
  .intro-settled .cloud-word { animation: cloud-arrive .6s both; }
  .intro-settled .cloud-word:nth-of-type(2) { animation-delay: .07s; }
  .intro-settled .cloud-word:nth-of-type(3) { animation-delay: .14s; }
  .intro-settled .cloud-word:nth-of-type(4) { animation-delay: .21s; }
  .intro-settled .cloud-word:nth-of-type(5) { animation-delay: .28s; }
  @keyframes cloud-arrive { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  @media(min-width:1600px) { :root { --max: 1460px; } }
  @media(max-width:1100px) {
    .personal-hero { grid-template-columns: 1.25fr 1fr; gap: 22px; padding-top: 66px; min-height: 620px; }
    .personal-hero .hero-position { font-size: clamp(49px,6.5vw,70px); }
    .capability-cloud { height: 380px; }
    .capability-layout { grid-template-columns: 220px minmax(0,1fr); gap: 5%; }
    .nav a { padding-inline: 7px; }
  }
  @media(max-width:800px) {
    .personal-hero { grid-template-columns: 1fr; padding-top: 48px; gap: 18px; }
    .hero-identity { padding-bottom: 0; gap: 22px; }
    .personal-hero .hero-position { font-size: clamp(50px,9vw,76px); }
    .capability-cloud { width: 100%; max-width: 560px; height: 300px; margin: 20px auto 40px; }
    .cloud-word:nth-of-type(2) { font-size: 25px; }
    .cloud-note { bottom: -30px; }
    .hero-caption { margin-top: 10px; font-size: 11px; }
    .capabilities,.project-collection { padding-top: 64px; }
    .section-heading { grid-template-columns: 1fr; gap: 16px; margin-bottom: 32px; }
    .section-heading h2 { max-width: 24ch; }
    .capability-layout { grid-template-columns: 1fr; gap: 32px; }
    .capability-nav { position: static; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; }
    .capability-nav a { flex: 1 1 180px; padding: 10px; border: 1px solid var(--rule); border-radius: 4px; gap: 8px; }
    .capability-nav a span { font-size: 12px; }
    .capability-panel { padding-bottom: 36px; }
    .capability-panel + .capability-panel { padding-top: 36px; }
    .case-brief { grid-template-columns: 1fr; gap: 24px; }
    .project-group { display: grid; gap: 8px; }
    .working-note { grid-template-columns: 1fr; gap: 24px; padding-block: 58px; }
    .project-copy { padding: 22px; }
  }
  @media(max-width:720px) {
    .site-header .wrap { gap: 4px 8px; }
    .site-header .nav { margin-left: 0; }
    .nav a { padding: 8px 4px; font-size: 12px; }
    .nav { gap: 0; }
    .brand { font-size: 16px; }
    .brand::before { width: 7px; height: 7px; margin-right: 6px; }
    .lang-switch { margin-left: auto; }
    .lang-switch + .theme-toggle { margin-left: 0; }
    .theme-toggle { margin-left: 0; }
    .project-grid { grid-template-columns: 1fr; gap: 24px; }
    .hero-caption { flex-direction: column; gap: 10px; }
    .proj-head { padding-top: 36px; }
    .proj-head > .lede { font-size: 16px; }
    .numbers > div + div { border-left: 0; border-top: 1px solid var(--rule); }
    .intro-skip { top: 18px; right: 18px; }
    .site-footer .btn-row { gap: 8px; }
    .site-footer .btn { font-size: 12px; padding: 11px 13px; }
  }
  :root:is(:lang(zh-Hant-TW),:lang(ja)) .hero-position { font-size: clamp(38px,4.9vw,67px); line-height: 1.25; max-width: 13em; letter-spacing: -.025em; }
  :root:is(:lang(zh-Hant-TW),:lang(ja)) .cloud-word { font-size: clamp(15px,1.45vw,20px); }
  :root:is(:lang(zh-Hant-TW),:lang(ja)) .cloud-word:nth-of-type(2) { font-size: clamp(18px,1.8vw,25px); }
  :root:is(:lang(zh-Hant-TW),:lang(ja)) .capability-panel h3 { line-height: 1.5; font-size: clamp(24px,2.6vw,34px); }
  @media(max-width:400px) {
    :root { --gutter: 18px; }
    .hero-identity > .eyebrow { font-size: 10px; }
    .personal-hero .hero-position { font-size: 47px; }
    :root:is(:lang(zh-Hant-TW),:lang(ja)) .hero-position { font-size: 36px; }
    .hero-summary { font-size: 14px; }
    .cloud-word { font-size: 16px; padding: 8px; }
    .cloud-word:nth-of-type(2) { font-size: 21px; }
    .capability-nav a { flex-basis: 140px; }
  }
  @media(prefers-reduced-motion:reduce) {
    html,.slides { scroll-behavior: auto !important; }
    *,*::before,*::after { animation: none !important; transition: none !important; }
    .intro-overlay { display: none !important; }
    .intro-running [data-intro-target] { visibility: visible; }
    .intro-running .capability-cloud,.intro-running .hero-summary { opacity: 1; }
    .reveal { opacity: 1 !important; transform: none !important; }
  }
}
@media print { .skip-link,.intro-overlay,.intro-replay { display: none !important; } }

/* Keep education in reading order for PDF text extraction. The explicit
   project-page start also balances the three language versions. */
.resume-date { white-space: nowrap; }
@media print {
  .resume-projects { break-before: page; page-break-before: always; }
  .resume-education .skills > div { display: block; break-inside: avoid; }
  .resume-education .skills dt { font-size: 9.5pt; font-weight: 700; letter-spacing: 0; text-transform: none; margin-bottom: 2pt; }
  .resume-education .skills dd { margin: 0 0 3pt; }
  :root:lang(zh-Hant-TW) .resume h1 { font-family: 'Noto Sans TC', Arial, sans-serif; }
  :root:lang(ja) .resume h1 { font-family: 'Noto Sans JP', Arial, sans-serif; }
}
