/* Mapa VPO. Shape rule: buttons pill, tiles 10px, panels 16px. One accent: map blue (the choropleth's own ramp). */
@font-face { font-family: "Schibsted Grotesk"; src: url("/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --f-sans: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --bg: #eef2f6; --surface: #fbfcfe; --surface-2: #e3e9f0; --field: #ffffff;
  --ink: #121821; --muted: #4f5e70; --line: #d3dbe4; --line-strong: #aab7c5;
  --accent: #1f5cb8; --accent-hover: #184c9a; --accent-ink: #f5f9ff; --accent-text: #1a52a6;
  --tile: #dde3e9; --tile-ink: #2b3540; --danger: #b42318;
  --r-s: 10px; --r-m: 16px; --r-btn: 999px;
  --shadow: 0 30px 70px -36px rgb(20 45 90 / .40), 0 1px 3px rgb(20 45 90 / .07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1219; --surface: #141b24; --surface-2: #10161e; --field: #0f151d;
    --ink: #e8eef5; --muted: #98a7b8; --line: #212b37; --line-strong: #34414f;
    --accent: #6aa8ff; --accent-hover: #8dbcff; --accent-ink: #04122b; --accent-text: #8dbcff;
    --tile: #1d242c; --tile-ink: #c4ced8; --danger: #f97066;
    --shadow: 0 30px 70px -30px rgb(0 0 0 / .75);
  }
}
h1, h2, h3 { font-weight: 800; letter-spacing: -0.03em; }
.lg-bg { fill: var(--accent); } .lg-fg { fill: var(--accent-ink); }

/* Graph-paper canvas: the data report reads as a set of drafted plates on a ruled sheet. */
body { background-color: var(--bg);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px; background-position: -1px -1px; }
:root { --grid-line: rgb(29 79 158 / .045); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --grid-line: rgb(255 255 255 / .03); } }

/* ------------------------------------------------------------------ hero and page heads */
.hero, .page-head { padding-block: 40px 28px; }
@media (min-width: 1024px) { .hero { padding-block: 64px 36px; } .page-head { padding-block: 48px 28px; } }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.9rem); line-height: 1; letter-spacing: -0.04em; max-width: 19ch; margin-bottom: .35em; }
.hero .dp-kpis, .page-head .dp-kpis { margin-top: 8px; }
.lab-grid > * { min-width: 0; }
@media (max-width: 560px) { .year-ctl { max-width: none; } }

/* home map */
.plate-map .plate-grid { align-items: start; }
.map-host { min-height: 280px; }
.map-host:empty { aspect-ratio: 1.22; }
.map-note { margin: 8px 0 0; font-size: .82rem; color: var(--muted); }
.year-ctl { display: inline-flex; align-items: center; gap: 10px; font-size: .86rem; font-weight: 600; min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.year-ctl output { font-family: var(--f-mono); min-width: 4ch; }
.year-ctl input { flex: 1; }
.year-ctl.off { opacity: .45; }
.p-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 12px 0 6px; width: 100%; }
.p-stats div { border-top: 1px solid var(--line); padding-top: 8px; }
.p-stats dt { font-size: .78rem; color: var(--muted); }
.p-stats dd { margin: 0; font-weight: 800; font-size: 1.35rem; letter-spacing: -0.03em; }
.p-spark-l { margin: 10px 0 2px; font-size: .78rem; color: var(--muted); }
.p-spark svg { width: 100%; height: auto; }
.ccaa-panel .cta-row { margin-top: 14px; }
.plate .ccaa-panel { min-height: 0; }
.ccaa-panel .p-title { font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin-top: 4px; }
.ccaa-panel { min-height: 0; }

/* tools */
.tools, .sec-block, .faq-block, .other-ccaa { padding-top: 44px; }
.tools h2, .sec-block h2, .faq-block h2, .other-ccaa h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.tool-grid { display: grid; gap: 16px; }
@media (min-width: 820px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }
.tool-card { display: flex; flex-direction: column; gap: 8px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); text-decoration: none; transition: border-color 200ms ease, transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .tool-card:hover { border-color: var(--ink); transform: translateY(-2px); } }
.tool-card:active { transform: scale(0.98); }
.tool-k { font: 600 .72rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
.tool-t { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; line-height: 1.15; }
.tool-d { color: var(--muted); font-size: .92rem; flex: 1; }
.tool-go { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .92rem; }

/* region pages */
.reg-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 14px; border-top: 2px solid var(--ink); }
.reg-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 6px; }
.reg-card .btn { width: 100%; }
.other-ccaa .dp-chips { margin-top: 6px; }

/* statistics: municipality search and downloads */
.muni-search { display: grid; gap: 8px; max-width: 420px; margin-bottom: 14px; }
.muni-search label { font-weight: 600; font-size: .9rem; }
.muni-out .table-scroll { max-height: 520px; overflow: auto; }
.muni-out thead th { position: sticky; top: 0; }
.dl-list { padding-left: 1.1em; }
.dl-list a { font-weight: 600; }

/* price calculator */
.lab-grid { display: grid; gap: 28px; }
@media (min-width: 960px) { .lab-grid { grid-template-columns: 5fr 7fr; gap: 44px; } }
.lab-form { display: grid; gap: 20px; align-content: start; }
.lab-form label output { float: right; font-family: var(--f-mono); color: var(--accent-text); }
.lab-out .dp-kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }

