/* =========================================================================
   DECK ENGINE - reusable slide-site core (LH / PV / privacy.potjevet.nl)
   Layout + slide flow + mosaic tiles + swappable nav. Site-agnostic.
   All colour/type/spacing comes from CSS custom properties a theme sets.
   ========================================================================= */

:root {
  /* Theme-overridable tokens (defaults are a neutral fallback). */
  --bg: #11131a;
  --fg: #e9ecf2;
  --muted: #9aa3b2;
  --accent: #6ea8fe;
  --tile-bg: #1b1e27;
  --tile-bg-hover: #222633;
  --nav-bg: #0d0f15;
  --radius: 18px;
  --radius-sm: 12px;
  --gap: 16px;
  --pad: 22px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font);
  --slide-ms: 600ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --nav-size: 248px;   /* sidebar width / bottom height base */
  --rail-size: 76px;   /* thin-rail width */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  /* HARD RULE: no scrollbars, ever. Full-screen app surface. */
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* mobile dynamic viewport */
}

/* ---- Nav rail: swappable via <html data-nav="sidebar|rail|bottom"> ------ */
.nav {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--pad);
  background: var(--nav-bg);
  z-index: 5;
}
[data-nav="sidebar"] #app { flex-direction: row; }
[data-nav="sidebar"] .nav { width: var(--nav-size); }

[data-nav="rail"] #app { flex-direction: row; }
[data-nav="rail"] .nav { width: var(--rail-size); align-items: center; }
[data-nav="rail"] .nav__label { display: none; }

[data-nav="bottom"] #app { flex-direction: column-reverse; }
[data-nav="bottom"] .nav {
  width: 100%;
  height: var(--rail-size);
  flex-direction: row;
  align-items: center;
  overflow-x: auto;
}
[data-nav="bottom"] .nav__spacer { display: none; }

.nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.2px;
  margin-bottom: 10px;
  color: var(--fg);
}
/* Items vertically centred in the rail (Lee). */
.nav__items { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; justify-content: center; }
[data-nav="bottom"] .nav__items { flex-direction: row; flex: 1 1 auto; }

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--ease) 180ms, color var(--ease) 180ms;
}
.nav__item:hover { background: var(--tile-bg); color: var(--fg); }
.nav__item[aria-current="true"] { color: var(--fg); background: var(--tile-bg); }
.nav__item[aria-current="true"]::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); flex: 0 0 auto;
}

.nav__spacer { flex: 1 1 auto; }
.nav__foot { display: flex; flex-direction: column; gap: 8px; }
[data-nav="bottom"] .nav__foot { flex-direction: row; align-items: center; }
.nav__langs { display: flex; gap: 8px; flex-wrap: wrap; }
.nav__lang {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 26px; padding: 0; border-radius: 7px;
  border: 1.5px solid transparent; background: var(--tile-bg);
  cursor: pointer; font-size: 1.05rem; line-height: 1; overflow: hidden;
  filter: saturate(0.85) opacity(0.7);
  transition: filter var(--ease) 160ms, border-color var(--ease) 160ms, transform var(--ease) 160ms;
}
.nav__lang:hover { filter: none; transform: translateY(-1px); }
.nav__lang[aria-current="true"] { filter: none; border-color: var(--accent); }
.nav__contact {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--radius-sm);
  background: var(--accent); color: #08101f; text-decoration: none;
  font-weight: 600; font-size: 0.9rem;
}

