:root {
  color-scheme: light;
  --navy: #102b43;
  --navy-dark: #091c2d;
  --paper: #efece4;
  --paper-bright: #f9f7f0;
  --gold: #dda72a;
  --gold-dark: #b87d11;
  --blue: #2b7896;
  --red: #b95a42;
  --ink-muted: #50606a;
  --scene-count: 12;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  background: #0c2133;
  scroll-behavior: auto;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--navy);
  background: #0c2133;
  overscroll-behavior-y: none;
}

button { font: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.experience {
  width: 100%;
  max-width: 470px;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 90px rgba(0, 0, 0, 0.34);
}

.journey {
  position: relative;
  height: calc(var(--scene-count) * 100svh);
}

.viewport {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  background: var(--paper);
  isolation: isolate;
}

#worldCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.paper-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(16, 43, 67, 0.08) 0 0.5px, transparent 0.7px),
    radial-gradient(circle at 70% 60%, rgba(184, 125, 17, 0.07) 0 0.5px, transparent 0.7px);
  background-size: 7px 7px, 11px 11px;
  mix-blend-mode: multiply;
}

.govtech-lockup {
  position: absolute;
  z-index: 20;
  top: calc(12px + env(safe-area-inset-top));
  right: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px 5px 6px;
  border: 1px solid rgba(16, 43, 67, 0.1);
  border-radius: 999px;
  color: var(--navy);
  background: rgba(249, 247, 240, 0.82);
  box-shadow: 0 6px 18px rgba(16, 43, 67, 0.09);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}

