/* =========================================================
   LAB — roelmandigers.nl
   Bento-bord vol probeersels. Mag stuk. Mag fout. Mag weg.
   Space Grotesk + Space Mono · nachtblauw + snoepkleuren
   ========================================================= */

:root {
  --nacht:   #11131f;   /* achtergrond */
  --papier:  #fff8ec;   /* room */
  --inkt:    #16182b;
  --koraal:  #ff5e36;
  --citroen: #ffc53d;
  --salie:   #9db89c;
  --lila:    #b9a7e8;
  --lucht:   #7fc8e8;
  --gat: 10px;
  --r: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mono: 'Space Mono', monospace;
  --grotesk: 'Space Grotesk', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--nacht);
  font-family: var(--grotesk);
  color: var(--inkt);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--koraal); color: var(--papier); }

:focus-visible { outline: 3px solid var(--citroen); outline-offset: 3px; border-radius: 6px; }

/* ---------- Het bord ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 150px;
  grid-auto-flow: dense;
  gap: var(--gat);
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(12px, 2.5vw, 28px);
  min-height: 100vh;
}

.tile {
  position: relative;
  border-radius: var(--r);
  padding: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--papier);
  cursor: default;
  animation: tile-in 0.6s var(--ease) backwards;
  animation-delay: calc(var(--d) * 60ms);
}
@keyframes tile-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
}

/* ---------- Plaatsing (4 kolommen) ---------- */
.t-intro   { grid-column: span 2; grid-row: span 2; background: var(--papier); }
.t-001     { grid-column: span 1; grid-row: span 1; background: var(--koraal); color: var(--papier); }
.t-klok    { grid-column: span 2; grid-row: span 2; background: var(--inkt); color: #9df0b8; }
.t-sleutel { grid-column: span 1; grid-row: span 2; background: var(--citroen); }
.t-kaart-mini {
  grid-column: span 1; grid-row: span 1;
  background: var(--lucht); color: var(--inkt);
  border: 0; cursor: pointer; font: inherit; text-align: left;
  gap: 3px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.t-kaart-mini:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.6); }
.t-kaart-mini .ico { width: 30px; height: 30px; margin-bottom: auto; }
.kaart-mini-cijfers { font-weight: 700; font-size: 1.02rem; line-height: 1.3; }
.kaart-mini-cta { font-size: 0.78rem; opacity: 0.75; }
.t-heeze   { grid-column: span 1; grid-row: span 2; background: var(--salie); }
.t-kleur   { grid-column: span 1; grid-row: span 1; background: var(--lila); }
.t-teller  { grid-column: span 1; grid-row: span 2; background: var(--lucht); }
.t-licht   { grid-column: span 1; grid-row: span 1; background: var(--papier); }
.t-waarom  { grid-column: span 2; grid-row: span 2; background: var(--lila); }
.t-bouw    { grid-column: span 1; grid-row: span 2; background: repeating-linear-gradient(-45deg, var(--citroen) 0 22px, var(--inkt) 22px 44px); color: var(--papier); }
.t-advies  { grid-column: span 1; grid-row: span 1; background: var(--salie); }
.t-terug   { grid-column: span 1; grid-row: span 1; background: var(--koraal); color: var(--papier); }

/* ---------- Typografie ---------- */
.mono { font-family: var(--mono); }
.small { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; margin: 0 0 6px; }
.huge {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 700; line-height: 0.95; letter-spacing: -0.03em; margin: 0;
}
.tile h1 { font-size: clamp(2.3rem, 6vw, 4.4rem); margin: 0; letter-spacing: -0.04em; line-height: 0.95; overflow-wrap: anywhere; }
.tile h2 { font-size: 1.6rem; margin: 12px 0 0; }
.tile p { margin: 0; }
.blink { animation: blink 1.1s steps(1) infinite; color: var(--koraal); }
@keyframes blink { 50% { opacity: 0; } }
.ico { width: 38px; height: 38px; }

/* =========================================================
   EFFECTEN — elk vak z'n eigen trucje
   Hover op desktop, .tap (JS) op touch, focus voor toetsenbord
   ========================================================= */

/* ---- Flip (3D-kaartje) ----
   Let op: géén overflow:hidden op de tegel — dat maakt de 3D plat.
   De tegel zelf is doorzichtig; de kleur zit op de voorkant van het kaartje,
   zodat het hele kaartje meedraait. */
