/* ---------------------------------------------------------------
   Bici d'epoca: foglio di stile
   Palette presa dalle bici stesse: alluminio, verde inglese,
   rosso smalto per tutto ciò che riguarda il tempo (anni, manici).
---------------------------------------------------------------- */

:root {
  --alluminio: #E2E5DF;
  --carta: #F2F3EE;
  --verde: #0F3A2C;
  --grafite: #55645C;
  --rosso: #B4281F;
  --filo: #BFC6BD;

  --display: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --testo: "Newsreader", Georgia, "Times New Roman", serif;

  --margine: clamp(1rem, 3.2vw, 2.75rem);
  --rail: 15.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--alluminio);
  color: var(--verde);
  font-family: var(--testo);
  font-size: 1.0625rem;
  line-height: 1.55;
}

body.blocca { overflow: hidden; }

button, input, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--rosso);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

/* --------------------------- avviso demo --------------------------- */

.avviso-demo {
  background: var(--verde);
  color: var(--carta);
  font-family: var(--display);
  font-size: .9rem;
  text-align: center;
  padding: .55rem var(--margine);
}

/* ------------------------------ pagina ----------------------------- */

.pagina {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 var(--margine) 3rem;
}

/* ------------------------------ testata ---------------------------- */

.testata {
  padding: clamp(1.75rem, 5vw, 3.5rem) 0 clamp(.75rem, 2vw, 1.25rem);
}

.decal {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-style: italic;
  font-stretch: 125%;
  font-size: clamp(2.6rem, 9.5vw, 8rem);
  line-height: .92;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.sommario {
  margin: 1rem 0 0;
  font-size: 1.2rem;
  color: var(--grafite);
}

/* ------------------------ linea del tempo -------------------------- */

.linea-wrap {
  position: relative;
  padding-top: 2.1rem;
}

.anni-sel {
  position: absolute;
  top: 0;
  right: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  color: var(--rosso);
}

.linea {
  --alt: 64px;
  position: relative;
  height: calc(var(--alt) + 26px);
  margin: 0 8px;
}

/* La finestra chiara tra i due manici */
.finestra {
  position: absolute;
  top: 0;
  height: var(--alt);
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, .5);
  pointer-events: none;
}

.assi {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.assi .base {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--alt);
  height: 2px;
  background: var(--verde);
}

.assi .decade {
  position: absolute;
  top: var(--alt);
  height: 7px;
  width: 1px;
  background: var(--verde);
}

.assi .decade span {
  position: absolute;
  top: 11px;
  left: 0;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  color: var(--grafite);
}

.ruote {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--alt);
  pointer-events: none;
}

.ruota {
  --d: 16px;
  position: absolute;
  width: var(--d);
  height: var(--d);
  margin-left: calc(var(--d) / -2);
  border-radius: 50%;
  border: 1.5px solid var(--filo);
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}

.ruota.attiva {
  border: 2px solid var(--verde);
  background: radial-gradient(circle, var(--verde) 2px, transparent 2.6px);
}

.ruota:hover {
  border-color: var(--rosso);
  background: radial-gradient(circle, var(--rosso) 2px, transparent 2.6px);
}

.ruote.intro .ruota {
  animation: arriva .55s cubic-bezier(.2, .7, .2, 1) both;
  animation-delay: calc(var(--k) * 16ms);
}

@keyframes arriva {
  from { opacity: 0; transform: translateX(-26px); }
  to   { opacity: 1; transform: none; }
}

/* I due manici sono range nativi sovrapposti: tastiera e touch funzionano da soli */

.manico {
  --larg: 16px;
  position: absolute;
  top: 0;
  left: -8px;
  width: calc(100% + 16px);
  height: var(--alt);
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.manico::-webkit-slider-runnable-track {
  height: var(--alt);
  background: transparent;
  border: 0;
}

.manico::-moz-range-track {
  height: var(--alt);
  background: transparent;
  border: 0;
}

.manico::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  cursor: ew-resize;
  width: var(--larg);
  height: var(--alt);
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(var(--rosso), var(--rosso)) 50% 0 / 12px 7px no-repeat,
    linear-gradient(var(--rosso), var(--rosso)) 50% 0 / 2px 100% no-repeat;
}

