/* Tokens — cores do livro de campo. */
:root { /* claro: Códice */
  color-scheme: light;
  --bg: #F1EBDD;
  --surface: #F8F4EA;
  --surface-2: #E6DCC6;
  --line: #C9BC9F;
  --text: #2A2620;
  --muted: #5B5346;
  --title: #34508F;
  --number: #2A2620;
  --ember: #B4521F;
  --link: #A84B1B; /* Brasa ajustada para texto pequeno sobre velino. */
  --verdigris: #2F6A62;
  --blood: #8C2F2A;
  --amber: #8A5F14;
  --button-text: #F8F4EA;
  --control: #5B5346;
  --max-width: 1200px;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Alegreya Sans", sans-serif;
  font-size: 18px;
  line-height: 1.6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.04' filter='url(%23n)'/%3E%3C/svg%3E");
}
h1, h2, h3, h4 { font-family: "Cinzel", serif; color: var(--title); font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
h1, h2, h3, h4, p, figure { margin: 0; }
h2 { font-size: clamp(1.8rem, 3.2vw, 2.8rem); margin-bottom: 24px; max-width: 25ch; }
h3 { font-size: clamp(1.35rem, 2.1vw, 1.85rem); margin-bottom: 20px; }
h4 { font-size: 1.07rem; }
p + p { margin-top: 18px; }
p, li { overflow-wrap: anywhere; }
ul { padding-left: 22px; margin: 18px 0 24px; }
li + li { margin-top: 10px; }
li::marker { color: var(--link); }
a { color: var(--link); text-underline-offset: 4px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button, .button { border-radius: 4px; }
button { background: var(--surface); border: 1px solid var(--control); min-height: 44px; }
svg { width: 24px; height: 24px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
img { display: block; max-width: 100%; height: auto; background: var(--surface-2); color: var(--text); font-size: 16px; }
::selection { background: var(--title); color: var(--bg); }
:focus-visible { outline: 3px solid var(--ember); outline-offset: 4px; }
[hidden] { display: none !important; }

/* Layout */
.container { width: min(var(--max-width), calc(100% - 64px)); margin-inline: auto; }
.section { padding-block: 96px; scroll-margin-top: 20px; }
.section-tinted { background-color: var(--surface); border-block: 1px solid var(--line); }
.section-heading { max-width: 68ch; margin-bottom: 48px; }
.prose { max-width: 68ch; }
.idea-layout, .story-row, .quest-layout, .behind-copy, .interface-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px; }
.idea-layout { grid-template-columns: .9fr 1.1fr; }
.idea-layout > *, .pillar > *, .map-layout > *, .story-row > *, .quest-layout > *, .behind-copy > * { min-width: 0; }

/* Componentes */
.eyebrow { display: flex; align-items: center; gap: 10px; font-size: .79rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.section-heading > .eyebrow::before, .idea-layout > div > .eyebrow::before, .quest-layout > div > .eyebrow::before, #rankings > .eyebrow::before { content: ""; width: 7px; height: 24px; background: var(--ember); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; border: 1px solid currentColor; border-radius: 3px; font-size: .85rem; font-weight: 700; line-height: 1.5; background: var(--surface); }
.status svg { width: 16px; height: 16px; }
.decided { color: var(--verdigris); }
.building { color: var(--link); }
.planned { color: var(--amber); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 22px; min-height: 48px; padding: 10px 23px; border: 1px solid; text-decoration: none; font-weight: 700; }
.primary { background: var(--ember); color: var(--button-text); border-color: #E8834D; }
.primary:hover { text-decoration: underline; text-underline-offset: 4px; }
.secondary { background: #1F252E; color: #ECE7DC; border-color: #B7BDC2; }
.secondary:hover { background: #2C3440; }
.text-link { display: inline-flex; align-items: center; gap: 16px; min-height: 44px; font-weight: 700; }
.art img { width: 100%; border: 1px solid var(--line); padding: 6px; background: var(--surface); border-radius: 3px; }
figcaption { font-style: italic; color: var(--muted); font-size: .94rem; line-height: 1.45; margin-top: 12px; }
.callout, .quest-card, .journal, .skill-sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.callout { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 24px; padding: 38px; border-left: 4px solid var(--ember); margin-top: 36px; }
.callout p { max-width: 68ch; }
.callout .status { margin-top: 20px; }
.callout-number { color: var(--title); font: 600 4.5rem/1 "Cinzel", serif; }
.housing, .ai-note { margin-top: 36px; padding: 24px; border-left: 2px solid var(--line); max-width: 74ch; }
.housing .status, .ai-note .status { margin-top: 16px; }

/* Cabeçalho */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.header-inner { width: min(1360px, calc(100% - 64px)); min-height: 72px; margin: auto; display: flex; align-items: center; gap: 28px; }
.brand { min-height: 44px; display: inline-flex; align-items: center; gap: 12px; color: var(--title); text-decoration: none; font: 700 1.4rem "Cinzel", serif; flex-shrink: 0; white-space: nowrap; }
.codename { font: 400 .75rem "Alegreya Sans", sans-serif; border: 1px solid var(--line); color: var(--muted); padding: 3px 6px; border-radius: 2px; }
#site-nav { margin-left: auto; display: flex; gap: 22px; }
#site-nav a { display: inline-flex; min-height: 44px; align-items: center; color: var(--text); font-size: 1rem; white-space: nowrap; text-decoration: none; }
#site-nav a:hover { text-decoration: underline; text-decoration-color: var(--link); text-underline-offset: 6px; }
.theme-toggle { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; background: transparent; }
.header-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }
.language-switch { display: inline-flex; border: 1px solid var(--control); border-radius: 4px; font-size: .85rem; font-weight: 700; }
.language-switch > * { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--text); text-decoration: none; }
.language-switch > * + * { border-left: 1px solid var(--control); }
.language-switch [aria-current="true"] { background: var(--title); color: var(--bg); }
.language-switch a:hover { text-decoration: underline; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle[aria-pressed="true"] .icon-sun { display: block; }
.theme-toggle[aria-pressed="true"] .icon-moon { display: none; }
.menu-toggle { display: none; align-items: center; gap: 8px; padding: 6px 10px; }

/* Hero */
.hero-stage { position: relative; min-height: 520px; height: 78vh; max-height: 980px; }
.hero-image { width: 100%; height: 100%; object-fit: cover; object-position: center 60%; }
.hero-copy { position: absolute; top: 6%; left: 50%; transform: translateX(-50%); width: min(720px, calc(100% - 64px)); text-align: center; background: rgba(31, 37, 46, .94); color: #ECE7DC; padding: 28px 38px 30px; border: 1px solid #5A626B; border-radius: 4px; }
.hero-copy .eyebrow { color: #EBD39A; justify-content: center; font-size: .75rem; margin-bottom: 8px; }
h1 { color: #EBD39A; font-size: clamp(3.5rem, 7.6vw, 6.5rem); letter-spacing: .035em; line-height: 1.12; margin-bottom: 16px; }
.hero-subtitle { font-size: 1.25rem; line-height: 1.5; max-width: 52ch; margin-inline: auto; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 26px; }
.hero-caption { position: absolute; bottom: 24px; right: 32px; color: #ECE7DC; background: #1F252E; border: 1px solid #5A626B; padding: 5px 12px; font-size: .8rem; letter-spacing: .06em; }
.development-note { max-width: 84ch; padding: 24px 32px; margin: 0 auto; font-size: .94rem; text-align: center; color: var(--muted); }

/* Fatos e pilares */
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); margin-top: 44px; border-radius: 4px; }
.fact { display: flex; align-items: flex-start; gap: 20px; padding: 28px; }
.fact + .fact { border-left: 1px solid var(--line); }
.fact > svg { color: var(--title); margin-top: 8px; width: 30px; height: 30px; }
.fact strong { color: var(--number); font: 600 1.45rem "Cinzel", serif; }
.fact p { color: var(--muted); margin-top: 8px; line-height: 1.4; }
.pillar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 64px; align-items: center; padding-block: 52px; border-top: 1px solid var(--line); }
.pillar.reverse > figure { order: 2; }
.pillar-copy p + .status { margin-top: 24px; }
.pillar-copy .eyebrow { margin-bottom: 12px; }
.skill-sheet { padding: 32px; background: var(--bg); }
.sheet-heading { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--line); color: var(--title); font-family: "Cinzel", serif; font-size: 1rem; }
.skill { margin-top: 20px; }
.skill > div:first-child { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.skill > div > span:last-child { color: var(--number); font-weight: 700; font-variant-numeric: tabular-nums; }
.skill-track { height: 9px; background: var(--surface); border: 1px solid var(--control); }
.skill-track > span { display: block; width: var(--value); height: 100%; background: var(--amber); }
.skill:nth-child(even) .skill-track > span { background: var(--verdigris); }
.skill-sheet figcaption { margin-top: 24px; }
.story-teaser { margin-top: 24px; display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); align-items: center; gap: 36px; padding: 24px; border: 1px solid var(--line); background: var(--bg); border-radius: 4px; }
.story-teaser p { max-width: 60ch; }
.story-teaser .text-link { margin-top: 12px; }

/* Vila, história e Diário */
.wide-art img { max-height: 570px; object-fit: cover; object-position: center; }
.voting-intro { margin-top: 56px; }
.timeline { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; margin: 32px 0; gap: 16px; align-items: start; }
.timeline > li { padding: 20px 16px; border-top: 2px solid var(--line); background: var(--surface); margin-top: 0; }
.timeline > li:nth-child(2) { margin-top: 16px; }
.timeline > li:nth-child(3) { margin-top: 32px; }
.timeline > li:nth-child(4) { margin-top: 48px; }
.step-number { display: block; color: var(--title); font: 600 1.8rem "Cinzel", serif; margin-bottom: 16px; }
.timeline p { margin-block: 12px 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin-bottom: 0; list-style: none; }
.chips li { margin: 0; padding: 3px 8px; border: 1px solid var(--line); background: var(--bg); font-size: .9rem; line-height: 1.4; border-radius: 3px; }
.story-row { align-items: center; }
.conversation-row { margin-top: 64px; }
.journal { background: var(--bg); padding: 32px; margin-top: 48px; }
.chapters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; list-style: none; padding: 0; margin: 0; }
.chapters li { display: flex; align-items: baseline; gap: 12px; border: 1px solid var(--line); border-left: 3px solid var(--line); padding: 20px 16px; background: var(--surface); margin: 0; line-height: 1.4; }
.chapters li > span:first-child { color: var(--title); font-family: "Cinzel", serif; }
.chapters .blank-page { border-style: dashed; font-style: italic; color: var(--muted); }
.quest-layout { align-items: center; }
.quest-card { padding: 32px; border-top: 4px solid var(--ember); }
.checklist { padding: 0; list-style: none; }
.checklist li { display: flex; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.checklist li > span:first-child { color: var(--link); font-size: 1.3rem; }
.checklist .done > span:first-child { color: var(--verdigris); }
.reward span, .reward strong { display: block; }
.reward span { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }

/* Mapa — a área de toque é maior que o círculo visível. */
.map-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; gap: 40px; }
.map-figure { position: static; }
.map-canvas { position: relative; padding: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 3px; }
.map-canvas img { padding: 0; border: 0; border-radius: 0; }
.map-marker { position: absolute; left: clamp(18px, var(--x), calc(100% - 18px)); top: clamp(18px, var(--y), calc(100% - 18px)); width: 44px; height: 44px; padding: 0; transform: translate(-50%, -50%); background: transparent; border: 0; display: grid; place-items: center; }
.map-marker span { display: grid; place-items: center; width: 32px; height: 32px; background: #1F252E; color: #EBD39A; border: 2px solid #EBD39A; border-radius: 50%; font-weight: 700; font-size: 16px; line-height: 1; }
.map-marker:hover span, .map-marker:focus-visible span, .map-marker.is-active span { background: #B4521F; color: #F8F4EA; border-color: #F8F4EA; }
.map-legend { list-style: none; padding: 0; margin: 0; }
.map-legend li + li { margin-top: 0; }
.map-legend button { display: flex; width: 100%; text-align: left; gap: 12px; padding: 12px 8px; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 1rem; line-height: 1.45; }
.map-legend strong { display: block; font-size: 1.1rem; color: var(--title); margin-bottom: 2px; }
.map-legend button > span:last-child { min-width: 0; }
.map-legend button:hover, .map-legend button:focus-visible, .map-legend button.is-active { background: var(--bg); box-shadow: inset 3px 0 var(--ember); }
.legend-number { flex: 0 0 26px; color: var(--number); font-family: "Cinzel", serif; font-weight: 700; text-align: center; }
.map-note { margin-top: 28px; color: var(--muted); max-width: 68ch; }
.map-status { display: flex; flex-wrap: wrap; gap: 16px 28px; margin-top: 16px; font-size: .95rem; }
.map-status > span { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

/* Rankings e bastidores */
.rankings-soon { display: flex; align-items: center; gap: 32px; padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.rankings-soon p { max-width: 68ch; margin-bottom: 18px; }
.podium { width: 64px; height: 64px; color: var(--title); }
#rankings-live { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
table { border-collapse: collapse; table-layout: fixed; width: 100%; background: var(--surface); font-variant-numeric: tabular-nums; }
caption { font: 600 1.2rem "Cinzel", serif; color: var(--title); text-align: left; padding: 16px 0; overflow-wrap: anywhere; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { font-weight: 700; }
thead { background: var(--surface-2); }
th:first-child, td:first-child { width: 58px; }
th:last-child, td:last-child { text-align: right; width: 28%; }
.behind-copy { margin-bottom: 40px; }
.behind-copy > p { font-size: 1.25rem; }
.interface-grid { gap: 28px; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 48px; padding-block: 44px; font-size: .94rem; color: var(--muted); }
.site-footer > div { max-width: 68ch; }
.site-footer p + p { margin-top: 10px; }
.footer-brand { color: var(--title); font-family: "Cinzel", serif; }
.site-footer > a { flex-shrink: 0; }

/* Utilitários */
.svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.skip-link { position: fixed; top: 8px; left: 16px; z-index: 100; padding: 12px 20px; background: var(--surface); border: 1px solid var(--control); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

/* Temas — valores idênticos para preferência do sistema e escolha manual. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { /* escuro: Ardósia */
    color-scheme: dark;
    --bg: #1F252E;
    --surface: #2C3440;
    --surface-2: #3B4552;
    --line: #5A626B;
    --text: #ECE7DC;
    --muted: #B7BDC2;
    --title: #EBD39A;
    --number: #EBD39A;
    --ember: #D2672F;
    --link: #E8834D;
    --verdigris: #6FB0A6;
    --blood: #9A3530;
    --amber: #CC9232; /* Ajuste mínimo para AA sobre a superfície. */
    --button-text: #14191F;
    --control: #B7BDC2;
  }
}
:root[data-theme="dark"] { /* escuro: Ardósia (mesmos valores) */
  color-scheme: dark;
  --bg: #1F252E;
  --surface: #2C3440;
  --surface-2: #3B4552;
  --line: #5A626B;
  --text: #ECE7DC;
  --muted: #B7BDC2;
  --title: #EBD39A;
  --number: #EBD39A;
  --ember: #D2672F;
  --link: #E8834D;
  --verdigris: #6FB0A6;
  --blood: #9A3530;
  --amber: #CC9232;
  --button-text: #14191F;
  --control: #B7BDC2;
}

/* Mídia */
@media (max-width: 1100px) {
  .header-inner { gap: 16px; }
  #site-nav { gap: 14px; }
  .brand { gap: 8px; }
  .codename { font-size: .7rem; }
  .pillar { gap: 36px; }
  .fact { padding: 24px 18px; gap: 12px; }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline > li:nth-child(n) { margin-top: 0; }
}
@media (max-width: 1100px) {
  .header-inner { flex-wrap: wrap; min-height: 64px; padding-block: 10px; }
  .brand { margin-right: auto; }
  .header-controls { margin-left: 0; }
  .menu-ready .menu-toggle { display: inline-flex; }
  #site-nav { order: 5; flex-basis: 100%; display: flex; flex-wrap: wrap; margin: 0; gap: 4px 24px; }
  .menu-ready #site-nav { display: none; }
  .menu-ready #site-nav.is-open { display: flex; }
  #site-nav a { flex: 1 0 26%; }
  .map-layout { gap: 24px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { font-size: 17px; }
  html { scroll-padding-top: 86px; }
  .container, .header-inner { width: calc(100% - 32px); }
  .header-inner { gap: 8px; }
  .header-controls { gap: 8px; }
  .brand { font-size: 1.13rem; gap: 6px; }
  .codename { padding: 2px 4px; }
  .menu-toggle { font-size: .94rem; padding-inline: 8px; }
  .menu-toggle svg { width: 18px; }
  .section { padding-block: 60px; }
  .section-heading { margin-bottom: 32px; }
  .idea-layout, .facts, .pillar, .story-teaser, .story-row, .quest-layout, .behind-copy, .interface-grid, .map-layout, .chapters, .timeline, #rankings-live { grid-template-columns: minmax(0, 1fr); }
  .idea-layout, .story-row, .quest-layout, .behind-copy, .interface-grid { gap: 28px; }
  .hero-stage { height: auto; min-height: 0; max-height: none; }
  .hero-image { height: 56vh; min-height: 260px; max-height: 560px; object-position: center 60%; }
  .hero-copy { position: relative; top: auto; left: auto; transform: none; width: 100%; background: var(--bg); color: var(--text); border: 0; padding: 30px 16px 12px; border-radius: 0; }
  .hero-copy .eyebrow { color: var(--muted); font-size: .65rem; letter-spacing: .08em; }
  h1 { color: var(--title); font-size: clamp(3rem, 13vw, 5rem); }
  .hero-subtitle { font-size: 1.15rem; }
  .hero-actions { gap: 10px; }
  .hero-actions .button { padding-inline: 16px; gap: 12px; }
  .hero-caption { display: none; }
  .development-note { padding: 24px 16px 0; text-align: left; }
  .fact + .fact { border-left: 0; border-top: 1px solid var(--line); }
  .fact { padding: 24px; }
  .pillar { padding-block: 36px; gap: 28px; }
  .pillar.reverse > figure { order: 0; }
  .skill-sheet { padding: 24px; }
  .sheet-heading { font-size: .9rem; gap: 8px; }
  .story-teaser { padding: 16px; gap: 24px; }
  .callout { grid-template-columns: minmax(0, 1fr); padding: 24px; gap: 14px; }
  .callout-number { font-size: 2.5rem; }
  .timeline { border-left: 1px solid var(--line); padding-left: 16px; }
  .timeline > li { position: relative; padding: 20px; }
  .timeline > li::before { content: ""; position: absolute; left: -22px; top: -6px; width: 11px; height: 11px; background: var(--title); border: 2px solid var(--bg); }
  .timeline .step-number { font-size: 1.4rem; }
  .conversation-row { margin-top: 40px; }
  .journal, .quest-card { padding: 24px; }
  .housing, .ai-note { padding: 16px; }
  .map-marker span { width: 28px; height: 28px; font-size: 15px; }
  .map-legend button { padding-block: 14px; }
  .rankings-soon { align-items: flex-start; padding: 24px; gap: 20px; flex-direction: column; }
  .podium { width: 44px; height: 44px; }
  .site-footer { flex-direction: column; align-items: flex-start; gap: 20px; padding-block: 32px; }
}
@media (max-width: 420px) {
  .codename { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
