@font-face{font-family:'Fraunces';font-style:normal;font-weight:300 900;font-display:swap;src:url(/montjuic/assets/fonts/fraunces-normal-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Fraunces';font-style:normal;font-weight:300 900;font-display:swap;src:url(/montjuic/assets/fonts/fraunces-normal-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'Source Serif 4';font-style:italic;font-weight:300 700;font-display:swap;src:url(/montjuic/assets/fonts/source-serif-4-italic-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Source Serif 4';font-style:italic;font-weight:300 700;font-display:swap;src:url(/montjuic/assets/fonts/source-serif-4-italic-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'Source Serif 4';font-style:normal;font-weight:300 700;font-display:swap;src:url(/montjuic/assets/fonts/source-serif-4-normal-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Source Serif 4';font-style:normal;font-weight:300 700;font-display:swap;src:url(/montjuic/assets/fonts/source-serif-4-normal-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}

:root {
  --bg: #f3ede1; --bg-2: #e9e0cd; --ink: #1f1a14; --ink-2: #3a3228; --ink-3: #4f4538;
  --rule: rgba(31, 26, 20, 0.18); --accent: #7a3413; --link: #6b2c10;
  --card: rgba(247, 242, 232, 0.94); --card-rule: rgba(31, 26, 20, 0.14);
  --bar-bg: rgba(243, 237, 225, 0.95);
  --sky: #d8d2c4;
  --stone: #deba78; --face: #a84a1e; --roman: #b3261e; --pin: #2d2219; --pin-bg: #f7f2e8;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --display: "Fraunces", "Source Serif 4", Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
  --bar-h: 48px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120e; --bg-2: #201b15; --ink: #f2ebdd; --ink-2: #ddd3c1; --ink-3: #cabfab;
    --rule: rgba(242, 235, 221, 0.18); --accent: #f0b98f; --link: #f3c39e;
    --card: rgba(21, 18, 14, 0.93); --card-rule: rgba(242, 235, 221, 0.14);
    --bar-bg: rgba(21, 18, 14, 0.95); --sky: #2b2a2c; --pin: #f2ebdd; --pin-bg: #1d1914;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15120e; --bg-2: #201b15; --ink: #f2ebdd; --ink-2: #ddd3c1; --ink-3: #cabfab;
  --rule: rgba(242, 235, 221, 0.18); --accent: #f0b98f; --link: #f3c39e;
  --card: rgba(21, 18, 14, 0.93); --card-rule: rgba(242, 235, 221, 0.14);
  --bar-bg: rgba(21, 18, 14, 0.95); --sky: #2b2a2c; --pin: #f2ebdd; --pin-bg: #1d1914;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sky); color: var(--ink); font-family: var(--serif); font-size: 18px; line-height: 1.62; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-underline-offset: 0.18em; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 60; background: var(--bg); padding: 8px 12px; }
i[lang] { font-style: italic; }

/* ---------- top bar ---------- */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--bar-h); z-index: 40; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--bar-bg); border-bottom: 1px solid var(--rule); font-family: var(--mono); font-size: 13px; color: var(--ink); }
.topbar a { color: var(--ink); text-decoration: none; }
.topbar .home { font-weight: 600; white-space: nowrap; }
.topnav { display: flex; gap: 16px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { white-space: nowrap; padding: 13px 0; border-bottom: 2px solid transparent; }
.topnav a[aria-current="true"] { border-bottom-color: var(--accent); }
.spacer { flex: 1; }
.langs { display: flex; gap: 4px; flex-shrink: 0; }
.langs a { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; padding: 0 6px; border: 1px solid var(--rule); border-radius: 6px; }
.langs a[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.icon-btn { flex-shrink: 0; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--rule); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
@media (max-width: 720px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar .home { display: none; }
  .topnav { gap: 12px; }
  .langs a { min-width: 28px; padding: 0 3px; font-size: 12px; }
}
@media (max-width: 400px) { .langs { gap: 2px; } .langs a { min-width: 26px; font-size: 11.5px; } .topnav { gap: 10px; } }

.banner { position: fixed; top: calc(var(--bar-h) + 8px); left: 50%; transform: translateX(-50%); z-index: 45; background: var(--bg); color: var(--ink); border: 1px solid var(--rule); border-radius: 10px; padding: 8px 12px; font-size: 15px; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,0.18); }
.banner button { font: inherit; background: none; border: 0; color: var(--link); text-decoration: underline; cursor: pointer; min-height: 32px; }
.banner[hidden] { display: none; }

/* ---------- stage ---------- */
.stage { position: fixed; inset: 0; z-index: 0; }
#scene { width: 100%; height: 100%; display: block; }
#tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 5px; white-space: nowrap; font: 600 12.5px/1.2 var(--serif); color: var(--pin); will-change: transform; }
.tag[hidden] { display: none; }
.tag b { background: var(--pin-bg); padding: 2px 6px; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.2); font-weight: 600; transform: translateY(-50%); }
.tag i { width: 14px; height: 14px; margin-left: -7px; transform: translateY(-50%); border-radius: 50%; border: 2.5px solid var(--face); background: var(--pin-bg); flex-shrink: 0; }
.tag.t-tested i { background: var(--face); }
.tag.t-disproved i { background: linear-gradient(135deg, transparent 42%, var(--face) 42% 58%, transparent 58%), var(--pin-bg); }
.tag.t-roman i { border-radius: 2px; border-color: var(--roman); background: var(--roman); }
.tag.t-cut i { border-color: var(--pin); background: var(--stone); border-radius: 2px; }
.tag.nolabel b { display: none; }
.tag.focus b { background: #6b2a0c; color: #fff; }
#scene-fallback { display: none; }
.no-webgl .stage { display: none; }
.no-webgl #scene-fallback { display: block; position: fixed; inset: 0; z-index: 0; background: var(--sky) url(/montjuic/assets/img/map-ro.webp?v=b3cf27cea8) center 86% / cover no-repeat; }
:root[lang="en"].no-webgl #scene-fallback { background-image: url(/montjuic/assets/img/map-en.webp?v=01c7b48d0d); }
:root[lang="es"].no-webgl #scene-fallback { background-image: url(/montjuic/assets/img/map-es.webp?v=1c0297fa7b); }
:root[lang="ca"].no-webgl #scene-fallback { background-image: url(/montjuic/assets/img/map-ca.webp?v=c09d584aaf); }

/* ---------- story ---------- */
main { position: relative; z-index: 2; }
.step { min-height: 105vh; display: flex; align-items: center; padding: calc(var(--bar-h) + 24px) 5vw 24px; pointer-events: none; }
.step .card { pointer-events: auto; max-width: 30rem; background: var(--card); border: 1px solid var(--card-rule); border-radius: 14px; padding: 22px 24px; box-shadow: 0 10px 34px rgba(0,0,0,0.16); }
.step .card.wide { max-width: 34rem; }
.step.hero { min-height: 100vh; align-items: flex-end; padding-bottom: 7vh; }
.kicker { font: 600 13px/1.3 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 6px; }
h1 { font-family: var(--display); font-weight: 600; font-size: clamp(34px, 5.2vw, 56px); line-height: 1.04; letter-spacing: -0.01em; margin: 0 0 14px; }
h2 { font-family: var(--display); font-weight: 600; font-size: clamp(24px, 3vw, 31px); line-height: 1.15; margin: 0 0 12px; }
.deck { font-size: 20px; line-height: 1.5; color: var(--ink-2); margin: 0 0 14px; }
.byline, .cue { font-size: 15px; color: var(--ink-3); margin: 6px 0 0; }
.card p { margin: 0 0 12px; }
.card p:last-child { margin-bottom: 0; }
.note { font-size: 15.5px; color: var(--ink-2); border-left: 3px solid var(--roman); padding-left: 12px; }

/* picker */
.picker { align-items: flex-start; padding-top: calc(var(--bar-h) + 24px); min-height: 150vh; }
.picker .card { display: flex; flex-direction: column; }
.picker .card > h2 { order: 0; } .picker .card > p { order: 1; } .picker .pick-card { order: 3; } .picker .pick { order: 2; } .picker details.list { order: 4; }
@media (max-width: 720px) { .picker .pick-card { order: 2; border-top: 0; border-bottom: 1px solid var(--rule); padding: 0 0 10px; } .picker .pick { order: 3; } }
.picker .card { position: sticky; top: calc(var(--bar-h) + 16px); max-height: calc(100vh - var(--bar-h) - 32px); overflow: auto; }
.pick { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 12px; }
.pick fieldset { border: 0; margin: 0; padding: 0; }
.pick legend { font: 600 12px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); margin-bottom: 4px; padding: 0; }
.pick .row { display: flex; flex-wrap: wrap; gap: 6px; }
.pick button { font: 15px/1.2 var(--serif); color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: 7px 12px; min-height: 36px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.pick button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pick button .m { width: 11px; height: 11px; border-radius: 50%; border: 2px solid currentColor; flex-shrink: 0; }
.pick button.t-tested .m { background: currentColor; }
.pick button.t-disproved .m { background: linear-gradient(135deg, transparent 40%, currentColor 40% 60%, transparent 60%); }
.pick-card { border-top: 1px solid var(--rule); padding-top: 12px; font-size: 16px; }
.pick-card h3 { font-family: var(--display); font-size: 20px; margin: 0 0 4px; }
.pick-card .tier { font: 600 12px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); margin: 0 0 8px; }
.pick-card p { margin: 0 0 8px; }
.pick-card .how { color: var(--ink-2); }

/* ---------- paper ---------- */
.paper { position: relative; z-index: 3; background: var(--bg); border-top: 1px solid var(--rule); padding: 48px 0 32px; }
.block { max-width: 40rem; margin: 0 auto; padding: 0 20px 36px; }
.block p { margin: 0 0 16px; }
.block h2 { margin-top: 12px; }
.fig { margin: 18px 0 22px; }
.fig figcaption { font-size: 15px; color: var(--ink-3); margin-top: 8px; line-height: 1.5; }
.method { font-size: 16px; }
.method p { color: var(--ink-2); }
.legend { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 6px 16px; font-size: 15px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.k { width: 18px; height: 14px; flex-shrink: 0; border-radius: 3px; }
.k-rel { background: linear-gradient(135deg, #cfc8b8, #8d8577); }
.k-stone { background: var(--stone); }
.k-roman { background: var(--roman); }
.k-tested, .k-documented, .k-disproved { width: 14px; border-radius: 50%; border: 2.5px solid var(--face); }
.k-tested { background: var(--face); }
.k-disproved { background: linear-gradient(135deg, transparent 40%, var(--face) 40% 60%, transparent 60%); }
.k-arc { height: 0; border-top: 3px dashed var(--face); border-radius: 0; }

/* game */
.game { list-style: none; padding: 0; margin: 18px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 16px; }
.piece { border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--bg-2); display: flex; flex-direction: column; }
.piece img { width: 100%; height: 190px; object-fit: contain; background: #fff; }
.piece .txt { padding: 10px 12px 12px; font-size: 15px; line-height: 1.45; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.piece h3 { font-size: 16px; margin: 0; font-family: var(--serif); }
.piece .where { color: var(--ink-3); margin: 0; }
.piece .btns { display: flex; gap: 6px; margin-top: auto; }
.piece .btns button { flex: 1; font: 600 14px/1.2 var(--serif); padding: 8px 6px; min-height: 40px; border-radius: 8px; border: 1px solid var(--ink-3); background: var(--bg); color: var(--ink); cursor: pointer; }
.piece .btns button:disabled { cursor: default; opacity: 0.55; }
.piece .btns button[aria-pressed="true"] { opacity: 1; background: var(--ink); color: var(--bg); }
.piece details summary { cursor: pointer; color: var(--link); font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.piece details p { margin: 4px 0 0; }
.piece .verdict { font-weight: 700; }
.piece.ok { border-color: #2f6b3a; }
.piece.ko { border-color: var(--face); }
.game-credit { font-size: 14px; color: var(--ink-3); }
.score { font-size: 19px; font-weight: 600; min-height: 1.5em; }

.foot { position: relative; z-index: 3; background: var(--bg); border-top: 1px solid var(--rule); padding: 18px 20px 80px; text-align: center; font-size: 15px; }
.foot a { margin: 0 4px; }

.to-top { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 50; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font: 600 10px/1 var(--mono); cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.to-top[hidden] { display: none; }

@media (max-width: 720px) {
  body { font-size: 17px; background: var(--bg); }
  /* phones: the scene is a fixed panel under the top bar; the text scrolls beneath it */
  .stage { inset: var(--bar-h) 0 auto 0; height: 44svh; z-index: 4; border-bottom: 1px solid var(--rule); }
  main { z-index: 1; }
  .paper, .foot { z-index: 5; }
  .step { min-height: 88svh; padding: calc(var(--bar-h) + 44svh + 14px) 12px 18px; align-items: flex-start; }
  .step .card { padding: 16px 16px; max-width: none; }
  .deck { font-size: 17px; line-height: 1.45; }
  h1 { font-size: 31px; }
  .hero .cue { display: none; }
  .picker { min-height: 120svh; }
  .picker .card { display: flex; flex-direction: column; }
.picker .card > h2 { order: 0; } .picker .card > p { order: 1; } .picker .pick-card { order: 3; } .picker .pick { order: 2; } .picker details.list { order: 4; }
@media (max-width: 720px) { .picker .pick-card { order: 2; border-top: 0; border-bottom: 1px solid var(--rule); padding: 0 0 10px; } .picker .pick { order: 3; } }
.picker .card { position: sticky; top: calc(var(--bar-h) + 44svh + 8px); max-height: calc(56svh - var(--bar-h) - 84px); }
  .step .card { box-shadow: none; }
  .piece img { height: 160px; }
  .game { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

details.list { margin-top: 12px; font-size: 15px; }
details.list summary { cursor: pointer; color: var(--link); min-height: 36px; display: flex; align-items: center; }
details.list table { border-collapse: collapse; width: 100%; margin-top: 6px; }
details.list th, details.list td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--rule); vertical-align: top; font-weight: 400; }
details.list td { color: var(--ink-3); font-size: 14px; }
body.nf { background: var(--bg); }
body.nf .paper { padding-top: 15vh; min-height: 100vh; }
