/* Compare, "Head to head": columns per yacht, one scale per row, plans overlaid at true scale on the sea block.
   Each yacht keeps one colour while it is in the comparison (checked for colour-blind separation, light and dark). */

:root { --c0: #0670b4; --c1: #d0742a; --c2: #a23e7a; }
@media (prefers-color-scheme: dark) { :root { --c0: #2e95d6; --c1: #d47a35; --c2: #c0679f; } }

/* .p-intro (pages.css) resets the side padding of .wrap; keep the gutter so the intro lines up with the board */
.cmp-intro { padding-left: var(--gutter); padding-right: var(--gutter); padding-bottom: 0; }
.cmp-intro h1:focus { outline: none; }

/* ---------- toolbar ---------- */

.cmp-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 28px; padding-bottom: 24px; }
.cmp-count { color: var(--ink-2); }
.cmp-tools-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.cmp-tools .btn { min-height: 40px; padding: 0 16px; font-size: 0.875rem; }
.cmp-status { flex-basis: 100%; color: var(--ink-2); overflow-wrap: anywhere; }
.cmp-status:empty { display: none; }

/* ---------- board ---------- */

.cmp-board { --label: 176px; --gap: 28px; --tpl: var(--label) repeat(var(--n), minmax(0, 1fr)); }
.cmp-board.has-slot { --tpl: var(--label) repeat(var(--n), minmax(0, 1fr)) minmax(0, 1fr); }
.cmp-head, .cmp-names, .cmp-row { display: grid; grid-template-columns: var(--tpl); column-gap: var(--gap); }

.cmp-yacht { display: grid; gap: 6px; align-content: start; min-width: 0; }
.cmp-photo { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--line); margin-bottom: 8px; }
.cmp-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.16, 1, .3, 1); }
.cmp-photo:hover img { transform: scale(1.03); }
.cmp-photo::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--c); }
.cmp-model { font-size: 0.8125rem; color: var(--muted); }
.cmp-name { font-size: clamp(1.4rem, 1.1rem + 0.9vw, 2rem); line-height: 1.05; overflow-wrap: anywhere; }
.cmp-name a { text-decoration: none; }
.cmp-name a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.cmp-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.cmp-actions { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin-top: 4px; font-size: 0.875rem; }
.cmp-remove { border: 0; background: none; padding: 0; min-height: 32px; color: var(--muted); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cmp-remove:hover { color: var(--ink); }

.cmp-slot { display: grid; align-content: center; padding: 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius); min-width: 0; }
.cmp-cell-slot { border-left: 1px dashed var(--line); border-right: 1px dashed var(--line); }

/* names stay in view while the rows scroll past */
.cmp-names { position: sticky; top: var(--header-h); z-index: 6; margin-top: 28px; padding: 10px 0; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-strong); font-weight: 700; font-size: 0.875rem; }
.cmp-names-item { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-names-item i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

.cmp-row { padding: 20px 0; border-bottom: 1px solid var(--line); align-items: start; }
.cmp-label { font-weight: 700; font-size: 0.9375rem; display: grid; gap: 2px; }
.cmp-label small { font-weight: 500; font-size: 0.75rem; color: var(--muted); max-width: 22ch; }
.cmp-cell { display: grid; gap: 8px; align-content: start; min-width: 0; }
.cmp-val { font-weight: 700; font-size: 1.0625rem; font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.cmp-val.is-missing { font-weight: 500; color: var(--muted); font-size: 0.9375rem; }
.cmp-val.is-note { font-weight: 600; color: var(--ink-2); font-size: 0.9375rem; }
.cmp-val.is-text { font-weight: 600; }
.cmp-most { font-size: 0.75rem; font-weight: 600; color: var(--sky-ink); }
.cmp-note { font-size: 0.8125rem; color: var(--muted); }

.cmp-bar { display: block; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--line) 80%, transparent); overflow: hidden; }
.cmp-bar i { display: block; height: 100%; border-radius: 4px; background: var(--c); opacity: .78; }
.cmp-cell.is-most .cmp-bar i { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .cmp-bar i { animation: cmpGrow .9s cubic-bezier(.22, 1, .36, 1) both; transform-origin: left center; }
}
@keyframes cmpGrow { from { transform: scaleX(0); } }

.cmp-pips { display: flex; flex-wrap: wrap; gap: 4px; }
.cmp-pips i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); opacity: .78; }
.cmp-cell.is-most .cmp-pips i { opacity: 1; }

