:root {
  color-scheme: light;
  --navy: #1a2b3c;
  --text: #222;
  --muted: #5b6570;
  --hero-logo-width: min(380px, 82vw, 38vh);
}

@supports (height: 1svh) {
  :root { --hero-logo-width: min(380px, 82vw, 38svh); }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
button { font: inherit; }
a { color: #244e75; text-underline-offset: 0.22em; }
a:hover { color: var(--navy); }
a:focus-visible, button:focus-visible {
  outline: 3px solid #a97927;
  outline-offset: 5px;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1100;
  padding: 0.55rem 0.85rem;
  color: var(--navy);
  background: white;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }
.language-switcher {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  gap: 0.4rem;
  padding: 0.3rem;
  border: 1px solid rgb(0 0 0 / 8%);
  border-radius: 999px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 6px 22px rgb(0 0 0 / 12%);
  backdrop-filter: blur(10px);
}
.language-switcher button {
  min-width: 48px;
  min-height: 36px;
  padding: 0.4rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--navy);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.language-switcher button[aria-pressed="true"] {
  border-color: #c6cdd3;
  background: #edf1f4;
}

/* CSS runs the intro so a script failure cannot cover the story. */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: #fff;
  pointer-events: none;
  animation: reveal-flag 0.8s ease 0.9s both;
}
.splash-screen img, .hero-logo {
  display: block;
  width: min(380px, 82vw, 38vh);
  width: var(--hero-logo-width);
  height: auto;
}
@keyframes reveal-flag {
  from { opacity: 1; visibility: visible; }
  to { opacity: 0; visibility: hidden; }
}
.flag-section {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  background: linear-gradient(to bottom,
    #ae1c28 0%, #ae1c28 33.333%,
    #fff 33.333%, #fff 66.667%,
    #21468b 66.667%, #21468b 100%);
}
.hero-logo {
  /* Centre the artwork itself, accounting for the SVG's unequal whitespace. */
  transform: translateY(-1vh);
  transform: translateY(-1svh);
  filter: drop-shadow(0 1px 3px rgb(26 43 60 / 8%));
}
.scroll-indicator {
  position: absolute;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgb(255 255 255 / 65%);
  border-radius: 50%;
  color: white;
  background: rgb(0 0 0 / 12%);
  transform: translateX(-50%);
  animation: nudge 2s ease-in-out 1.7s 3;
}
.scroll-indicator:hover { color: white; background: rgb(0 0 0 / 24%); }
.scroll-indicator svg { width: 26px; height: 26px; }
@keyframes nudge {
  0%, 40%, 100% { transform: translate(-50%, 0); }
  60% { transform: translate(-50%, 6px); }
  80% { transform: translate(-50%, 2px); }
}

main { padding: 0 1.25rem; }
.story {
  max-width: 900px;
  margin: 0 auto;
  padding: 3.5rem 0 3rem;
  scroll-margin-top: 3rem;
}
.story:focus { outline: none; }
.story-heading { margin-bottom: 2.25rem; text-align: center; }
.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
h1 { margin: 0; color: var(--navy); font-size: clamp(2rem, 5vw, 2.6rem); line-height: 1.2; letter-spacing: 0.04em; }
.tagline { margin: 0.65rem 0 0; color: var(--muted); font-size: 1.05rem; }
h2 { margin: 2rem 0 0.75rem; color: var(--navy); font-size: clamp(1.25rem, 3vw, 1.45rem); line-height: 1.3; }
p { margin: 0 0 1.1rem; }
.rune-list { margin: 0 0 1.1rem; padding-left: 1.35rem; }
.rune-list li { margin-bottom: 0.85rem; padding-left: 0.2rem; }
.back-to-top { display: inline-flex; align-items: center; gap: 0.7rem; min-height: 44px; margin-top: 1.25rem; font-size: 0.85rem; }
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem 1.25rem;
  border-top: 1px solid #e8ecef;
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
}
.site-footer span + span { padding-left: 1rem; border-left: 1px solid #c6cdd3; }

.story-title-button {
  display: block;
  margin: 0 auto;
  padding: 0.2rem 0;
  border: 0;
  border-bottom: 2px dotted currentColor;
  color: inherit;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.story-title-button span {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.48em;
  font-weight: 600;
  letter-spacing: normal;
}
html.gallery-open { overflow: hidden; }
.gallery {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  border: 0;
  color: #fff;
  background: rgb(0 0 0 / 95%);
  overscroll-behavior: contain;
}
.gallery[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 1rem;
}
.gallery::backdrop { background: #000; }
.gallery-header, .gallery-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1100px, 100%);
  margin: 0 auto;
}
.gallery-header { min-height: 3rem; }
.gallery-header h2 { margin: 0; color: #e6e6e6; font-size: 1rem; }
.gallery-close, .gallery-control {
  min-height: 44px;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 6px;
  color: #fff;
  background: rgb(255 255 255 / 8%);
  cursor: pointer;
}
.gallery-close {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  padding: 0;
  font-size: 1.8rem;
  line-height: 1;
}
.gallery-control { min-width: 6.5rem; padding: 0.55rem 0.8rem; font-weight: 700; }
.gallery-close:hover, .gallery-control:hover { background: rgb(255 255 255 / 16%); }
.gallery-control:disabled { opacity: 0.4; cursor: default; }
.gallery-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(1100px, 100%);
  min-height: 0;
  min-width: 0;
  margin: 0 auto;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.gallery-image {
  display: block;
  flex: 0 0 auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid rgb(255 255 255 / 28%);
  transform-origin: center;
  -webkit-user-drag: none;
}
.gallery-stage.is-zoomed { cursor: grab; }
.gallery-stage.is-dragging { cursor: grabbing; }
.gallery-message {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  pointer-events: none;
}
.gallery-message p { margin: 0; }
.gallery-message button { margin-top: 1rem; pointer-events: auto; }
.gallery-status { margin: 0; color: #cfcfcf; font-size: 0.9rem; }
.gallery-controls { display: flex; gap: 0.6rem; justify-content: flex-end; }

@media (max-width: 640px) {
  .language-switcher { top: 0.75rem; right: 0.75rem; }
  .story { padding-top: 2.75rem; }
  .gallery[open] { gap: 0.65rem; }
  .gallery-footer { flex-direction: column; gap: 0.6rem; }
  .gallery-controls { width: 100%; }
  .gallery-control { min-width: 0; flex: 1; font-size: 0.88rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .splash-screen { display: none; animation: none; }
  .scroll-indicator { animation: none; }
}