/* ---- Deck: the slide viewport ------------------------------------------ */
.deck {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
}
.slides {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;       /* slides stack vertically, full-height each */
  transition: transform var(--slide-ms) var(--ease);
  will-change: transform;
}
.slide {
  position: relative;
  flex: 0 0 100%;               /* one viewport tall; translateY moves between */
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Horizontal track inside a slide: tiles build left-to-right; if wider than
   the viewport the engine pans it horizontally before ticking to the next
   slide. */
.slide__track {
  display: flex;
  align-items: stretch;
  gap: var(--gap);
  padding: var(--pad) clamp(var(--pad), 4vw, 64px);
  min-width: 100%;
  height: 100%;
  transition: transform var(--slide-ms) var(--ease);
  will-change: transform;
}

/* .mosaic is defined further down as a JS-packed flex row (see _packMosaic). */

.tile {
  background: var(--tile-bg);
  border-radius: var(--radius);
  padding: var(--pad);
  min-width: clamp(220px, 24vw, 340px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: background var(--ease) 200ms, transform var(--ease) 200ms,
              grid-row var(--ease) 300ms;
  cursor: default;
}
.tile--wide { grid-row: span 2; }
.tile--hero { grid-row: span 2; min-width: clamp(280px, 34vw, 520px); }
.tile:hover { background: var(--tile-bg-hover); }
.tile__title { font-weight: 650; font-size: 1.05rem; }
.tile__sub { color: var(--muted); font-size: 0.9rem; }
.tile__body { color: var(--fg); font-size: 0.95rem; line-height: 1.5; }
.tile__media {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #0008;
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
}
.tile__credit { color: var(--muted); font-size: 0.72rem; margin-top: auto; }

.tile__more {
  margin-top: auto; align-self: flex-start;
  background: transparent; border: 0; color: var(--accent);
  font: inherit; font-weight: 600; cursor: pointer; padding: 4px 0;
}
.tile.is-expanded { min-width: clamp(360px, 44vw, 640px); }
.tile.is-expanded .tile__clip { max-height: none; }
.tile__clip { max-height: 4.5em; overflow: hidden; }

.tile__links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.tile__link {
  color: var(--accent); text-decoration: none; font-size: 0.88rem;
  display: inline-flex; align-items: center; gap: 6px;
}

/* Landing hero tile typographic emphasis. */
.tile--name .tile__title { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.05; }
.tile--name .tile__taglines { color: var(--muted); font-size: 1rem; }

/* Slide progress dots (vertical position indicator). */
.dots {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 9px; z-index: 4;
}
[data-nav="bottom"] .dots { right: 14px; }
.dots__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); opacity: 0.4; border: 0; padding: 0; cursor: pointer;
  transition: opacity var(--ease) 200ms, transform var(--ease) 200ms;
}
.dots__dot[aria-current="true"] { opacity: 1; transform: scale(1.4); background: var(--accent); }

/* Reduced-motion: honour the user. */
@media (prefers-reduced-motion: reduce) {
  .slides, .slide__track, .tile { transition: none; }
}

/* Small screens: nav collapses to bottom regardless of data-nav. */
@media (max-width: 720px) {
  #app { flex-direction: column-reverse; }
  .nav { width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; }
  .nav__brand, .nav__spacer { display: none; }
  .nav__items { flex-direction: row; overflow-x: auto; }
}

/* ---- Hero slide (centred landing, no panes) ---------------------------- */
.slide--hero { justify-content: center; }
.hero {
  display: flex; flex-direction: column; align-items: center; gap: 26px;
  width: 100%; padding: var(--pad); text-align: center;
}
.hero__inner {
  display: flex; align-items: center; gap: clamp(20px, 4vw, 56px);
  flex-wrap: wrap; justify-content: center;
}
.hero__photo {
  width: clamp(120px, 16vw, 210px); aspect-ratio: 1; border-radius: 50%;
  object-fit: cover; box-shadow: 0 18px 50px -20px rgba(0,0,0,0.8);
  border: 3px solid rgba(255,255,255,0.06);
}
.hero__name {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 5.6rem); line-height: 0.98;
  margin: 0; color: var(--fg);
}
.hero__roles {
  font-size: clamp(1.1rem, 2.4vw, 1.7rem); color: var(--muted);
  display: inline-flex; align-items: baseline; gap: 0.5ch; min-height: 1.6em;
  font-weight: 500;
}
.hero__roles-static { color: var(--muted); }
.hero__role {
  color: var(--accent); font-weight: 650; white-space: nowrap;
  display: inline-block; will-change: clip-path, transform, opacity;
}

