/* ossiandackfors.com — site styles */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #0a0c0f;
  --bg-2: #0e1115;
  --surface: #12161b;
  --surface-2: #171c23;
  --line: #20262e;
  --line-2: #2c343f;
  --text: #e8ebef;
  --text-2: #b4bcc7;
  --muted: #7e8895;
  --accent: #ffb547;
  --accent-strong: #ffc76e;
  --accent-ink: #1a1204;
  --accent-soft: rgba(255, 181, 71, 0.12);
  --cool: #7cc4ff;

  --tok-keyword: #c792ea;
  --tok-type: #7cc4ff;
  --tok-func: #ffd580;
  --tok-string: #a8e07a;
  --tok-number: #f79b6c;
  --tok-comment: #66717f;
  --tok-punct: #8f9aa8;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --container: 1200px;
  --gutter: 24px;
  --header-h: 64px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 20px 40px -24px 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-h) + 24px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

a { color: inherit; text-decoration: none; }

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

::selection { background: var(--accent); color: var(--accent-ink); }

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  text-wrap: balance;
}

p { margin: 0; }

code, kbd, pre { font-family: var(--font-mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.mono { font-family: var(--font-mono); }

.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;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(10, 12, 15, 0.78);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: linear-gradient(145deg, var(--surface-2), var(--bg));
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0;
}

.brand__name { font-size: 15px; }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--text-2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background-color 0.15s;
}

.nav a:hover { color: var(--text); background: var(--surface); }
.nav a[aria-current="page"] { color: var(--accent); }

.nav .nav__resume {
  margin-left: 8px;
  color: var(--accent);
  border: 1px solid rgba(255, 181, 71, 0.35);
}
.nav .nav__resume:hover { background: var(--accent-soft); color: var(--accent-strong); }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle svg { width: 18px; height: 18px; }

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 16px 16px;
    background: rgba(10, 12, 15, 0.97);
    border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px; font-size: 14px; }
  .nav .nav__resume { margin: 8px 0 0; text-align: center; }
}

/* ---------- Buttons & chips ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.btn:hover { border-color: var(--muted); background: var(--surface-2); }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }

.chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.015);
  white-space: nowrap;
}
.chip--accent { color: var(--accent); border-color: rgba(255, 181, 71, 0.35); background: var(--accent-soft); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before { content: "//"; color: var(--muted); letter-spacing: 0; }

/* ---------- Hero (home) ---------- */

.hero {
  position: relative;
  padding: 104px 0 96px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  opacity: 0.55;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 70% at 70% 40%, #000 20%, transparent 75%);
}

.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 720px;
  height: 720px;
  right: -180px;
  top: -260px;
  background: radial-gradient(circle, rgba(255, 181, 71, 0.13), transparent 60%);
  pointer-events: none;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 64px;
  align-items: center;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(18, 22, 27, 0.7);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-2);
}
.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.15);
}

.hero__title {
  margin-top: 28px;
  font-size: clamp(44px, 7vw, 84px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.hero__role {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: clamp(16px, 2vw, 20px);
  color: var(--accent);
  letter-spacing: 0.01em;
}
.hero__role::before { content: "> "; color: var(--muted); }

.hero__lede {
  margin-top: 24px;
  max-width: 34em;
  font-size: 19px;
  line-height: 1.6;
  color: var(--text-2);
}

.hero .btn-row { margin-top: 36px; }
.hero .chips { margin-top: 36px; }

/* Editor-window panel */

.panel {
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow), 0 40px 80px -40px rgba(255, 181, 71, 0.12);
  overflow: hidden;
}

.panel__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}
.panel__dots { display: flex; gap: 6px; }
.panel__dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.panel__title {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel pre {
  margin: 0;
  padding: 20px 22px 24px;
  font-size: 12.5px;
  line-height: 1.75;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}

.hero .panel { transform: perspective(1400px) rotateY(-6deg) rotateX(2deg); transform-origin: left center; }

/* ---------- Sections ---------- */

.section { padding: 112px 0; border-bottom: 1px solid var(--line); }
.section--tight { padding: 88px 0; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 48px;
}
.section-head h2 {
  margin-top: 14px;
  font-size: clamp(34px, 4.6vw, 52px);
  letter-spacing: -0.035em;
}
.section-head p { max-width: 30em; color: var(--muted); }

/* ---------- Project cards ---------- */

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

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.25s ease, box-shadow 0.25s;
}
.card:hover { border-color: var(--line-2); transform: translateY(-4px); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8); }

