/* CursedAtom.dev — polished editorial system */

@import url("https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap");

:root {
  --bg: #0b0c0f;
  --bg-2: #12141a;
  --surface: #161922;
  --surface-2: #1c2030;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f0f1f4;
  --muted: #959baa;
  --accent: #8b9cff;
  --accent-hover: #a8b5ff;
  --accent-soft: rgba(139, 156, 255, 0.12);
  --accent-glow: rgba(139, 156, 255, 0.22);
  --ok: #3ecf8e;
  --warn: #e8a838;
  --code-bg: #0e1016;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 48px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.28);
  --header-h: 3.75rem;
  --footer-h: 2.5rem;
  --max: 42rem;
  --max-wide: 72rem;
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --hero-img: url("/media/heroes/clifford.jpg");
  --bg-img: url("/media/heroes/halvorsen.jpg");
  --ambient-a: url("/media/heroes/hofstadter.jpg");
  --ambient-b: url("/media/heroes/nebula.jpg");
  --bg-opacity: 0.32;
  --ambient-opacity: 0.2;
  color-scheme: dark;
}

html.light {
  --bg: #f4f2ed;
  --bg-2: #ebe8e1;
  --surface: #fffcf7;
  --surface-2: #f7f4ee;
  --border: rgba(28, 24, 18, 0.1);
  --border-strong: rgba(28, 24, 18, 0.16);
  --text: #1a1814;
  --muted: #5c574e;
  --accent: #3d4fd4;
  --accent-hover: #2a39b0;
  --accent-soft: rgba(61, 79, 212, 0.1);
  --accent-glow: rgba(61, 79, 212, 0.16);
  --ok: #0d8a55;
  --warn: #a65f00;
  --code-bg: #f0ede6;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 16px 40px rgba(40, 32, 18, 0.08);
  --shadow-sm: 0 8px 20px rgba(40, 32, 18, 0.07);
  --bg-opacity: 0.4;
  --ambient-opacity: 0.22;
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
}

/* Attractor media stack — Halvorsen base + Hofstadter/nebula ambient */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 22%, transparent) 0%, color-mix(in srgb, var(--bg) 62%, transparent) 100%),
    var(--bg-img) center / cover no-repeat;
  opacity: var(--bg-opacity);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 55% at 12% 88%, var(--accent-glow), transparent 55%),
    linear-gradient(180deg, transparent 28%, color-mix(in srgb, var(--bg) 42%, transparent) 100%),
    var(--ambient-b) 70% 20% / cover no-repeat,
    var(--ambient-a) center / cover no-repeat;
  opacity: var(--ambient-opacity);
  mix-blend-mode: screen;
}

html.light body::before {
  background:
    linear-gradient(180deg, rgba(244, 242, 237, 0.18) 0%, rgba(244, 242, 237, 0.52) 100%),
    var(--bg-img) center / cover no-repeat;
}

html.light body::after {
  mix-blend-mode: normal;
  opacity: var(--ambient-opacity);
}

body > * {
  position: relative;
  z-index: 1;
}

/* Homepage: Dadras attractor */
body[data-bg="dadras"] {
  --bg-img: url("/media/heroes/dadras.jpg");
}

/* Opt out of photo layers when needed */
body[data-bg="none"]::before,
body[data-bg="none"]::after {
  display: none;
}

/* Soft gradient fallback only when media is disabled */
body[data-bg="none"] {
  background:
    radial-gradient(ellipse 70% 50% at 10% -10%, var(--accent-glow), transparent 55%),
    radial-gradient(ellipse 55% 45% at 95% 15%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 50%),
    var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s var(--ease);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:focus-visible,
button:focus-visible,
.select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.12em 0.4em;
}

pre {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  overflow-x: auto;
}

pre code {
  border: 0;
  background: none;
  padding: 0;
}

/* ── Header ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
}

.brand {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.brand::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex-shrink: 0;
}

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

.nav-toggle {
  display: none;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.nav-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.site-nav a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.site-nav a:hover {
  color: var(--text);
  background: var(--accent-soft);
  text-decoration: none;
}

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

.site-nav a.nav-photography[hidden] {
  display: none !important;
}

/* ── Layout ─────────────────────────────────────────── */
.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4.5rem;
}

