/* voyage — the map, the next port, the passport, the ports, rewards, and the
   celebration sheet (components/celebrate.js). See public/css/app.css for the
   tokens.

   Tokens only; every rule works in both themes. The map is a fixed night sea
   in both themes on purpose, so its colours are the sea tokens, which do not
   change with the theme. Motion is transform/opacity only and stops under the
   app-wide reduce-motion switch. */

/* ------------------------------------------------------------------- map */
figure.voyage {
  margin: 0 0 var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.voy-map { position: relative; }
.voy-scene { display: block; width: 100%; height: auto; }

.voy-sky-0 { stop-color: var(--sea-deep); }
.voy-sky-1 { stop-color: var(--sea); }
.voy-sky-2 { stop-color: var(--sea-mid); }
.voy-sun-0 { stop-color: var(--sun); }
.voy-sun-1 { stop-color: var(--coral); }
.voy-trail-0 { stop-color: var(--seaglass-2); }
.voy-trail-1 { stop-color: var(--sun); }

.voy-sunball { opacity: .92; }
.voy-star { fill: var(--ink-inv); opacity: .5; }
.voy-land { fill: var(--sea-deep); opacity: .55; }
.voy-sea-1 { fill: var(--sea); opacity: .75; }
.voy-sea-2 { fill: color-mix(in srgb, var(--sea) 55%, var(--sea-deep)); opacity: .85; }
.voy-route {
  fill: none; stroke: color-mix(in srgb, var(--ink-inv) 30%, transparent);
  stroke-width: 2.5; stroke-dasharray: 1 7; stroke-linecap: round;
}
.voy-sailed { fill: none; stroke: url(#voy-sailed); stroke-width: 3; stroke-linecap: round; opacity: .95; }
.voy-jetty { fill: var(--sun); }
.voy-ship { color: var(--ink-inv); }
/* SVG user units: about 12px on a 320px phone, more on anything wider. */
.voy-dog { font-size: 15px; }

/* Words and buttons over the scene. The layer lets taps through to nothing
   (there is nothing underneath to tap); only the markers take them. */
.voy-layer { position: absolute; inset: 0; pointer-events: none; }
.voy-port {
  position: absolute; width: var(--tap-min); height: var(--tap-min);
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  margin: 0; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); font: inherit;
  pointer-events: auto;
}
button.voy-port { cursor: pointer; }
button.voy-port:focus-visible { outline: 2px solid var(--ink-inv); outline-offset: -2px; }
.voy-port-mark {
  display: grid; place-items: center; border-radius: 50%;
  transition: transform var(--dur-1) var(--ease);
}
button.voy-port:active .voy-port-mark { transform: scale(.9); }
.voy-port-emoji { font-size: .9375rem; line-height: 1; }
.voy-port[data-state="reached"] .voy-port-mark {
  width: 30px; height: 30px;
  background: var(--seaglass-2);
  border: 2px solid var(--ink-inv);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--seaglass-2) 28%, transparent);
}
.voy-port[data-state="next"] .voy-port-mark {
  width: 28px; height: 28px;
  background: color-mix(in srgb, var(--sea-deep) 55%, transparent);
  border: 2px dashed color-mix(in srgb, var(--ink-inv) 85%, transparent);
}
/* Ports further on are quiet dots, not padlocks: they are ahead, not locked. */
.voy-port[data-state="later"] .voy-port-mark {
  width: 12px; height: 12px;
  background: color-mix(in srgb, var(--ink-inv) 18%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--ink-inv) 55%, transparent);
}

/* The next port's name, on the map. Above the marker, or below it when the
   marker is near the top; pinned to an edge when near one. */
.voy-next-label {
  position: absolute; z-index: 1;
  --lx: -50%; --ly: calc(-100% - 20px);
  transform: translate(var(--lx), var(--ly));
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--ink-inv); color: var(--sea-deep);
  font-size: var(--fs-caption); font-weight: 650; line-height: 1.3; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(4, 21, 30, .3);
}
.voy-next-label[data-flip="below"] { --ly: 20px; }
.voy-next-label[data-edge="end"] { --lx: calc(-100% + 14px); }
.voy-next-label[data-edge="start"] { --lx: -14px; }

