/* Shared by the home, country and region pages: maps with place dots, rankings, place lists. */
:root {
  --b1: #8fa2ff; --b2: #8f8cf0; --b3: #a078d8; --b4: #bb5f9f; --b5: #d24f63;
  --b6: #e2483a; --b7: #ec7444; --b8: #f2a65a; --b9: #fff1dc;
}

.intro { padding: 72px 0 40px; margin: 0; border: 0; max-width: 820px; }
.intro h1 { font-size: clamp(40px, 6vw, 80px); line-height: 0.98; font-weight: 500; letter-spacing: -0.035em; margin: 14px 0 20px; }
.intro h1 em { color: var(--amber); font-weight: 500; }
.intro .sub { font-size: 18px; max-width: 56ch; }

.finder { position: relative; z-index: 30; max-width: 520px; margin-top: 26px; }
.search { width: 100%; font-family: var(--mono); font-size: 15px; color: var(--text); background: rgba(18, 26, 48, 0.85); border: 1px solid var(--line); border-radius: 3px; padding: 13px 14px; backdrop-filter: blur(4px); }
.search::-webkit-search-cancel-button { -webkit-appearance: none; width: 12px; height: 12px; cursor: pointer; background: linear-gradient(45deg, transparent 45%, var(--muted) 45%, var(--muted) 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, var(--muted) 45%, var(--muted) 55%, transparent 55%); }
.search:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; list-style: none; margin: 0; padding: 4px 0; background: var(--ink-2); border: 1px solid var(--line); border-radius: 3px; box-shadow: 0 18px 40px rgba(0,0,0,0.5); }
.results[hidden] { display: none; }
.results a { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 10px; padding: 9px 14px; color: var(--text); text-decoration: none; font-size: 15.5px; }
.results a small { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.results a .sw.region { border-radius: 2px; }  /* a region result: a square in the color of its darkest place */
.results a .bn { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.results a.on, .results a:hover { background: var(--ink-3); }
.sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--c); }
.sw.park { border-radius: 1px; transform: rotate(45deg) scale(0.9); }

/* Atlas */
.atlas { border: 0; margin-top: 0; position: relative; width: min(1320px, calc(100vw - 2 * var(--gutter))); margin-left: calc(50% - min(660px, 50vw - var(--gutter))); padding: 18px 0 10px; }
.atlas-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; margin: 0 0 14px; }
.tabs { display: flex; gap: 0; }
.tabs button { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); background: transparent; border: 1px solid var(--line); padding: 10px 16px; cursor: pointer; }
.tabs button + button { border-left: none; }
.tabs button span { color: var(--faint); margin-left: 6px; }
.tabs button[aria-selected="true"] { color: var(--text); background: var(--red-soft); border-color: var(--red); }
.panel[hidden] { display: none; }
.panel.uk { display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 56px; align-items: start; }
.panel.uk[hidden] { display: none; }

