/* Murderdoku — Dossierboek-styling
 * Vintage detective casebook: oud papier, sepiatinten, stempel- en tweekleurige accenten.
 */
:root {
  --paper:        #f4ecd8;
  --paper-dark:   #d8c9a3;
  --paper-edge:   #b8a87e;
  --ink:          #2d2419;
  --ink-faded:    #5a4c33;
  --stamp-red:    #8b2a1f;
  --stamp-blue:   #1b3a52;
  --grid-line:    #8b7350;
  --truth-red:    #c1392b;
  --shadow:       rgba(45, 36, 25, 0.25);
  --page-pad:     clamp(1.25rem, 4vw, 2.5rem);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: #1a140c;
  color: var(--ink);
  font-family: 'Courier Prime', 'Courier New', monospace;
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  /* Achtergrond is een warm-parchment "lessenaar"-vlak; de pagina's drijven er bovenop. */
  background-image:
    radial-gradient(ellipse at top, #e8dcc0 0%, #c9b896 80%),
    repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(255,255,255,0.05) 3px, rgba(255,255,255,0.05) 4px);
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(0.5rem, 2vw, 1.5rem);
}

/* ─── Titelpagina (case-kiezer) ───────────────────────────── */
.title-page {
  text-align: center;
  padding: var(--page-pad);
  max-width: 56rem;
  width: 100%;
}
.title-page .stamp {
  display: inline-block;
  border: 0.25rem double var(--stamp-red);
  color: var(--stamp-red);
  padding: 0.4rem 1rem;
  font-family: 'Special Elite', monospace;
  letter-spacing: 0.15em;
  transform: rotate(-3deg);
  opacity: 0.85;
  margin-bottom: 1.5rem;
}
.title-page h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(2.5rem, 8vw, 5rem);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0 0 1.5rem;
}
.title-page .lead {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--ink-faded);
  max-width: 40ch;
  margin: 0 auto 2rem;
}
.title-page ul.case-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
}
.title-page ul.case-list li {
  margin: 0;
}
.title-page ul.case-list a {
  display: block;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  color: var(--ink);
  text-decoration: none;
  font-family: 'Special Elite', monospace;
  text-align: left;
  overflow: hidden;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.title-page ul.case-list a:hover,
.title-page ul.case-list a:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px var(--shadow);
  outline: none;
}
.title-page ul.case-list .case-thumb {
  aspect-ratio: 16/9;
  background-size: cover;
  background-position: center;
  background-color: var(--paper-dark);
  filter: sepia(0.05) contrast(1.05);
}
.title-page ul.case-list .case-meta {
  padding: 0.8rem 1rem;
  border-top: 1px dashed var(--paper-edge);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.title-page ul.case-list .case-meta .title {
  font-weight: 700;
  font-size: 1.05rem;
}
.title-page ul.case-list .case-meta .year {
  font-size: 0.9rem;
  color: var(--stamp-red);
  letter-spacing: 0.1em;
}

/* ─── Play-CTA (link naar interactieve PWA) ──────────────── */
.title-page .play-cta {
  margin: 2rem auto 0;
  max-width: 40rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.4);
  border: 1px dashed var(--stamp-red);
  padding: 1.25rem 1.5rem;
}
.title-page .play-cta .play-cta-text {
  font-size: clamp(0.9rem, 2.2vw, 1.05rem);
  color: var(--ink-faded);
  line-height: 1.5;
  margin: 0 0 0.85rem;
  font-style: italic;
}
.title-page .play-cta .play-cta-btn {
  display: inline-block;
  background: var(--stamp-red);
  color: var(--paper);
  text-decoration: none;
  font-family: 'Special Elite', monospace;
  letter-spacing: 0.1em;
  padding: 0.75rem 1.5rem;
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
  border: 2px solid var(--stamp-red);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.title-page .play-cta .play-cta-btn:hover,
.title-page .play-cta .play-cta-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(139, 42, 31, 0.35);
  outline: none;
}

/* ─── Boekpagina (per-zaak casebook) ───────────────────────── */
.book {
  display: grid;
  grid-template-rows: 1fr auto;
  width: 100%;
  max-width: 64rem;
  min-height: calc(100vh - 4rem);
}
.book-frame {
  position: relative;
  background: var(--paper);
  background-image:
    /* heel subtiele vezelstructuur */
    radial-gradient(circle at 20% 18%, rgba(139, 115, 80, 0.08) 0, transparent 35%),
    radial-gradient(circle at 82% 78%, rgba(139, 115, 80, 0.06) 0, transparent 40%),
    repeating-linear-gradient(45deg, transparent 0, transparent 2px, rgba(139, 115, 80, 0.025) 2px, rgba(139, 115, 80, 0.025) 3px);
  border: 1px solid var(--paper-edge);
  box-shadow:
    0 1px 0 var(--paper-dark) inset,
    0 2px 0 rgba(255,255,255,0.4) inset,
    0 18px 50px rgba(0,0,0,0.55);
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3.5rem) clamp(2rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
/* lichte kartelrand met mask-image voor de vintage feel */
.book-frame::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(139, 115, 80, 0.25);
  pointer-events: none;
}

