/* =====================================================================
   COSA FARE E VEDERE A RICCIONE — «Quattro capitoli a due strati» (06/10/2026)
   Indice in grande; poi ogni capitolo è una foto a tutto schermo che resta
   ferma (titolo e frase grande sopra) e un «foglio» del colore del capitolo
   che sale scorrendo e la copre: nastro dei luoghi, testo, foto con maschere
   e parallasse. Nei borghi una galleria orizzontale fissata. Foto Shutterstock.
   ===================================================================== */

/* ---------- indice ---------- */
.rindex { background: var(--warm); padding-bottom: clamp(5rem, 10vw, 8rem); }
.rindex__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rindex__list li { border-bottom: 1px solid var(--line); }
.rindex__list a { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto; align-items: center; gap: 1.5rem;
  padding-block: clamp(1.3rem, 2.4vw, 2rem); color: var(--ink); transition: color .45s var(--ease), padding .6s var(--ease); }
.rindex__n { font: 500 .74rem/1 var(--font-display); letter-spacing: .24em; color: var(--sand); }
.rindex__t { font: 200 clamp(1.9rem, 4.6vw, 4.4rem)/1.05 var(--font-display); letter-spacing: -.03em; }
.rindex__list i { font-size: clamp(1.4rem, 2.4vw, 2.2rem); color: var(--sand); transition: transform .5s var(--ease), color .45s var(--ease); }
.rindex__list a:hover { color: var(--teal); padding-left: 1.2rem; }
.rindex__list a:hover i { transform: translate(4px, 4px); color: var(--teal); }

/* ---------- capitoli a due strati ---------- */
.rc { --bg: var(--teal-deep); --fg: var(--white); --num: var(--sand); --txt: rgba(255,255,255,.84);
  position: relative; background: var(--bg); color: var(--fg); view-timeline: --rc block; scroll-margin-top: 0; }
.rc--sand { --bg: var(--sand-pale); --fg: var(--ink); --num: var(--sand); --txt: var(--grey); }
.rc--ink { --bg: #1d2628; --fg: var(--white); --num: var(--sand); --txt: rgba(255,255,255,.78); }
.rc--teal { --bg: var(--teal); --fg: var(--white); --num: var(--sand-pale); --txt: rgba(255,255,255,.9); }

/* strato sotto: la foto ferma, con il titolo */
.rc__stage { position: sticky; top: 0; height: 100vh; height: 100svh; min-height: 600px; overflow: hidden; isolation: isolate;
  display: flex; align-items: flex-end; color: var(--white); }
.rc__bg { position: absolute; inset: 0; z-index: -2; }
.rc__bg img { width: 100%; height: 100%; object-fit: cover; }
.rc__stage::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(15,58,65,.45) 0%, rgba(15,58,65,0) 30%, rgba(15,58,65,.1) 55%, rgba(12,30,34,.82) 100%); }
.rc__head { padding-bottom: clamp(3.5rem, 12vh, 8rem); }
.rc__num { font: 200 clamp(4rem, 9vw, 9rem)/.8 var(--font-display); letter-spacing: -.06em; color: var(--sand); margin-bottom: clamp(1rem, 2vw, 1.6rem); }
.rc__title { font: 200 clamp(2.8rem, 7vw, 7rem)/.95 var(--font-display); letter-spacing: -.04em; max-width: 13ch; }
.rc__big { margin-top: 1.6rem; max-width: 30ch; font: 300 clamp(1.25rem, 2vw, 1.85rem)/1.35 var(--font-display); color: rgba(255,255,255,.92); }

/* strato sopra: il foglio che sale e copre la foto */
/* margin-top: mezzo schermo in cui la foto resta ferma con il titolo ben leggibile, prima che arrivi il foglio */
.rc__sheet { margin-top: 55vh; position: relative; z-index: 2; background: var(--bg); color: var(--fg); padding-bottom: clamp(5rem, 10vw, 9rem);
  box-shadow: 0 -40px 80px -30px rgba(10,30,34,.55); }
.rc__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 2rem; align-items: start; padding-top: clamp(4rem, 8vw, 7rem); }
.rc__text { grid-column: 1 / 6; font: 300 clamp(1.15rem, 1.6vw, 1.45rem)/1.6 var(--font-display); color: var(--txt); position: sticky; top: 7rem; }
.rc__photos { grid-column: 7 / 13; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 2vw, 2rem); align-items: start; }
.rc__photos:empty { display: none; }
.rc__grid:has(.rc__photos:empty) .rc__text { grid-column: 1 / 9; position: static; font-size: clamp(1.2rem, 2vw, 1.8rem); }
.rc__ph figure { margin: 0; overflow: hidden; background: var(--teal); }
.rc__ph img { width: 100%; height: 100%; object-fit: cover; max-width: none; }
.rc__ph--tall figure { aspect-ratio: 3 / 4; }
.rc__ph--low { margin-top: clamp(6rem, 16vw, 14rem); }
.rc__ph--low figure { aspect-ratio: 4 / 5; }
.rc__ph--wide { grid-column: 1 / -1; }
.rc__ph--wide figure { aspect-ratio: 16 / 10; }

