/* Page sections and shared components, in page order. */

/* ---------- Pills (shared) ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 20px;
  border: var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.pill--dark {
  background: var(--ink);
  color: var(--bg);
}

a.pill:hover {
  background: var(--tint);
}

a.pill--dark:hover {
  background: #2E2E48;
}

/* ---------- Top bar ---------- */

/* One top bar for every public page, identical on each: full width, the
   page gutter on both sides (or the notch's inset, if larger), a rule
   under it. It sticks to the top of pages that scroll; the background
   hides what scrolls underneath. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding:
    max(12px, env(safe-area-inset-top))
    max(var(--gutter), env(safe-area-inset-right))
    12px
    max(var(--gutter), env(safe-area-inset-left));
  border-bottom: var(--border);
  background: var(--bg);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

/* Hall of Fame and About, beside the wordmark. */
.tabs {
  display: flex;
  gap: 4px;
}

.tabs__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 16px;
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.tabs__link:hover {
  border-color: var(--ink);
  background: var(--card);
}

.tabs__link[aria-current="page"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

/* One row on wide screens: the search takes what's left, down to 160px. */
.search {
  position: relative;
  flex: 1 1 160px;
  max-width: 520px;
  margin-left: auto;
}

.search__icon {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  pointer-events: none;
}

.search__input {
  width: 100%;
  min-height: 48px;
  padding: 0 20px 0 46px;
  border: var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
}

.search__input::placeholder {
  color: var(--muted);
  opacity: 1;
}

@media (max-width: 640px) {
  .topbar {
    column-gap: 12px;
  }

  .wordmark {
    gap: 8px;
    font-size: 20px;
  }

  .wordmark__icon {
    width: 28px;
    height: 28px;
  }
}

/* Too narrow for one row: the wordmark and "Report one" on top; the tabs
   and search share the second row. The ::after is the line break. */
@media (max-width: 900px) {
  .topbar {
    row-gap: 8px;
  }

  .topbar::after {
    content: "";
    order: 2;
    flex-basis: 100%;
  }

  .tabs {
    order: 3;
  }

  .tabs__link {
    padding: 0 12px;
    border-color: var(--ink);
    background: var(--card);
  }

  .search {
    order: 4;
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    margin-left: 0;
  }

  .search__input {
    padding-right: 12px;
    text-overflow: ellipsis;
  }

  .topbar .pill--dark {
    order: 1;
    margin-left: auto;
  }
}

/* ---------- Page ---------- */

/* The pages other than the map: their content starts at the same left edge
   as the top bar's wordmark, with the same gutters, up to --page-wide. */
.page {
  padding:
    0
    max(var(--gutter), env(safe-area-inset-right))
    0
    max(var(--gutter), env(safe-area-inset-left));
}

.page > main,
.page > .footer {
  max-width: var(--page-wide);
}

/* Anchored sections stop just below the sticky top bar. */
.section {
  scroll-margin-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ---------- Map-first home: app shell, stage and sheet ---------- */

/* The home and place pages fill the screen exactly: the top bar, then the
   stage (the map with the sheet over it). Nothing scrolls but the sheet.
   dvh follows the browser's toolbars; vh is the fallback. */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app > .topbar {
  flex: none;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

/* Wider screens: the sheet is a card docked on the left, full height. */
.sheet {
  position: absolute;
  z-index: 5;
  top: 16px;
  bottom: 16px;
  left: max(16px, env(safe-area-inset-left));
  width: min(var(--sheet-w), calc(100% - 32px));
  display: flex;
  flex-direction: column;
  border: var(--border);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 6px 0 var(--ink);
  overflow: hidden;
}

.sheet__grip {
  display: none;
}

.sheet__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px;
}

/* Phones: a bottom sheet with three heights. sheet.js moves it (and lets
   it be dragged); these rules place it when JavaScript doesn't run. */
@media (max-width: 640px) {
  .sheet {
    top: 12px;
    bottom: 0;
    left: 0;
    width: 100%;
    padding-bottom: env(safe-area-inset-bottom);
    border-width: var(--border-width) 0 0;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -6px 24px rgba(26, 26, 46, .18);
    transform: translateY(var(--sheet-y, 0));
    transition: transform .3s cubic-bezier(.2, .8, .2, 1);
    will-change: transform;
  }

  .sheet[data-snap="peek"] {
    --sheet-y: calc(100% - var(--sheet-peek) - env(safe-area-inset-bottom));
  }

  .sheet[data-snap="half"] {
    --sheet-y: 45%;
  }

  /* Follows the finger exactly while dragged. */
  .sheet--dragging {
    transition: none;
  }

  .sheet--dragging .sheet__handle {
    cursor: grabbing;
  }

  /* Dragged by its grip (and, when not fully open, anywhere on it). */
  .sheet__grip {
    display: block;
    flex: none;
    touch-action: none;
  }

  .sheet__handle {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: var(--touch);
    padding: 0;
    border: 0;
    background: none;
    cursor: grab;
  }

  .sheet__handle::before {
    content: "";
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background: var(--muted);
  }

  .sheet__body {
    padding-top: 0;
  }

  /* Only the fully open sheet scrolls; lower, a swipe moves the sheet. */
  .sheet:not([data-snap="full"]) .sheet__body {
    overflow: hidden;
  }

  .sheet:not([data-snap="full"]) {
    touch-action: none;
  }
}

/* The loading card: hidden until a place request has run for a moment. */
.sheet__skeleton {
  display: none;
}

.sheet.htmx-request .sheet__skeleton {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 14px;
  padding: 22px;
  padding-top: calc(22px + var(--touch) + 8px);
  background: var(--card);
  animation: skeleton-in .2s .15s both;
}

@media (max-width: 640px) {
  .sheet.htmx-request .sheet__skeleton {
    top: var(--touch);
    padding-top: calc(var(--touch) + 8px);
  }
}

.skeleton-bar,
.skeleton-score {
  display: block;
  background: linear-gradient(90deg, var(--tint) 30%, var(--bg) 50%, var(--tint) 70%) 0 0 / 300% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
}

.skeleton-bar {
  height: 14px;
  border-radius: 7px;
}

.skeleton-bar--meta { width: 55%; }
.skeleton-bar--title { width: 80%; height: 30px; border-radius: 10px; }
.skeleton-bar--sign { width: 60%; height: 34px; border-radius: 10px; }
.skeleton-bar--line { width: 100%; }
.skeleton-bar--short { width: 70%; }

.skeleton-score {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

@keyframes skeleton-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes skeleton-shimmer {
  to { background-position: -300% 0; }
}

/* The sheet's content. */
.sheet .intro {
  display: block;
  padding: 0;
}

.sheet .intro__title {
  font-size: 44px;
  margin-bottom: 16px;
}

/* Wider screens: the whole headline on one line. It's about 11.5 times its
   font size wide (a little more at small sizes); where the sheet is
   narrower than that needs, plus its 48px of padding and border, the type
   shrinks to fit. 11.9 leaves a few pixels to spare. */
@media (min-width: 641px) {
  .sheet .intro__title {
    font-size: min(44px, calc((var(--sheet-w) - 48px) / 11.9));
    white-space: nowrap;
  }

  .sheet .intro__line {
    display: inline;
  }
}

.sheet .intro__body {
  font-size: 17px;
  margin-bottom: 20px;
}

.sheet .section__title {
  font-size: 32px;
}

/* Anchors stop at the top of the sheet's scroll area. */
.sheet .section {
  scroll-margin-top: 8px;
}

.sheet-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch);
  margin-bottom: 8px;
  font-weight: 600;
  text-decoration: none;
}

.sheet-back:hover {
  text-decoration: underline;
}

.sheet-footer {
  margin-top: 40px;
  padding: 16px 0 8px;
  border-top: 1px solid var(--rule);
}

/* ---------- Section headings ---------- */

.section__title {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

@media (max-width: 640px) {
  .section__title {
    font-size: 32px;
  }
}

/* ---------- Intro header ---------- */

.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 32px 56px;
  padding: 32px 0 40px;
}

.intro__lede {
  flex: 999 1 620px;
  min-width: 0;
}

.intro__aside {
  flex: 1 1 360px;
  min-width: 0;
}

.intro__kicker {
  margin-bottom: 16px;
}

.intro__title {
  font-size: clamp(44px, 5.4vw, 80px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin-bottom: 24px;
}

.intro__title .alert {
  color: var(--alert);
}

/* Phones: one sentence a line, never wrapped. */
.intro__line {
  display: block;
  white-space: nowrap;
}

.intro__body {
  font-size: 19px;
  margin-bottom: 24px;
}

/* ---------- Grammar pills ---------- */

.grammar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.grammar__pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

.grammar__pill--wrong {
  border-color: var(--alert);
  color: var(--alert);
}

.grammar__pill--wrong s {
  text-decoration-thickness: 2px;
}

/* ---------- Step list ---------- */

.steps {
  display: grid;
  gap: 20px;
  padding: 0;
  list-style: none;
}

.steps__item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.steps__num {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.steps__item strong {
  font-weight: 800;
}

/* ---------- Sample badge ---------- */

.sample-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1.5px dashed var(--muted);
  border-radius: var(--radius-pill);
  color: var(--muted);
}

/* ---------- Hall of Fame ---------- */

.hall {
  padding-top: 32px;
}

.hall__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 20px;
}

.hall__list {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

/* The verdict sits under the name, and the dot centers on both. */
.hall__row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 2px 16px;
  min-height: 60px;
  padding: 10px 18px 10px 12px;
  border: var(--border);
  border-radius: 16px;
  background: var(--card);
  color: inherit;
  text-decoration: none;
}

.hall__row:hover {
  box-shadow: 0 3px 0 var(--ink);
}

.hall__row .score-dot {
  grid-row: span 2;
}

.hall__name {
  font-size: 20px;
  font-weight: 800;
}

.hall__verdict {
  grid-column: 2;
  color: var(--muted);
  font-weight: 600;
}

.score-dot {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

/* ---------- Place tile ---------- */

/* The sheet is the card; the tile is its content. */
.tile {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.tile__name {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.tile__sign {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--placeholder-bg);
  background-image: var(--stripes);
  font-weight: 600;
}

.tile__correction {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 22px;
  font-weight: 800;
}

.tile__wrong s {
  text-decoration-color: var(--alert);
  text-decoration-thickness: 3px;
}

.tile__arrow {
  width: 22px;
  height: 22px;
}

.tile__right {
  color: var(--cobalt);
}

/* A reader's note, shown when the place has no recorded offense. */
.tile__note {
  padding-left: 12px;
  border-left: 3px solid var(--cobalt);
  white-space: pre-line;
}

.tile__score {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tile__score > span:last-child {
  display: grid;
}

.tile__address {
  color: var(--muted);
}

/* ---------- Place photos ---------- */

/* The card's photos: four squares across (the last one says "+N" when
   there are more). A grid, not a sideways scroller: on phones a lowered
   sheet moves with any drag, so a swipe here would fight it. */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  justify-self: stretch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery__item[hidden] {
  display: none;
}

.gallery__link {
  position: relative;
  display: block;
  overflow: hidden;
  border: var(--border);
  border-radius: 10px;
  background: var(--stripes), var(--placeholder-bg);
}

.gallery__img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform .2s ease;
}

.gallery__link:hover .gallery__img {
  transform: scale(1.04);
}

.gallery__more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(26, 26, 46, .6);
  color: var(--bg);
  font-size: 18px;
  font-weight: 600;
}

/* The Hall of Fame's box: the first photo wide, then the rest. */
.gallery--big {
  gap: 12px;
}

.gallery--big .gallery__item--lead {
  grid-column: 1 / -1;
}

.gallery--big .gallery__link {
  border-radius: 16px;
}

.gallery--big .gallery__item--lead .gallery__img {
  aspect-ratio: 4 / 3;
}

@media (prefers-reduced-motion: reduce) {
  .gallery__img {
    transition: none;
  }
}

/* The viewer gallery.js opens: the whole screen, the photo as large as it
   fits, swiped (or stepped with ‹ ›) through a scroll-snap row. */
.viewer {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  overscroll-behavior: contain;
}

.viewer::backdrop {
  background: transparent;
}

.viewer__track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: pan-x;
}

.viewer__track::-webkit-scrollbar {
  display: none;
}

.viewer__slide {
  flex: 0 0 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  padding: max(64px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.viewer__img {
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  background: var(--stripes), var(--placeholder-bg);
}

.viewer__caption {
  max-width: 60ch;
  text-align: center;
  color: rgba(255, 246, 233, .8);
}

.viewer__count {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
}

.viewer__close,
.viewer__nav {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--touch);
  height: var(--touch);
  border: var(--border-width) solid var(--bg);
  border-radius: var(--radius-pill);
  background: rgba(26, 26, 46, .6);
  color: var(--bg);
  font: inherit;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.viewer__nav svg {
  width: 22px;
  height: 22px;
}

.viewer__close:hover,
.viewer__nav:hover:not(:disabled) {
  background: var(--bg);
  color: var(--ink);
}

.viewer__close {
  top: max(10px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
}

.viewer__nav {
  top: 50%;
  translate: 0 -50%;
}

.viewer__nav:disabled {
  opacity: .3;
  cursor: default;
}

.viewer__nav--prev {
  left: max(12px, env(safe-area-inset-left));
}

.viewer__nav--next {
  right: max(12px, env(safe-area-inset-right));
}

/* One photo: nothing to step through. */
.viewer--single .viewer__nav,
.viewer--single .viewer__count {
  display: none;
}

/* ---------- In view (the sheet's list) ---------- */

.area {
  padding-top: 24px;
}

.area__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 12px;
}

.area__title {
  font-size: 24px;
  font-weight: 800;
}

/* While the next list loads. */
.area.htmx-request .hall__list {
  opacity: .55;
  transition: opacity .2s;
}

.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.pager__link:last-child {
  justify-self: end;
}

.pager__count {
  text-align: center;
}

/* ---------- Hall of Fame page ---------- */

.hof {
  padding: 32px 0 16px;
}

.hof__head {
  display: grid;
  justify-items: start;
  gap: 8px;
  margin-bottom: 24px;
}

.hof__lede {
  font-size: 19px;
}

/* The list (narrow) beside the large box (wide). */
.hof__body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  align-items: start;
  gap: 24px;
}

.hof__list {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.hof__row {
  display: grid;
  grid-template-columns: 28px 34px minmax(0, 1fr);
  align-items: center;
  gap: 2px 12px;
  min-height: 60px;
  padding: 10px 16px 10px 12px;
  border: var(--border);
  border-radius: 16px;
  background: var(--card);
  color: inherit;
  text-decoration: none;
}

.hof__row:hover {
  box-shadow: 0 3px 0 var(--ink);
}

.hof__row[aria-current="true"] {
  background: var(--tint);
}

.hof__rank {
  grid-row: span 2;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.hof__row .score-dot {
  grid-row: span 2;
}

.hof__row .hall__verdict {
  grid-column: 3;
}

/* The large box: sticks beside the list on wide screens. */
.hof-detail {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  display: grid;
  gap: 16px;
  justify-items: start;
  padding: 32px;
  border: var(--border);
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 8px 0 var(--ink);
}

.hof-detail__rank {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--bg);
}

.hof-detail__name {
  font-size: clamp(36px, 4vw, 56px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.hof-detail__meter {
  display: grid;
  gap: 12px;
  width: 100%;
}

/* The Cannoli-meter as a ladder: every rung up to the place's is lit in its
   color; the place's own rung is outlined. */
.meter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 0;
  list-style: none;
}

.meter__rung {
  display: flex;
  align-items: flex-end;
  min-height: 56px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--rule);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
}

.meter__rung--lit {
  color: #fff;
}

.meter__rung--here {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.hof-detail__offenses {
  display: grid;
  gap: 24px;
  width: 100%;
  padding: 0;
  list-style: none;
}

.hof-detail__offense {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.hof-detail__offense + .hof-detail__offense {
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.hof-detail__sign {
  padding: 14px 18px;
  font-size: 20px;
}

.hof-detail__correction {
  font-size: 32px;
}

.hof-detail__correction .tile__arrow {
  width: 28px;
  height: 28px;
}

.hof-detail__ruling {
  max-width: 60ch;
  font-size: 19px;
}

.hof-detail__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin: 0;
}

.hof-detail__facts dd {
  margin: 2px 0 0;
  font-weight: 600;
}

.hof-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Narrow screens: the list, then the box under it. */
@media (max-width: 960px) {
  .hof__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .hof-detail {
    position: static;
    scroll-margin-top: calc(var(--header-h) + 16px);
  }
}

@media (max-width: 640px) {
  .hof-detail {
    padding: 22px;
  }

  .meter__rung {
    min-height: 44px;
    padding: 4px;
    font-size: 0;
  }

  .hof-detail__correction {
    font-size: 26px;
  }
}

/* ---------- About ---------- */

.about {
  padding-top: 32px;
}

.about__body {
  max-width: 68ch;
  margin-top: 16px;
  font-size: 18px;
}

.about__subtitle {
  margin: 40px 0 16px;
  font-size: 24px;
  font-weight: 800;
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  margin-top: 64px;
  padding: 32px 0 48px;
  border-top: 1px solid var(--rule);
}

/* ---------- Severity fills ---------- */
/* Background in the Cannoli-meter color for score n. White text passes on all. */

.sev-1 { background-color: var(--sev-1); }
.sev-2 { background-color: var(--sev-2); }
.sev-3 { background-color: var(--sev-3); }
.sev-4 { background-color: var(--sev-4); }
.sev-5 { background-color: var(--sev-5); }

/* ---------- Report one ---------- */

/* The modal the topbar's "Report one" opens: the whole form at once, in two
   columns, sized to fit a laptop screen without scrolling. (Phones get the
   step-by-step version below.) */
.report-dialog {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
}

.report-dialog::backdrop {
  background: rgba(26, 26, 46, .55);
}

.report-dialog__head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: var(--border);
  background: var(--card);
}

.report-dialog__title {
  margin: 0;
  font-size: 1.4rem;
}

.report-dialog__close {
  width: var(--touch);
  height: var(--touch);
  border: var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.report-dialog__close:hover {
  background: var(--tint);
}

.report-page {
  max-width: 880px;
}

.report-form {
  display: grid;
  gap: 8px 32px;
  align-items: start;
  padding: 16px 24px 20px;
}

/* The place (and cuisine) | where it is and photos; then the note and Send
   across both. */
.report-form__col,
.report-form__send {
  display: grid;
  gap: 8px;
  min-width: 0;
}

@media (min-width: 641px) {
  .report-form:not(.report-form--steps):not(.report-form--done) {
    grid-template-columns: 1fr 1fr;
  }

  .report-form__errors,
  .report-form__send {
    grid-column: 1 / -1;
  }
}

.report-form__send-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.report-page .report-form {
  padding: 0;
}

.report-form__label {
  margin-top: 8px;
  padding: 0;
  font-weight: 600;
}

.report-form__input {
  width: 100%;
  min-height: var(--touch);
  padding: 8px 12px;
  border: var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

textarea.report-form__input {
  resize: vertical;
}

.report-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.report-form__group {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.report-form__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-form__choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 14px;
  border: var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.report-form__choice:has(input:checked) {
  background: var(--tint);
}

.report-form__file {
  font: inherit;
}

.report-form__hint {
  margin: 0;
  font-size: .9rem;
}

.report-form__hint--error {
  color: var(--alert);
}

.report-form__previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-form__previews img {
  width: 72px;
  height: 72px;
  border: var(--border);
  border-radius: 8px;
  object-fit: cover;
  background: var(--stripes), var(--placeholder-bg);
}

.report-form__errors {
  padding: 12px 16px;
  border: var(--border-width) solid var(--alert);
  border-radius: 10px;
  color: var(--alert);
}

.report-form__errors p,
.report-form__errors ul {
  margin: 0;
}

/* The spam check: empty (and takes no room) unless Cloudflare needs a
   click, when its widget appears here. */
.report-form__check:empty {
  display: none;
}

.report-form__send-row .report-form__check {
  flex: 1 1 300px;
}

/* A problem, under its field. */
.report-form__error {
  margin: 0;
  color: var(--alert);
  font-weight: 600;
}

.report-form [aria-invalid="true"] {
  border-color: var(--alert);
}

fieldset.report-form__group[aria-invalid="true"] .report-form__choice {
  border-color: var(--alert);
}

.report-form__submit {
  margin-left: auto;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.report-form__submit:disabled {
  opacity: .5;
  cursor: progress;
}

.report-form--done {
  justify-items: start;
}

.report-form__thanks {
  margin: 0;
}

/* ---------- A modal in steps (phones) ---------- */

/* Full screen, one short step at a time: header (Back, title, "2 of 5",
   Close), the step, the spam check where needed, and the primary button
   pinned to the bottom. report.js sizes it to the visual viewport
   (--vv-height, --vv-top) so the button stays above the on-screen
   keyboard; dvh is the fallback. */
.report-dialog--steps {
  position: fixed;
  inset: 0;
  top: var(--vv-top, 0);
  width: 100%;
  max-width: none;
  height: 100vh;
  height: var(--vv-height, 100dvh);
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

.report-form--steps {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 100%;
  padding: 0;
  gap: 0;
}

.steps-modal__head {
  flex: none;
  display: grid;
  grid-template-columns: var(--touch) 1fr var(--touch);
  align-items: center;
  gap: 4px 8px;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  border-bottom: var(--border);
  background: var(--card);
}

.steps-modal__icon {
  display: grid;
  place-items: center;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

span.steps-modal__icon {
  border-color: transparent;
}

.steps-modal__titles {
  text-align: center;
}

.steps-modal__title {
  font-size: 1.25rem;
  line-height: 1.2;
}

.steps-modal__count {
  font-size: 12px;
}

.steps-modal__dots {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps-modal__dots li {
  width: 24px;
  height: 4px;
  border-radius: 2px;
  background: var(--rule);
}

.steps-modal__dots .is-done {
  background: var(--muted);
}

.steps-modal__dots .is-current {
  background: var(--ink);
}

/* The step. Sized to fit without scrolling; it only scrolls if the
   keyboard leaves too little room. */
.steps-modal__body {
  flex: 0 1 auto;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
}

.steps-modal__body .report-form__row {
  grid-template-columns: 1fr;
  gap: 8px;
}

/* The spam check sits outside the swapped step, so it survives moving
   between steps. */
.steps-modal__check {
  flex: none;
  padding: 0 max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
}

/* Takes the spare height, so the button stays at the bottom. */
.steps-modal__foot {
  flex: none;
  margin-top: auto;
  padding: 12px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border-top: var(--border);
  background: var(--card);
}

.steps-modal__primary {
  width: 100%;
  min-height: 52px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.steps-modal__primary:disabled {
  opacity: .5;
  cursor: progress;
}
