/* ══════════════════════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Light-only UI: keep UA-painted surfaces (overscroll glow, the bottom
     safe-area / gesture-indicator strip) light even under OS dark mode, so
     they match the light chrome instead of showing a dark band. */
  color-scheme: light;

  /* Palette — clean, minimal, single accent */
  --color-bg:           #F8F8F7;
  --color-bg-alt:       #F4F4F5;
  --color-surface:      #FFFFFF;
  --color-border:       #E4E4E7;
  --color-border-light: #F0F0F1;

  --color-text:         #09090B;
  --color-text-muted:   #71717A;
  --color-text-light:   #A1A1AA;

  --color-accent:       #C8102E;   /* Italian flag red — single accent */
  --color-accent-hover: #A50E26;
  --color-accent-bg:    #FFF0F1;

  --color-header-bg:    #111111;
  --color-header-text:  #FFFFFF;

  /* Typography */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* Spacing */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Layout */
  --max-width:     1120px;
  --content-px:    2rem;

  /* The page bar's height, remeasured by syncChromeHeight() in js/app.js.
     Sub-page panels pad themselves clear of it and the map panel subtracts it.
     It is 0 on home, which has no bar. This value is the pre-JS fallback. */
  --chrome-height: 55px;

  /* Home masthead. Colosseum at dusk by Wilfredor, released CC0 (Wikimedia
     Commons), so no attribution is required. */
  --hero-colosseum: url('../assets/hero-colosseum.jpg');

  /* Map-pin glyph used as a mask on location pills */
  --pin-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a7 7 0 0 0-7 7c0 5.25 7 13 7 13s7-7.75 7-13a7 7 0 0 0-7-7Zm0 9.5A2.5 2.5 0 1 0 12 6.5a2.5 2.5 0 0 0 0 5Z'/%3E%3C/svg%3E");

  /* Radii */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-full: 999px;

  /* Shadows — very subtle */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);

  --transition: 0.15s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--color-text);
  font-weight: 600;
}

a { color: var(--color-accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { max-width: 100%; display: block; }

/* ══════════════════════════════════════════════════════════
   ACCESSIBILITY
══════════════════════════════════════════════════════════ */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-md);
  background: var(--color-accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 9999;
  transition: top var(--transition);
  text-decoration: none;
}
.skip-link:focus { top: var(--space-md); }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════════════════════
   DIRECTORY (root landing page — index.html)
   A type-forward list of the guides. No default guide: a visitor at the
   root picks a property here. Shares the header/footer + design tokens with
   the guide; everything below is scoped to .directory-page.
══════════════════════════════════════════════════════════ */
.directory {
  flex: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vh, 5rem) var(--content-px) var(--space-3xl);
}

.directory-intro { margin-bottom: var(--space-2xl); }

.directory-intro h1 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin-bottom: var(--space-md);
}

.directory-intro p {
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.65;
  max-width: 56ch;
}

.directory-grid {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.directory-card {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

/* Accent rail that fills in on hover */
.directory-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--color-accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform var(--transition);
}

.directory-card:hover,
.directory-card:focus-visible {
  border-color: var(--color-text-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.directory-card:hover::before,
.directory-card:focus-visible::before { transform: scaleY(1); }

.directory-card-index {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-text-light);
  line-height: 1;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.directory-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.directory-card-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.directory-card-meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.directory-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
}
.directory-card-cta svg { transition: transform 0.2s ease; }
.directory-card:hover .directory-card-cta svg,
.directory-card:focus-visible .directory-card-cta svg { transform: translateX(3px); }

.directory-error {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

@media (max-width: 560px) {
  .directory-card {
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-md);
    padding: var(--space-lg);
  }
  .directory-card-name { font-size: 1.3rem; }
  /* CTA drops under the name, aligned with it (past the index number). */
  .directory-card-cta { width: 100%; }
}

/* ══════════════════════════════════════════════════════════
   MAIN / TAB PANELS
══════════════════════════════════════════════════════════ */
.main-content {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;

  display: flex;
  flex-direction: column;
}

.tab-panel {
  padding: var(--space-xl) var(--content-px);
  animation: fadeIn 0.2s ease;
  width: 100%;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}

.tab-panel.map-panel { padding: 0; }
.tab-panel[hidden]   { display: none !important; }


@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Tab headers */
.tab-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.tab-header.has-filter {
  margin-bottom: var(--space-md);
}

.tab-header h2 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.tab-intro {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  max-width: 60ch;
}

/* ══════════════════════════════════════════════════════════
   ADDRESS LINK (shared)
══════════════════════════════════════════════════════════ */
/* Stack multiple address links (e.g. the pharmacy list in Tips) */
.stacked-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
}
.stacked-links .address-link { white-space: normal; text-align: left; }

.address-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--color-accent);
  background: none;
  border: 1px solid var(--color-border);
  /* Left padding is trimmed to offset the wider glyph, so the pill keeps its
     original footprint. */
  padding: 5px 12px 5px 8px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

/* Map-pin glyph at the front of every location pill. Drawn as a mask so it
   picks up the pill's current text colour, including on hover. */
.address-link::before {
  content: '';
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: var(--pin-glyph) center / contain no-repeat;
  mask: var(--pin-glyph) center / contain no-repeat;
}

.address-link:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

/* ══════════════════════════════════════════════════════════
   FILTER ROW (shared)
══════════════════════════════════════════════════════════ */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.filter-btn {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--color-text-light);
  color: var(--color-text);
}

.filter-btn.active {
  background: var(--color-text);
  border-color: var(--color-text);
  color: #fff;
}

/* ══════════════════════════════════════════════════════════
   PLACE CARDS — PHOTO-FORWARD VERTICAL GRID
══════════════════════════════════════════════════════════ */
.place-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.place-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
}

.place-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* Featured (Must-See) — thin accent bar across the top of the card */
.place-card.featured::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-accent);
  z-index: 2;
}

/* Hidden (filtered out) */
.place-card.hidden,
.place-group.hidden { display: none; }

/* Eat & Drink category heading: a full-width row between the groups. */
.place-group {
  grid-column: 1 / -1;
  margin: var(--space-sm) 0 calc(-1 * var(--space-sm));
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.place-group:first-child { margin-top: 0; }

/* ── Image (top) ── */
.place-img {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--color-bg-alt);
  overflow: hidden;
  flex-shrink: 0;
}

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

/* Monogram placeholder when a place has no photo yet */
.place-img-mono {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 500;
  color: var(--color-text-light);
  background: var(--color-bg-alt);
}

/* Must-See badge — overlaid on the image */
.place-img .place-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  margin: 0;
  z-index: 2;
}

.place-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid #F5D3D8;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

/* ── Body (below image) ── */
.place-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-lg);
  flex: 1;
}

.place-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
}

.place-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.place-category-tag {
  font-size: 0.7rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.place-price {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Description ── */
.place-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-top: 2px;
  /* clamp to 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Meta (hours + address), pinned to card bottom ── */
.place-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: auto;
  padding-top: var(--space-md);
}

.place-hours {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-size: 0.75rem;
  color: var(--color-text-light);
  line-height: 1.3;
}

.place-hours-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.place-hours-time::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A79C8B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='M12 7v5l3 2'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  flex-shrink: 0;
}

.place-hours-cond {
  font-size: 0.7rem;
  font-style: italic;
  color: var(--color-text-light);
}

/* ══════════════════════════════════════════════════════════
   TRANSPORT
══════════════════════════════════════════════════════════ */
.transport-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-xl);
}

.transport-card {
  background: var(--color-surface);
  padding: var(--space-xl);
  transition: background var(--transition);
}

.transport-card:hover { background: var(--color-bg-alt); }

/* Icon and title share a row: "[icon] Title" */
.transport-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--space-md);
}

.transport-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}

.transport-icon svg {
  width: 21px;
  height: 21px;
  display: block;
}

.transport-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

/* Location pills need room to breathe under the body copy (matches the gap
   used by .stacked-links in the Tips cards). */
.transport-card .address-link { margin-top: 12px; }

.transport-card p {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.65;
}

