/* ===========================================================================
   Шість яхт, шість характерів, одна фінішна лінія
   Design tokens taken from the club journal template at yacht-club.kyiv.ua:
   body Plus Jakarta Sans 16/1.8, headings Roboto 500 uppercase with negative
   tracking, page #F8F9FA, ink #2D3436, muted #6B6B6B, brand #3A5587,
   725 px reading column inside a 1440 px container.
   =========================================================================== */

:root {
  --bg:          #F8F9FA;
  --surface:     #FFFFFF;
  --ink:         #2D3436;
  --muted:       #6B6B6B;
  --line:        #E3E6E9;
  --brand:       #3A5587;
  --brand-soft:  #E0E7FF;
  --brand-lift:  #4A6BA3;
  --footer:      #1A1A1A;
  --warn:        #B4472F;
  --warn-soft:   #FBEDE9;

  --text:  "Plus Jakarta Sans", Inter, Montserrat, -apple-system, sans-serif;
  --head:  Roboto, "Plus Jakarta Sans", Inter, sans-serif;

  --col:       725px;   /* reading measure */
  --layout:    1205px;  /* figures and tables may use this */
  --container: 1440px;

  --radius: 4px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171A; --surface: #1C2024; --ink: #E7EAEC; --muted: #9AA3AA;
    --line: #2C3238; --brand: #8AA6D8; --brand-soft: #232C3D;
    --brand-lift: #A6BCE6; --footer: #0E1113;
    --warn: #E08A73; --warn-soft: #2A1E1A;
  }
}
:root[data-theme="dark"] {
  --bg: #14171A; --surface: #1C2024; --ink: #E7EAEC; --muted: #9AA3AA;
  --line: #2C3238; --brand: #8AA6D8; --brand-soft: #232C3D;
  --brand-lift: #A6BCE6; --footer: #0E1113;
  --warn: #E08A73; --warn-soft: #2A1E1A;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.8;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 30px;
}

/* the article grid: everything sits in the 725 px column unless it opts out */
.layout { max-width: var(--layout); margin: 0 auto; }
.col    { max-width: var(--col); }

/* --------------------------------------------------------------- head ---- */
.masthead {
  padding: 40px 0 0;
}
.breadcrumbs {
  font-size: 12px; font-weight: 700; letter-spacing: .96px;
  text-transform: uppercase; color: var(--muted);
  margin: 0 0 40px; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: 6px 10px;
}
.breadcrumbs li::after { content: "·"; margin-left: 10px; }
.breadcrumbs li:last-child::after { content: ""; }
.breadcrumbs a { color: inherit; text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand); }

.article-title {
  font-family: var(--head);
  font-weight: 500;
  font-size: clamp(30px, 4.2vw, 51.2px);
  line-height: 1.2;
  letter-spacing: -.02em;
  text-transform: uppercase;
  margin: 0 0 28px;
}
.deck {
  font-size: 20px; line-height: 1.65; color: var(--muted);
  max-width: var(--col); margin: 0 0 28px;
}
.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  font-size: 13px; color: var(--muted); margin: 0 0 44px;
}
.badge {
  background: var(--brand-soft); color: var(--brand);
  font-weight: 700; font-size: 12px; letter-spacing: .8px;
  text-transform: uppercase; padding: 5px 12px; border-radius: 100px;
}
.byline { color: var(--ink); font-weight: 600; }

.theme-toggle {
  margin-left: auto; background: var(--brand); color: #fff; border: 0;
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; padding: 7px 14px; border-radius: 100px;
  cursor: pointer;
}
.theme-toggle:hover { background: var(--brand-lift); }

/* --------------------------------------------------------------- body ---- */
.body { max-width: var(--col); }
.body p { margin: 0 0 32px; }

