:root {
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: "Plus Jakarta Sans", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f3ee;
  --bg-elevated: rgba(255, 255, 255, 0.76);
  --surface-soft: #ebe5dc;
  --text: #172033;
  --text-soft: #566074;
  --line: rgba(23, 32, 51, 0.12);
  --line-strong: rgba(23, 32, 51, 0.2);
  --accent: #2b6cb0;
  --accent-soft: rgba(43, 108, 176, 0.1);
  --shadow: 0 16px 40px rgba(21, 27, 38, 0.08);
}

html[data-theme="dark"] {
  --bg: #07111f;
  --bg-elevated: rgba(10, 24, 47, 0.74);
  --surface-soft: #0c1a2f;
  --text: #edf3ff;
  --text-soft: #b6c2d8;
  --line: rgba(160, 184, 224, 0.16);
  --line-strong: rgba(160, 184, 224, 0.26);
  --accent: #6ec1ff;
  --accent-soft: rgba(110, 193, 255, 0.12);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: radial-gradient(circle at top right, rgba(74, 144, 226, 0.08), transparent 24%), var(--bg);
  color: var(--text);
  transition: background-color 220ms ease, color 220ms ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.94em;
}
h1, h2, h3, h4, h5, h6, .brand-name { font-family: var(--font-heading); }

.site-shell { min-height: 100vh; }
.container { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.section { padding: 88px 0; }
.section-tight { padding: 52px 0; }
.eyebrow {
  margin: 0 0 14px;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  min-height: 78px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
}
.brand {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}
.brand-name { font-size: 1rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.brand-subtitle { font-size: 0.83rem; color: var(--text-soft); }
.site-nav {
  justify-self: center;
  display: flex;
  gap: 24px;
  color: var(--text-soft);
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }

.theme-toggle {
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 8px;
  cursor: pointer;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-soft);
}
.theme-icon {
  display: none;
}
html[data-theme="light"] .sun-icon {
  display: block;
}
html[data-theme="dark"] .moon-icon {
  display: block;
}
.theme-toggle-track {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  align-items: center;
}
.theme-toggle-label {
  min-width: 52px;
  padding: 8px 10px;
  font-size: 0.78rem;
  text-align: center;
  border-radius: 999px;
  transition: background-color 180ms ease, color 180ms ease;
}
html[data-theme="light"] .theme-light-label,
html[data-theme="dark"] .theme-dark-label {
  background: var(--accent-soft);
  color: var(--accent);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 16px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(250px, 0.85fr);
  gap: 64px;
  align-items: center;
}
.hero-grid-merged { grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.7fr); }
.hero h1,
.page-title {
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.page-title { font-size: clamp(2.3rem, 5vw, 3.8rem); }
.hero-lead {
  margin: 22px 0 0;
  max-width: 14ch;
  font-size: clamp(1.35rem, 2vw, 1.72rem);
  line-height: 1.35;
  color: var(--text);
}
.hero-body,
.text-section p,
.resume-summary,
.timeline-item p,
.contact-list,
.footer-copy,
.editorial-item p {
  font-size: 1.08rem;
  line-height: 1.8;
  color: var(--text-soft);
}
.hero-body { max-width: 62ch; margin: 18px 0 0; }
.hero-actions,
.section-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 32px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}
.button:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.button-primary {
  background: var(--text);
  color: var(--bg);
  border-color: transparent;
}
.button-secondary { background: transparent; color: var(--text); }
.text-link {
  color: var(--accent);
  font-weight: 600;
}
.text-link:hover { text-decoration: underline; }

.hero-portrait-wrap { display: flex; justify-content: flex-end; }
.portrait-frame {
  position: relative;
  max-width: 360px;
  width: 100%;
}
.portrait-frame::before {
  content: "";
  position: absolute;
  inset: -16px 16px 16px -16px;
  border: 1px solid var(--line);
  border-radius: 32px;
}
.portrait-frame img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 28px;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}
.hero-portrait-frame { max-width: 340px; }
.portrait-frame-large { max-width: 420px; }
.portrait-note {
  margin: 18px 0 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-soft);
}

