:root {
  --paper: #e4dcc8;
  --paper-2: #d8cfb6;
  --ink: #1a1712;
  --muted: #5c5648;
  --line: rgba(26, 23, 18, 0.14);
  --forest: #24362c;
  --moss: #4e6a52;
  --earth: #9a4a28;
  --creek: #3d7ea3;
  --stamp: #9a4a28;
  --stage: #dedaca;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Figtree, ui-sans-serif, system-ui, sans-serif;
}
body {
  background-image:
    linear-gradient(rgba(26, 23, 18, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 23, 18, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
}

.progress {
  position: fixed;
  top: 0; left: 0; height: 3px;
  width: 0;
  background: var(--earth);
  z-index: 40;
}

.top {
  position: fixed;
  top: 12px;
  left: 16px;
  right: 16px;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.top .mark {
  font-weight: 700;
  pointer-events: none;
  background: rgba(26, 23, 18, 0.62);
  color: #f4efe2;
  padding: 8px 10px;
}
.top-cta {
  pointer-events: auto;
  border: 1px solid var(--earth);
  color: var(--paper);
  background: var(--earth);
  padding: 10px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  letter-spacing: 0.14em;
  font-weight: 650;
}
.top-cta:hover { filter: brightness(1.08); }

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 38%) 1fr;
  min-height: 100vh;
}

.story {
  padding: 88px 28px 120px;
  position: relative;
  z-index: 2;
}
.story section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 38rem;
  padding: 24px 0 48px;
}
.kicker {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--earth);
  margin: 0 0 12px;
}
h1, h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
  line-height: 1.05;
  margin: 0 0 16px;
  text-wrap: pretty;
}
h1 { font-size: clamp(36px, 5vw, 58px); }
h2 { font-size: clamp(28px, 3.4vw, 42px); }
.story p {
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 36rem;
  text-wrap: pretty;
}
.story p strong { color: var(--ink); font-weight: 650; }
.facts {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}
.facts li {
  border-top: 1px solid var(--line);
  padding: 10px 0;
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 12px;
  font-size: 14px;
}
.facts b { font-weight: 650; }
.note {
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}

.stage-wrap {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--stage);
  isolation: isolate;
}
#view {
  width: 100%;
  height: 100%;
  display: block;
}
.scene-note {
  position: absolute;
  top: 52px;
  left: 20px;
  right: 20px;
  margin: 0;
  color: #595c4e;
  font-size: 11px;
  line-height: 1.5;
  pointer-events: none;
}
.legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  color: #494c3e;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  max-width: calc(100% - 210px);
  pointer-events: none;
}
.legend i {
  display: inline-block;
  width: 10px; height: 10px;
  margin-right: 6px;
  vertical-align: -1px;
}
.legend .c-gleba { background: #9a4a28; }
.legend .c-rua { background: #626660; }
.legend .c-rio { background: #3d7ea3; }
.legend .c-casa { background: #a76043; }

.hud-tools {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  gap: 8px;
}
.hud-tools button {
  background: rgba(248, 244, 231, 0.88);
  color: #424a3a;
  border: 1px solid rgba(66, 74, 58, 0.25);
  padding: 12px;
  min-height: 40px;
  font: 650 11px/1 Figtree, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.hud-tools button[aria-pressed="true"] {
  background: #424a3a;
  color: #f8f4e7;
}
.hud-tools button:focus-visible { outline: 2px solid var(--earth); outline-offset: 3px; }
.hud-tools button:disabled { opacity: 0.45; cursor: wait; }

.sheet {
  margin-top: 20px;
  border: 1px solid var(--line);
  background: #efe7d4;
  padding: 8px;
}
.sheet img {
  display: block;
  width: 100%;
  height: auto;
  filter: contrast(1.05);
}

footer {
  padding: 24px 28px 48px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .stage-wrap {
    grid-row: 1;
    position: sticky;
    top: 0;
    height: 52vh;
    z-index: 3;
  }
  .story {
    grid-row: 2;
    padding: 24px 18px 80px;
    background: var(--paper);
  }
  .story section { min-height: 70vh; }
  .facts li { grid-template-columns: 1fr; gap: 4px; }
  .legend { bottom: 64px; max-width: calc(100% - 32px); gap: 8px 12px; font-size: 9px; }
  .scene-note { top: 48px; font-size: 10px; }
}

.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: end stretch;
  color: #f4efe2;
  overflow: hidden;
  background: #1a1712;
}
.hero-vid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}
.hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(26,23,18,0.15) 0%, rgba(26,23,18,0.55) 48%, rgba(26,23,18,0.88) 100%);
}
.hero-copy {
  position: relative;
  z-index: 2;
  padding: 32px 28px 56px;
  max-width: 40rem;
}
.hero-copy .kicker { color: #e2b39a; }
.hero-copy h1 {
  color: #f4efe2;
  font-size: clamp(40px, 6vw, 64px);
}
.hero-copy p { color: #d8cfb6; max-width: 34rem; }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 18px;
  text-decoration: none;
  font: 650 13px/1 Figtree, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.btn-solid { background: var(--earth); color: #f4efe2; }
.btn-ghost { background: transparent; color: #f4efe2; border: 1px solid rgba(244,239,226,0.45); }
.btn-solid:hover { filter: brightness(1.08); }
.btn-ghost:hover { background: rgba(244,239,226,0.1); }

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.pair figure { margin: 0; }
.pair img { display: block; width: 100%; height: auto; }
.pair figcaption {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 0 0;
}

.close {
  background: var(--forest);
  color: #e4dcc8;
  padding: 72px 28px 96px;
}
.close-inner { max-width: 44rem; }
.close .kicker { color: #e2b39a; }
.close h2 { color: #f4efe2; }
.close p { color: #c8c0a8; font-size: 17px; line-height: 1.5; }
.close .note { color: #a39b86; }
.close .sheet { background: #1f2a24; border-color: rgba(228,220,200,0.15); }
.close .btn-ghost { border-color: rgba(228,220,200,0.4); color: #f4efe2; }

@media (max-width: 860px) {
  .hero-copy { padding: 24px 18px 40px; }
  .pair { grid-template-columns: 1fr; }
  .close { padding: 48px 18px 80px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-vid { display: none; }
  .hero { background: #1a1712 url("../images/empty-still.png") center/cover no-repeat; }
}
