/* Titletown Greens — Masters Pool 2026
 * Palette + leaderboard styles. Phase 15 plan 15-01.
 * Class-name contract matches public/scoring.js output for 15-02 render.
 */

:root {
  --masters-green:     #076652;
  --masters-parchment: #F5F1E8;
  --masters-gold:      #F2C94C;
  --cut-red:           #B91C1C;
  --dropped-grey:      #6B7280;
  --counting-green:    #047857;
  --status-live:       #16A34A;
  --status-stale:      #D97706;
  --status-offline:    var(--cut-red);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--masters-parchment);
  color: #111;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* Header */
.masters-header {
  background: var(--masters-green);
  color: var(--masters-parchment);
  padding: 1rem 1.5rem;
  border-bottom: 3px solid var(--masters-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.masters-header h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Leaderboard table */
.leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.leaderboard thead th {
  background: var(--masters-green);
  color: var(--masters-parchment);
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.8rem;
}
.leaderboard td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(7, 102, 82, 0.12);
}

/* Score cells — tabular-nums MUST live on .score, not inherited (Pitfall 3) */
.leaderboard td.score {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-feature-settings: "tnum";
}

/* POS column — reserve room for position + CUT badge (Pitfall 5) */
.leaderboard td.pos {
  min-width: 6.5em;
  white-space: nowrap;
}

/* Interactive summary row */
.leaderboard tr.entry-row {
  cursor: pointer;
}
.leaderboard tr.entry-row:hover {
  background: rgba(7, 102, 82, 0.06);
}

/* CUT badge (UI-04) */
.cut-badge {
  display: inline-block;
  background: var(--cut-red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Detail row — expanded picks view */
.detail-row.hidden {
  display: none;
}
.detail-row td {
  background: #FBF8EF;
  padding: 0.75rem 1.5rem;
}

/* Picks drill-down (UI-02) */
/* Phase 16.1 — per-pick to-par detail row v2
 * Grid columns: tier, name, tournament to-par, thru, 4 per-round cells, total.
 * IMPORTANT: no `font:` shorthand anywhere — Pitfall 3 guard in test-ui.mjs. */
.picks .pick {
  display: grid;
  grid-template-columns: 2.5rem 14rem 3.5rem 3.5rem repeat(4, 3.5rem) 4rem;
  align-items: center;
  gap: 0.5rem;
  padding: 4px 0;
}
.picks .pick-header {
  font-family: 'Work Sans', 'IBM Plex Sans', Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.picks .pick.counting .pick-name {
  color: var(--counting-green);
  font-weight: 600;
}
.picks .pick.dropped .pick-name {
  color: var(--dropped-grey);
  text-decoration: line-through;
}
.picks .pick-tier {
  font-weight: 700;
  opacity: 0.7;
}
.picks .pick-topar,
.picks .pick-thru,
.picks .pick-day,
.picks .pick-total {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-feature-settings: "tnum";
}
.picks .pick-total {
  font-weight: 600;
}
/* Dropped picks get a red-tint on the pick-total, matching the pool
 * directions worked example — independent of cut state. */
.picks .pick.dropped .pick-total {
  color: var(--cut-red);
  font-weight: 700;
}

/* Mobile breakpoint */
@media (max-width: 640px) {
  .leaderboard .hide-mobile { display: none; }
}

/* Phase 16 — Live refresh status indicator (UI-03) */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--masters-parchment);
  opacity: 0.95;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--status-live);
  flex-shrink: 0;
}
.status-dot.live    { background: var(--status-live); }
.status-dot.stale   { background: var(--status-stale); }
.status-dot.offline { background: var(--status-offline); }
.status-label {
  white-space: nowrap;
}


/* ================================================================== */
/* Phase 19: restyle + rebrand — masters.com 1:1 homage (simplified)  */
/* Rewritten 2026-04-09 per user feedback:                            */
/*   - Nav stripped to just "Leader Board"                            */
/*   - User chunk (Hi, X + avatar) removed                            */
/*   - Filter row (Over/Under / Round 1 / All Players / search /      */
/*     view toggle) removed                                           */
/*   - #status relocated into .subheader-right as a pill              */
/*   - Arched scoreboard enlarged; rows scroll WITHIN the cream       */
/*     panel (sticky thead + overflow-y:auto), not down the page     */
/*                                                                    */
/* Hard rules preserved:                                              */
/*   - Never use `font:` shorthand on any selector matching .score    */
/*     (Phase 15 Pitfall 3 — resets tabular-nums).                    */
/*   - Twin-row safe stripe uses :nth-of-type(4n+1).                  */
/*   - 9 locked column headers + .entry-row / .detail-row contract.   */
/*   - Phase 15 palette (#076652, #F5F1E8, #F2C94C) still present     */
/*     in the baseline block above.                                   */
/* ================================================================== */

:root {
  --mc-green:          #006747;   /* Real masters.com nav green */
  --mc-green-deep:     #193526;   /* Scoreboard header border   */
  --mc-green-icon:     #107d57;
  --mc-border-gray:    #d9d9d6;
  --mc-text-dark:      #25282a;
  --mc-panel-cream:    #F3EEEC;   /* From leaderboard-bg.svg    */
  --mc-row-red:        #a6192e;
  --mc-row-green:      #006747;
}

/* ---- Body + root ------------------------------------------------- */

html, body { background: #eef3ef; }
body#masters-site {
  margin: 0;
  min-height: 100vh;
  color: var(--mc-text-dark);
  font-family: 'IBM Plex Sans', 'Benton Sans', Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
#root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Top subheader (white nav bar) ------------------------------- */

#masters-header {
  background: #fff;
  position: relative;
  z-index: 10;
}
section.subheader {
  position: relative;
  height: 56px;
  width: 100%;
  background-color: #fff;
  border-bottom: 1px solid var(--mc-border-gray);
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0 2.08%;
}
@media only screen and (min-width: 62em) {
  section.subheader { height: 76px; }
}

/* Main nav (Leader Board only) */
section.subheader nav.mainmenu {
  display: block;
  padding: 0;
  flex: 0 0 auto;
}
section.subheader nav.mainmenu ul.return {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
}
section.subheader nav.mainmenu ul.return li {
  display: flex;
  align-items: center;
}
section.subheader nav.mainmenu ul.return li a {
  color: var(--mc-green);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  font-family: 'IBM Plex Sans', 'Benton Sans', Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
}
section.subheader nav.mainmenu ul.return li.active a,
section.subheader nav.mainmenu ul.return li.scores.active a {
  border-bottom-color: var(--mc-green);
  font-weight: 700;
}

/* Centered Mattsters wordmark */
section.subheader .event-wrapper {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  height: 100%;
  display: flex;
  align-items: center;
}
section.subheader #eventLogo {
  height: 100%;
  display: flex;
  align-items: center;
}
section.subheader #eventLogo a.homelogo {
  display: flex;
  align-items: center;
  color: var(--mc-green);
  text-decoration: none;
  border: none;
}
section.subheader #eventLogo .wordmark {
  font-family: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 900;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--mc-green);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}
