/* Club profile page. Builds on styles.css tokens; adds only club-* classes. */
.club-main { width: min(1180px, 94vw); margin: 0 auto; padding-bottom: 48px; }
.club-loading { padding: 80px 0; color: var(--muted); }

.club-hero {
  padding: clamp(40px, 6vw, 84px) 0 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
  border-bottom: 1px solid var(--ink);
}
.club-hero h1 { font-size: clamp(44px, 6.4vw, 96px); overflow-wrap: anywhere; }
.club-hero .lede { margin-top: 18px; max-width: 46ch; }

.club-blade { margin: 0; text-align: right; }
.club-blade-face {
  display: inline-block;
  max-width: 100%;
  height: auto;
  background-repeat: no-repeat;
  image-rendering: auto;
  filter: drop-shadow(0 1px 1px rgba(20, 33, 31, .18));
}
.club-blade figcaption { margin-top: 6px; color: var(--muted); font-size: 11px; }

.club-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--ink);
}
.club-stats div { padding: 22px 0 20px; border-right: 1px solid var(--line); padding-left: 18px; }
.club-stats div:first-child { padding-left: 0; }
.club-stats div:last-child { border-right: 0; }
.club-stats b { display: block; font-family: var(--serif); font-size: clamp(34px, 4vw, 54px); font-weight: 500; line-height: 1; }
.club-stats span { color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }

.club-panel { min-width: 0; padding: 34px 0; border-bottom: 1px solid var(--line); }
.club-panel h2 { font-family: var(--serif); font-size: clamp(26px, 2.6vw, 36px); font-weight: 500; margin-bottom: 16px; }
.club-panel-head { min-width: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.club-panel-controls { min-width: 0; max-width: 100%; display: flex; align-items: center; justify-content: flex-end; gap: 12px 18px; flex-wrap: wrap; }
.club-panel-head label, .club-index-controls label { display: inline-flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.club-panel select, .club-panel input {
  padding: 8px 10px; border: 1px solid var(--line); background: var(--white); color: var(--ink); max-width: 100%;
}
.club-index-controls { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; }
.club-index-controls input { width: min(360px, 70vw); }
.club-az { display: flex; flex-wrap: wrap; gap: 4px; margin: -4px 0 16px; }
.club-az a { display: inline-grid; min-width: 27px; min-height: 24px; box-sizing: border-box; padding: 5px 6px; place-items: center; color: var(--muted); border: 1px solid var(--line); font: 800 11px/1 var(--sans); text-align: center; text-decoration: none; }
.club-az a:hover, .club-az a:focus-visible { color: var(--white); background: var(--brand); border-color: var(--brand); outline: none; }
.club-az a[aria-current="true"] { color: var(--white); background: var(--brand); border-color: var(--brand); }
.club-show-more { margin-top: 16px; min-height: 44px; padding: 9px 14px; color: var(--ink); background: transparent; border: 1px solid var(--ink); cursor: pointer; font-weight: 800; }
.club-show-more:hover, .club-show-more:focus-visible { color: var(--white); background: var(--brand); }

.club-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.club-tile { background: var(--white); border: 1px solid var(--line); padding: 16px; }
.club-tile b { display: block; font-family: var(--serif); font-size: 32px; font-weight: 500; color: var(--brand); }
.club-tile span { font-size: 12px; color: var(--muted); line-height: 1.35; display: block; margin-top: 4px; }

.club-note { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.club-muted { color: var(--muted); }
.club-tag { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); border: 1px solid currentColor; padding: 1px 5px; margin-left: 6px; }

.club-family-chart-shell { position: relative; min-width: 0; }
.club-family-chart { min-width: 0; }
.club-chart { width: 100%; height: auto; display: block; margin: 8px 0 4px; }
.club-chart-y-axis,
.club-chart-earlier-cue,
.club-chart-edge-fade { display: none; }
.club-family-sections { margin-top: 16px; border-top: 1px solid var(--ink); }
.club-family { border-bottom: 1px solid var(--line); }
.club-family > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 10px 18px; min-height: 52px; padding: 13px 4px; cursor: pointer; list-style-position: inside; }
.club-family > summary > span { font-family: var(--serif); font-size: 21px; }
.club-family > summary small { color: var(--muted); }
.club-family > summary a { color: var(--brand); font-size: 12px; font-weight: 800; text-underline-offset: 3px; }
.club-family[open] { padding-bottom: 22px; }
.club-medals-details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 800; }

