/* app_dir.css — the app's regatta directory, verbatim, for sailboss.ai.
 *
 * The Regattas page embeds the SAME directory the app renders at
 * app.sailboss.ai (#directory). Tokens are the app's hacker-theme values from
 * src/sailgpt/assets/tokens.css, scoped under .app-dir so they can't collide
 * with site.css (where --ink is the lime accent; in the app it's near-white).
 * The hh-* rules below are copied from src/sailgpt/assets/hub_home.css —
 * when the app's directory styling changes, re-copy rather than re-derive.
 */

.app-dir, .sb-source-dialog {
  --bg:#000000; --surface:#060B06; --sunken:#0A120A; --line:#123610; --line-2:#1A4716; --line-3:#266326;
  --ink:#F0F1E9; --muted:#A5ADA6; --faint:#69766B;
  --accent:#28FE14; --accent-ink:#6BFF55; --accent-soft:rgba(40,254,20,0.13); --accent-line:#1C7A18;
  --gain:#28FE14; --loss:#FF5F56; --warn:#E8C000;
  --rank-0:#BC2826; --rank-1:#D35500; --rank-2:#D78500; --rank-3:#C0B100; --rank-4:#92D700; --rank-5:#3DFF2C;
  --select:#55CFF5; --on-accent:#001400;
  --paper:#F0F1E9; --paper-dim:#8DA38F; --cyan:#55CFF5;
  --r:12px; --r-sm:8px;
  --shadow-pop:0 12px 40px rgba(0,0,0,.75);
  --font-ui:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  --mono:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;

  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
.app-dir a { color: inherit; text-decoration: none; }

/* ── Directory head (hub_home.css §Directory) ─────────────────────────── */
.hh-main { padding-bottom: 24px; }
.hh-section-kicker {
  font: 700 10px/1.4 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cyan);
}
.hh-directory-head {
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
  padding: 34px 2px 20px;
}
.hh-directory-head > div { display: grid; gap: 5px; }
.hh-directory-head .hh-section-kicker { color: var(--accent); }
.hh-directory-head h1 { margin: 0; color: var(--ink); font: 700 clamp(28px, 4vw, 40px)/1 var(--font-ui); letter-spacing: -.035em; }
.hh-directory-tools { display: flex !important; align-items: center; justify-content: flex-end; gap: 14px; }
.hh-directory-tools > p { margin: 0; color: var(--muted); font: 10px/1.4 var(--mono); white-space: nowrap; }
.hh-directory-tools > p strong { color: var(--accent); font-weight: 800; }
.hh-directory-tools label { display: inline-flex; align-items: center; gap: 7px; color: var(--faint); font: 700 8px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.hh-directory-tools select {
  appearance: none; -webkit-appearance: none;
  width: 124px; min-width: 124px; height: 32px; padding: 0 29px 0 10px;
  color: var(--ink); background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238DA38F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 10px 7px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); outline: none;
  font: 650 11px/1 var(--font-ui); text-transform: none; letter-spacing: 0; cursor: pointer;
}
.hh-directory-tools select:hover, .hh-directory-tools select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.hh-directory-foot { padding: 15px 2px 0; color: var(--muted); font-size: 12px; text-align: right; }
.hh-scroll-hint { display: none; }

/* ── Site-only additions ──────────────────────────────────────────────────
   Not in the app's hub_home.css. The app's directory sits behind a login and
   carries a ⌘K search in the shell bar above it; this one is the public front
   door, so the search and the "we'll add it" ask have to live in the toolbar
   itself. Keep these below the copied rules so a re-copy from the app is a
   clean replace of everything above. */
/* Three controls instead of the app's one, so the row has to be able to wrap
   rather than run off the page. */
.hh-directory-tools { flex-wrap: wrap; }
.hh-directory-tools input[type="search"] {
  width: 260px; height: 32px; padding: 0 11px;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  outline: none; font: 500 12px/1 var(--font-ui);
}
.hh-directory-tools input[type="search"]::placeholder { color: var(--faint); }
.hh-directory-tools input[type="search"]:hover,
.hh-directory-tools input[type="search"]:focus {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
}
/* Filled accent: this is the one thing in the toolbar that does something for
   a visitor whose regatta isn't in the table, so it reads as the action it is. */
