/* ============================================================
   Synthetic Memories — Archive
   Aesthetic: dark constellation atlas. Near-black ground, cool
   white/blue/violet ink, faint starfield grain — a nod to the
   diffraction-star mark and to Warburg's black boards threaded
   with connections.
   ============================================================ */

:root {
  --paper: #0c0d13;
  --paper-2: #14151f;
  --paper-3: #1c1e2c;
  --ink: #eef0fa;
  --ink-soft: #a7abc7;
  --ink-faint: #666b8c;
  --accent: #7c8cff;
  --accent-soft: #a6b3ff;
  --line: rgba(238, 240, 250, 0.09);
  --line-strong: rgba(238, 240, 250, 0.20);

  --c-log: #eef0fa;
  --c-research: #5f8dfd;
  --c-project: #8c7bfb;
  --c-reference: #b16bf5;
  --c-note: #8b90b3;
  --c-experiment: #e2a13f;
  --c-stub: #565b7c;
  --c-tag: #9099e0;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 3px;
  --shadow-card: 0 10px 32px -10px rgba(0, 0, 0, 0.65), 0 1px 0 rgba(238,240,250,0.04);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::selection { background: var(--accent); color: #05060a; }

/* subtle grain -- screen blend so it reads as starlight speckle on dark */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.05;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.app {
  height: 100vh;
  height: 100dvh; /* mobile Safari: accounts for the collapsing toolbar */
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-strong);
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 6px rgba(124, 140, 255, 0.45));
}

.brand-text h1 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: 21px;
  letter-spacing: 0.01em;
  margin: 0;
  line-height: 1;
  background: linear-gradient(120deg, var(--ink) 0%, var(--accent-soft) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  margin: 3px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-stats {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-stats b { color: var(--ink-soft); font-weight: 600; }

/* ---------- Panes ---------- */

.panes {
  flex: 1;
  min-height: 0;
  display: flex;
}

.graph-pane {
  position: relative;
  flex: 1 1 60%;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 900px 600px at 30% 20%, rgba(124,140,255,0.08), transparent 60%),
    radial-gradient(ellipse 700px 500px at 80% 80%, rgba(177,107,245,0.06), transparent 60%),
    radial-gradient(circle at 1px 1px, rgba(238,240,250,0.05) 1px, transparent 0) 0 0/24px 24px,
    var(--paper);
}

#graph { width: 100%; height: 100%; display: block; cursor: grab; }
#graph:active { cursor: grabbing; }

.reader-pane {
  flex: 0 0 clamp(360px, 33vw, 500px);
  border-left: 1px solid var(--line-strong);
  background: var(--paper-2);
  overflow-y: auto;
  position: relative;
}

/* ---------- Graph toolbar ---------- */

.graph-toolbar {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  left: calc(16px + env(safe-area-inset-left));
  display: flex;
  gap: 8px;
  z-index: 10;
  flex-wrap: wrap;
  max-width: calc(100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right));
}

.pill-btn {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 7px 12px;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 2px 10px -4px rgba(0,0,0,0.5);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, transform .1s, border-color .15s;
}
.pill-btn:hover { background: var(--paper-3); border-color: var(--accent); }
.pill-btn:active { transform: scale(0.96); }
.pill-btn-icon { padding: 7px 10px; width: 32px; justify-content: center; }
.pill-btn .ico { font-size: 12px; }

/* ---------- Tooltip ---------- */

.tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 30;
  background: #05060a;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 11px;
  line-height: 1.4;
  max-width: 240px;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity .1s;
  box-shadow: var(--shadow-card);
}
.tooltip.visible { opacity: 0.98; }
.tooltip .tt-title { font-family: var(--font-display); font-size: 12.5px; font-weight: 500; }
.tooltip .tt-meta { color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; font-size: 9.5px; margin-top: 2px; }

/* ---------- Filter panel (floating overlay) ---------- */

