/* Cliff Island Fleet Status — coastal Maine theme.
   Sea-mist white + harbor blues + lobster-red accent. Mobile-first, single column. */

:root {
  --bg: #eaf3f8;          /* sea mist */
  --bg-2: #dcebf0;        /* (unused placeholder) */
  --surface: #ffffff;     /* clapboard white */
  --surface-2: #e4eff6;   /* pale tide blue */
  --ink: #11304c;         /* deep harbor navy */
  --muted: #5d758d;       /* weathered slate */
  --line: #cadeeb;        /* light blue-gray rope */
  --good: #1f7d5b;        /* spruce / sea green */
  --warn: #d99a2b;        /* buoy yellow */
  --down: #d6492f;        /* lobster red */
  --bench: #1f6f9c;       /* deeper harbor blue */
  --accent: #d6492f;      /* lobster red — the accent */
  --link: #15618c;        /* harbor blue links */
  --shadow: 0 1px 3px rgba(17, 48, 76, 0.08), 0 1px 2px rgba(17, 48, 76, 0.06);
  --radius: 14px;
  --pad: 1.1rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -200px, #f4fafd 0%, var(--bg) 60%) fixed;
  color: var(--ink);
  font: 17px/1.55 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(0.9rem, 3vw, 1.4rem);
}

