/* Chengyang Lyu — portfolio. "Design notebook": warm paper, ink, highlighter yellow, one accent per project.
   Fonts are linked from the page head (latin-faces.css + cjk-faces.css). */

:root {
  --paper: #faf7f0;
  --paper-2: #f3eee3;
  --surface: #ffffff;
  --ink: #1d1b18;
  --ink-2: #3a362f;
  --muted: #5f5a53;
  --faint: #6b655c;
  --line: #e6dfd3;
  --line-2: #d8cfbf;
  --hi: #ffd23f;
  --hi-soft: #fff1b8;
  --hi-ink: #7a5600;

  --accent: #1d1b18;
  --accent-ink: #1d1b18;
  --accent-tint: #f3eee3;

  --font-display: 'Bricolage Grotesque', 'CLY Display ZH', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', 'Source Han Sans SC', sans-serif;
  --font-hand: 'Caveat', 'LXGW WenKai', 'Kaiti SC', 'STKaiti', 'KaiTi', cursive;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', monospace;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow-1: 0 1px 2px rgba(29, 27, 24, .06), 0 2px 8px rgba(29, 27, 24, .05);
  --shadow-2: 0 2px 4px rgba(29, 27, 24, .06), 0 12px 32px -8px rgba(29, 27, 24, .16);
  --page: 1200px;
  --read: 720px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}
:root:lang(zh) {
  --font-display: 'CLY Display ZH', 'Bricolage Grotesque', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-hand: 'LXGW WenKai', 'Caveat', 'Kaiti SC', 'STKaiti', 'KaiTi', cursive;
}

