/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* ---------- design tokens (light) ---------- */
:root {
  --bg: #f4f4f1;
  --bg-card: #ffffff;
  --text: #111111;
  --text-muted: #666666;
  --text-subtle: #888888;
  --border: #e5e3dd;
  --accent-live: #2ea043;
  --accent-wip: #b08800;
  --accent-hover: #2ea043;

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* ---------- dark theme ---------- */
[data-theme="dark"] {
  --bg: #0f0f0e;
  --bg-card: #1a1a18;
  --text: #e8e6e0;
  --text-muted: #888888;
  --text-subtle: #666666;
  --border: #2a2a26;
  --accent-live: #3fb950;
  --accent-wip: #d4a72c;
  --accent-hover: #3fb950;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f0e;
    --bg-card: #1a1a18;
    --text: #e8e6e0;
    --text-muted: #888888;
    --text-subtle: #666666;
    --border: #2a2a26;
    --accent-live: #3fb950;
    --accent-wip: #d4a72c;
    --accent-hover: #3fb950;
  }
}

/* ---------- base ---------- */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 28px 96px;
}

/* ---------- header ---------- */
.head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 48px;
}
.head-left {
  display: flex;
  gap: 18px;
  align-items: center;
}
.portrait {
  width: 80px;
  height: auto;
  display: block;
  flex-shrink: 0;
  background: #f4f4f1;
  border-radius: 4px;
}
.name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.meta span + span::before { content: " · "; color: var(--border); }
.meta-sub { color: var(--text-subtle); margin-top: 4px; }

.toggle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  transition: border-color 0.15s, color 0.15s;
}
.toggle:hover { border-color: var(--text-muted); color: var(--text); }
.toggle:focus-visible { outline: 2px solid var(--accent-live); outline-offset: 2px; }

/* ---------- section ---------- */
.section { margin-top: 44px; }
.label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin: 0 0 14px;
}
.prose p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  margin: 0 0 12px;
}
.prose p:last-child { margin-bottom: 0; }

/* ---------- story timeline ---------- */
.timeline {
  position: relative;
  margin: 0;
  padding: 0 0 0 24px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
}
.era {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  align-items: baseline;
}
.era-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
  position: relative;
}
.era-head::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--text-muted);
}
.era-year {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}
.era-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-subtle);
}
.era-prose p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  margin: 0 0 12px;
}
.era-prose p:last-child { margin-bottom: 0; }

.coda {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ---------- projects ---------- */
.proj-list { display: flex; flex-direction: column; }
.proj {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.proj:last-child { border-bottom: none; }

.status { font-size: 10px; line-height: 1; }
.status-live { color: var(--accent-live); }
.status-wip { color: var(--accent-wip); }

.proj-link, .proj-link-static { display: block; color: var(--text); }
.proj-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.proj-desc {
  display: block;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.proj-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-subtle);
  white-space: nowrap;
}
.proj-link:hover .proj-name { text-decoration: underline; text-decoration-color: var(--accent-hover); }
.proj-link:focus-visible { outline: 2px solid var(--accent-live); outline-offset: 2px; }

/* ---------- elsewhere links ---------- */
.links { display: flex; flex-direction: column; gap: 10px; }
.links a {
  font-family: var(--font-mono);
  font-size: 13px;
  display: inline-flex;
  gap: 14px;
  align-items: center;
  color: var(--text);
}
.links .arrow { color: var(--text-subtle); }
.links a:hover { color: var(--accent-hover); }
.links a:focus-visible { outline: 2px solid var(--accent-live); outline-offset: 2px; border-radius: 2px; }

/* ---------- footer ---------- */
.footer {
  margin-top: 80px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-subtle);
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

/* ---------- responsive ---------- */
@media (max-width: 480px) {
  .page { padding: 40px 20px 64px; }
  .head { flex-direction: column; }
  .head-left { gap: 14px; }
  .portrait { width: 64px; }
  .toggle { align-self: flex-start; }
  .proj { grid-template-columns: 14px 1fr; }
  .proj-tag { grid-column: 2; padding-top: 4px; }

  .timeline { gap: 28px; }
  .era { grid-template-columns: 1fr; gap: 8px; }
  .era-head { flex-direction: row; gap: 10px; align-items: baseline; padding-top: 0; }
}
