/* ==========================================================================
   Snark: un atlante in cianotipia
   Blu di Prussia, carta fredda, un solo evidenziatore giallo per i punti.
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-var.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-italic-var.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --blue: #0e2f57;        /* cianotipia */
  --blue-lift: #1a4a80;   /* luce al centro della lastra */
  --blue-deep: #091f3b;   /* piede di pagina */
  --paper: #eef1ec;       /* carta da carta topografica, fredda */
  --ink: #0e2f57;         /* inchiostro: lo stesso blu, stampato */
  --ink-soft: #3d5677;
  --signal: #ffd23f;      /* evidenziatore: solo per i punti sulla mappa */
  --line-on-blue: rgba(238, 241, 236, .2);

  --sans: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;

  /* scala 1.333 su 19px */
  --step--1: .8125rem;
  --step-0: 1.1875rem;
  --step-1: 1.5625rem;
  --step-2: 2.0625rem;
  --step-3: 2.75rem;

  --gutter: clamp(1.25rem, 4.5vw, 4rem);
  --max: 88rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--blue-deep); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }

:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 2px; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 20;
  background: var(--signal); color: var(--ink); padding: .6rem 1rem;
  font: 600 var(--step--1)/1 var(--sans); text-decoration: none;
}
.skip:focus { top: 1rem; }

/* --------------------------------------------------------------- testata */
.top {
  position: absolute; inset: 0 0 auto; z-index: 5;
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: clamp(1rem, 2.5vw, 1.75rem) var(--gutter);
  color: var(--paper);
}
.brand {
  font: 800 1.6rem/1 var(--sans);
  font-stretch: 125%;
  letter-spacing: -.02em;
  text-decoration: none;
}
.top__nav { display: flex; gap: clamp(1rem, 3vw, 2.25rem); }
.top__nav a {
  font: 500 1rem/1 var(--sans);
  text-decoration: none;
  padding-block: .4rem;
  border-bottom: 1px solid transparent;
}
.top__nav a:hover { border-bottom-color: currentColor; }