.transport-tip {
  margin-top: var(--space-sm);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  padding: 8px 10px;
  background: var(--color-bg-alt);
  border-left: 2px solid var(--color-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Info table */
.info-table-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.info-table-wrap h3 {
  font-size: 0.875rem;
  font-weight: 600;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-alt);
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.info-table th {
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  font-weight: 600;
  padding: 10px 20px;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-border);
}

.info-table td {
  padding: 11px 20px;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
}

.info-table tr:last-child td { border-bottom: none; }
.info-table tr:hover td { background: var(--color-bg-alt); }

/* Footnote under a table (e.g. where to buy tickets) */
.table-note {
  font-size: 0.75rem;
  color: var(--color-text-light);
  line-height: 1.55;
  padding: 10px var(--space-xl) 13px;
  border-top: 1px solid var(--color-border-light);
}

/* Tickets + official sources side by side */
.transport-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
}

/* Reference links (ATAC, Trenitalia, ...) */
.link-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: var(--space-md) var(--space-xl) var(--space-lg);
}

.link-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.link-list a {
  font-size: 0.85rem;
  font-weight: 600;
  width: fit-content;
  border-bottom: 1px solid transparent;
}
.link-list a:hover { border-bottom-color: var(--color-accent); }

.link-list span {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Inline links inside body copy */
.transport-card p a {
  border-bottom: 1px solid rgba(200, 16, 46, 0.35);
  transition: border-color var(--transition);
}
.transport-card p a:hover { border-bottom-color: var(--color-accent); }

/* ══════════════════════════════════════════════════════════
   TIPS
══════════════════════════════════════════════════════════ */
/* Emergency numbers: three tappable tiles above the tip cards */
.emergency-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.emergency-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 13px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
}
.emergency-tile:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-bg);
}

.emergency-num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1;
  color: var(--color-accent);
  letter-spacing: 0.01em;
}

.emergency-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  text-align: center;
}

/* Tip cards are packed into columns rather than laid out on a grid: the
   phrase table is much taller than the lists, and a grid leaves a large
   dead zone beside it. Multi-column flows the short cards up into the gap. */
.tips-grid {
  columns: 2;
  column-gap: var(--space-lg);
}

.tip-section {
  break-inside: avoid;
  margin-bottom: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  transition: border-color var(--transition);
}

.tip-section:hover { border-color: var(--color-text-light); }

.tip-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.tip-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tip-list li {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  padding-left: var(--space-md);
  position: relative;
  line-height: 1.55;
}

.tip-list li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: 700;
}

.tip-section p {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  margin-bottom: var(--space-sm);
}

/* Phrase table */
.phrase-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.phrase-table th {
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  font-weight: 600;
  padding: 7px 10px;
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-border);
}

.phrase-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
}

.phrase-table tr:last-child td { border-bottom: none; }
.phrase-table tr:hover td { background: var(--color-bg-alt); }

/* ══════════════════════════════════════════════════════════
   MAP
══════════════════════════════════════════════════════════ */
.tab-panel.map-panel {
  height: 100%;
  padding: 0;
}

/* When map tab is active, lock viewport so footer stays visible without scroll */
body.map-active { height: 100vh; overflow: hidden; }
body.map-active .main-content { min-height: 0; overflow: hidden; }

.map-element {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Circle pins */
.map-pin-wrap {
  background: transparent;
  border: 0;
}

.map-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--pin-color, #555);
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
  /* The glyphs are drawn in currentColor (PIN_KINDS in js/app.js), so the pin
     owns the ink colour. White on every coloured pin; the pharmacy overrides
     it below because its pin is the white one. */
  color: #fff;
}

/* One size for every glyph. A 30px pin with a 2.5px ring leaves a 25px well,
   so 18px keeps an even optical margin on all four categories — they used to
   be 24px and 20px, which is half of why they looked mismatched. */
.map-pin svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Pharmacy — Italian green cross (croce verde) on a white pin with a green ring */
.map-pin--pharmacy { border-color: #0E8A3E; color: #0E8A3E; }

/* An open pin is drawn by its PinMorph above it; the icon stays focusable. */
.map-pin-wrap.is-morphing,
.transit-pin-wrap.is-morphing { opacity: 0; }

/* Zoom control — minimal, modern, bottom-right on desktop, hidden on mobile */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
  margin: 0 var(--space-lg) var(--space-lg) 0 !important;
}

.leaflet-control-zoom a {
  background: #fff !important;
  color: var(--color-text) !important;
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
  font-size: 18px !important;
  font-weight: 400 !important;
  border: none !important;
  border-bottom: 1px solid var(--color-border-light) !important;
  transition: background var(--transition);
}

.leaflet-control-zoom a:last-child { border-bottom: none !important; }
.leaflet-control-zoom a:hover { background: var(--color-bg-alt) !important; }

/* ── Open pins: pin → pill → card (PinMorph in js/app.js) ──
   .pm sits at the pin's centre. .pm-box is the white box; its size, corner and
   offset (--w --h --r, and --cx --cy: where the pin's centre is inside it) are
   set per state from the measured content, and transition. .pm-origin moves
   back to the pin's centre with the same timing, so the content and the badge
   stay put while the box grows around them. 240ms is MORPH_MS. */
.pm {
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-body);
  line-height: 1.3;
  color: var(--color-text);
}
.pm.is-sticky { z-index: 1; }

.pm-box {
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  position: absolute;
  left: calc(-1 * var(--cx));
  top: calc(-1 * var(--cy));
  width: var(--w);
  height: var(--h);
  border-radius: var(--r);
  overflow: hidden;
  background: #fff;
  /* The border is an inset shadow so it takes no room: the slot offsets are
     measured from the box's edge. */
  box-shadow: var(--pin-shadow);
  cursor: pointer;
  transition: left 240ms var(--ease), top 240ms var(--ease), width 240ms var(--ease),
              height 240ms var(--ease), border-radius 240ms var(--ease), box-shadow 240ms var(--ease);
}
.pm[data-state="pill"] .pm-box {
  box-shadow: inset 0 0 0 1px var(--color-border), 0 4px 14px rgba(0,0,0,0.12);
}
.pm[data-state="card"] .pm-box,
.pm.is-touch[data-state="pill"] .pm-box {
  box-shadow: inset 0 0 0 1px var(--color-border), 0 6px 20px rgba(0,0,0,0.14), 0 1px 3px rgba(0,0,0,0.08);
}
.pm[data-state="card"] .pm-box { cursor: auto; }

.pm-origin {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  transition: left 240ms var(--ease), top 240ms var(--ease);
}

/* Pill and card content, each at its natural size (left/top place its slot on
   the origin). Only the shown one is visible; the other fades and leaves, so
   its buttons can't be tabbed to or clicked. */
.pm-layer {
  position: absolute;
  width: max-content;
  opacity: 0;
  visibility: hidden;
  transition: opacity 90ms ease-out, visibility 0s 90ms;
}
.pm[data-state="pill"] .pm-pill,
.pm[data-state="card"] .pm-card {
  opacity: 1;
  visibility: visible;
  transition: opacity 150ms ease-out 50ms, visibility 0s;
}
.pm-card:focus { outline: none; }
.pm-card:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; border-radius: var(--radius-lg); }

/* The pin itself, at its marker size and scaled to the slot of the state shown. */
.pm-badge {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%) scale(var(--scale));
  transition: transform 240ms var(--ease);
  pointer-events: none;
}
.pm-badge > * {
  box-shadow: none;
  transition: box-shadow 240ms var(--ease);
}
.pm.has-photo[data-state="card"] .pm-badge > * { box-shadow: 0 1px 3px rgba(0,0,0,0.25); }

/* The empty place each state leaves for the badge. */
.pm-slot { display: block; flex: none; }

/* Card (popupCardHTML in js/app.js). The box is the card's frame; the card
   owns the only inset. */
.pm-card .map-popup p { margin: 0; }

/* max-content, not auto: Leaflet measures the card while it sits at the pin,
   where an auto width shrinks to the room left of the map's right edge and
   wraps the category line. Still true in a PinMorph: its layer measures the
   card at max-content, capped at 300px. */