.voy-pier { display: contents; }
.voy-pier-glyph {
  position: absolute; left: 94.7%; top: 16.4%;
  transform: translate(-50%, -105%);
  font-size: 1.125rem; line-height: 1;
}
.voy-pier-label {
  position: absolute; right: 2.5%; top: calc(17.7% + 4px);
  font-size: var(--fs-overline); font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink-inv) 88%, transparent);
}

.voyage-caption {
  padding: var(--sp-3) var(--sp-4) 14px;
  font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2);
}

/* ------------------------------------------------------------- next port */
.voyage-next-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
/* On a narrow phone the day count drops under the name rather than squeezing it. */
.voyage-next-head > .grow { min-width: 9rem; }
.voyage-next-head > .tag { flex: none; align-self: flex-start; }
.voyage-next-glyph {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.4rem; line-height: 1;
  background: color-mix(in srgb, var(--seaglass) 14%, var(--surface));
}
.voyage-next-kicker {
  font-size: var(--fs-caption); font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}
.voyage-next-name {
  margin-top: 1px;
  font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 650; line-height: 1.3;
}
/* Which stretch the bar underneath is drawing. */
.voyage-next-leg { margin: calc(-1 * var(--sp-2)) 0 6px; font-size: var(--fs-note); line-height: 1.4; color: var(--ink-3); }
.voyage-next-note { font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2); }
.voyage-next.is-done .voyage-next-head { margin-bottom: var(--sp-2); }

/* -------------------------------------------------------------- sections */
.voyage-section {
  /* #/voyage/passport and #/voyage/rewards land here, clear of the masthead. */
  scroll-margin-top: calc(env(safe-area-inset-top) + var(--tap) + var(--sp-5));
}
.voyage-intro {
  margin: 0 2px var(--sp-3);
  font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2);
}
.section-title .section-add { color: var(--accent-text); font-size: var(--fs-note); letter-spacing: 0; text-transform: none; }
.voyage-sheet-lead { font-size: var(--fs-body); line-height: 1.55; color: var(--ink); margin-bottom: var(--sp-4); }

/* -------------------------------------------------------------- passport */
/* The stamp ink on paper, darker than the old mix so an 11px name reads on
   sand. The dark theme keeps app.css's lighter ink (those rules are more
   specific than this one). */
.passport {
  --stamp-ink: color-mix(in srgb, var(--coral) 60%, var(--ink));
  --stamp-crew-ink: var(--sea-mid);
}
.passport .stamp-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--sp-3) var(--sp-2); }

.stamp-cell {
  appearance: none; margin: 0; padding: var(--sp-1) 2px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-height: var(--tap-min);
  border: 0; border-radius: var(--r); background: transparent;
  color: inherit; font: inherit; text-align: center;
}
button.stamp-cell { cursor: pointer; }
button.stamp-cell:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.stamp-cell .stamp { position: relative; width: 100%; max-width: 104px; }
/* A fixed tilt is not motion, so it no longer depends on the motion setting. */
.stamp { transform: rotate(var(--tilt, -4deg)); transition: transform var(--dur-1) var(--ease); }
button.stamp-cell:active .stamp { transform: rotate(var(--tilt, -4deg)) scale(.95); }
.stamp .nm {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  max-width: 11ch; margin: 0 auto;
}
.stamp-count {
  position: absolute; top: -2px; right: -2px;
  min-width: 28px; height: 22px; padding: 0 6px;
  display: grid; place-items: center; border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--stamp-edge);
  font-size: var(--fs-caption); font-weight: 700; font-variant-numeric: tabular-nums;
  transform: rotate(calc(var(--tilt, -4deg) * -1));
}
.stamp.crew .stamp-count { border-color: var(--stamp-crew-edge); }
.stamp-when { font-size: var(--fs-caption); line-height: 1.3; color: var(--ink-2); }

