/* ===== Stamp Out War — Interactive Exhibition ===== */
/* QT Bengal: the display face of stampoutwar.com */
@font-face {
  font-family: "QT Bengal"; font-style: normal; font-weight: 400; font-display: fallback;
  src: url("media/fonts/qt-bengal-400-normal.otf") format("opentype");
}
@font-face {
  font-family: "QT Bengal"; font-style: normal; font-weight: 700; font-display: fallback;
  src: url("media/fonts/qt-bengal-700-normal.otf") format("opentype");
}

:root {
  --blue: #0057B7;
  --blue-deep: #003a7a;
  --blue-bright: #0C93E7;
  --yellow: #FFDD00;
  --yellow-warm: #f5c400;
  --paper: #fffdf6;
  --paper-dark: #f3efe2;
  --ink: #292524;
  --ink-soft: #57534e;
  --postmark: rgba(28, 39, 80, .55);
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --display: "QT Bengal", var(--serif);
  --hand: "Caveat", cursive;
  --card-ratio: 1400 / 983;
  --shadow: 0 2px 6px rgba(28,39,51,.14), 0 12px 28px rgba(28,39,51,.12);
}

* { box-sizing: border-box; }
/* 112.5% root = 1rem ≈ 18px: body text 1.125rem-equivalent, all rem sizes scale along */
html { scroll-behavior: smooth; font-size: 112.5%; }
body {
  margin: 0;
  font-family: var(--sans);
  line-height: 1.55;              /* ≈ 1.75rem at body size */
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(rgba(28,39,51,.035) 1px, transparent 1px);
  background-size: 22px 22px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
#view { flex: 1; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--blue); }

/* ===== Top bar ===== */
#topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.2rem;
  padding: .55rem 1.2rem;
  background: rgba(255, 253, 246, .78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(231, 229, 228, .6);
}
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.brand:hover .brand-name { color: var(--blue); }
.brand-icon {
  width: 28px; height: 28px; object-fit: contain;
  transition: transform .2s;
}
.brand:hover .brand-icon { transform: rotate(-8deg); }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; letter-spacing: .02em; white-space: nowrap; }
.brand-name span { display: inline; }
.nav-links { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav-links a {
  text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: .92rem;
  padding: .3rem .7rem; border-radius: 999px; transition: background .15s, color .15s;
}
.nav-links a:hover { background: rgba(0,87,183,.1); color: var(--blue-deep); }
.nav-links a.active { background: var(--blue); color: #fff; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
#draw-btn {
  border: none; border-radius: 999px; padding: .42rem .95rem;
  background: var(--yellow); color: var(--ink); font-weight: 700; font-size: .9rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .12s, box-shadow .12s;
}
#draw-btn:hover { transform: translateY(-1px) rotate(-1deg); box-shadow: 0 3px 8px rgba(0,0,0,.25); }
#passport {
  display: flex; align-items: center; gap: .35rem;
  font-size: .88rem; font-weight: 600; color: var(--blue-deep); white-space: nowrap;
  background: rgba(0, 87, 183, .08);
  border: 1.5px solid rgba(0, 87, 183, .35); border-radius: 999px;
  padding: .38rem .85rem;
  transition: background .15s, border-color .15s, transform .12s;
}
#passport:hover { background: rgba(0, 87, 183, .16); border-color: var(--blue); transform: translateY(-1px); }
#passport b { color: var(--blue); }