/* Default "pencil": write in left-to-right, scrape out left-to-right. */
@keyframes role-write { from { clip-path: inset(0 100% 0 0); opacity: 0.2; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
@keyframes role-erase { from { clip-path: inset(0 0 0 0); opacity: 1; transform: rotate(0); } to { clip-path: inset(0 0 0 100%); opacity: 0; transform: rotate(-1.5deg); } }
.hero__role.is-in  { animation: role-write 460ms var(--ease) both; }
.hero__role.is-out { animation: role-erase 360ms var(--ease) both; }

/* Variant "bounce" (e.g. Creator). */
@keyframes role-bounce-in { 0% { transform: translateY(40%); opacity: 0; } 60% { transform: translateY(-12%); opacity: 1; } 100% { transform: translateY(0); } }
.hero__role.anim-bounce.is-in  { animation: role-bounce-in 520ms var(--ease) both; }
.hero__role.anim-bounce.is-out { animation: role-erase 300ms var(--ease) both; }

/* Variant "glitch" (e.g. Multimedia). */
@keyframes role-glitch-in { 0% { opacity: 0; transform: translateX(-6px) skewX(8deg); } 30% { opacity: 1; transform: translateX(4px) skewX(-6deg); } 60% { transform: translateX(-2px) skewX(3deg); } 100% { transform: none; } }
.hero__role.anim-glitch.is-in  { animation: role-glitch-in 480ms steps(6, end) both; }
.hero__role.anim-glitch.is-out { animation: role-erase 280ms var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  .hero__role.is-in, .hero__role.is-out { animation: none; }
}

/* ---- Read-more focus: clicked tile grows, siblings shrink + dim, smooth -- */
.tile {
  transition: background var(--ease) 220ms, transform var(--ease) 340ms,
              opacity var(--ease) 340ms, min-width var(--ease) 380ms,
              box-shadow var(--ease) 300ms;
}
.mosaic.has-focus .tile:not(.is-expanded) { transform: scale(0.92); opacity: 0.4; }
.tile.is-expanded { z-index: 2; }

/* Poem tile: set with the display face, breathing room, preserve line breaks. */
.tile--poem .tile__body, .tile--poem .tile__clip {
  font-family: var(--font-display); font-style: italic;
  font-size: 1.05rem; line-height: 1.75; white-space: pre-line; color: var(--fg);
}

/* ---- Bottom cues: horizontal scroll indicator + next-slide down arrow ---- */
/* Side dots retired in favour of the down arrow (Lee). */
.dots { display: none !important; }

.scroll-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  width: min(420px, 46%); height: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.07); z-index: 4; pointer-events: none;
  opacity: 0; transition: opacity 420ms var(--ease);
}
.scroll-hint.is-shown { opacity: 1; }
.scroll-hint__fill {
  height: 100%; width: 14%; border-radius: 999px; background: var(--accent);
  transition: width var(--slide-ms) var(--ease);
}