.passport-more { margin-top: var(--sp-3); }
.passport-more > summary { color: var(--accent-text); }
.passport-foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2);
  margin-top: var(--sp-3); padding-top: var(--sp-2);
  border-top: 1px dashed color-mix(in srgb, var(--sand-deep) 80%, transparent);
}
.passport-legend { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
/* Scoped to the passport: Plan's week strip and the charts own the bare
   .legend-item / .legend-swatch names, and this file loads after both. The
   stamp inks are only defined on .passport anyway, so outside it these rules
   drew borderless circles over Plan's day-tile key. */
.passport-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-caption); color: var(--ink-2); }
.passport-legend .legend-swatch {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px dashed var(--stamp-edge);
  background: color-mix(in srgb, var(--stamp-ink) 10%, transparent);
}
.passport-legend .legend-swatch.crew { border-color: var(--stamp-crew-edge); background: color-mix(in srgb, var(--stamp-crew-ink) 10%, transparent); }
.passport .passport-guide { color: var(--accent-text); }

/* The day-one preview: three stamps, ghosted by .ghost in components.css. */
.passport-sample .stamp-grid { grid-template-columns: repeat(3, 1fr); }

/* One stamp, large, on its own paper. */
.stamp-sheet-paper { display: grid; place-items: center; padding: var(--sp-6) var(--sp-4); margin-bottom: var(--sp-4); }
.stamp-sheet-paper .stamp { width: 132px; }
.stamp-sheet-paper .stamp .glyph { font-size: 2.2rem; }
.stamp-sheet-paper .stamp .nm { font-size: var(--fs-caption); }
.stamp-sheet-detail { font-size: var(--fs-body); line-height: 1.55; color: var(--ink); margin-bottom: var(--sp-3); }
.stamp-sheet-facts { margin-bottom: var(--sp-2); }
.stamp-sheet-dates { font-size: var(--fs-note); line-height: 1.6; color: var(--ink-2); }

/* ------------------------------------------------------------------ ports */
.port-group { margin-bottom: var(--sp-2); }
/* A reached port wears the passport's stamp ink. */
.port-row.is-reached .item-lead {
  background: color-mix(in srgb, var(--coral) 12%, var(--surface));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--coral) 45%, transparent);
}
.port-row.is-next .item-lead {
  background: var(--seaglass-wash);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--seaglass) 55%, transparent);
}
/* Ahead, not locked: the emoji is simply quieter. */
.port-row.is-later .item-lead { background: var(--surface-2); filter: saturate(.35); opacity: .8; }
.port-later { margin-bottom: var(--sp-3); }
.port-later > .disclosure-body > .card { margin-bottom: 0; }

.port-sheet-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.port-sheet-glyph {
  flex: none; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.8rem; line-height: 1;
  background: color-mix(in srgb, var(--seaglass) 14%, var(--surface));
}
.port-sheet-note { font-size: var(--fs-note); line-height: 1.55; color: var(--ink-2); }
.port-sheet-note + .port-sheet-note { margin-top: var(--sp-2); }

/* ---------------------------------------------------------------- rewards */
.reward-head { display: flex; align-items: flex-start; gap: var(--sp-3); }
.reward-head > .tag { flex: none; }
.reward-head h3 { font-size: var(--fs-h3); font-weight: 650; line-height: 1.3; }
.reward-glyph {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.4rem; line-height: 1;
  background: color-mix(in srgb, var(--coral) 14%, var(--surface));
}
.reward-kicker {
  font-size: var(--fs-caption); font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 2px;
}
.reward-detail { margin-top: 2px; font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2); }
.reward-actions { margin-top: var(--sp-4); }
.reward-actions .btn.primary,
.reward-actions .btn.coral { min-height: var(--tap); flex: 1 1 auto; }
.card.reward-unlocked {
  background: color-mix(in srgb, var(--coral) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--coral) 50%, transparent);
}
.card.reward-ask { border-color: color-mix(in srgb, var(--seaglass) 40%, transparent); }