.manico::-moz-range-thumb {
  pointer-events: auto;
  cursor: ew-resize;
  width: var(--larg);
  height: var(--alt);
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(var(--rosso), var(--rosso)) 50% 0 / 12px 7px no-repeat,
    linear-gradient(var(--rosso), var(--rosso)) 50% 0 / 2px 100% no-repeat;
}

.manico:focus-visible { outline: none; }
.manico:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--verde); outline-offset: -2px; }
.manico:focus-visible::-moz-range-thumb { outline: 2px solid var(--verde); outline-offset: -2px; }

/* ----------------- filetti: la doppia riga dei telai ---------------- */

.filetti {
  height: 8px;
  margin: .5rem 0 clamp(1.5rem, 3vw, 2.25rem);
  background:
    linear-gradient(var(--verde), var(--verde)) 0 0 / 100% 3px no-repeat,
    linear-gradient(var(--rosso), var(--rosso)) 0 7px / 100% 1px no-repeat;
}

/* ------------------------------- corpo ----------------------------- */

.corpo {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}

/* -------------------------------- rail ----------------------------- */

.rail {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding-right: .5rem;
  scrollbar-width: thin;
}

.rail summary {
  display: none;
}

.gruppo {
  border: 0;
  margin: 0 0 1.25rem;
  padding: 0;
  min-width: 0;
}

.gruppo legend {
  padding: 0;
  margin-bottom: .6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
}

.opzione {
  display: grid;
  grid-template-columns: 1.1rem 1fr auto;
  align-items: center;
  gap: .6rem;
  padding: .32rem 0;
  cursor: pointer;
  font-family: var(--display);
  font-size: .95rem;
  line-height: 1.25;
}

.opzione input {
  -webkit-appearance: none;
  appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  border: 1.5px solid var(--grafite);
  background: transparent;
  display: grid;
  place-content: center;
  cursor: pointer;
}

.opzione input:checked {
  background: var(--verde);
  border-color: var(--verde);
}

.opzione input:checked::after {
  content: "";
  width: .55rem;
  height: .3rem;
  border-left: 2px solid var(--carta);
  border-bottom: 2px solid var(--carta);
  transform: translateY(-1px) rotate(-45deg);
}

.opzione .n {
  font-variant-numeric: tabular-nums;
  color: var(--grafite);
  font-size: .85rem;
}

.opzione.zero:not(.scelta) .nome,
.opzione.zero:not(.scelta) .n {
  color: var(--filo);
}

.opzione:hover .nome { text-decoration: underline; text-underline-offset: 3px; }

.marche {
  display: block;
}

/* ------------------------------- bottoni --------------------------- */

.tasto {
  font-family: var(--display);
  font-weight: 600;
  font-size: .92rem;
  line-height: 1.2;
  padding: .6rem 1.05rem;
  background: transparent;
  color: var(--verde);
  border: 1.5px solid var(--verde);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}

.tasto:hover {
  background: var(--verde);
  color: var(--carta);
}

