/* Reusable pieces: chips, panels, buttons, stat tiles, tables, weather notes, about card. */

/* ---------- chip ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.4;
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.chip.ok {
  color: var(--ok);
  border-color: var(--ok);
  background: var(--ok-soft);
}

.chip.warn {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--warn-soft);
}

.chip.storm {
  color: var(--storm);
  border-color: var(--storm);
}

.chip.calm {
  color: var(--calm);
  border-color: var(--calm);
  background: var(--calm-soft);
}

.chip.plain::before {
  display: none;
}

/* ---------- panel ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:hover:not(:disabled) {
  border-color: var(--ink-2);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
}

.btn.ghost:hover:not(:disabled) {
  border-color: var(--rule);
}

.btn.mini {
  min-height: 28px;
  min-width: 0;
  padding: 4px 8px;
  font-size: 11px;
}

@media (pointer: coarse) {
  .btn {
    min-height: 44px;
    min-width: 44px;
  }
  .btn.mini {
    min-height: 36px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .btn,
  .jump a {
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
  }
}

/* segmented control */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: calc(var(--radius) + 2px);
  background: var(--card-2);
}

.seg .btn {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
}

.seg .btn:hover:not(:disabled):not([aria-pressed="true"]) {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}

.seg .btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

@media (max-width: 520px) {
  .seg {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
  }
}

/* ---------- status banner ---------- */
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s4);
  margin-bottom: var(--s4);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-soft);
  font-size: 14px;
}

.banner p {
  flex: 1 1 280px;
  margin: 0;
}

.banner[hidden] {
  display: none;
}

/* ---------- stat tiles ---------- */
.group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s3) var(--s4);
  padding: var(--s3) var(--s4) var(--s4);
}

.group .gh {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--rule);
}

.group .gh .eyebrow {
  margin: 0;
  font-weight: 400;
}

.group .gh .sub {
  font-size: 11px;
  text-align: right;
}

.stat {
  min-width: 0;
  min-height: 76px;
}

.stat .v {
  margin-top: 2px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.stat .v small {
  margin-left: 4px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-2);
}

.stat .v .pos {
  display: block;
  font-size: 23px;
  line-height: 1.15;
  white-space: nowrap;
}

.stat .n {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-2);
}

.stat .n .btn {
  margin-left: var(--s1);
  vertical-align: middle;
}

@media (max-width: 520px) {
  .group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .group .gh + .stat {
    grid-column: 1 / -1;
  }
  /* Passage: three short numbers side by side instead of stacked. */
  .group.trio {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s3) var(--s2);
  }
  .group.trio .gh + .stat {
    grid-column: auto;
  }
  .group.trio .stat .v {
    font-size: 26px;
  }
  .group.trio .stat .n {
    font-size: 11px;
  }
  .group.trio .stat .eyebrow {
    font-size: 10px;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }
  .stat {
    min-height: 0;
  }
}

.progress {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
}

.progress .bar {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--rule);
}

.progress .bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--track);
}

@media (prefers-reduced-motion: no-preference) {
  .progress .bar i {
    transition: width 0.6s ease;
  }
}

@media (max-width: 520px) {
  .progress {
    grid-template-columns: 1fr;
    gap: var(--s1);
  }
}

/* ---------- section intro text ---------- */
.lognote {
  margin: var(--s2) 0 0;
  font-size: 12px;
  color: var(--ink-2);
}

.lognote.top {
  margin: 0 0 var(--s2);
}

.tablebox {
  min-width: 0;
  overflow-x: auto;
}

/* ---------- sea state ---------- */
.sum {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s3) var(--s4);
  margin: var(--s3) 0 0;
}

.sum p {
  margin: 0;
  padding-left: var(--s3);
  border-left: 3px solid var(--rule);
  font-size: 14px;
}

.sum p b {
  display: block;
  font-weight: 600;
}

.sea,
.log {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.sea th,
.log th {
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--ink);
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}

.sea td,
.log td {
  padding: 7px 10px 7px 0;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  vertical-align: top;
}

.sea th[scope="row"],
.log th[scope="row"] {
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  vertical-align: top;
}

.sea tr.now td,
.sea tr.now th,
.log tr.now td,
.log tr.now th {
  background: color-mix(in srgb, var(--fix) 8%, transparent);
}

.sea .bar {
  display: block;
  width: 80px;
  height: 4px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--rule);
}

.sea .bar i {
  display: block;
  height: 100%;
  background: var(--track);
}

.sea .bar.w i {
  background: var(--ink-3);
}

.sea .sq {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-size: 11px;
  color: var(--ink-2);
}

.sea .sq.hi {
  border-color: var(--storm);
  color: var(--storm);
}

