:root {
  --paper: #f3f5f8;
  --surface: #ffffff;
  --surface-soft: #e9eef5;
  --ink: #132238;
  --muted: #667085;
  --blue: #315efb;
  --blue-dark: #1e46d8;
  --line: #d4dbe5;
  --line-strong: #9eabbc;
  --focus: #f4c95d;
  --max: 1260px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e1622;
  --surface: #151f2d;
  --surface-soft: #1d2a3a;
  --ink: #f0f4fb;
  --muted: #9ba9bb;
  --blue: #7f9cff;
  --blue-dark: #9ab0ff;
  --line: #2e3d51;
  --line-strong: #53657d;
  --focus: #f4c95d;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, Aptos, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; }
[hidden] { display: none !important; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 1rem;
  top: -5rem;
  padding: .7rem 1rem;
  background: var(--ink);
  color: var(--surface);
}
.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2rem;
  padding: 0 max(24px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(16px);
}
.wordmark {
  width: max-content;
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -.045em;
  text-decoration: none;
}
.wordmark span { color: var(--blue); }
.site-header nav, .header-links, footer div {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}
.site-header nav a, .header-links > a {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.site-header nav a:hover, .site-header nav a.active, .header-links > a:hover { color: var(--ink); }
.site-header nav a.active { box-shadow: inset 0 -2px var(--blue); }
.header-links { justify-content: flex-end; }

.theme-toggle {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .43rem .62rem;
  background: var(--surface);
  color: var(--ink);
  font-size: .72rem;
  font-weight: 720;
  cursor: pointer;
}
.theme-toggle::before { content: "☼"; margin-right: .35rem; }
.theme-toggle[data-active-theme="dark"]::before { content: "☾"; }
.locale-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.locale-switch button {
  min-width: 34px;
  border: 0;
  border-radius: 4px;
  padding: .35rem .45rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .72rem;
  font-weight: 800;
}
.locale-switch button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

.intro, .section-title, .project-list, .repository-section {
  width: min(calc(100% - 48px), var(--max));
  margin-inline: auto;
}
.intro {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 0;
}
.intro.compact { min-height: 350px; }
.identity {
  margin: 0 0 1.05rem;
  color: var(--blue);
  font-size: .86rem;
  font-weight: 760;
}
.intro h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(3rem, 6vw, 5.4rem);
  font-weight: 780;
  letter-spacing: -.072em;
  line-height: .94;
}
.intro.compact h1 { font-size: clamp(3rem, 6vw, 5.5rem); }
.intro > p:not(.identity) {
  max-width: 620px;
  margin: 1.65rem 0 1.25rem;
  color: var(--muted);
  font-size: 1.08rem;
}
.text-link, .project-link {
  width: max-content;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 760;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.text-link:hover, .project-link:hover { color: var(--blue-dark); }

.projects { padding-bottom: 7rem; }
.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.4rem 0;
  border-top: 2px solid var(--ink);
}
.section-title h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.035em; }
.section-title p { margin: 0; color: var(--muted); font-size: .86rem; }
.project-list { border-bottom: 1px solid var(--line-strong); }
.project-showcase {
  display: grid;
  grid-template-columns: minmax(250px, .68fr) minmax(0, 1.6fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  min-height: 610px;
  padding: clamp(3.5rem, 6vw, 6rem) clamp(0rem, 2vw, 1.5rem);
  border-top: 1px solid var(--line-strong);
}
.project-showcase + .project-showcase { border-top-width: 2px; }
.project-showcase:nth-child(even) { grid-template-columns: minmax(0, 1.6fr) minmax(250px, .68fr); }
.project-showcase:nth-child(even) .project-copy { order: 2; }
.project-showcase:nth-child(even) .project-gallery { order: 1; }
.project-copy { max-width: 390px; }
.project-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .65rem;
  margin-bottom: 1.2rem;
  color: var(--muted);
  font-size: .76rem;
}
.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: .2rem .6rem;
  border: 1px solid color-mix(in srgb, var(--blue) 45%, var(--line));
  border-radius: 999px;
  color: var(--blue-dark);
  font-weight: 760;
}
.project-showcase h3 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4rem);
  letter-spacing: -.06em;
  line-height: .96;
}
.project-copy > p {
  margin: 1.25rem 0 1.35rem;
  color: var(--muted);
  font-size: .98rem;
}
.project-features {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0 0 1.65rem;
  padding: 0;
  list-style: none;
}
.project-features li {
  padding: .36rem .62rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 650;
}

