/* ============================================================
   PPI National Scotch Foursomes 2026
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&family=Playfair+Display:wght@400;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --province-primary: #0d1b3e;
  --province-accent:  #c9a84c;

  --white:         #ffffff;
  --off-white:     #f7f7f5;
  --surface:       #f0f0ed;
  --border:        rgba(0,0,0,0.09);
  --border-mid:    rgba(0,0,0,0.15);
  --text-primary:  #0d0d0d;
  --text-secondary:#555;
  --text-muted:    #999;

  --green:         #1a6b2f;
  --green-light:   #eaf5ed;
  --red:           #b91c1c;
  --red-light:     #fef2f2;
  --gold:          #a07820;
  --gold-light:    #fdf8e1;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  14px;
  --shadow:     0 2px 16px rgba(0,0,0,0.1);
  --transition: 0.15s ease;
  --max-w:      920px;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: 'DM Sans', sans-serif; background: var(--off-white); color: var(--text-primary); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ---- HEADER ---- */
.site-header { background: var(--province-primary); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 16px rgba(0,0,0,0.3); }
.header-inner { max-width: var(--max-w); margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; }
.header-brand { display: flex; align-items: center; gap: 12px; }
.back-link { font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.55); padding: 4px 10px 4px 0; border-right: 1px solid rgba(255,255,255,0.15); margin-right: 4px; white-space: nowrap; transition: color var(--transition); }
.back-link:hover { color: var(--white); }
.brand-logo { width: 36px; height: 36px; flex-shrink: 0; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-name { font-family: 'Cinzel', serif; color: var(--white); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; line-height: 1.2; }
.brand-sub { font-family: 'Cinzel', serif; font-size: 9px; color: var(--province-accent); font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 2px; }

/* ---- HOME HERO ---- */
.hero { background: var(--province-primary); padding: 48px 20px 36px; text-align: center; border-bottom: 3px solid var(--province-accent); }
.hero-inner { max-width: var(--max-w); margin: 0 auto; }
.hero-eyebrow { font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--province-accent); margin-bottom: 10px; }
.hero-title { font-family: 'Playfair Display', serif; font-size: 36px; font-weight: 700; color: var(--white); line-height: 1.15; margin-bottom: 10px; }
.hero-sub { font-size: 14px; color: rgba(255,255,255,0.65); }
.hero-note { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 6px; font-style: italic; }