/* ===== Visitor's Passport book ===== */
.passport-book {
  max-width: 860px; margin: 0 auto; border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
.passport-cover {
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.08), transparent 40%),
    #14264f;
  color: #d9b64f; text-align: center; padding: 1.7rem 1.2rem 1.4rem;
  border-bottom: 3px double #d9b64f;
}
.passport-cover .emblem { font-size: 2.1rem; display: block; margin-bottom: .3rem; }
.passport-cover h2 {
  font-family: var(--serif); font-weight: 700; margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: .14em; text-transform: uppercase;
}
.passport-cover p {
  margin: .35rem 0 0; font-size: .75rem; letter-spacing: .28em; text-transform: uppercase;
  color: rgba(217, 182, 79, .8);
}
.passport-pages {
  background: #fbf7ec;
  background-image: radial-gradient(rgba(20, 38, 79, .05) 1px, transparent 1px);
  background-size: 18px 18px;
  padding: 1.5rem clamp(1rem, 3vw, 2.2rem) 2rem;
}
.pp-intro p { color: var(--ink-soft); max-width: 44rem; margin: .3rem auto; text-align: center; }
.pp-intro b { color: var(--ink); }
.pp-progress {
  height: 9px; max-width: 30rem; margin: .9rem auto .35rem; border-radius: 999px;
  background: rgba(20, 38, 79, .12); overflow: hidden;
}
.pp-progress span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--blue-bright) 60%, var(--yellow));
  transition: width .6s ease;
}
.pp-progress-label { text-align: center; font-size: .8rem; color: var(--ink-soft); margin: 0 0 .4rem; }
.pp-complete {
  text-align: center; font-weight: 700; color: #8a6d1a;
  background: rgba(255, 221, 0, .25); border: 1px dashed #d9b64f; border-radius: 8px;
  padding: .5rem .8rem; max-width: 30rem; margin: .7rem auto 0 !important;
}
.pp-page h3 {
  font-family: var(--serif); color: var(--ink); font-size: 1.15rem;
  border-bottom: 2px dashed rgba(20, 38, 79, .2); padding-bottom: .3rem; margin: 1.6rem 0 .9rem;
}
.pp-page h3 small { font-family: var(--sans); font-weight: 600; font-size: .76rem; color: var(--ink-soft); }
.pp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .7rem;
}
.pp-stamp {
  aspect-ratio: 1; border-radius: 50%; background: none; padding: .3rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  transform: rotate(var(--rot, 0deg));
  transition: transform .15s, opacity .15s;
}
.pp-stamp:hover { transform: rotate(0deg) scale(1.08); opacity: 1; z-index: 2; }
.pp-stamp.visited {
  color: var(--postmark); border: 2.5px solid var(--postmark);
  background: repeating-linear-gradient(100deg, transparent 0 7px, rgba(28, 39, 80, .07) 7px 9px);
}
.pp-stamp.blank {
  color: rgba(41, 37, 36, .45); border: 2px dashed rgba(41, 37, 36, .3);
  opacity: .6;
}
.pp-stamp.blank .pp-flag { filter: grayscale(.85); opacity: .7; }
.pp-flag { font-size: 1.35rem; line-height: 1; }
.pp-name {
  font-size: .58rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  line-height: 1.1; max-width: 92%; overflow: hidden;
}
.pp-date { font-size: .56rem; letter-spacing: .12em; }

/* ===== Lobby hero — replicates the stampoutwar.com cover ===== */
.hero {
  position: relative; overflow: hidden;
  min-height: 500px;
  display: flex; flex-direction: column; justify-content: flex-start;
  /* bright azure fallback while the video loads */
  background: linear-gradient(180deg, #0082e6 0%, #7ec3f2 55%, #fffdf5 100%);
  padding: 4.2rem 1.5rem 1.6rem;
  text-align: center;
}
.hero-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 80%;
}
.hero-veil {
  /* both veils exported from the finished homepage:
     cover:  linear-gradient(180deg, rgba(0,130,230,.78) 0%, rgb(255,253,245) 88%)
     group:  linear-gradient(180deg, rgba(255,242,158,.78) 0%, rgb(255,253,244) 88%)
     merged here: blue sky -> golden light -> cream, all at the same .78 coverage */
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(0, 130, 230, .78) 0%,
    rgba(240, 248, 254, .85) 42%,
    rgba(255, 251, 238, .92) 68%,
    rgb(255, 253, 244) 88%);
}
.hero-content { position: relative; z-index: 2; }
.hero h1 {
  font-family: var(--serif); font-weight: 400; margin: 0;
  font-size: var(--fs-xx-large, clamp(2.222rem, 2.222rem + ((1vw - 0.2rem) * 5.868), 8.75rem));
  Font-weight: bold;
  line-height: 1.02; letter-spacing: 0; text-transform: uppercase;
  color: #ffd000;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, .5);
}

/* headline second tier, directly under the h1 */
.hero-sub2 {
  font-family: var(--serif); font-style: italic; font-weight: 600;
  color: var(--blue);
  margin: 1.1rem 0 0;
  font-size: clamp(2.25rem, 5vw, 4.5rem); line-height: 1.1;
}
.hero .tagline {
  font-size: clamp(1rem, 1.6vw, 1.2rem); line-height: 1.55; font-weight: 400;
  color: #57534e; max-width: 46rem; margin: 1.8rem auto 2.2rem;
}