@media (min-width: 900px) {
  .club-family-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .club-family:nth-child(odd) { border-right: 1px solid var(--line); padding-right: 14px; }
  .club-family:nth-child(even) { padding-left: 14px; }
  .club-family > summary { min-height: 42px; padding-block: 8px; gap: 8px 12px; }
  .club-family > summary > span { font-size: 18px; line-height: 1.1; }
  .club-family[open] > .table-wrap { max-height: 360px; overflow: auto; }
}
.club-blade-placeholder svg { width: 150px; height: auto; color: var(--muted); }
.club-chart-modes { display: inline-flex; border: 1px solid var(--line); background: var(--white); }
.club-chart-modes button { appearance: none; border: 0; border-right: 1px solid var(--line); padding: 8px 10px; background: transparent; color: var(--muted); font: 700 11px var(--sans); cursor: pointer; }
.club-chart-modes button:last-child { border-right: 0; }
.club-chart-modes button:hover, .club-chart-modes button:focus-visible { color: var(--brand); }
.club-chart-modes button.is-active { background: var(--brand); color: var(--white); }
.cg-grid { stroke: var(--line); stroke-width: 1; }
.cg-mid { stroke: var(--brand); stroke-width: 1.2; stroke-dasharray: 4 4; }
.cg-axis { font: 11px var(--sans); fill: var(--muted); }
.cg-note { font: 10px var(--sans); fill: var(--muted); }
.cg-val { font: 600 11px var(--sans); fill: var(--ink); }
.cg-bar { fill: var(--brand); }
.cg-low { fill: var(--accent-on-brand); }
.cg-medal { fill: var(--medal); }
.cg-canceled { fill: var(--paper-deep); opacity: .8; }
.cg-canceled-hatch { pointer-events: none; }
.cg-canceled-hatch-line { stroke: var(--line); stroke-width: 1; opacity: .55; }
.cg-canceled-label { fill: var(--chart-rust); font: 800 10px var(--sans); letter-spacing: .08em; }
.club-chart g:focus { outline: none; }
.club-chart g:focus .cg-bar, .club-chart g:hover .cg-bar { stroke: var(--brand); stroke-width: 2; }

.club-legend { font-size: 12px; color: var(--muted); display: flex; gap: 6px 16px; align-items: center; flex-wrap: wrap; }
.lg-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.club-legend-detail, .club-legend-note { flex: 1 0 100%; color: var(--muted); }
.club-legend-note { margin-top: -3px; }
.lg { display: inline-block; flex: 0 0 auto; width: 12px; height: 12px; margin: 0; }
.lg-bar { background: var(--brand); } .lg-low { background: var(--accent-on-brand); } .lg-medal { background: var(--medal); }
.lg-mid { height: 0; border-top: 2px dashed var(--brand); width: 16px; }

.club-table td.n, .club-table th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#club-chart { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.club-table td, .club-table th { padding: 10px 12px; }
.club-table a { text-underline-offset: 3px; }

.club-list { margin: 0; padding-left: 18px; line-height: 1.7; }
.club-facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; }
.club-facts dt { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); padding-top: 3px; }
.club-facts dd { margin: 0; font-family: var(--serif); font-size: 18px; line-height: 1.45; }
.club-editor { margin-top: 20px; padding: 14px 16px; background: var(--white); border-left: 3px solid var(--accent); }

.club-howto summary { cursor: pointer; font-family: var(--serif); font-size: 22px; }
.club-howto p { max-width: 72ch; line-height: 1.55; margin-top: 12px; }

.club-footer { width: min(1180px, 94vw); margin: 0 auto 40px; color: var(--muted); font-size: 12px; line-height: 1.5; }

