/*
 * The travel-journal trip board (js/trip_board.js; docs/design/GUEST-VISUAL-DIRECTION.md).
 *
 * Cards INSIDE the feed, on the shipped tokens only (glass.css / tokens.css): nothing here restyles
 * the header, the chip rail, the dock or a shipped card. Plum (--indigo) is kept for structure and
 * one primary tile; the orb keeps its own. One flow column — 12px gaps, the log's own gutter — and
 * no absolute positioning of anything that holds text, so a long hotel name or a Hindi string grows
 * the card instead of running under its neighbour. Text ≥13px (12px only for the stub's meta), tap
 * targets ≥44px, Cormorant line-heights ≥1.18 so descenders are never clipped.
 *
 * This file is loaded on every page, flag on or off (index.html), so every rule is anchored on the
 * board's own classes (.trip-board, .tb-*) or on html.journal: one that matched a shipped element
 * unscoped would restyle the flag-off app (tests/test_trip_board.py checks every selector).
 */

.trip-board-row {
  width: 100%;
  /* Plum for the journal's lines and marks — the dashed road, the spine, the outlined steps. At
     night Plum is a surface colour (glass.css), so the marks take the night ink instead. */
  --tb-mark: var(--indigo);
}

:root[data-theme="dark"] .trip-board-row {
  --tb-mark: var(--ink-soft);
}

.trip-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  color: var(--ink);
}

/*
 * SURFACES. Every card on the board is paper (`.surface-paper`): the shipped card face at the
 * spec's resting elevation (`--elev-1`, css/surfaces.css). Glass, liquid and the other elevations
 * live in css/surfaces.css ("paper with frosted edges", 6 Nov 2026); a card names its surface by
 * class and never sets its own background or shadow.
 */
.trip-board-row {
  --tb-paper-bg: var(--card-face, var(--surface));
  --tb-paper-line: var(--hairline);
}

html.journal .surface-paper {
  background: var(--tb-paper-bg);
  border: 1px solid var(--tb-paper-line);
  box-shadow: var(--elev-1);
}

.tb-card {
  border-radius: 18px;
  padding: 12px 14px;
  min-width: 0;
}

.tb-h1 {
  margin: 0;
  font: 600 28px/1.18 var(--font-serif);
  overflow-wrap: anywhere;
}

.tb-h2 {
  margin: 0;
  font: 600 22px/1.2 var(--font-serif);
  font-variant-numeric: lining-nums;
}

