:root {
  color-scheme: light;
  --paper: #f5f3ea;
  --paper-2: #ece9dc;
  --white: #fffdf7;
  --ink: #18251f;
  --muted: #4a5a51;
  --green: #16372d;
  --green-2: #0f2a21;
  --link: #205744;
  --lime: #d9f36e;
  --tram: #e8742c;
  --rule: #d8d6c6;
  --sans: "Avenir Next", Avenir, system-ui, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.65 var(--sans);
  /* faint paper grain */
  background-image: radial-gradient(rgba(22, 55, 45, .045) 1px, transparent 1px);
  background-size: 22px 22px;
}
::selection { background: var(--lime); color: var(--green); }
[hidden] { display: none !important; }
a { color: var(--link); text-underline-offset: .21em; text-decoration-thickness: .075em; }
a:hover { text-decoration-thickness: .13em; text-decoration-color: var(--tram); }
button { font: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
p { margin: 0 0 1rem; }
h1, h2, h3 { margin: 0; line-height: 1.13; }
.wrap { width: min(100% - 5rem, 76rem); margin-inline: auto; }
.skip-link { position: fixed; z-index: 10; top: .75rem; left: .75rem; padding: .5rem 1rem; background: var(--white); transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ——— Masthead ——— */
.masthead { position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.masthead-inner { min-height: 4.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.brand { display: inline-flex; gap: .75rem; align-items: center; color: var(--green); font-weight: 750; line-height: 1.1; text-decoration: none; }
.brand-mark { display: block; width: 2.6rem; height: 2.6rem; flex: none; transition: transform .4s cubic-bezier(.3, 1.6, .5, 1); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.utility { display: flex; gap: clamp(.5rem, 2vw, 1rem); align-items: center; }
.utility a { padding: .35rem .8rem; border: 1px solid var(--green); border-radius: 99px; color: var(--green); font-size: .85rem; font-weight: 700; text-decoration: none; white-space: nowrap; transition: background .2s, color .2s; }
.utility a:hover { background: var(--green); color: var(--lime); }

/* ——— Hero ——— */
.hero { position: relative; display: grid; grid-template-columns: 1.03fr 1fr; min-height: 32rem; margin-top: 1.5rem; border-radius: 1.1rem; overflow: hidden; background: var(--green); color: var(--white); isolation: isolate; }
.hero-content { position: relative; padding: clamp(2.4rem, 5vw, 5rem); align-self: center; }
.hero::before { /* lime orbit behind the title */
  content: ''; position: absolute; z-index: -1; width: 30rem; height: 30rem; left: -9rem; bottom: -13rem; border-radius: 50%;
  border: 1px solid rgba(217, 243, 110, .28); box-shadow: 0 0 0 3.5rem rgba(217, 243, 110, .04), 0 0 0 7rem rgba(217, 243, 110, .03);
}
.hero h1 { font: 380 clamp(3.4rem, 6.6vw, 6.6rem)/.92 var(--serif); font-variation-settings: "opsz" 144; letter-spacing: -.045em; }
.hero h1 em { font-style: italic; font-weight: 300; color: var(--lime); }
.hero h1 span { color: var(--tram); }
.hero p { max-width: 24rem; margin: 1.6rem 0 1.8rem; color: #dbe6de; font-size: clamp(1.02rem, 1.6vw, 1.2rem); line-height: 1.5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.85rem; padding: .57rem 1.2rem; border: 1px solid var(--green); border-radius: 99px; background: var(--green); color: var(--white); font-size: .9rem; font-weight: 750; text-decoration: none; cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s; }
.button:hover { background: #245442; }
.button-lime { border-color: var(--lime); background: var(--lime); color: #122a21; box-shadow: 0 0 0 0 var(--tram); }
.button-lime::after { content: '→'; transition: transform .2s; }
.button-lime:hover { background: #ebff9c; transform: translate(-3px, -3px); box-shadow: 3px 3px 0 0 var(--tram); }
.button-lime:hover::after { transform: translateX(3px); }
.button-lime:focus-visible { outline-color: var(--white); }
.hero-image { position: relative; min-width: 0; min-height: 17rem; margin: 0; overflow: hidden; background: #716952; }
.hero-image img { position: absolute; width: 100%; height: 100%; inset: 0; display: block; object-fit: cover; object-position: 51% 52%; transform: scale(1.02); transition: transform 1.2s ease; }
.hero:hover .hero-image img { transform: scale(1.06); }
.hero-image::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--green) 0%, rgba(22, 55, 45, 0) 22%), linear-gradient(0deg, rgba(10, 30, 22, .45), transparent 40%); pointer-events: none; }
.hero-image figcaption { position: absolute; z-index: 1; bottom: 1.1rem; right: 1.1rem; max-width: calc(100% - 2rem); padding: .32rem .75rem; background: var(--tram); color: #1c0f05; font: 600 .72rem/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; border-radius: 99px; }


/* ——— Layout & metro-line TOC ——— */
.guide-layout { display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); gap: clamp(2rem, 6.1vw, 6rem); align-items: start; margin-top: 3.5rem; margin-bottom: 5rem; counter-reset: section; }
.guide-sidebar { position: sticky; top: 6rem; }
.toc { --stop: .55rem; position: relative; display: grid; gap: .05rem; }
.toc::before { content: ''; position: absolute; left: calc(var(--stop) - 2px); top: 2.4rem; bottom: .9rem; width: 4px; border-radius: 4px; background: var(--green); }
.toc a { position: relative; padding: .36rem .6rem .36rem 1.9rem; color: var(--muted); font-size: .88rem; line-height: 1.37; text-decoration: none; transition: color .15s; }
.toc a:not(.toc-heading)::before { content: ''; position: absolute; left: var(--stop); top: 50%; width: .62rem; height: .62rem; transform: translate(-50%, -50%); border: 3px solid var(--green); border-radius: 50%; background: var(--paper); transition: background .2s, transform .2s; }
.toc a:hover { color: var(--green); }
.toc a:hover::before { background: var(--lime); }
.toc .toc-heading { padding: 0 0 .7rem; color: var(--green); font: 600 .72rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.toc a[aria-current] { color: var(--green); font-weight: 750; }
.toc a[aria-current]::before { background: var(--lime); transform: translate(-50%, -50%) scale(1.35); box-shadow: 0 0 0 4px rgba(217, 243, 110, .45); }

/* ——— Sections ——— */
.guide-layout main { width: min(100%, 51rem); min-width: 0; }
.opening-space { display: none; }
.guide-section { position: relative; padding: 3rem 0; border-top: 1px solid var(--rule); scroll-margin-top: 5.5rem; counter-increment: section; }
.orientation { padding-top: 0; border-top: 0; }
.guide-section h2 { margin-bottom: 1rem; font: 400 clamp(2.2rem, 4.4vw, 3.6rem)/1.02 var(--serif); font-variation-settings: "opsz" 144; letter-spacing: -.035em; color: var(--green); }
.guide-section h2::before { content: counter(section, decimal-leading-zero); display: block; margin-bottom: .7rem; font: 600 .75rem/1 var(--mono); letter-spacing: .14em; color: var(--tram); }
.guide-section h2::first-letter { color: var(--green); }
.guide-section h3 { font-size: 1.13rem; }
.guide-section > p { max-width: 44rem; color: var(--muted); }
.guide-section .lead { color: var(--ink); font: 400 clamp(1.25rem, 2.2vw, 1.55rem)/1.45 var(--serif); letter-spacing: -.01em; }
.text-link { font-weight: 750; }
.text-link::after { content: ' →'; }

/* Timeline as a tram line */
.timeline { position: relative; margin: 1.8rem 0 0; padding: 0; list-style: none; }
.timeline::before { content: ''; position: absolute; left: calc(.5rem - 2px); top: 1.4rem; bottom: 1.6rem; width: 4px; border-radius: 4px; background: linear-gradient(var(--green), var(--tram)); }
.timeline li { position: relative; display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: .65rem 1.2rem; padding: 1.15rem 0 1.15rem 2.2rem; }
.timeline li::before { content: ''; position: absolute; left: 0; top: 1.35rem; width: 1rem; height: 1rem; border: 4px solid var(--green); border-radius: 50%; background: var(--paper); }
.timeline li:last-child::before { border-color: var(--tram); background: var(--lime); }
.timeline li > div { padding: 1rem 1.2rem; margin-top: -.9rem; background: var(--white); border: 1px solid var(--rule); border-radius: .7rem; transition: transform .2s, box-shadow .2s; }
.timeline li:hover > div { transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(22, 55, 45, .45); }
.period { font: 600 .74rem/1.4 var(--mono) !important; letter-spacing: .1em; text-transform: uppercase; color: var(--tram) !important; }
.label { display: inline-block; padding: .14rem .55rem; border-radius: 99px; background: var(--green); color: var(--lime); font: 600 .68rem/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.timeline h3 { margin-bottom: .35rem; }
.timeline p, .resource p, .card p { color: var(--muted); margin: 0; }
.resource p + p { margin-top: .65rem; }

/* Filters / chips */
.filters { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1.4rem 0 1rem; }
.filters button, .copy-heading button { background: transparent; border: 1px solid #aebdaf; border-radius: 99px; padding: .42rem .9rem; color: var(--green); font-size: .86rem; font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s; }
.filters button:hover, .copy-heading button:hover { background: var(--white); border-color: var(--green); }
.filters button[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: var(--lime); }
.filters button[aria-pressed="true"]:focus-visible { outline-color: var(--green); }

/* Resource rows */
.resources { border-top: 1px solid var(--rule); }
.resource { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: .65rem 1.3rem; padding: 1.25rem .9rem; margin-inline: -.9rem; border-bottom: 1px solid var(--rule); border-radius: .5rem; align-items: start; transition: background .2s; }
.resource:hover { background: var(--white); }
.resource h3 { margin: .45rem 0 .42rem; font: 500 1.35rem/1.2 var(--serif); letter-spacing: -.015em; }
.resource > a { align-self: center; padding: .35rem .85rem; border: 1px solid var(--green); border-radius: 99px; font-weight: 750; font-size: .84rem; text-decoration: none; color: var(--green); transition: background .2s, color .2s; }
.resource > a::after { content: ' ↗'; }
.resource > a:hover { background: var(--green); color: var(--lime); }
.resource:last-child { border-bottom: 0; }
.city-entries { scroll-margin-top: 5.5rem; }
.city-entry { grid-template-columns: minmax(7rem, 1fr) minmax(0, 3.2fr); }
.city-entry h3 { margin: .1rem 0 0; font-size: 1.7rem; font-style: italic; color: var(--green); }
.resource:target { background: var(--lime); }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.6rem; }
.card { position: relative; padding: 1.35rem 1.35rem 1.45rem; background: var(--white); border: 1px solid var(--green); border-radius: .8rem; box-shadow: 5px 5px 0 0 var(--green); transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translate(-3px, -3px); box-shadow: 8px 8px 0 0 var(--tram); }
.card h3 { margin: .7rem 0 .55rem; font: 500 1.4rem/1.15 var(--serif); }
.card h3 a, .resource h3 a { color: var(--green); }
.card .label { display: inline-block; }

/* Link lists */
.link-list { margin: 1.2rem 0 0; padding: 0; list-style: none; border-top: 2px solid var(--green); counter-reset: item; }
.link-list li { display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(0, 2.15fr); gap: .35rem 1rem; padding: .9rem 0; border-bottom: 1px solid var(--rule); transition: padding .2s; }
.link-list li:hover { padding-left: .5rem; }
.link-list li:last-child { border: 0; padding-bottom: 0; }
.link-list li > a { font: 500 1.12rem/1.3 var(--serif); justify-self: start; color: var(--green); }
.link-list span { color: var(--muted); }
.after-list { margin-top: 1.25rem; }
.follow-up-heading { display: flex; align-items: center; gap: .7rem; margin: 2rem 0 .6rem; }
.follow-up-heading::before { content: ''; width: 1.4rem; height: 4px; border-radius: 4px; background: var(--tram); }

/* Route cards */
.route-card { margin: .75rem 0 0; padding: 1.2rem 1.4rem; background: var(--white); border: 1px solid var(--rule); border-left: 5px solid var(--tram); border-radius: .6rem; }
.route-card h3 { margin-bottom: .55rem; font: 500 1.35rem/1.2 var(--serif); color: var(--green); }
.route-card p, .route-card ol { margin: 0; color: var(--muted); }
.route-card ol { padding-left: 0; list-style: none; counter-reset: step; }
.route-card ol li { position: relative; padding-left: 2.2rem; counter-increment: step; }
.route-card ol li::before { content: counter(step); position: absolute; left: 0; top: .1rem; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--green); color: var(--lime); font: 700 .75rem/1 var(--mono); }
.route-card li + li { margin-top: .5rem; }

/* Map */
.map-frame { position: relative; isolation: isolate; aspect-ratio: 4 / 3; overflow: hidden; background: #e8e6dc; border: 1px solid var(--green); border-radius: .8rem; box-shadow: 5px 5px 0 0 var(--green); }
.map-canvas { position: absolute; inset: 0; font: inherit; background: #e8e6dc; }
.map-canvas .leaflet-tile-pane { filter: grayscale(.55) sepia(.18) contrast(.95) brightness(1.03); }
.map-canvas .leaflet-control-zoom { border: 1px solid var(--green); border-radius: .5rem; overflow: hidden; box-shadow: none; }
.map-canvas .leaflet-control-zoom a { color: var(--green); background: var(--white); }
.map-canvas .leaflet-control-attribution { font-size: .68rem; background: rgba(255, 253, 247, .85); }
.map-pin { display: grid; place-items: center; width: 30px; height: 30px; border: 2px solid var(--white); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--green); box-shadow: 0 0 0 1px var(--green), 0 4px 10px -3px rgba(0, 0, 0, .45); transition: background .2s; }
.map-pin::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--lime); }
.leaflet-marker-icon:hover .map-pin, .leaflet-marker-icon:focus-visible .map-pin { background: var(--tram); }
.leaflet-tooltip.map-area-label { padding: .12rem .5rem; border: 1px solid var(--green); border-radius: 99px; background: var(--lime); color: var(--green); font: italic 500 .82rem/1.3 var(--serif); white-space: nowrap; box-shadow: none; }
.leaflet-tooltip.map-area-label::before { display: none; }
.map-canvas .leaflet-popup-content-wrapper { border: 1px solid var(--green); border-radius: .7rem; background: var(--white); color: var(--ink); box-shadow: 4px 4px 0 0 var(--green); }
.map-canvas .leaflet-popup-tip { background: var(--white); border: 1px solid var(--green); }
.map-canvas .leaflet-popup-content { margin: .8rem 1rem; font: .88rem/1.45 var(--sans); }
.map-popup strong { display: block; margin-bottom: .25rem; font: 500 1.1rem/1.2 var(--serif); color: var(--green); }
.map-popup p { margin: 0 0 .5rem; color: var(--muted); }
.map-popup a { font-weight: 750; }
.map-credit { margin: .9rem 0 1rem; color: var(--muted); font-size: .82rem; }
.layer-toggle { display: inline-flex; align-items: center; gap: .45rem; }
.layer-toggle .swatch { width: .8rem; height: .8rem; border: 2px solid currentColor; }
.swatch-pin { border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.swatch-area { border-radius: .2rem; }
.layer-toggle[aria-pressed="true"] .swatch { background: var(--lime); border-color: var(--lime); }
.layer-toggle[aria-pressed="false"] { opacity: .75; }
.layer-toggle[aria-pressed="false"] .swatch { background: transparent; }
.map-layer-title { margin: 1rem 0 .45rem; font: 600 .74rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--tram); }
.city-map > [data-panel] .resource { scroll-margin-top: 5.5rem; }

/* Copy box: styled like a postcard */
.copy-box { position: relative; margin-top: 1.35rem; padding: 1.4rem 1.5rem; border: 1px solid var(--green); border-radius: .8rem; background: var(--white) repeating-linear-gradient(transparent 0 1.95rem, rgba(22, 55, 45, .07) 1.95rem 2rem); }
.copy-box::after { content: 'Milano'; position: absolute; top: -.9rem; right: 1.2rem; padding: .25rem .7rem; transform: rotate(4deg); border: 2px dashed var(--tram); border-radius: .3rem; background: var(--paper); color: var(--tram); font: italic 500 .9rem/1 var(--serif); }
.copy-heading { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: space-between; margin-bottom: .7rem; color: var(--green); }
#coffee-message { font: italic 400 1.1rem/1.75 var(--serif); color: var(--ink); }

/* Contribute: dark block */
.contribute { margin-top: 1.5rem; padding: clamp(1.8rem, 5vw, 3rem); border: 0; border-radius: 1.1rem; background: var(--green); color: #dbe6de; overflow: hidden; }
.contribute::after { content: '✳'; position: absolute; right: -1rem; bottom: -4.5rem; font-size: 16rem; line-height: 1; color: rgba(217, 243, 110, .1); pointer-events: none; }
.guide-section.contribute h2 { color: var(--white); }
.guide-section.contribute h2::before { color: var(--lime); }
.guide-section.contribute > p { color: #dbe6de; }
.contribution-links { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .6rem; font-weight: 700; }
.contribution-links a { padding: .5rem 1rem; border-radius: 99px; background: var(--lime); color: var(--green); text-decoration: none; transition: transform .2s; }
.contribution-links a:hover { transform: translateY(-2px); }

/* Footer */
.footer { border-top: 1px solid var(--rule); padding: 2rem 0 2.4rem; color: var(--muted); background: var(--paper-2); }
.footer-inner { display: flex; gap: .75rem 2rem; align-items: flex-start; justify-content: space-between; font-size: .88rem; }
.footer p { margin: .55rem 0 0; }
.photo-credit { max-width: 21rem; }

@media (min-width: 1000px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .wrap { width: min(100% - 3rem, 76rem); }
  .guide-layout { grid-template-columns: 12.6rem minmax(0, 1fr); gap: 1.8rem; }
  .timeline li { grid-template-columns: 7rem minmax(0, 1fr); }
}

@media (max-width: 700px) {
  .wrap { width: calc(100% - 2rem); }
  .hero { grid-template-columns: 1fr; margin-top: .9rem; min-height: 0; }
  .hero-content { padding: 2.2rem 1.55rem 2rem; }
  .hero h1 { font-size: clamp(3.2rem, 13vw, 4.8rem); }
  .hero p { margin-top: 1rem; margin-bottom: 1.25rem; }
  .hero-image { min-height: clamp(11.25rem, 58vw, 21rem); }
  .hero-image::after { background: linear-gradient(180deg, var(--green) 0%, rgba(22, 55, 45, 0) 25%); }
  .guide-layout { display: block; margin-top: 1.8rem; margin-bottom: 3rem; }
  .guide-sidebar { position: static; margin-bottom: 2rem; }
  .toc { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .9rem .7rem; border: 1px solid var(--green); border-radius: .8rem; background: var(--white); gap: .1rem; }
  .toc::before { display: none; }
  .toc a { padding: .4rem .4rem .4rem 1.5rem; }
  .toc a:not(.toc-heading)::before { left: .5rem; width: .55rem; height: .55rem; border-width: 2px; }
  .toc .toc-heading { grid-column: 1 / -1; margin: 0; padding: .2rem .4rem .5rem; }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
  .timeline li > div { margin-top: 0; }
  .guide-section { padding-top: 2.2rem; padding-bottom: 2.2rem; }
  .orientation { padding-top: 0; }
  .footer-inner { flex-direction: column; }
}

@media (max-width: 440px) {
  .masthead-inner { min-height: 3.8rem; gap: .7rem; }
  .brand { gap: .45rem; font-size: .93rem; }
  .utility a:first-child { display: none; }
  .card-grid, .link-list li { grid-template-columns: minmax(0, 1fr); }
  .resource { gap: .6rem; grid-template-columns: minmax(0, 1fr); }
  .resource > a { justify-self: start; }
  .city-entry h3 { font-size: 1.45rem; }
}

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

/* People cards */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: .85rem; margin-top: 1.4rem; }
.person-card { position: relative; display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: .95rem; align-items: start; padding: 1rem 1.1rem; background: var(--white); border: 1px solid var(--green); border-radius: .8rem; box-shadow: 4px 4px 0 0 var(--green); transition: transform .2s, box-shadow .2s; }
.person-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 0 var(--tram); }
.person-card img { display: block; width: 4rem; height: 4rem; border-radius: 50%; object-fit: cover; object-position: 50% 30%; border: 2px solid var(--green); background: var(--paper-2); box-shadow: 0 0 0 3px var(--lime); filter: saturate(.9); transition: filter .3s, box-shadow .2s; }
.person-card:hover img { filter: saturate(1.1); box-shadow: 0 0 0 3px var(--tram); }
.person-card > div { min-width: 0; }
.person-card h3 { margin: .45rem 0 .3rem; font: 500 1.15rem/1.15 var(--serif); letter-spacing: -.015em; }
.person-card h3 a { color: var(--green); text-decoration: none; }
.person-card h3 a::after { content: ''; position: absolute; inset: 0; } /* whole card clickable */
.person-card h3 a:hover { text-decoration: underline; }
.person-card p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.person-card p a { position: relative; z-index: 2; }
.person-card .label { border-radius: .4rem; font-size: .62rem; }