.filter-panel {
  position: absolute;
  left: calc(16px + env(safe-area-inset-left));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(260px, calc(100vw - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-height: calc(100% - 90px - env(safe-area-inset-bottom));
  background: rgba(20, 21, 31, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-tabs {
  display: flex;
  align-items: stretch;
  background: var(--paper-3);
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 12px;
  cursor: pointer;
  flex: 1;
  text-align: left;
}
.tab-btn:hover { color: var(--ink-soft); }
.tab-btn.active { color: var(--accent-soft); border-bottom-color: var(--accent); }

.chev-toggle {
  background: none;
  border: none;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.chev { transition: transform .15s; color: var(--ink-faint); }
.filter-panel.collapsed .chev { transform: rotate(-90deg); }
.filter-panel.collapsed .filter-panel-body { display: none; }

.filter-panel-body {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filter-group { display: flex; flex-direction: column; gap: 6px; }

.filter-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.filter-label-count { color: var(--accent-soft); }

.search-input, .date-range input, .sort-select {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  padding: 7px 9px;
  width: 100%;
  color-scheme: dark;
}
.search-input:focus, .date-range input:focus { outline: 1.5px solid var(--accent); outline-offset: -1px; }

.date-range { display: flex; align-items: center; gap: 6px; }
.date-range input { flex: 1; padding: 6px 7px; font-size: 11px; }
.date-sep { color: var(--ink-faint); }

.type-chips { display: flex; flex-direction: column; gap: 4px; }

.type-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: var(--radius);
  user-select: none;
}
.type-chip:hover { background: var(--paper-3); }
.type-chip input { accent-color: var(--accent); }
.type-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 6px currentColor; }
.type-chip-label { flex: 1; text-transform: capitalize; }
.type-chip-count { color: var(--ink-faint); font-size: 10px; }
.type-chip.dimmed { opacity: 0.45; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.toggle-row input { accent-color: var(--accent); }

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 140px;
  overflow-y: auto;
  padding-right: 2px;
}

.tag-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent-soft); }
.tag-chip.active { background: var(--accent); border-color: var(--accent); color: #05060a; }

.reset-btn {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  align-self: flex-start;
}
.reset-btn:hover { border-color: var(--accent); color: var(--accent-soft); }

/* ---------- List drawer ---------- */

.list-drawer {
  position: absolute;
  inset: 0;
  background: var(--paper);
  z-index: 15;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  border-right: 1px solid var(--line-strong);
}
.list-drawer.open { transform: translateX(0); }

.list-drawer-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--paper-2);
}
.list-drawer-header h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  margin: 0;
  color: var(--ink);
}
.list-count { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); font-weight: 400; }

.list-drawer-controls { display: flex; align-items: center; gap: 8px; }
.sort-select { width: auto; padding: 6px 8px; font-size: 11px; }
.icon-btn {
  background: none; border: 1px solid var(--line-strong); color: var(--ink-soft);
  width: 28px; height: 28px; border-radius: var(--radius); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-soft); }

.list-drawer-body { flex: 1; overflow-y: auto; padding: 8px 12px 40px; }

.note-row {
  display: flex;
  gap: 12px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  align-items: flex-start;
}
.note-row:hover { background: var(--paper-2); }
.note-row-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; box-shadow: 0 0 6px currentColor; }
.note-row-main { flex: 1; min-width: 0; }
.note-row-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 3px;
}
.note-row-meta {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 5px;
}
.note-row-excerpt {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}
.note-row-tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.note-row-tags span {
  font-size: 9.5px;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 1px 6px;
}
.list-empty { padding: 40px 20px; text-align: center; color: var(--ink-faint); font-size: 12px; }

/* ---------- Reader pane ---------- */

.reader-inner { padding: 28px 30px 60px; }

.reader-empty {
  height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-faint);
  gap: 10px;
  padding: 20px;
}
.reader-empty .mark { width: 30px; height: 30px; opacity: 0.85; }
.reader-empty p { max-width: 260px; font-size: 12px; line-height: 1.6; }

