/* ==========================================================================
   Ian's Portfolio · v3 shared styles (dark only)
   Used by index.html and every page in /works/. Tokens, fonts, nav, mobile
   menu, buttons, tags, section labels and footer live here.
   Type: Geist (Latin), Kode Mono (labels, nav, buttons), MiSans (Chinese).
   Icons: Remix Icon (remixicon.com), pasted inline as SVG with fill="currentColor".
   ========================================================================== */
@font-face { font-family: "Geist"; src: url("fonts/geist/Geist-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist/Geist-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist/Geist-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist/Geist-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist/GeistMono-Medium.woff2") format("woff2"); font-weight: 500; font-display: block; }
@font-face { font-family: "Kode Mono"; src: url("fonts/kode/KodeMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Kode Mono"; src: url("fonts/kode/KodeMono-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Kode Mono"; src: url("fonts/kode/KodeMono-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #060606; --surface: #101010; --surface-2: #181818;
  --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.16);
  --text: #f2f1ee; --muted: #8f8c86; --dim: #6c6964;
  --accent: #eb5b19; --accent-deep: #c2470e; --accent-soft: rgba(235,91,25,.12); --accent-line: rgba(235,91,25,.42);
  --on-accent: #0b0b0b;
  --font-sans: "Geist", "MiSans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "Kode Mono", "MiSans", "PingFang SC", ui-monospace, monospace;
  --maxw: 1440px;
  --pad-x: clamp(16px, 5.6vw, 80px);
  --nav-h: 76px;
  --focus: 0 0 0 3px rgba(235,91,25,.55);
}
@media (max-width: 720px) { :root { --nav-h: 64px; } }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 8px); background: var(--bg); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { font-weight: 700; text-wrap: balance; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 2px; }
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: max(var(--pad-x), env(safe-area-inset-left, 0px)) max(var(--pad-x), env(safe-area-inset-right, 0px)); }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* language: html[lang] decides which copy shows */
html:not([lang^="zh"]) .zh { display: none !important; }
html[lang^="zh"] .en { display: none !important; }
html[lang^="zh"] body { line-height: 1.75; }

/* type helpers */
.mono { font-family: var(--font-mono); }
.label { font-family: var(--font-mono); font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
html[lang^="zh"] .label { letter-spacing: .06em; }
.accent { color: var(--accent); }
.dim { color: var(--dim); }
.sec-label { display: inline-flex; align-items: center; gap: 10px; }
.sec-label::before { content: ""; width: 6px; height: 6px; background: var(--accent); flex: none; }
.h2 { font-size: clamp(44px, 5.4vw, 76px); line-height: 1.02; letter-spacing: -.04em; }
html[lang^="zh"] .h2 { letter-spacing: -.01em; line-height: 1.15; }
.h2 .soft { color: var(--muted); }
.h2 .hot { color: var(--accent); }

/* icons (Remix) */
.ri { width: 18px; height: 18px; flex: none; fill: currentColor; }

/* ---------- buttons (after blurr.design): square, icon block on the right ---------- */
.btn { display: inline-flex; align-items: center; gap: 18px; padding: 4px 4px 4px 20px; border-radius: 2px; text-decoration: none; cursor: pointer; border: 0; font: 600 13px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease; }
html[lang^="zh"] .btn { font-size: 14px; letter-spacing: .04em; }
.btn .ib { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 1px; flex: none; }
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -2px 0 rgba(0,0,0,.28), 0 8px 24px -6px rgba(235,91,25,.35); }
.btn--primary .ib { background: var(--accent-deep); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -2px 0 rgba(0,0,0,.28), 0 12px 28px -6px rgba(235,91,25,.5); }
.btn--secondary { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 1px 0 rgba(255,255,255,.08); }
.btn--secondary .ib { background: var(--surface-2); }
.btn--secondary:hover { background: var(--surface-2); }
.btn--secondary:hover .ib { background: #222; }
.btn .ri { transition: transform .2s ease; }
.btn:hover .ri-arrow-right-line { transform: translateX(2px); }

/* small boxed icon/text button */
.box-btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 2px; background: transparent; color: var(--text); border: 1px solid var(--line-strong); font: 500 12px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; text-decoration: none; cursor: pointer; transition: border-color .2s, background-color .2s; }
.box-btn:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.box-btn .ri { width: 16px; height: 16px; }