.reward-how { margin: var(--sp-1) 2px var(--sp-3); }
.reward-steps {
  margin: 0; padding-left: 22px;
  font-size: var(--fs-body); line-height: 1.55; color: var(--ink-2);
}
.reward-steps li + li { margin-top: 6px; }
.reward-steps li::marker { color: var(--ink-3); font-weight: 650; }

/* Where a reward is in its life: four stops on a line. */
.reward-track {
  display: flex; margin: 0 0 var(--sp-4); padding: 0; list-style: none;
}
.reward-track li {
  position: relative; flex: 1 1 0; min-width: 0;
  padding-top: 18px; text-align: center;
  font-size: var(--fs-caption); line-height: 1.3; color: var(--ink-3);
}
.reward-track li::before {
  content: ''; position: absolute; top: 2px; left: 50%; z-index: 1;
  width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-strong);
}
.reward-track li + li::after {
  content: ''; position: absolute; top: 7px; right: 50%; width: 100%; height: 2px;
  background: var(--line);
}
.reward-track li.done { color: var(--ink-2); }
.reward-track li.done::before { background: var(--seaglass); border-color: var(--seaglass); }
.reward-track li.done + li::after,
.reward-track li.done + li.on::after { background: var(--seaglass); }
.reward-track li.on { color: var(--accent-text); font-weight: 650; }
.reward-track li.on::before {
  background: var(--seaglass); border-color: var(--seaglass);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--seaglass) 25%, transparent);
}

.reward-sheet-actions { margin-top: var(--sp-4); }
.reward-sheet-actions .btn.primary,
.reward-sheet-actions .btn.coral { min-height: var(--tap); }
.reward-remove { margin-top: var(--sp-6); display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
.reward-sheet-next { font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2); }
.chip.emoji-chip { min-width: var(--tap-min); justify-content: center; font-size: 1.1rem; }

/* ------------------------------------------------------------ celebration */
/* One sheet for every moment: a stamp pressed onto passport paper. */
.celebrate-paper {
  display: grid; place-items: center;
  padding: var(--sp-7) var(--sp-4); margin-bottom: var(--sp-4);
}
.celebrate-stamp {
  width: 144px; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-content: center; gap: 4px; padding: 10px; text-align: center;
  border: 3px dashed var(--stamp-edge);
  color: var(--stamp-ink);
  background: color-mix(in srgb, var(--stamp-ink) 9%, transparent);
  transform: rotate(var(--tilt, -4deg));
  animation: ss-stamp-press 450ms var(--ease) both;
}
.celebrate-stamp.crew {
  border-color: var(--stamp-crew-edge); color: var(--stamp-crew-ink);
  background: color-mix(in srgb, var(--stamp-crew-ink) 9%, transparent);
}
.celebrate-glyph { font-size: 2.6rem; line-height: 1.1; }
.celebrate-name {
  max-width: 13ch; margin: 0 auto;
  font-size: var(--fs-caption); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; line-height: 1.2;
}
@keyframes ss-stamp-press {
  0%   { opacity: 0; transform: scale(1.4) rotate(0deg); }
  55%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1) rotate(var(--tilt, -4deg)); }
}
.celebrate-line {
  text-align: center; font-family: var(--font-display);
  font-size: var(--fs-h3); font-weight: 650; line-height: 1.35; color: var(--ink);
}
.celebrate-detail { margin-top: 6px; text-align: center; font-size: var(--fs-body); line-height: 1.55; color: var(--ink-2); }
.celebrate-note { margin-top: var(--sp-3); text-align: center; font-size: var(--fs-note); line-height: 1.55; color: var(--ink-2); }
.celebrate-more { margin-bottom: 0; }
.celebrate-actions { margin-top: var(--sp-5); }
.celebrate-actions .btn.primary { min-height: var(--tap); }

/* Still means still: the stamp is simply there, at its tilt. */
@media (prefers-reduced-motion: reduce) { .celebrate-stamp { animation: none; } }
:root[data-reduce-motion] .celebrate-stamp { animation: none; }

/* ------------------------------------------------------------ ship's log */
/* #/voyage/log: the keepsake. Paper for the cover, the sea's own colours for
   the marks, and nothing that animates. Every mark has its words beside it
   or in the readout under it; hollow and dashed marks are the honest states
   ("still arriving", "not scorable"), never a zero. */

