/* nixiong.net - design system. Structured, restrained, precise, calm. */

:root {
  --paper: #FCFBF9;
  --paper-2: #F7F5F1;
  --ink: #16191D;
  --ink-2: #3A424A;
  --muted: #6E767E;
  --faint: #9AA1A8;
  --rule: #E4E0D9;
  --rule-strong: #CFC9BF;
  --accent: #1E5B52;
  --accent-ink: #143F39;
  --accent-soft: #EAF1EF;
  --warn: #7A5200;
  --warn-soft: #FBF3E2;
  --max: 1120px;
  --measure: 68ch;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --cjk-sans: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Source Han Sans SC', sans-serif;
  --cjk-serif: 'Songti SC', 'SimSun', 'Noto Serif CJK SC', 'Source Han Serif SC', serif;
  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: 1.1875rem;
  --step-2: clamp(1.35rem, 1.2rem + 0.6vw, 1.6rem);
  --step-3: clamp(1.6rem, 1.3rem + 1.4vw, 2.15rem);
  --step-4: clamp(2.1rem, 1.5rem + 2.6vw, 3.35rem);
  --section-y: clamp(3rem, 7vw, 5.5rem);
  --gap: clamp(1rem, 3vw, 2rem);
  --radius: 3px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root:lang(zh), [lang='zh-Hans'] body { font-family: var(--cjk-sans); line-height: 1.85; }
:root:lang(zh) h1, :root:lang(zh) h2, :root:lang(zh) h3 { font-family: var(--cjk-serif); }
:root:lang(zh) .eyebrow, :root:lang(zh) .chip { letter-spacing: 0; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.011em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { margin: 0 0 1em; max-width: var(--measure); }
p.lede { font-size: var(--step-1); color: var(--ink-2); }
p.small, .small { font-size: var(--step--1); }

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-ink); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

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

.shell { max-width: var(--max); margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 2.5rem); }
.shell-narrow { max-width: 780px; }

/* ---------- skip link ---------- */
.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; z-index: 50; }
.skip:focus { left: 0; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(252, 251, 249, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 60px; }
.wordmark { font-family: var(--serif); font-size: 1.0625rem; letter-spacing: 0.005em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.wordmark:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.25em; }
.nav { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 1.9rem); }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 0.9375rem; }
.nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.25em; }
.nav a[aria-current='page'] { color: var(--ink); }
.nav a[aria-current='page']::after { content: ''; display: block; height: 2px; background: var(--accent); margin-top: 3px; }
.lang { font-size: 0.8125rem; color: var(--muted); letter-spacing: 0.02em; }
.lang a, .lang span[aria-current] { color: var(--muted); text-decoration: none; }
.lang .sep { padding: 0 0.35rem; color: var(--rule-strong); }
.menu-toggle { display: none; background: none; border: 1px solid var(--rule-strong); border-radius: var(--radius); font: inherit; font-size: 0.875rem; padding: 0.35rem 0.7rem; color: var(--ink-2); cursor: pointer; }
.text-button { background: none; border: 1px solid var(--rule-strong); border-radius: var(--radius); font: inherit; font-size: 0.8125rem; padding: 0.35rem 0.75rem; color: var(--ink-2); cursor: pointer; }
.text-button:hover { border-color: var(--ink-2); color: var(--ink); }

/* ---------- sections ---------- */
.section { padding-block: var(--section-y); border-top: 1px solid var(--rule); }
.section:first-of-type { border-top: 0; }
.section-label { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: clamp(1.25rem, 3vw, 2rem); }
.eyebrow { font-family: var(--sans); font-size: 0.6875rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
:root:lang(zh) .eyebrow { text-transform: none; letter-spacing: 0.08em; }
.section-label .rule { flex: 1; border-top: 1px solid var(--rule); transform: translateY(-3px); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(3.5rem, 9vw, 6.5rem) var(--section-y); }
.hero h1 { margin-bottom: 0.35em; }
.hero .kicker { font-family: var(--mono); font-size: 0.8125rem; color: var(--accent); letter-spacing: 0.02em; margin-bottom: 1.25rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 1.75rem; }
.hero-actions a { font-size: 0.9375rem; }

/* ---------- now ---------- */
.now { max-width: 720px; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.now dl { display: grid; grid-template-columns: minmax(9rem, 0.28fr) 1fr; gap: 0.5rem 2rem; margin: 0; }
.now dt { color: var(--muted); font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase; padding-top: 0.15rem; }
.now dd { margin: 0; color: var(--ink-2); }
.now-updated { font-size: 0.8125rem; color: var(--faint); margin: 0.9rem 0 0; }

/* ---------- grids ---------- */
.grid { display: grid; gap: var(--gap); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 1rem; }

/* ---------- cards ---------- */
.card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); padding: clamp(1rem, 2.2vw, 1.35rem); display: flex; flex-direction: column; gap: 0.75rem; }
.card h3 { margin: 0; font-size: var(--step-1); }
.card p { margin: 0; font-size: 0.9375rem; color: var(--ink-2); }
.card .meta { font-size: 0.8125rem; color: var(--muted); margin-top: auto; }
.card .artifact { border: 1px solid var(--rule); border-radius: var(--radius); aspect-ratio: 4 / 3; display: grid; place-items: center; color: var(--faint); font-size: 0.75rem; background: var(--paper-2); }
.card a.title-link { color: inherit; text-decoration: none; }
.card a.title-link:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* ---------- capability groups ---------- */
.caps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.cap { border-top: 2px solid var(--ink); padding-top: 1rem; }
.cap h3 { font-size: var(--step-1); margin-bottom: 0.5rem; }
.cap ul { list-style: none; margin: 0; padding: 0; font-size: 0.9375rem; color: var(--ink-2); }
.cap li { padding: 0.3rem 0; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; }
.cap li:last-child { border-bottom: 0; }
.cap .ev { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }

/* ---------- work rows ---------- */
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 132px 1fr auto; gap: clamp(1rem, 3vw, 1.75rem); padding: clamp(1.1rem, 2.4vw, 1.5rem) 0; border-top: 1px solid var(--rule); align-items: start; }
.row:last-child { border-bottom: 1px solid var(--rule); }
.row-noart { grid-template-columns: 1fr auto; }
.row .go .chip { white-space: nowrap; }
.row .thumb { border: 1px solid var(--rule); border-radius: var(--radius); aspect-ratio: 4 / 3; display: grid; place-items: center; color: var(--faint); font-size: 0.6875rem; background: var(--paper-2); }
.row h3 { margin: 0 0 0.35rem; font-size: var(--step-1); }
.row .evidence { font-size: 0.9375rem; color: var(--ink-2); margin: 0 0 0.5rem; }
.row .meta { font-size: 0.8125rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.row .go { font-size: 0.875rem; white-space: nowrap; }

/* ---------- timeline ---------- */
.timeline { position: relative; margin: clamp(1.5rem, 4vw, 2.5rem) 0; }
.timeline-line { position: absolute; left: 0; right: 0; top: 7px; height: 1px; background: var(--rule-strong); }
.timeline-nodes { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.5rem; position: relative; }
.tnode { text-align: left; }
.tnode .dot { width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--rule-strong); background: var(--paper); margin-bottom: 0.75rem; }
.tnode.is-now .dot, .tnode.is-expanded .dot { border-color: var(--accent); background: var(--accent); }
.tnode.is-aggregate .dot { border-style: dashed; }
.tnode .tlabel { font-size: 0.875rem; color: var(--ink-2); display: block; max-width: 12ch; }
.tnode .twhen { font-size: 0.75rem; color: var(--faint); display: block; margin-top: 0.15rem; }
.timeline-more { font-size: 0.8125rem; color: var(--muted); margin-top: 0.75rem; }

.timeline-vertical { display: none; }

/* ---------- era blocks ---------- */
.era { border-top: 1px solid var(--rule); padding-top: clamp(1.25rem, 3vw, 2rem); margin-top: clamp(1.5rem, 3vw, 2.25rem); }
.era-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.era-head h3 { margin: 0; }
.era-when { font-size: 0.8125rem; color: var(--muted); }
.era-fields { display: grid; grid-template-columns: 11rem 1fr; gap: 0.35rem 2rem; }
.era-fields dt { font-size: 0.8125rem; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; padding-top: 0.25rem; }
.era-fields dd { margin: 0; color: var(--ink-2); max-width: var(--measure); }