@media only screen and (min-width: 62em) {
  section.subheader #eventLogo .wordmark { font-size: 2.2rem; }
}

/* Right side — live status pill (replaces the Hi/avatar chunk) */
section.subheader .subheader-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  flex: 0 0 auto;
}
section.subheader .subheader-right .status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 30px;
  background: #fff;
  border: 1px solid var(--mc-border-gray);
  color: var(--mc-green);
  font-size: 0.72rem;
  font-family: 'IBM Plex Sans', 'Benton Sans', Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  white-space: nowrap;
  /* tabular-nums still inherited via the Phase 16 .status base rule */
}
@media (max-width: 48em) {
  section.subheader .subheader-right .status { font-size: 0.65rem; height: 30px; padding: 0 10px; }
  section.subheader .subheader-right .status .status-label {
    max-width: 6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---- Main page content (sky/course photo background) ------------- */

section.page-content {
  position: static;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}
section.page-content.leaderboard.skeuView {
  background-image: url("./assets/bg_lb_xs.jpg");
  background-color: #2d5a36;
  background-repeat: no-repeat;
  background-position: center top;
  background-size: cover;
  background-attachment: fixed;
  min-height: calc(100vh - 76px);
  padding: 40px 0;
}

/* ---- Scoreboard wrapper (arched SVG frame, bigger + scrollable) --- */

#leaderboardWrapper {
  width: 100%;
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 2.5%;
}
#leaderboardContainer {
  position: relative;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  /* Height is explicit so the arched SVG stretches to fit and the
     rows inside can scroll within a calculated cream-panel window. */
  height: min(760px, calc(100vh - 180px));
  background: transparent;
}

/* The arched SVG is stretched to fill the container (background frame) */
#leaderboardBg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
}
#leaderboardBg img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
}