@media (max-width: 760px) {
  .club-hero { grid-template-columns: 1fr; }
  .club-blade { text-align: left; }
  .club-stats, .club-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .club-stats div:nth-child(2) { border-right: 0; }
  .club-stats div:nth-child(3) { padding-left: 0; }
  .club-facts { grid-template-columns: 1fr; }
  .club-panel-head { display: block; }
  .club-panel-controls { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
  .club-panel-controls label { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .club-panel-controls select { width: 100%; min-width: 0; }
  .club-chart-modes { width: 100%; }
  .club-chart-modes button { flex: 1; }
  .club-family-chart {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-color: var(--line) transparent;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .club-family-chart:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
  .club-chart { min-width: 640px; }
  .club-chart .cg-y-axis-label { visibility: hidden; }
  .club-chart-y-axis {
    position: absolute;
    z-index: 3;
    left: 0;
    display: block;
    min-width: 38px;
    pointer-events: none;
    background: var(--paper);
  }
  .club-chart-y-axis-svg { display: block; width: 100%; height: 100%; overflow: visible; }
  .club-chart-earlier-cue {
    position: absolute;
    z-index: 5;
    top: 12px;
    left: calc(var(--club-chart-axis-width, 41px) + 5px);
    display: inline-flex;
    min-height: 24px;
    padding: 3px 6px;
    align-items: center;
    color: var(--muted);
    background: rgba(244, 240, 231, .94);
    border: 0;
    font: 800 9px var(--sans);
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .club-chart-earlier-cue[hidden] { display: none; }
  .club-chart-earlier-cue:hover,
  .club-chart-earlier-cue:focus-visible { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
  .club-chart-edge-fade {
    position: absolute;
    z-index: 2;
    top: 8px;
    bottom: 4px;
    display: block;
    width: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
  }
  .club-chart-edge-fade-left {
    left: var(--club-chart-axis-width, 41px);
    background: linear-gradient(90deg, rgba(244, 240, 231, .92), rgba(244, 240, 231, 0));
  }
  .club-chart-edge-fade-right {
    right: 0;
    background: linear-gradient(270deg, rgba(244, 240, 231, .96), rgba(244, 240, 231, 0));
  }
  .club-family-chart-shell.has-earlier .club-chart-edge-fade-left,
  .club-family-chart-shell.has-later .club-chart-edge-fade-right { opacity: 1; }
  .club-table td { padding: 8px; font-size: 13px; }
  .club-family > summary { grid-template-columns: minmax(0, 1fr) auto; }
  .club-family > summary a { grid-column: 1 / -1; margin-left: 20px; }
}

@media (max-width: 600px) {
  .club-family[open] > .table-wrap { max-height: none; overflow: visible; }
  .club-table { display: block; width: 100%; min-width: 0; }
  .club-table thead { display: none; }
  .club-table tbody { display: grid; }
  .club-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "year finish field"
      "boat boat division"
      "gap medals source";
    gap: 4px 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  .club-table td,
  .club-table td.n {
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
  }
  .club-table td::before {
    margin-right: 4px;
    color: var(--muted);
    content: attr(data-label) " ";
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  .club-year { grid-area: year; }
  .club-finish { grid-area: finish; }
  .club-field { grid-area: field; }
  .club-boat { grid-area: boat; overflow-wrap: anywhere; }
  .club-division { grid-area: division; text-align: right !important; overflow-wrap: anywhere; }
  .club-gap { grid-area: gap; }
  .club-medals { grid-area: medals; }
  .club-source { grid-area: source; text-align: right !important; }
  .club-boat, .club-division { color: var(--muted); }
  .club-table :is(.club-boat, .club-division)::before { color: inherit; }
}

/* Result rows open the corresponding race while the source link remains separate. */
.club-row-link { cursor: pointer; }
.club-row-link:hover td, .club-row-link:focus-within td { background: var(--accent-wash); }
.club-race-link { font-weight: 700; text-underline-offset: 3px; }
