/* Caderno de campo: papel quadriculado, tinta, lápis azul e marcador. */

:root {
  --paper: #f3eee2;
  --paper-2: #ebe4d3;
  --grid: rgba(47, 93, 115, 0.09);
  --ink: #1d2a30;
  --muted: #56646a;
  --pencil: #2f5d73;
  --marker: #c4472d;
  --amber: #c98a2b;
  --line: #d6cdb8;
  --card: #fbf8f1;
  --water: #c9dbe0;
  --night: #16313b;
  --night-ink: #f3eee2;
  --hand: "Caveat", "Segoe Print", cursive;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --max: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12191c;
    --paper-2: #182226;
    --grid: rgba(143, 189, 205, 0.07);
    --ink: #ece6d8;
    --muted: #a3b0b4;
    --pencil: #8fbdcd;
    --marker: #e2775c;
    --amber: #e0a955;
    --line: #2c3a3f;
    --card: #1a2529;
    --water: #1f3a44;
    --night: #0b2530;
    --night-ink: #ece6d8;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #12191c;
  --paper-2: #182226;
  --grid: rgba(143, 189, 205, 0.07);
  --ink: #ece6d8;
  --muted: #a3b0b4;
  --pencil: #8fbdcd;
  --marker: #e2775c;
  --amber: #e0a955;
  --line: #2c3a3f;
  --card: #1a2529;
  --water: #1f3a44;
  --night: #0b2530;
  --night-ink: #ece6d8;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 0.45em;
}

h1 { font-size: clamp(2.2rem, 6vw, 4rem); }
h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

a { color: var(--pencil); text-underline-offset: 3px; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 720px) {
  .wrap { padding: 0 32px; }
}

.hand {
  font-family: var(--hand);
  font-size: 1.45em;
  line-height: 1.1;
  color: var(--pencil);
}

.mono { font-family: var(--mono); }

/* Cabeçalho */

.top {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 5;
  pointer-events: none;
}

.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.top a { pointer-events: auto; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

.brand svg { width: 24px; height: 24px; color: var(--pencil); flex: none; }

@media (max-width: 719px) {
  .brand { font-size: 0.85rem; white-space: nowrap; }
}

.lang {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.9rem;
  text-decoration: none;
}

/* Abertura: o mapa */

.hero {
  position: relative;
  min-height: min(92vh, 860px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--water);
  border-bottom: 1px solid var(--line);
}

#map {
  position: absolute;
  inset: 0;
}

.hero-card {
  position: relative;
  z-index: 2;
  max-width: 560px;
  margin: 0 16px 24px;
  padding: 24px 24px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 18px 40px -20px rgba(20, 35, 40, 0.45);
}

/* Celular: mapa em cima, cartão embaixo (sem cobrir o mapa). */
@media (max-width: 719px) {
  .hero { display: block; min-height: 0; background: none; border-bottom: 0; }
  #map { position: relative; height: 62vh; min-height: 380px; border-bottom: 1px solid var(--line); }
  .hero-card { margin: -36px 16px 0; }
}

@media (min-width: 720px) {
  .hero { align-items: center; }
  .hero-card { margin: 0 0 0 max(32px, calc((100vw - var(--max)) / 2 + 32px)); padding: 32px 32px 24px; }
}

.hero-card .kicker {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.hero-card p { color: var(--muted); font-size: 1.05rem; }

.hero-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  display: inline-block;
  padding: 11px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1.5px solid var(--pencil);
}

.btn.primary { background: var(--pencil); color: var(--paper); }
.btn.ghost { color: var(--pencil); }

.legend {
  position: absolute;
  z-index: 2;
  right: 16px;
  top: 76px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.legend .row { display: flex; align-items: center; gap: 8px; }

.legend .sw {
  width: 12px;
  height: 12px;
  flex: none;
}

.sw.outlet { background: var(--marker); border-radius: 50%; transform: scale(0.8); }
.sw.point { border: 2px solid var(--pencil); border-radius: 50%; }
.sw.bottle { background: var(--amber); border: 1.5px solid var(--ink); border-radius: 50%; }
.sw.route { height: 0; border-top: 2px dashed var(--ink); }

.legend .sim {
  margin-top: 6px;
  font-family: var(--hand);
  font-size: 1.15rem;
  color: var(--marker);
}

@media (max-width: 719px) {
  .legend { display: none; }
}

.map-note {
  font-size: 1.5rem;
  color: var(--ink);
  text-shadow: 0 0 4px var(--paper), 0 0 8px var(--paper);
  white-space: nowrap;
}

.sim-badge {
  display: none;
  position: absolute;
  z-index: 3;
  left: 16px;
  top: 72px;
  padding: 3px 12px;
  background: var(--card);
  border: 1.5px solid var(--marker);
  border-radius: 999px;
  font-family: var(--hand);
  font-size: 1.15rem;
  color: var(--marker);
}

@media (max-width: 719px) {
  .sim-badge { display: block; }
}

.bottle-pin {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid var(--ink);
  cursor: pointer;
}

.bottle-pin:focus-visible {
  outline: 3px solid var(--pencil);
  outline-offset: 3px;
}

.map-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 1.6rem;
}

