:root {
  color-scheme: light dark;

  --bg: light-dark(#faf6f2, #0c0b09);
  --bg-alt: light-dark(rgba(242, 236, 228, 0.72), rgba(17, 16, 13, 0.72));
  --surface: light-dark(rgba(255, 253, 249, 0.88), rgba(20, 18, 14, 0.78));
  --surface-hover: light-dark(#ffffff, rgba(28, 24, 18, 0.92));
  --border: light-dark(rgba(45, 49, 54, 0.12), rgba(229, 201, 155, 0.15));
  --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));

  --header-bg: light-dark(rgba(250, 246, 242, 0.82), rgba(12, 11, 9, 0.82));
  --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;
  position: relative;
}

/* Full-page animated canvas behind all sections */
.spider-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

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: 18px;
  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: 18px;
}

.nav-links a {
  color: var(--muted);
  font-size: 13px;
  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-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: 86px 0 82px;
  border-bottom: 1px solid var(--border);
}

.hero-content {
  max-width: 780px;
  text-align: center;
}

.avatar-ring {
  width: 132px;
  height: 132px;
  margin: 0 auto 20px;
  border-radius: 50%;
  overflow: hidden;
  padding: 4px;
  background: linear-gradient(135deg, #f3dfb9, #c59b52);
  box-shadow: 0 0 32px rgba(229, 201, 155, 0.35);
}

.avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.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.1rem;
  color: var(--gold);
}

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

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

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

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

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

.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;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  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;
}

.clean-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}

.clean-list li {
  margin-bottom: 6px;
}

.edu-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

.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: 7px 13px;
  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);
  backdrop-filter: blur(10px);
  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: 740px;
}

.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: center;
  text-align: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Native <dialog> */
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);
  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;
}

.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: 900px) {
  .nav-links {
    display: none;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .timeline-item,
  .edu-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
