/* Where to eat in Bologna: the page of Forkful Guides, a made-up food guide. A warm paper page, a quiet drawn map of
   the old town in a card with a 1px edge and layered shadows, six pins, one bubble card that travels between them
   with a real photo of the dish, and the list of the six places beside the map (under it on a phone). One accent,
   Bologna red, for the pin in use and the score. */
:root {
  --fondo: #f3efe7;        /* the page */
  --carta: #fbf8f2;        /* the paper of the map */
  --card: #ffffff;         /* the bubble card and the lit row */
  --inchiostro: #1c1915;   /* the words */
  --tenue: #8a8278;        /* the small words and the street names */
  --linea: rgba(28, 25, 21, 0.09); /* the 1px edges */
  --via: #e6ddcd;          /* the main streets */
  --vicolo: #ede6da;       /* the small streets */
  --portico: #c4b9a6;      /* the dashed edge of the porticoes */
  --viale: #e1d7c6;        /* the ring road where the walls stood */
  --verde: #dfe2cc;        /* the gardens */
  --acqua: #d3dfdf;        /* the canal */
  --accento: #c2462b;      /* Bologna red: the pin in use, the score */
  --bolla-l: 236px;        /* the width of the bubble card (the script reads it) */
}

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

html, body { height: 100%; overflow: hidden; }

body {
  background:
    radial-gradient(90% 70% at 12% -10%, #fbf8f2 0%, rgba(251, 248, 242, 0) 60%),
    radial-gradient(70% 60% at 100% 110%, rgba(194, 70, 43, 0.05), rgba(194, 70, 43, 0) 70%),
    var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* the fine grain over the whole page, so the paper is never flat */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: var(--grana);
  opacity: 0.05;
  mix-blend-mode: multiply;
}

.stage {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.6vh, 22px);
  padding: clamp(8px, 2.4vmin, 24px);
  overflow: hidden;
}