/* Popup da ficha no mapa */

.maplibregl-popup-content {
  background: var(--card) !important;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px !important;
  padding: 12px 14px !important;
  font: 0.85rem/1.5 var(--mono);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.4) !important;
}

.maplibregl-popup-content b { font-family: var(--sans); }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup { z-index: 4; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 18px; }

/* Capítulos */

.chapter {
  padding: 72px 0;
}

@media (min-width: 900px) {
  .chapter { padding: 104px 0; }
}

.chapter-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
}

.chapter-head .num {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--marker);
  border: 1.5px solid var(--marker);
  border-radius: 999px;
  padding: 2px 10px;
  flex: none;
  transform: translateY(-6px);
}

.prose {
  max-width: 38em;
  font-size: 1.1rem;
}

.prose p { color: var(--ink); }

.pull {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  line-height: 1.3;
  max-width: 26em;
  padding-left: 20px;
  border-left: 3px solid var(--amber);
  margin: 36px 0;
}

.two {
  display: grid;
  gap: 40px;
  align-items: center;
}

@media (min-width: 900px) {
  .two { grid-template-columns: 1fr 1fr; gap: 64px; }
  .two.flip > :first-child { order: 2; }
}

/* Imagens com placeholder: quando o arquivo existe, a imagem cobre o aviso. */

.shot {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--paper-2);
  border: 1.5px dashed var(--line);
  border-radius: 4px;
}

.shot.wide { aspect-ratio: 16 / 9; }
.shot.photo { aspect-ratio: 3 / 2; }
.shot.phone { aspect-ratio: 9 / 18; width: 100%; max-width: 260px; margin: 0 auto; border-radius: 22px; }

.shot .ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
}

.shot .ph .hand { font-size: 1.6rem; }
.shot .ph code { font-family: var(--mono); font-size: 0.78rem; opacity: 0.8; }

.shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot:has(img) { border-style: solid; }

.taped {
  position: relative;
  padding: 10px 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 14px 30px -18px rgba(20, 35, 40, 0.5);
  transform: rotate(-0.8deg);
}

.taped::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 110px;
  height: 24px;
  transform: translateX(-50%) rotate(2deg);
  background: rgba(201, 138, 43, 0.28);
}

.taped figcaption {
  margin-top: 10px;
  font-family: var(--hand);
  font-size: 1.35rem;
  line-height: 1.15;
  color: var(--pencil);
}

/* Desenho do barco (vista lateral, na água) */

.drawing {
  margin: 8px 0 0;
  display: grid;
  gap: 24px;
  align-items: center;
}

@media (min-width: 960px) {
  .drawing { grid-template-columns: 1.7fr 1fr; gap: 40px; }
}

.drawing svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--ink);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent);
}

.drawing .hull { fill: var(--card); stroke: currentColor; stroke-width: 2.4; }
.drawing .shine { stroke: var(--paper); stroke-width: 4; stroke-linecap: round; opacity: 0.9; fill: none; }
.drawing .part { fill: var(--paper-2); stroke: currentColor; stroke-width: 2; }
.drawing .part-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drawing .tube { fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 1 0; opacity: 0.8; }
.drawing .bottle rect { fill: color-mix(in srgb, var(--amber) 40%, var(--card)); stroke: currentColor; stroke-width: 2; }
.drawing .tether { stroke: var(--marker); stroke-width: 2; stroke-dasharray: 6 6; fill: none; }
.drawing .waterfill { fill: var(--water); opacity: 0.6; }
.drawing .waterline { fill: none; stroke: var(--pencil); stroke-width: 2; }
.drawing .dim { stroke: var(--muted); stroke-width: 1; fill: none; }
.drawing .dimtxt { font-family: var(--mono); font-size: 14px; fill: var(--muted); }
.drawing .callouts path { stroke: var(--marker); stroke-width: 1.5; fill: none; }
.drawing .callouts circle { fill: var(--card); stroke: var(--marker); stroke-width: 2; }
.drawing .callouts text { font: 700 15px var(--sans); fill: var(--marker); text-anchor: middle; }

.parts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  counter-reset: p;
}

.parts li {
  counter-increment: p;
  position: relative;
  padding-left: 38px;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.5;
}

.parts li::before {
  content: counter(p);
  position: absolute;
  left: 0;
  top: -1px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 2px solid var(--marker);
  border-radius: 50%;
  color: var(--marker);
  font-weight: 700;
  font-size: 0.85rem;
}

.parts strong { color: var(--ink); }

/* O que os estudos dizem */

.findings {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  gap: 28px;
}