.card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.card:hover .card__media img { transform: scale(1.04); }

.card__index {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(10, 12, 15, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
}

.card__body { display: flex; flex-direction: column; gap: 14px; padding: 24px 24px 26px; flex: 1; }

.card__type {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.card__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 28px;
  letter-spacing: -0.03em;
}
.card__title a::after { content: ""; position: absolute; inset: 0; }
.card__arrow { width: 22px; height: 22px; color: var(--muted); transition: transform 0.2s, color 0.2s; flex: none; }
.card:hover .card__arrow { color: var(--accent); transform: translate(3px, -3px); }

.card__role { color: var(--text-2); font-size: 16px; }
.card__role strong { color: var(--accent); font-weight: 600; }

.card .chips { margin-top: auto; padding-top: 6px; }

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

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.about__text p { color: var(--text-2); font-size: 18px; }
.about__text p + p { margin-top: 20px; }
.about__text p:first-child { color: var(--text); font-size: 21px; line-height: 1.55; }

.aside-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 26px;
}
.aside-box + .aside-box { margin-top: 20px; }
.aside-box h3 {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

.selected { list-style: none; margin: 0; padding: 0; }
.selected li + li { border-top: 1px solid var(--line); }
.selected a { display: block; padding: 14px 0; }
.selected li:first-child a { padding-top: 0; }
.selected li:last-child a { padding-bottom: 0; }
.selected strong { display: block; font-size: 17px; transition: color 0.15s; }
.selected span { display: block; margin-top: 2px; font-size: 15px; color: var(--muted); line-height: 1.5; }
.selected a:hover strong { color: var(--accent); }

/* ---------- Contact ---------- */

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

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.2s, background-color 0.2s;
  min-width: 0;
}
.contact-card:hover { border-color: rgba(255, 181, 71, 0.45); background: var(--surface-2); }
.contact-card svg { width: 22px; height: 22px; color: var(--accent); }
.contact-card__label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.contact-card__value { margin-top: 4px; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

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

.site-footer { padding: 48px 0 56px; color: var(--muted); font-size: 14px; }
.site-footer .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 22px; font-family: var(--font-mono); font-size: 13px; }
.site-footer nav a:hover { color: var(--accent); }

/* ---------- Project page ---------- */

.project-hero {
  position: relative;
  padding: 56px 0 64px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}
.project-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.4;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 20% 0%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 70% 80% at 20% 0%, #000 10%, transparent 70%);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }
.back-link svg { width: 16px; height: 16px; }

.project-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
  margin-top: 36px;
}

.project-hero h1 {
  margin-top: 18px;
  font-size: clamp(44px, 6.4vw, 76px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.project-hero__role {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--accent);
}

.project-hero__lede { margin-top: 24px; font-size: 18.5px; line-height: 1.65; color: var(--text-2); max-width: 36em; }
.project-hero .btn-row { margin-top: 32px; }

.project-hero__media {
  position: relative;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-2);
  box-shadow: var(--shadow);
}
.project-hero__media img { width: 100%; max-height: 560px; object-fit: cover; }
.project-hero__media--contain img { object-fit: contain; max-height: 520px; margin: 0 auto; width: auto; }