.cmp-line { position: relative; display: block; height: 30px; }
.cmp-line::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 2px; border-radius: 1px; background: var(--line); }
.cmp-line i { position: absolute; top: 2px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--paper); }
.cmp-line small { position: absolute; bottom: 0; font-size: 0.6875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cmp-line-lo { left: 0; }
.cmp-line-hi { right: 0; }

@media (max-width: 760px) {
  .cmp-board, .cmp-board.has-slot { --gap: 12px; --tpl: repeat(var(--n), minmax(0, 1fr)); }
  .cmp-corner, .cmp-names-corner, .cmp-names-slot, .cmp-cell-slot { display: none; }
  .cmp-slot { grid-column: 1 / -1; margin-top: 18px; padding: 16px; }
  .cmp-label { grid-column: 1 / -1; margin-bottom: 10px; }
  .cmp-label small { max-width: none; }
  .cmp-name { font-size: 1.2rem; }
  .cmp-price { font-size: 0.875rem; }
  .cmp-model { font-size: 0.75rem; }
  .cmp-val { font-size: 0.9375rem; }
  .cmp-actions { flex-direction: column; align-items: flex-start; gap: 0; }
  .cmp-names { font-size: 0.75rem; margin-top: 18px; }
  .cmp-row { padding: 16px 0; }
}

/* ---------- picker (type-ahead) ---------- */

.cmp-pick { display: grid; gap: 0; min-width: 0; }
.cmp-pick-box { position: relative; }
.cmp-pick.is-big .cmp-pick-input { min-height: 58px; font-size: 1.125rem; padding: 0 16px; }
.cmp-pick-list {
  position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  max-height: 380px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper-raised); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.cmp-opt { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 10px; border-radius: 3px; cursor: pointer; }
.cmp-opt.is-active { background: var(--wash); }
.cmp-opt img, .cmp-opt-ph { width: 56px; height: 42px; object-fit: cover; border-radius: 2px; background: var(--line); }
.cmp-opt-text { display: grid; min-width: 0; }
.cmp-opt-name { font-family: var(--serif); font-size: 1.1rem; line-height: 1.2; }
.cmp-opt-sub { font-size: 0.8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-opt-none { padding: 14px 12px; color: var(--muted); font-size: 0.9rem; }

/* ---------- fewer than two: start here ---------- */

.cmp-empty-top { display: grid; gap: 32px; padding-top: 36px; }
.cmp-empty-top:not(.has-one) .cmp-start { max-width: 720px; }
.cmp-empty-top.has-one { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: center; gap: 32px clamp(32px, 5vw, 72px); }
.cmp-start { display: grid; gap: 14px; }
.cmp-start h2 { font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.8rem); }
.cmp-start .cmp-pick { margin-top: 10px; }
.cmp-one { display: grid; gap: 14px; }
.cmp-one-photo { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--line); }
.cmp-one-photo img { width: 100%; height: 100%; object-fit: cover; }
.cmp-one-text { display: grid; gap: 4px; justify-items: start; }
@media (max-width: 860px) { .cmp-empty-top.has-one { grid-template-columns: minmax(0, 1fr); } }

.cmp-near, .cmp-pairs { padding-top: clamp(56px, 7vw, 88px); }
.cmp-near h3, .cmp-pairs h3 { font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.9rem); margin-bottom: 22px; }

.cmp-near-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.cmp-near-card, .cmp-pair { display: grid; gap: 8px; align-content: start; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; min-width: 0; }
.cmp-near-photo { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--line); }
.cmp-near-photo img, .cmp-pair-photos img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.16, 1, .3, 1); }
.cmp-near-card:hover img, .cmp-pair:hover img { transform: scale(1.04); }
.cmp-near-name { font-family: var(--serif); font-size: 1.35rem; line-height: 1.1; }
.cmp-near-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 0.875rem; color: var(--ink-2); }
.cmp-near-meta strong { color: var(--ink); }
.cmp-near-add { font-size: 0.875rem; font-weight: 600; color: var(--sky-ink); text-decoration: underline; text-underline-offset: 3px; }

.cmp-pairs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 24px; }
.cmp-pair-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-radius: var(--radius); overflow: hidden; }
.cmp-pair-photos span { display: block; aspect-ratio: 3 / 4; overflow: hidden; background: var(--line); }
.cmp-pair-names { font-family: var(--serif); font-size: 1.3rem; line-height: 1.12; margin-top: 4px; }
.cmp-pair-line { font-size: 0.875rem; color: var(--ink-2); }
@media (max-width: 1000px) { .cmp-pairs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .cmp-near-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px 14px; } .cmp-near-grid > :nth-child(3) { display: none; } }
@media (max-width: 520px) { .cmp-pairs-grid { grid-template-columns: minmax(0, 1fr); } .cmp-pair-photos span { aspect-ratio: 4 / 3; } }

/* ---------- at true scale (sea block) ---------- */

