/* Sailing races · antidot.gr
   Light: grey-blue paper. Dark: deep blue-black. Red is kept for "today", blue marks short-handed races.
   Type: Fira Sans Condensed + Fira Mono (SIL Open Font License), as in Wind Router. */

:root {
  --paper: #e7ecf2;
  --paper-deep: #d9e1ea;
  --card: #f6f8fb;
  --ink: #0f1a2b;
  --ink-soft: rgba(15, 26, 43, 0.64);
  --ink-faint: rgba(15, 26, 43, 0.16);
  --ink-ghost: rgba(15, 26, 43, 0.06);
  --today: #e10600;
  --accent: #d21f28;
  --sea: #1f5fbf;
  --sea-soft: rgba(31, 95, 191, 0.1);
  --go: #13804a;
  --warn: #a85700;
  --wx-1: rgba(31, 95, 191, 0.08);
  --wx-2: rgba(31, 95, 191, 0.16);
  --wx-3: rgba(178, 94, 0, 0.16);
  --wx-4: rgba(178, 94, 0, 0.32);
  --sans: "Fira Sans Condensed", "Fira Sans", system-ui, sans-serif;
  --mono: "Fira Mono", ui-monospace, "Courier New", monospace;
  --gutter: 16px;
  --radius: 10px;
  --day: 26px;
  --lane: 54px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #070b14; --paper-deep: #0f1626; --card: #0c1322;
    --ink: #e6ecf5; --ink-soft: rgba(230, 236, 245, 0.66); --ink-faint: rgba(230, 236, 245, 0.16); --ink-ghost: rgba(230, 236, 245, 0.06);
    --today: #ff3b3b; --sea: #7aa8ff; --sea-soft: rgba(122, 168, 255, 0.14); --go: #4cc38a; --warn: #f0a24a;
    --wx-1: rgba(122, 168, 255, 0.1); --wx-2: rgba(122, 168, 255, 0.2); --wx-3: rgba(240, 162, 74, 0.2); --wx-4: rgba(240, 162, 74, 0.38);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #070b14; --paper-deep: #0f1626; --card: #0c1322;
  --ink: #e6ecf5; --ink-soft: rgba(230, 236, 245, 0.66); --ink-faint: rgba(230, 236, 245, 0.16); --ink-ghost: rgba(230, 236, 245, 0.06);
  --today: #ff3b3b; --sea: #7aa8ff; --sea-soft: rgba(122, 168, 255, 0.14); --go: #4cc38a; --warn: #f0a24a;
  --wx-1: rgba(122, 168, 255, 0.1); --wx-2: rgba(122, 168, 255, 0.2); --wx-3: rgba(240, 162, 74, 0.2); --wx-4: rgba(240, 162, 74, 0.38);
  color-scheme: dark;
}
@media (min-width: 720px) { :root { --gutter: 32px; --day: 30px; } }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; overflow-x: hidden; font-variant-numeric: tabular-nums; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ic.sm { width: 15px; height: 15px; vertical-align: -2px; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- header ---------- */
.top { padding: 14px 0 10px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.wordmark { font-weight: 600; font-size: 18px; text-decoration: none; letter-spacing: -0.01em; }
.wordmark .dot { color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 6px; min-width: 0; }
.area-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--ink); color: var(--paper); font-weight: 600; font-size: 15px; white-space: nowrap; max-width: 52vw; }
.area-btn span { overflow: hidden; text-overflow: ellipsis; }
h1 { font-weight: 600; font-size: clamp(2.2rem, 1.5rem + 3vw, 3.8rem); line-height: 1; letter-spacing: -0.015em; }
.sub { color: var(--ink-soft); margin-top: 6px; max-width: 44rem; font-size: 17px; }