/* Carved LEADERS title floats over the top arch */
#leaderboardContainer #header {
  position: absolute;
  top: 4.5%;
  left: 0;
  right: 0;
  z-index: 2;
  text-align: center;
  pointer-events: none;
}
#leaderboardContainer #header h1 {
  font-family: 'Work Sans', 'IBM Plex Sans', Arial, Helvetica, sans-serif;
  font-weight: 800;
  font-size: clamp(1.6rem, 3.2vw, 2.55rem);
  color: var(--mc-text-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.1;
  margin: 0;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}

/* The leaderboard content area sits over the cream panel of the SVG
   and scrolls vertically — does NOT leak past the cream panel.
   Bounds derived from the SVG source:
     <rect id="lb_bg" fill="#F7F4F0" x=0 y=38 width=700 height=311>
     inside viewBox="0 0 720 401"
   Cream panel vertical extent: y=38..349 → 9.5% .. 87% of container.
   The arched LEADERS title sits above the cream panel from ~4% to ~14%.
   Scroll window: top 16% / bottom 17% gives ~4% safety margin above the
   wooden foot so partial rows don't leak past the cream panel edge. */
.leaderBoardContent.ou {
  position: absolute;
  top: 16%;
  bottom: 17%;
  left: 8%;
  right: 8%;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(25,53,38,0.35) transparent;
}
.leaderBoardContent.ou::-webkit-scrollbar { width: 8px; }
.leaderBoardContent.ou::-webkit-scrollbar-track { background: transparent; }
.leaderBoardContent.ou::-webkit-scrollbar-thumb {
  background: rgba(25,53,38,0.35);
  border-radius: 4px;
}
.leaderBoardContent.ou::-webkit-scrollbar-thumb:hover { background: rgba(25,53,38,0.55); }

/* ---- Manual-board table (rendered inside the arched panel) -------- */

.leaderBoardContent .leaderboard {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  font-family: 'IBM Plex Sans', 'Benton Sans', Arial, Helvetica, sans-serif;
  font-size: 0.92rem;
  color: var(--mc-text-dark);
}

/* Sticky green header row — stays visible while rows scroll underneath */
.leaderBoardContent .leaderboard thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--mc-green);
  color: #fff;
  font-family: 'IBM Plex Sans', 'Benton Sans', Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 6px;
  border-right: 1px solid var(--mc-green-deep);
  border-bottom: 2px solid var(--mc-green-deep);
  text-align: center;
  line-height: 1.15;
  box-shadow: 0 2px 0 rgba(25,53,38,0.25);
}
.leaderBoardContent .leaderboard thead th.col-name { text-align: left; padding-left: 12px; }
.leaderBoardContent .leaderboard thead th:first-child { border-left: 1px solid var(--mc-green-deep); }
.leaderBoardContent .leaderboard thead th:last-child { border-right: 1px solid var(--mc-green-deep); }

.leaderBoardContent .leaderboard tbody td {
  padding: 10px 6px;
  border-right: 1px solid rgba(25,53,38,0.15);
  border-bottom: 1px solid rgba(25,53,38,0.10);
  font-family: 'IBM Plex Sans', 'Benton Sans', Arial, Helvetica, sans-serif;
  font-weight: 600;
  color: var(--mc-row-red);
  text-align: center;
  background: rgba(243,238,236,0.72);
}
.leaderBoardContent .leaderboard tbody td:first-child {
  border-left: 1px solid rgba(25,53,38,0.15);
}
.leaderBoardContent .leaderboard tbody td.pos {
  color: var(--mc-text-dark);
  font-weight: 700;
  text-align: center;
  min-width: 3.5em;
}
.leaderBoardContent .leaderboard tbody td.entry-name {
  color: var(--mc-text-dark);
  text-align: left;
  padding-left: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22rem;
}

/* TOTAL — longhand only so tabular-nums survives */
.leaderBoardContent .leaderboard tbody td.score.total {
  font-family: 'Work Sans', 'IBM Plex Sans', Arial, Helvetica, sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--mc-row-red);
}

/* Leader row (first entry) — gold tint + green total + gold left border */
.leaderBoardContent .leaderboard tbody tr.entry-row:first-of-type td {
  background: rgba(242, 201, 76, 0.22);
}
.leaderBoardContent .leaderboard tbody tr.entry-row:first-of-type td.pos {
  border-left: 3px solid var(--masters-gold);
}
.leaderBoardContent .leaderboard tbody tr.entry-row:first-of-type td.score.total {
  color: var(--mc-row-green);
}