.cmp-scale .scale-head { display: grid; gap: 14px; max-width: 64ch; margin-bottom: 28px; }
.cmp-scale .lede { color: var(--ink-2); }
.scale-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.scale-chip {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink);
  font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: opacity .2s ease, border-color .2s ease;
}
.scale-chip:hover { border-color: var(--ink-2); }
.scale-chip i { width: 14px; height: 14px; border-radius: 3px; background: var(--c); flex: none; }
.scale-chip small { font-weight: 500; color: var(--muted); font-size: 0.8125rem; }
.scale-chip[aria-pressed="false"] { opacity: .55; }
.scale-chip[aria-pressed="false"] i { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.scale-chip.is-berth i { --c: var(--ink-2); background: transparent; border: 2px dashed var(--ink-2); }
@media (max-width: 600px) {
  .scale-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .scale-chip { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 2px 10px; align-content: center; padding: 8px 12px; text-align: left; }
  .scale-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .scale-chip small { grid-column: 2; font-size: 0.75rem; }
}

.scale-fig { margin: 26px 0 0; }
.scale-svg svg { display: block; width: 100%; height: auto; overflow: visible; }
.scale-cap { color: var(--muted); margin-top: 14px; max-width: 80ch; }
.scale-guide { stroke: var(--line-strong); fill: none; }
.scale-guide-label { fill: var(--muted); font-family: var(--sans); }
.scale-berth rect { fill: none; stroke: var(--ink-2); }
.scale-berth-label { fill: var(--ink-2); font-family: var(--sans); font-weight: 600; }
.scale-rect { fill-opacity: .1; }
.scale-rect-label { fill: var(--ink); font-family: var(--sans); font-weight: 700; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.scale-axis line { stroke: var(--muted); }
.scale-axis text { fill: var(--muted); font-family: var(--sans); font-variant-numeric: tabular-nums; }
.scale-item image { mix-blend-mode: screen; }
.scale-item, .scale-berth { transition: opacity .35s ease; }
.scale-item.is-off, .scale-berth.is-off { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .scale-fig.is-waiting .scale-item { opacity: 0; transform: translateX(-7%); }
  .scale-fig.is-in .scale-item { transition: transform 1.4s cubic-bezier(.22, 1, .36, 1) calc(var(--d) * 280ms), opacity .7s ease calc(var(--d) * 280ms); }
  .scale-fig.is-waiting .scale-berth { opacity: 0; }
  .scale-fig.is-in .scale-berth { transition: opacity .8s ease 1.1s; }
}

.berth-all { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 20px clamp(32px, 5vw, 80px); margin-top: clamp(40px, 5vw, 64px); padding-top: 32px; border-top: 1px solid var(--line); }
.berth-all h3 { font-size: clamp(1.6rem, 1.3rem + 1vw, 2.2rem); margin-bottom: 18px; }
.berth-all-fig { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0 14px; }
.berth-all-fig span { font-family: var(--serif); font-size: clamp(2.6rem, 2rem + 2vw, 3.6rem); line-height: 1.05; color: var(--ink); }
.berth-all-fig small { font-size: 1rem; color: var(--ink-2); }
.berth-all-text { display: grid; gap: 12px; align-content: start; max-width: 60ch; color: var(--ink-2); font-size: 1.0625rem; }
.berth-all-link { color: var(--sky-ink); font-weight: 600; text-underline-offset: 3px; }
@media (max-width: 760px) { .berth-all { grid-template-columns: minmax(0, 1fr); } }

/* ---------- print: the board and the drawing on white, no controls ---------- */

@media print {
  .site-header, .site-footer, .cmp-tools, .cmp-slot, .cmp-cell-slot, .cmp-names, .cmp-actions, .scale-chips, .berth-all-link, .crumbs, .cmp-empty .cmp-pairs { display: none !important; }
  .has-hero main { margin-top: 0; }
  body { background: #fff; color: #0a0a09; font-size: 11pt; }
  .wrap { max-width: none; padding: 0; }
  .p-intro { padding: 0 0 12px; }
  .p-intro h1 { font-size: 26pt; }
  .cmp-board, .cmp-board.has-slot { --label: 120px; --gap: 16px; --tpl: var(--label) repeat(var(--n), minmax(0, 1fr)); }
  .cmp-photo { aspect-ratio: 3 / 2; }
  .cmp-head, .cmp-row, .scale-fig, .berth-all { break-inside: avoid; }
  .cmp-row { padding: 10px 0; }
  .cmp-bar i, .cmp-pips i, .cmp-line i { animation: none !important; }
  .cmp-scale {
    --paper: #fff; --ink: #0a0a09; --ink-2: #3b3732; --muted: #645c53; --line: #e6e1da; --line-strong: #c1b9ae;
    break-before: page; background: #fff !important; color: #0a0a09; margin: 0; padding: 0;
  }
  .cmp-scale h2 { color: #0a0a09; }
  .scale-item image { mix-blend-mode: multiply; }
  .scale-fig.is-waiting .scale-item, .scale-fig.is-waiting .scale-berth { opacity: 1 !important; transform: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
