@property --accent-h {
  syntax: '<number>';
  inherits: true;
  initial-value: 195;
}

:root {
  --bg: #0b0e14;
  --bg-drawer: #0f131a;
  --ink: #e8e6df;
  --ink-dim: rgba(232, 230, 223, 0.64);
  --ink-faint: rgba(232, 230, 223, 0.48);
  --rule: rgba(232, 230, 223, 0.14);
  --track: rgba(232, 230, 223, 0.14);
  --accent-h: 195;
  --accent: hsl(var(--accent-h) 48% 58%);
  --accent-soft: hsla(var(--accent-h), 48%, 58%, 0.16);
  --font-display: 'Fraunces', serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  position: relative;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  overflow-x: hidden;
}

.log-texture {
  position: fixed; inset: 0; z-index: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='128'%3E%3Ctext x='0' y='18' font-family='monospace' font-size='11' fill='%23e8e6df'%3E0x1F3A9  wal.append  seq%3D88231  ok%3C/text%3E%3Ctext x='0' y='46' font-family='monospace' font-size='11' fill='%23e8e6df'%3E0x1F3AA  wal.fsync   seq%3D88232  ok%3C/text%3E%3Ctext x='0' y='74' font-family='monospace' font-size='11' fill='%23e8e6df'%3E0x1F3AB  wal.commit  seq%3D88233  ok%3C/text%3E%3Ctext x='0' y='102' font-family='monospace' font-size='11' fill='%23e8e6df'%3E0x1F3AC  wal.append  seq%3D88234  ok%3C/text%3E%3C/svg%3E");
  animation: tail 14s linear infinite;
  pointer-events: none;
}
@keyframes tail { from { background-position-y: 0; } to { background-position-y: -128px; } }

.wash {
  position: fixed; z-index: 1; pointer-events: none;
  width: 85vw; height: 85vw; max-width: 640px; max-height: 640px;
  top: -12vw; left: -8vw;
  background: radial-gradient(circle, hsla(var(--accent-h), 55%, 55%, 0.15), transparent 70%);
  transition: background 0.3s ease;
}

.grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0.045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- base (also mobile): natural flow, free to scroll if it must ---- */
.screen { position: relative; }

.frame {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
}

.sidebar {
  position: relative; z-index: 3;
  padding: 1.25rem 0 1.5rem;
  display: flex; flex-direction: column; gap: 0.9rem;
}

.sidebar-header {
  padding-bottom: 0.5rem;
}

.wordmark { font-family: var(--font-mono); font-size: 0.95rem; color: var(--ink-dim); }

.side-label {
  font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-faint); margin-bottom: 0.5rem;
}

.side-divider { height: 1px; background: var(--rule); }

.index { display: flex; flex-direction: column; }
.index-item {
  display: flex; align-items: center; gap: 0.6rem;
  background: none; border: none; text-align: left; cursor: pointer;
  padding: 0.6rem 0.2rem;
  margin: 0 -0.2rem;
  min-height: 44px;
  font-family: var(--font-mono);
  color: var(--ink-faint);
  transition: color 0.25s ease;
}
.index-item:hover { color: var(--ink-dim); }
.index-item.active { color: var(--ink); }
.index-item.active .index-lsn { color: var(--accent); }
.index-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.index-lsn { font-size: 0.7rem; letter-spacing: 0.04em; transition: color 0.5s ease; }
.index-label { font-size: 0.82rem; }

.contact-block { display: flex; flex-direction: column; }
.contact-row {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--ink-dim); text-decoration: none;
  font-family: var(--font-mono); font-size: 0.8rem;
  padding: 0.28rem 0;
  transition: color 0.25s ease;
}
.contact-row svg { color: var(--ink-faint); flex-shrink: 0; transition: color 0.25s ease; }
.contact-row:hover, .contact-row:hover svg { color: var(--accent); }
.contact-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.contact-status {
  display: flex; align-items: flex-start; gap: 0.5rem;
  font-size: 0.75rem; color: var(--ink-faint); line-height: 1.5;
  margin-top: 0.45rem;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #5b9279; box-shadow: 0 0 6px #5b9279; flex-shrink: 0; margin-top: 0.4em; }

.main-panel {
  position: relative; z-index: 3;
  display: flex; flex-direction: column;
}

.topbar {
  display: flex; justify-content: flex-end; align-items: center;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}
.counter { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-faint); letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }

.entry-col {
  position: relative;
  min-width: 0;
  padding: 1.5rem 0 0.5rem;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
}
.entry-col::-webkit-scrollbar { display: none; } /* Chrome */

.entry { position: relative; }

.scan { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.scan::before {
  content: '';
  position: absolute; top: -8%; bottom: -8%; width: 2px; left: -2%;
  background: var(--accent);
  box-shadow: 0 0 14px 2px var(--accent), 0 0 32px 8px var(--accent-soft);
  opacity: 0;
}
.scan.scanning::before { animation: scanfwd 0.6s cubic-bezier(.4, 0, .2, 1); }
.scan.scanning.rev::before { animation-name: scanrev; }
@keyframes scanfwd {
  0% { left: -2%; opacity: 0; }
  12% { opacity: 1; }
  85% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}
@keyframes scanrev {
  0% { left: 100%; opacity: 0; }
  12% { opacity: 1; }
  85% { opacity: 1; }
  100% { left: -2%; opacity: 0; }
}

.meta {
  display: flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--ink-faint); letter-spacing: 0.03em;
  margin-bottom: 0.9rem;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transition: background 0.5s ease;
  flex-shrink: 0;
}
.dot.pulse { animation: dotpulse 0.5s ease; }
@keyframes dotpulse {
  0% { box-shadow: 0 0 8px var(--accent); transform: scale(1); }
  35% { box-shadow: 0 0 20px 5px var(--accent); transform: scale(1.7); }
  100% { box-shadow: 0 0 8px var(--accent); transform: scale(1); }
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 500; line-height: 1.15; letter-spacing: -0.005em;
  margin-bottom: 0.9rem;
  margin-left: -0.09em;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.body {
  font-size: 1rem; line-height: 1.6; color: var(--ink-dim);
  max-width: 56ch; margin-bottom: 1.2rem;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.exp-list {
  margin-top: 0.8rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.exp-list li {
  position: relative;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}
.exp-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
}

.metric {
  font-family: var(--font-mono);
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.85em;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; transition: opacity 0.25s ease, transform 0.25s ease; }
.tags span {
  font-family: var(--font-mono); font-size: 0.72rem;
  padding: 0.32rem 0.7rem; border-radius: 5px;
  border: 1px solid var(--accent-soft); color: var(--accent); background: var(--accent-soft);
  transition: color 0.5s ease, background 0.5s ease, border-color 0.5s ease;
}

.entry.fading .meta,
.entry.fading h1,
.entry.fading .body,
.entry.fading .tags { opacity: 0; transform: translateX(14px); }

.entry-col.glitching { animation: glitchJitter 0.32s steps(1, end); }
@keyframes glitchJitter {
  0%, 100% { transform: translateX(0); }
  8% { transform: translateX(-3px); }
  16% { transform: translateX(2px); }
  24% { transform: translateX(-1px); }
  32% { transform: translateX(0); }
  55% { transform: translateX(2px); }
  63% { transform: translateX(0); }
}

.entry.glitching h1 { animation: glitchText 0.32s steps(2, end); }
@keyframes glitchText {
  0%, 100% { text-shadow: none; }
  15% { text-shadow: -2px 0 rgba(255, 70, 70, .7), 2px 0 rgba(70, 220, 255, .7); }
  30% { text-shadow: 2px 0 rgba(255, 70, 70, .6), -2px 0 rgba(70, 220, 255, .6); }
  45% { text-shadow: none; }
  60% { text-shadow: -1px 0 rgba(255, 70, 70, .5), 1px 0 rgba(70, 220, 255, .5); }
  75% { text-shadow: none; }
}

.easter-egg {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 1rem;
  background: rgba(11, 14, 20, 0.85);
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 2vh, 1.1rem);
  letter-spacing: 0.02em;
  color: var(--ink);
  text-shadow: -2px 0 rgba(255, 70, 70, .55), 2px 0 rgba(70, 220, 255, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.easter-egg.show { opacity: 1; }

.panel-footer {
  background: var(--bg);
  position: relative;
  z-index: 5;
  display: flex; flex-direction: column; gap: 1rem;
  padding: 1.5rem 0 1.3rem;
  border-top: 1px solid var(--rule);
}

.artifact {
  display: flex; flex-direction: column; gap: 0.3rem; align-items: flex-start;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--rule); border-radius: 6px;
  background: none; text-align: left; cursor: pointer;
  text-decoration: none; color: var(--ink);
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.3s ease, background 0.3s ease;
  width: max-content; max-width: 100%;
}
.artifact.fading { opacity: 0; transform: translateX(10px); }
.artifact:hover { border-color: var(--accent); background: var(--accent-soft); }
.artifact:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.artifact-kind {
  font-family: var(--font-mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); transition: color 0.5s ease;
}
.artifact-name { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-dim); line-height: 1.3; }
.artifact-link {
  display: flex; align-items: center; gap: 0.3rem;
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint);
  margin-top: 0.1rem; transition: color 0.3s ease;
}
.artifact:hover .artifact-link { color: var(--accent); }
.artifact:hover .artifact-arrow { transform: translate(1px, -1px); }
.artifact-arrow { transition: transform 0.2s ease; }