/* Twin-row safe stripe — 4n+1 because entry-row + detail-row = 2 <tr> per entry */
.leaderBoardContent .leaderboard tbody tr.entry-row:nth-of-type(4n+1) td {
  background: rgba(243,238,236,0.92);
}
.leaderBoardContent .leaderboard tbody tr.entry-row:nth-of-type(4n+1):hover td {
  background: rgba(0,103,71,0.10);
}
.leaderBoardContent .leaderboard tbody tr.entry-row:hover td {
  background: rgba(0,103,71,0.06);
}

/* Detail row (expanded picks drill-down) — cream panel, dark text */
.leaderBoardContent .detail-row td {
  background: #FAF7F0;
  color: #222;
  text-align: left;
  padding: 12px 18px;
  font-weight: 500;
  text-transform: none;
  border-top: 1px solid rgba(25,53,38,0.18);
}
.leaderBoardContent .picks .pick {
  color: #222;
  font-family: 'IBM Plex Sans', 'Benton Sans', Arial, Helvetica, sans-serif;
}

/* ---- Responsive tweaks ------------------------------------------- */

@media (max-width: 900px) {
  section.subheader .event-wrapper { position: absolute; }
  #leaderboardContainer { height: min(640px, calc(100vh - 140px)); }
  .leaderBoardContent.ou { top: 15%; bottom: 17%; left: 6%; right: 6%; }
  #leaderboardContainer #header h1 { font-size: clamp(1.3rem, 3.2vw, 2rem); }
}
@media (max-width: 640px) {
  section.subheader { padding: 0 10px; }
  section.subheader nav.mainmenu ul.return li a { font-size: 0.85rem; }
  section.subheader #eventLogo .wordmark { font-size: 1.5rem; }
  section.page-content.leaderboard.skeuView { padding: 20px 0; }
  #leaderboardWrapper { padding: 0 1%; }
  #leaderboardContainer { height: min(560px, calc(100vh - 120px)); }
  .leaderBoardContent.ou { top: 14%; bottom: 17%; left: 5%; right: 5%; }
  #leaderboardContainer #header h1 { font-size: 1.2rem; letter-spacing: 0.5px; }
  .leaderBoardContent .leaderboard thead th { font-size: 0.6rem; padding: 7px 3px; letter-spacing: 0.08em; }
  .leaderBoardContent .leaderboard tbody td { padding: 7px 3px; font-size: 0.78rem; }
  .leaderBoardContent .leaderboard tbody td.entry-name { font-size: 0.75rem; max-width: 9rem; padding-left: 6px; }
  .leaderBoardContent .leaderboard tbody td.score.total { font-size: 0.9rem; }

  /* Pill safety net — ensure pill can never cross into the centered wordmark */
  section.subheader .subheader-right .status {
    font-size: 0.6rem;
    height: 26px;
    padding: 0 8px;
    gap: 6px;
  }
  section.subheader .subheader-right .status .status-label {
    max-width: 5rem;
  }

  /* --- Mobile: drop the skeuomorphic arched frame, go table-forward --- */

  /* Kill the sky/course photo + dark green fallback + heavy padding.
     Replace with flat cream matching the existing panel color. */
  section.page-content.leaderboard.skeuView {
    background-image: none;
    background-color: var(--mc-panel-cream);
    min-height: 0;
    padding: 0;
  }

  /* Wrapper goes full-bleed */
  #leaderboardWrapper {
    padding: 0;
    max-width: 100%;
  }

  /* Container: no fixed height, no max-width, no background — just flow */
  #leaderboardContainer {
    height: auto;
    max-width: 100%;
    background: transparent;
  }

  /* Hide the arched SVG frame image entirely */
  #leaderboardBg {
    display: none;
  }

  /* LEADERS heading: un-absolute it so it sits as a normal block above the table */
  #leaderboardContainer #header {
    position: static;
    text-align: center;
    padding: 14px 12px 6px;
  }
  #leaderboardContainer #header h1 {
    margin: 0;
  }

  /* The inner scroll window is the main offender — un-absolute it,
     remove all inset, remove overflow so the PAGE scrolls instead of
     an inner container. Full width of the viewport. */
  .leaderBoardContent.ou {
    position: static;
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
    overflow: visible;
    border-radius: 0;
    width: 100%;
  }

  /* Table itself: full viewport width. */
  .leaderBoardContent .leaderboard {
    width: 100%;
  }
}
/* End Phase 19 block */