.tasto-testo {
  border-color: transparent;
  padding-left: 0;
  padding-right: 0;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.tasto-testo:hover {
  background: transparent;
  color: var(--rosso);
}

#azzera { margin-top: .75rem; }

/* ------------------------------- barra ----------------------------- */

.barra {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem 2rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

.cerca {
  position: relative;
  flex: 1 1 22rem;
  color: var(--grafite);
}

.cerca svg {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.cerca input {
  width: 100%;
  padding: .55rem 0 .55rem 2rem;
  font-family: var(--display);
  font-size: 1.3rem;
  color: var(--verde);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--verde);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

.cerca input::placeholder { color: var(--grafite); opacity: .85; }
.cerca input:focus-visible { outline: none; border-bottom-color: var(--rosso); }
.cerca:focus-within { color: var(--rosso); }

.ordina {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  font-family: var(--display);
  font-size: .85rem;
  color: var(--grafite);
}

.ordina select {
  padding: .35rem 1.6rem .35rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--verde);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230F3A2C' stroke-width='2'/%3E%3C/svg%3E") right center no-repeat;
  border: 0;
  border-bottom: 2px solid var(--verde);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.conteggio {
  margin: 0 0 1.4rem;
  font-family: var(--display);
  font-size: .95rem;
  color: var(--grafite);
}

/* ------------------------------ griglia ---------------------------- */

.griglia {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 2.4rem 1.6rem;
}

.scheda a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.scheda .foto {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--carta);
  overflow: hidden;
}

.scheda .foto img,
.scheda .foto svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scheda .foto .alt {
  opacity: 0;
  transition: opacity .3s;
}

.scheda a:hover .foto .alt,
.scheda a:focus-visible .foto .alt {
  opacity: 1;
}

.scheda .riga {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  margin-top: .7rem;
}

.scheda .marca {
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 112%;
  font-size: 1.1rem;
  line-height: 1.2;
}

.scheda .marca.manca,
.scheda .anno.manca {
  font-weight: 500;
  font-stretch: 100%;
  color: var(--grafite);
}

.scheda .anno {
  flex: none;
  max-width: 55%;
  text-align: right;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--rosso);
}

.scheda .anno.manca { font-size: .85rem; font-weight: 500; }

.scheda .modello {
  margin: .1rem 0 0;
  color: var(--grafite);
  line-height: 1.35;
}

.scheda a:hover .marca { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }

.vuoto {
  padding: 3rem 0;
  max-width: 34rem;
}

.vuoto p { margin: 0 0 1rem; }
.vuoto-titolo {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.25;
}

/* ------------------------------- piede ----------------------------- */

.piede {
  margin-top: 4rem;
  font-family: var(--display);
  font-size: .85rem;
  color: var(--grafite);
}

/* ----------------------------- dettaglio --------------------------- */

dialog {
  width: min(1240px, 96vw);
  max-width: none;
  max-height: 94vh;
  padding: 0;
  border: 0;
  background: var(--carta);
  color: var(--verde);
  overflow: auto;
}

dialog[open] { animation: apri .2s ease-out; }

dialog::backdrop { background: rgba(15, 58, 44, .6); }

@keyframes apri {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.det {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
}

.det-foto { background: var(--alluminio); min-width: 0; }

.det-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: min(68vh, 760px);
  background: var(--alluminio);
}

.det-stage img,
.det-stage svg.segnaposto {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.det-stage svg.segnaposto { width: 70%; }

.freccia {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(242, 243, 238, .92);
  color: var(--verde);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}

.freccia:hover { background: var(--verde); color: var(--carta); }
.freccia.prec { left: .75rem; }
.freccia.succ { right: .75rem; }

.det-thumbs {
  display: flex;
  gap: .5rem;
  padding: .75rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.det-thumbs button {
  flex: none;
  width: 5.5rem;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: var(--carta);
  cursor: pointer;
  opacity: .72;
  outline-offset: 2px;
}

.det-thumbs button[aria-current="true"] {
  opacity: 1;
  outline: 2px solid var(--rosso);
}

.det-thumbs button:hover { opacity: 1; }

.det-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.det-testo {
  position: relative;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chiudi {
  align-self: flex-end;
  margin-bottom: 1rem;
}

.det-marca {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-style: italic;
  font-stretch: 125%;
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  line-height: 1;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}

.det-marca.manca {
  font-size: 1.5rem;
  color: var(--grafite);
}

.det-modello {
  margin: .6rem 0 0;
  font-size: 1.45rem;
  line-height: 1.25;
}

.det-anno {
  margin: .5rem 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--rosso);
  font-variant-numeric: tabular-nums;
}

.dati {
  margin: 1.5rem 0 0;
  border-top: 2px solid var(--verde);
}

.dati > div {
  display: grid;
  grid-template-columns: minmax(6.5rem, 9rem) 1fr;
  gap: 1rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--filo);
}

.dati dt {
  font-family: var(--display);
  font-size: .88rem;
  line-height: 1.45;
  color: var(--grafite);
}

.dati dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.det-note {
  margin: 1.5rem 0 0;
  max-width: 62ch;
  white-space: pre-line;
}

.det-nav {
  margin-top: auto;
  padding-top: 2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

/* ---------------------------- schermi piccoli ---------------------- */

@media (max-width: 900px) {
  .corpo {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .rail {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
    margin-bottom: 1.5rem;
  }

  .rail details {
    border-top: 1.5px solid var(--verde);
    border-bottom: 1.5px solid var(--verde);
    padding: 0 0 .25rem;
  }

  .rail summary {
    display: block;
    list-style: none;
    cursor: pointer;
    padding: .8rem 0;
    font-family: var(--display);
    font-weight: 700;
  }

  .rail summary::-webkit-details-marker { display: none; }
  .rail summary::after { content: "Mostra"; float: right; font-weight: 500; color: var(--grafite); }
  .rail details[open] summary::after { content: "Nascondi"; }

  .marche {
    columns: 2;
    column-gap: 1.5rem;
  }

  .marche .opzione { break-inside: avoid; }

  .det {
    grid-template-columns: minmax(0, 1fr);
  }

  .det-stage { height: min(52vh, 480px); }

  dialog { width: 100vw; max-height: 100vh; height: 100vh; }
}

@media (max-width: 520px) {
  .griglia { grid-template-columns: minmax(0, 1fr); }
  .dati > div { grid-template-columns: 1fr; gap: .1rem; }
  .anni-sel { font-size: 1rem; }
}

/* ------------------- navigazione, piede, pagine di testo ------------- */

.salta {
  position: absolute;
  left: .75rem;
  top: -4rem;
  z-index: 10;
  padding: .6rem 1rem;
  background: var(--verde);
  color: var(--carta);
  font-family: var(--display);
  font-weight: 600;
  text-decoration: none;
}

.salta:focus { top: .75rem; }

.menu {
  display: flex;
  gap: 1.75rem;
  padding-top: 1.25rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: .98rem;
}

.menu a {
  color: var(--verde);
  text-decoration: none;
  padding: .35rem 0;
  border-bottom: 2px solid transparent;
}

.menu a:hover { border-bottom-color: var(--filo); }
.menu a[aria-current="page"] { border-bottom-color: var(--rosso); }

main:focus { outline: none; }

.pie-sito {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--filo);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 2rem;
  font-family: var(--display);
  font-size: .88rem;
  color: var(--grafite);
}

.pie-sito p { margin: 0; }
.pie-sito .piede { margin: 0; }
.pie-sito a { color: inherit; text-underline-offset: 3px; }
.pie-sito a:hover { color: var(--rosso); }

.titolo-pagina {
  font-size: clamp(2.4rem, 7vw, 5.5rem);
}

.chi {
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}

.ritratto {
  margin: 0;
  position: sticky;
  top: 1rem;
}

.ritratto img,
.foto-testo img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--carta);
}

.foto-testo { margin: 1.75rem 0 1.5rem; }

.ritratto figcaption,
.foto-testo figcaption {
  margin-top: .5rem;
  font-family: var(--display);
  font-size: .88rem;
  line-height: 1.45;
  color: var(--grafite);
}

.testo {
  max-width: 40rem;
  font-size: 1.2rem;
  line-height: 1.65;
}

.testo p { margin: 0 0 1.1rem; }

.testo h2 {
  margin: 2.25rem 0 .6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.25;
}

.testo .attacco {
  font-size: 1.5rem;
  line-height: 1.45;
}

.testo a {
  color: var(--verde);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

.testo a:hover { color: var(--rosso); }
.testo a.tasto { text-decoration: none; display: inline-block; }
.testo a.tasto:hover { color: var(--carta); }

.testo .fonte {
  margin-top: 2rem;
  font-family: var(--display);
  font-size: .92rem;
  line-height: 1.5;
  color: var(--grafite);
}

@media (max-width: 700px) {
  .chi { grid-template-columns: minmax(0, 1fr); }
  .ritratto { position: static; max-width: 18rem; }
  .testo { font-size: 1.1rem; }
  .testo .attacco { font-size: 1.3rem; }
}

@media print {
  .menu, .salta, .rail, .barra, .linea-wrap, .filetti, .avviso-demo { display: none !important; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