.body h2 {
  font-family: var(--head); font-weight: 500; font-size: 24px;
  line-height: 1.2; letter-spacing: -.02em; text-transform: uppercase;
  margin: 64px 0 24px; scroll-margin-top: 24px;
  display: flex; gap: 14px; align-items: baseline;
}
.sec__no {
  flex: none;
  font-size: 13px; font-weight: 700; letter-spacing: 0;
  color: var(--brand); background: var(--brand-soft);
  min-width: 28px; height: 28px; border-radius: 100px;
  display: inline-flex; align-items: center; justify-content: center;
  transform: translateY(-2px);
}
.body h3 {
  font-family: var(--head); font-weight: 500; font-size: 20px;
  line-height: 1.25; letter-spacing: -.02em; text-transform: uppercase;
  margin: 48px 0 20px; color: var(--brand);
}
.body h4 { font-family: var(--head); font-weight: 500; text-transform: uppercase;
  letter-spacing: -.01em; margin: 0 0 12px; font-size: 16px; }

.body a { color: var(--brand); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-thickness: 1px; }
.body a:hover { color: var(--brand-lift); }

em.boat { font-style: italic; }
.metric { color: var(--brand); font-weight: 700; }

.dropcap {
  float: left; font-family: var(--head); font-weight: 500;
  font-size: 76px; line-height: .82; color: var(--brand);
  margin: 6px 10px 0 0;
}

.body ul, .body ol { margin: 0 0 32px; padding-left: 1.3em; }
.body li { margin: 0 0 10px; }

/* ------------------------------------------------------------ equations -- */
.eq {
  margin: 0 0 32px; padding: 20px 24px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--brand); border-radius: var(--radius);
  overflow-x: auto; text-align: center;
}
.eq math { font-size: 1.15em; }

/* --------------------------------------------------------------- boxes --- */
.standfirst {
  background: var(--brand); color: #fff; border-radius: var(--radius);
  padding: 28px 32px; margin: 0 0 44px; font-size: 17px; line-height: 1.7;
}
.standfirst p:last-child { margin-bottom: 0; }
.standfirst em.boat { color: #fff; }

.box {
  border: 1px solid var(--line); background: var(--surface);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius); padding: 22px 26px; margin: 0 0 32px;
  font-size: 15px;
}
.box p:last-child, .box ul:last-child, .box ol:last-child { margin-bottom: 0; }
.box__title {
  font-family: var(--head); font-weight: 500; font-size: 15px;
  text-transform: uppercase; letter-spacing: .02em;
  color: var(--brand); margin: 0 0 12px;
}
.box--warn { border-left-color: var(--warn); background: var(--warn-soft); }
.box--warn .box__title { color: var(--warn); }

.pullquote {
  margin: 40px 0; padding: 4px 0 4px 26px;
  border-left: 3px solid var(--brand);
  font-family: var(--head); font-weight: 500; font-size: 22px;
  line-height: 1.45; letter-spacing: -.01em; color: var(--ink);
}
.pullquote p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------- figures --- */
.fig {
  margin: 48px 0; padding: 0;
  max-width: var(--layout); width: 100%;
}
.fig__frame, .fig__panel { display: block; }
.fig img {
  display: block; width: 100%; height: auto;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.fig__panels { display: grid; gap: 14px; }
.fig__panel { position: relative; }
.fig__panel-label {
  position: absolute; left: 10px; top: 10px;
  background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; padding: 4px 10px; border-radius: 100px;
}
.fig__full { margin: 12px 0 0; font-size: 13px; }
.fig__full a { color: var(--brand); }
figcaption {
  font-size: 14px; line-height: 1.4; color: var(--muted);
  margin: 12px 0 0; padding: 8px 4px 0;
}
.fig__no, .tbl__no {
  font-weight: 700; color: var(--brand); text-transform: uppercase;
  letter-spacing: .4px; margin-right: 4px;
}
.hero { margin: 0 0 48px; }
.hero .fig__panels { gap: 8px; }

/* -------------------------------------------------------------- tables --- */
.tbl { margin: 48px 0; max-width: var(--layout); }
.tbl figcaption { margin: 0 0 14px; padding: 0; }
.tbl__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
thead th {
  background: var(--brand); color: #fff;
  font-family: var(--head); font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px;
  text-align: left; padding: 11px 14px; white-space: nowrap;
  position: sticky; top: 0;
}
tbody td { padding: 10px 14px; border-top: 1px solid var(--line);
  vertical-align: top; line-height: 1.5; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--line) 35%, transparent); }