[data-project="anime-town"] { --accent: #7a52cc; --accent-ink: #5e3aae; --accent-tint: #efe9fb; }
[data-project="phantom-rails"] { --accent: #23263a; --accent-ink: #23263a; --accent-tint: #ebe9f0; }
[data-project="aimlabs-pro"] { --accent: #e5484d; --accent-ink: #b8282e; --accent-tint: #fde8e8; }
[data-project="roses-and-mud"] { --accent: #4f8f88; --accent-ink: #2f6f69; --accent-tint: #e1f0ee; }
[data-project="sanding-man"] { --accent: #2e2e2e; --accent-ink: #b42f35; --accent-tint: #efedea; }
[data-project="cats-back-home"] { --accent: #f2b705; --accent-ink: #8a5a00; --accent-tint: #fff4cc; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.11 0 0 0 0 0.10 0 0 0 0 0.09 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body:lang(zh) { line-height: 1.85; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: .18em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--hi); color: var(--ink); }
strong { font-weight: 650; }
code { font-family: var(--font-mono); font-size: .9em; background: color-mix(in srgb, var(--ink) 7%, transparent); padding: .1em .4em; border-radius: 6px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; letter-spacing: -.015em; margin: 0; font-weight: 750; text-wrap: balance; }
:lang(zh) h1, :lang(zh) h2, :lang(zh) h3, :lang(zh) h4 { letter-spacing: 0; line-height: 1.3; }
p { margin: 0 0 1em; text-wrap: pretty; }
.wrap { width: min(var(--page), 100% - 2 * var(--gutter)); margin-inline: auto; }
.vh { 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: 100; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; text-decoration: none; }
.skip:focus { top: 12px; }

.mono { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
:lang(zh) .mono { letter-spacing: .08em; font-size: .82rem; }
.mark { background: linear-gradient(transparent 58%, var(--hi) 58%, var(--hi) 92%, transparent 92%); padding: 0 .08em; border-radius: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; transition: border-color .25s, box-shadow .25s; }
.site-header.scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 20px -16px rgba(29, 27, 24, .35); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-weight: 750; font-size: 1.06rem; letter-spacing: -.01em; }
.brand .logo { width: 34px; height: 34px; flex: none; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.brand:hover .logo { transform: rotate(-10deg) scale(1.06); }
.brand small { font-family: var(--font-body); font-weight: 500; color: var(--muted); font-size: .86rem; margin-left: 4px; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 999px; font-size: .95rem; font-weight: 550; color: var(--ink-2); transition: background-color .2s; }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav .lang { margin-left: 6px; border: 1.5px solid var(--ink); padding: 6px 12px; font-weight: 650; }
.nav .lang:hover { background: var(--ink); color: var(--paper); }
.menu-btn { display: none; background: none; border: 1.5px solid var(--ink); border-radius: 999px; padding: 7px 14px; font: 600 .92rem var(--font-body); color: var(--ink); cursor: pointer; }
@media (max-width: 900px) { .brand small { display: none; } }
@media (max-width: 760px) {
  .js .menu-btn { display: inline-flex; }
  .js .nav { position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 2px; padding: 10px var(--gutter) 18px; background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 14px 24px -18px rgba(0, 0, 0, .35); display: none; }
  .js .nav.open { display: flex; }
  .js .nav a { padding: 12px 14px; font-size: 1.05rem; }
  .js .nav .lang { margin: 8px 0 0; text-align: center; }
  .nav { padding-bottom: 8px; }
}

/* ---------- buttons & chips ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 999px; font: 650 1rem/1.15 var(--font-body); text-decoration: none; border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink); cursor: pointer; transition: transform .18s, box-shadow .18s, background-color .18s; white-space: nowrap; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 3px 0 var(--ink); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { box-shadow: 0 3px 0 var(--hi); }
.btn svg { width: 18px; height: 18px; flex: none; }
@media (max-width: 360px) { .btn { padding: 11px 16px; font-size: .95rem; } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--accent-tint); color: var(--accent-ink); font: 600 .8rem/1.4 var(--font-body); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chips li { background: var(--surface); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; font-size: .9rem; font-weight: 550; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .9rem; font-weight: 550; box-shadow: var(--shadow-1); }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: #2fbf71; box-shadow: 0 0 0 4px rgba(47, 191, 113, .18); }

/* ---------- home hero ---------- */
.hero { padding: clamp(32px, 7vw, 96px) 0 clamp(28px, 6vw, 72px); }
.hero .wrap { display: grid; grid-template-columns: 1.12fr .88fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.hero h1 { font-size: clamp(2.5rem, 5.4vw, 4.4rem); margin: 18px 0 20px; }
.hero h1 .name-alt { display: block; font-size: .38em; letter-spacing: 0; font-weight: 600; color: var(--muted); margin-top: 12px; font-family: var(--font-body); }
.hero .statement { font-family: var(--font-display); font-weight: 650; font-size: clamp(1.45rem, 2.6vw, 2.05rem); line-height: 1.25; letter-spacing: -.01em; margin: 0 0 18px; max-width: 22em; text-wrap: balance; }
:lang(zh) .hero .statement { letter-spacing: 0; line-height: 1.4; }
.hero .lead { font-size: clamp(1.02rem, 1.4vw, 1.12rem); color: var(--muted); max-width: 38em; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero .glance { margin-top: 30px; }
.collage { position: relative; aspect-ratio: 1.04; width: 100%; }
.polaroid { position: absolute; display: block; background: var(--surface); padding: 10px 10px 0; border-radius: 6px; box-shadow: var(--shadow-2); text-decoration: none; transition: transform .45s cubic-bezier(.2, .9, .3, 1.2), box-shadow .3s; }
.polaroid img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: 3px; }
.polaroid span.cap { display: block; font-family: var(--font-hand); font-size: 1.28rem; font-weight: 600; padding: 6px 4px 10px; color: var(--ink-2); line-height: 1.2; }
:lang(zh) .polaroid span.cap { font-size: 1.12rem; }
.polaroid::before { content: ''; position: absolute; top: -12px; left: 50%; width: 86px; height: 26px; transform: translateX(-50%) rotate(-3deg); background: color-mix(in srgb, var(--hi) 72%, transparent); border-radius: 2px; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.polaroid.p1 { left: 0; top: 2%; width: 58%; transform: rotate(-6deg); z-index: 2; }
.polaroid.p2 { right: 0; top: 0; width: 52%; transform: rotate(5deg); z-index: 1; }
.polaroid.p2 span.cap { text-align: right; }
.polaroid.p3 { left: 34%; top: 47%; width: 56%; transform: rotate(-2deg); z-index: 3; }
.polaroid:hover, .polaroid:focus-visible { transform: rotate(0) scale(1.04); z-index: 5; box-shadow: 0 30px 50px -20px rgba(29, 27, 24, .45); }
.doodle { position: absolute; color: var(--ink); pointer-events: none; }
.doodle svg { width: 100%; height: 100%; overflow: visible; }
.collage .d-star { width: 42px; height: 42px; right: 1%; bottom: 3%; color: var(--hi-ink); z-index: 4; }
.collage .d-spark { width: 28px; height: 28px; left: 9%; bottom: 31%; }
.collage .note { position: absolute; z-index: 4; left: 0; bottom: 8%; width: 32%; font-family: var(--font-hand); font-size: clamp(1.1rem, 1.6vw, 1.4rem); font-weight: 600; transform: rotate(-5deg); color: var(--ink-2); line-height: 1.15; word-break: keep-all; }
:lang(zh) .collage .note { font-size: clamp(1rem, 1.4vw, 1.2rem); }
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .collage { max-width: 540px; margin-inline: auto; }
}
@media (max-width: 600px) {
  .collage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; aspect-ratio: auto; padding-top: 10px; }
  .polaroid, .polaroid.p1, .polaroid.p2, .polaroid.p3 { position: relative; left: auto; right: auto; top: auto; width: auto; padding: 6px 6px 0; }
  .polaroid.p1 { transform: rotate(-4deg); } .polaroid.p2 { transform: rotate(3deg); } .polaroid.p3 { transform: rotate(-2deg); }
  .polaroid::before { width: 46px; height: 16px; top: -8px; }
  .polaroid span.cap, :lang(zh) .polaroid span.cap, .polaroid.p2 span.cap { font-size: .95rem; text-align: left; padding: 4px 2px 6px; }
  .collage .note, .collage .doodle { display: none; }
}

/* ---------- sections (home) ---------- */
.section { padding: clamp(44px, 8vw, 104px) 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: clamp(24px, 4vw, 40px); }
.section-head h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); position: relative; display: inline-block; }
.section-head h2 .squiggle { position: absolute; left: 0; bottom: -12px; width: 100%; height: 12px; color: var(--hi); }
.section-head .side { color: var(--muted); max-width: 30em; margin: 0; }
.section-head > div { flex: none; }
.kicker { color: var(--faint); display: block; margin-bottom: 10px; }
@media (max-width: 640px) { .section-head { flex-direction: column; align-items: flex-start; } .section-head .side { margin-top: 14px; } }

/* ---------- work grid ---------- */
.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(18px, 2.6vw, 30px); }
.card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow-1); transition: transform .35s cubic-bezier(.2, .8, .3, 1), box-shadow .35s, border-color .35s; }
a.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.card .thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--accent-tint); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .8, .3, 1); }
a.card:hover .thumb img { transform: scale(1.045); }
.card .body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; border-top: 4px solid var(--accent); }
.card .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card h3 { font-size: clamp(1.35rem, 2vw, 1.6rem); }
.card .tagline { color: var(--ink-2); margin: 0; font-size: .98rem; }
.card .meta { color: var(--muted); font-size: .88rem; margin: auto 0 0; padding-top: 6px; }
.card .go { font-weight: 650; font-size: .92rem; color: var(--accent-ink); display: inline-flex; align-items: center; gap: 6px; }
.card .go svg { width: 16px; height: 16px; transition: transform .25s; }
a.card:hover .go svg { transform: translateX(4px); }
.card.featured { grid-column: 1 / -1; flex-direction: row; }
.card.featured .thumb { aspect-ratio: auto; flex: 1.35; min-height: 340px; }
.card.featured .body { flex: 1; border-top: 0; border-left: 5px solid var(--accent); padding: clamp(24px, 3vw, 40px); justify-content: center; }
.card.featured h3 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.card.featured .tagline { font-size: 1.06rem; }
.card.soon { grid-column: 1 / -1; flex-direction: row; align-items: stretch; box-shadow: none; border-style: dashed; border-color: var(--line-2); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.card.soon .thumb { aspect-ratio: auto; flex: 0 0 180px; min-height: 120px; display: grid; place-items: center; }
.card.soon .thumb svg { width: 64px; height: 64px; color: var(--accent); }
.card.soon .body { border-top: 0; border-left: 4px solid var(--accent); justify-content: center; gap: 6px; padding: 16px 22px; }
.card.soon h3 { font-size: 1.25rem; }
.card.soon .sticker { align-self: flex-start; transform: rotate(-2deg); background: var(--hi); color: var(--ink); font-family: var(--font-hand); font-size: 1.2rem; font-weight: 700; padding: 2px 12px; border-radius: 6px; white-space: nowrap; }
:lang(zh) .card.soon .sticker { font-size: 1.02rem; }
@media (max-width: 820px) {
  .work-grid { grid-template-columns: 1fr; }
  .card.featured { flex-direction: column; }
  .card.featured .thumb { aspect-ratio: 16 / 10; min-height: 0; }
  .card.featured .body { border-left: 0; border-top: 4px solid var(--accent); }
  .card.featured .thumb, .card.featured .body { flex: none; }
}
@media (max-width: 480px) { .card.soon .thumb { flex-basis: 118px; padding: 8px; } .card.soon .thumb svg { width: 44px; height: 44px; } }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(28px, 5vw, 64px); align-items: start; }
.about-grid .lead { font-size: 1.15rem; color: var(--ink-2); }
.exp-title { margin: 30px 0 0; color: var(--faint); font-family: var(--font-mono); font-size: .78rem; font-weight: 600; }
.timeline { list-style: none; margin: 18px 0 0; padding: 0; border-left: 2px dashed var(--line-2); }
.timeline li { position: relative; padding: 0 0 20px 22px; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: .5em; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2.5px solid var(--ink); }
.timeline .when { display: block; color: var(--faint); margin-bottom: 2px; }
.timeline .what { font-weight: 650; display: block; }
.timeline .detail { color: var(--muted); font-size: .96rem; margin: 2px 0 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 28px); box-shadow: var(--shadow-1); }
.panel + .panel { margin-top: 20px; }
.panel h3 { font-size: 1.15rem; margin-bottom: 14px; }
.skill-group { display: grid; grid-template-columns: 8.5em 1fr; gap: 6px 14px; align-items: baseline; margin-bottom: 12px; }
.skill-group:last-child { margin-bottom: 0; }
.skill-group .label { color: var(--faint); padding-top: 6px; }
@media (max-width: 520px) { .skill-group { grid-template-columns: 1fr; gap: 6px; } .skill-group .label { padding-top: 0; } }
.hours { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hours li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; font-size: .95rem; }
.hours .bar { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.hours .bar span { display: block; height: 100%; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, var(--hi), #ffb627); transform-origin: left; }
.hours .h { font-family: var(--font-mono); font-size: .82rem; color: var(--muted); white-space: nowrap; }
.hours .note { color: var(--faint); font-size: .82rem; margin-left: 8px; }
@media (max-width: 480px) { .hours .note { display: block; margin-left: 0; } }
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- contact ---------- */
.contact-card { position: relative; background: var(--hi); border-radius: calc(var(--radius) + 6px); padding: clamp(26px, 5vw, 56px); overflow: hidden; display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center; box-shadow: var(--shadow-2); }
.contact-card h2 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
.contact-card p { font-size: 1.1rem; max-width: 30em; color: var(--ink-2); }
.contact-card .kicker { color: var(--hi-ink); }
.contact-card .actions { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.contact-card .btn { justify-content: center; }
.email-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.email-row a { font-family: var(--font-mono); font-size: 1rem; font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--ink); overflow-wrap: anywhere; }
.email-tag { font-size: .82rem; color: var(--hi-ink); font-weight: 650; min-width: 4.5em; }
@media (max-width: 480px) { .email-tag { flex-basis: 100%; min-width: 0; } }
.copy-btn { border: 1.5px solid var(--ink); background: transparent; border-radius: 999px; padding: 6px 14px; min-height: 34px; font: 600 .82rem var(--font-body); cursor: pointer; color: var(--ink); }
.copy-btn:hover { background: var(--ink); color: var(--hi); }
.contact-card .d-arrow { position: absolute; right: 30%; top: 14px; width: 90px; height: 60px; opacity: .85; }
@media (max-width: 820px) { .contact-card { grid-template-columns: 1fr; } .contact-card .d-arrow { display: none; } }

/* ---------- footer ---------- */
.site-footer { padding: 40px 0 56px; color: var(--muted); font-size: .92rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 22px; }
.site-footer a { color: inherit; white-space: nowrap; }

/* ---------- project page ---------- */
.p-hero { padding: clamp(20px, 4vw, 44px) 0 0; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; padding: 6px 0; }
.back svg { width: 16px; height: 16px; transition: transform .2s; }
.back:hover { color: var(--ink); }
.back:hover svg { transform: translateX(-3px); }
.p-head { display: grid; grid-template-columns: 1.25fr .75fr; gap: clamp(24px, 4vw, 56px); align-items: start; margin: 18px 0 28px; }
.p-head h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); margin: 12px 0 14px; }
.p-head .subtitle { display: block; font-size: .36em; color: var(--muted); font-weight: 600; margin-top: 8px; letter-spacing: 0; font-family: var(--font-body); }
.p-head .tagline { font-size: clamp(1.06rem, 1.6vw, 1.25rem); color: var(--ink-2); margin: 0; max-width: 34em; }
.spec { background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--accent); border-radius: var(--radius-sm); padding: 18px 20px; box-shadow: var(--shadow-1); }
.spec dl { margin: 0; display: grid; gap: 12px 18px; }
.spec dl:has(> div:nth-child(5)) { grid-template-columns: 1fr 1fr; }
.spec dt { color: var(--faint); margin-bottom: 2px; }
.spec dd { margin: 0; font-weight: 560; font-size: .97rem; line-height: 1.45; }
.spec .links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.spec .links .btn { padding: 9px 16px; font-size: .92rem; }
.p-cover { margin-top: 8px; border-radius: calc(var(--radius) + 4px); overflow: hidden; box-shadow: var(--shadow-2); background: var(--accent-tint); }
.p-cover img { width: 100%; max-height: 72vh; object-fit: cover; }
.p-cover.contain img { object-fit: contain; max-height: 72vh; }
@media (max-width: 900px) { .p-head { grid-template-columns: 1fr; } .spec dl:has(> div:nth-child(5)) { grid-template-columns: 1fr; } }

