:root {
  --bg: #090909;
  --ink: #ededed;
  --muted: #a1a1a1;
  --faint: #666666;
  --rule: #1e1e1e;
  --hover: #141414;
  --link-underline: #424242;
  --accent: #ededed;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --serif: 'Newsreader', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="light"] {
  --bg: #f1f1f1;
  --ink: #111111;
  --muted: #5c5c5c;
  --faint: #888888;
  --rule: #dedede;
  --hover: #e7e7e7;
  --link-underline: #b5b5b5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  transition: background 0.2s ease, color 0.2s ease;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 56px 24px 88px;
}

/* Header */
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 64px;
}

.site-name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

nav {
  display: flex;
  gap: 20px;
}

nav a {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

nav a:hover,
nav a.active {
  color: var(--ink);
}

nav a.active {
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 4px;
}

/* Inline prose links */
a.link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

a.link:hover {
  text-decoration-color: var(--ink);
}

/* Intro */
.intro {
  margin-bottom: 56px;
}

.intro p {
  font-size: 16px;
  color: var(--ink);
  line-height: 1.72;
  margin-bottom: 16px;
}

.intro p:last-child {
  margin-bottom: 0;
}

.intro em {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17.5px;
  font-weight: 400;
}

.intro .quiet {
  color: var(--muted);
}

/* Sections */
section {
  margin-bottom: 54px;
}

section:last-of-type {
  margin-bottom: 0;
}

h1 {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

h2 {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 18px;
  letter-spacing: -0.005em;
}

/* Active work grid */
.now-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.now-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--ink);
  opacity: 0.9;
}

.mark.subtle {
  color: var(--ink);
  opacity: 0.72;
}

.mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.now-item a.item-title {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}

.now-item a.item-title:hover {
  text-decoration-color: var(--ink);
}

.now-item p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.58;
}

/* Background note on homepage */
.bg-note {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
}

/* Expandable pure-HTML archive rows (projects.html) */
.archive-list {
  border-top: 1px solid var(--rule);
}

.archive-item {
  border-bottom: 1px solid var(--rule);
}

.archive-summary {
  width: 100%;
  padding: 14px 4px;
  display: grid;
  grid-template-columns: 204px 1fr 16px;
  gap: 16px;
  align-items: center;
  cursor: pointer;
  color: inherit;
  list-style: none;
  transition: background 0.12s ease;
}

.archive-summary::-webkit-details-marker {
  display: none;
}

.archive-item:not([open]) .archive-summary:hover {
  background: var(--hover);
}

.ar-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ar-one {
  font-size: 14.5px;
  color: var(--muted);
}

.ar-plus {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  text-align: right;
  transition: transform 0.18s ease, color 0.15s ease;
}

.archive-item[open] .ar-plus {
  transform: rotate(45deg);
  color: var(--ink);
}

.archive-detail {
  padding: 2px 24px 18px 224px;
}

.archive-detail p {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.66;
  margin-bottom: 10px;
}

.archive-detail p:last-child {
  margin-bottom: 0;
}

.archive-detail .ar-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  margin-top: 8px;
}

/* Prose (about.html) */
.prose p {
  font-size: 15.5px;
  color: var(--ink);
  line-height: 1.75;
  margin-bottom: 18px;
}

.prose p.muted {
  color: var(--muted);
}

.prose h2 {
  margin-top: 38px;
  margin-bottom: 14px;
  font-size: 15px;
  color: var(--ink);
}

/* Footer */
footer {
  margin-top: 80px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.footer-left,
.footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

footer a:hover {
  color: var(--ink);
}

.theme-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.theme-link:hover {
  color: var(--ink);
}

@media (max-width: 640px) {
  .page { padding: 36px 20px 64px; }
  header { margin-bottom: 44px; }
  .now-grid { grid-template-columns: 1fr; gap: 22px; }
  .archive-summary { grid-template-columns: 1fr 16px; gap: 4px 10px; }
  .ar-one { grid-column: 1 / 2; font-size: 13.5px; }
  .ar-plus { grid-row: 1; grid-column: 2; }
  .archive-detail { padding: 4px 8px 16px 4px; }
}