/* The way in, on the Voyage tab. */
.card.shiplog-entry { border-color: color-mix(in srgb, var(--sand-deep) 90%, transparent); }
.card.shiplog-entry.is-home { background: var(--sand); border-color: var(--sand-deep); }
.shiplog-entry-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.shiplog-entry-glyph {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.4rem; line-height: 1;
  background: color-mix(in srgb, var(--sand-deep) 55%, var(--surface));
}
.shiplog-entry-text { margin-bottom: var(--sp-3); font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2); }
.shiplog-entry .btn { min-height: var(--tap); gap: var(--sp-2); }
.shiplog-later { margin-top: calc(-1 * var(--sp-2)); }

/* The cover: the first page of the log. */
.shiplog > .card,
.shiplog > section { margin-bottom: var(--sp-5); }
.card.shiplog-cover {
  background:
    repeating-linear-gradient(180deg, transparent 0 27px, color-mix(in srgb, var(--sand-deep) 45%, transparent) 27px 28px),
    var(--sand);
  border-color: var(--sand-deep);
}
.shiplog-cover-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.shiplog-cover-glyph {
  flex: none; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sea-deep); color: var(--ink-inv);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sand-deep) 80%, transparent);
}
.shiplog-cover-title {
  font-family: var(--font-display); font-size: var(--fs-h2); font-weight: 680; line-height: 1.2;
  color: var(--ink); overflow-wrap: anywhere;
}
.shiplog-cover-dates { margin-top: 3px; font-size: var(--fs-note); font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.shiplog-cover-lead { font-size: var(--fs-body); line-height: 1.55; color: var(--ink); }
.shiplog-cover-note { margin-top: var(--sp-2); font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2); }
.shiplog-cover-link { margin: 2px 0 0 -8px; color: var(--accent-text); gap: 6px; }
.shiplog-actions {
  margin-top: var(--sp-4); padding-top: var(--sp-3);
  border-top: 1px dashed color-mix(in srgb, var(--sand-deep) 90%, transparent);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3);
}
.shiplog-actions .btn { min-height: var(--tap); gap: var(--sp-2); }
.shiplog-actions-note { flex: 1 1 12rem; font-size: var(--fs-note); line-height: 1.45; color: var(--ink-3); }
.shiplog-section .section-title { margin-top: 0; }
.shiplog-map { margin-bottom: 0; }
.shiplog-closed .empty { padding-block: var(--sp-4); }
.shiplog-note { margin-top: var(--sp-2); font-size: var(--fs-note); line-height: 1.5; color: var(--ink-3); }
.shiplog-readout {
  display: block; min-height: 1.5em;
  font-size: var(--fs-note); line-height: 1.5; color: var(--ink); font-variant-numeric: tabular-nums;
}
.shiplog-foot { margin: var(--sp-2) 2px var(--sp-6); font-size: var(--fs-note); line-height: 1.5; color: var(--ink-3); text-align: center; }
.shiplog-printed { display: none; }

/* Nights: each one a capsule on a 6 pm → noon clock, like a tide mark. The
   track's faint lines are midnight and 6 am; there is no bedtime line. */