.p-intro { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(24px, 4vw, 56px); padding: clamp(32px, 6vw, 72px) 0 clamp(12px, 2vw, 24px); }
.p-intro.no-hl { grid-template-columns: minmax(0, 1fr); }
.p-intro.no-hl .summary { max-width: 860px; }
.p-intro .summary p { font-size: clamp(1.08rem, 1.5vw, 1.22rem); color: var(--ink-2); }
.p-intro h2 { font-size: .8rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; margin-bottom: 14px; }
.highlights { position: relative; background: var(--hi-soft); border-radius: 6px; padding: 22px 22px 18px; transform: rotate(.6deg); box-shadow: var(--shadow-1); align-self: start; }
.highlights::before { content: ''; position: absolute; top: -10px; left: 50%; transform: translateX(-50%) rotate(-2deg); width: 80px; height: 22px; background: color-mix(in srgb, var(--accent) 35%, transparent); }
.highlights h2 { color: var(--hi-ink); }
.highlights ul { margin: 0; padding: 0 0 0 1.1em; display: grid; gap: 10px; }
.highlights li { font-size: .97rem; line-height: 1.5; }
.highlights li::marker { content: '★  '; color: var(--hi-ink); font-size: .8em; }
.highlights a { font-weight: 650; color: var(--accent-ink); }
@media (max-width: 900px) { .p-intro { grid-template-columns: 1fr; } .highlights { transform: none; } }

