/* =========================================================================
   GOLF BRACKETS — Spectator demo
   Aesthetic: Masters cream paper + Augusta green frame for the page chrome,
   leaderboard-style cells inside (heavy black sans names, big red scores,
   sharp grid). Three match states are colour-coded for glanceability.
   ========================================================================= */

:root {
  /* Palette — white paper, Augusta green, bright yellow accent, pure red */
  --bg:           #ffffff;
  --paper:        #ffffff;
  --paper-soft:   #f6f6f4;
  --ink:          #111111;
  --green:        #008854;
  --green-deep:   #006b42;
  --gold:         #ffdf00;
  --gold-soft:    #fff1a0;
  --red:          #ff0000;
  --amber:        #ffdf00;  /* in-progress highlight */
  --amber-deep:   #c9a900;
  --muted-bg:     #f1efe8;  /* pending state */
  --muted:        #7d7d76;
  --line:         #000000;
  --line-soft:    #c8c4b8;

  /* Layout */
  --bracket-h:    600px;
  --gutter:       28px;
  --match-h:      44px;
  --match-w-min:  168px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'EB Garamond', 'Garamond', 'Times New Roman', serif;
  font-size: 16px;
  line-height: 1.35;
  min-width: 1880px;
}

body::before { display: none; }

main, .page-header, .page-footer { position: relative; z-index: 1; }

/* =========================================================================
   HEADER
   ========================================================================= */

.page-header {
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  align-items: center;
  gap: 32px;
  padding: 28px 48px 18px;
  border-bottom: 1px solid var(--line);
}

.crest { justify-self: start; }
.club-tag { justify-self: end; }

.crest {
  width: 80px;
  height: 80px;
  display: grid;
  place-items: center;
}

.crest img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Sample-club monogram crest — used in the spectator demo. */
.crest-monogram {
  width: 80%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--green, #008854);
  color: var(--gold, #ffdf00);
  display: grid;
  place-items: center;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.06em;
  border: 2px solid var(--green-deep, #073926);
}

.titles { text-align: center; }

.titles .overline {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--green);
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}

.titles h1 {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 40px;
  color: var(--green);
  margin: 0;
  letter-spacing: 0.08em;
  line-height: 1;
}

.titles .subtitle {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  color: var(--green);
  letter-spacing: 0.32em;
  margin-top: 10px;
}

.club-tag {
  text-align: right;
}

.club-name {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.10em;
  color: var(--green);
}

.club-est {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--green);
  margin-top: 4px;
  letter-spacing: 0.06em;
}

/* =========================================================================
   ROUND LABELS
   ========================================================================= */

.round-labels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1.45fr 1fr 1fr 1fr 1fr;
  gap: var(--gutter);
  padding: 22px 48px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--green);
  text-transform: uppercase;
  text-align: center;
}

.round-labels div {
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 6px 12px;
  position: relative;
}

.round-labels div:nth-child(5) {
  font-size: 14px;
  border-bottom-color: var(--green);
  border-bottom-width: 2px;
}

.round-labels div.active {
  background: var(--green);
  color: #ffffff;
  border-bottom-color: var(--green);
  border-bottom-width: 2px;
}

.round-labels div.completed {
  color: var(--muted);
  border-bottom-color: var(--line-soft);
}

.round-status {
  display: block;
  margin-top: 6px;
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-transform: none;
}

/* =========================================================================
   BRACKET LAYOUT
   ========================================================================= */

.bracket {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1.45fr 1fr 1fr 1fr 1fr;
  gap: var(--gutter);
  height: var(--bracket-h);
  padding: 18px 48px 28px;
}

.col {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  position: relative;
  min-width: var(--match-w-min);
}

.pair {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  position: relative;
  height: var(--pair-h, auto);
}

.col.r32 .pair { --pair-h: calc(var(--bracket-h) / 4); }
.col.r16 .pair { --pair-h: calc(var(--bracket-h) / 2); }
.col.qf  .pair { --pair-h: calc(var(--bracket-h) / 1); }

/* =========================================================================
   MATCH CELLS — leaderboard style
   ========================================================================= */

.match {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 3px 9px;
  height: var(--match-h);
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: 1fr 1fr;
  column-gap: 8px;
}

/* === STATE: AWAITING (scheduled, result not yet entered) ================ */
.match.in-progress {
  background: var(--amber);
  border: 1px solid var(--line);
}

/* === STATE: TBD (players to be confirmed) =============================== */
.match.pending {
  background: var(--muted-bg);
  border: 1px solid var(--line);
}

/* === FINAL gets extra emphasis ========================================== */
.final {
  height: calc(var(--match-h) + 14px);
  border-width: 1px;
}

/* Competitor rows */
.competitor {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  position: relative;
}

.competitor:nth-child(1) { grid-row: 1; grid-column: 1; border-bottom: 1px solid rgba(20, 32, 26, 0.08); }
.competitor:nth-child(2) { grid-row: 2; grid-column: 1; }

.competitor .seed {
  display: none;
}