h1, h2 { line-height: 1.15; letter-spacing: -0.01em; }
h2 {
  font-size: 1.25rem;
  margin: 2rem 0 0.85rem;
}
h2::after {
  content: "";
  display: block;
  width: 2.4rem;
  height: 3px;
  margin-top: 0.4rem;
  background: var(--accent);
  border-radius: 2px;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:active { opacity: 0.7; }
.muted { color: var(--muted); }
.loading { color: var(--muted); padding: 2rem 0; }

/* ---------- masthead / site title ---------- */
.masthead { padding-top: 1.2rem; padding-bottom: 0.2rem; }
.masthead__title {
  font-size: clamp(1.5rem, 6vw, 2rem);
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.masthead__title::after {
  content: "";
  display: block;
  width: 3rem; height: 4px; margin-top: 0.5rem;
  background: var(--accent); border-radius: 2px;
}
.masthead__tag { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.95rem; }
.masthead__home {
  display: inline-block;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.masthead__home:hover { color: var(--link); text-decoration: none; }

/* ---------- sound button ---------- */
.soundbtn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin: 0.7rem 0 0;
  padding: 0.6rem 1rem;
  font: inherit; font-weight: 700;
  color: #fff; background: var(--down);
  border: none; border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
}
.soundbtn:hover { filter: brightness(1.05); }
.soundbtn:active { transform: translateY(1px); }
.media--playable { cursor: pointer; }

/* ---------- banner ---------- */
.banner {
  border-radius: var(--radius);
  padding: 1.6rem var(--pad) 1.4rem;
  text-align: center;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.banner--good { background: linear-gradient(165deg, #e6f4ee, #ffffff); border-color: #a9d8c4; }
.banner--warn { background: linear-gradient(165deg, #fbf1d8, #ffffff); border-color: #ecd293; }
.banner--down { background: linear-gradient(165deg, #fbe4de, #ffffff); border-color: #eaa797; }
.banner__count {
  font-size: clamp(4.5rem, 22vw, 7rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}
.banner--good .banner__count { color: var(--good); }
.banner--warn .banner__count { color: var(--warn); }
.banner--down .banner__count { color: var(--down); }
.banner__of { font-size: 0.4em; font-weight: 700; color: var(--muted); }
.banner__label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}
.banner__head { font-size: 1.5rem; margin: 0.9rem 0 0.3rem; color: var(--ink); }
.banner__sub { margin: 0; color: var(--muted); font-size: 1.02rem; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: 1fr; gap: 0.7rem; margin-top: 0.9rem; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}
.stat__label { font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat__big { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; margin: 0.15rem 0; color: var(--ink); }
.stat__foot { font-size: 0.92rem; color: var(--muted); }

/* ---------- breakdown ---------- */
.breakdown__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.bd-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.bd-row__bar { position: absolute; inset: 0 auto 0 0; width: var(--w); opacity: 0.18; z-index: 0; }
.bd-row--good .bd-row__bar { background: var(--good); }
.bd-row--warn .bd-row__bar { background: var(--warn); }
.bd-row--down .bd-row__bar { background: var(--down); }
.bd-row > :not(.bd-row__bar) { position: relative; z-index: 1; }
.bd-row__pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.bd-row__days { font-size: 0.88rem; }

/* ---------- leaderboard ---------- */
.leaderboard__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.lb-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "rank name pct" "bar bar bar";
  align-items: center;
  gap: 0.2rem 0.7rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.lb-row--benchmark { border-style: dashed; border-color: var(--bench); background: var(--surface-2); }
.lb-row__rank { grid-area: rank; font-weight: 800; color: var(--muted); min-width: 1.2em; }
.lb-row__name { grid-area: name; font-weight: 600; font-size: 1.05rem; color: var(--ink); }
.lb-row__pct { grid-area: pct; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.lb-row__bar {
  grid-area: bar; height: 6px; border-radius: 3px; margin-top: 0.35rem;
  background: linear-gradient(90deg, var(--bench) var(--w), rgba(17, 48, 76, 0.08) var(--w));
}
.lb-row--benchmark .lb-row__bar { background: linear-gradient(90deg, var(--accent) var(--w), rgba(17, 48, 76, 0.08) var(--w)); }

/* ---------- outage log ---------- */
.log__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.log__item {
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.log__item--open { border-left-color: var(--down); }
.log__top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; }
.log__veh { font-weight: 700; font-size: 1.05rem; }
.log__dur { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log__meta { color: var(--muted); font-size: 0.95rem; margin-top: 0.15rem; }

/* ---------- tags ---------- */
.tag {
  display: inline-block; margin-left: 0.5rem; padding: 0.05rem 0.45rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  border-radius: 999px; background: rgba(31, 111, 156, 0.12); color: var(--bench);
  vertical-align: middle; white-space: nowrap;
}
.tag--blame { color: var(--down); background: rgba(214, 73, 47, 0.12); }

/* ---------- media / photos (3:2 cover) ---------- */
.media {
  margin: 1rem 0 0; border-radius: var(--radius); overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.media picture { display: block; }
.media img {
  display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--surface-2);
}
.media figcaption {
  padding: 0.55rem 0.8rem; font-size: 0.9rem; color: var(--muted);
  border-top: 1px solid var(--line); background: var(--surface);
}
.media--hero { margin-top: 0.5rem; }
.media--repair { margin: 0.6rem 0 0; box-shadow: none; }
.media--missing { position: relative; }
.media--missing img { visibility: hidden; }
.media--missing::after {
  content: attr(data-placeholder);
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 1rem; color: var(--muted); font-size: 0.95rem;
  background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 12px, var(--surface-2) 12px, var(--surface-2) 24px);
}

/* ---------- vehicle detail ---------- */
.back { margin: 0 0 0.4rem; }
.veh-head { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-top: 1rem; }
.veh-head h1 { font-size: 1.7rem; margin: 0; }
.status-pill {
  font-size: 0.8rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.status-pill--up { background: rgba(31, 125, 91, 0.14); color: var(--good); }
.status-pill--down { background: rgba(214, 73, 47, 0.14); color: var(--down); }
.status-pill--bench { background: rgba(31, 111, 156, 0.14); color: var(--bench); }
.blurb { font-size: 1.08rem; }
.hazard {
  background: rgba(217, 154, 43, 0.12); border: 1px solid #e6c684; color: #8a6410;
  padding: 0.8rem 1rem; border-radius: 10px; font-size: 0.98rem;
}
.uptime-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin: 1rem 0; text-align: center; box-shadow: var(--shadow);
}
.uptime-card .stat__big { font-size: 2.6rem; }

.spec { width: 100%; border-collapse: collapse; margin-top: 0.3rem; }
.spec th, .spec td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec th { color: var(--muted); font-weight: 600; width: 38%; white-space: nowrap; }
.maint th { color: var(--muted); }
.due { color: var(--good); font-weight: 600; }
.due--over { color: var(--down); }
.quirks { padding-left: 1.2rem; margin: 0.3rem 0; }
.quirks li { margin: 0.25rem 0; }

/* ---------- footer ---------- */
.site-foot {
  max-width: 640px; margin: 2.5rem auto 1.5rem;
  padding: 1.2rem clamp(0.9rem, 3vw, 1.4rem) 0;
  border-top: 1px solid var(--line); color: var(--muted);
  font-size: 0.85rem; text-align: center;
}

/* ---------- troubleshooting: link from the vehicle page ---------- */
.guide-link {
  display: flex; align-items: center; gap: 0.8rem;
  margin: 1rem 0 0; padding: 0.85rem 1rem;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--bench);
  border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--ink); -webkit-tap-highlight-color: transparent;
}
.guide-link:hover { text-decoration: none; border-color: var(--bench); }
.guide-link:active { transform: translateY(1px); }
.guide-link__icon { font-size: 1.5rem; line-height: 1; }
.guide-link__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.guide-link__title { font-weight: 700; font-size: 1.05rem; }
.guide-link__sub { color: var(--muted); font-size: 0.85rem; }
.guide-link__arrow { color: var(--bench); font-weight: 800; font-size: 1.2rem; }

/* ---------- guide: header ---------- */
.guide-head { margin-top: 1rem; }
.guide-head h1 { font-size: 1.7rem; margin: 0; }
.guide-head__sub { margin: 0.35rem 0 0; font-size: 0.95rem; }
.ref-h { font-size: 1.02rem; margin: 1.3rem 0 0.5rem; color: var(--ink); }

/* ---------- guide: safety callouts ---------- */
.callout {
  display: flex; gap: 0.65rem; align-items: flex-start;
  margin: 0.6rem 0 0; padding: 0.8rem 0.95rem;
  border-radius: 10px; border: 1px solid #e6c684; border-left: 5px solid var(--warn);
  background: rgba(217, 154, 43, 0.12); color: #8a6410;
}
.callout__icon { font-size: 1.15rem; line-height: 1.3; flex: none; }
.callout__body { margin: 0; font-size: 0.98rem; color: #7a5a0e; }

/* ---------- guide: flow diagram (built from the steps data) ---------- */
.flow { display: flex; flex-direction: column; align-items: stretch; margin-top: 0.5rem; }
.flow__node {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 0.85rem 1rem; text-align: center;
  font-weight: 700; font-size: 1.05rem; color: var(--ink);
}
.flow__node--end {
  background: rgba(31, 125, 91, 0.12); border-color: #a9d8c4; color: var(--good);
}
.flow__link {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  padding: 0.3rem 0;
}
.flow__arrow { color: var(--muted); font-size: 0.9rem; line-height: 1; }

/* ---------- wire-color chips + swatches ---------- */
.wire-chip {
  display: inline-block; padding: 0.12rem 0.55rem; border-radius: 999px;
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.01em;
  border: 1px solid rgba(17, 48, 76, 0.18); white-space: nowrap;
}
.legend__swatch {
  display: inline-block; width: 1.05rem; height: 1.05rem; border-radius: 4px;
  border: 1px solid rgba(17, 48, 76, 0.25); flex: none;
}
.wire--blue { background: #2f7fc4; color: #fff; border-color: #235e91; }
.wire--orange { background: #e58a1e; color: #fff; border-color: #b46c12; }
.wire--orange-green { background: linear-gradient(90deg, #e58a1e 50%, #2f9d5b 50%); color: #fff; }
.wire--white { background: #f6f9fb; color: var(--ink); border-color: #b8ccd9; }
.wire--red { background: #d6492f; color: #fff; border-color: #a8341f; }
.wire--black { background: #2a2f36; color: #fff; border-color: #11141a; }
.wire--black-white { background: linear-gradient(90deg, #2a2f36 50%, #f6f9fb 50%); color: var(--ink); }
.wire--default { background: var(--surface-2); color: var(--ink); }

/* ---------- guide: triage card ---------- */
.triage {
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--bench);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem; margin-top: 1rem;
}
.triage__title { font-weight: 800; font-size: 1.1rem; }
.triage__body { margin: 0.5rem 0 0.7rem; }
.triage__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.triage__row {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.65rem 0.75rem; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.triage__result { font-weight: 700; }
.triage__meaning { color: var(--muted); font-size: 0.95rem; }
.triage__note { margin: 0.7rem 0 0; font-size: 0.95rem; }

/* ---------- guide: collapsible steps ---------- */
.step {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); margin-top: 0.6rem; overflow: hidden;
}
.step__sum {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.95rem 1rem; cursor: pointer; list-style: none;
  font-weight: 700; min-height: 3rem; -webkit-tap-highlight-color: transparent;
}
.step__sum::-webkit-details-marker { display: none; }
.step__sum::after {
  content: "›"; margin-left: auto; color: var(--muted);
  font-size: 1.4rem; line-height: 1; transform: rotate(90deg); transition: transform 0.15s;
}
.step[open] .step__sum::after { transform: rotate(-90deg); }
.step__title { font-size: 1.05rem; color: var(--ink); }
.step__body { padding: 0 1rem 1rem; }
.step__intro { margin-top: 0; color: var(--muted); }
.step__first, .step__note { font-size: 0.95rem; margin: 0.7rem 0 0; }
.step__note { color: var(--muted); }

.testblock {
  margin-top: 0.7rem; padding: 0.75rem 0.85rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
}
.testblock__h {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 800; color: var(--muted);
}
.testblock__test { margin: 0.3rem 0 0; }
.reading { margin: 0.4rem 0 0; font-size: 0.95rem; }
.reading__k { font-weight: 800; }
.reading--good { color: var(--good); }
.reading--bad { color: var(--down); }

/* ---------- guide: part / OEM block ---------- */
.part {
  margin-top: 0.8rem; padding: 0.75rem 0.85rem;
  border: 1px dashed var(--bench); border-radius: 10px; background: rgba(31, 111, 156, 0.06);
}
.part__name { font-weight: 700; }
.part__oem {
  display: inline-block; margin-left: 0.5rem; padding: 0.1rem 0.5rem;
  font-size: 0.78rem; font-weight: 800; border-radius: 999px;
  background: var(--bench); color: #fff; vertical-align: middle;
}
.part__refs { font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; }
.part__note { font-size: 0.92rem; margin: 0.4rem 0 0; }

/* ---------- guide: lists, chain, legend ---------- */
.guide-ul, .guide-ol { padding-left: 1.2rem; margin: 0.4rem 0 0; }
.guide-ul li, .guide-ol li { margin: 0.4rem 0; }
.chain { list-style: decimal; padding-left: 1.3rem; margin: 0.4rem 0 0; }
.chain__node { margin: 0.3rem 0; font-weight: 600; }
.chain__wire { font-weight: 400; }
.legend { list-style: none; margin: 0.4rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.legend__row { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.legend__color { font-weight: 700; }
.legend__meaning { font-size: 0.92rem; flex: 1 1 100%; padding-left: 1.6rem; }

/* ---------- guide: resolution card ---------- */
.resolution {
  margin-top: 1.2rem; padding: 1rem;
  background: linear-gradient(165deg, #e6f4ee, #ffffff);
  border: 1px solid #a9d8c4; border-radius: var(--radius); box-shadow: var(--shadow);
}
.resolution__h {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 800; font-size: 1.05rem; color: var(--good);
}
.resolution__check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.4rem; height: 1.4rem; border-radius: 999px;
  background: var(--good); color: #fff; font-size: 0.85rem; flex: none;
}
.resolution__list { margin: 0.6rem 0 0; padding-left: 1.2rem; }
.resolution__list li { margin: 0.35rem 0; }

/* wider screens: three-up stat cards */
@media (min-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .legend__meaning { flex: 1; padding-left: 0; }
}