.hh-ask {
  height: 32px; padding: 0 13px;
  color: var(--on-accent); background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--r-sm);
  font: 700 12px/1 var(--font-ui); white-space: nowrap; cursor: pointer;
}
.hh-ask:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.hh-linklike {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

/* ── Regatta table (hub_home.css §Regatta table) ──────────────────────── */
.hh-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
}
.hh-table {
  width: 100%;
  border-collapse: collapse;
  font: 13px/1.45 var(--font-ui);
  min-width: 1080px;
}
.hh-table th:first-child, .hh-table td:first-child { width: 34%; min-width: 210px; }
.hh-table th:nth-child(2), .hh-table td:nth-child(2) { white-space: nowrap; }
.hh-table th:nth-child(3), .hh-table td:nth-child(3) { white-space: nowrap; width: 1%; }
.hh-dates { color: var(--paper-dim); font-variant-numeric: tabular-nums; }
.hh-table thead th {
  text-align: left;
  padding: 10px 14px;
  font: 11px/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-dim);
  background: var(--sunken);
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
  font-weight: 400;
}
.hh-table thead th a { color: inherit; }
.hh-table thead th.hh-th-sort a:hover { color: var(--paper); }
.hh-table thead th.on a { color: var(--accent); }
.hh-table thead th.on a::after { content: " ▾"; }
.hh-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.hh-table tbody tr:last-child td { border-bottom: 0; }
.hh-table tbody tr[data-href] { cursor: pointer; }
.hh-table tbody tr:hover td { background: var(--sunken); }
.hh-group-row th {
  padding: 8px 13px; color: var(--paper-dim); background: var(--bg); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line);
  font: 700 9px/1.3 var(--mono); letter-spacing: .1em; text-align: left; text-transform: uppercase;
}
.hh-group-row:first-child th { border-top: 0; }
.hh-group-row th span { color: var(--cyan); }
.hh-group-row.live th span { color: var(--accent); }
.hh-group-row th b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 7px; padding: 0 5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; font-size: 8px; }

.hh-ev { color: var(--paper); }
.hh-ev-name { color: var(--paper); font: 650 13px/1.3 var(--font-ui); letter-spacing: -.006em; }
a.hh-ev-name:hover { color: var(--accent); text-decoration: underline; }
.hh-ev small {
  display: block;
  font-weight: 400;
  color: var(--paper-dim);
  font-size: 11px;
  margin-top: 2px;
}
.hh-num { text-align: right; font-variant-numeric: tabular-nums; }
td.hh-num { color: var(--paper); font-size: 13px; }
.hh-na { color: var(--faint); }
.hh-avail { white-space: nowrap; }
.hh-table th:last-child, .hh-table td:last-child { min-width: 142px; }
.hh-status { display: inline-flex; align-items: center; color: var(--paper); font: 600 12px/1.35 var(--font-ui); white-space: nowrap; }
.hh-status.available { color: var(--accent); font-weight: 650; }
.hh-status.available::before {
  content: ""; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 7px color-mix(in srgb, var(--accent) 48%, transparent);
}
.hh-status.early { color: var(--warn); }
.hh-status.scheduled { color: var(--paper-dim); }
.hh-avail > small { display: block; margin-top: 2px; color: var(--faint); font: 11px/1.3 var(--font-ui); white-space: nowrap; }
.hh-next { display: inline-block; margin: 0 6px 3px 0; padding: 2px 6px; color: var(--cyan); background: rgba(85,207,245,.09); border: 1px solid rgba(85,207,245,.3); border-radius: 99px; font: 600 9px/1.35 var(--font-ui); font-style: normal; letter-spacing: .04em; text-transform: uppercase; }

.hh-score { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; }
.hh-wind-m { color: var(--paper); white-space: nowrap; font-size: 11px; }
.hh-wind-d { color: var(--paper-dim); font-size: 13px; white-space: nowrap; }

.hh-table-note {
  max-width: 78ch; margin: 10px 2px 0;
  color: var(--paper-dim); font: 11.5px/1.6 var(--font-ui);
}
.hh-table-note strong { color: var(--paper); font-weight: 600; }

.hh-table tbody tr.scheduled .hh-ev-name { color: var(--paper); }
.hh-table tbody tr.scheduled:not(.early) td { color: var(--muted); }
.hh-request-access {
  padding: 5px 8px; border: 1px solid var(--accent-line); border-radius: 7px;
  background: var(--accent-soft); color: var(--accent);
  font: 700 10px/1.2 var(--font-ui); white-space: nowrap; cursor: pointer;
}
.hh-request-access:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.hh-table .hh-request-access {
  display: block; width: max-content; margin-top: 5px; padding: 2px 0;
  color: var(--paper-dim); background: transparent; border: 0;
  border-radius: 0; font-weight: 500; text-decoration: underline;
  text-decoration-color: var(--line-3); text-underline-offset: 3px;
}
.hh-table .hh-request-access:hover {
  color: var(--cyan); background: transparent;
  text-decoration-color: var(--cyan);
}

.hh-empty {
  color: var(--muted);
  font: 13px/1.5 var(--font-ui);
  font-style: italic;
  padding: 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
}

@media (max-width: 600px) {
  .hh-directory-head { display: block; padding-top: 24px; }
  .hh-directory-tools { justify-content: flex-start; margin-top: 15px; }
  .hh-directory-tools label { margin-left: auto; }
  .hh-directory-foot { text-align: left; }
}

