/* ─────────────────────────────────────────────
   Yan Hong — personal site
   Palette: fog ground, ink text, harbor-blue accent
   Type: Bricolage Grotesque / Newsreader / JetBrains Mono
   ───────────────────────────────────────────── */

:root {
  color-scheme: light;

  --bg: #F2F5F9;
  --bg-raised: #FFFFFF;
  --bg-sunken: #E8EDF3;
  --ink: #0F1B2D;
  --ink-2: #33415A;
  --mute: #5B6B80;
  --hair: #D4DCE6;
  --hair-strong: #B9C5D3;
  --accent: #1F6FB2;
  --accent-ink: #164F80;
  --accent-soft: #DCEAF7;
  --focus: #1F6FB2;

  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --rail-w: 340px;
  --gutter: clamp(20px, 4vw, 56px);
  --measure: 64ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B1524;
    --bg-raised: #111E31;
    --bg-sunken: #08101C;
    --ink: #EDF2F8;
    --ink-2: #C3CEDB;
    --mute: #8A9AAF;
    --hair: #223148;
    --hair-strong: #33465F;
    --accent: #5AA9E6;
    --accent-ink: #8EC5F0;
    --accent-soft: #143252;
    --focus: #5AA9E6;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1524;
  --bg-raised: #111E31;
  --bg-sunken: #08101C;
  --ink: #EDF2F8;
  --ink-2: #C3CEDB;
  --mute: #8A9AAF;
  --hair: #223148;
  --hair-strong: #33465F;
  --accent: #5AA9E6;
  --accent-ink: #8EC5F0;
  --accent-soft: #143252;
  --focus: #5AA9E6;
}

/* ── Reset-ish ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-optical-sizing: auto;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--display); font-optical-sizing: auto; margin: 0; text-wrap: balance; }
h2 a, h3 a { color: inherit; text-decoration: none; }
h2 a:hover, h3 a:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
time { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.skip {
  position: absolute; left: 8px; top: -48px;
  background: var(--accent); color: #fff; padding: 8px 12px;
  font-family: var(--display); border-radius: 4px; z-index: 10;
}
.skip:focus { top: 8px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

/* ── Page frame ── */
.page {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ── Rail ── */
.rail {
  border-right: 1px solid var(--hair);
  background: var(--bg-raised);
}
.rail-inner {
  position: sticky;
  top: 0;
  padding: var(--gutter) 28px calc(var(--gutter) * 0.75);
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.portrait {
  margin: 0;
  width: 156px;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 0 var(--hair-strong), 0 12px 32px -18px rgba(15, 27, 45, 0.45);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }

.ident { display: grid; gap: 6px; }
.name {
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
}
.tagline {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1rem;
  color: var(--ink-2);
  line-height: 1.35;
}
.loc {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--mute);
  display: flex; align-items: center; gap: 8px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }

.now {
  margin: 0;
  display: grid;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--hair);
}
.now div { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: baseline; }
.now dt { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.now dd { margin: 0; font-family: var(--display); font-size: 0.92rem; line-height: 1.4; color: var(--ink-2); }

.contact { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid var(--hair-strong);
  color: var(--ink);
  background: var(--bg-raised);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
:root[data-theme="dark"] .btn.primary,
:root[data-theme="dark"] .btn.primary:hover { color: #0B1524; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary,
  :root:not([data-theme="light"]) .btn.primary:hover { color: #0B1524; }
}


/* ── Main ── */
.main {
  padding: var(--gutter) var(--gutter) calc(var(--gutter) * 1.5);
  max-width: 940px;
}

/* Thesis */
.thesis { display: grid; gap: 28px; padding-bottom: 56px; border-bottom: 1px solid var(--hair); }
.thesis-line {
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  max-width: 24ch;
  color: var(--ink);
}
.thesis-line em {
  font-style: normal;
  color: var(--accent);
}
.bio { display: grid; gap: 14px; max-width: var(--measure); font-size: 1.125rem; line-height: 1.6; color: var(--ink-2); }

/* Sections */
.section { padding: 52px 0 0; }
.section-head { display: grid; gap: 10px; margin-bottom: 26px; }
.section-head h2 {
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.lede { color: var(--mute); max-width: var(--measure); font-size: 1.05rem; }

/* Timeline entries */
.entry {
  display: grid;
  grid-template-columns: 1fr;
  padding: 24px 0;
  border-top: 1px solid var(--hair);
}
.entry:last-child { border-bottom: 1px solid var(--hair); }
.entry .body { display: grid; gap: 10px; min-width: 0; }
.entry h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.sep { color: var(--hair-strong); margin: 0 2px; }
.entry .meta { font-family: var(--mono); font-size: 0.75rem; color: var(--mute); margin-top: -4px; }
.entry p, .entry li { color: var(--ink-2); max-width: var(--measure); }
.entry ul { display: grid; gap: 8px; }
.entry ul li { padding-left: 16px; position: relative; }
.entry ul li::before {
  content: ""; position: absolute; left: 0; top: 0.72em;
  width: 6px; height: 1px; background: var(--accent);
}
.also li strong { font-family: var(--display); font-weight: 600; color: var(--ink); }

/* Ventures */
.ventures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--hair);
  border-radius: 8px;
  overflow: hidden;
}
.venture {
  background: var(--bg-raised);
  padding: 22px 24px 24px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.venture h3 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.015em; }
.venture .kind { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink); }
.venture p:not(.kind) { color: var(--ink-2); font-size: 0.98rem; line-height: 1.5; }

/* Awards */
.awards { border-top: 1px solid var(--hair); }
.awards li {
  display: grid;
  grid-template-columns: 1fr;
  padding: 12px 0;
  border-bottom: 1px solid var(--hair);
  align-items: baseline;
}
.awards span { color: var(--ink-2); }

/* Education */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--hair);
}
.edu { display: grid; gap: 6px; align-content: start; }
.edu h3 { font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
.edu p:not(h3) { color: var(--ink-2); font-size: 0.95rem; }

.cred-row { display: grid; gap: 12px; margin-top: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-2);
  padding: 6px 11px;
  border: 1px solid var(--hair-strong);
  border-radius: 999px;
  background: var(--bg-raised);
}