.map-popup {
  width: max-content;
  min-width: 200px;
  max-width: 300px;
  padding: 10px;
}

.mp-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* The badge's slot: the pin a little larger, or a badge on the photo's corner. */
.mp-media { position: relative; flex: none; }
.mp-media > .pm-slot { width: 34px; height: 34px; }

.mp-photo { width: 64px; height: 64px; }
.mp-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
}
.mp-photo > .pm-slot {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 24px;
  height: 24px;
}

.mp-tx {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.map-popup .mp-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin: 0;
}

/* Category line: type · price · Must-see, and a metro station's line logos. */
.mp-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.mp-sub .metro-logo, .mp-sub .metro-logo svg { height: 16px; }
.mp-price,
.mp-must { white-space: nowrap; }
.mp-sub > .mp-price::before,
.mp-sub > .mp-must::before {
  content: '·';
  margin: 0 5px;
  color: var(--color-text-light);
  font-weight: 400;
}
.mp-price { font-weight: 600; color: var(--color-text); }
.mp-must  { font-weight: 600; color: var(--color-accent); }

/* Facts: open/closed pill, note, walk time — the places sheet's pills. */
.mp-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.mp-facts .place-walk { font-size: 0.72rem; gap: 4px; }
.mp-facts .place-walk svg { width: 13px; height: 13px; }
.mp-note { font-size: 0.72rem; color: var(--color-text-muted); }

.mp-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border-light);
}
.mp-addr {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Call (solid) then directions (outline), as on the mobile list rows. The
   row's own rules live in the mobile block; these are the popup's, at every
   width. */
.mp-acts { display: flex; gap: 6px; flex: none; margin-left: auto; }
.mp-head > .mp-acts { align-self: center; }
.map-popup .place-callbtn,
.map-popup .place-dirbtn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.map-popup .place-dirbtn {
  background: var(--color-accent-bg);
  border: 1px solid #F5D3D8;
  color: var(--color-accent);
}
.map-popup .place-dirbtn:hover { border-color: var(--color-accent); }
.map-popup .place-callbtn {
  background: var(--color-accent);
  border: 1px solid var(--color-accent);
  color: #fff;
  text-decoration: none;
}
.map-popup .place-callbtn:hover { background: var(--color-accent-hover); }
.map-popup .place-callbtn svg,
.map-popup .place-dirbtn svg { width: 15px; height: 15px; }

/* Pill, with a mouse: the pin, name and category on one line (the old hover
   tip). Near the map's right edge it grows leftwards, the pin at its end. */
.mt-in { display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; }
.mt-in > .pm-slot { width: 24px; height: 24px; }
.pm-pill.is-flipped .mt-in { padding: 4px 4px 4px 10px; }
.pm-pill.is-flipped .pm-slot { order: 1; }
.mt-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.mt-type { font-size: 0.75rem; color: var(--color-text-muted); white-space: nowrap; }
.mt-in:not(.mt-in--touch) .mt-type::before { content: '·'; margin-right: 6px; color: var(--color-text-light); }

/* Pill, on touch: condensed and horizontal. Pin, name over category, walk
   minutes over price, round directions button. The name gives way first. */
.mt-in--touch {
  gap: 10px;
  padding: 6px;
  max-width: min(340px, calc(100vw - 24px));
}
.mt-in--touch > .pm-slot { width: 36px; height: 36px; }
.mt-tx {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1 1 auto;
}
.mt-in--touch .mt-name {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mt-in--touch .mt-type { overflow: hidden; text-overflow: ellipsis; }
.mt-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: none;
  font-size: 0.75rem;
  white-space: nowrap;
}
.mt-walk {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--color-text-muted);
}
.mt-walk svg { width: 13px; height: 13px; }
.mt-price { font-weight: 600; }
.mt-in--touch .place-dirbtn {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: var(--color-accent-bg);
  border: 1px solid #F5D3D8;
  color: var(--color-accent);
  cursor: pointer;
}
.mt-in--touch .place-dirbtn svg { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) {
  .pm-box, .pm-origin, .pm-badge, .pm-badge > *, .pm-layer,
  .pm[data-state] .pm-layer { transition: none; }
}

/* ── Transport layer: metro / bus lines + station & taxi markers ── */

/* Transit lines are faint by default; the .is-active class (toggled on click)
   makes the whole line stand out. Colour comes from inline `color` per line. */
.transit-line        { opacity: 0.3; transition: opacity 0.2s ease; cursor: pointer; }
.transit-line:hover     { opacity: 0.6; }
.transit-line.is-active { opacity: 1; stroke-width: 6; }

/* Station / stop / taxi markers — a small SQUARE with the line letter,
   filled in the official line colour (so they read as metro line badges
   and don't compete with the eat/sights teardrops). */
.transit-pin-wrap { background: transparent; border: 0; }