/* ---------- controls ---------- */
.controls { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--ink-faint); padding: 8px 0; }
.toolbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; border: 1px solid var(--ink-faint); border-radius: 999px; padding: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 999px; font-size: 15px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.toggles { display: flex; gap: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--ink-faint); font-size: 15px; white-space: nowrap; }
.chip-btn[aria-pressed="true"] { background: var(--ink-ghost); border-color: var(--ink); }
#onlyStarred[aria-pressed="true"] .ic { fill: currentColor; }
@media (max-width: 760px) { .seg button span, .toggles .chip-btn span, #lang span { display: none; } .seg button, .chip-btn { padding: 7px 11px; } }

/* ---------- area sheet ---------- */
.area-list { display: grid; gap: 4px; padding: 6px 12px 16px; }
.area { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border-radius: 10px; font-size: 18px; text-align: left; }
.area:hover { background: var(--ink-ghost); }
.area[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.area .n { font-family: var(--mono); font-size: 13px; opacity: 0.65; }
.area .en { font-size: 14px; opacity: 0.6; margin-left: 8px; }

/* ---------- reminders / status ---------- */
main { padding-top: 16px; padding-bottom: 40px; min-height: 60vh; }
.status { color: var(--ink-soft); font-size: 15px; margin-bottom: 12px; }
.status:empty { display: none; }
.reminders { border: 1px solid var(--ink); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; background: var(--card); }
.reminders h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.reminders ul { list-style: none; display: grid; gap: 6px; }
.reminders li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.reminders .when { font-family: var(--mono); font-size: 13px; color: var(--today); text-transform: uppercase; }
.reminders a.name { font-weight: 600; text-decoration: none; }
.reminders.hint { border-style: dashed; border-color: var(--ink-faint); color: var(--ink-soft); }
.sub-note { color: var(--ink-soft); font-size: 15px; }

/* ---------- today line ---------- */
.today-line { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--today); font-weight: 700; font-size: 19px; letter-spacing: 0.02em; text-transform: uppercase; }
.today-line::after { content: ""; flex: 1; height: 2px; background: var(--today); }

/* ---------- list ---------- */
.month { font-family: var(--mono); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--ink-faint); }
.past-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 15px; padding: 6px 0; }
.past-toggle .ic { transition: transform .2s; }
.past-toggle[aria-expanded="true"] .ic { transform: rotate(180deg); }
.list { display: grid; gap: 8px; }

.race { display: grid; grid-template-columns: 58px minmax(0, 1fr) 210px; gap: 14px; background: var(--card); border: 1px solid var(--ink-faint); border-radius: var(--radius); padding: 12px 12px 12px 10px; position: relative; }
.race.starred { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--ink); }
.race.multi { padding-top: 16px; padding-bottom: 16px; }
.race.multi .r-name { font-size: 21px; }
.race.past { opacity: 0.6; }
.race.featured .r-name::after { content: " ●"; color: var(--accent); font-size: 0.6em; vertical-align: 0.3em; }
.r-date { text-align: center; line-height: 1.05; padding-top: 2px; }
.r-date .dow { display: block; font-size: 13px; text-transform: uppercase; color: var(--ink-soft); }
.r-date .day { display: block; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.r-date .mon { display: block; font-size: 13px; text-transform: uppercase; color: var(--ink-soft); }
.r-date .to { display: block; font-size: 12px; color: var(--ink-soft); margin: 2px 0; }
.r-date .day.end { font-size: 21px; }
.r-body { min-width: 0; }
.r-name { font-size: 18px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.r-meta { color: var(--ink-soft); font-size: 15px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 2px 12px; }
.r-meta span { display: inline-flex; align-items: center; gap: 4px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--ink-faint); color: var(--ink-soft); }
.badge.crew { color: var(--sea); border-color: var(--sea); background: var(--sea-soft); font-weight: 600; }
.badge.status { color: var(--warn); border-color: var(--warn); }
.race.st-off .r-name { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--ink-soft); }
.race.crew-double, .race.crew-solo { background: linear-gradient(90deg, var(--sea-soft), transparent 40%), var(--card); }

.legs { list-style: none; margin-top: 10px; border-left: 2px solid var(--ink-faint); padding-left: 12px; display: grid; gap: 8px; }
.legs li { position: relative; }
.legs li::before { content: ""; position: absolute; left: -17px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink-soft); }
.legs .l-when { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); margin-right: 6px; }
.legs .l-nm { color: var(--ink-soft); font-size: 14px; }

/* weather: the whole chip is a link to the detailed forecast */
a.wx { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 14px; margin-top: 8px; padding: 4px 10px; border-radius: 8px; background: var(--wx-1); text-decoration: none; }
a.wx:hover { outline: 1px solid var(--ink-soft); }
a.wx.lv2 { background: var(--wx-2); } a.wx.lv3 { background: var(--wx-3); } a.wx.lv4 { background: var(--wx-4); }
.wx .arrow { display: inline-block; }
.wx b { font-weight: 600; }
.wx .go { opacity: 0.55; }
.legs a.wx { margin-top: 4px; }

