:root {
  color-scheme: light dark;
}

body {
  --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);
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  body {
    --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;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

code {
  border-radius: 6px;
  padding: 0.1rem 0.28rem;
  background: var(--code-bg);
  color: var(--accent-strong);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.portfolio-page {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
}

.brand,
.nav-links,
.hero-actions,
.badges,
.card-links,
.contact-actions,
.site-footer {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.75rem;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

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

.nav-links {
  gap: clamp(0.75rem, 2vw, 1.4rem);
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-links a {
  text-decoration: none;
}

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

.section {
  padding: clamp(3rem, 7vw, 6.5rem) clamp(1rem, 4vw, 4rem);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  min-height: calc(100vh - 73px);
  padding-top: clamp(3rem, 7vw, 6rem);
}

.hero-copy,
.section-heading {
  max-width: 760px;
}

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

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  max-width: 900px;
  font-size: clamp(3.15rem, 8vw, 6.2rem);
  line-height: 0.95;
}

h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

h3 {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
}

p {
  color: var(--muted);
  line-height: 1.68;
}

.hero-text {
  max-width: 720px;
  margin: 1.4rem 0 1.5rem;
  font-size: clamp(1.05rem, 2vw, 1.32rem);
}

.badges {
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.2rem 0;
}

.badges img {
  display: block;
  height: 20px;
}

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

.button {
  display: inline-flex;
  min-height: 2.7rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem 1rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  font-weight: 750;
  text-decoration: none;
}

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

.hero-side {
  display: grid;
  gap: 1rem;
}

.hero-visual,
.focus-panel,
.project-card,
.package-row,
.code-panel,
.result-grid figure {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-visual {
  overflow: hidden;
}

.hero-visual svg {
  display: block;
  width: 100%;
  height: auto;
}

.visual-bg {
  fill: var(--surface);
}

.visual-grid path {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.visual-lattice path {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-width: 8;
}

.visual-lattice circle {
  fill: var(--surface);
  stroke: var(--accent-strong);
  stroke-width: 6;
}

.visual-labels {
  fill: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  font-weight: 700;
}

.focus-panel {
  padding: 1.25rem;
}

.focus-panel h2 {
  margin-bottom: 0.85rem;
  font-size: 1.1rem;
}

.focus-panel ul {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.55;
}

.section-heading {
  margin-bottom: 1.5rem;
}

.section-heading p {
  max-width: 760px;
}

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

.project-card {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.35rem;
}

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

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

.package-list {
  display: grid;
  gap: 0.75rem;
}

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

.package-row p {
  margin: 0;
}

.package-row a {
  color: var(--accent-strong);
  font-weight: 800;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
}

.code-panel {
  overflow: auto;
  padding: 1rem;
}

pre {
  margin: 0;
}

pre code {
  display: block;
  padding: 0;
  background: transparent;
  color: var(--text);
  line-height: 1.7;
  white-space: pre;
}

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

.notebook-grid {
  margin-top: 1rem;
}

.result-grid figure {
  overflow: hidden;
  margin: 0;
}

.result-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
}

.result-grid figcaption {
  padding: 0.85rem 1rem 1rem;
  color: var(--muted);
  font-weight: 750;
}

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

.site-footer {
  justify-content: space-between;
  gap: 1rem;
  padding: 1.3rem clamp(1rem, 4vw, 4rem);
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer a {
  color: var(--accent-strong);
  font-weight: 750;
}

@media (max-width: 1120px) {
  .project-grid,
  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .site-header,
  .nav-links,
  .package-row,
  .split-section,
  .contact-section {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .site-header {
    position: static;
    flex-direction: column;
  }

  .nav-links {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
  }

  .hero {
    min-height: auto;
  }

  .project-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .package-row {
    display: grid;
  }

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