.govtech-lockup img {
  display: block;
  width: 38px;
  height: 28px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.govtech-lockup span {
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

.chapter-dots {
  position: absolute;
  z-index: 10;
  top: -11px;
  left: 50%;
  width: 136px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border: 1px solid rgba(16, 43, 67, 0.09);
  border-radius: 999px;
  background: rgba(249, 247, 240, 0.76);
  box-shadow: 0 5px 18px rgba(16, 43, 67, 0.06);
  transform: translateX(-50%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.chapter-dots::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50%;
  height: 1px;
  background: rgba(16, 43, 67, 0.18);
  transform: translateY(-50%);
}

.chapter-dots span {
  position: relative;
  z-index: 1;
  width: 6px;
  height: 6px;
  border: 0;
  border-radius: 50%;
  background: #b9c0be;
  box-shadow: 0 0 0 2px rgba(249, 247, 240, 0.95);
  transition: background 240ms ease, transform 240ms ease, box-shadow 240ms ease;
}

.chapter-dots span.is-complete {
  background: var(--gold-dark);
}

.chapter-dots span.is-active {
  background: var(--navy);
  transform: scale(1.45);
  box-shadow: 0 0 0 2px rgba(249, 247, 240, 0.98), 0 0 0 4px rgba(16, 43, 67, 0.12);
}

.story-copy {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 42%;
  max-height: 48%;
  color: var(--navy);
  background: linear-gradient(180deg, rgba(249, 247, 240, 0.985), var(--paper-bright) 38%, var(--paper-bright));
  border-top: 1px solid rgba(16, 43, 67, 0.11);
  box-shadow: 0 -16px 40px rgba(16, 43, 67, 0.09);
}

.viewport.is-opening .story-copy {
  min-height: 43%;
}

.story-layer {
  position: absolute;
  top: 25px;
  left: 22px;
  right: 22px;
  bottom: calc(94px + env(safe-area-inset-bottom));
  will-change: opacity, transform;
}

.viewport.is-opening .story-copy h1 {
  max-width: 390px;
  font-size: clamp(2rem, 8.4vw, 2.5rem);
  line-height: 1.01;
}

.viewport.is-opening .story-copy p {
  max-width: 330px;
}

.story-copy h1 {
  max-width: 390px;
  margin: 0;
  font-size: clamp(1.85rem, 8.2vw, 2.5rem);
  font-weight: 470;
  line-height: 1.02;
  letter-spacing: -0.047em;
  text-wrap: balance;
}

.story-copy p {
  max-width: 380px;
  margin: 12px 0 0;
  color: #344b59;
  font-size: 0.94rem;
  line-height: 1.48;
}

.frame-nav {
  position: absolute;
  z-index: 13;
  left: 22px;
  right: 22px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  pointer-events: auto;
}

.frame-nav button {
  min-height: 44px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.frame-nav button:focus-visible {
  outline: 3px solid rgba(43, 120, 150, 0.34);
  outline-offset: 3px;
}

.frame-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: rgba(16, 43, 67, 0.62);
}

.frame-back:hover:not(:disabled) {
  color: var(--navy);
  transform: translateX(-2px);
}

.frame-back:disabled {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.frame-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-width: 142px;
  padding: 0 18px 0 20px;
  border: 1px solid rgba(119, 76, 2, 0.18);
  background: var(--gold);
  color: var(--navy-dark);
  box-shadow: 0 10px 24px rgba(184, 125, 17, 0.22);
}

.frame-next:hover {
  background: #e7b43b;
  box-shadow: 0 13px 28px rgba(184, 125, 17, 0.28);
  transform: translateY(-2px);
}

.frame-next:active {
  transform: translateY(0);
}

.frame-next-arrow {
  font-size: 1rem;
  line-height: 1;
  transition: transform 180ms ease;
}

.frame-next:hover .frame-next-arrow {
  transform: translateX(3px);
}

.frame-nav.is-transitioning {
  pointer-events: none;
}

.frame-nav.is-transitioning .frame-back,
.frame-nav.is-transitioning .frame-back:disabled {
  visibility: visible;
  opacity: 0.28;
}

.frame-nav.is-transitioning .frame-next {
  opacity: 0.72;
  box-shadow: 0 8px 20px rgba(184, 125, 17, 0.16);
}

.journey-prompt {
  position: absolute;
  z-index: 11;
  left: 50%;
  bottom: calc(42% + 14px);
  width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(16, 43, 67, 0.78);
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 220ms ease;
}

.viewport.is-opening .journey-prompt {
  bottom: calc(43% + 14px);
}

.journey-prompt.is-final {
  opacity: 0 !important;
}

.scroll-more-arrow {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid rgba(184, 125, 17, 0.34);
  border-radius: 50%;
  color: var(--navy);
  background: rgba(249, 247, 240, 0.72);
  box-shadow: 0 4px 14px rgba(16, 43, 67, 0.09);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  animation: gentle-pop 2.2s ease-in-out infinite;
  transform-origin: center;
}

@keyframes gentle-pop {
  0%, 100% {
    opacity: 0.68;
    transform: scale(1);
    box-shadow: 0 4px 14px rgba(16, 43, 67, 0.09), 0 0 0 0 rgba(221, 167, 42, 0.12);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
    box-shadow: 0 5px 17px rgba(16, 43, 67, 0.11), 0 0 0 7px rgba(221, 167, 42, 0);
  }
}

#journeyPromptText {
  font-size: 0.53rem;
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.is-reduced .scroll-more-arrow { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .scroll-more-arrow { animation: none; }
}

@media (min-width: 700px) {
  body { padding-top: 4vh; }
  .experience { border-radius: 28px 28px 0 0; overflow: clip; }
  .viewport { top: 4vh; height: 92vh; border-radius: 27px; }
  .journey { height: calc(var(--scene-count) * 92vh); }
}

@media (min-width: 900px) {
  html,
  body {
    background: var(--paper);
  }

  body {
    padding-top: 0;
  }

  .experience {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
  }

  .journey {
    height: calc(var(--scene-count) * 100svh);
  }

  .viewport {
    top: 0;
    height: 100svh;
    border-radius: 0;
    background:
      radial-gradient(circle at 72% 42%, rgba(255, 255, 255, 0.7), transparent 37%),
      var(--paper);
  }

  .paper-grain {
    opacity: 0.038;
  }

  .govtech-lockup {
    top: 22px;
    right: max(26px, calc((100vw - 1800px) / 2 + 28px));
    gap: 8px;
    padding: 6px 11px 6px 7px;
  }

  .govtech-lockup img {
    width: 44px;
    height: 32px;
  }

  .govtech-lockup span {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
  }

  .story-copy,
  .viewport.is-opening .story-copy {
    left: max(64px, calc((100vw - 1800px) / 2 + 64px));
    right: auto;
    top: 50%;
    bottom: auto;
    width: clamp(430px, 31vw, 560px);
    height: clamp(390px, 52svh, 480px);
    min-height: 0;
    max-height: none;
    overflow: hidden;
    color: var(--navy);
    background: rgba(249, 247, 240, 0.975);
    border: 1px solid rgba(16, 43, 67, 0.12);
    border-radius: 26px;
    box-shadow: 0 24px 70px rgba(16, 43, 67, 0.14);
    transform: translateY(-50%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .viewport.is-opening .story-copy {
    height: clamp(410px, 55svh, 500px);
  }

  .story-layer {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(72px, 8.5svh, 92px) clamp(38px, 3.5vw, 54px) clamp(86px, 10svh, 102px);
  }

  .frame-nav {
    left: clamp(38px, 3.5vw, 54px);
    right: clamp(38px, 3.5vw, 54px);
    bottom: clamp(27px, 3.8svh, 38px);
  }

  .frame-nav button {
    min-height: 46px;
    font-size: 0.8rem;
  }

  .frame-next {
    min-width: 158px;
    padding-right: 20px;
    padding-left: 22px;
  }

  .story-copy h1,
  .viewport.is-opening .story-copy h1 {
    max-width: 100%;
    font-size: clamp(2.25rem, min(3vw, 5.7svh), 3.35rem);
    line-height: 1;
    letter-spacing: -0.048em;
    overflow-wrap: normal;
  }

  .story-layer.is-dense h1 {
    font-size: clamp(2.05rem, min(2.65vw, 5.1svh), 3rem);
    line-height: 1.015;
  }

  .story-copy p,
  .viewport.is-opening .story-copy p {
    max-width: 440px;
    margin-top: clamp(15px, 2svh, 21px);
    font-size: clamp(0.98rem, 0.92vw, 1.08rem);
    line-height: 1.5;
  }

  .chapter-dots {
    top: clamp(30px, 3.8svh, 40px);
    left: clamp(38px, 3.5vw, 54px);
    width: 150px;
    height: 24px;
    transform: none;
    background: rgba(255, 255, 255, 0.52);
  }

  .journey-prompt {
    left: min(calc((100vw - 1800px) / 2 + 1240px), 68%);
    bottom: 26px;
    width: 190px;
    gap: 5px;
  }

  .viewport.is-opening .journey-prompt {
    bottom: 26px;
  }

  #journeyPromptText {
    font-size: 0.61rem;
    letter-spacing: 0.12em;
  }
}

@media (min-width: 1450px) {
  .story-copy,
  .viewport.is-opening .story-copy {
    width: clamp(500px, 29vw, 560px);
  }
}

@media (max-height: 710px) {
  .story-copy { min-height: 47%; }
  .story-layer { top: 18px; left: 20px; right: 20px; bottom: calc(86px + env(safe-area-inset-bottom)); }
  .story-copy h1 { font-size: 1.72rem; }
  .story-copy p { font-size: 0.82rem; line-height: 1.4; }
  .journey-prompt { bottom: calc(47% + 8px); }
}

@media (min-width: 900px) and (max-height: 710px) {
  .story-copy,
  .viewport.is-opening .story-copy {
    width: clamp(410px, 31vw, 520px);
    height: min(calc(100svh - 56px), 380px);
    min-height: 0;
  }

  .story-layer {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 58px 38px 82px;
  }

  .frame-nav {
    left: 38px;
    right: 38px;
    bottom: 22px;
  }

  .frame-nav button {
    min-height: 42px;
  }

  .story-copy h1,
  .viewport.is-opening .story-copy h1 {
    font-size: clamp(1.85rem, min(2.65vw, 6svh), 2.75rem);
  }

  .story-layer.is-dense h1 {
    font-size: clamp(1.72rem, min(2.35vw, 5.45svh), 2.42rem);
  }

  .story-copy p,
  .viewport.is-opening .story-copy p {
    margin-top: 13px;
    font-size: clamp(0.82rem, 0.88vw, 0.98rem);
    line-height: 1.42;
  }

  .chapter-dots {
    top: 24px;
    left: 38px;
  }

  .journey-prompt {
    bottom: 10px;
  }

  .viewport.is-opening .journey-prompt {
    bottom: 10px;
  }
}

@media (min-width: 1900px) {
  .story-copy,
  .viewport.is-opening .story-copy {
    width: 560px;
  }

  .journey-prompt {
    left: calc(50% + 300px);
  }
}