.toc-mobile { display: none; margin: 0 0 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; }
.toc-mobile summary { cursor: pointer; font-weight: 650; font-size: .95rem; }
.toc-mobile ol { margin: 10px 0 2px; padding-left: 1.3em; }
.toc-mobile li { margin: 4px 0; }
.toc-mobile a { text-decoration: none; color: var(--ink-2); }
.p-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); padding-bottom: 40px; }
.toc { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; padding-right: 6px; }
.toc .mono { color: var(--faint); display: block; margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; color: var(--muted); font-size: .92rem; line-height: 1.35; transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 650; }
.toc a:focus-visible { outline-offset: -3px; }
@media (max-width: 1060px) { .p-body { grid-template-columns: 1fr; } .toc { display: none; } .toc-mobile { display: block; } }

.content { min-width: 0; }
.content > section { padding-top: 12px; margin-bottom: clamp(36px, 5vw, 56px); }
.content > section > h2.sec-h { font-size: clamp(1.55rem, 2.5vw, 2.05rem); margin-bottom: 18px; position: relative; padding-left: 18px; }
.content > section > h2.sec-h::before { content: ''; position: absolute; left: 0; top: .2em; bottom: .2em; width: 6px; border-radius: 3px; background: var(--accent); }
.h2-sub { color: var(--muted); font-weight: 600; }
.content > section.sub { margin-top: -16px; }
.content > section.sub > h3.sec-h { font-size: clamp(1.18rem, 1.7vw, 1.36rem); margin-bottom: 14px; }
.content h3.bh, .content h4.bh { font-size: 1.12rem; margin: 26px 0 10px; color: var(--ink); line-height: 1.3; }
.content .bh:first-child { margin-top: 0; }
:lang(zh) .content h3.bh, :lang(zh) .content h4.bh { font-family: var(--font-body); font-weight: 700; font-size: 1.08rem; }
:lang(zh) .content > section.sub > h3.sec-h { font-family: var(--font-body); font-weight: 750; letter-spacing: 0; }
.content p, .content li { max-width: var(--read); }
.content ul, .content ol { padding-left: 1.3em; margin: 0 0 1em; }
.content li { margin-bottom: .4em; }
.content li::marker { color: var(--accent-ink); }