.site-main--narrow {
  max-width: var(--max);
}

.site-main--wide {
  max-width: var(--max-wide);
}

/* ── Hero — full-bleed Clifford attractor ────────────── */
.hero {
  position: relative;
  min-height: clamp(280px, 42vh, 440px);
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  max-width: none;
  margin: 0;
  padding: 0;
}

.hero__bg {
  display: block;
  position: absolute;
  inset: 0;
  background: var(--hero-img) center / cover no-repeat;
  transform: scale(1.02);
}

.hero__veil {
  display: block;
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(11, 12, 15, 0.12) 0%, rgba(11, 12, 15, 0.48) 50%, rgba(11, 12, 15, 0.92) 100%),
    linear-gradient(90deg, rgba(11, 12, 15, 0.62) 0%, transparent 58%);
}

html.light .hero__veil {
  background:
    linear-gradient(180deg, rgba(244, 242, 237, 0.18) 0%, rgba(244, 242, 237, 0.52) 48%, rgba(244, 242, 237, 0.94) 100%),
    linear-gradient(90deg, rgba(244, 242, 237, 0.72) 0%, transparent 60%);
}

.hero__copy {
  position: relative;
  z-index: 1;
  max-width: var(--max-wide);
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 2.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.hero__eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-hover);
  margin: 0;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.4);
}

.hero h1 {
  font-size: clamp(2.1rem, 5.5vw, 3.15rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
  margin: 0;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.5);
  max-width: 16ch;
}

.hero .deck {
  margin: 0;
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
  font-size: clamp(1.05rem, 2.2vw, 1.18rem);
  max-width: 28rem;
  line-height: 1.55;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.4);
  font-weight: 400;
}

/* ── Panels ──────────────────────────────────────────── */
.panel {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 3.5vw, 2rem);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
}

.panel--glow {
  box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--accent) 10%, color-mix(in srgb, var(--surface) 90%, transparent));
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
}

html.light .panel,
html.light .file-card,
html.light .table-wrap,
html.light .detail-panel,
html.light .code-viewer__toolbar {
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
}

.panel > :first-child {
  margin-top: 0;
}

.panel > :last-child {
  margin-bottom: 0;
}

.section-title {
  font-size: clamp(1.45rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.85rem;
  line-height: 1.2;
}

.lede {
  color: var(--muted);
  margin: 0 0 1.35rem;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ── Lists ───────────────────────────────────────────── */
.ink-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ink-list li {
  display: flex;
  gap: 0.9rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  align-items: flex-start;
}

.ink-list li:first-child {
  padding-top: 0.15rem;
}

.ink-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.ink-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 0.55rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.ink-list b,
.ink-list strong {
  font-weight: 600;
  color: var(--text);
}

/* ── Link stack ──────────────────────────────────────── */
.link-stack {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.link-stack a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease);
}

.link-stack a::after {
  content: "→";
  color: var(--muted);
  font-family: var(--mono);
  transition: color 0.15s var(--ease), transform 0.15s var(--ease);
}

.link-stack a:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
  color: var(--text);
  text-decoration: none;
  transform: translateY(-1px);
}

.link-stack a:hover::after {
  color: var(--accent);
  transform: translateX(3px);
}

/* ── Collapsibles ────────────────────────────────────── */
.collapse {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.55rem;
  overflow: hidden;
  background: var(--bg-2);
  transition: border-color 0.15s var(--ease);
}

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

.collapse__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.05rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.collapse__trigger:hover {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.collapse.is-open .collapse__trigger {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.collapse__chevron {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1;
  transition: color 0.15s var(--ease), transform 0.2s var(--ease);
}

.collapse.is-open .collapse__chevron {
  color: var(--accent);
  transform: rotate(45deg);
}

.collapse__panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s var(--ease);
}

.collapse__body {
  padding: 0 1.05rem 1.05rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.collapse.is-open .collapse__body {
  padding-top: 0.9rem;
}

.collapse__body p {
  margin: 0 0 0.7rem;
}

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

.collapse__body ul {
  margin: 0;
  padding-left: 1.2rem;
}

.collapse__body li + li {
  margin-top: 0.35rem;
}

/* ── Archive ─────────────────────────────────────────── */
.breadcrumbs {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  align-items: center;
}

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

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs .sep {
  opacity: 0.45;
}

.breadcrumbs .current {
  color: var(--text);
}

.status-msg {
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.88rem;
  padding: 2.25rem 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 0.75rem;
}

.file-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.05rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  min-height: 104px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease);
  box-shadow: var(--shadow-sm);
}