.next-cue {
  position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  z-index: 4; color: var(--muted); cursor: pointer; background: none;
  border: 0; font: inherit; font-size: 0.7rem; letter-spacing: 0.2px;
  opacity: 0.7; transition: opacity 320ms var(--ease), color 320ms var(--ease);
}
.next-cue:hover { opacity: 1; color: var(--fg); }
.next-cue.is-hidden { opacity: 0; pointer-events: none; }
.next-cue__chevron {
  width: 20px; height: 12px; display: block;
  animation: cue-bob 2.2s ease-in-out infinite;
}
.next-cue__chevron path { stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
@keyframes cue-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@media (prefers-reduced-motion: reduce) { .next-cue__chevron { animation: none; } }

/* Keyboard-selected tile: glows until summoned (Enter) or Esc clears it. */
.tile.is-selected {
  outline: 2px solid var(--accent); outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(201, 138, 94, 0.16), 0 16px 34px -18px rgba(0, 0, 0, 0.8);
  transform: translateY(-2px);
}
.mosaic.has-focus .tile.is-selected:not(.is-expanded) { opacity: 1; transform: translateY(-2px); }

/* ---- Sidebar foot reorder (Lee): brand bottom, contact, language --------- */
.nav__foot { gap: 12px; }
.nav__brand { margin: 0; text-align: left; }              /* now sits at the bottom */
.nav__contact { justify-content: center; gap: 9px; }       /* centred label + icon */
.nav__contact-ico { width: 16px; height: 16px; display: block; }
.nav__contact-ico path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Language selector: current flag is the toggle; the rest unfold as a popover. */
.nav__langs { position: relative; flex-direction: column; align-items: flex-start; gap: 6px; }
.nav__lang--current { filter: none; border-color: rgba(255, 255, 255, 0.12); }
.nav__lang-list {
  display: flex; gap: 7px; flex-wrap: wrap;
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 300ms var(--ease), opacity 220ms var(--ease);
}
.nav__langs.open .nav__lang-list { max-height: 140px; opacity: 1; }

/* Pan via --panx so the end-of-row bump can animate around the rest position. */
.slide__track { transform: translateX(var(--panx, 0px)); }
.slide__track.is-bump { animation: track-bump 420ms var(--ease); }
@keyframes track-bump {
  0%, 100% { transform: translateX(var(--panx, 0px)); }
  45% { transform: translateX(calc(var(--panx, 0px) - 26px)); }
}
.scroll-hint.is-bump .scroll-hint__fill { animation: hint-bump 420ms var(--ease); }
@keyframes hint-bump { 0%, 100% { transform: none; } 50% { transform: scaleX(1.06); } }

/* ---- Software logo rail (greyed icons, tooltip on hover) ----------------- */
.slide--logorail .slide__track { align-items: center; }
.logorail { display: flex; align-items: center; gap: 34px; height: 100%; padding: 0 clamp(var(--pad), 5vw, 88px); }
.logo { position: relative; display: flex; flex-direction: column; align-items: center; outline: none; }
.logo__icon {
  width: 88px; height: 88px; border-radius: 20px; display: grid; place-items: center;
  background: var(--tile-bg); color: var(--muted); font-size: 2rem; font-weight: 700;
  filter: grayscale(1); opacity: 0.5;
  transition: opacity var(--ease) 200ms, transform var(--ease) 220ms, filter var(--ease) 220ms, box-shadow var(--ease) 220ms;
}
.logo__img { width: 56%; height: 56%; object-fit: contain; filter: grayscale(1); }
.logo:hover .logo__icon, .logo:focus-visible .logo__icon { opacity: 1; filter: grayscale(0); transform: translateY(-4px); box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.8); }
.logo:hover .logo__img, .logo:focus-visible .logo__img { filter: none; }
.logo__name {
  position: absolute; bottom: -34px; left: 50%; transform: translateX(-50%) translateY(4px);
  opacity: 0; pointer-events: none; white-space: nowrap;
  background: rgba(0, 0, 0, 0.8); color: var(--fg); padding: 4px 10px; border-radius: 8px; font-size: 0.82rem;
  transition: opacity var(--ease) 160ms, transform var(--ease) 160ms;
}
.logo:hover .logo__name, .logo:focus-visible .logo__name { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Contact row (flag inline at start + contact button) + Contact slide -- */
.nav__cta-row { display: flex; align-items: center; gap: 10px; }
.nav__cta-row .nav__contact { flex: 1 1 auto; cursor: pointer; }
.nav__cta-row .nav__langs { position: relative; flex: 0 0 auto; }
.nav__cta-row .nav__lang-list {
  position: absolute; bottom: calc(100% + 8px); left: 0; flex-direction: column;
  background: var(--nav-bg); padding: 6px; border-radius: 12px;
  box-shadow: 0 14px 32px -12px rgba(0, 0, 0, 0.85); z-index: 6; pointer-events: none;
}
.nav__cta-row .nav__langs.open .nav__lang-list { pointer-events: auto; }

.slide--contact .contact { max-width: 700px; margin: 0 auto; }
.contact { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; padding: var(--pad); }
.contact__heading { font-family: var(--font-display); font-size: clamp(1.8rem, 4.5vw, 3.2rem); margin: 0; color: var(--fg); }
.contact__note { color: var(--muted); font-size: 1.05rem; line-height: 1.65; margin: 0; max-width: 54ch; }
.contact__links { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 8px; }
.contact__link {
  color: var(--fg); text-decoration: none; padding: 9px 16px; border-radius: 999px;
  background: var(--tile-bg); border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background var(--ease) 180ms, transform var(--ease) 180ms, border-color var(--ease) 180ms;
}
.contact__link:hover { background: var(--tile-bg-hover); border-color: var(--accent); transform: translateY(-2px); }

/* Feature tile: stands out / gets priority (e.g. PotjeVet, Lee's own brand). */
.tile--feature { border-color: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 38px -18px rgba(0, 0, 0, 0.85); }
.tile--feature .tile__title { color: var(--accent-2); }

/* Poem tile shows in full (no read-more clip). */
.tile--poem .tile__clip { max-height: none; }
.tile--poem { justify-content: center; }

/* ---- Contact: borderless social icon lineup (Lee) ----------------------- */
.contact__icons { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.contact__icon {
  position: relative; display: grid; place-items: center; width: 46px; height: 46px;
  color: var(--muted); text-decoration: none;
  transition: color var(--ease) 180ms, transform var(--ease) 180ms;
}
.contact__icon:hover { color: var(--accent-2); transform: translateY(-3px); }
.contact__svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.contact__icon-name {
  position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%);
  font-size: 0.74rem; color: var(--muted); opacity: 0; pointer-events: none; white-space: nowrap;
  transition: opacity var(--ease) 160ms;
}
.contact__icon:hover .contact__icon-name { opacity: 1; }

/* ---- Tile sizes, bottom-left tag, poem width (Lee) ---------------------- */
.tile { position: relative; padding-bottom: calc(var(--pad) + 16px); }
.tile__tag {
  position: absolute; left: var(--pad); bottom: 12px;
  font-size: 0.72rem; color: var(--muted); opacity: 0.7; letter-spacing: 0.3px;
}
.tile__more { align-self: flex-end; }   /* keep clear of the bottom-left tag */
.tile--sz-narrow, .tile--sz-small { min-width: clamp(180px, 16vw, 240px); }
.tile--sz-wide { min-width: clamp(360px, 38vw, 600px); }
.tile--sz-big { min-width: clamp(440px, 46vw, 720px); grid-row: span 2; }
.tile--poem { min-width: clamp(440px, 46vw, 720px); grid-row: span 2; }
.tile--poem .tile__title { font-family: var(--font-display); font-size: 1.5rem; }

/* Flag: square with border, neatly centred, same height as the contact button. */
.nav__cta-row { align-items: stretch; }
.nav__cta-row .nav__lang--current {
  width: auto; height: auto; aspect-ratio: 1; align-self: stretch; padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.14); border-radius: 12px;
  display: grid; place-items: center; font-size: 1.2rem; filter: none;
}

/* Snappy pan so free scrolling feels continuous, not ticky (Lee). */
.slide__track { transition: transform 170ms var(--ease); }

/* ---- Masonry mosaic: JS-packed columns (engine.js _packMosaic) ----------- */
/* The mosaic is a flex row of .mosaic-col columns. engine.js measures tile   */
/* heights and fills each column to viewport height, pulling later tiles up   */
/* to close gaps. CSS only sets the row/column/tile box; packing lives in JS. */
.slide:not(.slide--hero):not(.slide--contact) { align-items: center; }
.mosaic {
  display: flex; flex-direction: row; flex-wrap: nowrap;
  align-items: flex-start; gap: var(--gap);
  height: auto; width: max-content; padding: 0;
}
.mosaic-col { display: flex; flex-direction: column; gap: var(--gap); width: clamp(300px, 30vw, 420px); flex: 0 0 auto; }
.mosaic .tile { width: 100%; min-width: 0; height: auto; margin: 0; flex: 0 0 auto; }
.mosaic .tile--poem { max-width: none; }
.tile--poem .tile__body, .tile--poem .tile__clip { text-align: center; }