/* figures */
.fig { margin: 22px 0 26px; }
.fig .zoom { position: relative; display: block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface); cursor: zoom-in; transition: box-shadow .25s; }
.fig .zoom:hover { box-shadow: var(--shadow-2); }
.fig .zoom::after { content: ''; position: absolute; right: 10px; bottom: 10px; width: 30px; height: 30px; border-radius: 50%; background: rgba(29, 27, 24, .66) no-repeat center / 16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21M10.5 7.5v6M7.5 10.5h6'/%3E%3C/svg%3E"); opacity: 0; transition: opacity .2s; }
.fig .zoom:hover::after, .fig .zoom:focus-visible::after { opacity: 1; }
@media (hover: none) { .fig .zoom::after { opacity: .75; width: 26px; height: 26px; } }
.fig img { width: 100%; }
.fig figcaption { margin-top: 10px; font-size: .9rem; color: var(--muted); line-height: 1.45; max-width: var(--read); }
.fig figcaption.body { font-size: 1rem; color: var(--ink-2); }
.fig figcaption a { font-weight: 600; color: var(--accent-ink); }
.fig .alt-text { margin-top: 10px; font-size: .9rem; color: var(--muted); max-width: var(--read); }
.fig .alt-text summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.fig .alt-text p { margin: 8px 0 0; }
.fig.size-full { max-width: 880px; }
.fig.size-wide { max-width: none; }
.fig.size-half { max-width: 460px; }
.fig.size-third { max-width: 320px; }
.fig.size-small { max-width: 240px; }
.gallery { display: grid; gap: 16px; margin: 22px 0 8px; align-items: start; }
.gallery.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gallery .fig { margin: 0; max-width: none; }
.gallery.even .fig .zoom { aspect-ratio: var(--ar); display: flex; align-items: center; justify-content: center; background: var(--paper-2); }
.gallery.even .fig .zoom img { width: 100%; height: 100%; object-fit: contain; }
.gallery.even .fig.crop-top .zoom img { object-fit: cover; object-position: top; }
.gallery.cols-2 > .fig:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 8px); }
.gallery-cap { font-size: .9rem; color: var(--muted); margin-top: 6px; }
@media (max-width: 760px) {
  .gallery.cols-3, .gallery.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery.cols-3 > .fig:last-child:nth-child(odd), .gallery.cols-4 > .fig:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 8px); }
}
@media (max-width: 460px) { .gallery.cols-2 { grid-template-columns: 1fr; } }
.media-text { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(16px, 3vw, 32px); align-items: start; margin: 18px 0 26px; }
.media-text.side-right { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
.media-text.side-right .fig { order: 2; }
.media-text .fig { margin: 0; max-width: none; }
.media-text.tall { grid-template-columns: minmax(0, .55fr) minmax(0, 1.45fr); }
.media-text.tall.side-right { grid-template-columns: minmax(0, 1.45fr) minmax(0, .55fr); }
.media-text.tall .fig img { max-height: 520px; object-fit: contain; }
.media-text.short { grid-template-columns: minmax(0, auto) minmax(0, 1fr); }
.media-text.short.side-right { grid-template-columns: minmax(0, 1fr) minmax(0, auto); }
.media-text.short .fig .zoom { display: inline-block; }
.media-text.short .fig img { max-height: 340px; width: auto; max-width: min(100%, 460px); }
@media (max-width: 640px) {
  .media-text, .media-text.side-right, .media-text.tall, .media-text.tall.side-right, .media-text.short, .media-text.short.side-right { grid-template-columns: 1fr; }
  .media-text.side-right .fig { order: 0; }
  .media-text.tall .fig { max-width: 300px; }
}

blockquote { margin: 16px 0; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 4px var(--radius-sm) var(--radius-sm) 4px; max-width: var(--read); }
blockquote p { margin: 0; }
blockquote cite { display: block; margin-top: 8px; font-style: normal; font-size: .86rem; color: var(--muted); }

/* tables: scroll inside the wrapper on narrow screens; caption outside the scroll area */
.table-fig { margin: 18px 0 26px; max-width: 880px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.table-fig figcaption { padding: 10px 2px 0; color: var(--muted); font-size: .88rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.table-fig.wide table { min-width: 520px; }
.table-fig.wide .table-wrap { background: linear-gradient(90deg, var(--surface) 30%, rgba(255,255,255,0)) left / 40px 100% no-repeat local, linear-gradient(270deg, var(--surface) 30%, rgba(255,255,255,0)) right / 40px 100% no-repeat local, radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.13), transparent) left / 12px 100% no-repeat scroll, radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.13), transparent) right / 12px 100% no-repeat scroll, var(--surface); }
.table-fig.wide th { background: transparent; }
th { text-align: left; font-family: var(--font-mono); font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); font-weight: 600; background: var(--paper); white-space: nowrap; }
th, td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.rowhead td:first-child { font-weight: 600; }
.emph-2 td:nth-child(2) { font-weight: 650; color: var(--accent-ink); }
.emph-2 td:first-child { color: var(--muted); }