/* ---- EVENT CARDS ---- */
.province-select { padding: 32px 20px 60px; }
.province-cards { max-width: var(--max-w); margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.nat-card { display: block; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); transition: transform var(--transition), box-shadow var(--transition); }
.nat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.14); }
.nat-card-inner { display: flex; align-items: center; gap: 18px; padding: 24px 20px; }
.nat-card-icon { width: 56px; height: 56px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-family: 'Cinzel', serif; font-size: 24px; font-weight: 700; background: #0d1b3e; color: #c9a84c; flex-shrink: 0; }
.nat-icon-nonmixed { background: #6b2d8b; color: #f5d020; }
.nat-card-info { flex: 1; }
.nat-card-title { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.nat-card-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.nat-card-detail { font-size: 11px; color: var(--text-muted); font-style: italic; }
.nat-card-arrow { font-size: 20px; color: var(--text-muted); flex-shrink: 0; }

/* ---- COMP BANNER ---- */
.comp-banner { background: var(--province-primary); border-bottom: 3px solid var(--province-accent); padding: 16px 20px; }
.comp-banner-inner { max-width: var(--max-w); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.comp-banner-title { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 700; color: var(--white); margin-bottom: 2px; }
.comp-banner-meta { font-size: 12px; color: rgba(255,255,255,0.5); }
.comp-status-badge { font-size: 11px; font-weight: 600; padding: 4px 12px; border-radius: 12px; text-align: center; white-space: nowrap; }
.comp-status-badge.upcoming { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); }
.comp-status-badge.live     { background: var(--province-accent); color: var(--province-primary); }
.comp-status-badge.final    { background: #2d6a1f; color: var(--white); }
.updated-text { font-size: 10px; color: rgba(255,255,255,0.4); margin-top: 4px; }
.updated-text.stale { color: rgba(255,100,100,0.7); }

/* ---- COUNTING RULE BAR ---- */
.counting-rule-bar { background: #f0f2f8; border-bottom: 1px solid rgba(0,0,0,0.08); padding: 8px 20px; }
.counting-rule-inner { max-width: var(--max-w); margin: 0 auto; font-size: 11px; color: #555; font-style: italic; }

/* ---- VIEW TABS ---- */
.view-tabs {
  max-width: var(--max-w);
  margin: 20px auto 0;
  padding: 0 20px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.view-tabs::-webkit-scrollbar { display: none; }
.view-tab {
  flex: 1;
  min-width: fit-content;
  padding: 10px 16px;
  background: var(--white);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  white-space: nowrap;
}
.view-tab:hover { border-color: var(--province-primary); color: var(--province-primary); }
.view-tab.active {
  background: var(--province-primary);
  border-color: var(--province-primary);
  color: var(--white);
}

/* ---- LEADERBOARD ---- */
.leaderboard-wrap { max-width: var(--max-w); margin: 16px auto 24px; padding: 0 20px; }
.leaderboard-table { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow); }

.lb-header {
  display: grid;
  grid-template-columns: 40px 1.6fr 60px 70px 1.4fr 20px;
  padding: 10px 14px;
  background: var(--province-primary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  gap: 8px;
  align-items: center;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.lb-row {
  display: grid;
  grid-template-columns: 40px 1.6fr 60px 70px 1.4fr 20px;
  padding: 12px 14px;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.lb-row:hover { background: var(--surface); }
.lb-row.is-winner { background: var(--green-light); }

.lb-col-pos { display: flex; align-items: center; justify-content: center; }
.pos-num { font-size: 15px; font-weight: 600; color: var(--text-secondary); font-family: 'Playfair Display', serif; }
.pos-winner { color: var(--green); }

.lb-col-pairing { min-width: 0; overflow: hidden; }
.pairing-top { font-size: 13px; color: var(--text-primary); font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; line-height: 1.4; }
.player-name { white-space: nowrap; }
.player-sep { color: var(--text-muted); margin: 0 2px; }
.shots-text { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 4px; }
.pairing-bot { font-size: 11px; color: var(--text-secondary); margin-top: 3px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; line-height: 1.4; }
.player-club { white-space: nowrap; }
.club-sep { color: var(--border-mid); }
.session-badge { font-size: 9px; font-weight: 700; letter-spacing: 0.04em; padding: 1px 5px; border-radius: 3px; }
.session-badge.s1 { background: #d6eaf8; color: #1a5276; }
.session-badge.s2 { background: #fdebd0; color: #935116; }
.start-hole { font-size: 10px; color: var(--text-muted); }

.lb-col-r1, .lb-col-r2 { text-align: center; }
.round-score { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

.lb-col-total { text-align: center; }
.total-score { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700; color: var(--province-primary); }
.total-sub { display: block; font-size: 10px; font-weight: 500; color: var(--text-muted); margin-top: 2px; letter-spacing: 0.02em; }

.lb-col-expand { text-align: center; }
.expand-indicator { font-size: 11px; color: var(--text-muted); }
.lb-row:hover .expand-indicator { color: var(--province-primary); }

/* ---- CARD BREAKDOWN ---- */
.card-breakdown { display: none; background: var(--off-white); border-bottom: 1px solid var(--border); padding: 0 16px; }
.card-breakdown.open { display: block; padding: 16px 16px 20px; }
.breakdown-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.btn-collapse { font-size: 11px; font-weight: 500; color: var(--text-muted); background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 10px; transition: all var(--transition); }
.btn-collapse:hover { color: var(--text-primary); border-color: var(--border-mid); }

.breakdown-content { display: flex; flex-direction: column; gap: 14px; }

.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.score-grid-cell {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  text-align: center;
}
.score-grid-cell.highlight { background: #f0f8f2; border-color: rgba(26,107,47,0.2); }
.score-grid-cell.highlight-gross { background: #faf4e0; border-color: rgba(201,168,76,0.3); }
.sg-label { font-size: 9px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 3px; }
.sg-value { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 700; color: var(--text-primary); }

.players-detail { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; }
.player-detail-row { display: grid; grid-template-columns: 1.5fr 1fr auto; gap: 8px; padding: 5px 0; font-size: 12px; border-bottom: 1px dashed var(--border); }
.player-detail-row:last-of-type { border-bottom: none; }
.pd-name { color: var(--text-primary); font-weight: 500; }
.pd-club { color: var(--text-secondary); }
.pd-hcp { color: var(--text-muted); font-size: 11px; }
.pairing-meta { margin-top: 8px; font-size: 11px; color: var(--text-muted); padding-top: 8px; border-top: 1px solid var(--border); font-style: italic; }
.pairing-notes { font-size: 11px; color: var(--text-muted); font-style: italic; padding: 8px 12px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); }

/* ---- LOADING / ERROR ---- */
.loading-state, .error-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.spinner { width: 28px; height: 28px; border: 2px solid var(--border); border-top-color: var(--province-primary); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- FOOTER ---- */
.site-footer { background: var(--province-primary); padding: 20px; margin-top: 40px; }
.footer-inner { max-width: var(--max-w); margin: 0 auto; text-align: center; font-size: 11px; color: rgba(255,255,255,0.3); }

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
  .lb-header, .lb-row { grid-template-columns: 32px 1.4fr 44px 50px 1.3fr 18px; padding: 10px 8px; gap: 6px; }
  .pairing-line { font-size: 11px; }
  .player-club { font-size: 10px; }
  .meta-val { font-size: 11px; }
  .score-pair.total .sp-val { font-size: 15px; }
  .sp-val { font-size: 11px; }
  .sp-label { font-size: 7px; }
  .total-score { font-size: 17px; }
  .round-score { font-size: 12px; }
  .pairing-top { font-size: 12px; }
  .pairing-bot { font-size: 10px; }
  .score-grid { grid-template-columns: repeat(3, 1fr); }
  .sg-value { font-size: 15px; }
  .player-detail-row { grid-template-columns: 1fr; gap: 2px; }
  .pd-club, .pd-hcp { font-size: 10px; }
  .hero-title { font-size: 26px; }
  .comp-banner-inner { flex-direction: column; align-items: flex-start; }
  .view-tab { padding: 9px 12px; font-size: 11px; }
}

.pairing-line { font-size: 13px; color: var(--text-primary); font-weight: 500; line-height: 1.4; }
.player-name { font-weight: 500; }
.player-club { color: var(--text-secondary); font-size: 11px; font-weight: 400; }
.pairing-amp { font-size: 11px; color: var(--text-muted); margin: 1px 0; }

.lb-col-start, .lb-col-shots { text-align: center; }
.meta-label { font-size: 9px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.meta-val { font-size: 13px; font-weight: 600; color: var(--text-primary); }

.lb-col-scores { display: grid; grid-template-columns: 1fr 1fr 1.2fr 1fr; gap: 4px; align-items: center; }
.score-pair { text-align: center; display: flex; flex-direction: column; gap: 1px; }
.sp-label { font-size: 8px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.sp-val { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.score-pair.total .sp-val { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 700; color: var(--province-primary); }
.score-pair.sub .sp-val { font-size: 11px; color: var(--text-muted); }