.fx-flip { perspective: 900px; padding: 0; overflow: visible; background: transparent; }
.fx-flip .flip {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.65s var(--ease);
}
.fx-flip:hover .flip,
.fx-flip:focus-visible .flip,
.fx-flip.tap .flip { transform: rotateY(180deg); }
.fx-flip .face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 22px; border-radius: var(--r);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.t-intro .front { background: var(--papier); }
.t-sleutel .front { background: var(--citroen); }
.fx-flip .back {
  transform: rotateY(180deg);
  background: var(--inkt); color: var(--papier);
  font-size: 1.15rem;
}
.t-intro .back { font-size: clamp(1.2rem, 2.4vw, 1.7rem); }
.t-intro .back strong { color: var(--citroen); }

/* ---- Overlay (schuift omhoog) ---- */
.fx-overlay .overlay {
  position: absolute; inset: 0;
  background: var(--inkt); color: var(--papier);
  padding: 22px;
  display: flex; align-items: flex-end;
  transform: translateY(101%);
  transition: transform 0.45s var(--ease);
  font-size: 1.05rem;
}
.fx-overlay:hover .overlay,
.fx-overlay:focus-visible .overlay,
.fx-overlay.tap .overlay { transform: none; }
.fx-overlay .overlay a { color: var(--citroen); text-decoration: underline; }

/* ---- Swap (tekst A maakt plaats voor tekst B) ---- */
.fx-swap .swap-a, .fx-swap .swap-b { transition: opacity 0.3s var(--ease), transform 0.45s var(--ease); }
.fx-swap .swap-b {
  position: absolute; inset: auto 22px 22px 22px;
  opacity: 0; transform: translateY(10px);
}
.fx-swap:hover .swap-a, .fx-swap:focus-visible .swap-a, .fx-swap.tap .swap-a { opacity: 0; }
.fx-swap:hover .swap-b, .fx-swap:focus-visible .swap-b, .fx-swap.tap .swap-b { opacity: 1; transform: none; }
.klok { font-size: clamp(2.4rem, 5.5vw, 4.2rem); font-weight: 700; }
.datum { font-size: clamp(1.1rem, 2vw, 1.5rem); }
.t-001 .overlay { font-size: 0.95rem; }
.plaats { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 700; letter-spacing: -0.02em; }

/* ---- Hue-shift (kleur draait door het spectrum) ---- */
.fx-hue { transition: filter 0.4s; }
.fx-hue:hover, .fx-hue:focus-visible, .fx-hue.tap { animation: hue 3s linear infinite; }
@keyframes hue { to { filter: hue-rotate(360deg); } }
.verborgen-hint { opacity: 0; transition: opacity 0.4s; margin-top: 6px; }
.fx-hue:hover .verborgen-hint, .fx-hue.tap .verborgen-hint { opacity: 0.7; }

/* ---- Invert (licht wordt donker) ---- */
.fx-invert { transition: background 0.35s var(--ease); }
.woord-donker { display: none; }
.fx-invert:hover, .fx-invert:focus-visible, .fx-invert.tap { background: var(--inkt); color: var(--papier); }
.fx-invert:hover .woord-licht, .fx-invert:focus-visible .woord-licht, .fx-invert.tap .woord-licht { display: none; }
.fx-invert:hover .woord-donker, .fx-invert:focus-visible .woord-donker, .fx-invert.tap .woord-donker { display: block; }

/* ---- Strepen (warning-strepen gaan lopen) ---- */
.fx-strepen { background-size: 200% 200%; justify-content: center; align-items: center; }
.fx-strepen:hover, .fx-strepen:focus-visible, .fx-strepen.tap { animation: strepen 1.2s linear infinite; }
@keyframes strepen { to { background-position: 62px 62px; } }
.verticaal {
  writing-mode: vertical-rl;
  font-weight: 700; font-size: 1.1rem; letter-spacing: 0.35em;
  background: var(--inkt); color: var(--citroen);
  padding: 18px 10px; border-radius: 10px;
}

/* ---- Pijl (linkvak) ---- */
.fx-pijl { justify-content: space-between; flex-direction: row; align-items: center; font-weight: 700; cursor: pointer; }
.fx-pijl .pijl { font-size: 1.6rem; transition: transform 0.3s var(--ease); }
.fx-pijl:hover .pijl { transform: translateX(6px); }