.tb-sub {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.tb-meta {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.tb-strong {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.tb-num {
  margin: 0;
  font: 600 15px/1.2 var(--font-mono);
}

.tb-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

:lang(hi) .tb-kicker,
:lang(bn) .tb-kicker,
:lang(ne) .tb-kicker {
  letter-spacing: 0;
  text-transform: none;
}

.tb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.tb-head > .icon {
  color: var(--violet);
  flex: 0 0 auto;
}

.tb-aside {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- the greeting */

.tb-greet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 0;
}

.tb-greet-text {
  min-width: 0;
}

.tb-countdown {
  flex: 0 0 auto;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--indigo);
  color: var(--on-indigo);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4.5px var(--tb-mark);
  text-align: center;
}

.tb-countdown-n {
  font: 700 22px/1 var(--font-sans);
}

.tb-countdown-l {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  max-width: 52px;
}

.tb-weather-pill {
  flex: 0 0 auto;
  background: var(--surface-lift);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 8px 12px;
  text-align: right;
  max-width: 45%;
}

.tb-weather-pill .tb-num {
  font-size: 22px;
  line-height: 1;
}

.tb-offline {
  margin: 8px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- the stay ticket */

.tb-ticket {
  display: flex;
  min-width: 0;
  border-radius: 18px;
}

.tb-ticket-main {
  flex: 1 1 auto;
  min-width: 0;
  /* The ticket's own shape (no border, a perforation): the paper surface's face only. */
  background: var(--tb-paper-bg);
  border-radius: 18px 0 0 18px;
  padding: 14px 14px 12px 18px;
}

.tb-ticket-town {
  margin: 6px 0 0;
  font: 700 36px/1.18 var(--font-serif);
  overflow-wrap: anywhere;
}

.tb-ticket-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px dashed var(--hairline-strong);
}

/* The perforation: a dashed line, and the two notches are the page's own colour showing through. */
.tb-perf {
  flex: 0 0 0;
  border-left: 2px dashed var(--hairline-strong);
}

.tb-stub {
  flex: 0 0 100px;
  background: var(--lavender);
  border-radius: 0 18px 18px 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ink);
}

.tb-art {
  width: 80px;
  height: 72px;
  border: 3px solid #fff;
  border-radius: 6px;
  box-sizing: border-box;
  display: block;
}

.tb-stub-from {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.tb-stub-km {
  font-size: 14px;
}

.tb-stub-h {
  margin: 0;
  font-size: 12px;
  line-height: 1.25;
}

/* ---------------------------------------------------------------- tiles and facts */

.tb-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tb-grid2.is-one {
  grid-template-columns: minmax(0, 1fr);
}

.tb-fact {
  border-radius: 18px;
  padding: 11px 14px;
  min-width: 0;
}

.tb-fact.is-alert {
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.tb-fact-big {
  margin-top: 4px;
  font-size: 22px;
}

.tb-fact-line {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.tb-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 78px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: var(--surface-lift);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tb-tile:focus-visible,
.tb-back:focus-visible,
.tb-link:focus-visible,
.tb-strip:focus-visible,
.tb-request:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.tb-tile.is-plum {
  background: var(--indigo);
  border-color: var(--indigo);
  color: var(--on-indigo);
}

.tb-tile.is-plum .tb-tile-sub {
  color: var(--header-ink-soft);
}

.tb-tile.is-wash {
  background: var(--lavender);
  border-color: transparent;
}

.tb-tile-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.tb-tile-sub {
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-soft);
}

/* Progress as outlined segments — filled done, outlined to do; never colour alone. */
.tb-segs {
  display: flex;
  gap: 4px;
  width: 100%;
  margin-top: 4px;
}

.tb-seg {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1.5px var(--hairline-strong);
}

.tb-seg.is-done {
  background: var(--violet);
  box-shadow: none;
}

.tb-way .tb-grid2 {
  margin-top: 6px;
}

/* ---------------------------------------------------------------- arrival: the request tracker */

.tb-request {
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.tb-request-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.tb-request-note {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.4;
}

.tb-steps {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.tb-step-bar {
  display: block;
  height: 5px;
  margin-bottom: 5px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1.5px var(--hairline-strong);
}

.tb-steps .is-done {
  color: var(--ink);
}

.tb-steps .is-done .tb-step-bar {
  background: var(--indigo);
  box-shadow: none;
}

.tb-steps .is-now {
  color: var(--gold-deep);
}

.tb-steps .is-now .tb-step-bar {
  background: var(--violet);
  box-shadow: none;
}

/* ---------------------------------------------------------------- Right now, Today's route */

.tb-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.tb-li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid var(--hairline);
}

.tb-li-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--lavender);
  color: var(--violet);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tb-link {
  margin-left: auto;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-deep);
  cursor: pointer;
}

.tb-route-art {
  display: block;
  width: 100%;
  height: 36px;
  margin-top: 2px;
}

.tb-route-stops {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
  gap: 6px;
  text-align: center;
}

.tb-route-stops .tb-strong {
  font-size: 14px;
}

.tb-pill {
  margin-top: 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--indigo);
  color: var(--on-indigo);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------------------------------------------------------------- sub-views */

.tb-back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold-deep);
  cursor: pointer;
}

.tb-ready {
  flex: 0 0 auto;
  margin: 2px 0 0;
  width: 68px;
  padding: 8px 0;
  border-radius: 14px;
  border: 2px dashed var(--tb-mark);
  text-align: center;
}

.tb-ready-n {
  display: block;
  font: 700 18px/1.15 var(--font-sans);
}

/* Before you travel: one dashed road down the left, the stages as stops on it. */
.tb-prep-body {
  margin-top: 12px;
  padding-left: 14px;
  border-left: 2px dashed var(--tb-mark);
  margin-left: 14px;
}

.tb-stage {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin: 12px 0 6px -30px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--lavender);
  border: 1.5px solid var(--tb-mark);
  font-size: 13px;
  font-weight: 700;
}

.tb-stage.is-first {
  margin-top: 0;
  background: var(--indigo);
  color: var(--on-indigo);
}

.tb-checks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tb-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 44px;
  padding: 4px 0;
}

.tb-check-box {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: -8px 0 -8px -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tb-check-box input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.tb-check-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--tb-mark);
  background: var(--surface-lift);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
}

.tb-check-box input:focus-visible + .tb-check-mark {
  box-shadow: var(--focus-ring);
}

.tb-check.is-done .tb-check-mark {
  background: var(--indigo);
  color: #fff;
}