/* diagrams */
.diagram { margin: 18px 0 26px; max-width: 900px; }
.diagram-cap { font-size: .88rem; color: var(--muted); margin-bottom: 10px; }
.diagram-cap.note { font-style: italic; margin-top: -8px; }
.content .steps, .content .pairs, .content .legend { padding-left: 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0 30px; }
.steps li { position: relative; display: flex; margin: 0; max-width: none; }
.steps li span { display: flex; align-items: center; width: 100%; padding: 10px 12px; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 12px; font-size: .9rem; font-weight: 560; line-height: 1.35; text-wrap: balance; }
.steps li + li::before { content: ''; position: absolute; left: -26px; top: 50%; width: 22px; height: 12px; margin-top: -6px; background: no-repeat center / 22px 12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 12' fill='none' stroke='%238a847a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 6h22M18 1.5 23.5 6 18 10.5'/%3E%3C/svg%3E"); }
.steps li.k-player span { background: #fff6cf; border-color: #f2c84b; }
.steps li.k-ai span { background: #efe9fb; border-color: #b9a2ec; }
.steps li.k-code span { background: #e6f0ff; border-color: #94b8f0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; padding: 0; list-style: none; font-size: .84rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.legend i { width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid; display: inline-block; }
.legend .k-player i { background: #fff6cf; border-color: #f2c84b; }
.legend .k-ai i { background: #efe9fb; border-color: #b9a2ec; }
.legend .k-code i { background: #e6f0ff; border-color: #94b8f0; }
@media (max-width: 760px) {
  .steps { grid-auto-flow: row; grid-auto-columns: auto; gap: 26px 0; }
  .steps li + li::before { left: 22px; top: -20px; margin-top: 0; transform: rotate(90deg); }
}
@media (max-width: 1060px) {
  .steps.n-5, .steps.n-6, .steps.n-7, .steps.n-8 { grid-auto-flow: row; grid-auto-columns: auto; gap: 26px 0; max-width: 520px; }
  .steps.n-5 li + li::before, .steps.n-6 li + li::before, .steps.n-7 li + li::before, .steps.n-8 li + li::before { left: 22px; top: -20px; margin-top: 0; transform: rotate(90deg); }
}
:lang(zh) .steps li span, :lang(zh) .pairs .from, :lang(zh) .pairs .to { word-break: keep-all; }
.pairs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pairs li { display: grid; grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1.2fr); align-items: center; margin: 0; max-width: none; }
.pairs li::after { content: ''; grid-column: 2; grid-row: 1; height: 12px; background: no-repeat center / 26px 12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 12' fill='none' stroke='%238a847a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 6h22M18 1.5 23.5 6 18 10.5'/%3E%3C/svg%3E"); }
.pairs .from, .pairs .to { padding: 10px 14px; border-radius: 12px; font-size: .93rem; font-weight: 560; line-height: 1.35; }
.pairs .from { grid-column: 1; grid-row: 1; background: var(--paper-2); border: 1.5px solid var(--line-2); }
.pairs .to { grid-column: 3; grid-row: 1; background: var(--accent-tint); border: 1.5px solid color-mix(in srgb, var(--accent) 45%, transparent); }
@media (max-width: 460px) {
  .pairs li { grid-template-columns: 1fr; gap: 0; }
  .pairs li::after { grid-column: 1; grid-row: 2; height: 22px; transform: rotate(90deg); background-size: 18px 10px; }
  .pairs .from { grid-column: 1; grid-row: 1; }
  .pairs .to { grid-column: 1; grid-row: 3; }
}

.callout { position: relative; margin: 20px 0 26px; padding: 18px 20px 14px; background: var(--hi-soft); border-radius: 4px; max-width: var(--read); box-shadow: var(--shadow-1); }
.callout::before { content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 5px; background: var(--hi); border-radius: 4px 0 0 4px; }
.callout-title { font-family: var(--font-hand); font-size: 1.4rem; font-weight: 700; margin: 0 0 4px !important; color: var(--hi-ink); line-height: 1.2; }
:lang(zh) .callout-title { font-size: 1.22rem; }
.callout p:last-child { margin-bottom: 4px; }
.link-line a { font-weight: 650; color: var(--accent-ink); word-break: break-all; }
.link-line .arrow { margin-left: 4px; }

.p-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 24px 0 8px; }
.p-nav a { display: flex; gap: 16px; align-items: center; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; transition: transform .3s, box-shadow .3s; }
.p-nav a:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }
.p-nav img { width: 120px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; flex: none; }
.p-nav .lbl { color: var(--faint); display: block; }
.p-nav .ttl { font-family: var(--font-display); font-weight: 750; font-size: 1.2rem; line-height: 1.2; }
.p-nav .next { justify-content: flex-end; text-align: right; }
.p-nav .next img { order: 2; }
@media (max-width: 700px) { .p-nav { grid-template-columns: 1fr; } .p-nav img { width: 90px; } }

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 90; display: none; background: rgba(20, 18, 15, .92); color: #f4f1ea; }
.lb.open { display: grid; grid-template-rows: 1fr auto; }
.lb figure { margin: 0; display: grid; place-items: center; padding: 56px 64px 8px; min-height: 0; }
.lb img { max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; border-radius: 6px; background: #fff; }
.lb .cap { text-align: center; padding: 6px 24px 22px; font-size: .95rem; color: #d9d4ca; min-height: 1.5em; }
.lb button { position: absolute; background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; width: 46px; height: 46px; display: grid; place-items: center; cursor: pointer; font-size: 1.3rem; }
.lb button:hover { background: rgba(255, 255, 255, .2); }
.lb .x { top: 14px; right: 14px; }
.lb .prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb .next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb .count { position: absolute; top: 24px; left: 22px; font-family: var(--font-mono); font-size: .8rem; color: #bdb7ab; }
.lb :focus-visible, .lang-hint :focus-visible { outline-color: #fff; }
@media (max-width: 640px) { .lb figure { padding: 60px 10px 8px; } .lb img { max-height: calc(100vh - 210px); max-height: calc(100dvh - 210px); } .lb .prev, .lb .next { top: auto; bottom: 12px; transform: none; } .lb .cap { padding-bottom: 74px; } }

/* ---------- misc ---------- */
.lang-hint { position: fixed; z-index: 60; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: var(--paper); border-radius: 999px; padding: 8px 8px 8px 18px; display: none; gap: 10px; align-items: center; box-shadow: var(--shadow-2); font-size: .95rem; max-width: calc(100% - 24px); white-space: nowrap; }
.lang-hint.show { display: flex; }
.lang-hint a { color: var(--ink); background: var(--hi); text-decoration: none; padding: 6px 14px; border-radius: 999px; font-weight: 650; }
.lang-hint button { background: none; border: 0; color: var(--paper); font-size: 1.2rem; cursor: pointer; padding: 4px 8px; }
@media (max-width: 480px) { .lang-hint { font-size: .86rem; padding: 6px 6px 6px 14px; gap: 6px; bottom: 12px; } .lang-hint a { padding: 5px 11px; } }
.notfound { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 80px 0; }
.notfound h1 { font-size: clamp(3rem, 10vw, 7rem); }

@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .hours .bar span { transform: scaleX(0); transition: transform 1.1s cubic-bezier(.2, .7, .2, 1); }
  .js .hours.in .bar span { transform: scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@media print {
  .site-header, .toc, .toc-mobile, .p-nav, .lb, .lang-hint, .menu-btn { display: none !important; }
  body { background: #fff; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .card, .panel, .spec, .fig .zoom { box-shadow: none; }
}