.focus-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
}
.focus-band p,
.inline-grid span,
.contact-list a { color: var(--text-soft); }
.focus-title {
  margin: 0 0 8px;
  font-size: 1.02rem;
  line-height: 1.35;
}

.text-section { max-width: 880px; }
.narrow-text-section { max-width: 720px; }
.section-heading h2,
.resume-block h2,
.editorial-item h2,
.editorial-item h3,
.timeline-item h3 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
}
.split-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}
.section-heading h2 { max-width: 18ch; }
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 64px;
  align-items: start;
}
.page-copy { max-width: 720px; }
.about-page-text-only { max-width: 760px; }
.page-copy p { font-size: 1.08rem; line-height: 1.85; color: var(--text-soft); }

.editorial-list { margin-top: 28px; border-top: 1px solid var(--line); }
.editorial-item {
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.editorial-meta,
.timeline-meta {
  margin-bottom: 10px;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.editorial-item h3,
.editorial-item h2 { margin-bottom: 10px; }
.editorial-item a:hover { color: var(--accent); }

.post-card-grid {
  display: grid;
  gap: 24px;
  margin-top: 28px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.post-card {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 72%, white 28%);
  border-radius: 28px;
  padding: 24px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
html[data-theme="dark"] .post-card {
  background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
}
.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.post-card-category {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.post-card-title {
  margin: 16px 0 0;
  font-size: 1.32rem;
  line-height: 1.45;
  letter-spacing: -0.02em;
}
.post-card-title a:hover { color: var(--accent); }
.post-card-summary {
  margin: 16px 0 0;
  font-size: 0.98rem;
  line-height: 1.75;
  color: var(--text-soft);
}
.post-card-meta {
  margin-top: 20px;
  font-size: 0.92rem;
  color: var(--text-soft);
}

.inline-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 22px;
}
.inline-grid span {
  font-size: 0.98rem;
  line-height: 1.5;
  padding-right: 16px;
  border-right: 1px solid var(--line);
}
.inline-grid span:last-child { border-right: none; padding-right: 0; }

.resume-page,
.writing-page { max-width: 920px; margin: 0 auto; }
.resume-summary { max-width: 72ch; }
.resume-block { margin-top: 44px; }
.timeline-list {
  display: grid;
  gap: 22px;
  margin-top: 22px;
}
.timeline-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 26px;
}
.contact-list a:hover,
.footer-links a:hover { color: var(--accent); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 56px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}
.footer-copy { max-width: 56ch; margin: 0; }
.footer-links {
  display: flex;
  gap: 18px;
  color: var(--text-soft);
}

@media (max-width: 960px) {
  .header-inner,
  .hero-grid,
  .hero-grid-merged,
  .page-grid,
  .timeline-item,
  .footer-inner {
    grid-template-columns: 1fr;
  }
  .header-inner {
    display: grid;
    justify-items: start;
    padding: 18px 0;
  }
  .site-nav { justify-self: start; flex-wrap: wrap; }
  .theme-toggle { justify-self: start; }
  .hero-portrait-wrap { justify-content: flex-start; }
  .focus-band,
  .post-card-grid { grid-template-columns: 1fr; }
  .split-heading { flex-direction: column; align-items: start; }
  .timeline-item { gap: 10px; }
  .footer-links { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .container { width: min(100% - 32px, 1120px); }
  .section { padding: 72px 0; }
  .section-tight { padding: 40px 0; }
  .hero h1,
  .page-title { line-height: 1.02; }
  .post-card {
    border-radius: 22px;
    padding: 20px;
  }
  .portrait-frame::before {
    inset: -10px 10px 10px -10px;
    border-radius: 24px;
  }
  .portrait-frame img { border-radius: 22px; }
  .inline-grid span {
    border-right: none;
    padding-right: 0;
  }
}