/* exhibition byline above the hall doors */
.exhibit-title {
  font-family: var(--serif); font-style: italic; font-weight: 600;
  color: var(--blue); text-align: center;
  font-size: clamp(1.5rem, 2.8vw, 2.4rem); line-height: 1.2;
  margin: .6rem auto 2.4rem;
}

/* bouncing scroll arrow, as on the homepage */
.scroll-down-arrow { text-align: center; margin: 72px 0 44px; }
.arrow-link {
  display: inline-flex; flex-direction: column; align-items: center; gap: .5rem;
  text-decoration: none; color: #a8a29e; cursor: pointer;
  transition: color .3s;
}
.arrow-link .scroll-label {
  font-size: .82rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
}
.arrow-link .arrow-glyph {
  font-size: 3rem; line-height: 1;
  animation: bounce 1s infinite;
}
.arrow-link:hover { color: var(--blue-bright); }
@keyframes bounce {
  0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(.8, 0, 1, 1); }
  50% { transform: none; animation-timing-function: cubic-bezier(0, 0, .2, 1); }
}

/* fanned cards — spread apart so neighbouring hover zones don't fight */
.fan { position: relative; z-index: 2; height: 210px; margin: 1rem auto 0; width: min(760px, 94%); }
.fan a {
  position: absolute; left: 50%; bottom: 0; width: 235px; aspect-ratio: var(--card-ratio);
  border-radius: 6px; overflow: hidden;
  border: 5px solid #fff; box-shadow: 0 6px 20px rgba(0,20,60,.4);
  transform-origin: 50% 130%;
  transform: translateX(calc(-50% + var(--x, 0px) * var(--xf, 1))) rotate(var(--r)) translateY(var(--y));
  transition: transform .35s cubic-bezier(.2,.9,.3,1.3);
}
.fan a img { width: 100%; height: 100%; object-fit: cover; }
.fan a:hover {
  z-index: 20;
  transform: translateX(calc(-50% + var(--x, 0px) * var(--xf, 1))) rotate(0deg) translateY(-24px) scale(1.08);
}