/* ---- the head of the page ---- */
.testa { width: 100%; max-width: 960px; display: grid; gap: 4px; }
.marchio {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 640; font-stretch: 112%; letter-spacing: 0.01em; color: var(--inchiostro);
}
.marchio__segno { width: 15px; height: 15px; fill: none; stroke: var(--accento); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.titolo {
  font-size: clamp(19px, min(4.2vw, 5vh), 34px); font-weight: 560; font-stretch: 92%;
  letter-spacing: -0.025em; line-height: 1.04;
}
.titolo em { font-style: normal; font-weight: 720; font-stretch: 118%; color: var(--accento); }
.sottotitolo { font-size: 12.5px; color: var(--tenue); }

/* ---- the map and the list ---- */
.guida {
  width: 100%; max-width: 960px;
  display: grid;
  grid-template-columns: auto minmax(200px, 250px);
  gap: clamp(14px, 2.4vw, 28px);
  align-items: start;
  justify-content: center;
}

.mappa {
  position: relative;
  width: min(680px, 60vw, calc((100vh - 170px) * 1.3636));
  aspect-ratio: 600 / 440;
  border-radius: 20px;
  background: var(--carta);
  border: 1px solid var(--linea);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 2px rgba(40, 30, 20, 0.05),
    0 8px 18px -10px rgba(60, 40, 20, 0.14),
    0 30px 60px -30px rgba(60, 40, 20, 0.26);
  touch-action: manipulation;
}
.mappa__disegno {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border-radius: inherit; overflow: hidden; display: block;
}
.m-fuori path { fill: none; stroke: var(--vicolo); stroke-width: 3; stroke-linecap: round; }
.m-canale { fill: none; stroke: var(--acqua); stroke-width: 4; stroke-linecap: round; }
.m-viale { fill: none; stroke: var(--viale); stroke-width: 6; opacity: 0.8; }
.m-viale--fine { stroke: #d5cab7; stroke-width: 0.7; stroke-dasharray: 2 3; }
.m-verde { fill: var(--verde); }
.m-verde--chiaro { opacity: 0.7; }
.m-vicoli path { fill: none; stroke: var(--vicolo); stroke-width: 2.4; stroke-linecap: round; }
.m-portici path { fill: none; stroke: var(--portico); stroke-width: 0.7; stroke-dasharray: 1.2 2.4; stroke-linecap: round; }
.m-vie path { fill: none; stroke: var(--via); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.m-piazza { fill: #efe7d9; stroke: #d6ccba; stroke-width: 0.7; }
.m-piazza--segno { stroke: none; }
.m-tratto { stroke: #dcd2c1; stroke-width: 0.8; }
.m-torre { fill: #fbf8f2; stroke: #a99d89; stroke-width: 0.9; }
.m-nomi text {
  font-family: inherit; font-size: 7.4px; font-weight: 500; font-stretch: 88%; letter-spacing: 0.05em;
  fill: #a59b8d;
}
.m-nomi .m-nomi--verde { fill: #98a07c; }
.m-nomi .m-nomi--acqua { fill: #8fa5a6; }

/* the pins: the outer element is placed by the CSS, the body is moved by the script, the shadow stays on the ground */
.segnaposti { position: absolute; inset: 0; }
.pin {
  position: absolute;
  width: 30px; height: 40px;
  margin: -40px 0 0 -15px;
  border: 0; background: none; padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pin:focus-visible { outline: none; }
.pin:focus-visible .pin__forma { stroke: var(--inchiostro); stroke-width: 1.6; }
.pin__ombra {
  position: absolute; left: 50%; bottom: -3px;
  width: 14px; height: 5px; margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(40, 25, 15, 0.38), rgba(40, 25, 15, 0));
}
.pin__corpo { position: absolute; inset: 0; transform-origin: 50% 100%; }
.pin__corpo svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 1px 1px rgba(40, 25, 15, 0.16)); }
.pin__forma { fill: var(--card); stroke: rgba(28, 25, 21, 0.22); stroke-width: 1; transition: fill 0.35s ease, stroke 0.35s ease; }
.pin__luce { fill: none; stroke: rgba(255, 255, 255, 0.85); stroke-width: 1; transition: opacity 0.35s ease; opacity: 0; }
.pin__segno { fill: none; stroke: var(--accento); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.35s ease; }
.pin.attivo .pin__forma { fill: var(--accento); stroke: #9e331d; }
.pin.attivo .pin__luce { opacity: 0.55; }
.pin.attivo .pin__segno { stroke: #fff; }
.pin.attivo { z-index: 2; }

/* the bubble card: the outer element travels (script), the body opens and closes (script) */
.bolla {
  position: absolute; left: 0; top: 0; z-index: 5;
  width: var(--bolla-l);
  pointer-events: none;
  visibility: hidden;
}
.bolla__corpo {
  position: relative;
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--linea);
  padding: 5px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 1px 2px rgba(40, 30, 20, 0.08),
    0 6px 14px -6px rgba(40, 30, 20, 0.18),
    0 24px 44px -18px rgba(40, 30, 20, 0.34);
}
.bolla__foto {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  background: #e8e1d4;
  isolation: isolate;
}
.bolla__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
  transform-origin: 50% 50%;
}
/* the grain and a soft inner edge on the photo, so the six photos read as one set */
.bolla__foto::before {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background-image: var(--grana);
  mix-blend-mode: overlay; opacity: var(--grana-forza, 0.28);
}
.bolla__foto::after {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), inset 0 -36px 40px -30px rgba(20, 12, 6, 0.5);
}
/* the soft edge of the curtain, travelling with it */
.bolla__bordo {
  position: absolute; top: 0; bottom: 0; left: 0; width: 34px; margin-left: -34px; z-index: 2;
  background: linear-gradient(90deg, rgba(255, 250, 242, 0), rgba(255, 250, 242, 0.55) 80%, rgba(255, 255, 255, 0.9));
  opacity: 0; pointer-events: none;
}
.bolla__bordo.da-sinistra { margin-left: 0; transform: scaleX(-1); }
.bolla__piatto {
  position: absolute; left: 7px; bottom: 7px; z-index: 4;
  display: inline-flex; overflow: hidden;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.005em; color: #fff;
  padding: 3px 8px 3px; border-radius: 999px;
  background: rgba(30, 20, 12, 0.36);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.bolla__testo { padding: 8px 7px 4px; display: grid; gap: 2px; }
.bolla__nome { font-size: 14px; font-weight: 640; letter-spacing: -0.01em; line-height: 1.2; }
.bolla__dove { font-size: 11px; color: var(--tenue); line-height: 1.3; }
.bolla__dati {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 5px; padding-top: 6px; border-top: 1px solid var(--linea);
  font-size: 11.5px; font-weight: 600;
}
.voto { display: inline-flex; align-items: center; gap: 4px; color: var(--accento); }
.voto svg { width: 12px; height: 12px; fill: var(--accento); }
.prezzo { color: var(--inchiostro); font-weight: 520; }

/* a line of words in a window, so the old words can leave upwards and the new ones rise */
.finestra { display: inline-grid; overflow: hidden; vertical-align: bottom; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.finestra > .riga, .bolla__piatto > .riga { grid-area: 1 / 1; display: block; white-space: nowrap; }

.bolla__coda {
  position: absolute; left: 0; top: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  background: var(--card);
  border: 1px solid var(--linea);
  transform: rotate(45deg);
  border-radius: 2px;
}
/* the tail is a turned square half inside the card: only the two edges that stick out are drawn */
.bolla.sopra .bolla__coda { border-top-color: transparent; border-left-color: transparent; box-shadow: 3px 3px 6px -3px rgba(40, 30, 20, 0.18); }
.bolla.sotto .bolla__coda { border-bottom-color: transparent; border-right-color: transparent; }
.bolla.destra .bolla__coda { border-top-color: transparent; border-right-color: transparent; box-shadow: -3px 3px 6px -3px rgba(40, 30, 20, 0.14); }
.bolla.sinistra .bolla__coda { border-bottom-color: transparent; border-left-color: transparent; box-shadow: 3px -3px 6px -3px rgba(40, 30, 20, 0.14); }

/* the drawn pointer */
.fantasma {
  position: absolute; left: 0; top: 0; z-index: 8;
  width: 22px; height: 22px; margin: -3px 0 0 -5px;
  pointer-events: none; opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(20, 12, 6, 0.3));
}
.fantasma path { fill: #fff; stroke: var(--inchiostro); stroke-width: 1.3; stroke-linejoin: round; }

/* ---- the list ---- */
.elenco { display: grid; gap: 8px; }
.elenco__testa {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11.5px; font-weight: 640; font-stretch: 110%; letter-spacing: 0.01em;
  padding: 0 8px;
}
.elenco__testa span { font-weight: 500; color: var(--tenue); font-stretch: 100%; }
.elenco__corpo { position: relative; }
.elenco__luce {
  position: absolute; left: 0; top: 0; width: 10px; height: 10px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--linea);
  box-shadow: 0 1px 2px rgba(40, 30, 20, 0.06), 0 10px 22px -12px rgba(40, 30, 20, 0.26);
  opacity: 0;
}
.elenco__righe { position: relative; list-style: none; display: grid; gap: 2px; }
.riga-posto {
  display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 12px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.riga-posto__foto {
  width: 38px; height: 38px; border-radius: 9px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  background: #e8e1d4;
}
.riga-posto__foto img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(0.55); opacity: 0.8; transition: filter 0.4s ease, opacity 0.4s ease; }
.riga-posto__nome { font-size: 13px; font-weight: 560; letter-spacing: -0.005em; line-height: 1.2; transition: font-stretch 0.4s ease, color 0.4s ease; color: #4b4640; }
.riga-posto__dove { font-size: 11px; color: var(--tenue); line-height: 1.3; }
.riga-posto__voto { font-size: 11.5px; font-weight: 600; color: var(--tenue); display: inline-flex; align-items: center; gap: 6px; transition: color 0.4s ease; }
.riga-posto__freccia { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: translateX(-4px); transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.riga-posto.attiva .riga-posto__foto img { filter: none; opacity: 1; }
.riga-posto.attiva .riga-posto__nome { color: var(--inchiostro); font-stretch: 108%; }
.riga-posto.attiva .riga-posto__voto { color: var(--accento); }
.riga-posto.attiva .riga-posto__freccia { opacity: 1; transform: none; }

/* ---- the phone: the map on top, the list under it, two columns, by tap ---- */
@media (max-width: 699px) {
  :root { --bolla-l: min(150px, 46vw); }
  .stage { justify-content: center; gap: clamp(6px, 1.6vh, 14px); }
  .testa { gap: 2px; padding: 0 2px; }
  .marchio { font-size: 10.5px; }
  .sottotitolo { display: none; }
  .titolo { font-size: clamp(17px, min(5.4vw, 4.6vh), 26px); }
  .guida { grid-template-columns: 1fr; gap: clamp(6px, 1.6vh, 14px); justify-items: center; }
  .mappa { width: min(96vw, calc((100vh - 168px) * 1.3636), 560px); border-radius: 16px; }
  .elenco { width: min(96vw, calc((100vh - 168px) * 1.3636), 560px); gap: 4px; }
  .elenco__testa { display: none; }
  .elenco__righe { grid-template-columns: 1fr 1fr; gap: 0 4px; }
  .riga-posto { grid-template-columns: 1fr auto; gap: 6px; padding: clamp(4px, 1vh, 8px) 8px; border-radius: 9px; }
  .riga-posto__foto, .riga-posto__dove, .riga-posto__freccia { display: none; }
  .riga-posto__nome { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .riga-posto__voto { font-size: 10.5px; }
  .elenco__luce { border-radius: 9px; }
  .pin { width: 24px; height: 32px; margin: -32px 0 0 -12px; }
  .bolla__corpo { padding: 4px; border-radius: 12px; }
  .bolla__foto { border-radius: 8px; aspect-ratio: 2 / 1; }
  .bolla__testo { padding: 6px 5px 3px; gap: 1px; }
  .bolla__nome { font-size: 12px; }
  .bolla__dove { font-size: 10px; }
  .bolla__dati { margin-top: 3px; padding-top: 4px; font-size: 10.5px; }
  .bolla__piatto { font-size: 9.5px; left: 5px; bottom: 5px; padding: 2px 6px; }
}

@media (hover: hover) {
  .riga-posto:hover .riga-posto__nome { color: var(--inchiostro); }
}

@media (prefers-reduced-motion: reduce) {
  .riga-posto__freccia { transition: opacity 0.3s ease; transform: none; }
}

/* ---- the blocks and the map's own controls ---- */
.m-isolati rect { fill: #f2ece1; }
.mappa__etichetta {
  position: absolute; left: 12px; top: 12px; z-index: 3;
  display: inline-flex; gap: 6px; align-items: baseline;
  font-size: 11px; font-weight: 620; letter-spacing: 0.005em;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--linea);
  box-shadow: 0 1px 2px rgba(40, 30, 20, 0.06), 0 6px 14px -8px rgba(40, 30, 20, 0.2);
}
.mappa__etichetta span { font-weight: 500; color: var(--tenue); }
.mappa__zoom {
  position: absolute; right: 12px; bottom: 12px; z-index: 3;
  display: grid; border-radius: 10px; overflow: hidden;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--linea);
  box-shadow: 0 1px 2px rgba(40, 30, 20, 0.06), 0 6px 14px -8px rgba(40, 30, 20, 0.2);
}
.mappa__zoom span { width: 28px; height: 26px; display: grid; place-items: center; }
.mappa__zoom span + span { border-top: 1px solid var(--linea); }
.mappa__zoom svg { width: 11px; height: 11px; fill: none; stroke: var(--inchiostro); stroke-width: 1.4; stroke-linecap: round; }
.mappa__nord { position: absolute; left: 14px; bottom: 12px; z-index: 3; width: 20px; height: 20px; }
.nord__ago { fill: var(--accento); }
.nord__coda { fill: #cfc5b4; }

@media (max-width: 699px) {
  .mappa__etichetta { left: 8px; top: 8px; font-size: 9.5px; padding: 3px 8px; }
  .mappa__zoom { right: 8px; bottom: 8px; border-radius: 8px; }
  .mappa__zoom span { width: 22px; height: 20px; }
  .mappa__nord { left: 9px; bottom: 8px; width: 16px; height: 16px; }
}