.file-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  transform: translateY(-2px);
}

.file-card__kind {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.file-card__name {
  font-size: 0.9rem;
  font-weight: 500;
  word-break: break-word;
  line-height: 1.35;
}

.file-card__ext {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 1.45rem;
  height: 1.45rem;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.75rem;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.file-card__ext:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ── Code viewer ─────────────────────────────────────── */
.code-viewer {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 50vh;
}

.code-viewer.hidden {
  display: none !important;
}

.code-viewer__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.code-viewer__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.85rem;
  min-width: 0;
}

.code-viewer__name {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 600;
  word-break: break-all;
  color: var(--text);
}

.code-viewer__lang {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.18rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-2);
}

.code-viewer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  background: var(--accent-soft);
}

.btn--primary {
  background: var(--accent);
  border-color: transparent;
  color: #0b0c0f;
}

html.light .btn--primary {
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: #0b0c0f;
  border-color: transparent;
}

html.light .btn--primary:hover {
  color: #fff;
}

.code-viewer__pre {
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: min(75vh, 900px);
  background: #0d1117;
  box-shadow: var(--shadow-sm);
}

html.light .code-viewer__pre {
  background: #faf9f6;
}

.code-viewer__pre code {
  display: block;
  padding: 1.15rem 1.25rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  tab-size: 4;
  white-space: pre;
  overflow-x: auto;
}

/* ── Photography ─────────────────────────────────────── */
.photo-header {
  margin-bottom: 1.75rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.photo-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: var(--shadow-sm);
}

.photo-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--bg-2);
  transition: transform 0.35s var(--ease);
}

.photo-card:hover img {
  transform: scale(1.03);
}