.transit-pin {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  background: var(--pin-color, #555);
  border: 1.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  text-align: center;
  transition: transform 0.15s ease;
}

/* Larger than the old filled glyph: an outline mark reads smaller at the same
   box, and the taxi pin now uses the shared outline family. 15px is as big as
   the 20px square (less its 1.5px ring) will take. */
.transit-pin svg { width: 15px; height: 15px; display: block; }

.transit-pin.taxi {
  background: #1A1A1A;
  border-color: #F2C200;
  color: #F2C200;
}


/* Official Rome metro line logos (M + line letter) shown in transit popups.
   Inlined as <svg> (not <img>) so they stay crisp inside Leaflet's
   transformed popup layer on HiDPI screens. */
.metro-logo {
  display: inline-block;
  height: 18px;
  vertical-align: middle;
  margin-right: 4px;
}
.metro-logo svg { height: 18px; width: auto; display: block; }

/* ══════════════════════════════════════════════════════════
   NAV MODAL
══════════════════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.modal[hidden] { display: none; }

.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  max-width: 360px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  border: 1px solid var(--color-border);
  animation: slideUp 0.18s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--color-border); color: var(--color-text); }

.modal-box h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.modal-place-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  color: var(--color-text);
}

.modal-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.nav-options { display: flex; flex-direction: column; gap: 6px; }

.nav-option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}

.nav-option-btn:hover {
  background: var(--color-text);
  border-color: var(--color-text);
  color: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
  backdrop-filter: blur(4px);
}
.modal-backdrop[hidden] { display: none; }

/* ══════════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════════ */
.site-footer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding: 12px var(--content-px);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.footer-meta {
  font-size: 0.7rem;
  color: var(--color-text-light);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.footer-meta a {
  color: var(--color-text-muted);
  text-decoration: none;
}
.footer-meta a:hover { color: var(--color-accent); }

.footer-sep { color: var(--color-text-light); }

/* ══════════════════════════════════════════════════════════
   MOBILE REDESIGN — DESKTOP GUARDS
   ──────────────────────────────────────────────────────────
   Every element the ≤768px redesign introduces is hidden here so the
   desktop layout stays exactly as it was. The mobile block below
   re-enables them.
══════════════════════════════════════════════════════════ */
.place-quick,
.place-actions,
.place-must-mini,
.transport-quick,
.transport-more-toggle,
.acc-teaser,
.acc-chev,
.tip-icon,
.hours-disclaimer,
.map-chips,
.map-sheet { display: none; }

/* Accordion headers are real <button>s (for mobile); on desktop they render
   as the plain headers they replaced and ignore the pointer. */
.acc-toggle {
  background: none;
  border: 0;
  padding: 0;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: default;
  pointer-events: none;
}
.acc-tx { min-width: 0; }

/* Open/closed + walk-time pills. Visible only inside mobile-only containers,
   so they can be styled once here without touching desktop. */
.place-now {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 8px 3px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.place-now::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.place-now.open { color: #0E8A3E; background: #EAF7EF; border: 1px solid #C7EAD5; }
.place-now.open::before { background: #12A550; box-shadow: 0 0 0 3px rgba(18, 165, 80, 0.18); }
.place-now.shut { color: #B23A00; background: #FBEEE6; border: 1px solid #F3D6C4; }
.place-now.shut::before { background: #E06D2B; box-shadow: 0 0 0 3px rgba(224, 109, 43, 0.18); }

.place-walk {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.place-walk svg { width: 14px; height: 14px; flex-shrink: 0; }

/* "from Home" inside the walk pill: a link, not a control. It has to be a
   <button> (it runs JS, it is not a URL), so the button chrome is stripped
   back to an underlined word. */
.walk-home {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--color-border);
  transition: color var(--transition), text-decoration-color var(--transition);
}
.walk-home:hover,
.walk-home:focus-visible { color: var(--color-accent); text-decoration-color: var(--color-accent); }

.place-must-mini {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--color-accent);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE REDESIGN  (≤768px, "line a")
   ──────────────────────────────────────────────────────────
   Implements the claude.ai/design "Mobile Redesign" canvas, options
   1a / 2a / 3a / 4a / 5a, with the home page extended by 1b's location
   card and Start-exploring tiles:

   - The top tab strip is replaced by a fixed bottom tab bar + a red
     floating Map button.
   - Home: full-bleed photo, oversized serif headline, a floating glass
     "your stay" card, then location + shortcuts below the fold.
   - Eat/Sights: dense list rows (photo, open-now pill, walk time, one
     tap for directions). Descriptions and address pills are desktop-only.
   - Transport/Tips: quick-answer tiles + accordions instead of walls of
     text. Emergency numbers become large call buttons.
   - Map: floating filter chips + a draggable places sheet.

   Everything is scoped to this block (plus the desktop guards above), so
   deleting both restores the previous mobile layout without touching
   desktop.
══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --content-px: 1rem; --bottom-nav-h: env(safe-area-inset-bottom, 0px); }

  .leaflet-control-zoom { display: none !important; }

  /* The panel's side borders read as a thin light outline against the dark
     hero at screen edges. Full-bleed on mobile instead. */
  .tab-panel { border-left: 0; border-right: 0; }

  /* Content panels take their natural height — no forced fill. A page that is
     shorter than the screen simply doesn't scroll (see the body rule below);
     a page that overflows (e.g. Tips with an accordion open) scrolls. The
     grey background that used to show below a short white panel is gone because
     the body is painted with the surface colour on mobile. */
  .tab-panel:not(.map-panel):not(#tab-home) {
    /* Trim the bottom padding: the wide 2rem gap under the (divider-less) last
       list row made that row read as taller than the rest. This keeps it a
       comfortable, even distance above the nav. */
    padding-bottom: var(--space-md);
  }

  /* Footer removed on mobile (redesign feedback). */
  .site-footer { display: none; }

  body {
    /* Cover the gesture-indicator strip with our own surface. */
    padding-bottom: var(--bottom-nav-h);
    /* Track the *current* viewport, not the large (URL-bar-hidden) one. The
       base `min-height: 100vh` resolves to the large viewport on mobile, so
       while the URL bar is showing the body was taller than the visible screen
       and short pages scrolled into empty space. dvh matches the visible area,
       so a page that fits is exactly one screen (locked, no scroll) and only a
       page that overflows (e.g. Tips with a dropdown open) scrolls. */
    min-height: 100dvh;
    /* Paint the leftover space below a short panel with the panel's own colour
       so it reads as one continuous surface instead of a grey strip (this
       replaces the old min-height fill on the panels). */
    background: var(--color-surface);
  }
  body.map-active { padding-bottom: 0; }

  /* ── Tab headers: eyebrow-less serif title, intros dropped for density ── */
  .tab-header { margin-bottom: var(--space-sm); padding-bottom: 0; border-bottom: 0; }
  .tab-header h2 { font-size: 1.9rem; letter-spacing: -0.02em; line-height: 1.05; margin-bottom: 0; }
  .tab-header .tab-intro { display: none; }
  .tab-header.has-filter { margin-bottom: var(--space-sm); }

  /* ── Filters: scrollable chip row (2a) ── */
  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 8px;
    margin: 0 calc(-1 * var(--content-px));
    padding: 4px var(--content-px) 12px;
    border-bottom: 1px solid var(--color-border);
  }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-btn {
    flex: none;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 7px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface);
    color: var(--color-text-muted);
    white-space: nowrap;
  }
  .filter-btn.active {
    background: var(--color-text);
    border-color: var(--color-text);
    color: #fff;
  }

  /* ── Eat & Sights: compact list rows (2a) ── */
  .place-grid { display: block; }
  .place-group { margin: 18px 0 2px; font-size: 0.68rem; }
  .place-group:first-child { margin-top: 6px; }

  .place-card {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 13px;
    align-items: center;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--color-border-light);
    border-radius: 0;
    overflow: visible;
    padding: 14px 0;
    margin: 0;
  }
  .place-card:hover { transform: none; box-shadow: none; }
  .place-card:last-child { border-bottom: 0; }
  .place-card.featured::before { display: none; }

  .place-img {
    width: 56px;
    height: 56px;
    aspect-ratio: 1;
    border-radius: 12px;
  }
  .place-img .place-badge { display: none; }
  .place-img-mono { font-size: 1.4rem; }

  .place-body { padding: 0; gap: 0; }
  /* Price sits right after the name instead of floating to the far right. */
  .place-title-row { justify-content: flex-start; gap: 7px; align-items: baseline; }
  .place-name { font-size: 0.95rem; line-height: 1.05; }
  .place-price { font-size: 0.8rem; }
  /* Category hugs the title. */
  .place-category-tag { font-size: 0.68rem; margin-top: 0; line-height: 1.1; letter-spacing: 0.04em; }
  .place-desc { display: none; }
  .place-meta { display: none; }

  .place-quick {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
  }
  .place-must-mini { display: inline-block; }

  /* Round action buttons to the right of each list row: call (solid) then
     directions (outline). Call only appears when a phone number exists. */
  .place-actions { display: flex; align-items: center; gap: 8px; }
  .place-callbtn,
  .place-dirbtn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex: none;
  }
  .place-dirbtn {
    background: var(--color-accent-bg);
    border: 1px solid #F5D3D8;
    color: var(--color-accent);
  }
  .place-callbtn {
    background: var(--color-accent);
    border: 1px solid var(--color-accent);
    color: #fff;
    text-decoration: none;
  }
  .place-callbtn:hover { background: var(--color-accent-hover); }
  .place-callbtn svg,
  .place-dirbtn svg { width: 17px; height: 17px; }

  /* Accuracy note, now at the top of Eat & Drink with a disclaimer icon. */
  .hours-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    line-height: 1.45;
    padding: 10px 12px;
    margin-bottom: var(--space-sm);
    background: var(--color-bg-alt);
    border-radius: 10px;
  }
  .hours-disclaimer-ic {
    flex: none;
    width: 15px;
    height: 15px;
    margin-top: 1px;
    color: var(--color-text-light);
  }

  /* ── Accordions (shared by Transport 3a + Tips 4a) ── */
  .acc-toggle {
    pointer-events: auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    margin: 0;
  }
  .acc-tx { flex: 1; text-align: left; }
  .acc-teaser {
    display: block;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .acc-chev { display: block; color: var(--color-text-light); flex: none; transition: transform 0.2s ease; }
  .acc-chev svg { width: 18px; height: 18px; display: block; }
  .acc-item.open .acc-chev { transform: rotate(90deg); }
  .acc-body { display: none; padding: 0 16px 14px 56px; }
  .acc-item.open .acc-body { display: block; }
  .acc-body > p { margin-bottom: 9px; }

  /* ── Transport (3a): quick answers + one accordion per mode ── */
  .transport-quick {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: var(--space-md) 0 var(--space-md);
  }
  .qtile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 13px 10px;
    text-align: center;
  }
  .qtile-k {
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-light);
  }
  .qtile-v {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.3rem;
    line-height: 1.1;
    margin-top: 3px;
  }
  .qtile-v small {
    font-size: 0.66rem;
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-weight: 500;
  }

  .transport-grid {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: var(--space-md);
  }
  .transport-card { background: none; padding: 0; border-top: 1px solid var(--color-border); }
  .transport-card:first-child { border-top: 0; }
  .transport-card:hover { background: none; }

  .transport-head { margin-bottom: 0; }
  .transport-icon {
    width: 26px;
    height: auto;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--color-accent);
  }
  .transport-icon svg { width: 24px; height: 24px; }
  .transport-card h3 {
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
  }
  .transport-card .address-link { margin-top: 4px; }

  /* Tickets + official links collapse behind one toggle (its button is
     display:none on desktop, where the tables show as before). */
  .transport-more {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    overflow: hidden;
  }
  .transport-more-toggle { display: flex; }
  .transport-more-toggle h3 {
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
  }
  .transport-more .acc-body { padding: 0; }
  .transport-more.open .transport-bottom { display: grid; grid-template-columns: 1fr; gap: 0; }
  .transport-more .info-table-wrap {
    border: 0;
    border-radius: 0;
    border-top: 1px solid var(--color-border-light);
  }

  /* ── Tips (4a): big call buttons + accordions ── */
  /* One merged panel, three tappable segments split by hairline dividers,
     rather than three cards with gaps between them. */
  .emergency-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border: 0;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: var(--space-md);
  }
  .emergency-tile {
    display: block;
    text-align: center;
    border: 0;
    border-radius: 0;
    padding: 12px 8px;
    background: var(--color-text);
  }
  .emergency-tile + .emergency-tile { border-left: 1px solid rgba(255, 255, 255, 0.15); }
  .emergency-tile:first-child { background: var(--color-accent); }
  .emergency-tile:hover { background: var(--color-text); opacity: 0.92; }
  .emergency-tile:first-child:hover { background: var(--color-accent-hover); opacity: 1; }
  .emergency-num {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.7rem;
    line-height: 1;
    color: #fff;
  }
  .emergency-label {
    display: block;
    font-size: 0.53rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    opacity: 0.8;
    margin-top: 3px;
  }

  .tips-grid {
    display: block;
    columns: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    overflow: hidden;
  }
  .tip-section {
    background: none;
    border: 0;
    border-top: 1px solid var(--color-border);
    border-radius: 0;
    padding: 0;
    margin: 0;
    break-inside: auto;
  }
  .tip-section:first-child { border-top: 0; }

  .tip-icon {
    display: grid;
    place-items: center;
    width: 26px;
    flex: none;
    color: var(--color-accent);
  }
  .tip-icon svg { width: 24px; height: 24px; }
  .tip-section h3 {
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    border-bottom: 0;
    padding-bottom: 0;
    margin: 0;
  }
  .tip-list li { font-size: 0.82rem; }

  /* Phrase table: reclaim the accordion indent and drop the pronunciation
     column, which never fit a phone width. */
  .tip-section .acc-body .phrase-table {
    margin-left: -40px;
    width: calc(100% + 40px);
    font-size: 0.78rem;
  }
  .phrase-table th:nth-child(3),
  .phrase-table td:nth-child(3) { display: none; }
  .phrase-table th { background: none; }
  .phrase-table tr:hover td { background: none; }

  /* ── Map (5a): filter chips + places sheet ── */
  .tab-panel.map-panel { position: relative; }
  body.map-active .site-footer { display: none; }

  .map-chips {
    display: flex;
    position: absolute;
    /* Absolute positioning resolves against the panel's padding box, which
       starts at its border-box top — so the chips have to clear the fixed page
       bar themselves or they sit underneath it. */
    top: calc(var(--chrome-height) + 10px);
    left: 0;
    right: 0;
    z-index: 900;
    gap: 8px;
    padding: 2px var(--content-px);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .map-chips::-webkit-scrollbar { display: none; }
  .map-chip {
    flex: none;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
  }
  .map-chip.active {
    background: var(--color-text);
    border-color: var(--color-text);
    color: #fff;
  }

  .map-sheet {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    /* --bottom-nav-h is now just the safe-area inset and already includes the
       nav's padding + safe-area inset, so the sheet sits flush on the nav. */
    bottom: var(--bottom-nav-h);
    z-index: 950;
    background: var(--color-surface);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 30px -10px rgba(0, 0, 0, 0.2);
    padding-top: 4px;
    height: 210px;             /* collapsed peek starts higher, shows ~2 rows */
    overflow: hidden;
    transition: height 0.25s ease;
  }
  .map-sheet.expanded { height: min(68%, 470px); }

  .map-sheet-grab {
    display: block;
    width: 100%;
    padding: 8px 0 4px;
    background: none;
    border: 0;
    cursor: grab;
    touch-action: none;
  }
  .map-sheet.dragging { transition: none; }
  .map-sheet.dragging .map-sheet-grab { cursor: grabbing; }
  .map-sheet-grab span {
    display: block;
    width: 38px;
    height: 5px;
    border-radius: 3px;
    background: var(--color-border);
    margin: 0 auto;
  }
  .map-sheet-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 20px 10px;
    border-bottom: 1px solid var(--color-border-light);
    cursor: grab;
    touch-action: none;
  }
  .map-sheet.dragging .map-sheet-head { cursor: grabbing; }
  .map-sheet-head h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; margin: 0; }
  .map-sheet-sub { font-size: 0.68rem; color: var(--color-text-muted); white-space: nowrap; }

  .map-sheet-list { overflow-y: auto; height: calc(100% - 60px); padding-bottom: 8px; overscroll-behavior: contain; }
  .sheet-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--color-border-light);
    cursor: pointer;
  }
  .sheet-row:last-child { border-bottom: 0; }
  .sheet-thumb {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex: none;
  }
  .sheet-thumb svg { width: 20px; height: 20px; }
  .sheet-thumb--eat { background: var(--color-accent-bg); color: var(--color-accent); }
  .sheet-thumb--sights { background: #EAF1FF; color: #2563EB; }
  .sheet-thumb--pharmacy { background: #EAF7EF; color: #0E8A3E; }
  .sheet-thumb--parking { background: #EAF2FD; color: #2F80ED; }
  .sheet-thumb--transit { background: #FDEBEA; color: #EE2926; }
  .sheet-li { flex: 1; min-width: 0; }
  .sheet-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sheet-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
  .sheet-type { font-size: 0.72rem; color: var(--color-text-muted); }
}

@media (max-width: 480px) {
  .transport-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════
   MAP — LIVE USER LOCATION + LOCATE BUTTON
══════════════════════════════════════════════════════════ */
.map-panel { position: relative; }

.map-locate {
  position: absolute;
  z-index: 800;
  top: 78px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  color: var(--color-text);
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.15s ease;
}
.map-locate:hover { background: var(--color-bg-alt); }
.map-locate.has-fix { color: #2563EB; }
.map-locate svg { width: 20px; height: 20px; }

/* Waiting on the first fix — a fix indoors can take several seconds, and a
   button that does nothing visible in that window reads as broken. */
.map-locate.is-seeking { color: #2563EB; }
.map-locate.is-seeking svg { animation: locateSeek 1.1s ease-in-out infinite; }
@keyframes locateSeek {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
/* Denied, timed out or unavailable. Paired with .map-locate-note, which says
   which of the three it was. */
.map-locate.is-error { color: var(--color-accent); border-color: var(--color-accent); }

.map-locate-note {
  position: absolute;
  z-index: 800;
  top: 78px;
  right: 68px;
  max-width: min(260px, calc(100% - 84px));
  margin: 0;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: rgba(17, 17, 17, 0.92);
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.35;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  pointer-events: none;
}
.map-locate-note.show { opacity: 1; visibility: visible; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .map-locate.is-seeking svg { animation: none; }
  .map-locate-note { transition: none; }
}

/* Pulsing blue "you are here" dot. */
.user-dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2563EB;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
  position: relative;
}
.user-dot::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.25);
  animation: userPulse 2s ease-out infinite;
}
@keyframes userPulse {
  0%   { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(2);   opacity: 0; }
}

@media (max-width: 768px) {
  /* Takes the (now hidden) map FAB's old top-right slot on the map tab. */
  .map-locate { top: calc(var(--chrome-height) + 56px); }
  /* The note hangs below the button here rather than beside it — there isn't
     room for both on a phone-width row. */
  .map-locate-note {
    top: calc(var(--chrome-height) + 108px);
    right: 16px;
    left: 16px;
    max-width: none;
  }
  /* Get out of the way once the places sheet is dragged up. */
  .map-panel:has(.map-sheet.expanded) .map-locate,
  .map-panel:has(.map-sheet.expanded) .map-locate-note { opacity: 0; pointer-events: none; }
}

/* ══════════════════════════════════════════════════════════
   PAGE BAR
   The tiled home is the whole menu, so sub-pages carry a single slim bar:
   back, title, language, home. Fixed, and its measured height lands in
   --chrome-height (syncChromeHeight in js/app.js) for the map panel.
══════════════════════════════════════════════════════════ */
.page-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px calc(var(--content-px) - 8px);
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.page-bar[hidden] { display: none; }

.pb-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding-left: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pb-btn {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: var(--radius-full);
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--transition);
}
.pb-btn:hover { background: var(--color-bg-alt); }
.pb-btn svg { width: 20px; height: 20px; }

/* The page bar reuses the home language switch, one size down. */
.lang-switch-sm { padding: 2px; flex: none; }
.lang-switch-sm .lang-opt { padding: 3px 7px 3px 4px; font-size: 0.66rem; gap: 4px; }
.lang-switch-sm .lang-flag { width: 16px; height: 12px; }

/* Content clears the fixed bar. Home has no bar, hence the :not(). The map
   excludes itself too: `:not(#tab-home)` carries id specificity, so a plain
   `.tab-panel.map-panel` override loses to it. */
.tab-panel:not(#tab-home):not(.map-panel) {
  padding-top: calc(var(--chrome-height) + var(--space-lg));
}
/* The map sits directly under the bar: no padding gap above it, and it is not
   allowed to slide behind the bar either. */
.tab-panel.map-panel { padding-top: var(--chrome-height); }

/* ══════════════════════════════════════════════════════════
   HOME — TILED MENU  (design A, "Letterhead")
   ──────────────────────────────────────────────────────────
   A glass plate and a glass control bar printed over a photograph of the
   Colosseum, then eight tiles. The glass is deliberately *light* (white at
   high alpha + blur) rather than the usual dark smoked panel: the banner
   artwork is dark-on-transparent and would disappear on a dark plate, and
   dark-on-light is the readable direction over a lit night photo.
══════════════════════════════════════════════════════════ */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

#tab-home {
  padding: 0;
  border-left: 0;
  border-right: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  min-height: calc(100vh - var(--chrome-height));
  min-height: calc(100dvh - var(--chrome-height));
}
body.home-active { background: var(--color-bg); }

/* ── Masthead ──
   Four layers, bottom to top: the photograph, softened; a scrim; the brand
   plate sitting directly on it; the control bar. Nothing between the photo and
   the plate — the plate is not a card. */
.home-masthead {
  position: relative;
  isolation: isolate;
  overflow: hidden;               /* clips the overscanned blur layer */
  display: flex;
  flex-direction: column;
  /* Scales with the viewport so home still fits one screen on a short phone
     (the tiles below claim the rest). */
  min-height: clamp(220px, 34dvh, 300px);
  padding: calc(var(--space-lg) + env(safe-area-inset-top, 0px)) var(--content-px) 0;
  background: #1b1f27;
  color: #fff;
}

/* Layer 1 — the photograph, taken slightly out of focus so it reads as a
   ground rather than a picture. The blur lives on its own layer on purpose:
   `filter` on .home-masthead would blur the logo and the buttons too. The
   negative inset overscans it, because a blur samples past its own edges and
   would otherwise fade out at the sides. */
.home-masthead::before {
  content: '';
  position: absolute;
  inset: -20px;
  z-index: -2;
  background: var(--hero-colosseum) center 58% / cover no-repeat;
  filter: blur(3px);
}

/* Layer 2 — scrim. Lighter at the top where the photo carries itself, heavier
   at the bottom where the glass buttons need something to sit on. */
.home-masthead::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg,
    rgba(9, 9, 11, 0.34) 0%,
    rgba(9, 9, 11, 0.16) 38%,
    rgba(9, 9, 11, 0.58) 100%);
}