tbody tr:hover { background: var(--brand-soft); }

/* ---------------------------------------------------------- boat cards --- */
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
/* Flex column with a two-line floor under the lineage: without it a card whose
   lineage wraps pushes its spec block down and no two cards in a row line up
   — the same defect the print edition had. */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; font-size: 14px;
  display: flex; flex-direction: column;
}
.card__head { background: var(--brand); color: #fff; padding: 12px 16px; }
.card__head h4 { margin: 0; font-size: 17px; color: #fff; }
.card__year { margin: 2px 0 0; font-size: 12px; opacity: .85; }
.card__lineage {
  margin: 14px 16px 10px; font-style: italic; color: var(--muted);
  line-height: 1.5; min-height: 3em;
}
.card__spec { margin: 0 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.card__spec > div { display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; padding: 2px 0; }
.card__spec dt { color: var(--muted); }
.card__spec dd { margin: 0; font-weight: 700; white-space: nowrap; }
.card__note { margin: 0 16px 16px; }
.card__spec + .card__note { margin-top: 4px; }

/* --------------------------------------------------------- "three ways" -- */
.ways { margin: 48px 0; max-width: var(--layout); }
.ways__title { font-family: var(--head); font-weight: 500; font-size: 20px;
  text-transform: uppercase; letter-spacing: -.01em; margin: 0 0 18px; }
.ways__grid { display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.way { background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--warn); border-radius: var(--radius);
  padding: 18px 20px; font-size: 14px; }
.way h4 { color: var(--warn); font-size: 14px; }
.way p:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------------- toc --- */
.toc { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 26px; margin: 0 0 48px; }
.toc h2 { font-family: var(--head); font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; color: var(--muted);
  margin: 0 0 12px; }
.toc ol { margin: 0; padding-left: 1.4em; font-size: 15px; }
.toc li { margin: 0 0 6px; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--brand); text-decoration: underline; }

/* ------------------------------------------------------------ appendix --- */
.appendix { margin: 80px 0 0; max-width: var(--layout); }
.appendix > h2 {
  font-family: var(--head); font-weight: 500; font-size: 24px;
  text-transform: uppercase; letter-spacing: -.02em;
  border-top: 3px solid var(--brand); padding-top: 28px; margin: 0 0 12px;
}
.appendix__lead { max-width: var(--col); color: var(--muted); margin: 0 0 32px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.tab {
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; font-family: var(--head);
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 100px;
  padding: 8px 18px; cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--brand); color: #fff;
  border-color: var(--brand); }

.sheet__head { display: flex; flex-wrap: wrap; gap: 12px 20px;
  align-items: baseline; margin: 0 0 14px; }
.sheet__title { font-family: var(--head); font-weight: 500; font-size: 18px;
  text-transform: uppercase; margin: 0; }
.sheet__sub { color: var(--muted); font-size: 14px; margin: 0; }
.sheet__hint { font-size: 14px; color: var(--muted); margin: 0 0 16px;
  max-width: var(--col); }
.sheet__reset {
  font: inherit; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; background: var(--line); color: var(--ink);
  border: 0; border-radius: 100px; padding: 6px 14px; cursor: pointer;
}
.sheet__reset:hover { background: var(--brand-soft); color: var(--brand); }

/* The sheet already scrolls horizontally, so let the label columns keep their
   rows one line deep rather than wrapping "Carter 33 modif." into three. */
table.scratch td { white-space: nowrap; }
table.scratch td.num { text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
table.scratch th.num { text-align: right; }
table.scratch tr.is-scratch { background: var(--brand-soft) !important; }
table.scratch tr.is-scratch td { font-weight: 700; }
.delta--slow { color: var(--warn); }
.delta--fast { color: #1F7A4C; }
:root[data-theme="dark"] .delta--fast { color: #6BD39B; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .delta--fast { color: #6BD39B; }
}
.delta__time { display: block; font-size: 11px; opacity: .75; }
.scratch__pick { width: 34px; text-align: center; }

.dur-input {
  width: 4.2em; font: inherit; font-size: 12px; text-align: right;
  border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.12);
  color: #fff; border-radius: 3px; padding: 2px 4px;
}

/* -------------------------------------------------------------- calc ----- */
.calc { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px 26px; margin: 32px 0 0; }
.calc h3 { font-family: var(--head); font-weight: 500; font-size: 18px;
  text-transform: uppercase; margin: 0 0 8px; }
.calc__lead { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.calc__row { display: flex; flex-wrap: wrap; gap: 16px 22px; margin: 0 0 20px; }
.calc__field { display: flex; flex-direction: column; gap: 5px; }
.calc__field label { font-size: 12px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; color: var(--muted); }
.calc__field input, .calc__field select {
  font: inherit; font-size: 15px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--ink); min-width: 9em;
}
.calc__note { font-size: 13px; color: var(--muted); margin: 16px 0 0; }

/* ------------------------------------------------------------- colophon -- */
.colophon {
  margin: 72px 0 0; padding: 28px 0 0; border-top: 3px solid var(--brand);
  max-width: var(--col); font-size: 13.5px; color: var(--muted);
}
.colophon p { margin: 0 0 14px; }
.place { font-family: var(--head); font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--brand); font-size: 13px; }

.site-footer {
  background: var(--footer); color: #fff; margin: 80px 0 0; padding: 40px 0;
  font-size: 13px;
}
.site-footer .container { display: flex; flex-wrap: wrap; gap: 12px 30px;
  align-items: baseline; justify-content: space-between; }
.site-footer a { color: #fff; }

/* -------------------------------------------------------------- lightbox - */
.lightbox {
  position: fixed; inset: 0; background: rgba(10,12,14,.94);
  display: none; align-items: center; justify-content: center; z-index: 50;
  padding: 20px;
}
.lightbox[open], .lightbox.is-open { display: flex; }
.lightbox img { max-width: 100%; max-height: 92vh; object-fit: contain;
  background: #fff; }
.lightbox__close {
  position: absolute; top: 16px; right: 20px; background: none; border: 0;
  color: #fff; font-size: 34px; line-height: 1; cursor: pointer;
}
.lightbox__cap { position: absolute; left: 0; right: 0; bottom: 12px;
  text-align: center; color: #cfd4d8; font-size: 13px; padding: 0 20px; }

/* -------------------------------------------------------------- small ---- */
@media (max-width: 800px) {
  .container { padding: 0 18px; }
  body { font-size: 15.5px; }
  .body h2 { margin-top: 48px; }
  .dropcap { font-size: 60px; }
  .pullquote { font-size: 19px; }
  .deck { font-size: 18px; }
  table { font-size: 13px; }
  thead th, tbody td { padding: 9px 10px; }
}

@media print {
  .theme-toggle, .tabs, .scratch__pick, .sheet__reset, .lightbox,
  .site-footer, .toc { display: none !important; }
  body { background: #fff; font-size: 10pt; }
  .fig, .tbl, .ways, .appendix { break-inside: avoid; }
  a { text-decoration: none; color: inherit; }
}
/* Navigation supplied by the two-article collection. */
.collection-back {
  position: fixed;
  z-index: 1000;
  left: 16px;
  bottom: 16px;
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(11, 35, 42, .9);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
  font: 700 12px/1.2 Inter, sans-serif;
  letter-spacing: .03em;
  text-decoration: none;
  backdrop-filter: blur(10px);
}
.collection-back:hover { transform: translateY(-2px); }