/* ---- Teller & advies (knop-vakken) ---- */
.teller-knop, .advies-knop {
  all: unset; cursor: pointer;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  position: absolute; inset: 0; padding: 22px;
}
.teller-knop:active .huge { transform: scale(1.15); }
.teller-knop .huge { transition: transform 0.15s var(--ease); }
.advies-knop span:last-child { font-size: 1.05rem; font-weight: 500; }
.t-teller.feest { animation: feest 0.5s var(--ease); }
@keyframes feest {
  30% { transform: rotate(-2deg) scale(1.04); }
  60% { transform: rotate(2deg) scale(1.02); }
}

/* ---- Kaart-overlay (volledig scherm) ---- */
.kaart-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(13, 15, 23, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: clamp(8px, 3vw, 36px);
}
.kaart-overlay[hidden] { display: none; }
.kaart-paneel {
  position: relative; width: 100%; height: 100%;
  border-radius: var(--r); overflow: hidden;
  background: #e8ecef;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
#kaart { position: absolute; inset: 0; z-index: 1; background: #e8ecef; }
.kaart-chip {
  position: absolute; top: 12px; left: 12px; z-index: 1000;
  margin: 0; padding: 7px 12px;
  background: var(--inkt); color: var(--papier);
  border-radius: 100px;
  font-size: 0.78rem; letter-spacing: 0.05em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.kaart-sluit {
  position: absolute; top: 12px; right: 12px; z-index: 1000;
  width: 42px; height: 42px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: var(--inkt); color: var(--papier);
  font-size: 16px; font-family: var(--grotesk);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s var(--ease);
}
.kaart-sluit:hover { transform: scale(1.08); }
body.kaart-open { overflow: hidden; }
.live-stip {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #2fae5f; margin-right: 5px; vertical-align: 1px;
  animation: live-puls 2s ease-in-out infinite;
}
@keyframes live-puls { 50% { opacity: 0.3; } }
/* mini-matrixborden: zwart kastje zoals boven de weg */
.msi-wrap { background: none; border: none; }
.msi {
  display: grid; place-items: center;
  width: 22px; height: 22px;
  background: #0b0d15; color: #fff;
  border: 1px solid #444b66; border-radius: 5px;
  font-family: var(--mono); font-weight: 700; font-size: 11px; line-height: 1;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
}
.msi-ring { border: 2px solid #ff3b30; border-radius: 50%; }
.msi-lane_closed { color: #ff4d3d; font-size: 12px; }
.msi-lane_open { color: #4ade80; font-size: 13px; }
.msi-lane_closed_ahead { color: #ffc53d; font-size: 13px; }
.msi-restriction_end { color: #aab3c5; font-size: 12px; }
.msi-flash { animation: blink 1s steps(1) infinite; }

/* incidenten: ronde waarschuwingsstippen */
.inc {
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  color: #fff;
  font-family: var(--mono); font-weight: 700; font-size: 13px; line-height: 1;
  border: 2px solid #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}
.inc-ongeval { background: #d61f26; }
.inc-voertuig { background: #f59e0b; }
.inc-obstakel { background: #7c6fd0; }
.popup-weg.is-incident { background: #d61f26; }

.leaflet-popup-content-wrapper {
  background: #ffffff; color: var(--inkt);
  border-radius: 12px; font-family: var(--grotesk);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.leaflet-popup-tip { background: #ffffff; }
.leaflet-popup-content { margin: 14px 16px; line-height: 1.45; }
.popup-weg {
  display: inline-block; background: var(--koraal); color: var(--papier);
  font-weight: 700; font-family: var(--mono);
  padding: 1px 8px; border-radius: 6px; margin-bottom: 6px;
}
.popup-weg.is-flitser { background: var(--citroen); color: var(--inkt); }
.popup-detail { opacity: 0.75; font-size: 0.88em; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .board { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 140px; }
  .t-intro, .t-001, .t-typ, .t-waarom { grid-column: span 2; }
}
@media (max-width: 480px) {
  .board { grid-auto-rows: 120px; }
  .tile { padding: 16px; }
  .fx-flip .face { padding: 16px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .tile { animation: none; }
  .typ::after { content: ""; }
}