.project-gallery {
  --pointer-x: 50%;
  --pointer-y: 50%;
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #08101d;
  box-shadow: 0 24px 70px color-mix(in srgb, var(--ink) 17%, transparent);
}
.browser-bar {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-bottom: 1px solid #273246;
  background: #111a28;
  color: #9ca9bd;
  font-size: .68rem;
}
.browser-bar i { width: 7px; height: 7px; border-radius: 50%; background: #526178; }
.browser-bar i:first-child { background: #f06b67; }
.browser-bar i:nth-child(2) { background: #e8b957; }
.browser-bar i:nth-child(3) { background: #5abf83; }
.browser-bar span {
  overflow: hidden;
  margin-left: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.carousel-viewport { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.carousel-viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(360px circle at var(--pointer-x) var(--pointer-y), #ffffff12, transparent 60%);
  opacity: 0;
  transition: opacity .2s ease;
}
.project-gallery:hover .carousel-viewport::after { opacity: 1; }
.carousel-slide { position: relative; width: 100%; height: 100%; margin: 0; background: #080e19; }
.carousel-slide img { width: 100%; height: 100%; object-fit: contain; }
.carousel-slide.mobile-preview {
  background: linear-gradient(135deg, #111b2b, #070d17 68%);
}
.carousel-slide.mobile-preview img {
  width: auto;
  margin-inline: auto;
  box-shadow: 0 0 0 1px #ffffff18, 0 16px 42px #0008;
}
.carousel-slide figcaption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: .35rem .58rem;
  border: 1px solid #ffffff24;
  border-radius: 5px;
  background: #07101cdd;
  color: #eff4fc;
  font-size: .7rem;
  backdrop-filter: blur(8px);
}
.carousel-footer {
  min-height: 48px;
  display: grid;
  grid-template-columns: 38px 1fr auto 38px;
  align-items: center;
  gap: .7rem;
  padding: 5px 8px;
  border-top: 1px solid #273246;
  background: #111a28;
  color: #bdc8d8;
}
.carousel-control {
  width: 36px;
  height: 36px;
  border: 1px solid #34425a;
  border-radius: 6px;
  background: #182337;
  color: #f5f8ff;
  cursor: pointer;
  font-size: 1.45rem;
  line-height: 1;
}
.carousel-control:hover { border-color: #7f9cff; background: #22314a; }
.carousel-dots { display: flex; align-items: center; justify-content: center; gap: .5rem; }
.carousel-dots button {
  width: 26px;
  height: 4px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: #46546b;
  cursor: pointer;
}
.carousel-dots button[aria-pressed="true"] { background: #8ba3ff; }
.carousel-position { min-width: 34px; font-size: .68rem; font-variant-numeric: tabular-nums; }

.repository-section { padding-bottom: 7rem; }
.repository-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.repository-card {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.repository-card:nth-child(even) { border-right: 0; }
.repository-card h3 { margin: 0; font-size: 1.35rem; letter-spacing: -.03em; }
.repository-card h3 a { text-decoration: none; }
.repository-card h3 a:hover { color: var(--blue-dark); }
.repository-card p { color: var(--muted); }
.repo-meta { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: auto; color: var(--muted); font-size: .75rem; }
.repo-state { padding: 3rem 0; color: var(--muted); }

footer {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem max(24px, calc((100vw - var(--max)) / 2));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .8rem;
}
footer p { margin: 0; }
footer a { text-decoration: none; }
footer a:hover { color: var(--ink); }

.error-page {
  width: min(calc(100% - 40px), 720px);
  min-height: 100vh;
  display: grid;
  align-content: center;
  margin-inline: auto;
}
.error-page h1 { margin: 0; font-size: clamp(3rem, 8vw, 6rem); letter-spacing: -.06em; }
.error-page p { color: var(--muted); }
.eyebrow { font-weight: 800; }
.button { width: max-content; margin-top: 1rem; padding: .75rem 1rem; border-radius: 7px; text-decoration: none; }
.button-primary { background: var(--blue); color: #fff; }

@media (max-width: 1040px) {
  .site-header { grid-template-columns: auto 1fr; }
  .site-header nav { display: none; }
  .project-showcase, .project-showcase:nth-child(even) { grid-template-columns: 1fr; min-height: 0; gap: 2rem; }
  .project-copy, .project-showcase:nth-child(even) .project-copy { order: 1; max-width: 650px; }
  .project-gallery, .project-showcase:nth-child(even) .project-gallery { order: 2; }
}

@media (max-width: 760px) {
  .site-header { min-height: 66px; gap: 1rem; padding-inline: 18px; }
  .header-links { gap: .42rem; }
  .header-links > a { display: none; }
  .intro, .section-title, .project-list, .repository-section { width: min(calc(100% - 32px), var(--max)); }
  .intro { min-height: 330px; padding: 3rem 0; }
  .intro.compact { min-height: 310px; }
  .intro h1 { font-size: clamp(2.65rem, 13vw, 4.2rem); }
  .intro > p:not(.identity) { font-size: 1rem; }
  .section-title { display: block; }
  .section-title p { margin-top: .4rem; }
  .project-showcase { padding: 3.2rem 0; }
  .project-showcase h3 { font-size: clamp(2.35rem, 12vw, 3.4rem); }
  .project-gallery { border-radius: 8px; }
  .browser-bar { height: 32px; }
  .carousel-footer { min-height: 46px; grid-template-columns: 36px 1fr auto 36px; gap: .35rem; }
  .carousel-control { width: 34px; height: 34px; }
  .carousel-dots button { width: 20px; }
  .repository-grid { grid-template-columns: 1fr; }
  .repository-card, .repository-card:nth-child(even) { border-right: 0; }
  footer { min-height: 95px; padding-inline: 18px; }
}

@media (max-width: 430px) {
  .header-links { gap: .35rem; }
  .locale-switch button { min-width: 30px; }
  .theme-toggle { padding-inline: .48rem; }
  .intro h1 { overflow-wrap: anywhere; }
  .carousel-slide figcaption { display: none; }
  footer { align-items: flex-start; flex-direction: column; gap: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .carousel-viewport::after { display: none; }
}