.note-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  padding: 3px 10px 3px 8px;
}
.note-type-badge .type-dot { width: 7px; height: 7px; }

.note-date {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}

.reader-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.reader-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.15;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.reader-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.reader-tags .tag-chip { cursor: default; }
.reader-tags .tag-chip:hover { border-color: var(--line-strong); color: var(--ink-soft); }

.reader-extra {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 14px;
  font-size: 11.5px;
}
.reader-extra dt { color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; font-size: 10px; }
.reader-extra dd { margin: 0; color: var(--ink-soft); }
.reader-extra a { color: var(--accent-soft); }

.reader-body {
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--ink);
}
.reader-body h1, .reader-body h2, .reader-body h3 {
  font-weight: 500;
  margin: 1.6em 0 0.5em;
  line-height: 1.3;
  color: var(--ink);
}
.reader-body h2 { font-size: 19px; }
.reader-body h3 { font-size: 16.5px; }
.reader-body p { margin: 0 0 1.1em; }
.reader-body ul, .reader-body ol { margin: 0 0 1.1em; padding-left: 1.3em; }
.reader-body li { margin-bottom: 0.4em; }
.reader-body blockquote {
  margin: 0 0 1.1em;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}
.reader-body strong { font-weight: 600; color: var(--ink); }
.reader-body em { font-style: italic; }
.reader-body code {
  font-family: var(--font-mono);
  background: var(--paper-3);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.85em;
  color: var(--accent-soft);
}
.reader-body hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }
.reader-body sup { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); }

.embedded-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.2em 0;
  border: 1px solid var(--line-strong);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.7);
  opacity: 0.94;
}

.wikilink {
  color: var(--accent-soft);
  text-decoration: none;
  border-bottom: 1px solid rgba(166, 179, 255, 0.4);
  cursor: pointer;
}
.wikilink:hover { background: rgba(124,140,255,0.12); }
.wikilink-stub {
  color: var(--ink-faint);
  border-bottom: 1px dashed var(--line-strong);
}
.wikilink-stub:hover { color: var(--ink-soft); background: var(--paper-3); }

.backlinks {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line-strong);
}
.backlinks h3 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 10px;
  font-weight: 500;
}
.backlink-item {
  display: block;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
}
.backlink-item:hover .backlink-title { color: var(--accent-soft); }
.backlink-title { font-family: var(--font-display); font-size: 14px; }
.backlink-excerpt { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.no-backlinks { font-size: 11.5px; color: var(--ink-faint); font-style: italic; }

.stub-notice {
  background: var(--paper-3);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 20px;
  line-height: 1.6;
}

/* ---------- Graph SVG elements ---------- */

.link-line { stroke: var(--ink-faint); stroke-opacity: 0.4; }
.link-line.stub { stroke-dasharray: 2 3; }
.link-line.tag { stroke: var(--c-tag); stroke-opacity: 0.55; stroke-width: 0.9px; }

.node circle { stroke: var(--paper); stroke-width: 1.5px; cursor: pointer; }
.node.stub circle { fill: transparent; stroke: var(--c-stub); stroke-width: 1.2px; stroke-dasharray: 2 2; }
.node.tag circle { stroke: var(--paper); stroke-width: 1px; fill-opacity: 0.9; cursor: pointer; }
.node.tag.active circle { stroke: var(--accent); stroke-width: 2px; fill-opacity: 1; }
.node text {
  font-family: var(--font-mono);
  font-size: 8.5px;
  fill: var(--ink-soft);
  pointer-events: none;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 3px;
}
.node.selected circle { stroke: var(--accent); stroke-width: 2.5px; }
.node circle { filter: drop-shadow(0 0 3px rgba(124,140,255,0.15)); }

/* ---------- Scrollbars ---------- */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

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

.mobile-back-btn { display: none; }

@media (max-width: 860px) {
  .reader-pane { position: absolute; inset: 0; z-index: 25; transform: translateX(100%); transition: transform .22s; }
  .reader-pane.open { transform: translateX(0); }
  .graph-pane { flex: 1 1 100%; }
  .mobile-back-btn {
    display: block;
    position: sticky;
    top: 0;
    z-index: 5;
    width: 100%;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 12px 20px;
    background: var(--paper-3);
    border: none;
    border-bottom: 1px solid var(--line-strong);
    color: var(--ink-soft);
    cursor: pointer;
  }
}


/* ---------- Tuning sliders (Preview tab) ---------- */

.tune-slider {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}


/* ============================================================
   Experiments — the screen works, living inside the archive
   ============================================================ */

/* --- topbar view switch --- */

.view-switch {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  overflow: hidden;
  background: var(--paper);
}

.view-switch button {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  border: 0;
  color: var(--ink-faint);
  padding: 6px 14px;
  cursor: pointer;
  transition: color .15s, background .15s;
}

.view-switch button:hover { color: var(--ink); }

.view-switch button.active {
  color: #05060a;
  background: var(--ink-soft);
}

.view-switch button.active.is-exp { background: var(--c-experiment); }

/* --- gallery --- */

.gallery-pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--paper);
  display: none;
}