/* ---------- beyond work tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.2rem; background: var(--paper); }
.tile h3 { font-size: 1rem; margin: 0 0 0.35rem; font-family: var(--sans); }
.tile p { margin: 0; font-size: 0.875rem; color: var(--muted); }
.feature { border: 1px solid var(--rule); border-radius: var(--radius); padding: clamp(1.25rem, 3vw, 2rem); background: var(--paper-2); margin-top: var(--gap); }
.feature .stamp-figure { margin-top: 1.25rem; border: 1px dashed var(--rule-strong); border-radius: var(--radius); min-height: 160px; display: grid; place-items: center; color: var(--faint); font-size: 0.8125rem; }

/* ---------- case study ---------- */
.case-head { padding-block: clamp(2.25rem, 6vw, 3.5rem) clamp(1.5rem, 3vw, 2rem); }
.meta-line { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.875rem; color: var(--muted); }
.snapshot { border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper-2); padding: clamp(1.1rem, 2.6vw, 1.6rem); margin: clamp(1.25rem, 3vw, 2rem) 0; }
.snapshot h2 { font-size: 0.75rem; font-family: var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; }
.snapshot dl { display: grid; grid-template-columns: 9rem 1fr; gap: 0.45rem 1.5rem; margin: 0; }
.snapshot dt { font-size: 0.8125rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding-top: 0.2rem; }
.snapshot dd { margin: 0; color: var(--ink-2); }
.cs-section { padding-block: clamp(1.5rem, 4vw, 2.5rem); border-top: 1px solid var(--rule); }
.cs-section h2 { font-size: var(--step-2); }
.figure { border: 1px dashed var(--rule-strong); border-radius: var(--radius); min-height: 200px; display: grid; place-items: center; color: var(--faint); font-size: 0.8125rem; margin: 1.25rem 0 0.5rem; background: var(--paper-2); }
.figure-caption { font-size: 0.8125rem; color: var(--muted); }

/* ---------- placeholder state (build artifact, never public) ---------- */
.chip { display: inline-block; font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); border: 1px dashed #D8BE86; border-radius: 2px; padding: 0.12rem 0.42rem; vertical-align: 0.08em; white-space: nowrap; }
:root:lang(zh) .chip { letter-spacing: 0.02em; }
.ph { color: var(--faint); }
.ph-block { border-left: 2px solid #E2CFA4; padding-left: 0.9rem; color: var(--muted); font-style: italic; }

/* ---------- resume utility ---------- */
.utility { border: 1px solid var(--rule); border-radius: var(--radius); padding: clamp(1.25rem, 3vw, 2rem); background: var(--paper-2); max-width: 620px; }
.btn { display: inline-block; font: inherit; font-size: 0.9375rem; padding: 0.6rem 1.1rem; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--ink); color: var(--paper); text-decoration: none; }
.btn:hover { background: var(--ink-2); color: var(--paper); }
.btn[aria-disabled='true'] { background: transparent; color: var(--faint); border-color: var(--rule-strong); border-style: dashed; pointer-events: none; }
.linklist { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: 0.9375rem; padding: 0; margin: 1rem 0 0; list-style: none; }

/* ---------- contact ---------- */
.contact { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.75rem 1.5rem; }
.contact p { margin: 0; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); margin-top: var(--section-y); padding-block: clamp(1.75rem, 4vw, 2.5rem); font-size: 0.875rem; color: var(--muted); }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.footer-links a { color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; text-underline-offset: 0.25em; }
.footer-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--faint); font-size: 0.8125rem; }

/* ---------- motion ---------- */
/* Content is visible by default. Motion is additive only, so a failed or slow script can never blank the page. */
.reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  a, .card, .row, .tile { transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .grid-3, .grid-4, .caps, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 96px 1fr; }
  .row .go { grid-column: 2; }
  .timeline { display: none; }
  .timeline-vertical { display: block; margin: 1.5rem 0 0; padding-left: 0; list-style: none; }
  .timeline-vertical li { position: relative; padding: 0 0 1.1rem 1.5rem; border-left: 1px solid var(--rule-strong); }
  .timeline-vertical li:last-child { border-left-color: transparent; padding-bottom: 0; }
  .timeline-vertical .dot { position: absolute; left: -7px; top: 6px; width: 13px; height: 13px; border-radius: 50%; border: 1px solid var(--rule-strong); background: var(--paper); }
  .timeline-vertical li.is-expanded .dot, .timeline-vertical li.is-now .dot { background: var(--accent); border-color: var(--accent); }
  .timeline-vertical li.is-aggregate .dot { border-style: dashed; }
  .era-fields, .snapshot dl, .now dl { grid-template-columns: 1fr; gap: 0.2rem; }
  .era-fields dt, .snapshot dt, .now dt { margin-top: 0.6rem; }
}

@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4, .caps, .tiles { grid-template-columns: 1fr; }
  .nav { display: none; }
  .nav.is-open { display: flex; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: flex-start; gap: 0.25rem; padding: 1rem clamp(1.25rem, 5vw, 2.5rem) 1.25rem; background: var(--paper); border-bottom: 1px solid var(--rule); }
  .nav.is-open a { padding: 0.4rem 0; font-size: 1rem; }
  .menu-toggle { display: inline-block; }
  .row { grid-template-columns: 1fr; }
  .row .thumb { aspect-ratio: 16 / 9; }
  .row .go { grid-column: 1; }
}

/* ---------- print ---------- */
@media print {
  .site-header, .site-footer, .menu-toggle, .hero-actions, .lang { display: none; }
  body { background: #fff; font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
  .section { border: 0; padding-block: 1rem; }
}