/* Site-only, and deliberately after the copied mobile block above so these
   win: on a phone the three toolbar controls share the width instead of
   pushing the ask button off the right edge. */
@media (max-width: 600px) {
  .hh-directory-tools { width: 100%; gap: 8px; }
  .hh-directory-tools select { flex: 0 0 112px; min-width: 0; }
  .hh-directory-tools select,
  .hh-directory-tools input[type="search"],
  .hh-ask { min-height: 42px; }
  .hh-directory-tools input[type="search"] { flex: 1 1 0; width: auto; min-width: 0; }
  .hh-ask { flex: 1 1 100%; }
  .hh-scroll-hint {
    display: block; margin: 0 0 8px; color: var(--paper-dim);
    font: 10.5px/1.45 var(--font-ui);
  }
  .hh-table thead th:first-child,
  .hh-table tbody tr:not(.hh-group-row) td:first-child {
    position: sticky; left: 0; z-index: 2; background: var(--surface);
    box-shadow: 1px 0 0 var(--line);
  }
  .hh-table th:first-child, .hh-table td:first-child {
    width: 240px; min-width: 240px; max-width: 240px;
  }
  .hh-table thead th:first-child { z-index: 3; background: var(--sunken); }
  .hh-table tbody tr:hover td:first-child { background: var(--sunken); }
}

/* ── Source column (hub_home.css §Source) ─────────────────────────────── */
.hh-source { white-space: nowrap; }
.app-dir .hh-source-link { color: var(--paper); font-size: 13px; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.app-dir .hh-source-link:hover { color: var(--accent); text-decoration-color: currentColor; }

/* ── GPS credit panel — copied byte for byte from tokens.css ──────────────
   (tests/test_sources.py compares the two). The dialog sits on <body>, so it
   gets the app tokens by name at the top of this file. */
/* SOURCE-PANEL-BEGIN */
/* Shared GPS attribution panel; native dialog provides focus trapping/Escape. */
.sb-source-dialog { box-sizing: border-box; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 22px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); font: 14px/1.5 var(--font-ui); }
.sb-source-dialog::backdrop { background: rgb(0 0 0 / .2); }
.sb-source-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: 24px/1 var(--font-ui); cursor: pointer; }
.sb-source-dialog .sb-source-by { padding-right: 36px; }
.sb-source-close:hover { background: var(--sunken); }
.sb-source-by { margin: 0; color: var(--paper-dim); font: 14px/1.6 var(--font-ui); }
.sb-source-by strong { color: var(--ink); }
/* The provider's name is the way to the original replay: accent colour and
   an underline, so it reads as a link and not as bold text. */
.sb-source-by a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.sb-source-by a:hover { color: var(--ink); }
.sb-source-by.gone a { text-decoration: line-through; color: var(--paper-dim); }
.sb-source-by + .sb-source-note { margin: 8px 0 0; max-width: none; }
.sb-source-by + .sb-source-links, .sb-source-by + .sb-source-races { margin-top: 14px; }
.sb-source-links { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
.sb-source-item { max-width: 100%; }
.sb-source-replay { display: inline-block; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 7px; font: 600 13px/1.5 var(--font-ui); }
.sb-source-replay { color: var(--accent); text-decoration: none; }
.sb-source-replay:hover { background: var(--sunken); border-color: var(--accent); }
.sb-source-replay.gone { color: var(--paper-dim); text-decoration: line-through; }
/* A link per race: one compact row of race numbers. */
.sb-source-races { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sb-source-races-label { margin-right: 4px; color: var(--paper-dim); font: 13px/1 var(--font-ui); }
.sb-source-race { min-width: 30px; padding: 6px 4px; border: 1px solid var(--line-2); border-radius: 6px; color: var(--accent); font: 600 13px/1 var(--font-ui); text-align: center; text-decoration: none; font-variant-numeric: tabular-nums; }
.sb-source-race:hover { background: var(--sunken); border-color: var(--accent); }
.sb-source-race.gone { color: var(--paper-dim); text-decoration: line-through; }
.sb-source-note { display: block; max-width: 32ch; margin: 5px 0 0; color: var(--paper-dim); font: 12px/1.5 var(--font-ui); }
@media (max-width: 600px) {
  .sb-source-dialog { inset: auto 0 0 !important; margin: 0 !important; width: 100%; max-width: none; max-height: 80dvh; border-radius: 16px 16px 0 0; padding: 22px 22px max(24px, env(safe-area-inset-bottom)); }
  .sb-source-replay { padding: 11px 13px; }
  .sb-source-race { min-width: 40px; padding: 11px 6px; }
  .sb-source-close { width: 44px; height: 44px; top: 8px; right: 8px; }
  .sb-source-dialog .sb-source-by { padding-right: 44px; }
}
/* SOURCE-PANEL-END */
