/* Region pages (r/<slug>) and the regions index (r/).

   Written once, linked by every generated page, so a change of look is one file and not 636.
   The face and the two golds are the site's own (vendor/fonts/eco-fonts.css, wordmark.css); this
   file adds layout and nothing that would make a region page look like a different product.

   WHY THE HERO CAN BE EMPTY AND STILL LOOK DESIGNED. The picture is a generated plate that streams
   from the media host. Offline, on a bad link, or with the plate withheld in policy/region-pages.json,
   the hero is the region's biome colour (--biome, from config.js BIOMES) under the same shade and the
   same type. A page that needs its picture to look finished is a page that looks broken on a train.

   WHY EVERY SIZE IS A MEASURE, NOT A PIXEL. Checked at 360, 375, 393, 412 and 1440 wide: nothing is
   set wider than the viewport, the capture form stacks under 520px, and inputs are 16px so iOS does not
   zoom the page when one is focused. */

:root {
  --bg: #07090a; --panel: #0e1211; --panel-2: #121816;
  --ink: #ece6d6; --dim: #a39d8c; --faint: #6f6c60;
  --rule: #26292a; --gold: #e9c46a; --gold-dim: #c9a45c; --royal: #a78bfa;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --ui: "Jost", "Helvetica Neue", Arial, sans-serif;
  --measure: 66ch;
}
* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 19px/1.55 var(--serif); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--gold); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: #ffe9b5; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }

/* --- top bar ---------------------------------------------------------------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
  position: absolute; z-index: 5; left: 0; right: 0; top: 0;
}
.top .wordmark { font: 500 13px/1 var(--ui); margin: 0; }
.top nav { display: flex; align-items: center; gap: 6px 18px; font: 400 12px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; }
.top nav a { color: var(--ink); text-decoration: none; padding: 12px 4px; min-height: 44px; display: inline-flex; align-items: center; }
.top nav a:hover { color: var(--gold); }
.top nav .btn-ghost { padding: 12px 14px; }
body.index .top { position: static; background: var(--bg); border-bottom: 1px solid var(--rule); }
@media (max-width: 420px) { .top nav a:first-child { display: none; } }

/* --- the hero ---------------------------------------------------------------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden; min-height: 300px;
  aspect-ratio: 21 / 9; max-height: 68vh; display: flex; align-items: flex-end;
  background:
    radial-gradient(120% 90% at 20% 0%, color-mix(in srgb, var(--biome, #1b4a39) 70%, #fff 6%) 0%, transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--biome, #1b4a39) 55%, #000) 0%, #07090a 100%);
}
@supports not (color: color-mix(in srgb, red, blue)) { .hero { background: var(--biome, #1b4a39); } }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero-shade { position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(7,9,10,.55) 0%, rgba(7,9,10,0) 28%, rgba(7,9,10,.35) 58%, #07090a 100%); }
.hero-in { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px 28px; }
.eyebrow { font: 500 11px/1.4 var(--ui); letter-spacing: .26em; text-transform: uppercase; color: var(--gold); }
h1 { font: 400 clamp(38px, 7.2vw, 78px)/1.02 var(--serif); letter-spacing: -.012em; margin: 10px 0 0; text-wrap: balance; overflow-wrap: anywhere; }
.hero-note { margin-top: 12px; font: 400 12px/1.4 var(--ui); color: var(--dim); max-width: 46ch; }
@media (max-width: 700px) { .hero { aspect-ratio: auto; min-height: 340px; } .hero-in { padding-bottom: 22px; } }

/* The label that lives ON every generated picture. */
.badge {
  position: absolute; right: 12px; top: 12px; z-index: 2; pointer-events: none;
  font: 500 10.5px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
  background: rgba(7,9,10,.72); border: 1px solid rgba(233,196,106,.55); border-radius: 999px; padding: 7px 11px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.hero > .badge { top: auto; bottom: 14px; right: max(16px, calc(50% - 520px)); }
.badge.real { border-color: rgba(143,201,168,.7); color: #cfe9da; }
@media (max-width: 700px) { .hero > .badge { bottom: auto; top: 64px; right: 14px; } }
.noimg .badge, .noimg .hero-note { display: none; }

/* --- the page ------------------------------------------------------------------ */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 56px; }
.meta { display: flex; flex-wrap: wrap; gap: 14px 40px; padding: 22px 0 18px; border-bottom: 1px solid var(--rule); }
.meta div { min-width: 0; }
.meta dt { font: 500 10.5px/1.4 var(--ui); letter-spacing: .22em; text-transform: uppercase; color: var(--gold-dim); }
.meta dd { font: 400 17px/1.35 var(--serif); margin-top: 3px; }
.lede { font: 400 clamp(21px, 2.6vw, 27px)/1.45 var(--serif); max-width: var(--measure); margin: 26px 0 0; text-wrap: pretty; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 8px; }
.btn, .btn-ghost, .cap-form button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 22px;
  font: 500 12px/1.35 var(--ui); letter-spacing: .16em; text-transform: uppercase; text-decoration: none; cursor: pointer; text-align: center;
  border-radius: 2px; border: 1px solid var(--gold);
}
.btn, .cap-form button { background: var(--gold); color: #1a1405; }
.btn:hover, .cap-form button:hover { background: #ffe9b5; color: #1a1405; }
.btn-ghost { background: transparent; color: var(--gold); border-color: rgba(233,196,106,.5); }
.btn-ghost:hover { background: rgba(233,196,106,.1); color: #ffe9b5; }
@media (max-width: 520px) { .cta .btn, .cta .btn-ghost { flex: 1 1 100%; } }

.cols { display: grid; grid-template-columns: 1fr; gap: 0 56px; margin-top: 26px; }
@media (min-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.blk { border-top: 1px solid var(--rule); padding: 18px 0 12px; }
.blk p { max-width: var(--measure); }
.blk + .blk { margin-top: 4px; }
.label { font: 500 11px/1.4 var(--ui); letter-spacing: .24em; text-transform: uppercase; color: var(--gold-dim); margin-bottom: 8px; }
.sub { color: var(--dim); font-size: 16px; margin-bottom: 4px; }
sup.fn { font: 500 10px/0 var(--ui); margin-left: 2px; vertical-align: super; white-space: nowrap; }
sup.fn a { color: var(--gold-dim); text-decoration: none; padding: 0 1px; }
sup.fn a:hover { color: var(--gold); text-decoration: underline; }
ol.facts { padding-left: 1.2em; } ol.facts li { margin: 0 0 8px; max-width: var(--measure); }

table.sp { width: 100%; border-collapse: collapse; margin: 6px 0 2px; font-size: 17px; }
table.sp td { padding: 8px 10px 8px 0; border-top: 1px solid var(--rule); vertical-align: baseline; }
table.sp .vn { display: block; font: 400 13px/1.35 var(--ui); color: var(--dim); margin-top: 1px; }
table.sp .tx { font: 400 12px/1.3 var(--ui); color: var(--dim); white-space: nowrap; }
table.sp .st { font: 500 10.5px/1.3 var(--ui); letter-spacing: .08em; color: var(--gold-dim); text-align: right; }
table.sp .st[data-iucn="CR"], table.sp .st[data-iucn="EN"] { color: #f0a58a; }
table.sp .st[data-iucn="VU"] { color: #e9c46a; }
@media (max-width: 420px) { table.sp .tx { display: none; } }

/* --- figures -------------------------------------------------------------------- */
.pics { display: grid; grid-template-columns: 1fr; gap: 28px; margin: 36px 0 8px; }
@media (min-width: 900px) { .pics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pics figure.gen.sky { grid-column: 1 / -1; } }
figure .frame { position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--rule); aspect-ratio: 16 / 9; }
figure.relief .frame { aspect-ratio: 1536 / 640; }
figure .frame img { width: 100%; height: 100%; object-fit: cover; }
figure.noimg .frame { display: grid; place-items: center; }
figure.noimg .frame::after { content: "Picture not loaded"; font: 400 12px/1 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
figcaption { font: 400 14.5px/1.5 var(--serif); color: var(--dim); margin-top: 9px; max-width: var(--measure); }
figcaption b { color: var(--ink); font-weight: 500; }
figcaption a { color: var(--gold-dim); }

/* --- the email capture ------------------------------------------------------------ */
.capture { margin: 44px 0 0; padding: 28px clamp(18px, 4vw, 36px); background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid rgba(233,196,106,.38); border-radius: 3px; }
.capture h2 { font: 400 clamp(26px, 3.4vw, 34px)/1.15 var(--serif); }
.capture p { max-width: var(--measure); margin-top: 8px; }
.cap-form { display: flex; gap: 10px; margin-top: 18px; max-width: 560px; }
.cap-form[hidden] { display: none; }
.cap-form input[type=email] {
  flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 0 14px; font: 400 16px/1 var(--ui); color: var(--ink);
  background: #070a09; border: 1px solid #3a3e3d; border-radius: 2px;
}
.cap-form input[type=email]::placeholder { color: #7b786c; }
.cap-form input[type=email]:focus { border-color: var(--gold); outline: 2px solid rgba(233,196,106,.35); outline-offset: 1px; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.cap-msg { font: 500 15px/1.4 var(--ui); color: #cfe9da; margin-top: 12px; }
.cap-msg.err { color: #f0a58a; }
.fine { font: 400 13px/1.55 var(--ui); color: var(--dim); margin-top: 14px; }
@media (max-width: 520px) { .cap-form { flex-direction: column; } .cap-form button { width: 100%; } }

/* --- sources, nearby, footer -------------------------------------------------------- */
.sources { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--rule); font: 400 13px/1.55 var(--ui); color: var(--dim); }
.sources ol { list-style: none; padding: 0; }
.sources li { margin: 0 0 5px; overflow-wrap: anywhere; }
.sources li span { color: var(--gold-dim); font-weight: 500; margin-right: 6px; }
.sources a { color: var(--dim); }
.sources a:hover { color: var(--gold); }
.sources li:target { background: rgba(233,196,106,.1); outline: 1px solid rgba(233,196,106,.4); }
.stat { margin-top: 10px; font: 400 12.5px/1.55 var(--ui); color: var(--dim); max-width: 78ch; }
.near { margin-top: 36px; }
.near ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.near a { display: inline-block; padding: 12px 16px; min-height: 44px; border: 1px solid var(--rule); background: var(--panel); color: var(--ink); text-decoration: none; font-size: 16px; }
.near a:hover { border-color: var(--gold-dim); color: var(--gold); }
.foot { border-top: 1px solid var(--rule); padding: 22px 20px 40px; max-width: 1080px; margin: 0 auto; font: 400 12.5px/1.6 var(--ui); color: var(--dim); }
.foot p + p { margin-top: 6px; }
.foot a { color: var(--dim); } .foot a:hover { color: var(--gold); }

/* --- the index ------------------------------------------------------------------------ */
.idx-head { padding: 40px 0 8px; }
.idx-head h1 { font-size: clamp(34px, 6vw, 60px); }
.filter { margin-top: 20px; max-width: 460px; }
.filter[hidden] { display: none; }
.filter input { width: 100%; min-height: 48px; padding: 0 14px; font: 400 16px/1 var(--ui); color: var(--ink); background: #070a09; border: 1px solid #3a3e3d; border-radius: 2px; }
.realm { margin-top: 34px; }
.realm[hidden], .biome[hidden], .biome li[hidden] { display: none; }
.biome { margin: 16px 0 0; padding-left: 14px; border-left: 3px solid var(--biome, #1b4a39); }
.biome h3 { font: 500 14px/1.4 var(--ui); letter-spacing: .06em; color: var(--dim); margin-bottom: 6px; }
.biome ul { list-style: none; padding: 0; columns: 3 240px; column-gap: 28px; }
.biome li { break-inside: avoid; }
.biome li a { display: block; padding: 7px 0; min-height: 36px; color: var(--ink); text-decoration: none; font-size: 17px; line-height: 1.3; }
.biome li a:hover { color: var(--gold); text-decoration: underline; }

@media print {
  html, body { background: #fff; color: #111; }
  .top, .cta, .capture, .near, .hero-shade, .btn, .btn-ghost { display: none !important; }
  .hero { min-height: 0; aspect-ratio: auto; background: none; } .hero-in { padding: 0; } h1 { color: #111; font-size: 34px; }
  a { color: #111; }
}