.card.shiplog-tide { padding: var(--sp-3) var(--sp-3) var(--sp-2); }
.tide-axis { position: relative; height: 18px; margin: 0 var(--sp-2) 2px; }
.tide-tick {
  position: absolute; top: 0; left: calc(var(--a) * 100%);
  transform: translateX(calc(var(--a) * -100%));
  font-size: var(--fs-overline); font-weight: 600; line-height: 18px; color: var(--ink-3); white-space: nowrap;
}
.tide-rows { display: flex; flex-direction: column; }
.tide-row {
  appearance: none; display: flex; flex-direction: column; gap: 6px;
  width: 100%; min-height: var(--tap-min); margin: 0; padding: var(--sp-2);
  border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--ink); font: inherit; text-align: left;
}
.tide-row + .tide-row { border-top: 1px solid var(--line-soft); border-radius: 0; }
button.tide-row { cursor: pointer; transition: background var(--dur-2); }
button.tide-row:active { background: color-mix(in srgb, var(--ink) 5%, transparent); }
button.tide-row:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; border-radius: var(--r-sm); }
.tide-row-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px var(--sp-2); }
.tide-day { font-size: var(--fs-note); font-weight: 650; color: var(--ink); }
.tide-times { font-size: var(--fs-note); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tide-row-head .tag { align-self: center; }
.tag.tide-tag { background: color-mix(in srgb, var(--sand-deep) 55%, var(--surface)); color: var(--ink-2); }
.tide-track {
  position: relative; display: block; height: 12px; border-radius: var(--r-pill);
  background:
    linear-gradient(90deg, transparent calc(33.333% - .5px), var(--line) calc(33.333% - .5px) calc(33.333% + .5px), transparent calc(33.333% + .5px),
                           transparent calc(66.667% - .5px), var(--line) calc(66.667% - .5px) calc(66.667% + .5px), transparent calc(66.667% + .5px)),
    var(--line-soft);
}
.tide-capsule {
  position: absolute; top: 0; bottom: 0;
  left: calc(var(--a) * 100%); width: calc(var(--w) * 100%); min-width: 6px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--seaglass), color-mix(in srgb, var(--seaglass) 70%, var(--sea-mid)));
}
.tide-capsule.is-pending,
.tide-capsule.is-in_progress { background: transparent; border: 1.5px dashed var(--pending); }
/* Not scorable: the times are real, the score will not come. Outlined, not dashed. */
.tide-capsule.is-unscorable { background: transparent; border: 1.5px solid var(--line-strong); }
/* On arrival the nights fill in one after another, like a tide coming up the
   beach. Once, and never under reduce-motion. */
.shiplog.is-arriving .tide-capsule {
  transform-origin: left center;
  animation: ss-tide-in var(--dur-3) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
@keyframes ss-tide-in {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .shiplog.is-arriving .tide-capsule { animation: none; } }
:root[data-reduce-motion] .shiplog.is-arriving .tide-capsule { animation: none; }

/* Minutes moving: a column per day, yours and — if they share it — theirs. */
.card.shiplog-moves { padding-top: var(--sp-3); }
.moves-scale { font-size: var(--fs-overline); font-weight: 600; color: var(--ink-3); margin-bottom: 2px; }
.moves-mid {
  position: absolute; right: 0; top: 50%; transform: translateY(-100%);
  padding: 0 3px 1px; border-radius: 3px; z-index: 1;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  font-size: var(--fs-overline); line-height: 1.2; color: var(--ink-3);
  pointer-events: none;
}
.moves-frame { position: relative; }
.moves-plot {
  position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  align-items: end; height: 132px;
  border-bottom: 1px solid var(--line-strong);
  background: linear-gradient(180deg, transparent calc(50% - .5px), var(--line) calc(50% - .5px) calc(50% + .5px), transparent calc(50% + .5px));
  touch-action: pan-y; cursor: pointer; border-radius: var(--r-xs) var(--r-xs) 0 0;
  -webkit-user-select: none; user-select: none;
}
.moves-plot:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.moves-col {
  position: relative; height: 100%;
  display: flex; align-items: flex-end; justify-content: center; gap: 1px;
  padding: 0 12%;
}
.moves-bar {
  flex: 1 1 0; max-width: 18px; min-height: 2px;
  height: calc(var(--h, 0) * 100%);
  border-radius: 3px 3px 0 0;
  background: var(--seaglass);
}
.moves-bar.mate { background: color-mix(in srgb, var(--plum) 80%, var(--seaglass)); }
.moves-bar.is-pending { height: 18px; background: transparent; border: 1.5px dashed var(--pending); border-bottom: 0; }
.moves-col.is-selected .moves-bar.you { background: color-mix(in srgb, var(--seaglass) 70%, var(--sea-deep)); }
.moves-col.is-selected .moves-bar.mate { background: var(--plum); }
.moves-col.is-selected .moves-bar.is-pending { background: transparent; }
.moves-guide {
  position: absolute; top: 0; bottom: 0; width: 1px; margin-left: -.5px; pointer-events: none;
  left: calc((var(--sel, 0) + .5) / var(--n) * 100%);
  background: color-mix(in srgb, var(--ink) 20%, transparent);
}
.moves-days {
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  margin-top: 4px; font-size: var(--fs-overline); color: var(--ink-3); text-align: center;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.moves-axis-name { margin: 2px 0 var(--sp-2); font-size: var(--fs-overline); color: var(--ink-3); text-align: center; }
.moves-legend { display: flex; flex-wrap: wrap; gap: 4px var(--sp-4); margin-top: var(--sp-2); }
.moves-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-caption); color: var(--ink-2); }
.moves-key { width: 12px; height: 12px; border-radius: 3px; background: var(--seaglass); }
.moves-key.mate { background: color-mix(in srgb, var(--plum) 80%, var(--seaglass)); }

