/* ──────────────────────────────────────────────────────────────
   Hongyu Shen — personal site redesign
   Editorial × engineering-minimal. Apple-grade quiet.
   ────────────────────────────────────────────────────────────── */

:root {
  /* Type */
  --font-serif: "Newsreader", "Iowan Old Style", "Georgia", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Warm neutrals */
  --bg: oklch(0.985 0.003 80);
  --bg-elev: oklch(0.975 0.003 80);
  --fg: oklch(0.18 0.005 80);
  --fg-muted: oklch(0.45 0.005 80);
  --fg-faint: oklch(0.62 0.005 80);
  --rule: oklch(0.9 0.004 80);
  --rule-strong: oklch(0.82 0.004 80);

  /* One accent — soft terracotta */
  --accent: oklch(0.58 0.13 35);
  --accent-soft: oklch(0.58 0.13 35 / 0.12);

  /* Geometry */
  --measure: 680px;
  --gutter: clamp(20px, 5vw, 48px);

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="dark"] {
  --bg: oklch(0.16 0.005 80);
  --bg-elev: oklch(0.2 0.005 80);
  --fg: oklch(0.95 0.004 80);
  --fg-muted: oklch(0.7 0.004 80);
  --fg-faint: oklch(0.5 0.004 80);
  --rule: oklch(0.28 0.005 80);
  --rule-strong: oklch(0.4 0.005 80);
  --accent: oklch(0.72 0.12 40);
  --accent-soft: oklch(0.72 0.12 40 / 0.18);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(0.16 0.005 80);
    --bg-elev: oklch(0.2 0.005 80);
    --fg: oklch(0.95 0.004 80);
    --fg-muted: oklch(0.7 0.004 80);
    --fg-faint: oklch(0.5 0.004 80);
    --rule: oklch(0.28 0.005 80);
    --rule-strong: oklch(0.4 0.005 80);
    --accent: oklch(0.72 0.12 40);
    --accent-soft: oklch(0.72 0.12 40 / 0.18);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition:
    background 0.3s var(--ease),
    color 0.3s var(--ease);
}

::selection {
  background: var(--accent-soft);
  color: var(--fg);
}

a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  transition: all 0.2s var(--ease);
}
a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Layout shell ───────────────────────────────────────────── */
.site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site__main {
  flex: 1;
  max-width: var(--measure);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter) 120px;
}

/* ── Header ─────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--rule);
}
.nav__inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav__brand {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav__brand .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.nav__links {
  display: flex;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__links a {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg-muted);
  border: none;
  text-transform: lowercase;
  letter-spacing: 0.01em;
  position: relative;
  padding: 4px 2px;
}
.nav__links a:hover {
  color: var(--fg);
}
.nav__links a.is-active {
  color: var(--fg);
}
.nav__links a.is-active::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: -15px;
  height: 1.5px;
  background: var(--accent);
}
.nav__theme {
  background: none;
  border: 1px solid var(--rule-strong);
  border-radius: 99px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--fg-muted);
  transition: all 0.2s var(--ease);
  padding: 0;
}
.nav__theme:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
}

/* ── Eyebrow / metadata ─────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-faint);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
  display: inline-block;
}

.meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
  letter-spacing: 0.01em;
}

/* ── Type ───────────────────────────────────────────────────── */
h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--fg);
  text-wrap: balance;
}
h1 {
  font-size: clamp(38px, 6vw, 56px);
  line-height: 1.05;
  margin: 0 0 24px;
  font-weight: 350;
}
h2 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 16px;
}
h3 {
  font-size: 20px;
  line-height: 1.3;
  margin: 0 0 8px;
}
p {
  margin: 0 0 1.1em;
  text-wrap: pretty;
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  padding: 96px 0 64px;
  border-bottom: 1px solid var(--rule);
}
.hero__lede {
  font-family: var(--font-serif);
  font-size: clamp(22px, 3vw, 26px);
  line-height: 1.45;
  font-weight: 350;
  color: var(--fg-muted);
  max-width: 36ch;
  margin: 0 0 32px;
}
.hero__lede em {
  font-style: italic;
  color: var(--fg);
}
.hero__row {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-top: 40px;
  flex-wrap: wrap;
}
.hero__avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
}
.hero__avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.hero__bio {
  flex: 1;
  min-width: 240px;
}
.hero__name {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 4px;
  letter-spacing: -0.005em;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}