.controls {
  display: flex; align-items: center; gap: 1.5rem;
  flex-wrap: wrap;
}

.replay-btn {
  display: flex; align-items: center; gap: 0.5rem;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-dim); font-family: var(--font-mono); font-size: 0.8rem;
  padding: 0.6rem 1rem; border-radius: 5px; cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.15s ease;
  flex-shrink: 0;
}
.replay-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.replay-btn:active { transform: scale(0.96); }
.replay-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.seek-wrap { flex: 1; min-width: 160px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 3px; border-radius: 2px;
  background: var(--track);
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  border: 2px solid var(--bg);
  transition: background 0.4s ease, box-shadow 0.4s ease;
  animation: nudgeThumb 1.6s ease-in-out 1.2s 2;
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--bg);
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transition: background 0.4s ease, box-shadow 0.4s ease;
  animation: nudgeThumb 1.6s ease-in-out 1.2s 2;
}
@keyframes nudgeThumb {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); }
  50% { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 14px 3px var(--accent); }
}
input[type="range"]::-moz-range-progress { background: var(--accent); height: 3px; border-radius: 2px; }
input[type="range"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 5px; }

.ticks { display: flex; justify-content: space-between; margin-top: 0.5rem; font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-faint); }
.ticks span { transition: color 0.4s ease; }
.ticks span.active { color: var(--ink-dim); }


/* ---- Drawer (Dialog) ---- */
.drawer {
  margin: 0;
  margin-left: auto; /* push to right */
  height: 100%;
  max-height: 100%;
  width: 100%;
  max-width: 500px;
  border: none;
  background: var(--bg-drawer);
  color: var(--ink);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}
.drawer[open] {
  transform: translateX(0);
}
.drawer::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.drawer[open]::backdrop {
  opacity: 1;
}

.drawer-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.drawer-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--ink);
}
.drawer-close {
  background: none;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem;
  transition: color 0.2s ease;
}
.drawer-close:hover {
  color: var(--accent);
}

.drawer-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink-dim);
}
.drawer-body p { margin-bottom: 1rem; }
.drawer-body ul { margin-left: 1.5rem; margin-bottom: 1rem; }
.drawer-body li { margin-bottom: 0.5rem; }
.drawer-body strong { color: var(--ink); }