.tb-check-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

.tb-check-action {
  padding: 0 0 8px 44px;
}

/* Where <town> eats and shops: a numbered scrapbook list, drawings on polaroids. */
.tb-places {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.tb-place {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.tb-polaroid {
  flex: 0 0 auto;
  margin: 0;
  padding: 5px 5px 14px;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 6px 14px -8px rgba(42, 18, 38, 0.35);
}

.tb-place-art {
  display: block;
  width: 82px;
  height: 70px;
}

.tb-place-text {
  min-width: 0;
}

.tb-place-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.tb-place-n {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--tb-mark);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tb-place-why {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.45;
}

/* My days: Day 1 → N on one spine. */
.tb-spine {
  list-style: none;
  margin: 0;
  padding: 0 0 0 40px;
  display: grid;
  gap: 12px;
  background: linear-gradient(var(--tb-mark), var(--tb-mark)) 15px 14px / 2px calc(100% - 28px) no-repeat;
}

.tb-day {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-left: -40px;
}

.tb-spine-dot {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-top: 10px;
  border-radius: 50%;
  border: 2px solid var(--tb-mark);
  background: var(--surface-lift);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tb-spine-dot.is-done {
  background: var(--indigo);
  color: #fff;
}

.tb-spine-dot.is-now {
  background: var(--violet);
  border-color: var(--violet);
  color: #fff;
}

.tb-day-card {
  flex: 1 1 auto;
}

.tb-day.is-today .tb-day-card {
  border-color: var(--violet);
}

.tb-day-stops {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.tb-day-stops li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--hairline);
}

/* ---------------------------------------------------------------- the folded strip */

.tb-strip {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 16px;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tb-strip > .icon:first-child {
  color: var(--violet);
}

.tb-strip-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- the rail's request count */

html.journal .cap-pill-count {
  flex: 0 0 auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--indigo);
  color: var(--on-indigo);
  font-size: 13px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

@media (prefers-reduced-motion: no-preference) {
  .tb-tile,
  .tb-strip {
    transition: transform 120ms ease-out;
  }

  .tb-tile:active,
  .tb-strip:active {
    transform: scale(0.98);
  }
}

/* ---------------------------------------------------------------- phase 2: places and ticks */

.tb-place-name {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: -10px 0 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--hairline-strong);
  text-underline-offset: 3px;
}

.tb-place-actions,
.tb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tb-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--hairline-strong);
  background: var(--surface-lift);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tb-toggle.is-on {
  border-color: var(--tb-mark);
  background: var(--lavender);
}

.tb-pill-ghost {
  min-height: 44px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 999px;
  border: 1.5px solid var(--tb-mark);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tb-toggle:focus-visible,
.tb-pill-ghost:focus-visible,
.tb-pill:focus-visible,
.tb-stop:focus-visible,
.tb-place-name:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* A plan stop is the tick itself: the whole row is the target. */
.tb-stop {
  width: 100%;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 2px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
}

.tb-stop .tb-strong {
  font-size: 14px;
}

.tb-stop.is-done .tb-meta::before {
  content: "✓ ";
}

.tb-stop-row {
  flex-direction: row;
  justify-content: space-between;
  text-align: left;
}

.tb-day-stops li {
  padding: 0;
}

.tb-polaroid-big .tb-place-art {
  width: 100%;
  height: auto;
  aspect-ratio: 82 / 70;
}

.tb-polaroid-big {
  width: min(200px, 60%);
  margin: 4px 0 12px;
}

.tb-polaroid-small {
  padding: 3px 3px 8px;
}

.tb-polaroid-small .tb-place-art {
  width: 52px;
  height: 44px;
}

.tb-facts {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-soft);
}

.tb-facts li::before {
  content: "· ";
}

.tb-saved {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.tb-saved .tb-check {
  align-items: center;
}

.tb-saved-text {
  min-width: 0;
}

.tb-requests {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.tb-req {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--hairline);
}

.tb-req-text {
  min-width: 0;
}

.tb-req-status {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--tb-mark);
  font-size: 13px;
  font-weight: 700;
}

.tb-req-status.is-closed {
  border-color: var(--hairline-strong);
  color: var(--ink-soft);
}

.tb-sent {
  margin: 10px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--ok-bg);
  color: var(--ok-ink);
  font-size: 15px;
  font-weight: 700;
}

/* The menu's "My trip" rows: the label takes the row, so the chevron sits at the edge. */
.tb-menu-label {
  flex: 1 1 auto;
  text-align: left;
}