.competitor .name {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.competitor .hcp {
  display: none;
}

/* Winner / loser */
.competitor.winner .name { color: var(--ink); }
.competitor.winner .seed { color: var(--green); }

.competitor.loser { opacity: 0.40; }
.competitor.loser .name {
  text-decoration: line-through;
  text-decoration-color: rgba(20, 32, 26, 0.5);
  text-decoration-thickness: 1px;
  font-weight: 600;
}

.competitor.tbd .name {
  color: rgba(20, 32, 26, 0.35);
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.2em;
  padding-left: 8px;
  text-transform: none;
}

/* =========================================================================
   PLAYER CARD (hover) — full name, seed, handicap, phone
   ========================================================================= */

.player-card {
  position: absolute;
  top: calc(100% + 8px);
  left: -8px;
  z-index: 50;
  min-width: 240px;
  background: var(--paper);
  border: 2px solid var(--green);
  padding: 12px 16px 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font-family: 'Inter', sans-serif;
  text-align: left;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
  pointer-events: none;
}

.player-card.right {
  left: auto;
  right: -8px;
}

.competitor:hover .player-card {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.player-card .pc-name {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.player-card .pc-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink);
  font-weight: 600;
  padding: 2px 0;
  gap: 18px;
}

.player-card .pc-row span {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  align-self: center;
}

/* Hovering a loser raises opacity briefly so the card label is readable */
.competitor.loser:hover { opacity: 1; }
.competitor.loser:hover .name { text-decoration: none; }

/* Hovered competitor floats above neighbours so the card isn't clipped */
.competitor:hover { z-index: 100; }

/* === SCORE on the right of a complete match ============================ */
.match .score {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  justify-self: end;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--red);
  letter-spacing: -0.01em;
  padding: 2px 0 2px 8px;
  border-left: 1px solid var(--line);
  min-width: 38px;
  text-align: right;
  line-height: 1;
}

/* === STATUS BADGE for in-progress / TBD ================================ */
.match .status-badge {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  justify-self: end;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 7.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 4px;
  border-radius: 1px;
  white-space: nowrap;
  margin-left: 4px;
}

.in-progress .status-badge {
  background: var(--green);
  color: #fff8e0;
}

.pending .status-badge {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line-soft);
}

/* =========================================================================
   CONNECTOR LINES
   ========================================================================= */

.left .match::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  width: calc(var(--gutter) / 2);
  height: 1px;
  background: var(--line);
}

.left .pair::after {
  content: '';
  position: absolute;
  left: calc(100% + var(--gutter) / 2);
  top: 25%;
  bottom: 25%;
  width: 1px;
  background: var(--line);
}

.left .pair::before {
  content: '';
  position: absolute;
  left: calc(100% + var(--gutter) / 2);
  top: 50%;
  width: calc(var(--gutter) / 2);
  height: 1px;
  background: var(--line);
  z-index: 1;
}

.col.sf.left .match::after { width: var(--gutter); }

.right .match::after {
  content: '';
  position: absolute;
  right: 100%;
  left: auto;
  top: 50%;
  width: calc(var(--gutter) / 2);
  height: 1px;
  background: var(--line);
}

.right .pair::after {
  content: '';
  position: absolute;
  right: calc(100% + var(--gutter) / 2);
  left: auto;
  top: 25%;
  bottom: 25%;
  width: 1px;
  background: var(--line);
}

.right .pair::before {
  content: '';
  position: absolute;
  right: calc(100% + var(--gutter) / 2);
  left: auto;
  top: 50%;
  width: calc(var(--gutter) / 2);
  height: 1px;
  background: var(--line);
  z-index: 1;
}

.col.sf.right .match::after {
  width: var(--gutter);
  right: 100%;
  left: auto;
}

.col.center .match::after,
.col.center .pair::after,
.col.center .pair::before { display: none; }

/* =========================================================================
   CENTRE COLUMN: Champion + Final
   ========================================================================= */

.col.center {
  position: relative;
  justify-content: flex-start;
  align-items: stretch;
}

.champion {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 280px;
  padding: 20px 20px 18px;
  text-align: center;
  background: var(--green);
  color: #ffffff;
  border: none;
}

.champion-label {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.30em;
  color: #ffffff;
  text-transform: uppercase;
  line-height: 1;
}

.champion-divider {
  width: 56px;
  height: 1.5px;
  background: var(--gold);
  margin: 14px auto 12px;
}

.champion-tournament {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: #ffffff;
  line-height: 1.05;
}

.champion-year {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.28em;
  color: #ffffff;
  opacity: 0.88;
  margin-top: 6px;
}

.champion-name {
  font-family: 'EB Garamond', serif;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.48);
  font-style: italic;
  letter-spacing: 0.08em;
  min-height: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1.5px dashed var(--gold);
}

.final-wrap {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.final-label {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.22em;
  color: var(--green);
  text-transform: uppercase;
}

.final { width: 100%; }

/* =========================================================================
   LEGEND + FOOTER
   ========================================================================= */

.legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  padding: 16px 48px 0;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--ink);
}

.legend-row.hint {
  flex-basis: 100%;
  justify-content: center;
  color: var(--muted);
  font-style: italic;
  font-family: 'EB Garamond', serif;
  font-size: 13px;
  margin-top: 12px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.04em;
}

.legend-row strong {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
}

.dot {
  width: 22px;
  height: 14px;
  border-radius: 0;
  border: 1.5px solid var(--green);
}

.dot.complete    { background: var(--paper); }
.dot.in-progress { background: var(--amber); border-color: var(--amber-deep); }
.dot.pending     { background: var(--muted-bg); border-style: dashed; border-color: var(--line-soft); }

.page-footer {
  margin-top: 18px;
  padding: 14px 48px 20px;
  border-top: 1.5px solid var(--green);
  font-family: 'EB Garamond', serif;
  text-align: center;
  font-size: 13px;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.page-footer .muted {
  color: var(--muted);
  margin-top: 6px;
  font-size: 12px;
  font-style: italic;
}
