:root {
  color-scheme: dark;
  --bg: #101211;
  --surface: #171918;
  --text: #f2f3ef;
  --muted: #a6aaa5;
  --line: #303330;
  --accent: #8fb4ff;
  --accent-text: #0d1729;
  --header: rgba(16, 18, 17, 0.9);
  --page: min(1040px, calc(100vw - 3rem));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f6f2;
  --surface: #ecece7;
  --text: #171916;
  --muted: #626660;
  --line: #d2d4cf;
  --accent: #315fd6;
  --accent-text: #ffffff;
  --header: rgba(246, 246, 242, 0.9);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.65;
  transition: background-color 160ms ease, color 160ms ease;
}
a { color: inherit; }
button { font: inherit; }
::selection { background: var(--accent); color: var(--accent-text); }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.8rem;
  left: 0.8rem;
  padding: 0.6rem 0.85rem;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: var(--header);
  backdrop-filter: blur(14px);
}
.nav-shell {
  width: var(--page);
  min-height: 4.25rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.brand {
  font-size: 1.05rem;
  font-weight: 760;
  letter-spacing: -0.025em;
  text-decoration: none;
}
.brand span { color: var(--accent); }
.site-header nav { display: flex; align-items: center; gap: 1.5rem; }
.site-header nav > a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}
.site-header nav > a:hover { color: var(--text); }
.theme-toggle {
  min-height: 2.2rem;
  padding: 0.35rem 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--muted); }

main { width: var(--page); margin: 0 auto; }
.hero {
  min-height: calc(82svh - 4.25rem);
  padding: clamp(6rem, 15vw, 11rem) 0 clamp(5rem, 10vw, 8rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}
.eyebrow, .section-label {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font: 650 0.78rem/1.3 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.eyebrow span {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
}
.hero h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(3.6rem, 8vw, 6.7rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}
.hero-copy {
  max-width: 42rem;
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: clamp(1.12rem, 2vw, 1.35rem);
  line-height: 1.55;
}
.hero-links { margin-top: 2.25rem; display: flex; align-items: center; gap: 1.4rem; }
.hero-links a { font-weight: 650; text-underline-offset: 0.3em; }
.primary-link {
  display: inline-flex;
  min-height: 2.85rem;
  padding: 0.55rem 0.9rem;
  align-items: center;
  border-radius: 0.35rem;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  text-decoration: none;
}
.primary-link:hover { filter: brightness(1.06); }

.section { padding: clamp(5rem, 11vw, 8rem) 0; border-bottom: 1px solid var(--line); }
.section-heading { margin-bottom: 3.25rem; }
.section-heading h2, .two-column h2, .contact h2 {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 3.7rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}
.section-heading > p:last-child { max-width: 36rem; margin: 1rem 0 0; color: var(--muted); }

.project-list { border-top: 1px solid var(--line); }
.project {
  min-height: 9rem;
  padding: 1.65rem 0;
  display: grid;
  grid-template-columns: minmax(13rem, 0.9fr) minmax(18rem, 1.4fr) minmax(10rem, 0.65fr) auto;
  align-items: start;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
}
.project-title h3 { margin: 0; font-size: 1.25rem; letter-spacing: -0.02em; }
.project-title span {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font: 600 0.72rem/1.3 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-transform: uppercase;
}
.project > p { margin: 0; color: var(--muted); }
.project .project-stack { font-size: 0.88rem; }
.project > a { color: var(--accent); font-weight: 650; text-underline-offset: 0.25em; }

.two-column { display: grid; grid-template-columns: minmax(16rem, 0.75fr) minmax(0, 1.25fr); gap: clamp(3rem, 9vw, 8rem); }
.about-copy { color: var(--muted); }
.about-copy > p { max-width: 42rem; margin: 0 0 1.5rem; font-size: 1.08rem; }
.focus-list { margin-top: 2.5rem; display: flex; flex-wrap: wrap; gap: 0.55rem; }
.focus-list span { padding: 0.4rem 0.65rem; border: 1px solid var(--line); border-radius: 99rem; color: var(--text); font-size: 0.84rem; }

.contact { border-bottom: 0; }
.contact h2 { margin-bottom: 1.8rem; }
.contact .primary-link { width: fit-content; }

.site-footer {
  width: var(--page);
  min-height: 6rem;
  margin: 0 auto;
  padding: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); text-underline-offset: 0.25em; }

/* Legal page */
.legal-page {
  width: var(--page);
  min-height: calc(100svh - 4.25rem);
  margin: 0 auto;
  padding: clamp(5rem, 10vw, 8rem) 0;
  display: grid;
  grid-template-columns: minmax(8rem, 0.26fr) minmax(0, 1fr);
  gap: clamp(2rem, 8vw, 7rem);
}
.section-index { color: var(--muted); font: 650 0.78rem/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.legal-content { max-width: 49rem; }
.legal-content .eyebrow { color: var(--accent); }
.legal-content h1 { margin: 0 0 2.5rem; font-size: clamp(3.4rem, 8vw, 6rem); line-height: 1; letter-spacing: -0.055em; }
.legal-warning { margin-bottom: 2.5rem; padding: 1rem; border: 1px solid var(--line); border-radius: 0.4rem; background: var(--surface); }
.legal-content section { padding: 2rem 0; border-top: 1px solid var(--line); }
.legal-content h2 { margin-top: 0; font-size: 1.25rem; }
.legal-content address { font-style: normal; }
.legal-content mark { padding: 0.08em 0.25em; background: var(--accent); color: var(--accent-text); }
.legal-hint, .legal-disclaimer { color: var(--muted); }

@media (max-width: 860px) {
  .project { grid-template-columns: minmax(11rem, 0.75fr) minmax(0, 1.25fr) auto; }
  .project-stack { grid-column: 2; }
  .project > a { grid-column: 3; grid-row: 1; }
}

@media (max-width: 680px) {
  :root { --page: calc(100vw - 2rem); }
  .nav-shell { min-height: 3.9rem; }
  .site-header nav { gap: 0.9rem; }
  .site-header nav > a { display: none; }
  .theme-label { display: none; }
  .theme-toggle { width: 2.25rem; justify-content: center; padding-inline: 0; }
  .hero { min-height: auto; padding-block: 6rem; }
  .hero h1 { font-size: clamp(3.3rem, 16vw, 4.8rem); }
  .hero-links { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .project { grid-template-columns: 1fr; gap: 0.85rem; }
  .project-stack, .project > a { grid-column: 1; grid-row: auto; }
  .project > a { margin-top: 0.25rem; }
  .two-column, .legal-page { grid-template-columns: 1fr; gap: 2.5rem; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}