.spec {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.spec div { padding: 22px 24px; border-right: 1px solid var(--line); min-width: 0; }
.spec div:last-child { border-right: 0; }
.spec dt { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.spec dd { margin: 6px 0 0; font-weight: 600; font-size: 15.5px; line-height: 1.4; }
.spec-wrap { border-bottom: 1px solid var(--line); background: var(--bg-2); }
.spec-wrap .spec { border-bottom: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.spec[data-cols="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.project-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 760px);
  justify-content: space-between;
  gap: 64px;
  padding-top: 72px;
  padding-bottom: 96px;
}

.toc {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 64px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.toc__title {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a {
  display: block;
  margin-left: -1px;
  padding: 5px 0 5px 14px;
  border-left: 1px solid transparent;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
}
.toc a:hover { color: var(--text); }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent); }
.toc .toc__sub a { padding-left: 28px; font-size: 12.5px; }

/* ---------- Prose ---------- */

.prose { min-width: 0; color: var(--text-2); overflow-wrap: break-word; }
.prose h2, .prose h3, .prose h4 { overflow-wrap: anywhere; }
.prose > * + * { margin-top: 20px; }

.prose h2 {
  position: relative;
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: clamp(28px, 3.4vw, 36px);
  letter-spacing: -0.03em;
  color: var(--text);
}
.prose > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h2::before {
  content: attr(data-num);
  display: block;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.prose h3 { margin-top: 48px; font-size: 22px; letter-spacing: -0.02em; color: var(--text); }
.prose h4 { margin-top: 36px; font-size: 17px; font-family: var(--font-mono); font-weight: 600; letter-spacing: 0; color: var(--text); }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 16px; }

.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--text); }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(255, 181, 71, 0.4); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }

.prose ul, .prose ol { padding-left: 0; list-style: none; }
.prose li { position: relative; padding-left: 24px; }
.prose li + li { margin-top: 8px; }
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 6px;
  height: 6px;
  background: var(--accent);
  transform: rotate(45deg);
  opacity: 0.85;
}
.prose ul ul { margin-top: 8px; }
.prose ul ul > li::before { background: transparent; border: 1px solid var(--muted); opacity: 1; }
.prose ol { counter-reset: step; }
.prose ol > li { counter-increment: step; padding-left: 36px; }
.prose ol > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.12em;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