/* nastro dei luoghi, in cima al foglio */
.rc__tape { overflow: hidden; padding-block: clamp(1.4rem, 3vh, 2.2rem); border-bottom: 1px solid color-mix(in srgb, var(--fg) 16%, transparent); }
.rc__half { display: flex; align-items: center; flex: none; }
.rc__tape span { padding-inline: clamp(1.2rem, 2.6vw, 2.6rem); white-space: nowrap; font: 200 clamp(2rem, 4.4vw, 4.2rem)/1 var(--font-display); letter-spacing: -.025em; color: var(--fg); }
.rc__tape i { flex: none; width: .6rem; aspect-ratio: 1; border-radius: 50%; background: var(--num); }

/* terra di motori: linee di velocità sopra la foto del circuito */
.rc__speed { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.rc__speed i { position: absolute; left: 0; height: 1px; width: 40vw; background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.7)); }
.rc__speed i:nth-child(1) { top: 22%; } .rc__speed i:nth-child(2) { top: 38%; width: 60vw; }
.rc__speed i:nth-child(3) { top: 51%; width: 28vw; } .rc__speed i:nth-child(4) { top: 66%; width: 52vw; } .rc__speed i:nth-child(5) { top: 79%; width: 34vw; }

/* ---------- i borghi: galleria orizzontale fissata ---------- */
.rb { margin-top: clamp(4rem, 8vw, 7rem); }
.rb__track { gap: clamp(1.5rem, 3vw, 3rem); padding: clamp(2rem, 6vh, 4rem) max(1.5rem, (100vw - var(--wrap)) / 2); align-items: flex-start; }
.rb__card { flex: none; width: clamp(18rem, 34vw, 32rem); }
.rb__card:nth-child(even) { margin-top: clamp(3rem, 9vh, 6rem); }
.rb__img { position: relative; margin: 0; aspect-ratio: 4 / 5; overflow: hidden; background: var(--teal-deep); }
.rb__img img { position: absolute; top: 0; left: -8%; width: 116%; max-width: none; height: 100%; object-fit: cover; }
.rb__img--type { display: grid; place-items: center; background: var(--teal-deep); }
.rb__img--type span { font: 200 clamp(2.4rem, 4.4vw, 4rem)/1 var(--font-display); letter-spacing: -.03em; color: var(--sand-pale); font-style: italic; }
.rb__n { margin-top: 1.4rem; font: 500 .74rem/1 var(--font-display); letter-spacing: .24em; color: var(--sand-pale); }
.rb__name { margin-top: .7rem; font: 200 clamp(1.9rem, 3vw, 2.8rem)/1.05 var(--font-display); letter-spacing: -.02em; }
.rb__line { margin-top: .6rem; max-width: 30ch; font-size: 1rem; line-height: 1.6; color: var(--txt); }

/* ---------- panorama prima della chiusura ---------- */
.rpan { position: relative; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; overflow: hidden; isolation: isolate; color: var(--white); }
.rpan__bg { position: absolute; inset: -14% 0; z-index: -2; }
.rpan__bg img { width: 100%; height: 100%; object-fit: cover; max-width: none; }
.rpan::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(15,58,65,.25), rgba(15,58,65,.55)); }
.rpan__text { max-width: 24ch; margin-inline: auto; text-align: center; font: 300 clamp(2rem, 4.4vw, 4.2rem)/1.12 var(--font-display); letter-spacing: -.02em; }

@media (prefers-reduced-motion: no-preference) {
  .rc__tape .marquee-track { animation: pmarqLoop 46s linear infinite; }
  .rc__tape--fast .marquee-track { animation-duration: 18s; }
  .rc__speed i { animation: rchSpeed 2.6s cubic-bezier(.6, 0, .3, 1) infinite; transform: translateX(-70vw); }
  .rc__speed i:nth-child(2) { animation-delay: .5s; } .rc__speed i:nth-child(3) { animation-delay: 1.1s; }
  .rc__speed i:nth-child(4) { animation-delay: 1.6s; } .rc__speed i:nth-child(5) { animation-delay: .8s; }
  @keyframes rchSpeed { to { transform: translateX(170vw); } }
  @supports (animation-timeline: view()) {
    /* la foto del capitolo entra con uno zoom che rientra, poi scurisce mentre il foglio la copre */
    .rc__bg img { animation: rcZoom linear both; animation-timeline: --rc; animation-range: entry 0% entry 100%; }
    @keyframes rcZoom { from { transform: scale(1.22); } to { transform: scale(1); } }
    .rc__bg { animation: rcDim linear both; animation-timeline: --rc; animation-range: contain 0% contain 40%; }
    @keyframes rcDim { to { filter: brightness(.55) saturate(.85); } }
    .rc__head { animation: rcHead linear both; animation-timeline: --rc; animation-range: contain 0% contain 35%; }
    @keyframes rcHead { to { transform: translateY(-10vh); } }
  }
}

@media (max-width: 899px) {
  .rindex__list a { grid-template-columns: 2.6rem minmax(0, 1fr) auto; gap: 1rem; }
  .rc__text, .rc__photos, .rc__grid:has(.rc__photos:empty) .rc__text { grid-column: 1 / -1; position: static; }
  .rc__photos { margin-top: 2.5rem; }
  .rc__num { font-size: clamp(4rem, 22vw, 6.5rem); }
  .rc__ph--low { margin-top: 4rem; }
  .rb__card { width: 78vw; }
  .rb__card:nth-child(even) { margin-top: 0; }
}
