/* ==========================================================================
   DESK: the detective's office, the corkboard of case files, the archive.
   ========================================================================== */
.desk { position: relative; min-height: 100vh; overflow: hidden; background: #0a0c14; padding: 0; }
.desk > * { position: relative; }


/* The lamp coming on. js/scroll.js adds .lit when the desk scrolls into view. */
.lamp-ob { position: absolute !important; inset: 0; z-index: 4; pointer-events: none; background: #02030a; opacity: .9; }
.lit .lamp-ob { animation: lampOn 2.6s ease-out both; }
@keyframes lampOn { 0% { opacity: .9; } 20% { opacity: .4; } 35% { opacity: .9; } 60% { opacity: .12; } 100% { opacity: 0; } }
.desk-vignette { position: absolute !important; inset: 0; pointer-events: none; z-index: 3; background: radial-gradient(ellipse at 50% 30%, transparent 40%, rgba(0,0,0,.6) 100%); }

.desk-head { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; justify-content: space-between; }
.nameplate {
  display: inline-block; margin: 0;
  background: linear-gradient(180deg, #d9b05a, #8a6a22); color: var(--paper-ink);
  border: 3px solid #3a2a0a; padding: 8px 26px; box-shadow: 0 5px 0 #000;
  font: 400 clamp(26px, 4vw, 40px) var(--font-display); letter-spacing: .08em;
}
.sticky {
  max-width: 280px; margin: 0; rotate: 2deg;
  background: var(--ochre); color: var(--ink); padding: 12px 14px;
  font-size: 15px; line-height: 1.35; box-shadow: 4px 5px 0 rgba(0,0,0,.5);
}

/* Search + tag filters */
.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 32px 0 22px; }
.search {
  min-height: 44px; padding: 0 14px; width: min(320px, 100%);
  border: 3px solid var(--ink); background: #fff; color: var(--ink); font: 17px var(--font-text); border-radius: 0;
}
.tagbar { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 44px; padding: 0 16px; cursor: pointer;
  background: var(--manila); color: var(--paper-ink); border: 2px solid var(--paper-ink);
  font: 16px var(--font-text);
}
.chip[aria-pressed="true"] { background: var(--ochre); box-shadow: inset 0 -4px 0 var(--brick); }

/* The corkboard */
.board {
  position: relative; background: var(--cork); border: 12px solid var(--wood-2);
  box-shadow: inset 0 0 40px rgba(0,0,0,.45), 0 10px 0 #000;
  background-image: radial-gradient(circle, rgba(0,0,0,.2) 1.5px, transparent 2px); background-size: 9px 9px;
  padding: 48px 28px 36px; min-height: 300px;
}
.board-grid {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 44px 32px;
}
.strings { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; }
.strings path { fill: none; stroke: var(--crimson); stroke-width: 2.5; stroke-linecap: round; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.board-empty { position: relative; z-index: 2; margin: 0; color: var(--ink); background: var(--cream); padding: 14px 18px; display: inline-block; }

.polaroid {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 14px;
  background: var(--cream); color: var(--paper-ink); text-decoration: none;
  box-shadow: 6px 8px 0 rgba(0,0,0,.45);
  rotate: var(--rot, 0deg); translate: var(--dx, 0px) var(--dy, 0px);
  transition: rotate .2s, scale .2s, translate .2s;
}
.polaroid:hover, .polaroid:focus-visible { rotate: 0deg; scale: 1.05; translate: 0 -6px; z-index: 5; color: var(--paper-ink); }
.pin {
  position: absolute; left: 50%; top: -9px; width: 16px; height: 16px; margin-left: -8px; z-index: 3;
  border-radius: 50%; background: var(--crimson); box-shadow: 0 3px 0 #000, inset -3px -3px 0 rgba(0,0,0,.25);
}
.polaroid h3 { margin: 4px 0 0; font: 400 19px / 1.2 var(--font-text); }
.polaroid time { font-size: 14px; }
.polaroid-stamp {
  position: absolute; right: 8px; top: 38px; rotate: -12deg; opacity: 0; scale: 1.8;
  border: 3px solid var(--brick); color: var(--brick); background: rgba(242,230,201,.92);
  padding: 0 10px; font: 28px var(--font-comic); letter-spacing: .06em;
  transition: opacity .15s, scale .2s cubic-bezier(.2, 1.6, .4, 1);
}
.polaroid:hover .polaroid-stamp, .polaroid:focus-visible .polaroid-stamp { opacity: 1; scale: 1; }

.board-more { display: flex; justify-content: center; margin: 26px 0 0; }

/* ---------- Placeholder cover art (used when a post has no photo) ---------- */
.cover { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: var(--navy); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.scene { position: absolute; inset: 0; }
.scene::before, .scene::after { content: ""; position: absolute; }
.scene-alley { background: linear-gradient(180deg, #0a0f2a, #15204e); }
.scene-alley::before { left: 40%; bottom: 18%; width: 6px; height: 58%; background: #000; box-shadow: 0 0 0 0 #000; }
.scene-alley::after { left: calc(40% - 60px); bottom: 54%; width: 126px; height: 126px; border-radius: 50%; background: radial-gradient(circle, #ffd37a 0, rgba(224,162,58,.5) 35%, rgba(224,162,58,0) 70%); }
.scene-rooftop { background: linear-gradient(180deg, #0c1540, #5a2a3a 75%, #8a3a2e); }
.scene-rooftop::before { left: 0; right: 0; bottom: 0; height: 14%; background: #000; }
.scene-rooftop::after { left: 38%; bottom: 14%; width: 14%; height: 48%; background: #000; clip-path: polygon(35% 0,65% 0,65% 9%,88% 11%,88% 13%,60% 13%,60% 19%,82% 24%,88% 45%,96% 100%,4% 100%,12% 45%,18% 24%,40% 19%,40% 13%,12% 13%,12% 11%,35% 9%); }
.scene-harbor { background: linear-gradient(180deg, #0a1a2e 0%, #1c3a5c 55%, #2fb5b5 100%); }
.scene-harbor::before { left: 0; right: 0; bottom: 0; height: 40%; background: repeating-linear-gradient(0deg, rgba(255,255,255,.12) 0 2px, transparent 2px 9px), #0e2a40; }
.scene-snow { background: linear-gradient(180deg, #0a1a2e, #1c3a5c); }
.scene-snow::before { inset: 0; background-image: radial-gradient(circle, rgba(242,230,201,.8) 2px, transparent 2.5px); background-size: 34px 29px; }
.scene-snow::after { left: 0; right: 0; bottom: 0; height: 22%; background: #d8e2f0; }
.scene-castle { background: linear-gradient(180deg, #0c1540, #3b2450); }
.scene-castle::before { left: 20%; right: -10%; bottom: 0; height: 56%; background: #060916; clip-path: polygon(0 100%,10% 60%,18% 60%,18% 40%,24% 40%,24% 24%,30% 8%,36% 24%,36% 40%,44% 40%,44% 56%,52% 56%,52% 70%,100% 100%); }
.scene-city { background: linear-gradient(180deg, #04061a, #3b2450 70%, #8a3a2e); }
.scene-city::before { left: 0; right: 0; bottom: 0; height: 55%; background: var(--navy); clip-path: polygon(0 100%,0 50%,10% 50%,10% 20%,18% 20%,18% 46%,28% 46%,28% 30%,38% 30%,38% 56%,48% 56%,48% 10%,52% 10%,52% 40%,62% 40%,62% 28%,72% 28%,72% 52%,84% 52%,84% 34%,94% 34%,94% 46%,100% 46%,100% 100%); }

/* ---------- The archive (typed list, grouped by year) ---------- */
.archive {
  margin: 56px 0 0; padding: 28px; background: var(--cream); color: var(--ink); box-shadow: 8px 8px 0 #000;
}
.archive h2 { margin: 0 0 6px; font: 400 clamp(28px, 4vw, 40px) var(--font-display); }
.archive .year { margin: 22px 0 4px; font: 400 24px var(--font-display); color: var(--brick); }
.row {
  min-height: 48px; display: flex; align-items: baseline; gap: 10px; padding: 10px 6px;
  border-top: 1px dashed var(--ink); color: var(--ink); text-decoration: none; font-size: 18px;
  transition: background .15s;
}
.row:hover { background: rgba(142,42,34,.15); color: var(--ink); }
.row .date { white-space: nowrap; }
.row .leader { flex: 1; min-width: 20px; border-bottom: 2px dotted var(--ink); translate: 0 -4px; }
.row .t { font-weight: 700; text-align: right; }

.site-foot {
  margin-top: 56px; padding: 22px 0 40px; border-top: 2px solid var(--ochre);
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; font-size: 14px; color: #d9cdb0;
}

@media (max-width: 640px) {
  .board { padding: 40px 14px 28px; border-width: 8px; }
  .board-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 36px 18px; }
  .archive { padding: 18px; }
  .row { font-size: 16px; }
}

/* ==========================================================================
   POW PASS: grain, comic bursts, taped photos, scribbles.
   ========================================================================== */
.desk::after {
  content: ""; position: absolute; inset: -10%; pointer-events: none; z-index: 5; opacity: .26; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .5s steps(4) infinite;
}

.nameplate { rotate: -1.5deg; }
.sticky { font-family: var(--font-marker); font-size: 18px; line-height: 1.25; }

/* comic-print dots on the board + cork grain */
.board { border: 12px solid #000; outline: 4px solid var(--wood-2); box-shadow: inset 0 0 50px rgba(0,0,0,.55), 10px 12px 0 #000; }
.board::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .4;
  background: radial-gradient(circle, rgba(0,0,0,.5) 1.2px, transparent 1.7px) 0 0 / 8px 8px;
  -webkit-mask-image: linear-gradient(135deg, transparent 40%, #000 100%); mask-image: linear-gradient(135deg, transparent 40%, #000 100%); }

/* ---- polaroids: tape, pins with a glint, comic burst on hover, drop-in ---- */
.polaroid { box-shadow: 7px 9px 0 rgba(0,0,0,.5); border: 2px solid #000; }
.polaroid h3 { font-size: 20px; }
.polaroid time { font: 15px var(--font-marker); color: var(--brick); }
.pin::after { content: ""; position: absolute; left: 3px; top: 3px; width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.75); }
.pin.tape { width: 70px; height: 22px; margin-left: -35px; top: -12px; border-radius: 0; rotate: -4deg;
  background: rgba(238,222,160,.82); box-shadow: 0 1px 0 rgba(0,0,0,.25); border-left: 3px dotted rgba(0,0,0,.18); border-right: 3px dotted rgba(0,0,0,.18); }
.pin.tape::after { display: none; }
.polaroid:nth-child(3n) .pin.tape { rotate: 6deg; }
.polaroid:nth-child(4n+1) .pin.tape { rotate: -9deg; }
.newtag { position: absolute; left: -16px; top: -14px; z-index: 4; padding: 2px 10px; rotate: -12deg;
  background: var(--crimson); color: var(--cream); border: 3px solid #000; box-shadow: 3px 3px 0 #000; font: 22px var(--font-comic); letter-spacing: .08em; }
.polaroid::after { content: attr(data-sfx); position: absolute; right: -26px; top: -30px; z-index: 6; width: 118px; height: 100px;
  display: grid; place-items: center; rotate: 11deg; scale: 0; pointer-events: none;
  font: 28px var(--font-comic); letter-spacing: .04em; color: var(--crimson); -webkit-text-stroke: 1.5px #000; paint-order: stroke fill;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpolygon points='50,2 60,22 82,8 78,32 98,36 82,52 98,66 76,70 80,92 60,80 50,98 40,80 20,92 24,70 2,66 18,52 2,36 22,32 18,8 40,22' fill='%23e0a23a' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  transition: scale .2s cubic-bezier(.2, 1.9, .4, 1); }
.polaroid:hover::after, .polaroid:focus-visible::after { scale: 1; }
.lit .polaroid { animation: slap .55s cubic-bezier(.2, 1.4, .4, 1) backwards; animation-delay: calc(var(--i, 0) * .09s + .35s); }
@keyframes slap { from { opacity: 0; scale: 1.7; translate: 0 -50px; rotate: 12deg; } }

/* red string draws itself, then stays */
.lit .strings path { stroke-dasharray: 1; animation: drawstr 1.1s ease-out backwards; animation-delay: calc(var(--k, 0) * .12s + .9s); }
@keyframes drawstr { from { stroke-dashoffset: 1; } }
.strings path { stroke-width: 3; }

/* index-card style filter chips */
.chip { box-shadow: 3px 3px 0 #000; border-width: 2px; transition: translate .12s, rotate .12s; }
.chip:nth-child(odd) { rotate: -1.5deg; } .chip:nth-child(even) { rotate: 1.2deg; }
.chip:hover { translate: 0 -3px; rotate: 0deg; }
.search { box-shadow: 4px 4px 0 #000; }

/* archive: classified stamp + ragged top */
.archive { position: relative; border: 2px solid #000; }
.archive::before { content: "CLASSIFIED"; position: absolute; right: 18px; top: -18px; rotate: 7deg; padding: 0 14px;
  font: 34px var(--font-comic); letter-spacing: .1em; color: var(--crimson); border: 4px solid var(--crimson); background: rgba(242,230,201,.92); }
.row:hover { padding-left: 14px; }
.row .date { font-family: var(--font-marker); font-size: 16px; }


/* ---- fixes + font tuning ---- */
.board-empty[hidden] { display: none; }
.polaroid-stamp { top: auto !important; bottom: 10px; right: 8px; }
/* decorations live in the board's top and bottom margins so they never cover a photo */
.polaroid h3 { font-size: 23px; line-height: 1.15; }
.chip, .search { font-size: 18px; }
.row { font-size: 21px; }
.btn { font-family: var(--font-text); font-size: 18px; }


@media (max-width: 640px) { .polaroid::after { right: -8px; width: 90px; height: 78px; font-size: 22px; } }

.locker-link { align-self: center; rotate: 1.5deg; box-shadow: 3px 4px 0 rgba(0,0,0,.5); font-size: 17px; }

/* red string: tag labels and the highlight when you point at a card */
.strings path { transition: opacity .25s, stroke-width .25s; }
.strings text { font: 16px var(--font-type); fill: #f4e6c0; paint-order: stroke; stroke: #000; stroke-width: 4px; stroke-linejoin: round; opacity: 0; transition: opacity .25s; pointer-events: none; }
.strings.has-hl path { opacity: .28; }
.strings.has-hl path.hl { opacity: 1; stroke-width: 4.5; filter: drop-shadow(0 0 5px rgba(255,70,60,.7)) drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.strings text.hl { opacity: 1; }
.strings.has-hl { z-index: 8; }