/* right-hand column: actions + links */
.r-side { display: flex; flex-direction: column; gap: 8px; border-left: 1px solid var(--ink-faint); padding-left: 12px; min-width: 0; }
.r-actions { display: flex; gap: 2px; justify-content: flex-end; margin: -4px -4px 0 0; }
.links { display: grid; gap: 7px; font-size: 14px; min-width: 0; }
.links a { display: inline-flex; align-items: flex-start; gap: 6px; text-decoration: none; line-height: 1.2; }
.links a .t { border-bottom: 1px solid var(--ink-faint); overflow-wrap: anywhere; }
.links a:hover .t { border-color: var(--ink); }
.links .ic { margin-top: 1px; }
.links .open { color: var(--go); font-weight: 600; }
.links .closed { color: var(--ink-soft); }
.links .search { color: var(--ink-soft); }
.links .grp { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-top: 4px; }

.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; color: var(--ink-soft); flex: none; }
.icon-btn:hover { background: var(--ink-ghost); color: var(--ink); }
.icon-btn .ic { width: 20px; height: 20px; }
.icon-btn.star[aria-pressed="true"] { color: var(--ink); }
.icon-btn.star[aria-pressed="true"] .ic { fill: currentColor; }

/* hidden race: a thin line */
.race.is-hidden { display: flex; align-items: center; gap: 10px; padding: 2px 6px 2px 12px; background: transparent; border-style: dashed; color: var(--ink-soft); font-size: 14px; opacity: 0.75; }
.race.is-hidden .h-date { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.race.is-hidden .h-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.race.is-hidden .icon-btn { width: 30px; height: 30px; }

@media (max-width: 680px) {
  .race { grid-template-columns: 46px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .r-side { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--ink-faint); padding: 8px 0 0; flex-direction: row-reverse; justify-content: space-between; align-items: flex-start; }
  .race.multi .r-name { font-size: 19px; }
}

.empty { color: var(--ink-soft); padding: 30px 0; text-align: center; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--ink-faint); border-radius: var(--radius); background: var(--card); }
table.races { border-collapse: collapse; width: 100%; font-size: 15px; min-width: 900px; }
table.races th { text-align: left; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); border-bottom: 1px solid var(--ink-faint); padding: 0; background: var(--card); }
table.races th button { width: 100%; text-align: left; padding: 10px 8px; display: flex; gap: 4px; align-items: center; text-transform: inherit; letter-spacing: inherit; }
table.races th button .ic { opacity: 0; transition: transform .2s; }
table.races th[aria-sort] button .ic { opacity: 1; }
table.races th[aria-sort="descending"] button .ic { transform: rotate(180deg); }
table.races td { padding: 8px; border-bottom: 1px solid var(--ink-ghost); vertical-align: top; }
table.races tr.starred td { background: var(--ink-ghost); }
table.races tr.starred td:first-child { box-shadow: inset 3px 0 0 var(--ink); }
table.races tr.is-hidden td { opacity: 0.4; }
table.races tr.past td { color: var(--ink-soft); }
table.races tr.multi .t-name { font-weight: 700; }
table.races .t-name { font-weight: 600; }
table.races .t-date { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
table.races .st-off .t-name { text-decoration: line-through; }
table.races tr.today-row td { padding: 0; border: 0; height: 0; position: relative; }
table.races tr.today-row td::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--today); }
table.races tr.today-row td span { position: absolute; left: 8px; top: -13px; background: var(--card); color: var(--today); font-weight: 700; font-size: 16px; padding: 0 6px; text-transform: uppercase; letter-spacing: .03em; }
table.races .acts { white-space: nowrap; }
table.races .acts .icon-btn { width: 30px; height: 30px; }
table.races .acts .icon-btn .ic { width: 17px; height: 17px; }
table.races a.wx { margin: 0; padding: 2px 7px; font-size: 13px; white-space: nowrap; }
table.races .badge { font-size: 12px; padding: 1px 7px; }
table.races .club-links a { display: block; }

