/* piura2040.com — direction C "Señal ciudadana". Mobile-first. */

/* ---------- Fonts (self-hosted Latin subsets, SIL OFL) ---------- */
/* Digits always come from Rubik so Atkinson's slashed zero never shows. */
@font-face {
  font-family: "Digits";
  src: url("../fonts/rubik-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0030-0039;
}
@font-face {
  font-family: "Rubik";
  src: url("../fonts/rubik-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-700-latin.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@property --lvl {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 50%;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --ink: #111111;
  --ink-soft: #444444;
  --water: #7cc8e2;
  --water-pale: #e8f5fa;
  --hazard: #f5c518;
  --hazard-pale: #fff8d6;
  --wa: #25d366;
  --wa-ink: #05301a;
  --ok: #1b6b2f;
  --rule: #e3e3e3;
  --radius: 12px;
  --measure: 36rem;
  --gutter: 1.25rem;
  --display: "Rubik", system-ui, sans-serif;
  --body: "Digits", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.55 var(--body);
}
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.02em;
}
h2 { font-size: clamp(2rem, 9vw, 2.75rem); line-height: 1.05; margin: 0 0 1.25rem; }
h3 { font-size: 1.4rem; line-height: 1.15; margin: 0 0 .6rem; }
p { margin: 0 0 1rem; max-width: 60ch; }
a { color: inherit; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
sup a { text-decoration: none; font-weight: 700; padding: 0 .1em; }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }
.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 10;
}
.skip:focus { left: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 50px; padding: .8rem 1.3rem;
  font: 700 1rem/1 var(--body);
  border: 0; border-radius: var(--radius);
  text-decoration: none; cursor: pointer;
}
.btn-wa { background: var(--wa); color: var(--wa-ink); }
.btn-link {
  background: transparent; color: inherit;
  text-decoration: underline; text-underline-offset: 4px; padding-inline: .5rem;
}

/* ---------- 1. Hero: the waterline ---------- */
.hero { padding-top: 2.25rem; }
.hero-date { font-weight: 700; margin: 0 0 .75rem; }
.flood {
  margin: 0 calc(var(--gutter) * -1);
  padding: 0 var(--gutter);
  background: linear-gradient(180deg, transparent var(--lvl), var(--water) var(--lvl));
  animation: rise 1.6s cubic-bezier(.3, .7, .2, 1) .3s both;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
/* Soft wave on the waterline: a 120px-period strip that drifts sideways
   (transform only). Paused off-screen via .is-still (main.js). */
.flood::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  top: calc(var(--lvl) - 11px);
  width: calc(100% + 120px);
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='12'%3E%3Cpath d='M0 6Q30 0 60 6T120 6V12H0Z' fill='%237cc8e2'/%3E%3C/svg%3E") repeat-x;
  animation: drift 7s linear infinite;
}
.flood.is-still::before { animation-play-state: paused; }
@keyframes drift {
  to { transform: translateX(-120px); }
}
.flood h1 {
  margin: 0;
  padding-bottom: .12em;
  font-size: clamp(3.2rem, 15vw, 5.5rem);
  line-height: 1;
}
@keyframes rise {
  from { --lvl: 100%; }
  to { --lvl: 50%; }
}
.hero-body { background: var(--water); padding: 1.75rem 0 2.75rem; }
.slogan {
  font-family: var(--display); font-weight: 800; letter-spacing: -0.02em;
  font-size: clamp(1.7rem, 8vw, 2.4rem); line-height: 1.05;
  margin: 0 0 1.25rem;
}
.since { border-left: 4px solid var(--ink); padding-left: .9rem; margin: 0 0 1.75rem; }
.since strong {
  display: block;
  font-family: var(--display); font-weight: 800; letter-spacing: -0.02em;
  font-size: 1.8rem; line-height: 1.1;
}
.slogan .wavy {
  text-decoration: underline wavy var(--ink);
  text-decoration-thickness: .07em;
  text-underline-offset: .14em;
  text-decoration-skip-ink: none;
}
.hook { font-weight: 700; margin: 0 0 1.5rem; }
.hook .zero {
  font-family: var(--display); font-weight: 800;
  background: var(--hazard); color: var(--ink);
  padding: 0 .3em; white-space: nowrap;
}
.actions { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }

/* ---------- Sections ---------- */
section { padding: 3.5rem 0; }

/* ---------- 2. Rain gauge ---------- */
.gauge { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; align-items: end; margin: 1.5rem 0; }
.gauge-svg { width: 64px; height: 230px; display: block; }
.gauge p { margin: .25rem 0 0; }
.gauge .gauge-num {
  margin: 0;
  font-family: var(--display); font-weight: 800; letter-spacing: -0.02em;
  font-size: 3rem; line-height: 1;
}

