:root {
  --paper: #f3efe8;
  --paper-2: #e9e3d9;
  --ink: #17161a;
  --ink-soft: #6c6760;
  --accent: #1f5f6b;
  --card-w: clamp(132px, min(26vw, 33vh), 270px);
  --card-h: calc(var(--card-w) * 1.34);
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.4vh, 22px);
  padding: clamp(46px, 9vh, 80px) 0 clamp(16px, 4vh, 40px);
  overflow: hidden;
  background:
    radial-gradient(70% 55% at 50% 48%, #fbf9f5 0%, rgba(251, 249, 245, 0) 70%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  user-select: none;
  -webkit-user-select: none;
}

/* a whisper of paper grain */
.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .32;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.45  0 0 0 0 0.4  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.top {
  position: absolute;
  top: clamp(12px, 3vh, 26px);
  left: clamp(14px, 4vw, 40px);
  right: clamp(14px, 4vw, 40px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: clamp(11px, 1.6vh, 13px);
}

.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -.01em; font-size: clamp(12px, 1.9vh, 15px); }
.brand__mark { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; }

.from {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-soft);
  padding: 6px 11px 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .55);
  box-shadow: inset 0 0 0 1px rgba(23, 22, 26, .07), 0 1px 2px rgba(23, 22, 26, .05);
}
.from svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; }

.title {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 420;
  font-size: clamp(22px, min(5.4vw, 6.4vh), 46px);
  letter-spacing: -.02em;
  line-height: 1;
  overflow: hidden;
  padding-bottom: .08em;
  /* il corsivo di «next?» sporge a destra della sua scatola: un margine laterale dentro il ritaglio, che non sposta niente */
  padding-inline: .16em;
  margin-inline: -.16em;
}
.title__line { display: inline-block; }
.title em { font-style: italic; color: var(--accent); font-weight: 380; }

/* ---------------------------------------------------------------- the deck */
.deck {
  position: relative;
  width: 100%;
  height: calc(var(--card-h) + 26px);
  perspective: 1100px;
  perspective-origin: 50% 45%;
  cursor: grab;
  touch-action: pan-y;
  outline: none;
  flex: none;
}
.deck.is-dragging { cursor: grabbing; }

.card {
  position: absolute;
  left: 50%;
  top: 6px;
  width: var(--card-w);
  height: var(--card-h);
  margin-left: calc(var(--card-w) / -2);
  border-radius: calc(var(--card-w) * .085);
  overflow: hidden;
  transform-style: preserve-3d;
  will-change: transform;
  background: #2a2a2d;
  box-shadow:
    0 1px 1px rgba(23, 22, 26, .08),
    0 6px 12px -4px rgba(23, 22, 26, .18),
    0 22px 40px -14px rgba(23, 22, 26, .32);
}

/* 1px edge that catches the light */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.card__photo {
  position: absolute;
  inset: 0 -22%;
  will-change: transform;
}
.card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, 50% 50%);
  display: block;
  pointer-events: none;
}

/* a darkening at the foot for the text, and a soft vignette */
.card__photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 12, 16, .18) 0%, rgba(10, 12, 16, 0) 26%, rgba(10, 12, 16, 0) 55%, rgba(10, 12, 16, .62) 100%);
}

.card__sheen {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, .26) 48%, rgba(255, 255, 255, 0) 58%);
  mix-blend-mode: soft-light;
  will-change: transform, opacity;
}

.card__temp {
  position: absolute;
  top: calc(var(--card-w) * .06);
  right: calc(var(--card-w) * .06);
  font-size: clamp(10px, calc(var(--card-w) * .052), 13px);
  font-weight: 600;
  color: #fff;
  padding: .32em .7em;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
}

.card__foot {
  position: absolute;
  left: calc(var(--card-w) * .07);
  right: calc(var(--card-w) * .07);
  bottom: calc(var(--card-w) * .065);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: #fff;
  font-size: clamp(10px, calc(var(--card-w) * .05), 13px);
}
.card__region { font-weight: 600; letter-spacing: .01em; }
.card__nights { opacity: .78; }

/* ---------------------------------------------------------------- the info row */
.info {
  width: min(calc(var(--card-w) * 2.1), 88vw);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex: none;
}

.info__left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.info__name {
  display: block;
  position: relative;
  height: 1.08em;
  overflow: hidden;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 460;
  font-size: clamp(20px, min(4.4vw, 5vh), 36px);
  letter-spacing: -.02em;
  line-height: 1.08;
  white-space: nowrap;
  width: min(calc(var(--card-w) * 1.45), 56vw);
}
.info__word { position: absolute; left: 0; top: 0; display: inline-block; white-space: nowrap; }
.info__word .ch { display: inline-block; will-change: transform; }

.info__time {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-soft);
  font-size: clamp(11px, 1.7vh, 13px);
}
.info__time svg { width: 13px; height: 13px; fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linejoin: round; }

.info__right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.info__from { font-size: clamp(10px, 1.5vh, 12px); color: var(--ink-soft); letter-spacing: .04em; text-transform: uppercase; }

.fare {
  display: inline-flex;
  align-items: baseline;
  font-weight: 640;
  font-variation-settings: 'wdth' 92;
  font-size: clamp(20px, min(4.4vw, 5vh), 34px);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.fare__cur { font-size: .62em; margin-right: .08em; color: var(--accent); font-weight: 600; }
.fare__digit { display: inline-block; height: 1em; overflow: hidden; }
.fare__strip { display: flex; flex-direction: column; will-change: transform; }
.fare__strip span { height: 1em; line-height: 1; display: block; text-align: center; }

/* ---------------------------------------------------------------- the pager: a thin line with a sliding segment */
.pager {
  position: relative;
  width: clamp(70px, 14vw, 120px);
  height: 2px;
  border-radius: 2px;
  background: rgba(23, 22, 26, .12);
  flex: none;
}
.pager__thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 20%;
  border-radius: 2px;
  background: var(--ink);
  will-change: transform;
}

/* ---------------------------------------------------------------- the drawn pointer of the autopilot */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  z-index: 20;
  pointer-events: none;
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25));
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .card__sheen { display: none; }
}