/* glassmorphic stat cards — exact stat-card-blue / stat-card-yellow recipe */
.stats {
  display: flex; justify-content: center; gap: 1.5rem;
  flex-wrap: wrap; margin-top: 2.6rem;
}
.stat.glass {
  text-align: center; min-width: 150px; padding: 1.5rem;
  background: rgba(255, 255, 255, .32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(231, 229, 228, .5);
  border-radius: .75rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05);
  transition: transform .3s ease, background .3s ease;
}
.stat.glass.b { border-top: 4px solid var(--blue); }
.stat.glass.y { border-top: 4px solid #FFDD00; }
.stat.glass:hover { background: rgba(255, 255, 255, .85); transform: translateY(-5px); }
.stat b {
  display: block; font-family: var(--sans); font-weight: 700;
  font-size: clamp(2.25rem, 3vw, 3rem); line-height: 1.1; margin-bottom: .35rem;
  color: var(--blue);
}
.stat.glass.sold { border-top: 4px solid #d24a3b; border-bottom: none; border-left: none; border-right: none; cursor: pointer; font: inherit; }
.stat.glass.sold b { color: #c14538; }
.stats-note {
  text-align: center; margin: .9rem auto 0; font-size: .82rem;
  color: #78716c; max-width: 44rem;
}
.linklike {
  background: none; border: none; padding: 0; font: inherit;
  color: var(--blue); text-decoration: underline; cursor: pointer;
}

/* ===== The Accounts (finance ledger) ===== */
.ledger-book {
  max-width: 880px; margin: 0 auto; background: #fbf7ec;
  background-image: radial-gradient(rgba(20, 38, 79, .05) 1px, transparent 1px);
  background-size: 18px 18px;
  border-radius: 14px; padding: 1.8rem clamp(1.2rem, 4vw, 2.6rem) 2.2rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
.ledger-book h2 { font-family: var(--serif); margin: 0 0 .5rem; color: var(--ink); }
.ledger-lead { color: var(--ink-soft); font-size: .95rem; margin: 0 0 1.2rem; }
.ledger-scroll { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
/* edition cell: fixed-width year so the names line up, no mid-name wrapping */
.ledger-table td.ed { white-space: nowrap; padding-right: 1.2rem; }
.ledger-table .ed-year {
  display: inline-block; width: 3.4em; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ledger-table .ed-name { color: var(--ink-soft); }
.ledger-table th, .ledger-table td {
  padding: .5rem .6rem; text-align: right; color: var(--ink);
  border-bottom: 1px dashed rgba(20, 38, 79, .22);
}
.ledger-table th:first-child, .ledger-table td:first-child { text-align: left; }
.ledger-table th {
  font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); border-bottom: 2px solid rgba(20, 38, 79, .35);
}
.ledger-table td.net { font-weight: 700; white-space: nowrap; }
.ledger-table .neg { color: #b3402f; }
.ledger-table em {
  display: block; white-space: normal; margin-left: auto;
  max-width: 12em; color: var(--ink-soft); font-size: .8rem; font-weight: 400;
}
.ledger-table tfoot td {
  border-bottom: none; border-top: 3px double rgba(20, 38, 79, .5);
  font-weight: 700; padding-top: .7rem;
}
.ledger-table tfoot td.net { color: #b3402f; font-size: 1.05rem; }
@media (max-width: 560px) {
  .ledger-table { font-size: .8rem; }
  .ledger-table th, .ledger-table td { padding: .4rem .3rem; }
}
.stat.glass.y b { color: #1c1917; }
.stat span {
  font-size: .875rem; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: #78716c;
}

/* lobby doors */
.lobby-doors { max-width: 1080px; margin: 0 auto; padding: 2.6rem 1.4rem 3rem; }
.lobby-doors h2, .hall h2, .album h2 {
  font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 .3rem;
}
.lobby-doors .lead { color: var(--ink-soft); margin: 0 0 1.6rem; max-width: 52rem; }
/* three edition halls per row; the Stamp Album centred on its own row */
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.door.album-door { grid-column: 2; }
@media (max-width: 760px) {
  .doors { grid-template-columns: 1fr; }
  .door.album-door { grid-column: auto; }
}
.door {
  position: relative; display: block; text-decoration: none; color: var(--ink);
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s;
  border: 1px solid rgba(28,39,51,.08);
}
.door:hover { transform: translateY(-5px); box-shadow: 0 6px 14px rgba(28,39,51,.16), 0 20px 40px rgba(28,39,51,.16); }
.door-art { height: 118px; background: linear-gradient(to bottom, var(--blue) 0%, var(--blue-bright) 54%, var(--yellow) 54%); position: relative; }
.door-art .postmark-deco {
  position: absolute; right: 14px; top: 14px; width: 74px; height: 74px;
  border: 2.5px solid rgba(255,255,255,.9); border-radius: 50%;
  color: rgba(255,255,255,.95); font-size: .58rem; font-weight: 700; letter-spacing: .06em;
  display: flex; align-items: center; justify-content: center; text-align: center;
  transform: rotate(10deg);
}
/* album door: same flag colours as the year doors, with a little fan of
   perforated stamps from the collection */
.door-art.album-art {
  display: flex; align-items: center; gap: .45rem; padding-left: 1.1rem;
}
.mini-stamp {
  width: 46px; height: 54px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; line-height: 1;
  transform: rotate(var(--r, 0deg));
  filter: drop-shadow(0 3px 6px rgba(0, 20, 60, .35));
  /* real perforation: a scalloped edge of tangent semicircular teeth
     (filled circles along the rim + a solid interior), not punched holes */
  --tooth: 4px;
  -webkit-mask:
    radial-gradient(circle var(--tooth) at var(--tooth) var(--tooth), #000 97%, transparent)
      round 0 0 / calc(var(--tooth) * 2) calc(var(--tooth) * 2),
    linear-gradient(#000, #000)
      var(--tooth) var(--tooth) / calc(100% - var(--tooth) * 2) calc(100% - var(--tooth) * 2) no-repeat;
  mask:
    radial-gradient(circle var(--tooth) at var(--tooth) var(--tooth), #000 97%, transparent)
      round 0 0 / calc(var(--tooth) * 2) calc(var(--tooth) * 2),
    linear-gradient(#000, #000)
      var(--tooth) var(--tooth) / calc(100% - var(--tooth) * 2) calc(100% - var(--tooth) * 2) no-repeat;
}
/* door bodies align across the row: 2 lines reserved for the title,
   2 for the meta, flags pinned to the bottom */
.door-body { padding: .85rem 1rem 1rem; display: flex; flex-direction: column; flex: 1; }
.door { display: flex; flex-direction: column; }
.door-body h3 {
  margin: 0 0 .2rem; font-family: var(--serif); font-size: 1.35rem;
  line-height: 1.2; min-height: 2.4em;
}
.door-body p { margin: 0; color: var(--ink-soft); font-size: .9rem; line-height: 1.35; min-height: 2.7em; }
.door-body .nowrap { white-space: nowrap; }
.door .flagstrip { margin-top: auto; padding-top: .55rem; font-size: 1.05rem; letter-spacing: .12em; overflow: hidden; white-space: nowrap; }

/* how it works */
.howto { max-width: 1080px; margin: 0 auto; padding: 0 1.4rem 3.4rem; }
.howto .cardnote {
  background: #fff; border-radius: 10px; box-shadow: var(--shadow);
  padding: 1.3rem 1.5rem; border-left: 6px solid var(--yellow);
}
.howto h3 { margin: 0 0 .5rem; font-family: var(--serif); }
.howto p { margin: .3rem 0; color: var(--ink-soft); }
.howto .hand { font-family: var(--hand); font-size: 1.35rem; color: var(--ink); }

/* ===== Hall (edition) ===== */
.hall { max-width: 1180px; margin: 0 auto; padding: 2.2rem 1.4rem 3rem; }
.hall .hall-head { margin-bottom: 1.6rem; }
.hall .hall-head .kicker, .album .kicker {
  text-transform: uppercase; letter-spacing: .22em; font-size: .74rem; font-weight: 700;
  color: var(--blue); margin: 0 0 .25rem;
}
.hall .hall-head p.blurb { color: var(--ink-soft); max-width: 56rem; margin: .4rem 0 0; }
.hall-toggle { margin-top: 1rem; }
.continent { margin: 1.8rem 0 0; }
.continent h3 {
  font-family: var(--serif); font-size: 1.15rem; color: var(--ink-soft);
  border-bottom: 2px solid var(--paper-dark); padding-bottom: .3rem; margin: 0 0 .9rem;
  display: flex; align-items: baseline; gap: .6rem;
}
.continent h3 small { font-family: var(--sans); font-weight: 600; font-size: .78rem; color: var(--ink-soft); opacity: .75; }
.plaques { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: .8rem; }
.plaque {
  position: relative; background: #fff; border: 1px solid rgba(28,39,51,.1);
  border-radius: 9px; padding: .85rem .9rem .8rem; text-align: left;
  box-shadow: 0 1px 4px rgba(28,39,51,.08);
  transition: transform .15s, box-shadow .15s;
  overflow: hidden;
}
.plaque:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.plaque .flag { font-size: 2rem; line-height: 1; display: block; margin-bottom: .35rem; }
.plaque .cname { font-weight: 700; font-size: .98rem; display: block; }
.plaque .ccount { color: var(--ink-soft); font-size: .8rem; }
@keyframes stamp-in {
  0% { transform: rotate(-30deg) scale(2.1); opacity: 0; }
  60% { transform: rotate(-14deg) scale(.94); opacity: 1; }
  100% { transform: rotate(-14deg) scale(1); opacity: 1; }
}
.plaque .visited-mark.fresh { animation: stamp-in .5s cubic-bezier(.2, .8, .3, 1.1) both; }
.plaque .visited-mark {
  position: absolute; right: -14px; top: -6px; width: 84px; height: 84px;
  border: 2.5px solid var(--postmark); border-radius: 50%;
  color: var(--postmark); font-size: .52rem; font-weight: 700; letter-spacing: .08em;
  display: flex; align-items: center; justify-content: center; text-align: center;
  transform: rotate(-14deg); pointer-events: none;
  background:
    repeating-linear-gradient(100deg, transparent 0 7px, rgba(28,39,80,.12) 7px 9px);
}

/* ===== Vitrine (country) ===== */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(18, 26, 38, .86);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  overflow-y: auto;               /* content taller than the frame scrolls inside the box */
  overscroll-behavior: contain;   /* never hand the wheel to the page (or embedding iframe parent) */
}
.overlay.hidden { display: none; }

/* ===== Focus Mode (view swap) =====
   Opening any shadow box swaps the whole view: the exhibition (top bar, page,
   footer) is hidden and the overlay itself becomes the document content, in
   normal flow. The page — and therefore the embedding iframe, which is resized
   to the document height — is exactly as tall as the focused content. No
   artificial bottom padding, no overlay positioning tricks, no scroll locks. */
html.modal-active body { background: #121a26; }
html.modal-active #topbar,
html.modal-active #view,
html.modal-active #footer { display: none !important; }

html.modal-active .overlay {
  position: relative; inset: auto; z-index: auto;
  background: transparent;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  overflow: visible; overscroll-behavior: auto;
  min-height: 100vh;              /* full dark stage when the content is short */
  padding: 2rem 0 2.4rem;
}
/* in the auto-resized iframe 100vh is self-referential (doc height -> iframe
   height -> vh): it would stop the iframe from ever shrinking. Content rules. */
html.embedded.modal-active .overlay { min-height: 0; }
html.embedded body { min-height: 0; }

/* the inner scroller becomes normal document flow */
html.modal-active .overlay-scroll { height: auto; overflow: visible; }

/* controls pin to the document instead of the viewport inside the iframe */
html.embedded .close-btn { position: absolute; top: .9rem; right: 1rem; }
html.embedded .viewer-arrow { position: absolute; top: min(36vw, 430px); }

/* the viewer card and stamp lightbox size by vh in standalone mode; inside the
   auto-resized iframe vh is meaningless, so size by width and let the parent
   page scroll if the card is taller than the visitor's screen */
html.embedded .flip-card { width: min(1400px, 94vw); }
html.embedded .stampbox-frame img { max-height: none; }
.overlay-scroll { width: 100%; height: 100%; overflow-y: auto; padding: 2.6rem 1.4rem 3rem; }
.close-btn {
  position: fixed; top: .8rem; right: 1rem; z-index: 70;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.14); color: #fff; font-size: 1.6rem; line-height: 1;
  transition: background .15s, transform .15s;
}
.close-btn:hover { background: rgba(255,255,255,.3); transform: rotate(90deg); }

.vitrine-head { max-width: 1080px; margin: 0 auto 1.4rem; color: #fff; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.vitrine-head .flag { font-size: 3rem; filter: drop-shadow(0 3px 6px rgba(0,0,0,.4)); }
.vitrine-head h2 { font-family: var(--serif); margin: 0; font-size: clamp(1.6rem, 3.4vw, 2.4rem); }
.vitrine-head .meta { width: 100%; color: rgba(255,255,255,.75); margin-top: -.4rem; font-size: .95rem; }
.vitrine-grid {
  max-width: 1080px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.3rem;
}
.vcard { background: transparent; border: none; padding: 0; text-align: left; color: #fff; }
.vcard .vcard-img {
  display: block;
  aspect-ratio: var(--card-ratio); border-radius: 5px; overflow: hidden;
  border: 5px solid #fff; box-shadow: 0 8px 22px rgba(0,0,0,.45);
  transition: transform .2s;
  background: #fff;
}
.vcard:hover .vcard-img { transform: scale(1.04) rotate(-.6deg); }
.vcard .vcard-img img { width: 100%; height: 100%; object-fit: contain; }
.vcard .vlabel { display: block; margin-top: .5rem; font-size: .86rem; color: rgba(255,255,255,.85); }
.vcard .vlabel b { color: #fff; }
.vcard .vlabel .hand { font-family: var(--hand); font-size: 1.15rem; color: var(--yellow); }
/* card number + town on the left, red-ink "sold" tag pushed to the right */
.vlabel .vlabel-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: .6rem;
}
.vlabel .hand { display: block; }
.vlabel .sold-tag {
  display: inline-block; padding: 0 .45rem; white-space: nowrap;
  border: 1.5px solid rgba(226, 96, 79, .8); border-radius: 5px;
  color: #ff9d8f; font-size: .72rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; transform: rotate(-2deg);
}

/* dealer's hand-stamp in the card viewer */
.sold-stamp {
  display: inline-block; margin-top: .65rem;
  padding: .28rem 1rem .24rem;
  border: 2.5px solid #d24a3b; border-radius: 8px;
  box-shadow: inset 0 0 0 1.5px rgba(210, 74, 59, .35);
  color: #e2604f; font-weight: 800; font-size: .82rem;
  letter-spacing: .16em; text-transform: uppercase;
  transform: rotate(-2.5deg);
  background: repeating-linear-gradient(105deg, transparent 0 9px, rgba(210, 74, 59, .06) 9px 11px);
}
.sold-stamp small {
  display: block; font-weight: 600; font-size: .62rem;
  letter-spacing: .22em; opacity: .85;
}

/* ===== Card viewer / flip ===== */
#viewer.overlay, #draw.overlay, #stampbox.overlay { padding: 1rem; }
/* margin:auto centres the stage when it fits, and anchors the top (scrollable) when it doesn't */
.viewer-stage { display: flex; flex-direction: column; align-items: center; gap: 1rem; max-width: 96vw; margin: auto; }
.flip-card {
  /* up to the scan's native 1400px, capped by viewport width and height */
  width: min(1400px, 94vw, calc((100vh - 250px) * 1400 / 983));
  aspect-ratio: var(--card-ratio);
  perspective: 1600px; cursor: pointer;
}
.flip-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.35,.1,.2,1);
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 6px; overflow: hidden; background: #fff;
  border: 6px solid #fff; box-shadow: 0 16px 44px rgba(0,0,0,.55);
}
.flip-face img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.flip-back { transform: rotateY(180deg); }

.viewer-caption { text-align: center; color: #fff; max-width: 60rem; }
.viewer-title { font-family: var(--serif); font-size: clamp(1.1rem, 2.6vw, 1.5rem); }
.viewer-sub { color: rgba(255,255,255,.8); font-size: .95rem; margin-top: .25rem; }
.viewer-sub .hand { font-family: var(--hand); font-size: 1.3rem; color: var(--yellow); }
#flip-btn, .draw-actions button {
  margin-top: .7rem; border: 1.5px solid rgba(255,255,255,.5); background: transparent;
  color: #fff; border-radius: 999px; padding: .4rem 1.1rem; font-weight: 600; font-size: .9rem;
  transition: background .15s, border-color .15s;
}
#flip-btn:hover, .draw-actions button:hover { background: rgba(255,255,255,.15); border-color: #fff; }
.viewer-arrow {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 70;
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.14); color: #fff; font-size: 2rem; line-height: 1;
  transition: background .15s;
}
.viewer-arrow:hover { background: rgba(255,255,255,.32); }
.viewer-arrow.prev { left: 1rem; }
.viewer-arrow.next { right: 1rem; }

.viewer-stampchip {
  margin-top: .55rem; display: flex; justify-content: center;
  flex-wrap: wrap; gap: .5rem;
}
.viewer-stampchip button.no-img { cursor: default; opacity: .75; }
.viewer-stampchip button {
  display: flex; align-items: center; gap: .6rem;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.28);
  border-radius: 10px; padding: .4rem .7rem; color: #fff; font-size: .84rem; text-align: left;
  transition: background .15s;
}
.viewer-stampchip button:hover { background: rgba(255,255,255,.22); }
.viewer-stampchip img { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 3px; padding: 2px; }

/* ===== Stamp album ===== */
.album { max-width: 1180px; margin: 0 auto; padding: 2.2rem 1.4rem 3rem; }
.album .lead { color: var(--ink-soft); max-width: 56rem; margin: .4rem 0 1.2rem; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.chips button {
  border: 1.5px solid rgba(28,39,51,.25); background: #fff; border-radius: 999px;
  padding: .32rem .95rem; font-weight: 600; font-size: .88rem; color: var(--ink-soft);
  transition: all .15s;
}
.chips button:hover { border-color: var(--blue); color: var(--blue-deep); }
.chips button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chips .text-toggle { margin-left: auto; }

/* captions hidden — images only */
.album.no-text .stamp-cell .s-country,
.album.no-text .stamp-cell .s-name,
.album.no-text .stamp-cell .s-row { display: none; }
.album.no-text .stamp-cell .simgwrap { margin-bottom: 0; }
.album.no-text .stamp-cell { padding: .7rem; }
.album-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 1.1rem;
  align-items: stretch;
}
/* frosted display cells, in the style of the collection page */
.stamp-cell {
  display: flex; flex-direction: column; text-align: left;
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 1.15rem; padding: 1rem;
  box-shadow: 0 4px 14px rgba(41, 37, 36, .06);
  transition: transform .5s cubic-bezier(.2, .8, .25, 1), box-shadow .5s cubic-bezier(.2, .8, .25, 1);
}
.stamp-cell:hover {
  transform: translateY(-9px);
  box-shadow: 0 18px 40px rgba(41, 37, 36, .16);
}
.stamp-cell .simgwrap {
  height: 168px; display: flex; align-items: center; justify-content: center;
  /* creamy light yellow: whiter above, cream below */
  background: linear-gradient(180deg, #FFFEFA 0%, #F8F0D8 100%);
  border-radius: .7rem; overflow: hidden; margin-bottom: .85rem;
}
.stamp-cell .simgwrap img {
  max-height: 150px; max-width: 92%; object-fit: contain;
  filter: drop-shadow(0 5px 9px rgba(0, 0, 0, .16));
  transition: transform .6s cubic-bezier(.2, .8, .25, 1);
}
.stamp-cell:hover .simgwrap img { transform: scale(1.07); }
.stamp-cell .s-country { font-size: .9rem; font-weight: 400; color: var(--ink); text-align: center; }
.stamp-cell .s-country b { font-weight: 700; }
.stamp-cell .s-issue { font-weight: 400; }
.stamp-cell .s-name { font-size: .92rem; line-height: 1.35; margin-top: .3rem; color: var(--ink); }
.stamp-cell .s-name b { font-weight: 400; }
.stamp-cell .s-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: .6rem;
  margin-top: auto; padding-top: .5rem;
}
.stamp-cell .s-cat { font-size: .78rem; color: var(--blue); font-weight: 400; }
.stamp-cell .s-use { font-size: .76rem; color: var(--ink-soft); white-space: nowrap; margin-left: auto; }
.stampbox-frame {
  background: #fff; padding: 14px; border-radius: 4px;
  max-width: min(84vw, 560px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .5);
}
.stampbox-frame img { display: block; max-width: 100%; max-height: 56vh; object-fit: contain; }

.stampbox-stage { display: flex; flex-direction: column; align-items: center; gap: 1rem; max-width: 92vw; margin: auto; }
.stampbox-cards { margin-top: .6rem; display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.stampbox-cards button {
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff;
  border-radius: 999px; padding: .28rem .8rem; font-size: .82rem;
}
.stampbox-cards button:hover { background: rgba(255,255,255,.22); }

/* ===== Draw a card ===== */
.draw-stage { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin: auto; }
.draw-hint { color: rgba(255,255,255,.75); font-family: var(--hand); font-size: 1.5rem; margin: 0; }
.draw-card { width: min(86vw, 680px); }
.draw-cardback { display: flex; }
.draw-cardback-art {
  flex: 1; display: flex; flex-direction: column;
  border-radius: 4px; margin: 8px; overflow: hidden;
}
.draw-cardback-art .half {
  flex: 1; display: flex; justify-content: center;
  text-align: center; line-height: 1;
  font-family: var(--serif); font-weight: 900; text-transform: uppercase;
  letter-spacing: .22em; font-size: clamp(1.6rem, 6vw, 2.8rem);
  white-space: nowrap;
}
/* blue field, yellow lettering — the words hug the flag's seam */
.draw-cardback-art .sky {
  background: var(--blue); color: var(--yellow);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  align-items: flex-end; padding-bottom: .22em;
}
/* golden field, blue lettering */
.draw-cardback-art .field {
  background: var(--yellow); color: var(--blue);
  text-shadow: 0 1px 2px rgba(255, 255, 255, .45);
  align-items: flex-start; padding-top: .22em;
}
.draw-actions { display: flex; gap: .7rem; justify-content: center; }

/* ===== Footer ===== */
#footer {
  border-top: 1px solid rgba(28,39,51,.12); padding: 1rem 1.4rem; text-align: center;
  color: var(--ink-soft); font-size: .88rem; background: var(--paper-dark);
}
#footer p { margin: 0; }

/* ===== Responsive & motion ===== */
@media (max-width: 720px) {
  .nav-links a { padding: .3rem .5rem; font-size: .84rem; }
  .passport-label { display: none; }
  .fan { height: 150px; }
  .fan a { width: 165px; --xf: .62; }
  .viewer-arrow.prev { left: .3rem; }
  .viewer-arrow.next { right: .3rem; }
}

/* narrow mobile: no brand (the site's own menu is at the bottom of the page);
   every nav item becomes a direct flex child of the bar and wraps into two
   tight centred rows: Lobby + years, then Stamp Album + actions */
@media (max-width: 560px) {
  .brand { display: none; }
  #topbar {
    flex-wrap: wrap; justify-content: center; align-items: center;
    gap: .3rem .3rem; padding: .5rem .5rem .55rem;
  }
  .nav-links, .nav-right { display: contents; }
  .nav-links a { order: 1; padding: .28rem .55rem; font-size: .86rem; flex: 0 0 auto; }
  /* second row: album link + the two action buttons */
  .nav-links a[data-route="/album"] { order: 2; }
  #draw-btn { order: 2; white-space: nowrap; padding: .3rem .6rem; font-size: .8rem; margin-left: .3rem; }
  #passport { order: 2; padding: .28rem .55rem; font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