/* ── Layer 3: the brand plate, printed straight onto the photo ── */
.home-plate {
  flex: 1;                        /* takes the space above the control bar */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: var(--space-md) 0;
  text-align: center;
}

/* The banner keeps a white ground of its own — the artwork is dark and would
   disappear straight on the photo. (The PNG's own baked-in white was cleared
   by knockout-banner-bg.js so this chip can have rounded corners.) */
.home-mark {
  display: block;
  width: 100%;
  max-width: 240px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: 0 8px 22px rgba(9, 9, 11, 0.30);
}
.home-banner { display: block; width: 100%; height: auto; margin: 0 auto; }
.home-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--color-text);       /* it sits on the white chip */
}

/* Just enough of a ground to stay legible wherever the photo lands. */
.home-kicker {
  display: inline-block;
  margin: 0;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-indent: 0.22em;            /* balance the trailing letter-space */
  text-transform: uppercase;
  font-weight: 600;
  color: #fff;
  background: rgba(9, 9, 11, 0.30);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: var(--radius-full);
  padding: 5px 13px;
}

.home-rule {
  width: 34px;
  height: 2px;
  background: var(--color-accent);
  border-radius: 2px;
  margin: 0;
  box-shadow: 0 1px 4px rgba(9, 9, 11, 0.5);
}

