/* Start page extras: world map and build-year slider. Loaded after site.css on index.html. */

/* ---------- where they are right now ---------- */

.wmap { --land: #cdc6bc; }
@media (prefers-color-scheme: dark) { .wmap { --land: #3a424a; } }
.wmap-head { display: flex; justify-content: space-between; align-items: end; gap: 20px 32px; flex-wrap: wrap; margin-bottom: 28px; }
.wmap-head .lede { max-width: 52ch; }
.wmap-stage { position: relative; width: 100%; overflow: hidden; }
.wmap-land { position: absolute; inset: 0; transition: opacity .26s ease; }
.wmap-land.is-fading { opacity: 0; }
.wmap-dots { position: absolute; inset: 0; overflow: visible; }
.wdot { cursor: pointer; transition: transform .9s cubic-bezier(.65, 0, .35, 1), opacity .4s ease; outline: none; }
.wdot.is-out { opacity: 0; pointer-events: none; }
.wdot .core { fill: var(--sky-ink); stroke: var(--paper); stroke-width: 2; transition: fill .2s ease; }
.wdot .halo { fill: var(--sky); opacity: 0; transition: opacity .2s ease; }
.wdot .count { fill: #fff; font: 700 11px var(--sans); text-anchor: middle; pointer-events: none; }
.wdot:hover .halo, .wdot:focus-visible .halo, .wdot.is-on .halo { opacity: .28; }
.wdot.is-on .core { fill: var(--sky); }
@media (prefers-reduced-motion: no-preference) {
  .wmap-stage.has-land .wdot .halo { animation: breathe 3.2s ease-in-out infinite; }
}
@keyframes breathe { 0%, 100% { opacity: 0; } 50% { opacity: .18; } }
.wmap-card {
  position: absolute; z-index: 3; background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: grid;
}
.wmap-card[hidden] { display: none; }
.wmap-card-head { position: relative; display: grid; gap: 2px; padding: 12px 40px 10px 14px; }
.wmap-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.wmap-card ul { list-style: none; margin: 0; padding: 6px 0; }
.wmap-card li a { display: grid; padding: 7px 14px; text-decoration: none; }
.wmap-card li a:hover, .wmap-card li a:focus-visible { background: var(--wash); }
.wmap-card li span { font-family: var(--serif); font-size: 1.1rem; line-height: 1.2; }
.wmap-card li small { color: var(--muted); font-size: 0.8125rem; }
.wmap-card > p { padding: 0 14px 12px; }
.wmap-box { position: relative; }
@media (max-width: 600px) {
  .wmap-card { position: static; margin-top: 12px; grid-template-columns: 112px minmax(0, 1fr); }
  .wmap-card-head { grid-column: 1 / -1; }
  .wmap-card img { height: 100%; aspect-ratio: auto; }
  .wmap-card ul { padding: 0; }
  .wmap-card > p { grid-column: 1 / -1; padding-top: 8px; }
}
.wmap-close { position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; border: 0; background: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); }

/* ---------- from 2005 to 2026 ---------- */

/* the fanned cards are rotated and shifted, which would widen the page on phones */
.years { overflow-x: clip; }
.yr-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(28px, 5vw, 80px); align-items: center; }
.yr-copy { display: grid; gap: 16px; align-content: start; }
.yr-now { display: grid; gap: 4px; margin-top: 10px; }
.yr-big { font-family: var(--serif); font-size: clamp(4.5rem, 3rem + 6vw, 9rem); line-height: .9; font-variant-numeric: tabular-nums; color: var(--ink); }
.yr-meta { font-weight: 700; color: var(--ink-2); }
.yr-names { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 0; }
.yr-names li a { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; }
.yr-names li a:hover span { text-decoration: underline; text-decoration-color: var(--sky); text-underline-offset: 4px; }
.yr-names span { font-family: var(--serif); font-size: 1.2rem; }
.yr-names small { color: var(--muted); font-size: 0.8125rem; align-self: center; text-align: right; }
.yr-stack { position: relative; aspect-ratio: 4 / 3.3; }
.yr-card {
  position: absolute; left: 6%; right: 6%; top: 6%; margin: 0; background: #fff; padding: 10px 10px 34px;
  box-shadow: 0 18px 40px rgb(30 25 20 / .18); transform: translate(var(--x), calc(var(--i) * 3%)) rotate(var(--r));
  transition: transform .7s cubic-bezier(.16, 1, .3, 1), opacity .4s ease;
}
.yr-card img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--line); }
.yr-card figcaption { position: absolute; left: 12px; right: 12px; bottom: 8px; font-family: var(--serif); font-size: 1.05rem; color: #1b1814; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yr-card.is-leaving { opacity: 0; transform: translate(-30%, 8%) rotate(-14deg); }
@media (prefers-reduced-motion: no-preference) {
  .yr-card:not(.is-leaving) { animation: deal .7s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--i) * 70ms); }
}
@keyframes deal { from { opacity: 0; transform: translate(40%, -6%) rotate(12deg); } }

.yr-track { position: relative; margin-top: 48px; padding-bottom: 40px; }
.yr-range { width: 100%; appearance: none; -webkit-appearance: none; background: transparent; height: 32px; margin: 0; cursor: pointer; }
.yr-range::-webkit-slider-runnable-track { height: 2px; background: var(--line-strong); }
.yr-range::-moz-range-track { height: 2px; background: var(--line-strong); }
.yr-range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--sky-ink); border: 4px solid var(--paper); box-shadow: 0 0 0 1px var(--sky-ink); margin-top: -12px; }
.yr-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--sky-ink); border: 4px solid var(--paper); box-shadow: 0 0 0 1px var(--sky-ink); }
.yr-range:focus-visible { outline: none; }
.yr-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--sky); }
.yr-ticks { position: absolute; left: 13px; right: 13px; top: 30px; height: 30px; }
.yr-ticks button { position: absolute; transform: translateX(-50%); border: 0; background: none; padding: 6px 2px 0; cursor: pointer; color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.yr-ticks button::before { content: ""; position: absolute; left: 50%; top: 0; width: 1px; height: 6px; background: var(--line-strong); }
.yr-ticks button span { visibility: hidden; }
.yr-ticks button.major span, .yr-ticks button.is-on span { visibility: visible; }
.yr-ticks button.is-on { color: var(--sky-ink); font-weight: 700; }
@media (max-width: 860px) {
  /* phones: heading, cards, year, slider, then the names, so the slider sits right under the cards */
  .years > .wrap { display: flex; flex-direction: column; }
  .yr-grid, .yr-copy { display: contents; }
  .yr-copy h2 { order: 1; }
  .yr-copy .lede { order: 2; margin-top: 12px; }
  .yr-stack { order: 3; max-width: 520px; width: 100%; align-self: center; margin: 28px 0 12px; }
  .yr-now { order: 4; }
  .yr-track { order: 5; margin-top: 16px; }
  .yr-names { order: 6; }
}
@media (max-width: 600px) { .yr-ticks button:not(.is-on) span { visibility: hidden; } .yr-ticks button.major:first-child span, .yr-ticks button.major:last-child span { visibility: visible; } }

/* size section: two links side by side, wrapping on phones */
.size-links { display: flex; gap: 12px; flex-wrap: wrap; }