/* inline identifiers */
.prose code {
  padding: 0.12em 0.4em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  font-size: 0.86em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.prose pre code {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: inherit;
  color: inherit;
  overflow-wrap: normal;
}

.prose .lead { font-size: 19px; color: var(--text); line-height: 1.65; }

.takeaway {
  padding: 16px 20px;
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: linear-gradient(90deg, var(--accent-soft), transparent 80%);
  color: var(--text);
}

.defs { display: grid; gap: 12px; }
.defs > div { padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.defs dt { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--text); }
.defs dd { margin: 6px 0 0; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare > div { padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.compare h5 { margin: 0 0 8px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.compare p + p, .compare p + ul, .compare ul + p { margin-top: 10px; }

/* ---------- Figures ---------- */

.fig { margin: 36px 0; }
.fig__frame {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0) 0 0 / 16px 16px,
    var(--bg-2);
  overflow: hidden;
}
.fig__frame button {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  min-width: 0;
}
.fig img { max-height: 560px; width: auto; margin: 0 auto; }
.fig--wide .fig__frame { padding: 0; }
.fig--wide img { width: 100%; max-height: none; }
.fig--pad .fig__frame { padding: 20px; }
.fig--pad img { border-radius: 4px; }
.fig--row .fig__frame { flex-direction: column; padding: 16px; }
.fig--row img { border-radius: 4px; }
.fig figcaption {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}
.fig figcaption::before { content: "fig." attr(data-n); color: var(--accent); white-space: nowrap; }

/* ---------- Code ---------- */

.code {
  margin: 32px 0;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #0c0f13;
  overflow: hidden;
}
.code__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 40px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.code__lang { color: var(--accent); }
.code__name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code__copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.code__copy:hover { color: var(--text); border-color: var(--line-2); }
.code__copy svg { width: 14px; height: 14px; }
.code pre { margin: 0; padding: 18px 20px 20px; overflow-x: auto; font-size: 13.5px; line-height: 1.7; color: #d6dbe2; tab-size: 4; }
.code figcaption { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 14px; font-style: italic; color: var(--muted); }

.tok-k { color: var(--tok-keyword); }
.tok-t { color: var(--tok-type); }
.tok-f { color: var(--tok-func); }
.tok-s { color: var(--tok-string); }
.tok-n { color: var(--tok-number); }
.tok-c { color: var(--tok-comment); font-style: italic; }
.tok-p { color: var(--tok-punct); }

/* ---------- Video facade ---------- */

.video {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
}
.video iframe, .video button { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video button { padding: 0; background: #000; cursor: pointer; color: #fff; }
.video button img { width: 100%; height: 100%; object-fit: cover; opacity: 0.72; transition: opacity 0.2s, transform 0.4s; }
.video button:hover img { opacity: 0.9; transform: scale(1.02); }
.video__play {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 10px rgba(255, 181, 71, 0.2);
  transition: transform 0.2s;
}
.video button:hover .video__play { transform: scale(1.06); }
.video__play svg { width: 28px; height: 28px; margin-left: 4px; }
.video__note {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 2px #000;
}

/* ---------- Project CTA & pager ---------- */

.project-cta {
  margin-top: 80px;
  padding: 32px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background:
    radial-gradient(ellipse at top right, rgba(255, 181, 71, 0.1), transparent 60%),
    var(--surface);
}
.project-cta h2 { margin: 0 0 18px; padding: 0; border: 0; font-size: 22px; }
.project-cta h2::before { display: none; }
.project-cta dl { display: grid; gap: 12px; margin: 0 0 24px; }
.project-cta dl div { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.project-cta dt { color: var(--text); font-weight: 600; }
.project-cta dd { margin: 0; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-bottom: 96px; }
.pager a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.2s, background-color 0.2s;
}
.pager a:hover { border-color: rgba(255, 181, 71, 0.45); background: var(--surface-2); }
.pager span { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pager strong { font-size: 20px; letter-spacing: -0.02em; }
.pager .pager__next { text-align: right; }

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 24px;
  border: 0;
  background: rgba(5, 6, 8, 0.94);
  color: var(--text);
}
.lightbox[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.lightbox::backdrop { background: transparent; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); width: auto; object-fit: contain; border-radius: 6px; }
.lightbox p { max-width: 70ch; text-align: center; font-family: var(--font-mono); font-size: 13px; color: var(--text-2); }
.lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.lightbox__close svg { width: 18px; height: 18px; }

/* ---------- Simple pages ---------- */

.page-hero { padding: 88px 0 56px; border-bottom: 1px solid var(--line); }
.page-hero h1 { margin-top: 16px; font-size: clamp(44px, 6.4vw, 76px); font-weight: 800; letter-spacing: -0.045em; }
.page-hero p { margin-top: 18px; color: var(--text-2); font-size: 18.5px; max-width: 36em; }

.error-page { min-height: calc(100vh - var(--header-h) - 150px); display: grid; place-items: center; text-align: center; padding: 96px 0; }
.error-page .code-num { font-family: var(--font-mono); font-size: 14px; color: var(--accent); }
.error-page h1 { margin: 14px 0 16px; font-size: clamp(36px, 5vw, 56px); }
.error-page p { color: var(--text-2); margin-bottom: 32px; }
.error-page .btn-row { justify-content: center; }

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

@media (max-width: 1080px) {
  .project-layout { grid-template-columns: minmax(0, 1fr); padding-top: 56px; }
  .toc { display: none; }
  .spec, .spec[data-cols="5"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .spec div:nth-child(3n) { border-right: 0; }
  .spec div:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .spec[data-cols="5"] div:nth-child(5) { border-right: 0; }
  .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero { padding: 72px 0 72px; }
  .hero__grid, .project-hero__grid, .about { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .hero .panel { transform: none; }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .section { padding: 88px 0; }
}

@media (max-width: 600px) {
  :root { --gutter: 16px; }
  body { font-size: 16.5px; }
  .hero__lede { font-size: 17.5px; }
  .brand__name { display: none; }
  .section { padding: 72px 0; }
  .section-head { margin-bottom: 32px; }
  .card__body { padding: 20px; }
  .card__title { font-size: 24px; }
  .spec, .spec[data-cols="5"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec div { padding: 16px; border-top: 1px solid var(--line); border-right: 1px solid var(--line) !important; }
  .spec div:nth-child(2n) { border-right: 0 !important; }
  .spec div:nth-child(-n + 2) { border-top: 0; }
  .spec-wrap .container { padding: 0; }
  .spec-wrap .spec { border-left: 0; border-right: 0; }
  .contact-grid { grid-template-columns: minmax(0, 1fr); }
  .compare { grid-template-columns: minmax(0, 1fr); }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager .pager__next { text-align: left; }
  .project-cta { padding: 24px; }
  .code pre { font-size: 12.5px; padding: 16px; }
  .fig img { max-height: 520px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .card:hover, .card:hover .card__media img { transform: none; }
}
