/* Entry 001 — Search as an evidence board (rebuilt)
   Scene art direction: an incident room after dark. ONE warm raking light
   falls from the upper-left across a charcoal wall; paper cards are pinned,
   lit from that side, casting soft shadows to the lower-right. Every thread is
   a quiet neutral string except ONE — the contradiction — drawn in red.
   Red is the only accent. Case-file labels in mono; the human claim in serif.
   Crafted gradient wall (no photo): the cards are the subject. */

.board-scene {
  --accent: #d23f2a;          /* the red thread — the only accent */
  --accent-glow: rgba(210, 63, 42, 0.6);
  --string: rgba(232, 222, 205, 0.3);
  --paper-ink: #211e18;
  --label: #a4906f;
  position: relative;
  border-color: rgba(14, 12, 10, 0.7);
  /* a believable dim wall: warm light upper-left, shadow lower-right */
  background:
    radial-gradient(78% 66% at 20% 8%, rgba(126, 102, 74, 0.34), transparent 62%),
    radial-gradient(120% 100% at 82% 96%, rgba(7, 6, 5, 0.6), transparent 70%),
    linear-gradient(156deg, #2c2822 0%, #232019 44%, #16130e 100%);
}

/* mid layer — the lamp's warm pool spilled across the wall */
.lamp {
  position: absolute;
  z-index: 0;
  left: 8%;
  top: 0%;
  width: 64%;
  height: 56%;
  background: radial-gradient(54% 60% at 40% 36%, rgba(255, 214, 158, 0.20), transparent 72%);
  filter: blur(50px);
  pointer-events: none;
}

.board {
  position: relative;
  z-index: 2;
  aspect-ratio: 1000 / 620;
  width: 100%;
  font-family: var(--ui-sans);
}

/* ---- toolbar: dark glass pill ------------------------------------- */
.board-toolbar {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 7px 8px 7px 16px;
  border-radius: 12px;
  background: rgba(24, 21, 17, 0.6);
  border: 1px solid rgba(255, 238, 214, 0.14);
  box-shadow: 0 18px 48px rgba(6, 4, 2, 0.5);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.board-query {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #e4d8c2;
  white-space: nowrap;
}

.mode-group { display: flex; gap: 3px; }

.mode {
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 7px 12px;
  font: 700 10px/1 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(235, 224, 204, 0.5);
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}
.mode:hover { color: #fff; }
.mode.active { background: #f3ede1; color: #1f1c17; }

/* ---- threads: quiet strings, one red ------------------------------- */
.threads {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.thread {
  fill: none;
  stroke: var(--string);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  opacity: 0.7;
  transition: opacity 220ms ease, stroke-width 220ms ease;
}

.thread-hot {
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-dasharray: 9 6;
  opacity: 1;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.thread-node {
  fill: #16130e;
  stroke: rgba(232, 222, 205, 0.7);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

/* ---- cards: pinned paper, lit from upper-left ----------------------- */
.evidence-card {
  position: absolute;
  z-index: 2;
  width: 26.5%;
  min-width: 196px;
  border-radius: 10px;
  background:
    linear-gradient(184deg, rgba(255, 255, 255, 0.5), transparent 40%),
    linear-gradient(180deg, #fbf6ec 0%, #f1e8d6 100%);
  border: 1px solid rgba(120, 96, 60, 0.22);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    10px 20px 46px rgba(6, 4, 2, 0.55),
    2px 5px 14px rgba(6, 4, 2, 0.32);
  padding: 18px 20px 14px;
  transform: rotate(var(--tilt, 0deg));
  cursor: pointer;
  outline: none;
  transition: transform 220ms ease, box-shadow 220ms ease, opacity 220ms ease;
}

.evidence-card:hover,
.evidence-card:focus-visible,
.evidence-card.active {
  transform: rotate(0deg) translateY(-5px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    14px 28px 60px rgba(4, 3, 1, 0.62),
    0 0 0 1px rgba(210, 63, 42, 0.0);
  z-index: 3;
}

.evidence-card.active { box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 14px 28px 60px rgba(4,3,1,0.62), 0 0 0 2px rgba(210, 63, 42, 0.5); }

.evidence-card.dim { opacity: 0.32; }
.thread.dim { opacity: 0.08; }
.thread.lit { opacity: 1; stroke-width: 2.2; stroke: rgba(245, 238, 224, 0.9); }
.thread-hot.lit { stroke: var(--accent); }

.pin {
  position: absolute;
  top: -7px;
  left: 26px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #efe4cd, #c3b393 70%);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 8px rgba(6, 4, 2, 0.5);
}

.pin-hot {
  background: radial-gradient(circle at 38% 34%, #f5917f, var(--accent) 66%);
  box-shadow: 0 0 12px var(--accent-glow), 0 4px 8px rgba(6, 4, 2, 0.5);
}

.card-type {
  margin: 0 0 9px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--label);
}
.evidence-card[data-card="contradiction"] .card-type { color: var(--accent); }

.evidence-card h3 {
  margin: 0 0 9px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--paper-ink);
}

.evidence-card > p:not(.card-type) {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: #6e675c;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
  padding-top: 9px;
  border-top: 1px solid rgba(31, 28, 23, 0.1);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 500;
  color: #8a8275;
}
.card-meta .domain { transition: all 200ms ease; }

/* card placement — same coordinate space as the SVG threads */
.card-a { --tilt: -0.8deg; left: 5%;    top: 13%; }
.card-b { --tilt: 0.7deg;  left: 68%;   top: 11%; }
.card-c { --tilt: 0.6deg;  left: 8%;    top: 60%; }
.card-d { --tilt: -0.6deg; left: 65.5%; top: 62%; }

/* ---- margin note ------------------------------------------------------ */
.board-note {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%) rotate(-0.8deg);
  margin: 0;
  max-width: 340px;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1.4;
  color: rgba(238, 230, 214, 0.82);
  text-shadow: 0 2px 18px rgba(6, 4, 2, 0.7);
}

/* ---- modes -------------------------------------------------------------- */
.board[data-mode="tension"] .thread:not(.thread-hot) { opacity: 0.08; }
.board[data-mode="tension"] .thread-hot { opacity: 1; stroke-width: 2.8; }
.board[data-mode="tension"] .evidence-card:not([data-card="memory"]):not([data-card="contradiction"]) { opacity: 0.28; }

.board[data-mode="sources"] .thread { opacity: 0.06; }
.board[data-mode="sources"] .evidence-card h3,
.board[data-mode="sources"] .evidence-card > p:not(.card-type) { opacity: 0.32; }
.board[data-mode="sources"] .card-meta .domain {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  font-weight: 500;
  color: var(--paper-ink);
}

/* ---- reveal --------------------------------------------------------------- */
.board.is-revealing .thread {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: revealThread 1100ms ease forwards 200ms;
}
.board.is-revealing .thread-hot { animation-delay: 700ms; }
.board.is-revealing .evidence-card { opacity: 0; animation: revealCard 560ms ease forwards; }
.board.is-revealing .card-a { animation-delay: 80ms; }
.board.is-revealing .card-b { animation-delay: 260ms; }
.board.is-revealing .card-c { animation-delay: 440ms; }
.board.is-revealing .card-d { animation-delay: 620ms; }

@keyframes revealThread { to { stroke-dashoffset: 0; } }
@keyframes revealCard {
  from { opacity: 0; transform: translateY(14px) rotate(var(--tilt, 0deg)); }
  to { opacity: 1; transform: translateY(0) rotate(var(--tilt, 0deg)); }
}

@media (prefers-reduced-motion: reduce) {
  .board.is-revealing .thread,
  .board.is-revealing .evidence-card { animation: none; opacity: 1; stroke-dashoffset: 0; }
}

/* ---- small screens: the wall becomes a stack ------------------------------ */
@media (max-width: 760px) {
  .board { aspect-ratio: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px 16px 24px; }
  .threads { display: none; }
  .board-toolbar { position: static; transform: none; flex-wrap: wrap; justify-content: center; margin-bottom: 6px; }
  .evidence-card { position: static; width: 100%; min-width: 0; --tilt: 0deg; }
  .pin { left: 50%; transform: translateX(-50%); }
  .board-note { position: static; transform: rotate(-0.8deg); margin: 8px auto 0; }
}