.sea .sq.mid {
  border-color: var(--warn);
  color: var(--warn);
}

/* ---------- daily log ---------- */
.log th.num,
.log td.num {
  text-align: right;
}

.sea .mark,
.log .mark {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--ink-3);
}

.sea small,
.log small {
  font-size: inherit;
  color: var(--ink-2);
}

.log .bar {
  display: block;
  width: 64px;
  height: 4px;
  margin: 4px 0 0 auto;
  overflow: hidden;
  border-radius: 2px;
  background: var(--rule);
}

.log .bar i {
  display: block;
  height: 100%;
  margin-left: auto;
  background: var(--track);
}

.log tbody:not(.all) tr.older {
  display: none;
}

/* Narrow screens keep the columns that matter at a glance; the rest are one tap away. */
@media (max-width: 760px) {
  .sea:not(.full) .x,
  .log .x {
    display: none;
  }
  .sea th,
  .sea td,
  .log th,
  .log td {
    padding-right: 8px;
  }
  .sea .bar {
    width: 56px;
  }
}

/* ---------- weather notes ---------- */
.wx {
  display: grid;
  gap: var(--s2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.wx li {
  padding: var(--s3) var(--s3) var(--s2) var(--s4);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
}

.wx li.storm {
  border-left-color: var(--storm);
}

.wx li.calm {
  border-left-color: var(--calm);
}

/* A storm that will not reach the route reads as a quieter, smaller card. */
.wx li.quiet {
  border-left-color: color-mix(in srgb, var(--storm) 35%, var(--rule));
  background: var(--card-2);
}

.wx li.quiet .brief {
  color: var(--ink-2);
}

.wx .t {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s1) var(--s2);
  font-weight: 600;
}

.wx p {
  margin: var(--s1) 0 0;
  font-size: 14px;
}

.wx .brief {
  font-size: 14.5px;
}

.wx details p {
  color: var(--ink-2);
}

.wx .src {
  margin-top: var(--s1);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}

/* ---------- disclosure ---------- */
details > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--s1);
  padding: 4px 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
}

details[open] > summary::before {
  transform: rotate(45deg);
}

details > summary:hover {
  color: var(--ink);
}

@media (pointer: coarse) {
  details > summary {
    min-height: 36px;
  }
}

details.more {
  margin-top: var(--s2);
}

/* ---------- section heads ---------- */
.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: var(--s3);
  margin-bottom: var(--s3);
}

.sec-head h2 {
  margin: 0;
}

.sec-sub {
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}

.headline {
  margin: 0 0 var(--s3);
  font-size: 16px;
  font-weight: 600;
}

.more-cols {
  margin-top: var(--s2);
}

@media (min-width: 761px) {
  #seamore {
    display: none;
  }
}

/* ---------- ahead strip ---------- */
.ahead {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
}

.ahead > .eyebrow {
  align-self: center;
  margin: 0;
  font-size: 11px;
  font-weight: 400;
}

.ahead-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--s2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ahead-list a {
  display: block;
  height: 100%;
  padding: var(--s2) var(--s3);
  border-left: 3px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  color: inherit;
  text-decoration: none;
}

.ahead-list a:hover {
  background: color-mix(in srgb, var(--ink) 6%, var(--card-2));
}

.ahead-list .eyebrow {
  display: block;
  margin: 0;
}

.ahead-list .v {
  display: block;
  margin-top: 1px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.15;
}

.ahead-list .n {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--ink-2);
}

.ahead-list .tone-ok a {
  border-left-color: var(--ok);
}

.ahead-list .tone-warn a {
  border-left-color: var(--warn);
}

.ahead-list .tone-warn .v {
  color: var(--warn);
}

.ahead-list .tone-storm a {
  border-left-color: var(--storm);
}

.ahead-list .tone-storm .v {
  color: var(--storm);
}

.ahead-list .tone-calm a {
  border-left-color: var(--calm);
}

.ahead-list .tone-plain a {
  border-left-color: var(--track);
}

@media (max-width: 640px) {
  .ahead {
    grid-template-columns: 1fr;
    gap: var(--s2);
    padding: var(--s3);
  }
  .ahead-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ahead-list .v {
    font-size: 19px;
  }
}

/* ---------- about the voyage ---------- */
.about {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--s4);
  padding: var(--s4);
}

.about .item {
  min-width: 0;
}

.about .item .v {
  margin-top: 2px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.1;
}

.about .item .n {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-2);
}

.about .note {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-2);
}

/* ---------- theme toggle ---------- */
.theme-btn {
  flex: none;
}

@media (max-width: 380px) {
  .theme-btn .btn-label {
    display: none;
  }
}