.hero__alias {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--fg-faint);
  font-weight: 400;
  margin-left: 8px;
  text-transform: lowercase;
}
.hero__alias-sep {
  margin-right: 6px;
  opacity: 0.55;
}
.hero__role {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg-faint);
  margin: 0 0 14px;
}
.hero__links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
}
.hero__links a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  border: none;
  text-transform: lowercase;
}
.hero__links a:hover {
  color: var(--accent);
}
.hero__links span {
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ── Section ────────────────────────────────────────────────── */
section.block {
  padding: 64px 0;
  border-bottom: 1px solid var(--rule);
}
section.block:last-of-type {
  border-bottom: none;
}
.block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.block__head h2 {
  margin: 0;
}
.block__head a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  border: none;
}
.block__head a:hover {
  color: var(--accent);
}
.block__head a::after {
  content: " →";
  display: inline-block;
  transition: transform 0.2s var(--ease);
}
.block__head a:hover::after {
  transform: translateX(2px);
}

/* ── News / changelog feed ──────────────────────────────────── */
.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.feed__item {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 24px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}
.feed__item:last-child {
  border-bottom: 1px solid var(--rule);
}
.feed__date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-faint);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.feed__body {
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg);
}
.feed__body a {
  color: var(--fg);
  border-bottom-color: var(--rule-strong);
}
.feed__body a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.feed__tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: 3px;
  margin-right: 8px;
  vertical-align: 2px;
}

/* ── Post list ──────────────────────────────────────────────── */
.posts {
  list-style: none;
  margin: 0;
  padding: 0;
}
.posts__item {
  padding: 24px 0;
  border-top: 1px solid var(--rule);
  display: block;
  border-bottom: none;
  color: inherit;
  transition: padding 0.25s var(--ease);
}
.posts__item:hover {
  padding-left: 8px;
}
.posts__item:last-child {
  border-bottom: 1px solid var(--rule);
}
.posts__item .meta {
  display: block;
  margin-bottom: 6px;
}
.posts__item h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  margin: 0 0 6px;
  line-height: 1.25;
}
.posts__item p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 15px;
  line-height: 1.5;
}

/* ── Pubs ───────────────────────────────────────────────────── */
.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pub {
  padding: 22px 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 24px;
  align-items: start;
}
.pub:last-child {
  border-bottom: 1px solid var(--rule);
}
.pub__year {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
  padding-top: 4px;
}
.pub__title {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.35;
  margin: 0 0 4px;
  font-weight: 400;
  color: var(--fg);
}
.pub__authors {
  font-size: 13.5px;
  color: var(--fg-muted);
  margin: 0 0 8px;
  line-height: 1.5;
}
.pub__authors b {
  color: var(--fg);
  font-weight: 500;
}
.pub__venue {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pub__links {
  display: inline-flex;
  gap: 12px;
  margin-left: 8px;
}
.pub__links a {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  border: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pub__links a:hover {
  color: var(--accent);
}

/* ── Project cards ──────────────────────────────────────────── */
.proj-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 640px) {
  .proj-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.proj {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 20px;
  background: var(--bg);
  transition: all 0.25s var(--ease);
  display: flex;
  flex-direction: column;
  color: inherit;
  border-bottom: 1px solid var(--rule);
}
.proj:hover {
  border-color: var(--rule-strong);
  transform: translateY(-2px);
  color: inherit;
}
.proj__thumb {
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
  position: relative;
  background: var(--bg-elev);
}
.proj__thumb svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.proj__thumb .ph-label {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.proj h3 {
  font-size: 17px;
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-weight: 400;
}
.proj p {
  font-size: 13.5px;
  color: var(--fg-muted);
  margin: 0 0 12px;
  line-height: 1.5;
}
.proj__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}
.proj__tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-faint);
  text-transform: lowercase;
  border: 1px solid var(--rule);
  padding: 2px 6px;
  border-radius: 99px;
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--rule);
  padding: 40px var(--gutter);
  max-width: var(--measure);
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-faint);
}
.footer a {
  color: var(--fg-muted);
  border: none;
}
.footer a:hover {
  color: var(--accent);
}
.footer__cmd {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.footer__kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid var(--rule-strong);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--fg-muted);
}

