:root {
  color-scheme: dark;

  --bg: #04100f;
  --bg-2: #07191a;
  --surface: #0a201f;
  --surface-2: #0e2a29;

  --ink: #eaf6f3;
  --muted: #8aa39e;
  --faint: rgba(234, 246, 243, 0.06);
  --line: rgba(95, 240, 228, 0.14);
  --line-strong: rgba(95, 240, 228, 0.3);

  --water: #34e6d6;
  --water-bright: #5ff0e4;
  --water-deep: #0f9aa0;
  --glow: rgba(52, 230, 214, 0.45);

  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --max-width: 1120px;
  --gutter: 36px;
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #f5faf8;
  --bg-2: #edf6f4;
  --surface: #e3f0ec;
  --surface-2: #d6e8e3;

  --ink: #0a1a18;
  --muted: #5c706b;
  --faint: rgba(10, 26, 24, 0.04);
  --line: rgba(15, 154, 160, 0.16);
  --line-strong: rgba(15, 154, 160, 0.32);

  --water: #0f9aa0;
  --water-bright: #0c8389;
  --water-deep: #0f7a80;
  --glow: rgba(15, 154, 160, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(120% 90% at 100% -10%, var(--glow), transparent 55%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 88px,
    linear-gradient(90deg, var(--faint) 1px, transparent 1px) 0 0 / 88px 100%,
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

::selection {
  background: rgba(52, 230, 214, 0.25);
  color: var(--ink);
}

.site-header,
.site-footer,
main {
  width: min(calc(100% - var(--gutter)), var(--max-width));
  margin: 0 auto;
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 14px;
}

.wordmark,
.nav-links {
  display: flex;
  align-items: center;
}

.wordmark {
  gap: 12px;
  text-decoration: none;
}

.wordmark-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 16px var(--glow));
  transition: transform 220ms ease;
}

.wordmark-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.wordmark-mark--sm {
  width: 26px;
  height: 26px;
}

.mark-box {
  fill: var(--water);
}

.mark-wave {
  stroke: var(--bg);
  stroke-width: 5;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}

.wordmark:hover .wordmark-mark {
  transform: translateY(-2px) rotate(-3deg);
}

.wordmark-text {
  font-weight: 500;
  letter-spacing: 0.01em;
}

.nav-links {
  gap: 26px;
  color: var(--muted);
}

.nav-links a {
  text-decoration: none;
  transition: color 160ms ease;
}

.nav-links a:hover,
.footer-links a:hover {
  color: var(--water-bright);
}

.nav-links a[aria-current="page"] {
  color: var(--ink);
}

.nav-cta {
  color: var(--water);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  color: var(--muted);
  border-radius: 6px;
  transition: color 160ms ease, background 160ms ease;
  text-decoration: none;
}

.theme-toggle:hover {
  color: var(--water-bright);
  background: rgba(52, 230, 214, 0.08);
}

.theme-icon {
  display: none;
}

:root .theme-icon-sun { display: block; }
:root .theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }

@media (max-width: 520px) {
  .nav-cta {
    display: none;
  }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: clamp(440px, 68vh, 640px);
  flex-direction: column;
  justify-content: center;
  padding: 56px 0 72px;
  overflow: hidden;
}

.hero-reflection {
  display: block;
  position: absolute;
  z-index: -2;
  opacity: 0.95;
  -webkit-mask-image: radial-gradient(130% 120% at 70% 40%, #000 35%, transparent 78%);
  mask-image: radial-gradient(130% 120% at 70% 40%, #000 35%, transparent 78%);
}

/* soft vignette so text stays readable over the flow */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, var(--bg) 6%, transparent 78%);
}

.hero-inner {
  max-width: 760px;
}

.kicker-tilde {
  color: var(--water);
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}

.hero-lead {
  display: block;
  max-width: 14ch;
  font-family: var(--font-sans);
  font-size: clamp(40px, 7vw, 82px);
  font-weight: 300;
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: var(--ink);
  animation: rise 700ms ease 80ms both;
}