.book-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-family: 'Special Elite', monospace;
  color: var(--ink-faded);
  border-bottom: 1px dashed var(--grid-line);
  padding-bottom: 0.5rem;
}
.book-meta .case-no { letter-spacing: 0.15em; }
.book-meta .case-loc { font-size: 0.95rem; }

.book-title {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  line-height: 1.1;
  margin: 0;
}

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ─── Pagina: Cover ────────────────────────────────────── */
.page-cover { padding: 0; gap: 0; }
.page-cover .cover-img {
  aspect-ratio: 16/9;
  width: 100%;
  background-size: cover;
  background-position: center;
  background-color: var(--ink);
  margin: calc(var(--page-pad) * -1) calc(var(--page-pad) * -1) 0;
  position: relative;
  filter: sepia(0.05) contrast(1.05);
}
.page-cover .cover-img::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 50%, rgba(0,0,0,0.6) 100%);
  pointer-events: none;
}
.page-cover .cover-caption {
  padding: 1.5rem clamp(1rem, 4vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.page-cover .cover-caption .subtitle {
  font-family: 'Special Elite', monospace;
  font-size: 0.95rem;
  color: var(--ink-faded);
  letter-spacing: 0.15em;
  margin: 0;
}
.page-cover .cover-caption h2 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  margin: 0;
  line-height: 1.1;
}

/* ─── Pagina: Briefing ───────────────────────────────────── */
.page-briefing h3 {
  font-family: 'Special Elite', monospace;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--stamp-red);
  font-size: 0.95rem;
  margin: 0;
  border-bottom: 2px solid var(--stamp-red);
  padding-bottom: 0.4rem;
}
.page-briefing p {
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  line-height: 1.65;
  margin: 0 0 1rem;
}
.casefile {
  background: rgba(255, 255, 255, 0.35);
  border: 1px dashed var(--ink-faded);
  padding: 1rem 1.25rem;
  font-family: 'Courier Prime', monospace;
  font-size: 0.95rem;
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1rem;
  row-gap: 0.25rem;
  margin: 0;
}
.casefile dt {
  color: var(--ink-faded);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin: 0;
}
.casefile dd {
  margin: 0;
}

/* ─── Pagina: Verdachten (3x3 grid portretten) ───────── */
.page-suspects h3 {
  font-family: 'Special Elite', monospace;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--stamp-red);
  font-size: 0.95rem;
  margin: 0;
  border-bottom: 2px solid var(--stamp-red);
  padding-bottom: 0.4rem;
}
.suspect-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.suspect-card {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--paper-edge);
  padding: 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
}
.suspect-card .number {
  position: absolute;
  top: 4px;
  left: 6px;
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--stamp-red);
  opacity: 0.7;
  line-height: 1;
}
.suspect-card .portrait {
  aspect-ratio: 1/1;
  background-size: cover;
  background-position: center;
  background-color: var(--paper-dark);
  filter: sepia(0.05) contrast(1.05);
  border: 1px solid var(--paper-edge);
}
.suspect-card .name {
  font-family: 'Special Elite', monospace;
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.15;
}
.suspect-card .role {
  font-family: 'Courier Prime', monospace;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--ink-faded);
  margin: 0;
}
@media (max-width: 480px) {
  .suspect-card .name { font-size: 0.72rem; }
  .suspect-card .role { font-size: 0.65rem; }
}

/* ─── Pagina: Sudoku ─────────────────────────────────────── */
.page-sudoku h3 {
  font-family: 'Special Elite', monospace;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--stamp-red);
  font-size: 0.95rem;
  margin: 0;
  border-bottom: 2px solid var(--stamp-red);
  padding-bottom: 0.4rem;
}
.page-sudoku p {
  font-size: clamp(0.95rem, 2.2vw, 1.05rem);
  line-height: 1.55;
  margin: 0 0 0.5rem;
}
.legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: 'Special Elite', monospace;
  font-size: 0.85rem;
  color: var(--ink-faded);
  margin: 0.5rem 0 0;
}
.legend .swatch {
  display: inline-block;
  width: 0.9rem; height: 0.9rem;
  vertical-align: middle;
  margin-right: 0.4rem;
  border: 1px solid var(--ink);
}
.legend .swatch.given  { background: var(--ink); }
.legend .swatch.truth  { background: var(--truth-red); border-color: var(--truth-red); border-radius: 50%; }
.legend .swatch.empty { background: var(--paper); }