.map { position: relative; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #060913; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); }
.map img { display: block; width: 100%; height: auto; }
.frame { position: relative; }
.insets { display: flex; justify-content: center; align-items: flex-start; gap: 0; border-top: 1px solid var(--line); background: #060913; }
.map .inset { position: relative; border-right: 1px solid var(--line); }
.map .inset:last-child { border-right: 0; }
.map .inset img { height: 230px; width: auto; }
.map .inset.ic img { height: 150px; }  /* the Canaries under Spain */
.map .inset span { position: absolute; left: 6px; top: 4px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.dots { position: absolute; inset: 0; }
.dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px rgba(5, 7, 15, 0.9); }
.js .dot { opacity: 0; transform: scale(0); }
.dot.park { border-radius: 1px; width: 10px; height: 10px; margin: -5px 0 0 -5px; transform: rotate(45deg); }
.js .dot.park { transform: rotate(45deg) scale(0); }
.dot:hover, .dot:focus-visible, .dot.hot { z-index: 3; outline: none; box-shadow: 0 0 0 2px var(--text), 0 3px 10px rgba(0, 0, 0, 0.6); }
.lit .dot { animation: pop 0.7s cubic-bezier(.2, .9, .3, 1.4) forwards; animation-delay: var(--d); }
.lit .dot.park { animation: pop-park 0.7s cubic-bezier(.2, .9, .3, 1.4) forwards; animation-delay: var(--d); }
.lit .dot.park.tw { animation: pop-park 0.7s cubic-bezier(.2, .9, .3, 1.4) forwards, twinkle 3.2s ease-in-out infinite; animation-delay: var(--d), calc(var(--d) + 0.7s + var(--t)); }  /* only the darkest: see TWINKLE in build_page.py */
@keyframes pop { 0% { opacity: 0; transform: scale(0); } 60% { opacity: 1; transform: scale(1.6); } 100% { opacity: 1; transform: scale(1); } }
@keyframes pop-park { 0% { opacity: 0; transform: rotate(45deg) scale(0); } 60% { opacity: 1; transform: rotate(45deg) scale(1.6); } 100% { opacity: 1; transform: rotate(45deg) scale(1); } }
@keyframes twinkle { 0%, 100% { opacity: 1; transform: rotate(45deg) scale(1); } 50% { opacity: 0.55; transform: rotate(45deg) scale(0.8); } }
@media (prefers-reduced-motion: reduce) {
  .dot, .lit .dot { animation: none !important; opacity: 1; transform: none; }
  .dot.park, .lit .dot.park { transform: rotate(45deg); }
}
.tip { position: absolute; z-index: 10; pointer-events: none; transform: translate(-50%, calc(-100% - 14px)); background: var(--ink-2); border: 1px solid var(--line); border-radius: 3px; padding: 7px 10px; white-space: nowrap; font-size: 15px; box-shadow: 0 10px 24px rgba(0,0,0,0.45); }
.tip small { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.tip[hidden] { display: none; }

.key { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.bscale { display: flex; align-items: center; gap: 3px; }
.bscale b { font-weight: 400; padding: 0 5px; }
.bscale i { width: 22px; height: 8px; background: var(--c); font-style: normal; }
.bscale i:first-child { border-radius: 2px 0 0 2px; } .bscale i:last-child { border-radius: 0 2px 2px 0; }
.key .shape { display: inline-flex; align-items: center; gap: 8px; }

.ranks { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 48px; margin-top: 34px; }
/* Side-by-side blocks share rows: a heading that wraps doesn't push its list below the neighbor's. */
.ranks > div { display: grid; grid-template-rows: subgrid; grid-row: span 3; align-content: start; }
.ranks > div h2 { align-self: start; }
.panel.uk .ranks { grid-template-columns: 1fr; margin-top: 0; }
.ranks h2 { font-size: clamp(22px, 2.4vw, 28px); line-height: 1.15; font-weight: 500; margin: 6px 0 12px; }
.ranks ol { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.ranks li a { display: grid; grid-template-columns: 22px 14px 1fr auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(38,49,79,0.6); color: var(--text); text-decoration: none; }
.ranks li a::before { counter-increment: r; content: counter(r); font-family: var(--mono); font-size: 11px; color: var(--faint); }
.ranks li a:hover { color: var(--amber); }
.ranks li small { display: block; font-family: var(--mono); font-size: 11px; color: var(--faint); margin-top: 2px; }
.ranks li .mag { font-family: var(--mono); font-size: 14.5px; font-weight: 500; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }

/* Full list */
.all { margin-top: 88px; padding-top: 40px; border-top: 1px solid var(--line); }
.all > h2 { font-size: clamp(28px, 3.4vw, 42px); font-weight: 500; margin: 8px 0 30px; }
.country h3.cn { font-size: 26px; font-weight: 500; margin: 26px 0 14px; }
.all h3.cont { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 44px 0 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.region { margin: 0 0 26px; }
.region h4 { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 18px; }
.grid a { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(38,49,79,0.6); color: var(--text); text-decoration: none; font-size: 15.5px; }
.grid a:hover { color: var(--amber); }
.grid a span { font-family: var(--mono); font-size: 13.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.grid a.park { color: var(--amber); }
.grid a[hidden] { display: none; }
.gfind { margin: 4px 0 16px; max-width: 420px; }
.gfind input { width: 100%; font-family: var(--sans); font-size: 15px; color: var(--text); background: var(--ink-2); border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; }
.gfind input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.gnone { color: var(--muted); font-size: 15px; }
.more-row { margin: 18px 0 0; }
.gmore { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 3px; padding: 10px 16px; cursor: pointer; }
.gmore:hover { border-color: var(--amber); color: var(--amber); }
.legend-line { font-family: var(--mono); font-size: 12px; color: var(--faint); margin: -14px 0 26px; }
.legend-line b { color: var(--amber); font-weight: 400; }

@media (max-width: 760px) {
  .intro { padding-top: 40px; }
  .panel.uk { grid-template-columns: 1fr; gap: 28px; }
  .ranks { grid-template-columns: 1fr; }
  .dot { width: 5.5px; height: 5.5px; margin: -2.75px 0 0 -2.75px; box-shadow: 0 0 0 1px rgba(5, 7, 15, 0.9); }
  .dot.park { width: 6.5px; height: 6.5px; margin: -3.25px 0 0 -3.25px; }
  .map .inset img { height: 120px; } .map .inset.ic img { height: 110px; }
  .tabs button { padding: 10px 12px; }
}

/* Country and region pages */
.region-panel { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.region-panel .ranks { grid-template-columns: 1fr; margin-top: 0; }
.region-map { max-width: 760px; }
.outline { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.outline path { fill: none; stroke: rgba(233, 228, 218, 0.38); stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.region h4 a, .country h3.cn a { color: inherit; text-decoration: none; }
.region h4 a:hover, .country h3.cn a:hover { color: var(--amber); }
.tablewrap { overflow-x: auto; }
table.regions { width: 100%; border-collapse: collapse; font-size: 15.5px; }
table.regions th { text-align: left; font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); padding: 0 12px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.regions td { padding: 10px 12px 10px 0; border-bottom: 1px solid rgba(38, 49, 79, 0.6); }
table.regions td:nth-child(2), table.regions td:nth-child(3) { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
table.regions a { color: var(--text); text-decoration: none; }
table.regions a:hover { color: var(--amber); }
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--amber); }
@media (max-width: 760px) {
  .region-panel { grid-template-columns: 1fr; gap: 28px; }
}

/* Home: every state and nation at a glance */
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.rcard { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 4px; background: rgba(18, 26, 48, 0.55); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.rcard:hover { border-color: var(--amber); transform: translateY(-1px); }
.rcard .rn { font-size: 17px; font-weight: 500; }
.rcard .rc { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.rcard .rd { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.all .country { border: 0; padding: 0; margin: 28px 0 0; }
/* Country cards: thumbnail at the left, four rows that line up across a row of cards (subgrid), so a long name or
   a wrapped darkest place never pushes its neighbors' rows out of step. */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.ccard { display: grid; grid-template-columns: 56px 1fr; grid-template-rows: subgrid; grid-row: span 5; column-gap: 14px; row-gap: 3px; align-items: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 4px; background: rgba(18, 26, 48, 0.55); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.ccard:hover { border-color: var(--amber); transform: translateY(-1px); }
.ccard img { grid-row: 1 / -1; width: 56px; height: 56px; align-self: start; }
.ccard .rn { font-size: 17px; font-weight: 500; }
.ccard .rc { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.ccard .rd { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin-top: 5px; }
.ccard .rb { font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding-left: 18px; align-self: end; }
@supports not (grid-template-rows: subgrid) { .ccard { grid-template-rows: auto auto auto auto auto; } }
.rank-note { font-size: 14px; line-height: 1.5; color: var(--muted); margin: 10px 0 0; max-width: 52ch; }
.key-note { font-size: 14px; line-height: 1.5; color: var(--muted); margin: -4px 0 14px; max-width: 80ch; }
.key-note a { color: var(--text); text-decoration-color: var(--faint); }
.key-note a:hover { color: var(--amber); }
table.regions .u { display: none; }
table.regions th .th2 { font-size: 10px; letter-spacing: 0.08em; color: var(--faint); }
table.regions td:last-child a { display: inline-flex; align-items: center; gap: 8px; }
table.regions .dm { display: block; font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--muted); margin: 3px 0 0 18px; }
@media (max-width: 640px) {
  table.regions thead { display: none; }
  table.regions, table.regions tbody { display: block; }
  table.regions tr { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 4px 14px; padding: 12px 0; border-bottom: 1px solid rgba(38, 49, 79, 0.6); }
  table.regions td { border: 0; padding: 0; }
  table.regions .u { display: inline; }
  table.regions td:last-child { grid-column: 1 / -1; margin-top: 4px; font-size: 14.5px; }
}

/* Panels: padding and rows */
.ranks ol { padding: 2px 16px; }
.ranks li:last-child a { border-bottom: 0; }
.ranks li a:hover { background: rgba(255, 255, 255, 0.03); }
.tablewrap { padding: 0 18px; }
table.regions tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.018); }
table.regions tbody tr:hover td { background: rgba(255, 255, 255, 0.04); }
table.regions tbody tr:last-child td { border-bottom: 0; }
table.regions th { padding-top: 14px; }
@media (max-width: 640px) {
  .tablewrap { padding: 0; }
  table.regions tbody tr { padding: 12px 14px; }
  table.regions tbody tr:last-child { border-bottom: 0; }
  table.regions tbody tr td, table.regions tbody tr:hover td { background: none !important; }
  table.regions tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.025); }
}
.region-panel .ranks > div:first-child h2, .panel.uk .ranks > div:first-child h2 { margin-top: 0; }

/* Home: search button, more room above the map, map filters */
.search-row { display: flex; gap: 0; }
.search-row .search { border-radius: 3px 0 0 3px; }
.search-go { flex: none; font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: #f1eefc; background: #4a3a8c; border: 1px solid #5c4aa6; border-left: 0; border-radius: 0 3px 3px 0; padding: 0 20px; cursor: pointer; }
.search-go:hover { background: #5a48a8; }
.search-go:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
/* Near me (home page): next to Search on wide screens, its own row on phones */
.search-near { flex: none; display: inline-flex; align-items: center; gap: 8px; margin-left: 8px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text); background: rgba(18, 26, 48, 0.85); border: 1px solid var(--line); border-radius: 3px; padding: 0 16px; cursor: pointer; }
.search-near[hidden] { display: none; }
.search-near svg { width: 15px; height: 15px; fill: none; stroke: var(--amber); stroke-width: 1.5; }
.search-near:hover { border-color: var(--amber); }
.search-near:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.search-near:disabled { opacity: 0.6; cursor: progress; }
.results .rhead { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); padding: 10px 14px 4px; }
@media (max-width: 520px) {
  .search-row { flex-wrap: wrap; }
  .search-row .search { flex: 1 1 0; min-width: 0; }
  .search-near { flex: 1 1 100%; justify-content: center; margin: 8px 0 0; padding: 12px 16px; }
}
/* Home map: the darkest places are few, so their dots are bigger and easy to tap; all towns or parks stay small */
.home-atlas[data-show="dark"] .dot, .home-atlas[data-show="dark"] .dot.park { width: 12px; height: 12px; margin: -6px 0 0 -6px; }
@media (max-width: 760px) { .home-atlas[data-show="dark"] .dot, .home-atlas[data-show="dark"] .dot.park { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; } }
.intro + .atlas { margin-top: 48px; }
.map-filters { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; margin: 4px 0 14px; }
.seg { display: flex; }
.seg button { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); background: transparent; border: 1px solid var(--line); padding: 10px 16px; cursor: pointer; }
.seg button + button { border-left: none; }
.seg button[aria-pressed="true"] { color: var(--text); background: rgba(74, 58, 140, 0.35); border-color: #5c4aa6; }
@media (max-width: 760px) { .seg button, .map-filters .tabs button { padding: 10px 12px; } .search-go { padding: 0 14px; }
  /* four countries don't fit in one row on a phone: two by two */
  .map-filters .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
  .map-filters .tabs button + button { border-left: 1px solid var(--line); }
  .map-filters .tabs button[aria-selected="true"] { border-color: var(--red); } }