body.view-experiments .panes { display: none; }
body.view-experiments .gallery-pane { display: block; }

.gallery-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 32px 90px;
}

.gallery-lede {
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 26px;
  margin-bottom: 40px;
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
}

.gallery-lede h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

.gallery-lede p {
  margin: 0;
  max-width: 62ch;
  color: var(--ink-soft);
  line-height: 1.65;
  font-size: 12.5px;
}

.gallery-lede .gallery-note {
  margin-top: 12px;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.gallery-meta {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.9;
  text-align: right;
  white-space: nowrap;
}

.gallery-meta b { color: var(--c-experiment); font-weight: 500; }

.gallery-question {
  margin: 44px 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.gallery-question .qn {
  display: block;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-experiment);
  margin-bottom: 8px;
}

.gallery-question .qt {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink);
  max-width: 72ch;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 22px;
}

.exp-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}

.exp-card:hover {
  border-color: var(--c-experiment);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.exp-still {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #05060a;
  overflow: hidden;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.exp-still img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.9);
  transition: opacity .2s, transform 6s ease-out;
}

.exp-card:hover .exp-still img { opacity: 0.72; transform: scale(1.03); }

.exp-run {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .18s;
}

.exp-card:hover .exp-run { opacity: 1; }

.exp-run span {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #05060a;
  background: var(--c-experiment);
  padding: 8px 16px;
  border-radius: 100px;
}

.exp-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }

.exp-code {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--c-experiment);
  text-transform: uppercase;
}

.exp-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  margin: 3px 0 10px;
  letter-spacing: 0.01em;
}

.exp-desc {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.62;
  margin: 0 0 14px;
  flex: 1;
}

.exp-actions { display: flex; gap: 8px; align-items: center; }

.exp-link {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: color .15s, border-color .15s;
}

.exp-link:hover { color: var(--ink); border-color: var(--c-experiment); }

.gallery-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--ink-faint);
  line-height: 1.7;
}

/* --- experiment hero in the reader --- */

.exp-hero {
  display: block;
  position: relative;
  margin: 0 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: #05060a;
  aspect-ratio: 16 / 9;
  cursor: pointer;
}

.exp-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

.exp-hero .exp-run { opacity: 0; }
.exp-hero:hover .exp-run { opacity: 1; }
.exp-hero:hover img { opacity: 0.7; }

.exp-hero-caption {
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  margin: -8px 0 20px;
  line-height: 1.7;
}

.exp-hero-caption b { color: var(--ink-soft); font-weight: 500; }

.exp-keys {
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 4px;
}

@media (max-width: 720px) {
  .gallery-inner { padding: 24px 16px 70px; }
  .gallery-meta { text-align: left; }
}
