/* Secondary screens — ที่เที่ยว · เช็กอิน · พาสปอร์ต · ฉัน
 *
 * Shared chrome for the four screens hanging off the bottom nav. They reuse the home
 * screen's cards, chips, rails and rhythm from styles.css; only what does not exist on
 * /home is defined here. Loaded by every page, because the easy-mode block at the end
 * changes the home screen too. */

.page-head,
.view-switch,
.place-list-panel,
.map-panel,
.scan-section,
.checkin-success,
.nearby-checkin,
.stamps,
.memories,
.reward-teaser,
.profile,
.saved,
.settings {
  position: relative;
  background: var(--color-canvas);
}

.page-head {
  display: grid;
  padding-block: var(--space-sm) var(--space-xs);
  padding-inline: var(--space-gutter);
  gap: var(--space-3xs);
  justify-items: start;
}

.page-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 6vw, 1.625rem);
  font-weight: 700;
  line-height: var(--lh-display);
  letter-spacing: -0.01em;
}

.page-head p {
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

/* The wordmark shrinks on secondary screens: the page title carries the identity
 * there, and two full-size titles on one screen read as a mistake. */
.wordmark--compact {
  font-size: clamp(1.25rem, 6vw, 1.5rem);
}

.wordmark--compact::after {
  content: none;
}

.icon-button--ghost {
  display: block;
  width: var(--size-control);
  height: var(--size-control);
  background: none;
  box-shadow: none;
}

/* List / map is one control with two states, so it is a segmented pair rather than
 * two loose buttons (Bloomberg Connects, Michelin). */
.view-switch {
  display: grid;
  margin-inline: var(--space-gutter);
  padding: var(--space-3xs);
  gap: var(--space-3xs);
  grid-template-columns: 1fr 1fr;
  border: var(--rule-hair) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
}

.view-button {
  display: inline-flex;
  min-height: 2.25rem;
  gap: var(--space-2xs);
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.view-button .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.view-button[aria-pressed="true"] {
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-control);
}

/* Full-width rows, not the home screen's rail cards: this screen is for scanning a
 * list, so the photo shrinks and the name takes the width. */
.place-list {
  display: grid;
  margin: 0;
  padding-inline: var(--space-gutter);
  padding-block-end: var(--space-xs);
  gap: var(--space-xs);
  list-style: none;
}

.place-row {
  position: relative;
}

.place-row__link {
  display: grid;
  overflow: hidden;
  gap: var(--space-sm);
  grid-template-columns: 5.5rem minmax(0, 1fr);
  align-items: stretch;
  border-radius: var(--radius-tile);
  background: var(--color-surface);
  box-shadow: var(--shadow-control);
  color: inherit;
  text-decoration: none;
}

.place-row__photo {
  display: block;
  overflow: hidden;
}

.place-row__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.place-row__body {
  display: grid;
  padding-block: var(--space-xs);
  padding-inline-end: 3rem;
  gap: 0.15rem;
  align-content: center;
}

.place-row__name {
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-heart--row {
  inset-block-start: 50%;
  inset-inline-end: 0.35rem;
  translate: 0 -50%;
  background: var(--color-surface);
}

/* The map is the point of this panel, so it takes a tall fixed block rather than an
 * aspect ratio that collapses on short phones. */
.map-panel {
  display: grid;
  padding-inline: var(--space-gutter);
  padding-block-end: var(--space-xs);
  gap: var(--space-xs);
}

.map-full,
.map-fallback {
  min-height: 22rem;
  overflow: hidden;
  border-radius: var(--radius-tile);
  background: color-mix(in srgb, var(--color-tint-chill) 42%, var(--color-surface));
  box-shadow: var(--shadow-control);
}

/* MapLibre measures its container on construction, so the map host is always laid out.
 * The drawn plate is the failure state instead: hidden by default, shown only if the
 * tile archive cannot be read. */
.map-fallback {
  display: none;
}

.map-shell[data-map-state="error"] + .map-fallback {
  display: grid;
  padding: var(--space-sm);
  gap: var(--space-xs);
  place-items: center;
}

.map-fallback svg {
  width: 100%;
  max-width: 15rem;
  height: auto;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-fallback__note {
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
  text-align: center;
}

.map-legend {
  display: flex;
  margin: 0;
  padding: 0;
  gap: var(--space-sm);
  flex-wrap: wrap;
  list-style: none;
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
}

.map-legend li {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  border: var(--rule-hair) solid var(--color-ink);
  border-radius: 50%;
}

.dot--food { background: var(--color-tint-food); }
.dot--oldtown { background: var(--color-tint-oldtown); }
.dot--merit { background: var(--color-tint-merit); }
.dot--photo { background: var(--color-tint-photo); }
.dot--chill { background: var(--color-tint-chill); }

.map-note,
.fine-note {
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
  line-height: 1.5;
}

.fine-note {
  padding-inline: var(--space-gutter);
  padding-block-start: var(--space-2xs);
}

/* The live map lives on ที่เที่ยว only. MapLibre is ~250 KB of script and the home
 * screen has a 200 KB budget, so /home keeps the drawn plate and links here. */
.map-shell {
  position: relative;
}

.map-pin {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 2px solid var(--color-ink);
  border-radius: 50%;
  background: var(--pin, var(--color-tint-food));
  box-shadow: var(--shadow-control);
  cursor: pointer;
  transition: transform var(--dur-short) var(--ease-out);
}

.map-pin.is-active {
  border-width: 3px;
  transform: scale(1.35);
}

.map-pin:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* The selected place rides over the map as a sheet, the way every map app does it. */
.map-place-card {
  position: absolute;
  z-index: 2;
  inset-inline: var(--space-xs);
  inset-block-end: var(--space-xs);
  display: grid;
  padding: var(--space-sm) var(--space-sm) var(--space-xs);
  gap: 0.15rem;
  border-radius: var(--radius-tile);
  background: var(--color-surface);
  box-shadow: var(--shadow-float);
}

.map-place-card[hidden] {
  display: none;
}

.map-place-card__close {
  position: absolute;
  inset-block-start: 0.15rem;
  inset-inline-end: 0.35rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-ink-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.map-place-card__name {
  padding-inline-end: 2rem;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
}

.map-place-card__meta {
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
}

.map-place-card__nav {
  justify-self: start;
  margin-block-start: var(--space-2xs);
  min-height: 2.25rem;
  padding-inline: var(--space-md);
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

/* MapLibre's own chrome, brought into the palette. */
.maplibregl-ctrl-group {
  border-radius: var(--radius-control) !important;
  background: var(--color-surface) !important;
  box-shadow: var(--shadow-control) !important;
}

.maplibregl-ctrl-attrib {
  background: color-mix(in srgb, var(--color-surface) 82%, transparent) !important;
  font-size: 0.6875rem;
}

/* เช็กอิน: a viewfinder that is honest about being a mockup. */
.scan-section {
  display: grid;
  padding-inline: var(--space-gutter);
  gap: var(--space-sm);
}

.scan-frame {
  position: relative;
  display: grid;
  aspect-ratio: 1 / 1;
  max-height: 17rem;
  padding: var(--space-md);
  gap: var(--space-2xs);
  place-content: center;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface-sunken);
  text-align: center;
}

.scan-frame[data-state="done"] {
  border-style: solid;
  border-color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 8%, var(--color-surface));
}

.scan-corner {
  position: absolute;
  width: 2.25rem;
  height: 2.25rem;
  border: 3px solid var(--color-primary);
}

.scan-corner--tl { inset-block-start: 1rem; inset-inline-start: 1rem; border-width: 3px 0 0 3px; border-radius: 0.75rem 0 0 0; }
.scan-corner--tr { inset-block-start: 1rem; inset-inline-end: 1rem; border-width: 3px 3px 0 0; border-radius: 0 0.75rem 0 0; }
.scan-corner--bl { inset-block-end: 1rem; inset-inline-start: 1rem; border-width: 0 0 3px 3px; border-radius: 0 0 0 0.75rem; }
.scan-corner--br { inset-block-end: 1rem; inset-inline-end: 1rem; border-width: 0 3px 3px 0; border-radius: 0 0 0.75rem 0; }

.scan-hint {
  font-size: var(--text-sm);
  font-weight: 600;
}

.scan-sub {
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
}

.wide-button {
  display: flex;
  min-height: var(--size-control);
  padding-inline: var(--space-md);
  gap: var(--space-xs);
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.wide-button .icon {
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
}

.wide-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* The payoff moment: one card, centred, the one place the product raises its voice. */
.checkin-success {
  padding-inline: var(--space-gutter);
  padding-block-start: var(--space-sm);
}

.success-card {
  display: grid;
  padding: var(--space-md) var(--space-sm) var(--space-sm);
  gap: var(--space-2xs);
  justify-items: center;
  border: var(--rule-card) solid color-mix(in srgb, var(--color-success) 35%, var(--color-surface));
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.stamp-badge svg {
  width: 4.5rem;
  height: 4.5rem;
}

.sb-ring {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 2.5;
}

.sb-ring--inner {
  stroke-dasharray: 3 5;
  stroke-width: 1.5;
}

.sb-art {
  color: var(--color-primary);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.success-kicker {
  color: var(--color-success);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.success-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  line-height: var(--lh-title);
}

.success-line {
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.success-count {
  font-size: var(--text-xs);
  font-weight: 600;
}

.success-actions {
  display: flex;
  padding-block-start: var(--space-2xs);
  gap: var(--space-xs);
  flex-wrap: wrap;
  justify-content: center;
}

.ghost-button {
  min-height: 2.25rem;
  padding-inline: var(--space-md);
  border: var(--rule-hair) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.checkin-list,
.setting-list,
.memory-list {
  display: grid;
  margin: 0;
  padding-inline: var(--space-gutter);
  gap: var(--space-2xs);
  list-style: none;
}

.checkin-row {
  display: flex;
  min-height: var(--size-control);
  padding: var(--space-xs) var(--space-sm);
  gap: var(--space-sm);
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-tile);
  background: var(--color-surface);
  box-shadow: var(--shadow-control);
}

.checkin-row__body {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 0.1rem;
}

.checkin-row__name {
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip--done {
  display: inline-flex;
  gap: 0.2rem;
  align-items: center;
  background: var(--color-surface-sunken);
  color: var(--color-ink-muted);
}

.chip--done .icon {
  width: 0.8rem;
  height: 0.8rem;
  stroke-width: 3;
}

.chip--open,
.chip--soon,
.chip--done {
  white-space: nowrap;
}

/* พาสปอร์ต: the page version of the home card, plus the book itself. */
.passport--page .passport-card {
  gap: var(--space-xs);
}

.passport-ring--lg {
  width: 5rem;
  height: 5rem;
}

.passport-tier {
  font-size: var(--text-xs);
}

.passport-tier strong {
  font-family: var(--font-display);
  font-size: var(--text-base);
}

.tier-track {
  position: relative;
  z-index: 1;
  display: flex;
  padding-block-start: var(--space-2xs);
  gap: var(--space-2xs);
  align-items: center;
  justify-content: space-between;
}

.tier {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: var(--rule-hair) dashed var(--color-border);
  border-radius: 50%;
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
  font-weight: 700;
}

.tier.is-done {
  border-style: solid;
  border-color: var(--color-primary-bright);
  background: var(--color-primary-bright);
  color: var(--color-on-primary);
}

.tier.is-next {
  border-style: solid;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.stamp-grid {
  display: grid;
  margin: 0;
  padding-inline: var(--space-gutter);
  gap: var(--space-xs);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  list-style: none;
}

/* A stamp slot is a perforated disc: filled ones carry the place's motif, empty ones
 * keep the dashed edge so the book reads as unfinished, not broken. */
.stamp {
  display: grid;
  padding: var(--space-2xs) 0.15rem;
  gap: 0.15rem;
  place-items: center;
  border: var(--rule-hair) dashed var(--color-border);
  border-radius: var(--radius-tile);
  background: var(--color-surface);
  color: var(--color-ink-muted);
  text-align: center;
}

.stamp .icon {
  width: 1.35rem;
  height: 1.35rem;
  stroke-width: 1.7;
}

.stamp span {
  overflow: hidden;
  max-width: 100%;
  font-size: 0.625rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stamp.is-on {
  border-style: solid;
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-surface));
  background: color-mix(in srgb, var(--color-tint-merit) 45%, var(--color-surface));
  color: var(--color-primary);
}

.stamp.is-on span {
  color: var(--color-ink);
  font-weight: 600;
}

.memory-row {
  display: flex;
  padding: var(--space-2xs) var(--space-sm) var(--space-2xs) var(--space-2xs);
  gap: var(--space-sm);
  align-items: center;
  border-radius: var(--radius-tile);
  background: var(--color-surface);
  box-shadow: var(--shadow-control);
}

.memory-photo {
  display: block;
  width: 3.25rem;
  height: 3.25rem;
  flex: none;
  overflow: hidden;
  border-radius: var(--radius-control);
}

.memory-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-body {
  display: grid;
  min-width: 0;
  gap: 0.1rem;
}

.memory-name {
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reward-teaser {
  padding-inline: var(--space-gutter);
  padding-block: var(--space-xs) var(--space-sm);
}

.reward-card {
  display: flex;
  min-height: 3.5rem;
  padding: var(--space-xs) var(--space-sm);
  gap: var(--space-sm);
  align-items: center;
  border: var(--rule-hair) solid var(--color-border);
  border-radius: var(--radius-tile);
  background: var(--color-surface);
  color: inherit;
  text-decoration: none;
}

.reward-mark {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--color-tint-merit);
  color: var(--color-ink);
}

.reward-mark .icon {
  width: 1.3rem;
  height: 1.3rem;
}

.reward-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 0.1rem;
}

.reward-copy strong {
  font-size: var(--text-sm);
}

.reward-copy span {
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
  line-height: 1.4;
}

/* ฉัน */
.profile {
  display: grid;
  padding-inline: var(--space-gutter);
  gap: var(--space-xs);
}

.profile-card {
  display: flex;
  padding: var(--space-sm);
  gap: var(--space-sm);
  align-items: center;
  border-radius: var(--radius-tile);
  background: var(--color-surface);
  box-shadow: var(--shadow-control);
}

.avatar {
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--color-surface-sunken);
  color: var(--color-ink-muted);
}

.avatar .icon {
  width: 1.6rem;
  height: 1.6rem;
}

.profile-copy {
  display: grid;
  min-width: 0;
  gap: 0.15rem;
}

.profile-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
}

.profile-sub {
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
}

.stat-trio {
  display: grid;
  margin: 0;
  padding: 0;
  gap: var(--space-xs);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
}

.stat-trio li {
  display: grid;
  padding-block: var(--space-xs);
  gap: 0.1rem;
  justify-items: center;
  border-radius: var(--radius-tile);
  background: var(--color-surface);
  box-shadow: var(--shadow-control);
}

.stat-trio strong {
  font-family: var(--font-display);
  font-size: var(--text-md);
  line-height: 1.1;
}

.stat-trio span {
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
}

.setting-row {
  display: flex;
  min-height: 3.25rem;
  padding: var(--space-xs) var(--space-sm);
  gap: var(--space-sm);
  align-items: center;
  border-radius: var(--radius-tile);
  background: var(--color-surface);
  box-shadow: var(--shadow-control);
}

.setting-mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  place-items: center;
  border-radius: var(--radius-control);
  background: var(--color-surface-sunken);
  color: var(--color-ink-muted);
}

.setting-mark .icon {
  width: 1.15rem;
  height: 1.15rem;
}

.setting-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 0.1rem;
  color: inherit;
  text-decoration: none;
}

.setting-name {
  font-size: var(--text-sm);
  font-weight: 600;
}

.setting-sub {
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
  line-height: 1.4;
}

.setting-value {
  flex: none;
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.setting-chevron {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
  color: var(--color-ink-muted);
}

/* A real switch, not a bare checkbox. The control is a full 44 px tall target; the
 * track and knob are painted inside it, so the thing you can hit is bigger than the
 * thing you can see. */
.switch {
  position: relative;
  width: 2.75rem;
  height: var(--size-control);
  flex: none;
  margin: 0;
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
}

.switch::before {
  position: absolute;
  inset-block-start: 50%;
  inset-inline: 0;
  height: 1.6rem;
  border: var(--rule-hair) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
  content: "";
  translate: 0 -50%;
  transition: background-color var(--dur-short) var(--ease-out);
}

.switch::after {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 0.15rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: var(--shadow-control);
  content: "";
  translate: 0 -50%;
  transition: translate var(--dur-short) var(--ease-out);
}

.switch:checked::before {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.switch:checked::after {
  translate: 1.15rem -50%;
}

.switch:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ── One vertical scale for the whole app ────────────────────────────────
 * Measured across all five screens, the gaps had drifted to 3 / 8 / 12 / 16 /
 * 20 / 25 px depending on which element happened to carry padding. Two steps
 * now cover everything:
 *
 *   28 px  between content blocks   (20 above + 8 below, the home screen's step)
 *   12 px  inside a control cluster (search field, view switch, filter chips)
 *
 * Every rule below exists to hit one of those two numbers, so no section has to
 * know what its neighbour does. */
.page-head {
  padding-block: var(--space-sm) var(--space-xs);
}

.search-zone,
.view-switch,
.filter-row {
  padding-block-start: var(--space-sm);
  padding-block-end: 0;
}

/* The last chip row hands over to content, so it closes the cluster. */
.filter-row {
  padding-block-end: var(--space-xs);
}

.place-list-panel,
.map-panel,
.scan-section,
.checkin-success,
.nearby-checkin,
.passport--page,
.stamps,
.memories,
.reward-teaser,
.profile,
.saved,
.settings {
  padding-block: var(--space-section) var(--space-xs);
}

/* Two exceptions, both deliberate: the scan frame is the screen's subject and
 * sits straight under its title, and the reward card is the last thing before
 * the nav bar. */
.scan-section {
  padding-block-start: var(--space-sm);
}

.reward-teaser {
  padding-block-end: var(--space-sm);
}

/* Easy mode is a real product state, not a demo toggle: bigger type, no decoration,
 * flat surfaces. The switch on "ฉัน" writes the same attribute the season flags use,
 * so one control changes every screen. */
html[data-easy="on"] body {
  font-size: 1.0625rem;
}

html[data-easy="on"] .section-swash,
html[data-easy="on"] .section-sparkle,
html[data-easy="on"] .wordmark__sparkles,
html[data-easy="on"] .doodle,
html[data-easy="on"] .photo-sticker,
html[data-easy="on"] .passport-watermark,
html[data-easy="on"] .skyline-divider {
  display: none;
}

html[data-easy="on"] .place-name,
html[data-easy="on"] .setting-name,
html[data-easy="on"] .checkin-row__name,
html[data-easy="on"] .place-row__name {
  font-size: var(--text-base);
}

html[data-easy="on"] .place-meta,
html[data-easy="on"] .place-rating,
html[data-easy="on"] .setting-sub,
html[data-easy="on"] .fine-note {
  font-size: var(--text-xs);
}

/* The bottom nav and the header home button became real links when the app grew past
 * one page. Links bring the user-agent's blue and an underline with them, neither of
 * which belongs on a control that used to be a button. */
.nav-item,
.icon-button,
.wide-button,
.reward-card,
.memory-row {
  text-decoration: none;
}

a.icon-button {
  color: var(--color-ink);
}

a.nav-item {
  color: var(--color-ink-muted);
}

a.nav-item.is-active {
  color: var(--color-primary-bright);
}

/* The active nav item fills its glyph, which reads well for a house or a pin but turns
 * the passport booklet into a solid block — its outline IS the drawing. */
.nav-item--outline.is-active .icon {
  fill: none;
  stroke-width: 2.1;
}

/* ── Bringing the secondary screens up to the home screen ────────────────
 * The four screens below the nav had photography in only one place and no motif
 * layer at all, so they read as a cheaper product than /home. */

/* เช็กอิน: a viewfinder that shows it is looking. One perpetual loop — the screen's
 * only one, and the ceiling allows two. */
.scan-sweep {
  position: absolute;
  z-index: 1;
  inset-inline: 2.5rem;
  inset-block-start: 2.5rem;
  height: 2px;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    to right,
    transparent,
    var(--color-primary-bright),
    transparent
  );
  opacity: 0.85;
}

.scan-doodle {
  width: 5.5rem;
  height: 5.5rem;
  margin-inline: auto;
  margin-block-end: var(--space-2xs);
  color: var(--color-primary);
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.55;
}

.scan-frame[data-state="done"] .scan-sweep {
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  html:not([data-ambient="off"]):not([data-easy="on"]):not([data-season="royal"]):not([data-season="mourning"]) .scan-sweep {
    animation: scan-sweep 2.6s var(--ease-in-out) infinite alternate;
  }
}

@keyframes scan-sweep {
  from { transform: translateY(0); }
  to { transform: translateY(9.5rem); }
}

/* Photographs in the nearby list: the same places already have pictures elsewhere in
 * the app, and a row of pure text was the flattest thing in the product. */
.checkin-row__photo {
  display: block;
  width: 3rem;
  height: 3rem;
  flex: none;
  overflow: hidden;
  border-radius: var(--radius-control);
}

.checkin-row__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.checkin-row {
  padding-inline-start: var(--space-2xs);
}

/* พาสปอร์ต: a stamp is an impression with a date on it, not a labelled tile. */
.stamp {
  position: relative;
  padding-block: var(--space-xs) var(--space-2xs);
}

.stamp.is-on {
  border-style: solid;
}

.stamp.is-on::before {
  position: absolute;
  inset: 0.25rem;
  border: 1px dashed color-mix(in srgb, var(--color-primary) 40%, transparent);
  border-radius: calc(var(--radius-tile) - 0.25rem);
  content: "";
  pointer-events: none;
}

.stamp-date {
  color: var(--color-primary);
  font-size: 0.5625rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

/* The entrance choreography /home has, at a fraction of the length: a page that
 * assembles itself reads as made, not rendered. One-shot, so it costs no budget. */
@media (prefers-reduced-motion: no-preference) {
  html:not([data-entrance="off"]) .page-head {
    animation: enter-fade-down 380ms var(--ease-out) backwards;
  }

  html:not([data-entrance="off"]) .search-zone,
  html:not([data-entrance="off"]) .view-switch,
  html:not([data-entrance="off"]) .filter-row {
    animation: enter-fade-up 420ms var(--ease-out) 120ms backwards;
  }

  html:not([data-entrance="off"]) .scan-frame,
  html:not([data-entrance="off"]) .passport--page .passport-card,
  html:not([data-entrance="off"]) .profile-card,
  html:not([data-entrance="off"]) .map-shell {
    animation: enter-card 460ms var(--ease-out) 180ms backwards;
    animation-timing-function: linear(0, 0.3, 0.65, 0.92, 1.02 70%, 1.002 85%, 1);
  }

  html:not([data-entrance="off"]) .place-row,
  html:not([data-entrance="off"]) .checkin-row,
  html:not([data-entrance="off"]) .setting-row,
  html:not([data-entrance="off"]) .memory-row {
    animation: enter-fade-up 380ms var(--ease-out) backwards;
  }

  html:not([data-entrance="off"]) .place-row:nth-child(1),
  html:not([data-entrance="off"]) .checkin-row:nth-child(1),
  html:not([data-entrance="off"]) .setting-row:nth-child(1),
  html:not([data-entrance="off"]) .memory-row:nth-child(1) { animation-delay: 240ms; }
  html:not([data-entrance="off"]) .place-row:nth-child(2),
  html:not([data-entrance="off"]) .checkin-row:nth-child(2),
  html:not([data-entrance="off"]) .setting-row:nth-child(2),
  html:not([data-entrance="off"]) .memory-row:nth-child(2) { animation-delay: 290ms; }
  html:not([data-entrance="off"]) .place-row:nth-child(3),
  html:not([data-entrance="off"]) .checkin-row:nth-child(3),
  html:not([data-entrance="off"]) .setting-row:nth-child(3),
  html:not([data-entrance="off"]) .memory-row:nth-child(3) { animation-delay: 340ms; }
  html:not([data-entrance="off"]) .place-row:nth-child(n + 4),
  html:not([data-entrance="off"]) .checkin-row:nth-child(n + 4),
  html:not([data-entrance="off"]) .setting-row:nth-child(n + 4) { animation-delay: 390ms; }

  html:not([data-entrance="off"]) .stamp {
    animation: enter-pop 360ms var(--ease-out) backwards;
    animation-timing-function: linear(0, 0.2, 0.6, 1.04 60%, 1.01 78%, 1);
  }

  html:not([data-entrance="off"]) .stamp:nth-child(1) { animation-delay: 260ms; }
  html:not([data-entrance="off"]) .stamp:nth-child(2) { animation-delay: 290ms; }
  html:not([data-entrance="off"]) .stamp:nth-child(3) { animation-delay: 320ms; }
  html:not([data-entrance="off"]) .stamp:nth-child(4) { animation-delay: 350ms; }
  html:not([data-entrance="off"]) .stamp:nth-child(5) { animation-delay: 380ms; }
  html:not([data-entrance="off"]) .stamp:nth-child(6) { animation-delay: 410ms; }
  html:not([data-entrance="off"]) .stamp:nth-child(7) { animation-delay: 440ms; }
  html:not([data-entrance="off"]) .stamp:nth-child(n + 8) { animation-delay: 470ms; }
}

/* ที่เที่ยว: the list opened with eight identical rows, which is the flattest a screen
 * can be. The nearest place now leads with a full-width photograph, the way the news
 * section does on /home — one editorial moment, then the efficient list. */
.place-row--lead {
  margin-block-end: var(--space-2xs);
}

.place-lead {
  display: grid;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  color: inherit;
  text-decoration: none;
}

/* The ratio rides on the image, not the wrapper: as a stretched grid item the wrapper
 * takes its height from content, and aspect-ratio on it is simply ignored. */
.place-lead__photo {
  position: relative;
  display: block;
  overflow: hidden;
}

.place-lead__photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.place-lead__tag {
  position: absolute;
  inset-block-start: var(--space-xs);
  inset-inline-start: var(--space-xs);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--color-primary-bright);
  color: var(--color-on-primary);
  font-size: var(--text-2xs);
  font-weight: 700;
}

.place-lead__body {
  display: grid;
  padding: var(--space-xs) var(--space-sm) var(--space-sm);
  gap: 0.2rem;
}

.place-lead__body .place-row__name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: 0;
}

.place-lead__heart {
  inset-block-start: var(--space-xs);
  inset-inline-end: var(--space-xs);
  translate: none;
}

/* ── Repairs the consult found, all of them real defects ────────────────────
 * Controls below the 44 px target, an active nav label that sat at ~3:1 on the
 * surface, and white numerals on the bright clay tier. */
.view-button,
.filter-chip,
.ghost-button,
.passport-cta {
  min-height: var(--size-control);
}

.save-heart {
  width: var(--size-control);
  height: var(--size-control);
}

.link-more,
.footer-line a {
  display: inline-flex;
  min-height: var(--size-control);
  padding-inline: var(--space-xs);
  align-items: center;
}

a.nav-item.is-active {
  color: var(--color-primary);
}

a.nav-item.is-active .icon {
  color: var(--color-primary-bright);
}

.tier.is-done {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-on-primary);
}

/* ── The system-level move: one opening stage per screen ────────────────────
 * The title and the screen's first real object share a single sunken sheet, and
 * the content below reads as the next layer — the same relationship the cream
 * page has to the collage on /home. */
.screen-stage {
  position: relative;
  isolation: isolate;
  overflow: clip;
  border-radius: 0 0 var(--radius-sheet) var(--radius-sheet);
  background: var(--color-surface-sunken);
  box-shadow: var(--shadow-card);
}

.screen-stage > .page-head,
.screen-stage > .search-zone,
.screen-stage > .view-switch,
.screen-stage > .filter-row,
.screen-stage > .scan-section,
.screen-stage > .passport,
.screen-stage > .profile {
  background: none;
}

.screen-stage > :last-child {
  padding-block-end: var(--space-section);
}

/* Easy mode flattens the stage: fewer surfaces, more contrast. */
html[data-easy="on"] .screen-stage {
  border-radius: 0;
  background: var(--color-canvas);
  box-shadow: none;
}

/* The last undersized targets the audit found. */
.filter-chip,
.view-button {
  min-width: var(--size-control);
}

.setting-copy--link {
  min-height: var(--size-control);
  justify-content: center;
}

/* The pin's dot stays 24 px; the button around it is the full target. */
.map-pin {
  display: grid;
  width: var(--size-control);
  height: var(--size-control);
  place-items: center;
  border: 0;
  background: none;
  box-shadow: none;
}

.map-pin::before {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--color-ink);
  border-radius: 50%;
  background: var(--pin, var(--color-tint-food));
  box-shadow: var(--shadow-control);
  content: "";
  transition: scale var(--dur-short) var(--ease-out);
}

.map-pin.is-active {
  transform: none;
}

.map-pin.is-active::before {
  border-width: 3px;
  scale: 1.35;
}

/* MapLibre ships 29 px zoom buttons. */
.maplibregl-ctrl-group button {
  width: var(--size-control) !important;
  height: var(--size-control) !important;
}

.maplibregl-ctrl-attrib a {
  display: inline-block;
  padding-block: var(--space-2xs);
}

/* ── The proposal's card treatments ─────────────────────────────────────────
 * The watermarks are decorative line art: without these rules they render as
 * solid black fills and push the copy sideways. */
.frame-watermark,
.profile-watermark {
  position: absolute;
  width: 7rem;
  height: auto;
  fill: none;
  stroke: var(--color-ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.08;
  pointer-events: none;
}

.frame-watermark {
  inset-block-end: var(--space-md);
  inset-inline-end: var(--space-md);
}

.profile-watermark {
  inset-block-start: -0.75rem;
  inset-inline-end: -1rem;
  width: 7.5rem;
  opacity: 0.07;
}

/* The scan frame looks at the town, in the same warm light as the home hero. */
.scan-frame {
  background: linear-gradient(135deg, var(--color-page-backdrop-a), var(--color-page-backdrop-b));
}

.scan-doodle,
.scan-hint,
.scan-sub {
  position: relative;
  z-index: 1;
}

/* The profile card is this screen's hero band. */
.profile-card {
  position: relative;
  overflow: hidden;
  border: var(--rule-card) solid var(--color-surface);
  background: linear-gradient(135deg, var(--color-page-backdrop-a), var(--color-page-backdrop-b));
  box-shadow: var(--shadow-card);
}

.profile-card .avatar {
  border: 2px solid var(--color-primary-bright);
  background: var(--color-surface);
  color: var(--color-primary);
}

.profile-card .profile-copy {
  position: relative;
}

/* Three counters, three kinds of memory: the lane tints carry the difference. */
.stat-trio li:nth-child(1) { background: var(--color-tint-merit); }
.stat-trio li:nth-child(2) { background: var(--color-tint-chill); }
.stat-trio li:nth-child(3) { background: var(--color-tint-food); }

/* The settings ladder picks up the same six tints instead of five grey squares. */
.setting-row:nth-child(1) .setting-mark { background: var(--color-tint-chill); color: var(--color-ink); }
.setting-row:nth-child(2) .setting-mark { background: var(--color-tint-merit); color: var(--color-ink); }
.setting-row:nth-child(3) .setting-mark { background: var(--color-tint-coffee); color: var(--color-ink); }
.setting-row:nth-child(4) .setting-mark { background: var(--color-tint-oldtown); color: var(--color-ink); }
.setting-row:nth-child(5) .setting-mark { background: var(--color-tint-photo); color: var(--color-ink); }

/* A saved place says so on the photograph. */
.saved .place-photo {
  position: relative;
}

.saved-badge {
  position: absolute;
  inset-block-start: var(--space-2xs);
  inset-inline-end: var(--space-2xs);
  display: grid;
  width: 1.5rem;
  height: 1.5rem;
  place-items: center;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: var(--shadow-control);
  color: var(--color-primary);
}

.saved-badge .icon {
  width: 0.9rem;
  height: 0.9rem;
  fill: currentColor;
}

/* The success stamp gets the sunburst the moment deserves. */
.stamp-badge {
  position: relative;
  display: grid;
  place-items: center;
}

.sb-rays {
  position: absolute;
  width: 6.5rem;
  height: 6.5rem;
  fill: none;
  stroke: var(--color-primary-bright);
  stroke-width: 2.4;
  stroke-linecap: round;
  opacity: 0.55;
  pointer-events: none;
}

/* A place already collected carries the passport's own mark. */
.checkin-row__photo {
  position: relative;
}

.photo-stamp {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--color-surface) 55%, transparent);
}

.photo-stamp svg {
  width: 2rem;
  height: 2rem;
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  transform: rotate(-8deg);
}

.photo-stamp circle:nth-of-type(2) {
  stroke-dasharray: 3 5;
  stroke-width: 1.5;
}

/* The page title carries the home screen's sparkle. */
.page-head {
  position: relative;
}

.page-head .section-sparkle {
  inset-block-start: calc(var(--space-sm) + 0.35rem);
  inset-inline-start: auto;
  inset-inline-end: var(--space-gutter);
}

/* One-shot, event-driven: the success card arrives, it does not loop. */
@media (prefers-reduced-motion: no-preference) {
  html:not([data-ambient="off"]):not([data-easy="on"]) .checkin-success:not([hidden]) .success-card {
    animation: enter-card 460ms var(--ease-out) backwards;
  }

  html:not([data-ambient="off"]):not([data-easy="on"]) .checkin-success:not([hidden]) .stamp-badge {
    animation: enter-pop var(--dur-long) var(--ease-out) 120ms backwards;
  }
}