.hero-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  width: fit-content;
  animation: rise 700ms ease 180ms both;
}

.hero-menu-item {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 500;
  color: var(--water-bright);
  letter-spacing: -0.01em;
}

.hero-menu-item::before {
  content: "//";
  margin-right: 6px;
  color: var(--water-deep);
  opacity: 0.8;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 22px;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.btn-primary {
  background: var(--water);
  color: var(--bg);
  box-shadow: 0 8px 28px rgba(52, 230, 214, 0.22);
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: var(--water-bright);
  box-shadow: 0 12px 34px rgba(52, 230, 214, 0.34);
}

.btn-ghost {
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  transform: translateY(-2px);
  border-color: var(--water);
  background: rgba(52, 230, 214, 0.06);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Release strip ---------- */

.release-strip {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, var(--surface) 0%, var(--bg-2) 50%, var(--surface) 100%);
  overflow-x: auto;
}

.release-strip-inner {
  width: min(calc(100% - var(--gutter)), var(--max-width));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 54px;
  padding: 8px 0;
}

.release-items {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.release-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.release-chip:hover {
  border-color: var(--line-strong);
  background: rgba(52, 230, 214, 0.08);
  color: var(--water-bright);
  transform: translateY(-1px);
}

.release-chip-name {
  font-weight: 500;
  color: var(--water);
}

.release-chip-version {
  color: var(--ink);
  opacity: 0.7;
}

.release-chip-date {
  color: var(--muted);
  opacity: 0.6;
  font-size: 11px;
}

.release-log-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 6px 16px 6px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--water);
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.release-log-link:hover {
  background: rgba(52, 230, 214, 0.1);
  border-color: var(--water);
  color: var(--water-bright);
  transform: translateY(-1px);
}

.release-log-arrow {
  font-size: 15px;
  transition: transform 180ms ease;
}

.release-log-link:hover .release-log-arrow {
  transform: translateX(3px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Projects ---------- */

.projects-section {
  border-top: 1px solid var(--line);
  padding: 88px 0;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 48px;
}

h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(30px, 4.4vw, 56px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
}

.section-count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.project-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.project-list li {
  border-bottom: 1px solid var(--line);
}

.project-row {
  position: relative;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 24px 16px 24px 12px;
  text-decoration: none;
  transition: transform 200ms ease, background 200ms ease;
}

.project-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12%;
  bottom: 12%;
  width: 2px;
  background: var(--water);
  border-radius: 0;
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 200ms ease;
}

.project-row:hover,
.project-row:focus-visible {
  background: linear-gradient(90deg, rgba(52, 230, 214, 0.06), transparent 70%);
  outline: none;
}

.project-row:hover {
  transform: translateX(6px);
}

.project-row:hover::before,
.project-row:focus-visible::before {
  transform: scaleY(1);
}

.project-row:focus-visible {
  box-shadow: inset 0 0 0 1px var(--line-strong);
  border-radius: 0;
}

.project-row:hover .project-name,
.project-row:focus-visible .project-name,
.project-row:hover .project-arrow,
.project-row:focus-visible .project-arrow,
.project-row:hover .project-index,
.project-row:focus-visible .project-index {
  color: var(--water-bright);
}

.project-logo-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: linear-gradient(150deg, var(--surface-2), var(--surface));
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.project-row:hover .project-logo-frame,
.project-row:focus-visible .project-logo-frame {
  border-color: var(--line-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 0 24px rgba(52, 230, 214, 0.08);
}

.project-logo {
  width: min(82px, 100%);
  height: auto;
  filter: saturate(0.25) opacity(0.55);
  transition: filter 220ms ease, transform 220ms ease;
}

.project-row:hover .project-logo,
.project-row:focus-visible .project-logo {
  filter: saturate(1) opacity(1) drop-shadow(0 0 8px rgba(52, 230, 214, 0.35));
  transform: scale(1.04);
}

.project-copy {
  display: grid;
  gap: 9px;
}

.project-name {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  transition: color 180ms ease;
}

.project-summary {
  display: block;
  max-width: 38ch;
  color: var(--muted);
  font-size: clamp(15px, 1.6vw, 17px);
  line-height: 1.45;
}

.project-meta {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.project-index {
  color: rgba(234, 246, 243, 0.32);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: color 180ms ease;
}

.project-arrow {
  color: rgba(234, 246, 243, 0.3);
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1;
  transition: color 180ms ease, transform 180ms ease;
}

.project-row:hover .project-arrow {
  transform: translate(2px, -2px);
}

/* ---------- About page ---------- */

.page-main {
  min-height: calc(100vh - 184px);
}

.page-section {
  width: min(calc(100% - var(--gutter)), var(--max-width));
  margin: 0 auto;
  padding: 64px 0 96px;
}

.page-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.page-title {
  display: block;
  max-width: 16ch;
  margin: 0 0 40px;
  font-size: clamp(34px, 5.4vw, 64px);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.about-copy {
  max-width: 680px;
}

.about-copy p {
  margin-bottom: 22px;
  color: var(--ink);
  opacity: 0.82;
  font-size: clamp(18px, 1.9vw, 22px);
  line-height: 1.6;
  font-weight: 300;
}

.about-copy p:last-child {
  margin-bottom: 0;
}

/* ---------- Releases page ---------- */

.releases-section {
  width: min(calc(100% - var(--gutter)), var(--max-width));
  margin: 0 auto;
  padding: 64px 0 96px;
}

.release-project {
  border-top: 1px solid var(--line);
  padding: 40px 0;
}

.release-project-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 28px;
}

.release-project-name {
  font-family: var(--font-mono);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.release-project-repo {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.release-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 18px;
}

.release-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px 28px;
  align-items: baseline;
  padding: 14px 18px;
  border: 1px solid var(--faint);
  border-radius: 0;
  background: linear-gradient(120deg, var(--surface), var(--bg-2));
  transition: border-color 180ms ease, background 180ms ease;
}

.release-entry:hover {
  border-color: var(--line);
  background: linear-gradient(120deg, var(--surface-2), var(--surface));
}

.release-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.release-version {
  font-size: 14px;
  font-weight: 500;
  color: var(--water-bright);
}

.release-date {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.6;
}

.release-notes {
  font-size: clamp(14px, 1.4vw, 16px);
  color: var(--muted);
  line-height: 1.55;
}

.release-notes code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--water);
  background: rgba(52, 230, 214, 0.08);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 104px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}

.footer-links {
  display: flex;
  gap: 22px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 160ms ease;
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  :root {
    --gutter: 28px;
  }

  .site-header {
    min-height: 70px;
  }

  .nav-links {
    gap: 18px;
  }

  .hero {
    min-height: 460px;
    padding: 40px 0 56px;
  }

  .hero-reflection {
    opacity: 0.7;
  }

  .hero::before {
    background: linear-gradient(180deg, var(--bg), var(--bg) 86%);
  }

  .projects-section {
    padding: 64px 0;
  }

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

  .project-row {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 18px;
    padding: 20px 8px;
  }

  .project-logo-frame {
    min-height: 80px;
    padding: 12px;
    border-radius: 0;
  }

  .project-logo {
    width: min(58px, 100%);
  }

  .project-meta {
    grid-column: 2;
    grid-auto-flow: column;
    justify-content: start;
    gap: 14px;
  }

  .page-section {
    padding: 40px 0 64px;
  }

  .release-strip-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
  }

  .release-entry {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .release-log-link {
    align-self: flex-end;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
  }
}

@media (max-width: 430px) {
  .nav-links {
    font-size: 12px;
  }

  .hero-menu-item {
    font-size: clamp(18px, 6vw, 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-lead,
  .hero-menu {
    animation: none;
  }
}