/* ---------- timeline ---------- */
.tl-wrap { border: 1px solid var(--ink-faint); border-radius: var(--radius); background: var(--card); overflow-x: auto; overflow-y: hidden; position: relative; -webkit-overflow-scrolling: touch; }
.tl { position: relative; }
.tl-months { position: relative; height: 26px; border-bottom: 1px solid var(--ink-faint); }
.tl-months span { position: absolute; top: 4px; font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); padding-left: 6px; border-left: 1px solid var(--ink-faint); height: 22px; white-space: nowrap; }
.tl-days { position: relative; height: 22px; border-bottom: 1px solid var(--ink-faint); }
.tl-days span { position: absolute; top: 3px; width: var(--day); text-align: center; font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.tl-days span.we { color: var(--ink); font-weight: 600; }
.tl-grid { position: absolute; inset: 48px 0 0 0; pointer-events: none; }
.tl-grid i { position: absolute; top: 0; bottom: 0; width: var(--day); background: var(--ink-ghost); }
.tl-lanes { position: relative; margin-top: 26px; }
.tl-bar { position: absolute; height: calc(var(--lane) - 10px); display: flex; align-items: center; gap: 7px; text-align: left; font-size: 14px; line-height: 1.15; }
.tl-bar .blk { flex: none; height: 100%; border-radius: 8px; border: 1.5px solid var(--ink-soft); background: var(--card); display: inline-flex; align-items: center; justify-content: center; }
.tl-bar .lbl { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tl-bar.multi .blk { border-color: var(--ink); background: var(--paper-deep); }
.tl-bar.starred .blk { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tl-bar.starred .lbl { font-weight: 700; }
.tl-bar.crew-double .blk, .tl-bar.crew-solo .blk { border-color: var(--sea); border-width: 2px; }
.tl-bar.starred.crew-double .blk, .tl-bar.starred.crew-solo .blk { background: var(--sea); border-color: var(--sea); color: #fff; }
.tl-bar .blk .ic { width: 15px; height: 15px; color: var(--sea); }
.tl-bar.starred .blk .ic { color: inherit; }
.tl-bar.is-hidden { opacity: 0.28; }
.tl-bar.st-off .lbl { text-decoration: line-through; color: var(--ink-soft); }
.tl-bar.past { opacity: 0.55; }
.tl-bar.past.is-hidden { opacity: 0.18; }
.tl-bar:hover .lbl { text-decoration: underline; }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--today); z-index: 3; pointer-events: none; }
.tl-today span { position: absolute; top: 52px; left: 5px; background: var(--today); color: #fff; font-weight: 700; font-size: 15px; padding: 1px 7px; border-radius: 4px; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-soft); font-size: 14px; margin-top: 10px; }
.tl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tl-legend i { display: inline-block; width: 22px; height: 14px; border-radius: 3px; border: 1.5px solid var(--ink-soft); }
.tl-legend i.multi { width: 40px; border-color: var(--ink); background: var(--paper-deep); }
.tl-legend i.star { background: var(--ink); border-color: var(--ink); }
.tl-legend i.crew { border-color: var(--sea); border-width: 2px; }
.tl-legend i.today { width: 2px; border: 0; background: var(--today); border-radius: 0; height: 16px; }

/* ---------- sheets (dialogs) ---------- */
.sheet { border: 0; padding: 0; background: var(--paper); color: var(--ink); width: min(640px, 100vw - 24px); max-height: min(86vh, 900px); margin: auto; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
#areaSheet { width: min(420px, 100vw - 24px); }
.sheet::backdrop { background: rgba(4, 8, 16, 0.5); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 0 16px; }
.sheet-head h2 { font-weight: 600; font-size: 24px; }
#detailBody, #subBody { padding: 4px 16px 18px; }
#detailBody .race { border: 0; padding: 4px 0; background: transparent; box-shadow: none; }
@media (max-width: 560px) { .sheet, #areaSheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 14px 14px 0 0; max-height: 88vh; } }
.sub-actions { display: grid; gap: 8px; margin: 14px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.btn.primary { background: var(--ink); color: var(--paper); }
.sub-sep { border: 0; border-top: 1px solid var(--ink-faint); margin: 16px 0; }
.copy-row { display: flex; gap: 6px; margin-top: 8px; }
.copy-row input { flex: 1; min-width: 0; font: 12px var(--mono); padding: 8px; border: 1px solid var(--ink-faint); border-radius: 8px; background: var(--card); color: var(--ink); }
#subBody h3 { font-size: 17px; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }

/* ---------- footer ---------- */
.foot { color: var(--ink-soft); font-size: 13.5px; padding-top: 20px; padding-bottom: 40px; border-top: 1px solid var(--ink-faint); display: grid; gap: 4px; }
.foot a { text-decoration-color: var(--ink-faint); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