.sudoku {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: min(100%, 28rem);
  aspect-ratio: 1/1;
  margin: 1rem auto;
  background: var(--ink);
  border: 2px solid var(--ink);
  gap: 1px;
  user-select: none;
}
.sudoku .cell {
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(0.85rem, 4vw, 1.25rem);
  position: relative;
  color: var(--ink);
}
/* Dikke lijn tussen 3×3 boxes */
.sudoku .cell.r3 { border-right: 2px solid var(--ink); }
.sudoku .cell.c3 { border-bottom: 2px solid var(--ink); }
/* Reset aan de buitenrand */
.sudoku .cell.r0 { border-left: none; }
.sudoku .cell.c0 { border-top: none; }
.sudoku .cell.r8 { border-right: none; }
.sudoku .cell.c8 { border-bottom: none; }
.sudoku .cell.truth::before {
  content: "";
  position: absolute; inset: 18%;
  background: var(--truth-red);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(193, 57, 43, 0.25);
}
.sudoku .cell.truth.revealed::before {
  display: none;
}
.sudoku .cell.revealed {
  color: var(--stamp-red);
}
.sudoku .cell.truth.placeholder {
  background: rgba(193, 57, 43, 0.06);
}
/* sudoku-buttons */
.sudoku-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.sudoku-actions button {
  font-family: 'Special Elite', monospace;
  letter-spacing: 0.1em;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  text-transform: uppercase;
}
.sudoku-actions button:hover,
.sudoku-actions button:focus-visible {
  background: var(--stamp-red);
  outline: none;
}

/* ─── Pagina: Ontknoping ─────────────────────────────────── */
.page-solution {
  position: relative;
}
.page-solution h3 {
  font-family: 'Special Elite', monospace;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--stamp-red);
  font-size: 0.95rem;
  margin: 0;
  border-bottom: 2px solid var(--stamp-red);
  padding-bottom: 0.4rem;
}
.solution-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}
.solution-card {
  border: 2px solid var(--ink);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.5);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.solution-card .label {
  font-family: 'Special Elite', monospace;
  letter-spacing: 0.15em;
  font-size: 0.8rem;
  color: var(--stamp-red);
  text-transform: uppercase;
}
.solution-card .value {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  line-height: 1.15;
}
.stamp-solved {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 7rem;
  height: 7rem;
  border: 0.4rem double var(--stamp-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.15em;
  color: var(--stamp-red);
  transform: rotate(-12deg);
  opacity: 0.9;
  pointer-events: none;
  line-height: 1.05;
  padding: 0.4rem;
  background: rgba(244, 236, 216, 0.85);
}
@media (max-width: 480px) {
  .stamp-solved { width: 5.5rem; height: 5.5rem; font-size: 0.85rem; }
  .solution-grid { grid-template-columns: 1fr; gap: 0.5rem; }
}

.closing {
  margin-top: 1rem;
  font-size: clamp(0.95rem, 2.2vw, 1.05rem);
  line-height: 1.55;
}
.back-to-toc {
  display: inline-block;
  margin-top: 1rem;
  font-family: 'Special Elite', monospace;
  font-size: 0.9rem;
  color: var(--stamp-red);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

/* ─── Navigatie ──────────────────────────────────────────── */
.book-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(20, 14, 8, 0.85);
  color: var(--paper);
  font-family: 'Special Elite', monospace;
  letter-spacing: 0.1em;
  max-width: 64rem;
  width: 100%;
  border: 1px solid var(--paper-edge);
  position: relative;
}
.book-nav button {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--paper-edge);
  padding: 0.5rem 0.9rem;
  font-family: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-transform: uppercase;
}
.book-nav button:hover,
.book-nav button:focus-visible {
  background: var(--paper);
  color: var(--ink);
  outline: none;
}
.book-nav button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.book-nav .dots {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.book-nav .dots button.dot {
  width: 0.7rem; height: 0.7rem;
  padding: 0;
  border: 1px solid var(--paper);
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
}
.book-nav .dots button.dot.active {
  background: var(--paper);
}
.book-nav .play-link {
  text-decoration: none;
  color: var(--paper);
  font-family: 'Special Elite', monospace;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  border: 1px dashed var(--stamp-red);
  background: var(--stamp-red);
  padding: 0.4rem 0.7rem;
}
.book-nav .play-link:hover,
.book-nav .play-link:focus-visible {
  background: var(--paper);
  color: var(--stamp-red);
  outline: none;
}
.book-nav .back-home {
  text-decoration: none;
  color: var(--paper);
  font-family: 'Special Elite', monospace;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  border: 1px dashed var(--paper-edge);
  padding: 0.4rem 0.7rem;
}
.book-nav .back-home:hover,
.book-nav .back-home:focus-visible {
  background: var(--stamp-red);
  border-color: var(--stamp-red);
  outline: none;
}

/* ─── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation-duration: 0.001ms !important;
  }
}
