:root {
  color-scheme: light dark;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-muted: #ededeb;
  --text: #1d2328;
  --muted: #5b6670;
  --line: #d7d9d6;
  --accent: #126c83;
  --accent-strong: #0f5364;
  --accent-soft: #dceff3;
  --code-bg: #eef2f1;
  --shadow: 0 18px 45px rgba(34, 41, 47, 0.08);
  --shadow-soft: 0 10px 30px rgba(34, 41, 47, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101416;
    --surface: #171d20;
    --surface-muted: #20282b;
    --text: #edf1f2;
    --muted: #a9b4b8;
    --line: #2e393d;
    --accent: #66c5d7;
    --accent-strong: #9eddea;
    --accent-soft: #17333a;
    --code-bg: #11191c;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.18);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent) 65%, transparent);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-strong);
}

a:focus-visible,
main:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

img {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
}

code {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.18rem 0.36rem;
  background: var(--code-bg);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  white-space: nowrap;
}

pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: var(--code-bg);
  color: var(--text);
}

pre code {
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
  white-space: pre;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  transform: translateY(-150%);
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 160ms ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-shell {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 0.82rem;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-links a {
  border-radius: 6px;
  padding: 0.15rem 0;
  text-decoration: none;
}

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.article-wrap {
  width: min(980px, calc(100% - 2rem));
}

.section {
  padding: clamp(3rem, 8vw, 6rem) 0;
  scroll-margin-top: 6rem;
}

.section + .section,
.article-page main {
  border-top: 1px solid var(--line);
}

.hero {
  min-height: calc(100vh - 5rem);
  display: grid;
  align-items: center;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
}

.hero-copy h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(3.6rem, 10vw, 7.5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead,
.section-heading p,
.focus-panel li,
.metric span,
.project-card p,
.result-card figcaption span,
.finding p,
.article p,
.article li,
.article figcaption {
  color: var(--muted);
}

.lead {
  max-width: 780px;
  margin: 1.4rem 0 0;
  font-size: clamp(1.08rem, 2vw, 1.28rem);
}

.hero-actions,
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem 1rem;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.button.primary {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #ffffff;
}

.button:hover {
  transform: translateY(-1px);
}

.hero-side,
.package-list,
.article-copy {
  display: grid;
  gap: 1rem;
}

.focus-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.4rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.focus-panel h2,
.focus-panel h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.focus-panel ul {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding-left: 1.1rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 2rem 0 0;
}

.metric,
.project-card,
.package-row,
.article,
figure.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric {
  min-height: 116px;
  padding: 1.25rem;
}

.metric strong {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 1.8rem;
  line-height: 1;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 1.5rem;
}

.section-heading h2,
.contact-section h2,
.article-page h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.section-heading p {
  margin: 0.9rem 0 0;
}

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

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

.project-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  justify-content: space-between;
  overflow: hidden;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.project-card:not(figure) {
  padding: 1.25rem;
}

.project-card:hover,
.project-card:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.project-card h3,
.package-row h3,
.article h3 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  line-height: 1.25;
}

.result-card figure,
figure.result-card {
  margin: 0;
}

.result-card figcaption {
  border-top: 1px solid var(--line);
  padding: 1rem 1.1rem;
}

.result-card figcaption strong {
  display: block;
  margin-bottom: 0.4rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.card-links a,
.package-row a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.card-links a::after,
.package-row a::after {
  content: " ->";
}

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

.finding {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent-strong);
  border-radius: 8px;
  padding: 1.25rem;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.finding h3,
.finding p {
  margin: 0;
}

.finding h3 {
  margin-bottom: 0.5rem;
}

.package-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.9fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badges img {
  width: auto;
  height: 20px;
  background: transparent;
}

.article-page main {
  padding: clamp(3rem, 8vw, 5rem) 0;
}

.article-page h2 {
  margin: 2.5rem 0 0.9rem;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: 1.08;
}

.article-page h3 {
  margin: 1.8rem 0 0.6rem;
}

.article {
  margin-top: 1.75rem;
  padding: 1.75rem;
}

.article figure {
  margin: 1.5rem 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.article figcaption {
  border-top: 1px solid var(--line);
  padding: 0.9rem 1rem;
}

.equation {
  overflow-x: auto;
  padding: 0.75rem 0;
}

.contact-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem;
  border-top: 1px solid var(--line);
}

.contact-actions {
  justify-content: flex-end;
  margin-top: 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.site-footer a {
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 880px) {
  .hero,
  .hero-layout,
  .contact-section {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .metrics,
  .project-grid,
  .figure-grid,
  .model-grid,
  .findings {
    grid-template-columns: 1fr;
  }

  .package-row {
    grid-template-columns: 1fr;
  }

  .contact-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .nav-shell {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    padding: 0.85rem 0;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .wrap,
  .article-wrap {
    width: min(100% - 1rem, 1120px);
  }

  .hero-copy h1 {
    font-size: clamp(3rem, 17vw, 5rem);
  }

  .button {
    width: 100%;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .button:hover,
  .project-card:hover,
  .project-card:focus-within {
    transform: none;
  }
}
