/* Trip page: a personal journey told as a journal over the map (ADR 0018).
   Builds on live.css (map, glass, dock, markers, blips) and base.css tokens. */

.journal {
  position: fixed; z-index: 20; top: 12px; left: 12px; bottom: 12px; width: 420px;
  display: flex; flex-direction: column; overflow: hidden;
}
.journal .sheet-handle { display: none; }
.j-head { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 14px; }
.j-head > .row { display: flex; align-items: center; justify-content: space-between; }
.j-rider { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: var(--c); color: #0a0d12; font-weight: 800; font-size: 19px; letter-spacing: -0.02em;
}
.avatar::after { content: ""; position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--panel-solid); background: var(--faint); }
.avatar.is-moving::after { background: var(--ok); }
.avatar.is-stopped::after { background: var(--warn); }
.avatar.is-offline::after { background: var(--danger); }
.avatar.is-finished::after { background: var(--cyan); }
.j-rider h1 { font-size: 20px; letter-spacing: -0.025em; line-height: 1.15; }
.j-rider .trip-name { color: var(--muted); font-size: 13px; margin-top: 1px; }
.j-rider .now { margin-top: 6px; font-size: 13px; display: flex; align-items: center; gap: 7px; }
.j-rider .now .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.j-rider .now.is-moving .dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 18%, transparent); animation: blink 1.6s ease-in-out infinite; }
.j-rider .now.is-stopped .dot { background: var(--warn); }
.j-rider .now.is-offline .dot { background: var(--danger); }
.j-rider .bio { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }

.j-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.j-stats .stat { background: var(--panel-solid); padding: 12px 6px 10px; text-align: center; }
.j-stats .stat b { display: block; font-size: 19px; font-weight: 720; letter-spacing: -0.02em; }
.j-stats .stat b small { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.j-stats .stat span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.j-stats .planned { grid-column: 1 / -1; background: var(--panel-solid); padding: 10px 14px 12px; }

.j-message { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.j-message .msg-form { margin: 0; }

.j-day { padding: 14px 14px 6px; border-bottom: 1px solid var(--line); }
.j-day header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; position: sticky; top: 0; background: var(--panel-solid); padding: 6px 0; z-index: 1; }
.j-day header h2 { font-size: 15px; letter-spacing: -0.01em; }
.j-day header h2 span { color: var(--muted); font-weight: 500; margin-left: 6px; }
.j-day header .figures { font-size: 12px; color: var(--muted); white-space: nowrap; }
.j-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.j-items li { position: relative; }
.j-items time { font-size: 11.5px; color: var(--faint); }

.j-photo { border-radius: 14px; overflow: hidden; background: var(--raise); cursor: pointer; border: 1px solid var(--line); }
.j-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.j-photo .cap { padding: 9px 12px 10px; display: grid; gap: 2px; }
.j-photo .cap p { font-size: 14px; line-height: 1.4; }
.j-moment { padding: 10px 12px; border-radius: 14px; background: var(--raise); border-left: 3px solid var(--c, var(--accent-text)); cursor: pointer; }
.j-moment p { font-size: 14px; line-height: 1.4; }
.j-place { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 6px 4px; cursor: pointer; border-radius: 10px; }
.j-place:hover, .j-moment:hover { background: var(--raise-2); }
.j-place .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--raise-2); display: grid; place-items: center; font-size: 17px; }
.j-place b { font-size: 13px; }
.j-place small { display: block; color: var(--muted); font-size: 12.5px; }
.j-status { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; padding: 0 4px; }
.j-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.j-status.k-riding::before { background: var(--ok); }
.j-status.k-sleeping::before, .j-status.k-resting::before, .j-status.k-eating::before { background: var(--warn); }
.j-status.k-mechanical::before { background: var(--danger); }
.j-msg { padding: 9px 12px; border-radius: 14px 14px 14px 4px; background: color-mix(in srgb, var(--message) 8%, transparent); border: 1px solid color-mix(in srgb, var(--message) 20%, transparent); font-size: 13.5px; max-width: 88%; }
.j-msg b { color: var(--message); font-weight: 650; margin-right: 4px; }
.j-empty { padding: 24px 16px; color: var(--muted); text-align: center; }
.j-foot { font-size: 11.5px; padding: 14px 16px 18px; }

.trip-dock { left: 444px; }
.trip-dock .profile { height: 86px; }
.trip-dock .attribution { font-size: 10.5px; color: var(--faint); margin-top: 4px; }
.trip .map-tools { top: 12px; }

@media (max-width: 900px) {
  .journal {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 88dvh; border-radius: 20px 20px 0 0; border-bottom: 0;
    transform: translateY(calc(88dvh - 45dvh)); transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .journal[data-snap="peek"] { transform: translateY(calc(88dvh - 150px)); }
  .journal[data-snap="full"] { transform: none; }
  .journal .sheet-handle { display: block; width: 100%; height: 22px; border: 0; background: transparent; flex: none; }
  .journal .sheet-handle::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--text) 25%, transparent); margin: 0 auto; }
  .j-head { padding-top: 0; }
  .j-head > .row { display: none; }
  .trip-dock { display: none; }
  .trip .map-tools { top: 12px; right: 8px; }
  .j-stats .stat b { font-size: 17px; }
}

/* A story picked on the map briefly lights up in the journal. */
.is-flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent-text); } 100% { box-shadow: 0 0 0 3px transparent; } }