.photo-card__cap {
  display: block;
  padding: 0.65rem 0.85rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1.5rem;
  background: rgba(6, 7, 10, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox__figure {
  margin: 0;
  max-width: min(1100px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}

.lightbox__figure img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.lightbox__figure figcaption {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.lightbox__close {
  position: absolute;
  top: 0.85rem;
  right: 1.1rem;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s var(--ease);
}

.lightbox__close:hover {
  opacity: 1;
}

.lightbox__nav {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.75rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s var(--ease);
}

.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.16);
}

@media (max-width: 640px) {
  .lightbox__nav {
    display: none;
  }
}

/* ── Page chrome ─────────────────────────────────────── */
.page-heading {
  font-size: clamp(1.6rem, 3.2vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  margin: 0 0 0.35rem;
}

.page-sub {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.select {
  width: 100%;
  font: inherit;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s var(--ease);
}

.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.detail-panel {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.detail-panel p {
  margin: 0.35rem 0;
}

.detail-panel.hidden,
.hidden {
  display: none !important;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 0.7rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table th:hover {
  color: var(--accent);
}

.data-table th.sort-icon::after {
  content: " ↕";
  opacity: 0.4;
}

.data-table th.sort-asc::after {
  content: " ↑";
  color: var(--accent);
  opacity: 1;
}

.data-table th.sort-desc::after {
  content: " ↓";
  color: var(--accent);
  opacity: 1;
}

.data-table td {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: var(--accent-soft);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.variant-star {
  margin-left: 0.2rem;
  color: var(--ok);
  font-weight: 700;
  cursor: help;
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.72rem;
  white-space: normal;
  max-width: 240px;
  z-index: 20;
  box-shadow: var(--shadow-sm);
}

/* ── 404 — double-pendulum chaos map ─────────────────── */
body.page-404 {
  --bg: #050508;
  background: #050508;
}

body.page-404::before {
  background: url("/media/heroes/dp-ttf.jpg") center / cover no-repeat;
  opacity: 1;
}

body.page-404::after {
  display: none;
}

html.light body.page-404 {
  --bg: #050508;
  --text: #f5f5f7;
  --muted: #c4c4cc;
  --accent: #ffb347;
  --accent-hover: #ffd08a;
  color-scheme: dark;
}

html.light body.page-404::before {
  background: url("/media/heroes/dp-ttf.jpg") center / cover no-repeat;
  opacity: 1;
}

body.page-404 .site-header {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.08);
  backdrop-filter: none;
}

body.page-404 .site-footer {
  background: transparent;
  border-top-color: rgba(255, 255, 255, 0.08);
  color: rgba(245, 245, 247, 0.55);
}

body.page-404 .brand,
body.page-404 .site-nav a {
  color: rgba(245, 245, 247, 0.9);
}

body.page-404 .brand::before {
  background: #ffb347;
  box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.2);
}

body.page-404 .site-nav a:hover,
body.page-404 .site-nav a[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.error-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Keep copy inside the dark central void of the cover-scaled image */
  min-height: calc(100vh - var(--header-h) - 4rem);
  padding: 2rem 1.25rem 3rem;
  text-align: center;
}

.error-eye {
  max-width: min(22rem, 70vw);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #f5f5f7;
}

.error-code {
  font-family: var(--mono);
  font-size: clamp(3.75rem, 14vw, 6.5rem);
  font-weight: 700;
  line-height: 0.95;
  margin: 0 0 0.55rem;
  letter-spacing: -0.05em;
  color: #fff;
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  -webkit-text-fill-color: #fff;
  text-shadow: 0 0 40px rgba(255, 120, 40, 0.35);
}

.error-title {
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 0.65rem;
  color: #f5f5f7;
}

.error-msg {
  margin: 0 0 1.25rem;
  color: rgba(245, 245, 247, 0.72);
  font-size: 1.02rem;
  line-height: 1.5;
}

.error-back a {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: #ffb347;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 179, 71, 0.4);
  padding-bottom: 0.1rem;
}

.error-back a:hover {
  color: #ffd08a;
  border-bottom-color: #ffd08a;
  text-decoration: none;
}

/* ── Prose ───────────────────────────────────────────── */
.prose h2 {
  font-size: 1.22rem;
  margin: 1.6rem 0 0.6rem;
  letter-spacing: -0.025em;
}

.prose h3 {
  font-size: 1.05rem;
  margin: 1.25rem 0 0.45rem;
}

.prose p {
  color: var(--muted);
  margin: 0 0 0.95rem;
}

.prose ol,
.prose ul {
  color: var(--muted);
  padding-left: 1.2rem;
}

.prose li + li {
  margin-top: 0.4rem;
}

.prose img {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0.7rem 0;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.disclaimer {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
}

.cta-line {
  margin-top: 1.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.tldr {
  margin-top: 1.2rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  font-weight: 600;
  color: var(--text);
}

/* ── Footer ──────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-2) 70%, transparent);
  height: var(--footer-h);
  min-height: var(--footer-h);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

/* ── Theme toggle — vertically centered in footer band ─ */
.theme-toggle {
  --toggle-h: 1.7rem;
  position: fixed;
  bottom: calc((var(--footer-h) - var(--toggle-h)) / 2);
  right: 0.75rem;
  z-index: 100;
  height: var(--toggle-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0 0.85rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle .label-dark {
  display: none;
}

html.dark .theme-toggle .label-light,
html:not(.light) .theme-toggle .label-light {
  display: none;
}

html.dark .theme-toggle .label-dark,
html:not(.light) .theme-toggle .label-dark {
  display: inline;
}

html.light .theme-toggle .label-light {
  display: inline;
}

html.light .theme-toggle .label-dark {
  display: none;
}

.mobile-only {
  display: none;
}

.desktop-only {
  display: block;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: inline-block;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 1rem 0.9rem;
    box-shadow: var(--shadow-sm);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 0.65rem 0.9rem;
  }

  .error-eye {
    max-width: min(18rem, 78vw);
  }

  .mobile-only {
    display: block;
  }

  .desktop-only {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .photo-card:hover img,
  .link-stack a:hover,
  .file-card:hover,
  .photo-card:hover {
    transform: none;
  }
}