/* ---------- 3. Official record ---------- */
.record { background: var(--hazard-pale); }
.ficha {
  background: #fff; border: 2px solid var(--ink); border-radius: var(--radius);
  overflow: hidden; margin: 1.5rem 0 .5rem;
}
.ficha-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem; border-bottom: 2px solid var(--ink);
}
.ficha-head span { font-size: .9rem; color: var(--ink-soft); line-height: 1.3; }
.ficha-head strong {
  font-family: var(--display); font-weight: 800; letter-spacing: .02em;
  font-size: clamp(1.9rem, 9vw, 2.4rem); line-height: .9; white-space: nowrap;
}
.ficha dl { margin: 0; }
.ficha-row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .7rem 1rem; border-top: 1px solid var(--rule);
}
.ficha-row:first-child { border-top: 0; }
.ficha dt { color: var(--ink-soft); }
.ficha dd { margin: 0; font-weight: 700; text-align: right; }
.ficha-zero {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: var(--hazard); padding: .6rem .8rem; font-weight: 700;
  border: 6px solid;
  border-image: repeating-linear-gradient(135deg, var(--hazard) 0 14px, var(--ink) 14px 28px) 6;
}
.ficha .ficha-zero dt { color: var(--ink); }
.ficha .ficha-zero dd {
  font-family: var(--display); font-weight: 800; font-size: 2.6rem; line-height: 1; white-space: nowrap;
}
.src { font-size: .88rem; color: var(--ink-soft); }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 2rem 0 0; }
.steps li {
  counter-increment: step;
  display: grid; grid-template-columns: 2.25rem 1fr; gap: .75rem;
  padding: .85rem 0; border-top: 1px solid var(--rule);
  color: var(--ink-soft);
}
.steps li::before {
  content: counter(step);
  font-family: var(--display); font-weight: 800; font-size: 1.5rem; line-height: 1.1;
}
.steps span { display: block; font-size: .92rem; }
.steps .step-done { color: var(--ink); }
.steps .step-done::before { content: counter(step) "✓"; color: var(--ok); white-space: nowrap; }
.steps .step-stuck {
  background: var(--hazard); color: var(--ink); font-weight: 700;
  border-top-color: var(--ink);
  margin: 0 calc(var(--gutter) * -1); padding-inline: var(--gutter);
}

/* ---------- 4. Temporary vs permanent ---------- */
.compare { display: grid; gap: 1rem; margin-top: 1.5rem; }
.compare-temp, .compare-perm { border-radius: var(--radius); padding: 1.25rem; }
.compare-temp { border: 2px dashed var(--ink-soft); }
.compare-perm { background: var(--water); border: 2px solid var(--ink); }
.compare ul { margin: 0; padding-left: 1.1rem; }
.compare li { margin-bottom: .35rem; }

/* ---------- 5. Action ---------- */
.act { background: var(--water-pale); }
.act-sub { margin-top: 2.25rem; }
.act-step { display: flex; align-items: center; gap: .6rem; }
.act-step .num {
  display: inline-grid; place-items: center; flex: none;
  width: 1.8em; height: 1.8em; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: .85em;
}
.btn-block { width: 100%; }
.share-more { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-top: .5rem; }
.btn-quiet {
  font: inherit; font-weight: 700; color: var(--ink); background: none; border: 0;
  padding: .7rem 0; min-height: 44px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px;
}
.btn-outline { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.btn-dark { background: var(--ink); color: #fff; width: 100%; }
.cards-intro { margin: 1.5rem 0 .75rem; }
.cards {
  list-style: none; padding: 0 var(--gutter) .75rem; margin: 0 calc(var(--gutter) * -1);
  display: flex; gap: .9rem; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
}
.card {
  flex: none; width: 168px; scroll-snap-align: start;
  display: grid; gap: .4rem; font-weight: 700; font-size: .95rem;
}
.card img {
  width: 100%; height: auto; display: block;
  border: 2px solid var(--ink); border-radius: 8px; background: #fff;
}
.card a { display: block; padding: .6rem 0; text-underline-offset: 3px; }
.msg {
  background: #fff; border: 2px solid var(--ink); border-radius: var(--radius);
  padding: 1rem; margin-top: .75rem;
}
.msg p { font-size: .98rem; user-select: all; -webkit-user-select: all; }
.copy-status { min-height: 1.6em; margin: .6rem 0 0; font-weight: 700; color: var(--ok); }
[hidden] { display: none !important; }

/* ---------- 6–7. Sources and about ---------- */
.sources ol { padding-left: 1.3rem; margin: 0; color: var(--ink-soft); font-size: .95rem; }
.sources li { margin-bottom: .7rem; padding: .15rem .3rem; border-radius: 4px; }
.sources li:target { background: var(--hazard); color: var(--ink); }
.sources a { color: var(--ink); overflow-wrap: anywhere; }
.about { border-top: 2px solid var(--ink); }

/* ---------- Simple pages (privacy, 404) ---------- */
.page { padding: 3rem 0 4rem; }
.page h1 { font-size: clamp(2.2rem, 10vw, 3.2rem); line-height: 1.05; margin: 0 0 1.25rem; }
.page h2 { font-size: 1.5rem; margin: 2rem 0 .6rem; }
.page-home { display: inline-block; margin-bottom: 2rem; font-weight: 700; }

/* ---------- Footer ---------- */
footer { background: var(--ink); color: #fff; padding: 2rem 0; font-size: .9rem; }

@media (min-width: 720px) {
  :root { --measure: 44rem; }
  .compare { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .flood, .flood::before { animation: none; }
}