/* ── Long-form post body ────────────────────────────────────── */
.post-body {
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.7;
  color: var(--fg);
}
.post-body p {
  margin: 0 0 1.2em;
}
.post-body h2 {
  font-size: 24px;
  margin-top: 2em;
  margin-bottom: 0.4em;
}
.post-body h3 {
  font-size: 19px;
  margin-top: 1.6em;
  font-weight: 500;
}
.post-body blockquote {
  margin: 1.4em 0;
  padding-left: 22px;
  border-left: 2px solid var(--accent);
  color: var(--fg-muted);
  font-style: italic;
}
.post-body pre,
.post-body code {
  font-family: var(--font-mono);
  font-size: 14px;
}
.post-body pre {
  background: var(--bg-elev);
  padding: 16px 20px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  line-height: 1.55;
}
.post-body code {
  background: var(--bg-elev);
  padding: 2px 6px;
  border-radius: 4px;
}
.post-body pre code {
  background: transparent;
  padding: 0;
}
.post-body ul,
.post-body ol {
  padding-left: 24px;
  margin: 0 0 1.2em;
}
.post-body ul li,
.post-body ol li {
  margin-bottom: 0.4em;
}

/* ── Reveal animation ───────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ── Interests (home) ──────────────────────────────────────── */
.interests {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.interests__item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 20px;
  align-items: baseline;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
}
.interests__item:last-child {
  border-bottom: 1px solid var(--rule);
}
.interests__num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-faint);
  letter-spacing: 0.04em;
  padding-top: 5px;
}
.interests__title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 400;
  line-height: 1.3;
  margin: 0 0 4px;
  color: var(--fg);
  letter-spacing: -0.005em;
}
.interests__body {
  font-size: 14.5px;
  color: var(--fg-muted);
  line-height: 1.55;
  margin: 0;
  max-width: 60ch;
}
.interests__foot {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg-faint);
  margin: 18px 0 0;
}
.interests__foot a {
  color: var(--fg-muted);
  border: none;
}
.interests__foot a:hover {
  color: var(--accent);
}

/* ── Now-reading inline strip ───────────────────────────────── */
.now {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
  border-top: 1px dashed var(--rule);
  border-bottom: 1px dashed var(--rule);
  padding: 14px 0;
  margin: 32px 0 0;
}
.now span b {
  color: var(--fg-muted);
  font-weight: 500;
}
.now__dot {
  color: var(--accent);
}

/* ── Big featured post (lede) ───────────────────────────────── */
.lede-post {
  display: block;
  border: none;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  color: inherit;
}
.lede-post .meta {
  margin-bottom: 8px;
}
.lede-post h3 {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 350;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  line-height: 1.15;
}
.lede-post p {
  color: var(--fg-muted);
  font-size: 15.5px;
  margin: 0;
  line-height: 1.55;
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .nav__inner {
    padding: 12px var(--gutter);
  }
  .nav__links {
    gap: 16px;
  }
  .hero {
    padding: 64px 0 48px;
  }
  .feed__item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