/* Walks together and stamps reuse the rows and the passport. */
.shiplog-stamps { list-style: none; margin: 0; padding: 0; }

/* What your band measured: folded, and yours alone. */
.shiplog-band-disclose {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); padding: 0 var(--sp-4);
  box-shadow: var(--shadow-1);
}
.shiplog-band-disclose > summary { min-height: var(--tap); }
.shiplog-band-summary { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); font-weight: 650; color: var(--ink); }
.shiplog-band-lock { display: inline-grid; color: var(--ink-3); }
.shiplog-band-disclose .disclosure-body { padding-bottom: var(--sp-4); }
.band-lead { display: flex; align-items: flex-start; gap: var(--sp-3); }
.band-lead p { flex: 1 1 auto; font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2); }
.band-lead .tag { flex: none; }

/* Logbook strips: one per measurement, each on its own scale, all sharing
   the same days, so one selection reads straight down through them. */
.shiplog-strips-card { margin-top: var(--sp-3); }
.shiplog-strips {
  position: relative; display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-2) 0; touch-action: pan-y; cursor: pointer; border-radius: var(--r-sm);
  -webkit-user-select: none; user-select: none;
}
.shiplog-strips:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.shiplog-strip-head { display: flex; align-items: baseline; gap: var(--sp-2); margin-bottom: 4px; }
.shiplog-strip-name { font-size: var(--fs-note); font-weight: 650; color: var(--ink); }
.shiplog-strip-usual { font-size: var(--fs-caption); color: var(--ink-3); }
.shiplog-strip-value { margin-left: auto; font-size: var(--fs-note); font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.shiplog-strip-plot {
  position: relative; height: 40px;
  border-bottom: 1px solid var(--line);
}
.shiplog-strip-usual-band { position: absolute; left: 0; right: 0; background: var(--seaglass-wash); border-radius: 3px; }
.shiplog-strip-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.shiplog-strip-line polyline { fill: none; stroke: color-mix(in srgb, var(--seaglass) 70%, transparent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.shiplog-strip-dot {
  position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--seaglass);
}
.shiplog-strip-dot.is-selected { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; background: var(--seaglass); border-color: var(--surface); box-shadow: 0 0 0 1.5px var(--seaglass); }
/* The honest states sit on the baseline: hollow for "on its way", a short
   neutral bar for "will not come", a tick for no reading at all. */
.shiplog-strip-mark { position: absolute; bottom: -1px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; }
.shiplog-strip-mark.is-pending,
.shiplog-strip-mark.is-in_progress { border: 1.5px dashed var(--pending); bottom: 2px; }
.shiplog-strip-mark.is-calibrating { border: 1.5px solid var(--pending); bottom: 2px; }
.shiplog-strip-mark.is-unscorable { height: 3px; width: 10px; margin-left: -5px; border-radius: 2px; background: var(--line-strong); bottom: 3px; }
.shiplog-strip-mark.is-none,
.shiplog-strip-mark.is-measured { width: 2px; height: 5px; margin-left: -1px; border-radius: 1px; background: var(--line-strong); opacity: .6; }
.shiplog-strip-mark.is-selected { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 25%, transparent); }
.shiplog-strain-plot { height: 34px; }
.shiplog-strain-bar {
  position: absolute; bottom: 0; width: 6px; margin-left: -3px;
  height: calc(var(--h) * 100%); min-height: 2px;
  border-radius: 2px 2px 0 0; background: color-mix(in srgb, var(--sea-mid) 75%, var(--seaglass));
}
.shiplog-strain-bar.is-selected { background: var(--sea-mid); box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 3px var(--sea-mid); }
/* The selected day, straight down through every strip (--sel on .shiplog-strips). */
.shiplog-strip-plot::after {
  content: ''; position: absolute; top: -4px; bottom: 0; width: 1px; margin-left: -.5px; pointer-events: none;
  left: calc((var(--sel, 0) + .5) / var(--n) * 100%);
  background: color-mix(in srgb, var(--ink) 22%, transparent);
}
.shiplog-strips-foot { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.shiplog-strips-foot .shiplog-readout { flex: 1 1 14rem; }
.shiplog-open-day { color: var(--accent-text); gap: 6px; }

.homeport-box {
  margin-top: var(--sp-4); padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r); background: var(--sand); border: 1px solid var(--sand-deep);
}
.homeport-title {
  display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
  font-size: var(--fs-overline); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
}
.homeport-text { font-size: var(--fs-note); line-height: 1.55; color: var(--ink); }
.homeport-usual { list-style: none; margin: var(--sp-2) 0 0; padding: 0; }
.homeport-usual li {
  display: flex; justify-content: space-between; gap: var(--sp-2); min-height: 32px; align-items: center;
  font-size: var(--fs-note); color: var(--ink-2);
}
.homeport-usual li + li { border-top: 1px dashed color-mix(in srgb, var(--sand-deep) 90%, transparent); }
.homeport-usual .num { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }

@media (max-width: 360px) {
  .moves-plot { height: 116px; }
  .moves-col { padding: 0 6%; }
  .shiplog-cover-glyph { width: 48px; height: 48px; }
}

/* ------------------------------------------------------------- on paper */
/* "Print or save as PDF": the log alone, light, with every value written
   out. The shell, the buttons and anything folded stay off the page — so the
   band's section prints only when its owner has opened it. */
@media print {
  body:has(.shiplog) .masthead,
  body:has(.shiplog) .tabbar,
  body:has(.shiplog) .skip-link,
  body:has(.shiplog) .toast-host { display: none !important; }
  body:has(.shiplog) { background: #fff; }
  .shiplog {
    /* The light palette, whatever the phone's theme: ink is for paper. */
    --bg: #fff; --surface: #fff; --surface-2: #f7fbfb;
    --line: #d9e5e7; --line-soft: #e9f1f2; --line-strong: #78909a;
    --ink: #0e2430; --ink-2: #3d5a66; --ink-3: #527079;
    --sand: #f6ecdd; --sand-deep: #e8d7bf; --seaglass-wash: #e4f6f3;
    --seaglass: #21a99a; --seaglass-2: #4fd0bd; --accent-text: #0c746b; --pending-text: #566d77;
    color: var(--ink);
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .shiplog .screen-head,
  .shiplog .shiplog-actions,
  .shiplog .shiplog-cover-link,
  .shiplog .shiplog-open-day,
  .shiplog .item-chev { display: none !important; }
  .shiplog .card,
  .shiplog .shiplog-band-disclose { box-shadow: none; break-inside: avoid; }
  .shiplog-section { break-inside: avoid-page; }
  .shiplog .print-show {
    position: static; width: auto; height: auto; margin: var(--sp-2) 0 0; padding: 0 0 0 1.2em;
    overflow: visible; clip: auto; white-space: normal;
    font-size: var(--fs-note); line-height: 1.5; color: var(--ink-2);
  }
  .shiplog-band-disclose:not([open]) { display: none; }
  .shiplog-printed { display: block; text-align: center; font-size: var(--fs-note); color: var(--ink-3); }
}