@media (min-width: 860px) {
  .findings { grid-template-columns: repeat(3, 1fr); gap: 36px; }
}

.findings li {
  padding-top: 16px;
  border-top: 2px solid var(--ink);
}

.findings .stat {
  display: block;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1.05;
  color: var(--marker);
  margin-bottom: 10px;
}

.findings p { color: var(--muted); }

.gap {
  max-width: 40em;
  margin-top: 28px;
  padding: 14px 18px;
  background: var(--card);
  border-left: 3px solid var(--amber);
  font-size: 1.02rem;
}

/* Ficha do frasco */

.tag {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
  padding: 28px 28px 24px 52px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 6px 22px 22px 6px;
  font-family: var(--mono);
  font-size: 0.9rem;
  box-shadow: 0 20px 40px -24px rgba(20, 35, 40, 0.55);
  transform: rotate(1.2deg);
}

.tag::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--paper);
}

.tag h3 {
  font-family: var(--mono);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.tag dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 0;
}

.tag dt { color: var(--muted); }
.tag dd { margin: 0; }

.tag .stamp {
  position: absolute;
  right: 18px;
  top: 18px;
  padding: 2px 10px;
  border: 2px solid var(--marker);
  border-radius: 4px;
  color: var(--marker);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transform: rotate(-6deg);
}

/* Passos */

.steps {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  gap: 28px;
  counter-reset: s;
}

@media (min-width: 800px) {
  .steps { grid-template-columns: repeat(3, 1fr); gap: 36px; }
}

.steps li { counter-increment: s; }

.steps li::before {
  content: counter(s);
  display: block;
  font-family: var(--hand);
  font-size: 3rem;
  line-height: 1;
  color: var(--marker);
  margin-bottom: 6px;
}

.steps p { color: var(--muted); }

.screens {
  display: grid;
  gap: 32px;
  margin-top: 48px;
}

@media (min-width: 900px) {
  .screens { grid-template-columns: 2fr 1fr 1fr; align-items: start; }
}

/* Etapas: trilha de fases, como num jogo */

.stages {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  gap: 16px;
  position: relative;
}

@media (min-width: 900px) {
  .stages { grid-template-columns: repeat(3, 1fr); gap: 20px; }
}

.stage {
  position: relative;
  padding: 20px 22px 18px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 8px;
}

.stage h3 { margin: 10px 0 6px; }
.stage p { color: var(--muted); font-size: 0.95rem; margin-bottom: 12px; }

.stage dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 0.9rem;
}

.stage dt { color: var(--muted); }
.stage dd { margin: 0; }
.stage dd.mono { font-weight: 500; }

.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lvl {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1.5px solid currentColor;
}

.chip svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.stage.done { border-color: var(--pencil); }
.stage.done .chip { color: var(--pencil); }

.stage.now {
  border-color: var(--amber);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 22%, transparent);
}
.stage.now .chip { color: var(--paper); background: var(--amber); border-color: var(--amber); }

.stage.locked { border-style: dashed; background: color-mix(in srgb, var(--card) 55%, transparent); }
.stage.locked .chip { color: var(--muted); }
.stage.locked h3 { color: var(--muted); }

.stage.goal {
  background: var(--night);
  border-color: var(--night);
  color: var(--night-ink);
}
.stage.goal .lvl, .stage.goal p { color: var(--night-ink); opacity: 0.8; }
.stage.goal .chip { color: var(--amber); }
.stage.goal h3 { font-size: 1.5rem; }

@media (min-width: 900px) {
  .stage.goal { grid-column: span 2; display: flex; flex-direction: column; justify-content: center; }
  .stage.goal h3 { font-size: 2.2rem; }
}

.stages + .fine { margin-top: 20px; }

/* Comunidade e sonho */

.night {
  background: var(--night);
  color: var(--night-ink);
  background-image: none;
}

.night .chapter-head .num { color: var(--amber); border-color: var(--amber); }
.night .prose p { color: var(--night-ink); opacity: 0.88; }

.promises {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: grid;
  gap: 18px;
}

@media (min-width: 800px) {
  .promises { grid-template-columns: repeat(2, 1fr); gap: 28px 40px; }
}

.promises li {
  padding-top: 14px;
  border-top: 1.5px solid color-mix(in srgb, var(--night-ink) 35%, transparent);
}

.promises strong { display: block; font-family: var(--serif); font-size: 1.2rem; margin-bottom: 4px; }
.promises span { opacity: 0.8; }

/* Quem faz */

.about {
  display: grid;
  gap: 36px;
}

@media (min-width: 860px) {
  .about { grid-template-columns: 1.5fr 1fr; align-items: start; }
}

.contact {
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.contact .mail {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 0.95rem;
  word-break: break-all;
}

.sign {
  font-family: var(--hand);
  font-size: 2rem;
  color: var(--pencil);
  margin-top: 8px;
}

footer {
  padding: 28px 0 40px;
  font-size: 0.88rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.credit {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}