/* ── Language switch: flag + code ──
   Used in the home masthead and, one size down, in the page bar. A flag alone
   names a country, not a language, so the letters stay. */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;                    /* never let a crowded row squeeze it to wrap */
  background: var(--color-bg-alt);
  border-radius: var(--radius-full);
  padding: 3px;
}
.lang-opt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: 4px 9px 4px 5px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.lang-opt.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}
.lang-flag {
  width: 18px;
  height: 13px;
  border-radius: 2px;
  display: block;
  flex: none;
}

/* ── Layer 4: the control bar ──
   Divided off from the plate by a hairline that has to read over a photograph,
   so it is drawn twice: a light line, and a dark one immediately under it. One
   of the two always has contrast, whatever the picture is doing there. */
.home-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-inline: calc(var(--content-px) * -1);
  /* Symmetric. The safe-area inset does *not* belong here: this bar sits in the
     middle of the page with the tiles below it, not against the bottom of the
     screen, so adding the inset only made the bar look bottom-heavy. The tile
     grid carries the inset instead — see the mobile block below. */
  padding: 14px var(--content-px);
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 1px 0 rgba(9, 9, 11, 0.30);
}
.home-actions { display: flex; align-items: center; gap: 8px; }

/* ── Glass ──
   Genuinely translucent, not off-white: a low-alpha white film over a real
   backdrop blur, a bright top edge for the lit rim, and white content so the
   photo behind reads as depth instead of haze. Scoped to .home-controls — the
   same .lang-switch markup also sits in the page bar, where it stays a plain
   grey pill. */
.home-controls .lang-switch,
.home-act {
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.40),
              0 6px 16px rgba(9, 9, 11, 0.26);
}

.home-controls .lang-opt { color: rgba(255, 255, 255, 0.80); }
.home-controls .lang-opt.active {
  background: rgba(255, 255, 255, 0.94);
  color: var(--color-text);
  box-shadow: 0 1px 3px rgba(9, 9, 11, 0.28);
}

.home-act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-full);
  color: #fff;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition);
}
.home-act:hover { background: rgba(255, 255, 255, 0.30); }
.home-act svg { width: 15px; height: 15px; flex: none; }

/* Call and text are icon-only: the glyphs read faster than a label here, and
   three labelled pills would not fit beside the language switch at 360px. */
.home-act-round { width: 38px; height: 38px; justify-content: center; gap: 0; }
.home-act-round svg { width: 17px; height: 17px; }
.home-act-pdf { padding: 0 13px 0 11px; height: 38px; }
/* Both labels share one grid cell and only the inactive one is hidden, so the
   button keeps the wider label's width. A single swapped label resized it by a
   pixel, and that nudged call and text sideways on every language switch. */
.act-label { display: inline-grid; }
.act-label > span { grid-area: 1 / 1; }
html:not([lang="it"]) .act-label .act-it,
html[lang="it"] .act-label .act-en { visibility: hidden; }

