:root {
  color-scheme: light dark;

  /* Starlight Gold + Espresso Dark palette using light-dark() */
  --bg: light-dark(#faf6f2, #0c0b09);
  --bg-alt: light-dark(#f2ece4, #11100d);
  --surface: light-dark(#fffdf9, rgba(250, 246, 242, 0.035));
  --surface-hover: light-dark(#ffffff, rgba(250, 246, 242, 0.06));
  --border: light-dark(rgba(45, 49, 54, 0.12), rgba(229, 201, 155, 0.14));
  --text: light-dark(#1f1d1a, #faf6f2);
  --muted: light-dark(#645e55, #b2aca2);

  --gold: light-dark(#9a6f28, #e5c99b);
  --gold-strong: light-dark(#825b1c, #f3dfb9);
  --gold-soft: light-dark(rgba(197, 155, 82, 0.14), rgba(212, 175, 106, 0.14));
  --gold-border: light-dark(rgba(154, 111, 40, 0.35), rgba(229, 201, 155, 0.38));
  --gold-btn-text: light-dark(#ffffff, #19140b);

  --header-bg: light-dark(rgba(250, 246, 242, 0.82), rgba(12, 11, 9, 0.78));
  --shadow: light-dark(0 10px 30px rgba(31, 29, 26, 0.07), 0 14px 36px rgba(0, 0, 0, 0.45));
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  color-scheme: dark;
}

:root:has(> head > meta[name="color-scheme"][content="light"]) {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.brand:hover {
  text-decoration: none;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f3dfb9, #c59b52);
  box-shadow: 0 0 12px rgba(229, 201, 155, 0.65);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links a {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 2px;
  transition: color 0.16s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--gold);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
  padding: 11px 20px;
}

.btn:hover,
.icon-btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-gold {
  background: linear-gradient(135deg, #f3dfb9, #c59b52);
  color: #19140b;
  box-shadow: 0 6px 22px rgba(197, 155, 82, 0.28);
}

.btn-gold:hover {
  filter: brightness(1.06);
}

.btn-gold-sm {
  background: linear-gradient(135deg, #f3dfb9, #c59b52);
  color: #19140b;
  padding: 8px 14px;
  font-size: 12.5px;
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--gold-border);
}

.btn-outline-sm {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 14px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-ghost {
  background: var(--gold-soft);
  color: var(--gold-strong);
  border-color: var(--gold-border);
}

.icon-btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  padding: 8px 12px;
  font-size: 12.5px;
}

/* Hero */
.hero {
  position: relative;
  min-height: 560px;
  display: flex;
  align-items: center;
  padding: 96px 0 88px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.spider-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, transparent 25%, var(--bg) 92%);
}

.motion-btn {
  position: absolute;
  right: 24px;
  bottom: 20px;
  z-index: 5;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11.5px;
  cursor: pointer;
}

.motion-btn:hover {
  color: var(--text);
  border-color: var(--gold-border);
}

.hero-content {
  position: relative;
  z-index: 3;
  max-width: 780px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  color: var(--gold-strong);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.whoami {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.subtitle {
  margin: 14px 0 0;
  font-size: 1.12rem;
  color: var(--gold);
}

.lead {
  margin: 18px auto 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.7;
}

.hero-cta {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* Sections */
.section {
  padding: 84px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-head {
  margin-bottom: 36px;
}

.section-kicker {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.section-head h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-desc {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14.5px;
  max-width: 640px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.card:hover {
  border-color: var(--gold-border);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.card h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 700;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.card-tag,
.badge-gold {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold-strong);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.project-top .badge-gold {
  margin-bottom: 0;
}

.project-top a {
  font-size: 12.5px;
  font-weight: 600;
}

.tags,
.pill-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tags span {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--gold);
}

.pill-wrap span {
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timeline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
}

.timeline-item h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.year {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
}

/* Contact */
.contact-box {
  text-align: center;
  max-width: 720px;
}

.contact-box .section-desc {
  margin: 10px auto 26px;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.copy-status {
  margin: 12px 0 0;
  min-height: 20px;
  font-size: 12.5px;
  color: var(--gold);
}

/* Footer */
.site-footer {
  padding: 26px 0;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Native <dialog> per modern-web-guidance */
dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 500px;
  width: calc(100% - 32px);
  color: var(--text);
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-card {
  background: var(--bg-alt);
  border: 1px solid var(--gold-border);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 19px;
}

.dialog-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
}

.dialog-body {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13.5px;
}

.dialog-actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

/* Reduced motion & reveal */
.reveal {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.45s ease, transform 0.45s ease;
  }
  .reveal.visible {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .nav-links {
    display: none;
  }
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .timeline-item {
    flex-direction: column;
    align-items: flex-start;
  }
}