.drawer-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--rule);
}
.drawer-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.6rem 1rem;
  border-radius: 5px;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: all 0.2s ease;
}
.drawer-link-btn:hover {
  background: var(--accent);
  color: var(--bg);
}


/* ---- wide enough for IDE split pane ---- */
@media (min-width: 721px) {
  html, body { overflow: hidden; }

  .screen { height: 100vh; overflow: hidden; }

  .wash { width: 55vw; height: 55vw; max-width: 640px; max-height: 640px; }

  .frame {
    height: 100%;
    padding: 0 2rem;
    padding: 0 clamp(1.5rem, 4vw, 3rem);
    flex-direction: row;
    align-items: stretch;
  }

  .sidebar {
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid var(--rule);
    padding: 2rem 2rem 2rem 0;
    padding: clamp(1.5rem, 4vh, 2.5rem) clamp(1.5rem, 2vw, 2.5rem) clamp(1.5rem, 4vh, 2.5rem) 0;
    gap: 1.25rem;
    gap: clamp(1rem, 2.5vh, 1.5rem);
  }

  .main-panel {
    flex: 1;
    min-width: 0;
    height: 100%;
  }

  .topbar { 
    padding: clamp(0.7rem, 2.2vh, 1.2rem) 0 clamp(0.7rem, 2.2vh, 1.2rem) clamp(1.5rem, 3vw, 3.5rem); 
  }

  .entry-col { 
    padding: clamp(1rem, 3vh, 2rem) 0 clamp(1rem, 3vh, 2rem) clamp(1.5rem, 3vw, 3.5rem); 
  }

  .meta { margin-bottom: clamp(0.5rem, 1.4vh, 0.85rem); }

  h1 {
    font-size: clamp(1.5rem, 3.2vh, 2.6rem);
    margin-bottom: clamp(0.55rem, 1.5vh, 0.95rem);
  }

  .body {
    font-size: clamp(0.88rem, 1.75vh, 1rem);
    line-height: 1.55;
    margin-bottom: clamp(0.65rem, 1.7vh, 1.1rem);
  }

  .panel-footer {
  background: var(--bg);
  position: relative;
  z-index: 5;
    padding: clamp(0.6rem, 1.8vh, 1rem) 0 clamp(0.8rem, 2.1vh, 1.2rem) clamp(1.5rem, 3vw, 3.5rem); 
    gap: 1.2rem;
  }
  
  .controls {
    flex-wrap: nowrap;
  }

  .index-item { padding: 0.32rem 0.1rem; margin: 0 -0.1rem; min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .log-texture, .scan.scanning::before, .dot.pulse, input[type="range"]::-webkit-slider-thumb, input[type="range"]::-moz-range-thumb, .entry-col.glitching, .entry.glitching h1 { animation: none !important; }
  .entry, .meta, h1, .body, .tags, .artifact, .ticks span, .replay-btn, .dot, .index-item, .easter-egg, .drawer { transition: none !important; }
}

/* ── Recap card (entry 0) ──────────────────────────────────────────────── */
.recap-name {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.02em;
  margin-bottom: 0.8rem;
}
.recap-bio {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-dim);
  max-width: 56ch;
  margin-bottom: 0.9rem;
}
.recap-usp {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.5rem 0.8rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  margin-bottom: 1rem;
  line-height: 1.4;
  transition: color 0.5s ease, background 0.5s ease, border-color 0.5s ease;
}
.recap-services {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.recap-service {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.35rem 0.75rem;
  border-radius: 5px;
  border: 1px solid var(--accent-soft);
  color: var(--accent);
  background: var(--accent-soft);
  transition: color 0.5s ease, background 0.5s ease, border-color 0.5s ease;
}
.recap-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.3rem;
}
.recap-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 0.25s ease;
}
.recap-link:hover { color: var(--accent); }

/* ── Keyboard Hints ─────────────────────────────────────────────────────── */
.kb-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  margin-top: 0.8rem;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ink-dim);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  margin-right: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
