/* =========================================================================
   "25 jaar getrouwd" photobook.
   Design echoes the UNHCR site (brand blue #0072BC, clean sans UI chrome) but
   dressed as a bound printed album: navy linen cover, cream paper, photos
   mounted like prints with a white border.
   ========================================================================= */
:root {
  --blue: #0072BC;            /* UNHCR brand blue */
  --blue-dark: #005a96;
  --navy: #10243a;            /* book cover */
  --navy-2: #1c3653;
  --gold: #c8a24a;            /* foil accent on the cover */
  --paper: #fbf7ef;           /* cream page */
  --paper-edge: #efe7d6;
  --ink: #2a2724;
  --muted: #8a8275;
  --backdrop-1: #243447;
  --backdrop-2: #0e1822;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  font-family: "Helvetica Neue", Arial, "Segoe UI", system-ui, sans-serif;
  color: #eef2f6;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--backdrop-1), var(--backdrop-2) 70%);
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100%;
  display: flex; flex-direction: column;
  align-items: center;
  padding: 14px 12px 22px;
  width: 100%;
  overflow-x: hidden;            /* the flip canvas must never widen the page */
}

/* --- top bar --------------------------------------------------------------*/
.topbar {
  width: 100%; max-width: 1180px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 14px;
}
.topbar .brand {
  font-weight: 800; letter-spacing: .5px; font-size: 18px;
  color: #fff;
}
.topbar .brand::before {
  content: ""; display: inline-block; width: 26px; height: 3px;
  background: var(--blue); margin-right: 10px; vertical-align: middle;
}
.topbar .hint { color: #9fb2c4; font-size: 13px; transition: opacity .4s; }
.topright { display: flex; align-items: center; gap: 14px; }

.langswitch { display: flex; align-items: center; gap: 8px; }
.langswitch .flag {
  display: block; width: 30px; height: 20px; border-radius: 3px; overflow: hidden;
  opacity: .5; transition: .14s; box-shadow: 0 0 0 1px rgba(255,255,255,.25);
}
.langswitch .flag img { display: block; width: 100%; height: 100%; }
.langswitch .flag:hover { opacity: .9; transform: translateY(-1px); }
.langswitch .flag.active { opacity: 1; box-shadow: 0 0 0 2px var(--blue); }

/* --- the book -------------------------------------------------------------*/
.book-wrap {
  flex: 1;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.book { margin: 0 auto; touch-action: pan-y; }

/* StPageFlip sets sizes inline; we only style the page surfaces. */
.page {
  background: var(--paper);
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
.page--photo,
.page--intro {
  background:
    linear-gradient(90deg, rgba(0,0,0,.10), rgba(0,0,0,0) 7%, rgba(0,0,0,0) 93%, rgba(0,0,0,.06)),
    var(--paper);
  box-shadow: inset 0 0 60px rgba(120,100,60,.06);
}
/* soft gutter shadow on the inner edge of each leaf */
.--right .page--photo { box-shadow: inset 22px 0 30px -22px rgba(60,45,20,.35); }

/* --- cover ---------------------------------------------------------------*/
.page--cover {
  background:
    radial-gradient(130% 100% at 30% 0%, var(--navy-2), var(--navy) 70%);
  color: #f3ead2;
}
.page--cover .cover-inner {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 10% 12%;
  border: 1px solid rgba(200,162,74,.35);
  margin: 14px; border-radius: 4px;
}
.cover-kicker {
  text-transform: uppercase; letter-spacing: 4px; font-size: 12px;
  color: var(--gold); margin: 0 0 8px;
}
.cover-title {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700; font-size: clamp(28px, 6vw, 52px);
  margin: 6px 0; color: #fff; line-height: 1.05;
}
.cover-title.small { font-size: clamp(30px, 8vw, 60px); color: var(--gold); }
.cover-sub { color: #d8c6a0; margin: 4px 0 0; font-size: clamp(13px, 2.4vw, 17px); }
.cover-foot { color: #b9a778; font-size: 12px; letter-spacing: 1px; margin-top: 14px; }
.cover-rule {
  width: 54px; height: 2px; margin: 16px auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* --- intro page ----------------------------------------------------------*/
.page--intro .intro-inner {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 14% 16%; color: var(--ink);
}
.page--intro h2 {
  font-family: Georgia, serif; font-size: clamp(26px, 5vw, 44px);
  color: var(--blue); margin: 0 0 14px;
}
.page--intro p { color: #5a544a; line-height: 1.7; margin: 0 0 10px; max-width: 34ch; }
.intro-mark { font-family: Georgia, serif; font-style: italic; color: var(--muted); }

/* --- photo leaf layouts --------------------------------------------------*/
.page--photo .leaf {
  height: 100%; padding: 7% 7% 8%;
  display: flex; gap: 5%;
  align-items: center; justify-content: center;
}
.tpl-duo-landscape .leaf { flex-direction: column; }
.tpl-single .leaf { padding: 8%; }

.tile {
  margin: 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  max-height: 100%;
  cursor: zoom-in;
}
.tpl-duo-portrait .tile { flex: 1 1 0; }
.tpl-duo-landscape .tile { width: 100%; flex: 1 1 0; }

/* a print mounted on the page */
.paper-photo {
  position: relative; display: inline-block;
  background: #fff;
  padding: 2.6%;
  border-radius: 2px;
  box-shadow:
    0 1px 1px rgba(0,0,0,.10),
    0 10px 22px -10px rgba(40,30,10,.45);
  max-width: 100%; max-height: 100%;
  transition: transform .18s ease, box-shadow .18s ease;
}
.tile:hover .paper-photo,
.tile:focus-visible .paper-photo {
  transform: translateY(-2px) rotate(-.3deg);
  box-shadow: 0 2px 2px rgba(0,0,0,.12), 0 18px 30px -12px rgba(40,30,10,.5);
}
.paper-photo img {
  display: block; max-width: 100%; max-height: 100%;
  width: auto; height: auto; object-fit: contain;
  border-radius: 1px;
}
/* give single full-page photos room to breathe */
.tpl-single .paper-photo img { max-height: 74vh; }
.tpl-duo-portrait .paper-photo img,
.tpl-duo-landscape .paper-photo img { max-height: 60vh; }

figcaption {
  margin-top: 9px; font-size: 12.5px; color: var(--muted);
  font-family: Georgia, serif; font-style: italic; letter-spacing: .2px;
  text-align: center;
}

/* video play badge */
.is-video .playbtn {
  position: absolute; inset: 0; margin: auto;
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(0,114,188,.85); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; padding-left: 4px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  pointer-events: none;
}
.is-video { cursor: pointer; }

.folio { display: none; }

/* --- controls ------------------------------------------------------------*/
.controls {
  display: flex; align-items: center; gap: 16px;
  margin-top: 16px;
}
.navbtn {
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06); color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer;
  transition: .14s; display: flex; align-items: center; justify-content: center;
}
.navbtn:hover { background: var(--blue); border-color: var(--blue); }
.navbtn:disabled { opacity: .3; cursor: default; }
.counter { color: #b9c6d4; font-size: 13px; min-width: 78px; text-align: center; letter-spacing: .3px; }

/* --- lightbox ------------------------------------------------------------*/
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8,12,18,.94);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 4vw, 48px);
}
.lightbox[hidden] { display: none; }
.lb-stage {
  max-width: 92vw; max-height: 86vh;
  display: flex; align-items: center; justify-content: center;
}
.lb-stage img, .lb-stage video {
  max-width: 92vw; max-height: 86vh;
  width: auto; height: auto;
  border-radius: 3px; box-shadow: 0 20px 60px rgba(0,0,0,.6);
  background: #000;
}
.lb-close, .lb-nav {
  position: fixed; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18); color: #fff;
  cursor: pointer; transition: .14s; backdrop-filter: blur(4px);
}
.lb-close {
  top: 18px; right: 20px; width: 46px; height: 46px; border-radius: 50%;
  font-size: 26px; line-height: 1;
}
.lb-nav {
  top: 50%; transform: translateY(-50%);
  width: 54px; height: 72px; border-radius: 10px; font-size: 34px;
}
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-close:hover, .lb-nav:hover { background: var(--blue); border-color: var(--blue); }
.lb-caption {
  position: fixed; bottom: 18px; left: 0; right: 0; text-align: center;
  color: #cdd6df; font-family: Georgia, serif; font-style: italic; font-size: 14px;
}

/* --- responsive ----------------------------------------------------------*/
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  .stage { padding: 0 0 6px; }

  /* slim top bar; keep the flags fully on-screen */
  .topbar { padding: 9px 12px; gap: 8px; }
  .topbar .brand { font-size: 15px; white-space: nowrap; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .topbar .brand::before { width: 16px; margin-right: 7px; }
  .topbar .hint { display: none; }
  .topright { gap: 10px; flex: 0 0 auto; }
  .langswitch { gap: 8px; }
  .langswitch .flag { width: 28px; height: 19px; }

  /* give the photos most of the screen */
  .book-wrap { padding: 2px 0; }
  .page--photo .leaf { padding: 3% 3.5% 4%; gap: 3%; }
  .tpl-single .leaf { padding: 3.5%; }
  .paper-photo { padding: 1.8%; }
  .tpl-single .paper-photo img { max-height: 74vh; }
  .tpl-duo-portrait .paper-photo img,
  .tpl-duo-landscape .paper-photo img { max-height: 43vh; }

  /* bigger, easier nav tap targets */
  .controls { margin-top: 8px; gap: 22px; }
  .navbtn { width: 54px; height: 54px; font-size: 27px; }

  .lb-nav { width: 44px; height: 60px; font-size: 28px; }
  .lb-close { width: 42px; height: 42px; top: 12px; right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .paper-photo { transition: none; }
}