/* In brief */
.facts { margin: 0; border-top: 1px solid var(--hair); }
.facts div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hair);
  align-items: baseline;
}
.facts dt { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.facts dd { margin: 0; color: var(--ink-2); max-width: var(--measure); }
@media (max-width: 820px) { .facts div { grid-template-columns: 1fr; gap: 4px; } }

/* Outro */
.outro {
  margin-top: 64px;
  padding: 36px 36px 30px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: grid;
  gap: 16px;
}
.outro h2 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.015em; max-width: 22ch; }
.outro p { color: var(--ink-2); max-width: var(--measure); }
.outro .contact { margin-top: 4px; }
.outro .btn { background: var(--bg-raised); }
.outro .btn.primary { background: var(--accent); }
.fine { font-family: var(--mono); font-size: 0.72rem; color: var(--mute); margin-top: 10px; }

/* ── Responsive ── */
@media (max-width: 1080px) {
  :root { --rail-w: 300px; }
  .ventures { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .page { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--hair); }
  .rail-inner {
    position: static;
    max-height: none;
    padding: var(--gutter) var(--gutter) 24px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "photo ident"
      "now now"
      "contact contact";
    gap: 20px 22px;
    align-items: center;
  }
  .portrait { grid-area: photo; width: 112px; }
  .ident { grid-area: ident; }
  .now { grid-area: now; }
  .contact { grid-area: contact; }
  .name { font-size: 2rem; }
  .edu-grid { grid-template-columns: 1fr; }
  .outro { padding: 28px 22px 24px; }
}

@media (max-width: 480px) {
  .rail-inner { grid-template-columns: 1fr; grid-template-areas: "photo" "ident" "now" "contact"; }
}