.ccaa-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: clamp(22px, 3vw, 32px); box-shadow: var(--shadow); min-height: 320px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
@media (min-width: 960px) { .ccaa-panel { position: sticky; top: 96px; } }
.ccaa-panel.swap > * { animation: swap 200ms var(--ease-out) both; }
.ccaa-panel.swap > *:nth-child(2) { animation-delay: 30ms; } .ccaa-panel.swap > *:nth-child(n+3) { animation-delay: 60ms; }
@keyframes swap { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .ccaa-panel.swap > * { animation: none; } }
.p-kicker { margin: 0; color: var(--muted); font-size: .9rem; }
.p-title { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 .1em; }
.p-reg { font-weight: 650; margin: 0 0 .6em; }
.p-note { color: var(--muted); margin: 0 0 1.2em; }
.p-app { display: flex; gap: 14px; align-items: flex-start; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .93rem; }
.p-app img { border-radius: 12px; flex: none; }
.p-app p { margin: 0; color: var(--muted); }
.p-app a { color: var(--accent-text); font-weight: 600; }

/* ------------------------------------------------------------------ sections */
.sec { padding-block: 88px 0; }
.sec h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); max-width: 22ch; }
.sec-lead { color: var(--muted); max-width: 60ch; margin-bottom: 30px; }

/* registry index: two-column accordion */
.reg-list { display: grid; gap: 0 32px; }
@media (min-width: 820px) { .reg-list { grid-template-columns: 1fr 1fr; } }
.reg-list details { border-bottom: 1px solid var(--line); }
.reg-list summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 0; font-weight: 700; }
.reg-list summary::-webkit-details-marker { display: none; }
.reg-list summary .i { transition: transform .3s cubic-bezier(.16,1,.3,1); color: var(--muted); }
.reg-list details[open] summary .i { transform: rotate(45deg); }
.reg-list .body { padding: 0 0 18px; color: var(--muted); font-size: .95rem; }
.reg-list .body a { color: var(--accent-text); font-weight: 600; }

/* app promo: phone screenshots + copy */
.promo { display: grid; gap: 32px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: clamp(24px, 4vw, 48px); overflow: hidden; }
@media (min-width: 900px) { .promo { grid-template-columns: 1fr 1fr; gap: 56px; } }
.promo h2 { margin-bottom: .4em; }
.promo p { color: var(--muted); }
.phones { position: relative; display: flex; justify-content: center; gap: 16px; }
.phones img { width: min(46%, 240px); height: auto; border-radius: 22px; box-shadow: var(--shadow); }
.phones img:last-child { transform: translateY(28px); }
@media (prefers-reduced-motion: no-preference) {
  .js .phones img { transition: transform .9s cubic-bezier(.16,1,.3,1); }
  .js .phones:not(.in) img:first-child { transform: translateY(30px) rotate(-3deg); }
  .js .phones:not(.in) img:last-child { transform: translateY(60px) rotate(3deg); }
}
.store-btn { display: inline-flex; align-items: center; gap: 10px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
.facts div { border-top: 2px solid var(--accent); padding-top: 10px; }
.facts strong { display: block; font-size: 1.05rem; }
.facts span { font-size: .85rem; color: var(--muted); }

/* IPREM tool */
.iprem { display: grid; gap: 24px; }
@media (min-width: 960px) { .iprem { grid-template-columns: 5fr 7fr; gap: 40px; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: clamp(22px, 3vw, 32px); }
.iprem .form { display: grid; gap: 18px; }
.veces { font-family: var(--f-mono); font-size: clamp(3.6rem, 10vw, 6.4rem); line-height: 1; letter-spacing: -0.06em; font-weight: 700; color: var(--accent-text); margin: 4px 0; }
.veces-l { color: var(--muted); margin: 0; }
.ruler { container-type: inline-size; position: relative; margin: 34px 0 10px; height: 54px; }
.ruler-track { position: absolute; left: 0; right: 0; top: 18px; height: 10px; border-radius: 99px; background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--accent) 35%, var(--surface-2))); }
.ruler-ticks { position: absolute; left: 0; right: 0; top: 34px; display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: .75rem; color: var(--muted); }
.marker { position: absolute; left: 0; top: 6px; width: 0; transition: transform .8s cubic-bezier(.16,1,.3,1); }
.marker::before { content: ""; position: absolute; left: -2px; top: 0; width: 4px; height: 34px; border-radius: 2px; background: var(--ink); }
.marker[data-over="true"]::before { background: var(--accent); }

/* articles */
.article { padding-block: 48px 0; }
.article-head { max-width: 780px; margin-bottom: 36px; }
.article-head h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); line-height: 1; letter-spacing: -0.045em; }
.article-head p { color: var(--muted); font-size: 1.12rem; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.callout { border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); padding: 14px 18px; background: color-mix(in srgb, var(--accent) 6%, var(--surface)); border-radius: 12px; margin: 1.5em 0; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

@media (prefers-reduced-motion: no-preference) {
  .hero .wrap > * { animation: up .8s cubic-bezier(.16,1,.3,1) both; }
  .ccaa-panel { animation: up .8s .2s cubic-bezier(.16,1,.3,1) both; }
  @keyframes up { from { opacity: 0; transform: translateY(14px); } }
}

/* The region panel sits inside a plate: a column with a rule, not a card in a card (one elevation). */
.plate .ccaa-panel { background: none; border: 0; border-top: 2px solid var(--ink); border-radius: 0; box-shadow: none; padding: 14px 0 0; }
@media (min-width: 960px) { .plate .ccaa-panel { position: sticky; top: 88px; } }