/* ----------------------------------------------------------------- hero */
.hero {
  position: relative;
  min-height: clamp(40rem, 100svh, 62rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto;
  gap: 2rem var(--gutter);
  padding: 7rem var(--gutter) clamp(2rem, 5vw, 4rem);
  background:
    radial-gradient(120% 90% at 62% 30%, var(--blue-lift) 0%, var(--blue) 62%);
  color: var(--paper);
  overflow: hidden;
  isolation: isolate;
}
.hero__map { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.no-js .hero__map { display: none; }

.hero__copy { grid-column: 1; grid-row: 2; max-width: 46rem; }
.hero h1 {
  font: 760 clamp(3.3rem, 9.4vw, 9rem)/.86 var(--sans);
  font-stretch: 68%;
  letter-spacing: -.012em;
  text-wrap: balance;
  max-width: 9ch;
}
.hero__lede {
  margin-top: 1.5rem;
  max-width: 36ch;
  font-size: var(--step-1);
  line-height: 1.38;
  color: rgba(238, 241, 236, .86);
  text-wrap: pretty;
}

/* legenda, come nell'angolo di una carta */
.legend {
  grid-column: 2; grid-row: 2; align-self: end;
  min-width: 17rem;
  padding: 1.1rem 1.25rem 1.25rem;
  border: 1px solid rgba(238, 241, 236, .38);
  background: rgba(9, 31, 59, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.legend__title { font: italic 400 1rem/1 var(--serif); opacity: .75; margin-bottom: .75rem; }
.legend ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.legend a {
  display: grid; grid-template-columns: 1.4rem 1fr; gap: .75rem; align-items: center;
  padding: .4rem .25rem; margin-inline: -.25rem;
  text-decoration: none;
}
.legend a:hover b { text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }
.legend b { display: block; font: 600 1rem/1.15 var(--sans); }
.legend i { display: block; font: italic 400 .9rem/1.3 var(--serif); opacity: .72; }

.sym { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.sym .fill { fill: currentColor; stroke: none; }
.legend .sym, .pin .sym { color: var(--signal); }

/* punti sulla mappa */
.hero__pins { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.pin {
  --halo: var(--blue);
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  display: flex; align-items: center; gap: .6rem;
  translate: -.75rem -50%;
  text-decoration: none;
  pointer-events: auto;
}
.pin__mark {
  display: grid; place-items: center;
  width: 1.5rem; height: 1.5rem;
  transition: scale .25s cubic-bezier(.3, 1.6, .5, 1);
}
.pin__mark .sym { width: 1.5rem; height: 1.5rem; stroke-width: 1.8; }
.pin:hover .pin__mark { scale: 1.25; }
.pin__label {
  display: grid;
  text-shadow: 0 0 3px var(--halo), 0 0 8px var(--halo), 0 0 14px var(--halo);
}
.pin__label b { font: 650 1.05rem/1.1 var(--sans); font-stretch: 108%; letter-spacing: -.005em; }
.pin__label i { font: italic 400 .92rem/1.25 var(--serif); opacity: .8; }

.pin--unknown { --x: 51; --y: 75; pointer-events: none; translate: -50% -50%; }
.pin__ring {
  width: clamp(5rem, 11vw, 9rem); aspect-ratio: 1;
  border: 1.5px dashed rgba(238, 241, 236, .45);
  border-radius: 50%;
}
.pin--unknown .pin__label { position: absolute; left: 50%; top: 50%; translate: -50% -50%; white-space: nowrap; }
.pin--unknown i { font-size: 1rem; opacity: .7; }

.js .pin { opacity: 0; }
.js .is-ready .pin {
  opacity: 1;
  transition: opacity .5s ease calc(var(--i) * 110ms);
}
@media (prefers-reduced-motion: no-preference) {
  .js .pin { translate: -.75rem calc(-50% + 10px); }
  .js .is-ready .pin {
    translate: -.75rem -50%;
    transition: opacity .5s ease calc(var(--i) * 110ms), translate .6s cubic-bezier(.2, .9, .3, 1.2) calc(var(--i) * 110ms);
  }
}

/* --------------------------------------------------------------- tavole */
.plates { background: var(--paper); }
.plate {
  max-width: var(--max);
  margin-inline: auto;
  padding: clamp(4.5rem, 10vw, 9rem) var(--gutter);
}
.plate + .plate { border-top: 1px solid rgba(14, 47, 87, .16); }

.plate__place {
  display: flex; align-items: center; gap: .6rem;
  font: italic 400 var(--step-1)/1.2 var(--serif);
  color: var(--ink-soft);
}
.plate__place .sym { width: 1.25rem; height: 1.25rem; color: var(--ink); }
.plate__name {
  margin-top: .35rem;
  font: 820 clamp(2.15rem, 7.4vw, 7.6rem)/.9 var(--sans);
  font-stretch: 125%;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.plate__body {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2rem, 5vw, 5.5rem);
  align-items: center;
  margin-top: clamp(2rem, 5vw, 4rem);
}
.plate--flip .plate__body { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.plate--flip .plate__art { order: 2; }

.plate__headline {
  font: 650 var(--step-2)/1.08 var(--sans);
  font-stretch: 86%;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.plate__lede { margin-top: 1rem; max-width: 34em; line-height: 1.62; text-wrap: pretty; }

.facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 2rem;
  margin-top: 2rem;
}
.facts div {
  display: flex; flex-direction: column-reverse; justify-content: flex-end;
  padding-top: .8rem;
  border-top: 1px solid rgba(14, 47, 87, .28);
}
.facts dd {
  font: 720 var(--step-3)/1 var(--sans);
  font-stretch: 70%;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums lining-nums;
}
.facts dt { margin-top: .35rem; font-size: 1rem; line-height: 1.35; color: var(--ink-soft); }

.plate__go { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 2.5rem; }
.cta {
  display: inline-flex; align-items: center; min-height: 3.25rem;
  padding: .9rem 1.5rem;
  background: var(--ink); color: var(--paper);
  border-radius: 3px;
  font: 650 1.0625rem/1 var(--sans);
  text-decoration: none;
  transition: background-color .2s, color .2s, box-shadow .2s;
}
.cta:hover { background: var(--signal); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.plate__url { font: italic 400 1rem/1.3 var(--serif); color: var(--ink-soft); }

/* illustrazioni */
.plate__art { color: var(--ink); }
.art { width: 100%; height: auto; overflow: visible; }
.art text { font-family: var(--serif); font-size: 12.5px; fill: currentColor; }
.art .art__name { font-family: var(--sans); font-weight: 600; font-stretch: 88%; }
.art .art__q { font-family: var(--sans); font-weight: 400; font-stretch: 80%; opacity: .7; font-variant-numeric: tabular-nums; }
.art .art__note { font-style: italic; font-size: 15px; }
.art-caption { margin-top: 1rem; font: italic 400 1rem/1.4 var(--serif); color: var(--ink-soft); max-width: 46ch; }

.art__grid line { stroke: currentColor; opacity: .14; }
.art__grid text { opacity: .55; font-family: var(--sans) !important; font-stretch: 80%; }
.art__summit path { fill: currentColor; }
.art__summit.is-top path { fill: var(--signal); stroke: currentColor; stroke-width: 1.4; }
.art .art__cname { font-family: var(--sans); font-weight: 700; font-size: 14px; font-stretch: 100%; }
.art .art__cstats { opacity: .7; }

.art .art__lane { font-size: 14px; }
.art__lane-fill { fill: currentColor; opacity: .07; }
.art__finish rect { fill: currentColor; }

.art__block { fill: currentColor; opacity: .1; }
.art__river { stroke: currentColor; opacity: .2; }
.art .art__note--river { opacity: .75; }
.art__mission rect { fill: var(--paper); stroke: currentColor; stroke-width: 1.6; }
.art__mission.is-done > rect { fill: currentColor; }
.art__mission.is-now > rect:first-of-type { fill: var(--signal); }
.art__mission.is-now > rect + rect, .art__mission.is-todo > rect + rect { fill: currentColor; stroke: none; }
.art__ping { fill: none; stroke: currentColor; stroke-width: 1.2; transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .art__ping { animation: ping 2.4s cubic-bezier(.2, .6, .3, 1) infinite; }
  @keyframes ping { from { scale: .45; opacity: 1; } to { scale: 1.6; opacity: 0; } }
}
.art__board > rect { fill: var(--paper); stroke: currentColor; stroke-width: 1.4; }
.art__you { fill: var(--signal); }
.art .art__rank { font-family: var(--sans); font-weight: 700; font-stretch: 80%; }

.art--generic path.is-index { stroke-width: 2; }

/* calcolatore nel prato della pista */
.art-stack { position: relative; container-type: inline-size; }
.pace {
  position: absolute; left: 31.25%; top: 30.2%; width: 37.5%; height: 39.7%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  text-align: center;
}
.pace__label { font: italic 400 .95rem/1.2 var(--serif); color: var(--ink-soft); }
.pace__row { display: flex; align-items: stretch; gap: .5rem; }
.pace input {
  width: 3.3em;
  padding: 0 .1rem .1rem;
  border: 0; border-bottom: 2px solid var(--ink); border-radius: 0;
  background: transparent; color: var(--ink);
  font: 720 1.9rem/1 var(--sans); font-stretch: 70%;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.pace input:focus-visible { outline: none; background: rgba(255, 210, 63, .45); }
.pace input[aria-invalid="true"] { border-bottom-color: #c23a2e; }
.pace button {
  padding: .45rem .8rem;
  border: 1.5px solid var(--ink); border-radius: 3px;
  background: var(--paper); color: var(--ink);
  font: 600 .9rem/1 var(--sans);
  cursor: pointer;
}
.pace button:hover { background: var(--signal); }
.pace output { font: 400 .95rem/1.3 var(--serif); min-height: 2.6em; }
.pace output b { font: 700 1.05rem/1 var(--sans); font-stretch: 80%; font-variant-numeric: tabular-nums; }

@container (max-width: 560px) {
  .pace {
    position: static; width: auto; height: auto;
    flex-direction: row; flex-wrap: wrap; justify-content: flex-start; text-align: left;
    gap: .5rem 1rem;
    margin-top: 1.25rem; padding: 1rem 1.1rem;
    border: 1px solid rgba(14, 47, 87, .28);
  }
  .pace__label { flex-basis: 100%; }
  .pace output { flex-basis: 100%; min-height: 0; }
}

/* ---------------------------------------------------------- chi c'è dietro */
.about {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2rem var(--gutter);
  padding: clamp(4.5rem, 10vw, 8rem) max(var(--gutter), (100% - var(--max)) / 2 + var(--gutter));
  background: var(--blue); color: var(--paper);
}
.about h2 {
  font: 760 clamp(2.6rem, 6vw, 5.5rem)/.9 var(--sans);
  font-stretch: 68%;
}
.about__text { display: grid; gap: 1.1rem; max-width: 36rem; font-size: var(--step-1); line-height: 1.45; color: rgba(238, 241, 236, .88); }

/* ------------------------------------------------------------ piede */
.foot {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 1rem 2.5rem;
  padding: 2.5rem max(var(--gutter), (100% - var(--max)) / 2 + var(--gutter));
  background: var(--blue-deep); color: rgba(238, 241, 236, .8);
}
.foot .brand { color: var(--paper); font-size: 1.3rem; }
.foot__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.foot__list a { font: 500 1rem/1.4 var(--sans); text-decoration: none; }
.foot__list a:hover { text-decoration: underline; text-underline-offset: .2em; }
.foot__note { margin-left: auto; font-size: .95rem; }

/* --------------------------------------------------------------- mobile */
@media (max-width: 64rem) {
  .plate__body, .plate--flip .plate__body { grid-template-columns: 1fr; }
  .plate--flip .plate__art { order: 0; }
  .plate__text { max-width: 40rem; }
}
@media (max-width: 52rem) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(18rem, 1fr) auto auto;
    padding-top: 5rem;
  }
  .hero__copy { grid-row: 2; }
  .legend { grid-column: 1; grid-row: 3; align-self: start; min-width: 0; }
  .hero__pins { bottom: auto; height: min(30rem, 52svh); }
  .pin { top: calc(var(--y) * 1.6%); }
  .pin__label { display: none; }
  .pin--unknown { left: 20%; top: 20%; }
  .pin--unknown .pin__label { display: grid; }
  .about { grid-template-columns: 1fr; }
  .foot__note { margin-left: 0; flex-basis: 100%; }
}
/* sui telefoni le tavole si scorrono di lato: il testo resta leggibile */
@media (max-width: 46rem) {
  .plate__art:not(:has(.art-stack)), .art-scroll {
    overflow-x: auto;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
  }
  .plate__art > .art, .art-scroll > .art { width: 46rem; max-width: none; }
  .art-caption { position: sticky; left: 0; max-width: calc(100vw - var(--gutter) * 2); }
}
@media (max-width: 30rem) {
  .facts { gap: 1.25rem 1.25rem; }
  .top__nav a:last-child { display: none; }
}

@media (forced-colors: active) {
  .pin__label { text-shadow: none; }
  .legend { backdrop-filter: none; }
}
.cta:focus-visible { outline-color: var(--ink); }