/* Below ~380px the four controls stop fitting on one line, so the PDF button
   drops its label and joins the other two as an icon. */
@media (max-width: 380px) {
  .home-act-pdf span { display: none; }
  .home-act-pdf { width: 38px; padding: 0; justify-content: center; gap: 0; }
}

/* ── The tiles ──
   The sheet takes whatever height the masthead leaves, and the grid rows share
   it, so home is exactly one screen with no dead space at the bottom. */
.home-sheet {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.home-tiles {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* min-content, not a pixel floor: rows grow to share the leftover height on
     a tall screen and shrink to exactly what the tile needs on a short one,
     without ever clipping the label. */
  grid-auto-rows: minmax(min-content, 1fr);
  gap: 10px;
  padding: var(--space-md) var(--content-px) var(--space-lg);
}

.home-tile {
  position: relative;
  /* Icon pinned top, label pinned bottom, so a tile still reads correctly
     when the grid stretches it to fill the screen. */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-sm);
  text-align: left;
  border: 1px solid var(--color-border);
  font-family: inherit;
  cursor: pointer;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 13px 13px 14px;
  color: var(--color-text);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.home-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.home-tile:active { transform: translateY(0); }

.ht-ic { display: block; color: var(--color-accent); }
.ht-ic svg { display: block; width: 22px; height: 22px; }

.ht-tx { display: block; }
.ht-t {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.94rem;
  line-height: 1.15;
}
.ht-s {
  display: block;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  line-height: 1.32;
  margin-top: 3px;
}

/* Only the Frequent Questions banner tile shows a chevron. */
.ht-chev { display: none; }
.ht-chev svg { width: 17px; height: 17px; }

/* Frequent Questions leads as a full-width banner row. */
.home-tile[data-tile="faq"] {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  background: var(--color-accent-bg);
  border-color: #F5D3D8;
}
.home-tile[data-tile="faq"] .ht-tx { flex: 1; }
.home-tile[data-tile="faq"] .ht-t { font-size: 1.05rem; }
.home-tile[data-tile="faq"] .ht-chev {
  display: grid;
  place-items: center;
  flex: none;
  color: var(--color-accent);
}

/* Map closes it, full width and inverted. */
.home-tile[data-tile="map"] {
  grid-column: 1 / -1;
  background: var(--color-header-bg);
  border-color: var(--color-header-bg);
  color: #fff;
}
.home-tile[data-tile="map"] .ht-ic { color: #fff; }
.home-tile[data-tile="map"] .ht-s { color: rgba(255, 255, 255, 0.62); }

/* ── Mobile: home is a screen, not a document ──
   Everything below is sized against **svh**, the *small* viewport — the height
   with the browser's chrome visible. That is the state the page first paints
   in and the smallest it will ever be, so a layout that fits it fits every
   other state. `dvh` (what this used) sizes to whatever the chrome happens to
   be doing at first paint and then reflows when it collapses: the page opened
   with the last tile clipped and "fixed itself" once you scrolled. Home cannot
   scroll at all now, so the chrome never collapses either.

   The tightening is **fluid rather than stepped** for the same reason. The old
   `(max-height: 800px)` block never fired on a tall phone, because a height
   media query reads the *large* viewport while the page renders in the small
   one — a 390x844 phone asked for the roomy layout inside ~750px of screen.
   clamp() against svh has no threshold to be wrong about.

   Must sit *after* the tile rules above — same specificity, source order decides. */
@media (max-width: 768px) {
  #tab-home {
    min-height: 0;
    /* body keeps its safe-area padding-bottom, so the panel stops short of it
       and the two together are exactly one screen. */
    height: calc(100vh - var(--bottom-nav-h));      /* pre-svh fallback */
    height: calc(100svh - var(--bottom-nav-h));
    overflow: hidden;
  }
  body.home-active { min-height: 0; height: 100svh; overflow: hidden; }

  .home-masthead {
    min-height: clamp(186px, 27svh, 300px);
    /* max(), not a sum: the inset already *is* the status-bar/notch strip, so
       adding our own padding on top of it spent ~14px of a short screen on
       empty space above a logo that was already clear of the notch. */
    padding-top: max(clamp(10px, 1.9svh, 20px), env(safe-area-inset-top, 0px));
  }
  .home-plate { gap: clamp(4px, 1.1svh, 12px); padding: clamp(4px, 1.1svh, 16px) 0; }
  .home-mark { max-width: clamp(168px, 26svh, 240px); padding: clamp(7px, 1.3svh, 12px) 16px; }
  .home-kicker { padding: clamp(3px, 0.6svh, 5px) 11px; }
  .home-controls {
    padding-top: clamp(9px, 1.8svh, 14px);
    padding-bottom: clamp(9px, 1.8svh, 14px);
  }

  /* min-height:0 lets the flex chain shrink; without it a grid item refuses to
     go below its content and pushes the last tile off the bottom. */
  .home-sheet { min-height: 0; }
  .home-tiles {
    min-height: 0;
    /* No min-content floor: the rows share exactly the height the masthead
       leaves, so the grid can never overflow the screen it is locked to. */
    grid-auto-rows: minmax(0, 1fr);
    gap: clamp(5px, 1.2svh, 10px);
    padding: clamp(6px, 1.4svh, 16px) var(--content-px) clamp(8px, 1.7svh, 24px);
  }
  /* Belt and braces: with the rows sharing a fixed height, a stubborn label on
     a very short screen loses its last pixels inside its own tile instead of
     printing over the tile below. */
  .home-tile {
    padding: clamp(7px, 1.15svh, 13px) 12px;
    gap: clamp(3px, 0.65svh, 8px);
    overflow: hidden;
  }
  .ht-ic svg { width: clamp(15px, 2.4svh, 22px); height: clamp(15px, 2.4svh, 22px); }
  .ht-t { font-size: clamp(0.84rem, 1.75svh, 0.94rem); }
  .ht-s { font-size: clamp(0.63rem, 1.28svh, 0.68rem); line-height: 1.25; }
  .home-tile[data-tile="faq"] .ht-t { font-size: clamp(0.95rem, 2svh, 1.05rem); }
}


/* ══════════════════════════════════════════════════════════
   FREQUENT QUESTIONS
   Accordion so the page reads as a list of questions first; the answer is
   opt-in. Works the same on desktop and mobile (unlike .acc-item, which is
   deliberately inert on desktop).
══════════════════════════════════════════════════════════ */
.faq-list {
  border-top: 1px solid var(--color-border);
  max-width: 68ch;
}

.faq-item { border-bottom: 1px solid var(--color-border); }

.faq-q {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  text-align: left;
  background: none;
  border: 0;
  padding: 16px 0;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}
/* The question is set as a quotation: guests hear it in their own words, and
   the marks themselves are the accent. */
.faq-qt {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.faq-qt::before,
.faq-qt::after {
  color: var(--color-accent);
  font-weight: 700;
}
.faq-qt::before { content: '\201C'; }
.faq-qt::after  { content: '\201D'; }
.faq-chev {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--color-text-light);
  transition: transform 0.18s ease, color var(--transition);
}
.faq-chev svg { width: 18px; height: 18px; }
.faq-q:hover .faq-chev { color: var(--color-accent); }
.faq-item.open .faq-chev { transform: rotate(180deg); color: var(--color-accent); }

.faq-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.22s ease;
}
.faq-item.open .faq-body { grid-template-rows: 1fr; }
/* The wrapper is the grid item, not the paragraph: min-height:0 lets it shrink
   past its content (a grid item defaults to min-height:auto), and overflow
   clips it. The answer's own bottom padding lives inside, so a closed item
   really is 0px tall rather than leaking its padding. */
.faq-body-in { overflow: hidden; min-height: 0; }

/* The answer opens with an em dash, like a reply. Flex rather than a text
   indent so wrapped lines line up with the first word, not under the dash. */
.faq-a {
  display: flex;
  gap: 0.45em;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.65;
  padding: 0 var(--space-xl) 18px 0;
  margin: 0;
}
.faq-dash {
  flex: none;
  color: var(--color-accent);
  font-weight: 600;
}
.faq-at { flex: 1; min-width: 0; }

