/* Fives — Club directory styles. Prefix: cd-.
   Mobile-first. Region-grouped card grid; no map (the courts page owns that).
   Structure and tokens mirror courts-page.css so the two directories read as
   one family. */

html, body { margin: 0; padding: 0; }
body {
  background: var(--fives-bg);
  color: var(--fives-text);
  font-family: var(--fives-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.cd-app { min-height: 100vh; }

/* ─── Hero ────────────────────────────────────────────────── */
.cd-hero {
  max-width: 1240px;
  margin: 0 auto;
  padding: 56px 24px 32px;
}
@media (min-width: 760px) {
  .cd-hero { padding: 96px 40px 48px; }
}
.cd-hero-eyebrow {
  font-size: 12px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--fives-primary);
  margin: 0 0 14px;
}
.cd-hero-h1 {
  font-family: var(--fives-display);
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 600;
  letter-spacing: -2.4px;
  line-height: 0.98;
  margin: 0;
  color: var(--fives-text);
}
.cd-hero-sub {
  font-family: var(--fives-display);
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 500;
  letter-spacing: -0.6px;
  line-height: 1.2;
  color: var(--fives-muted);
  margin: 8px 0 22px;
}
.cd-hero-body {
  font-size: 16px;
  line-height: 1.6;
  color: var(--fives-text);
  max-width: 62ch;
  margin: 0;
  text-wrap: pretty;
}

/* ─── Sticky filter bar ───────────────────────────────────── */
.cd-filterbar {
  position: sticky; top: calc(65px + var(--safe-top)); z-index: 40;
  background: var(--fives-bg);
  border-top: 1px solid var(--fives-line);
  border-bottom: 1px solid var(--fives-line);
  padding: 12px max(24px, var(--safe-left)) 12px max(24px, var(--safe-right));
}
@media (min-width: 760px) {
  .cd-filterbar { top: calc(69px + var(--safe-top)); padding-left: max(40px, var(--safe-left)); padding-right: max(40px, var(--safe-right)); }
}
.cd-filterbar-inner { max-width: 1240px; margin: 0 auto; }

.cd-filter {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cd-filter::-webkit-scrollbar { display: none; }
.cd-segmented {
  display: inline-flex;
  background: color-mix(in srgb, var(--fives-bg) 97%, transparent);
  border: 1px solid var(--fives-line);
  border-radius: var(--fives-r-sm);
  padding: 3px;
  gap: 2px;
  position: relative;
  width: max-content;
}
.cd-seg-ind {
  position: absolute;
  top: 3px; bottom: 3px; left: 0;
  background: var(--fives-primary);
  border-radius: 3px;
  pointer-events: none;
  transition: transform var(--fives-t-standard) var(--fives-e-draw),
              width var(--fives-t-standard) var(--fives-e-draw);
}
.cd-seg {
  position: relative; z-index: 1;
  background: transparent;
  border: none;
  font-family: var(--fives-body);
  font-size: 13px; font-weight: 500;
  color: var(--fives-muted);
  padding: 7px 14px;
  border-radius: 3px;
  cursor: pointer;
  transition: color var(--fives-t-quick);
  white-space: nowrap;
}
.cd-seg:hover { color: var(--fives-text); }
.cd-seg:active { transform: scale(0.97); transition-duration: var(--fives-t-instant); }
.cd-seg.is-on { color: #ffffff; }
.cd-seg:focus-visible { outline: 2px solid var(--fives-primary); outline-offset: 2px; }
.cd-seg-n {
  font-family: var(--fives-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
  margin-left: 6px;
}

/* Filter meta: count + the active type's one-line note. */
.cd-meta {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-top: 10px;
  min-height: 18px;   /* reserve — the note swaps in/out (zero CLS) */
}
.cd-count {
  font-family: var(--fives-mono);
  font-size: 12px;
  color: var(--fives-muted);
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.cd-note {
  font-size: 12.5px;
  color: var(--fives-muted);
  margin: 0;
  line-height: 1.4;
}

/* ─── Directory ───────────────────────────────────────────── */
.cd-directory {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px max(24px, var(--safe-left)) 48px max(24px, var(--safe-right));
  box-sizing: border-box;
}
@media (min-width: 760px) {
  .cd-directory { padding: 48px max(40px, var(--safe-left)) 64px max(40px, var(--safe-right)); }
}

.cd-group + .cd-group { margin-top: 40px; }
.cd-group-h {
  display: flex; align-items: baseline; gap: 10px;
  padding: 0 0 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--fives-line);
}
.cd-group-h h2 {
  font-family: var(--fives-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.4px;
  margin: 0;
  color: var(--fives-text);
}
.cd-group-h span {
  font-family: var(--fives-mono);
  font-size: 12px;
  color: var(--fives-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4px;
}

.cd-grid {
  display: grid;
  /* minmax(0, …) not 1fr: a bare 1fr track takes min-width:auto, and a long
     nowrap "Plays at …" line (Jock Burnet Fives Centre is the worst) would
     push the column past the viewport and scroll the whole page sideways. */
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  list-style: none;
  margin: 0; padding: 0;
}
@media (min-width: 700px)  { .cd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .cd-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ─── Club card ───────────────────────────────────────────── */
.cd-club {
  display: flex; flex-direction: column;
  /* Anchor target for /clubs#club-… links from the courts page. Clears the
     sticky nav (65px + safe-top) plus the filter bar (91px at its tallest,
     when the note wraps to two lines), so the card never lands underneath. */
  scroll-margin-top: calc(168px + var(--safe-top));
  background: #ffffff;
  border: 1px solid var(--fives-line);
  border-radius: var(--fives-r-md);
  padding: 16px 18px 14px;
  transition: border-color var(--fives-t-quick),
              transform var(--fives-t-quick) var(--fives-e-settle),
              box-shadow var(--fives-t-quick) var(--fives-e-settle);
}
.cd-club:hover {
  border-color: var(--fives-primary);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -14px rgba(42,36,24,.35);
}
.cd-club-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.cd-club-title { min-width: 0; flex: 1; }
.cd-club-title h3 {
  font-family: var(--fives-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--fives-text);
  margin: 0 0 4px;
  line-height: 1.2;
  text-wrap: balance;
}
.cd-club-loc {
  font-size: 13px;
  color: var(--fives-muted);
  margin: 0;
  line-height: 1.4;
}
.cd-club-dot { color: var(--fives-line); margin: 0 4px; }

.cd-tag {
  display: inline-flex; align-items: center;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 100px;
  border: 1px solid var(--fives-line);
  background: var(--fives-bg);
  font-family: var(--fives-body);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--fives-muted);
}
/* Open leads — it gets the accent. Everything else stays quiet. */
.cd-tag--open         { color: #ffffff; background: var(--fives-accent); border-color: var(--fives-accent); }
.cd-tag--university   { color: #4A40B8;                 border-color: rgba(90,79,207,0.3);  background: rgba(90,79,207,0.06); }
.cd-tag--school       { color: var(--fives-primary);    border-color: rgba(35,76,54,0.3);   background: rgba(35,76,54,0.06); }
.cd-tag--alumni       { color: var(--fives-muted);      border-color: var(--fives-line);    background: var(--fives-bg-2); }
.cd-tag--invitational { color: var(--fives-muted);      border-color: var(--fives-line);    background: var(--fives-bg-2); }

.cd-club-desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--fives-text);
  margin: 0 0 12px;
  text-wrap: pretty;
  flex: 1;   /* pushes the foot to the card bottom so rows align */
}
.cd-club-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--fives-line);
  font-size: 12.5px;
}
.cd-club-court {
  color: var(--fives-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.cd-club-court {
  color: var(--fives-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--fives-line);
  transition: color var(--fives-t-quick), border-color var(--fives-t-quick);
}
a.cd-club-court:hover { color: var(--fives-primary); border-color: var(--fives-primary); }
a.cd-club-court:focus-visible { outline: 2px solid var(--fives-primary); outline-offset: 2px; }
.cd-club-cta {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--fives-primary);
  text-decoration: none;
  white-space: nowrap;
}
.cd-club-cta:hover { color: var(--fives-primary-700); text-decoration: underline; }
.cd-club-cta:focus-visible { outline: 2px solid var(--fives-primary); outline-offset: 2px; }

/* ─── Trailing sections ───────────────────────────────────── */
.cd-section {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px max(24px, var(--safe-left)) 96px max(24px, var(--safe-right));
  box-sizing: border-box;
}
@media (min-width: 760px) {
  .cd-section { padding: 24px max(40px, var(--safe-left)) 128px max(40px, var(--safe-right)); }
}
.cd-eyebrow {
  font-size: 12px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--fives-accent-700);
  margin: 0 0 14px;
}
.cd-how {
  background: var(--fives-bg-2);
  border: 1px solid var(--fives-line);
  border-radius: var(--fives-r-lg);
  padding: 28px 24px;
}
@media (min-width: 760px) { .cd-how { padding: 40px; } }
.cd-how h2 {
  font-family: var(--fives-display);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 600;
  letter-spacing: -0.8px;
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--fives-text);
}
.cd-how p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--fives-text);
  max-width: 62ch;
  margin: 0 0 12px;
  text-wrap: pretty;
}
.cd-how p:last-child { margin-bottom: 0; }
.cd-how a {
  color: var(--fives-primary);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--fives-line);
}
.cd-how a:hover { color: var(--fives-primary-700); border-color: var(--fives-primary-700); }

/* ─── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cd-club,
  .cd-seg-ind,
  .cd-seg,
  a.cd-club-court { transition: none; }
  .cd-club:hover  { transform: none; }
  .cd-seg:active  { transform: none; }
}