/* tags */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 2px; font: 400 11px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
html[lang^="zh"] .tag { letter-spacing: .04em; font-size: 12px; }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 50; background: rgba(6,6,6,.82); backdrop-filter: saturate(1.2) blur(14px); -webkit-backdrop-filter: saturate(1.2) blur(14px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.nav-in { height: var(--nav-h); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.logo { display: inline-flex; width: 58px; color: var(--text); text-decoration: none; justify-self: start; }
.logo svg { width: 100%; height: auto; }
.nav-links { display: flex; gap: 10px; }
.navbox { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--accent-line); border-radius: 2px; font: 500 12px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-decoration: none; background: transparent; cursor: pointer; transition: color .2s, background-color .2s, border-color .2s; }
html[lang^="zh"] .navbox { letter-spacing: .06em; font-size: 13px; }
.navbox:hover { color: var(--text); border-color: var(--accent); }
.navbox[aria-current="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.navbox .ri { width: 14px; height: 14px; }
.nav-right { justify-self: end; display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 7px 12px; font: 500 12px/1 var(--font-mono); letter-spacing: .08em; cursor: pointer; }
.seg button[data-lang^="zh"] { font-family: var(--font-sans); letter-spacing: 0; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--on-accent); }
.menu-btn { display: none; }
.menu-btn .ri { width: 15px; height: 15px; }
.menu-btn .ri-close-line { display: none; }

/* mobile menu: full-screen list of boxed links */
.menu-panel { display: none; }
@media (max-width: 860px) {
  .nav-in { grid-template-columns: auto 1fr; }
  .nav-links { display: none; }
  .menu-btn { display: inline-flex; padding: 7px 12px; }
  .logo { width: 50px; }
  .nav.open { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .nav.open .menu-btn { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
  .nav.open .menu-btn .ri-menu-line { display: none; }
  .nav.open .menu-btn .ri-close-line { display: inline; }
  .menu-panel { position: fixed; inset: calc(var(--nav-h) + env(safe-area-inset-top, 0px)) 0 0; background: var(--bg); padding: 28px max(var(--pad-x), env(safe-area-inset-left)) calc(32px + env(safe-area-inset-bottom)); flex-direction: column; gap: 10px; overflow-y: auto; }
  .nav.open .menu-panel { display: flex; }
  .menu-panel .navbox { justify-content: space-between; padding: 20px 18px; font-size: 18px; color: var(--text); }
  html[lang^="zh"] .menu-panel .navbox { font-size: 19px; }
  .menu-panel .navbox small { font-size: 11px; color: var(--dim); letter-spacing: .08em; }
  .menu-panel .menu-foot { margin-top: auto; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
  .menu-panel .menu-foot a { font-size: 20px; font-weight: 500; text-decoration: none; letter-spacing: -.01em; }
  body.menu-open { overflow: hidden; }
}

/* ---------- footer: logo + line on the left, copyright on the right ---------- */
.foot { border-top: 1px solid var(--line); padding-block: 56px 48px; }
.foot-in { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.foot-brand { display: flex; flex-direction: column; gap: 16px; }
.foot-brand .logo { width: 64px; }
.foot-brand p { font-size: 14px; color: var(--muted); }
.foot-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.foot-copy { font: 400 12px/1.5 var(--font-mono); letter-spacing: .04em; color: var(--dim); }
.foot-font { font: 400 11px/1.5 var(--font-mono); letter-spacing: .04em; color: var(--dim); opacity: .7; }
@media (max-width: 720px) { .foot { padding-block: 40px 32px; } .foot-brand .logo { width: 54px; } }

/* reveal on scroll (content stays visible without JS) */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
  .js .reveal.in { opacity: 1; transform: none; }
}