/* ──────────────────────────────────────────────
   INLINE MARKUP IN AUTHORED COPY
   Produced by inlineMarkup() in js/app.js from the *word* and
   [label](tab:x) shorthands used in data.js.
────────────────────────────────────────────── */
.tx-em {
  font-style: normal;
  font-weight: 600;
  color: var(--color-accent);
}

.tx-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--color-accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(200, 16, 46, 0.35);
  text-underline-offset: 2px;
  transition: text-decoration-color var(--transition);
}
.tx-link:hover { text-decoration-color: var(--color-accent); }

/* ══════════════════════════════════════════════════════════
   WI-FI PAGE
   The QR does the work: no browser API can join a network, but iOS 11+ and
   Android 10+ join straight from a camera scan. The PNG is generated ahead
   of time (generate-wifi-qr.js) so the page works with no connection.
══════════════════════════════════════════════════════════ */
.wifi-page { max-width: 480px; }

.wifi-qr-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}
.wifi-qr {
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.wifi-qr img { width: 100%; height: 100%; object-fit: contain; display: block; }
.wifi-qr-note {
  margin-top: var(--space-md);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  max-width: 34ch;
  margin-inline: auto;
}

.wifi-or {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0 var(--space-md);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-text-light);
}
.wifi-or::before,
.wifi-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.wifi-fields { display: flex; flex-direction: column; gap: var(--space-sm); }

.wifi-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: border-color var(--transition), background var(--transition);
}
.wifi-field:hover { border-color: var(--color-text-light); }
.wifi-field.copied { border-color: var(--color-accent); background: var(--color-accent-bg); }

/* The network name is shown, not copied: you pick it from a list. */
.wifi-field-static { cursor: default; }
.wifi-field-static:hover { border-color: var(--color-border); }

.wf-tx { flex: 1; min-width: 0; }
.wf-k {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-text-light);
}
.wf-v {
  display: block;
  margin-top: 3px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  word-break: break-word;
}

.wf-act {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  color: var(--color-text-light);
}
.wf-act > * { grid-area: 1 / 1; }
.wf-act svg { width: 20px; height: 20px; }
.wf-tick { display: none; color: var(--color-accent); }
.wifi-field.copied .wf-copy { display: none; }
.wifi-field.copied .wf-tick { display: block; }

/* "Copied" flashes over the row rather than reflowing it. */
.wf-said {
  position: absolute;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-accent);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.wifi-field.copied .wf-said { opacity: 1; }

.wifi-help {
  margin-top: var(--space-lg);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}

.wifi-tbc { padding: var(--space-lg) 0; }

/* ── Mobile: one screen, no scroll ──
   Same svh reasoning as home (see the mobile home block): sized to the
   chrome-visible viewport so the page does not open with the title scrolled
   under the bar. The fields and the copy take what they need and **the code
   takes the rest** — a flexible square rather than a fixed 240px, so the page
   fits a short phone by shrinking the one element that can afford it. */
@media (max-width: 768px) {
  #tab-wifi {
    height: calc(100vh - var(--bottom-nav-h));      /* pre-svh fallback */
    height: calc(100svh - var(--bottom-nav-h));
    display: flex;
    flex-direction: column;
    padding-bottom: clamp(10px, 1.8svh, 16px);
  }
  #wifi-body,
  .wifi-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }

  .wifi-or { margin: clamp(10px, 2svh, 24px) 0 clamp(8px, 1.4svh, 16px); }

  .wifi-qr-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(8px, 1.5svh, 16px);
    padding: clamp(12px, 2svh, 24px);
  }
  /* Height comes from the flex remainder, width follows it (aspect-ratio 1),
     so the square never gets wider than the card either. */
  .wifi-qr { flex: 1; min-height: 0; width: auto; max-width: 100%; align-self: center; }
  .wifi-qr img { width: auto; height: 100%; max-width: 100%; }
  .wifi-qr-note { margin-top: 0; }

  .wifi-help { margin-top: clamp(10px, 2svh, 24px); }
}

/* ══════════════════════════════════════════════════════════
   CHECK-IN & CHECK-OUT PAGE
   Also holds the address and contact details, which used to live in the
   Welcome hero and have nowhere else to go now that home is a menu.
══════════════════════════════════════════════════════════ */
.stay-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 480px;
}
.stay-times-tbc { display: block; background: none; padding: var(--space-md); }

.st-cell {
  background: var(--color-surface);
  padding: var(--space-md) var(--space-lg);
}
.st-k {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-text-light);
}
.st-v {
  display: block;
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stay-panel {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--color-border);
  max-width: 68ch;
}
.stay-panel:last-child { border-bottom: 0; }
.stay-luggage { margin-top: var(--space-md); border-top: 1px solid var(--color-border); }

.sp-ic {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--color-accent-bg);
  color: var(--color-accent);
}
.sp-ic svg { width: 18px; height: 18px; }

.stay-panel h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 5px;
}
.stay-panel p {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}
.stay-panel .address-link { margin-top: var(--space-sm); }
.stay-panel .contact-line { margin-top: 2px; }

/* Shared by the stay page and any generated copy that calls pending(). */
.contact-line { font-size: 0.95rem; }
.contact-line a { font-weight: 500; }
.contact-sep { margin: 0 8px; color: var(--color-text-light); }

.info-pending {
  display: inline-block;
  padding: 3px 10px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
}

/* ══════════════════════════════════════════════════════════
   HOME + NEW PAGES — DESKTOP
══════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  .home-masthead { padding-left: var(--content-px); padding-right: var(--content-px); }
  .home-sheet { flex: none; }
  .home-tiles {
    flex: none;
    grid-auto-rows: auto;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    padding: var(--space-xl) var(--content-px) var(--space-2xl);
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
  }
  .home-tile { padding: var(--space-md) var(--space-md) var(--space-lg); }
  .ht-t { font-size: 1.02rem; }
  .home-tile { gap: var(--space-lg); }
  .ht-s { font-size: 0.75rem; }
  .ht-ic svg { width: 24px; height: 24px; }

  /* More photo above and below the plate on a wide screen, and a touch more
     blur since the image is scaled up further here. */
  .home-masthead { min-height: 360px; }
  .home-masthead::before { filter: blur(5px); }
  .home-plate { gap: var(--space-md); padding: var(--space-xl) 0; }
  .home-mark { max-width: 300px; padding: 14px 20px; }
  .home-kicker { font-size: 0.64rem; }
  .home-controls { padding-top: var(--space-md); padding-bottom: var(--space-md); }

  /* Five columns, because the two banner tiles each take two: 2+1+1+1 on the
     first row, 1+1+1+2 on the second. Four columns would leave the Map tile
     alone on a third row with two empty cells beside it. */
  .home-tiles { grid-template-columns: repeat(5, 1fr); }
  .home-tile[data-tile="faq"],
  .home-tile[data-tile="map"] { grid-column: span 2; }

  .page-bar { padding-left: max(var(--content-px), calc((100vw - var(--max-width)) / 2)); }
  .faq-qt { font-size: 1.1rem; }
  .faq-a { font-size: 0.95rem; }
}

/* ══════════════════════════════════════════════════════════
   PRINT / PDF
══════════════════════════════════════════════════════════ */
@media print {
  .page-bar, .home-masthead, .filter-row,
  .nav-btn, .modal, .modal-backdrop, .map-panel, #tab-map { display: none !important; }

  body { background: #fff; font-size: 10pt; }

  .tab-panel { display: block !important; page-break-before: always; padding: 20pt; }
  .tab-panel:first-child { page-break-before: avoid; }

  .place-card { page-break-inside: avoid; }
  a { text-decoration: none; color: inherit; }
}

/* ══════════════════════════════════════════════════════════
   HIGH CONTRAST & REDUCED MOTION
══════════════════════════════════════════════════════════ */
@media (prefers-contrast: high) {
  :root { --color-border: #888; --color-text-muted: #333; }
  .place-card { border-bottom-width: 2px; }
}

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