/* ===========================================================================
   Design tokens
   Light is the default; dark applies from the OS setting unless the visitor
   picked a theme, and always when data-theme="dark" is set.
=========================================================================== */
:root {
  color-scheme: light;

  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e9ecf1;
  --border: #e2e6ec;
  --border-strong: #cdd3dc;

  --text: #0f141b;
  --text-2: #465061;
  --text-3: #5f6a7b;

  --accent: #1d5fd1;
  --accent-strong: #174ea9;
  --accent-soft: #e8f0fd;
  --accent-line: #b9cff5;
  --on-accent: #ffffff;

  --ok: #16774c;
  --ok-soft: #e6f4ed;
  --lock: #5b4bb3;
  --lock-soft: #efedfa;
  --warm: #9a4a14;
  --warm-soft: #fbefe6;

  /* Categorical chart slots, validated for adjacent-pair CVD separation. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;

  --shadow-sm: 0 1px 2px rgba(15, 20, 27, 0.05);
  --shadow-md: 0 1px 2px rgba(15, 20, 27, 0.04), 0 12px 32px -16px rgba(15, 20, 27, 0.18);

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;

  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue",
    Roboto, Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system,
    "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono",
    monospace;

  --content-width: 1140px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --header-height: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #0d1016;
    --surface: #151922;
    --surface-2: #1a1f29;
    --surface-3: #222834;
    --border: #262c38;
    --border-strong: #353d4b;

    --text: #e9ecf2;
    --text-2: #aeb6c3;
    --text-3: #8e98a8;

    --accent: #82a9ff;
    --accent-strong: #a3c0ff;
    --accent-soft: #18233a;
    --accent-line: #2d4577;
    --on-accent: #0d1016;

    --ok: #56cf9c;
    --ok-soft: #13271f;
    --lock: #b4a6ff;
    --lock-soft: #211d38;
    --warm: #f0a26b;
    --warm-soft: #2b1d14;

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 36px -18px rgba(0, 0, 0, 0.7);
  }
}

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

  --bg: #0d1016;
  --surface: #151922;
  --surface-2: #1a1f29;
  --surface-3: #222834;
  --border: #262c38;
  --border-strong: #353d4b;

  --text: #e9ecf2;
  --text-2: #aeb6c3;
  --text-3: #8e98a8;

  --accent: #82a9ff;
  --accent-strong: #a3c0ff;
  --accent-soft: #18233a;
  --accent-line: #2d4577;
  --on-accent: #0d1016;

  --ok: #56cf9c;
  --ok-soft: #13271f;
  --lock: #b4a6ff;
  --lock-soft: #211d38;
  --warm: #f0a26b;
  --warm-soft: #2b1d14;

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 36px -18px rgba(0, 0, 0, 0.7);
}

/* ===========================================================================
   Base
=========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 4.2vw, 2.9rem);
}

h2 {
  font-size: clamp(1.5rem, 2.8vw, 2rem);
}

h3 {
  font-size: 1.15rem;
  letter-spacing: -0.012em;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 3px;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

main:focus {
  outline: none;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.icon {
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.125em;
}

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

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 100;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
  color: var(--on-accent);
}

/* ===========================================================================
   Layout primitives
=========================================================================== */
.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.narrow {
  max-width: 760px;
}

main {
  flex: 1;
}

.section {
  padding-block: clamp(3.5rem, 8vw, 6rem);
}

.section--first {
  padding-top: clamp(2.25rem, 5vw, 3.5rem);
}

.section--tight {
  padding-block: clamp(2rem, 4vw, 3rem);
}

.section--alt {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.section-head {
  max-width: 720px;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.section-head__lead,
.lead {
  margin-top: 0.85rem;
  color: var(--text-2);
  font-size: 1.075rem;
  max-width: 64ch;
}

.eyebrow {
  margin-bottom: 0.7rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.facts__label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.note {
  margin-top: 0.85rem;
  color: var(--text-3);
  font-size: 0.875rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.75rem;
}

.subsection {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

.subsection__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

/* ===========================================================================
   Header & footer
=========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-height);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.015em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--text);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
}

.site-nav a {
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.93rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover {
  background: var(--surface-3);
  color: var(--text);
}

.site-nav a.active {
  color: var(--text);
  background: var(--surface-3);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 1.05rem;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.icon-sun {
  display: none;
}

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

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

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

@media (max-width: 680px) {
  .site-header__inner {
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    padding-block: 0.6rem 0.35rem;
    min-height: 0;
  }
  .brand {
    margin-right: auto;
  }
  .site-nav {
    order: 3;
    flex-basis: 100%;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 0.2rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .site-nav a {
    padding-inline: 0.5rem;
    font-size: 0.9rem;
  }
  .site-nav a:first-child {
    margin-left: -0.5rem;
  }
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2.25rem;
  color: var(--text-3);
  font-size: 0.9rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.site-footer__name {
  color: var(--text);
  font-weight: 600;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
}

.site-footer a {
  color: var(--text-2);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

/* ===========================================================================
   Buttons, chips, badges, tags
=========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.6rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn--primary:hover {
  background: var(--accent-strong);
  color: var(--on-accent);
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--secondary:hover {
  border-color: var(--text-3);
  color: var(--text);
}

.btn--block {
  width: 100%;
  margin-top: 0.75rem;
}

.btn[hidden] {
  display: none;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.5rem;
  padding: 0.3rem 0.85rem 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 500;
}

.pill__dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

.pill__dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--ok);
  opacity: 0.25;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--surface-3);
  color: var(--text-2);
}

.chip--internal {
  background: var(--lock-soft);
  color: var(--lock);
}

.chip--private {
  background: var(--accent-soft);
  color: var(--accent);
}

.chip--commercial {
  background: var(--warm-soft);
  color: var(--warm);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-3);
  font-size: 0.8rem;
}

.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
}

.badge--confirmed::before {
  background: var(--ok);
}

.badge--active::before {
  background: var(--accent);
}

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

.tag {
  padding: 0.14rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.5;
  white-space: nowrap;
}

.tag--more {
  color: var(--text-3);
}

/* ===========================================================================
   Lists
=========================================================================== */
.bullets {
  display: grid;
  gap: 0.55rem;
  color: var(--text-2);
}

.bullets li {
  position: relative;
  padding-left: 1.2rem;
}

.bullets li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--accent);
}

.bullets--small {
  gap: 0.4rem;
  font-size: 0.9rem;
}

@media (min-width: 720px) {
  .bullets--columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2rem;
  }
}

.steps {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.25rem;
  counter-reset: step;
  color: var(--text-2);
}

.steps li {
  position: relative;
  padding-left: 2.2rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

/* ===========================================================================
   Hero
=========================================================================== */
.hero {
  position: relative;
  padding-block: clamp(2.5rem, 7vw, 5rem) clamp(3rem, 7vw, 5rem);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(60rem 30rem at 0% 0%, var(--accent-soft), transparent 70%),
    var(--bg);
}

.hero__grid {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}

@media (min-width: 980px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    align-items: center;
  }
}

.hero__name {
  font-size: clamp(2.5rem, 6vw, 3.9rem);
  letter-spacing: -0.035em;
}

.hero__role {
  margin-top: 0.6rem;
  color: var(--text-2);
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  font-weight: 500;
}

.hero__headline {
  margin-top: 1.6rem;
  max-width: 34ch;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

.hero__lead {
  margin-top: 1rem;
  max-width: 60ch;
  color: var(--text-2);
  font-size: 1.05rem;
}

.facts {
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.facts__title {
  margin-bottom: 1rem;
  font-size: 1rem;
  letter-spacing: -0.005em;
}

.facts__list {
  display: grid;
  gap: 0.85rem;
  margin: 0 0 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.facts__list div {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
}

.facts__list dt {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-3);
  font-size: 0.88rem;
}

.facts__list dd {
  margin: 0;
  font-size: 0.93rem;
  font-weight: 500;
}

.facts__stack .tag-list + .facts__label {
  margin-top: 1rem;
}

@media (max-width: 420px) {
  .facts__list div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

/* ===========================================================================
   Project cards
=========================================================================== */
.project-stack {
  display: grid;
  gap: 1.25rem;
}

.project {
  position: relative;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.project[hidden] {
  display: none;
}

.project:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

@media (min-width: 900px) {
  .project {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .project--text {
    grid-template-columns: 1fr;
  }
}

.project__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: clamp(1.35rem, 3vw, 2rem);
}

.project__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin-bottom: 0.85rem;
}

.project__title {
  font-size: clamp(1.35rem, 2.4vw, 1.6rem);
}

.project__title a {
  color: var(--text);
  text-decoration: none;
}

/* Stretch the title link over the whole card. */
.project__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.project__title a:focus-visible {
  outline: none;
}

.project:has(.project__title a:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.project__subtitle {
  color: var(--text-3);
  font-size: 0.95rem;
  font-weight: 500;
}

.project__summary {
  margin-top: 0.85rem;
  color: var(--text-2);
}

.project__highlights {
  margin: 1rem 0 1.25rem;
  font-size: 0.93rem;
}

.project__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: auto;
  padding-top: 1.25rem;
  font-size: 0.88rem;
}

.project__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent);
  font-weight: 600;
}

.project__cta .icon {
  transition: transform 0.2s ease;
}

.project:hover .project__cta .icon {
  transform: translateX(3px);
}

.project__code {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-3);
}

/* Sits above the stretched card link so it stays separately clickable. */
.project__code--link {
  position: relative;
  z-index: 2;
  color: var(--accent);
  font-weight: 600;
}

.project__visual {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: clamp(1rem, 2.5vw, 1.75rem);
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box;
  border-top: 1px solid var(--border);
}

@media (min-width: 900px) {
  .project__visual {
    border-top: 0;
    border-left: 1px solid var(--border);
  }
}

.project__visual img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.project__visual .diagram {
  width: 100%;
}

.teaser-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
}

.teaser {
  position: relative;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s ease;
}

.teaser:hover {
  border-color: var(--border-strong);
}

.teaser .project__meta {
  margin-bottom: 0.6rem;
}

.teaser__title {
  font-size: 1.1rem;
}

.teaser__title a {
  color: var(--text);
  text-decoration: none;
}

.teaser__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

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

.teaser__subtitle {
  margin: 0.25rem 0 0.9rem;
  color: var(--text-2);
  font-size: 0.9rem;
}

/* ===========================================================================
   Architecture diagram
=========================================================================== */
.diagram {
  container-type: inline-size;
  margin: 0;
}

.diagram__flow {
  display: flex;
  flex-direction: column;
}

.diagram__step {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
}

.diagram__col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.diagram__label {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.diagram__nodes {
  display: grid;
  gap: 0.4rem;
}

.diagram__node {
  display: grid;
  gap: 0.1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
}

.diagram__node--accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.diagram__node-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.diagram__node-detail {
  color: var(--text-2);
  font-size: 0.76rem;
  line-height: 1.35;
}

.diagram__link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0 0.35rem 0.9rem;
  min-height: 2.25rem;
}

.diagram__arrow {
  position: relative;
  order: -1;
  width: 1px;
  height: 1.6rem;
  background: var(--border-strong);
  flex: none;
}

.diagram__arrow::after {
  content: "";
  position: absolute;
  left: -3.5px;
  bottom: -1px;
  border: 4px solid transparent;
  border-top: 5px solid var(--text-3);
  border-bottom: 0;
}

.diagram__link-label {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.3;
}

.diagram__caption {
  margin-top: 1rem;
  color: var(--text-3);
  font-size: 0.82rem;
}

/* Horizontal flow once there is room for it. */
@container (min-width: 34rem) {
  .diagram__flow {
    flex-direction: row;
    align-items: stretch;
  }
  .diagram__step {
    flex-direction: row;
  }
  .diagram__col {
    flex: 1 1 0;
    min-width: 0;
  }
  .diagram__nodes {
    flex: 1;
    align-content: center;
  }
  .diagram__link {
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
    width: clamp(3rem, 9cqi, 5.5rem);
    padding: 1.2rem 0.3rem 0;
    text-align: center;
  }
  .diagram__arrow {
    order: 0;
    width: 100%;
    height: 1px;
  }
  .diagram__arrow::after {
    left: auto;
    right: -1px;
    bottom: -4px;
    border: 4px solid transparent;
    border-left: 5px solid var(--text-3);
    border-right: 0;
  }
}

/* Card variant: a vertical stack with the layer label beside its boxes.
   Selectors are more specific than the container-query rules above, so the card
   keeps this layout at every width. */
.diagram--compact .diagram__flow,
.diagram--compact .diagram__step {
  flex-direction: column;
  align-items: stretch;
}

.diagram--compact .diagram__col {
  display: grid;
  grid-template-columns: 6.75rem minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
}

.diagram--compact .diagram__label {
  font-size: 0.6rem;
  text-align: right;
}

.diagram--compact .diagram__nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.diagram--compact .diagram__node {
  padding: 0.35rem 0.6rem;
  box-shadow: var(--shadow-sm);
}

.diagram--compact .diagram__node-title {
  font-size: 0.78rem;
  overflow-wrap: normal;
}

.diagram--compact .diagram__link {
  flex-direction: row;
  justify-content: flex-start;
  width: auto;
  min-height: 0;
  padding: 0.2rem 0 0.2rem calc(6.75rem + 0.75rem + 1rem);
}

.diagram--compact .diagram__arrow {
  order: 0;
  width: 1px;
  height: 0.85rem;
}

.diagram--compact .diagram__arrow::after {
  left: -3.5px;
  right: auto;
  bottom: -1px;
  border: 4px solid transparent;
  border-top: 5px solid var(--text-3);
  border-bottom: 0;
}

.panel-diagram {
  padding: clamp(1rem, 3vw, 1.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

/* ===========================================================================
   Focus-area donut
=========================================================================== */
.donut {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  margin: 0;
}

@media (min-width: 900px) {
  .donut {
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  }
}

.donut__chart {
  position: relative;
  width: min(100%, 340px);
  margin-inline: auto;
}

.donut__chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.donut__track {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 26;
}

.donut__seg {
  fill: none;
  stroke-width: 26;
  cursor: pointer;
  transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

.donut__seg--1 { stroke: var(--series-1); }
.donut__seg--2 { stroke: var(--series-2); }
.donut__seg--3 { stroke: var(--series-3); }
.donut__seg--4 { stroke: var(--series-4); }
.donut__seg--5 { stroke: var(--series-5); }
.donut__seg--6 { stroke: var(--series-6); }
.donut__seg--7 { stroke: var(--series-7); }

.donut__swatch--1 { background: var(--series-1); }
.donut__swatch--2 { background: var(--series-2); }
.donut__swatch--3 { background: var(--series-3); }
.donut__swatch--4 { background: var(--series-4); }
.donut__swatch--5 { background: var(--series-5); }
.donut__swatch--6 { background: var(--series-6); }
.donut__swatch--7 { background: var(--series-7); }

.donut.has-active .donut__seg {
  opacity: 0.25;
}

.donut.has-active .donut__seg.is-active {
  opacity: 1;
  stroke-width: 32;
}

.donut__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24%;
  text-align: center;
  pointer-events: none;
}

.donut__value {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 3.2rem);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.03em;
}

.donut__caption {
  margin-top: 0.35rem;
  color: var(--text-2);
  font-size: 0.85rem;
  line-height: 1.3;
}

.donut__legend ul {
  display: grid;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .donut__legend ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.donut__row {
  display: flex;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.donut.has-active .donut__row {
  opacity: 0.55;
}

.donut.has-active .donut__row.is-active {
  opacity: 1;
  border-color: var(--border-strong);
  background: var(--surface);
}

.donut__swatch {
  flex: none;
  width: 12px;
  height: 12px;
  margin-top: 0.35rem;
  border-radius: 3px;
}

.donut__text {
  min-width: 0;
}

.donut__title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
}

.donut__count {
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.donut__stack {
  margin-top: 0.15rem;
  color: var(--text-2);
  font-size: 0.85rem;
}

.donut__projects {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.75rem;
  margin-top: 0.4rem;
  font-size: 0.82rem;
}

.donut__note {
  margin-top: 1rem;
  color: var(--text-3);
  font-size: 0.82rem;
}

/* ===========================================================================
   Strengths & contact band
=========================================================================== */
.strength-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 760px) {
  .strength-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.strength {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: clamp(1.25rem, 3vw, 1.6rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.strength > p:first-of-type {
  color: var(--text-2);
}

.strength__evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.8rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  font-size: 0.88rem;
}

.strength__evidence-label {
  color: var(--text-3);
}

.contact-band {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.contact-band__inner {
  display: grid;
  gap: 1.5rem;
  align-items: center;
}

.contact-band h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
}

.contact-band p {
  margin-top: 0.75rem;
  max-width: 60ch;
  color: var(--text-2);
}

.contact-band .actions {
  margin-top: 0;
}

@media (min-width: 900px) {
  .contact-band__inner {
    grid-template-columns: minmax(0, 1.4fr) auto;
    gap: 3rem;
  }
  .contact-band .actions {
    justify-content: flex-end;
  }
}

/* ===========================================================================
   Project detail
=========================================================================== */
.breadcrumb {
  margin-bottom: 1.75rem;
  font-size: 0.9rem;
}

.breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-2);
  text-decoration: none;
}

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

.case__header {
  padding-bottom: 0;
}

.case__intro {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 960px) {
  .case__intro {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
  }
}

.case__subtitle {
  margin-top: 0.55rem;
  color: var(--text-2);
  font-size: clamp(1.05rem, 1.8vw, 1.2rem);
  font-weight: 500;
}

.case__summary {
  margin-top: 1.1rem;
  max-width: 62ch;
  font-size: 1.05rem;
}

.case__glance {
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.case__glance .bullets {
  color: var(--text);
  font-size: 0.95rem;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 1px;
  margin: 2rem 0 1.25rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
}

.fact-grid div {
  padding: 0.85rem 1.1rem;
  background: var(--surface);
}

.fact-grid dt {
  color: var(--text-3);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.fact-grid dd {
  margin: 0.15rem 0 0;
  font-size: 0.93rem;
  font-weight: 500;
}

.case__hero {
  margin-top: 2rem;
}

.case__figure {
  margin: 0;
}

.case__hero-media {
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
  cursor: zoom-in;
}

.case__hero-media img {
  width: auto;
  max-width: 100%;
  max-height: 640px;
  margin-inline: auto;
  object-fit: contain;
}

.case__layout {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 1000px) {
  .case__layout {
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 4rem;
  }
}

.case__body {
  display: grid;
  gap: clamp(2.5rem, 5vw, 3.25rem);
  min-width: 0;
}

.case__section h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.3rem, 2.2vw, 1.55rem);
}

.case__section > p {
  max-width: 70ch;
  color: var(--text-2);
  font-size: 1.02rem;
}

.case__section > .bullets {
  max-width: 72ch;
}

.case__section .panel-diagram + .steps {
  margin-top: 1.5rem;
}

.challenges {
  display: grid;
  gap: 0.75rem;
}

.challenge {
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.challenge__problem {
  font-weight: 500;
}

.challenge__approach {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border);
  color: var(--text-2);
  font-size: 0.94rem;
}

.challenge__approach .icon {
  margin-top: 0.22rem;
  color: var(--ok);
}

.case__aside {
  display: grid;
  gap: 1rem;
  align-content: start;
}

@media (min-width: 1000px) {
  .case__aside {
    position: sticky;
    top: calc(var(--header-height) + 1.5rem);
  }
}

.toc ol {
  display: grid;
  border-left: 1px solid var(--border);
}

.toc a {
  display: block;
  margin-left: -1px;
  padding: 0.3rem 0 0.3rem 0.9rem;
  border-left: 2px solid transparent;
  color: var(--text-2);
  font-size: 0.9rem;
  text-decoration: none;
}

.toc a:hover,
.toc a[aria-current="true"] {
  border-left-color: var(--accent);
  color: var(--text);
}

@media (max-width: 999px) {
  .toc {
    display: none;
  }
}

.aside-card {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.9rem;
}

.aside-card > p:not(.facts__label) {
  color: var(--text-2);
}

.aside-card .link-arrow {
  margin-top: 0.75rem;
}

.mini-facts {
  display: grid;
  gap: 0.5rem;
  margin: 0.9rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.mini-facts dt {
  color: var(--text-3);
  font-size: 0.78rem;
}

.mini-facts dd {
  margin: 0;
  font-weight: 500;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(3rem, 6vw, 4rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pager__link {
  display: grid;
  gap: 0.2rem;
  text-decoration: none;
}

.pager__link--next {
  margin-left: auto;
  text-align: right;
}

.pager__dir {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-3);
  font-size: 0.82rem;
}

.pager__link--next .pager__dir {
  justify-content: flex-end;
}

.pager__title {
  color: var(--text);
  font-weight: 600;
}

.pager__link:hover .pager__title {
  color: var(--accent);
}

/* ===========================================================================
   Gallery & lightbox
=========================================================================== */
.gallery {
  display: grid;
  gap: 1rem;
  align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}

.gallery__item {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.gallery__item--wide {
  grid-column: 1 / -1;
}

.gallery__link {
  position: relative;
  display: block;
  background: var(--surface-2);
  cursor: zoom-in;
}

.gallery__link img {
  width: 100%;
}

.gallery__zoom {
  position: absolute;
  right: 0.6rem;
  top: 0.6rem;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(10, 13, 18, 0.65);
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gallery__link:hover .gallery__zoom,
.gallery__link:focus-visible .gallery__zoom {
  opacity: 1;
}

.gallery figcaption {
  padding: 0.7rem 0.95rem;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.86rem;
}

.gallery--natural {
  align-items: start;
}

.gallery--natural .gallery__link {
  display: flex;
  justify-content: center;
  padding: 0.75rem;
}

.gallery--natural .gallery__link img {
  width: auto;
}

.lightbox {
  width: min(96vw, 1500px);
  max-height: 94vh;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
}

.lightbox::backdrop {
  background: rgba(8, 10, 14, 0.78);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.6rem 0.6rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.lightbox__caption {
  color: var(--text-2);
  font-size: 0.9rem;
}

.lightbox img {
  width: auto;
  max-width: 100%;
  max-height: calc(94vh - 60px);
  margin-inline: auto;
  background: var(--surface-2);
}

/* ===========================================================================
   Projects filter
=========================================================================== */
.filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
}

.filter[hidden] {
  display: none;
}

.filter button {
  min-height: 36px;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}

.filter button:hover {
  color: var(--text);
  border-color: var(--text-3);
}

.filter button[aria-pressed="true"] {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

/* ===========================================================================
   Technologies
=========================================================================== */
.level-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  margin-bottom: 2rem;
  color: var(--text-2);
  font-size: 0.88rem;
}

.level-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.level {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.level--core {
  background: var(--accent-soft);
  color: var(--accent);
}

.level--solid {
  background: var(--ok-soft);
  color: var(--ok);
}

.level--applied {
  background: var(--surface-3);
  color: var(--text-2);
}

.skill-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 900px) {
  .skill-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.skill-group {
  padding: clamp(1.2rem, 3vw, 1.6rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.skill-group h2 {
  font-size: 1.2rem;
}

.skill-group__summary {
  margin: 0.35rem 0 1rem;
  color: var(--text-2);
  font-size: 0.9rem;
}

.skill-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.skill-table tr + tr {
  border-top: 1px solid var(--border);
}

.skill-table th,
.skill-table td {
  padding: 0.6rem 0;
  text-align: left;
  vertical-align: top;
}

.skill-table th {
  width: 36%;
  padding-right: 0.75rem;
  font-weight: 600;
}

.skill-table td:nth-child(2) {
  width: 1%;
  padding-right: 0.9rem;
}

.skill-table__evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.7rem;
  color: var(--text-2);
  font-size: 0.85rem;
}

@media (max-width: 520px) {
  .skill-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.2rem 0.75rem;
    padding: 0.6rem 0;
  }
  .skill-table th,
  .skill-table td {
    width: auto !important;
    padding: 0;
  }
  .skill-table__evidence {
    grid-column: 1 / -1;
  }
}

/* ===========================================================================
   About & contact
=========================================================================== */
.about {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 1000px) {
  .about {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 4rem;
  }
  .about__aside {
    position: sticky;
    top: calc(var(--header-height) + 1.5rem);
  }
}

.about__aside {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.prose {
  display: grid;
  gap: 1rem;
  max-width: 68ch;
  color: var(--text-2);
  font-size: 1.05rem;
}

.about__block {
  margin-top: clamp(2.5rem, 5vw, 3.25rem);
}

.about__block h2 {
  margin-bottom: 1.1rem;
  font-size: clamp(1.3rem, 2.2vw, 1.55rem);
}

.timeline {
  display: grid;
  gap: 0;
  border-left: 2px solid var(--border);
  margin-left: 0.35rem;
}

.timeline__item {
  position: relative;
  padding: 0 0 1.75rem 1.5rem;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.3rem;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}

.timeline__item:first-child::before {
  background: var(--accent);
}

.timeline__period {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.timeline__title {
  margin-top: 0.2rem;
  font-size: 1.08rem;
}

.timeline__org {
  color: var(--accent);
  font-weight: 500;
  font-size: 0.93rem;
}

.timeline__text {
  margin-top: 0.4rem;
  max-width: 64ch;
  color: var(--text-2);
}

.contact {
  max-width: 820px;
}

.contact__card {
  padding: clamp(1.4rem, 4vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.contact__email {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 4vw, 1.9rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.contact__email a {
  color: var(--text);
  text-decoration: none;
}

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

.contact__card .actions {
  margin-top: 1.25rem;
}

.contact .fact-grid {
  margin-top: 1.5rem;
}

/* ===========================================================================
   Print
=========================================================================== */
@media print {
  .site-header,
  .site-footer,
  .contact-band,
  .filter,
  .toc,
  .pager,
  .lightbox,
  .skip-link {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .project,
  .challenge,
  .strength {
    break-inside: avoid;
    box-shadow: none;
  }
}
