/* MashUp Golf — shared theme.
 *
 * MOBILE FIRST: most players use phones. Base rules target a ~390px screen;
 * wider layouts are added with min-width queries. Rules every component
 * follows: tap targets >= 44px, body-ish text >= 13px (labels >= 12px),
 * hover effects only under (hover:hover), nothing may cause horizontal scroll.
 *
 * Tokens + reusable components. Loaded alongside the Tailwind CDN build, not
 * instead of it: existing pages keep their inline <style> blocks and utility
 * classes until they're migrated one at a time. Every component class is
 * prefixed `mu-` so it can never collide with a page-local rule or a Tailwind
 * utility. Token values mirror the `tailwind.config` colors already in each
 * page (flame / surface / card / border) — change them here, and in that
 * config, together.
 *
 * Color meaning (keep it this strict — it's what makes the palette readable):
 *   --flame  interactive / primary action / "hot"
 *   --live   an event in progress
 *   --win    positive / completed
 *   --cold   "cold" form only
 * Format families get NO color (decided in design review: format shows as a
 * neutral .mu-fmt tag).
 */

:root {
  --bg: #0c0c0c;
  --surface: #141414;
  --card: #1e1e1e;
  --card-hi: #252525;
  --border: #2c2c2c;
  --border-hi: #3a3a3a;

  --flame: #f97316;
  --live: #fbbf24;
  --win: #22c55e;
  --cold: #60a5fa;

  --text: #f3f4f6;
  --text-2: #b4b8c0;
  --text-3: #8a8f98; /* smallest allowed text colour on --bg (≈6:1) */

  --f-display: 'Bebas Neue', cursive;
  --f-head: 'Barlow Condensed', sans-serif;
  --f-body: 'Inter', sans-serif;

  --radius: 10px;
  --maxw: 1152px;
}

/* ---------- Base (phone) ---------- */
html { -webkit-text-size-adjust: 100%; }
a, button { -webkit-tap-highlight-color: rgba(249, 115, 22, .18); touch-action: manipulation; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Layout ---------- */
/* Gutters respect the notch / rounded corners in landscape (needs viewport-fit=cover). */
.mu-wrap {
  max-width: var(--maxw); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.mu-split { display: grid; gap: 32px; }
.mu-split > * { min-width: 0; }
@media (max-width: 520px) {
  .mu-hero__top h1 { font-size: 34px; }
  .mu-hero__top img { height: 52px; }
  .mu-live h2 { font-size: 24px; }
}
/* Source order is the phone order: events/results first, then the sidebar (standings / form). */
@media (min-width: 900px) { .mu-split { grid-template-columns: 1fr 320px; } }

/* ---------- Type ---------- */
.mu-label {
  font: 600 12px/1.2 var(--f-head);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.mu-label--flame { color: var(--flame); }
.mu-label--live { color: var(--live); }

.mu-section-title {
  font: 700 14px var(--f-head);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.mu-section-title a { font-size: 13px; color: var(--flame); letter-spacing: .1em; padding: 14px 0 14px 16px; margin: -14px 0; } /* 44px-tall hit area, no visual change */

/* ---------- Nav ---------- */
.mu-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12, 12, 12, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.mu-nav .mu-wrap { height: 56px; display: flex; align-items: center; gap: 28px; }
.mu-wordmark { font: 22px var(--f-display); letter-spacing: .06em; color: var(--text); display: inline-flex; align-items: center; min-height: 44px; }
.mu-navlinks { display: none; gap: 4px; flex: 1; }
.mu-navlinks a {
  font: 600 14px var(--f-head); letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-2); padding: 8px 12px; border-radius: 6px; transition: .15s;
}
@media (hover: hover) { .mu-navlinks a:hover { color: #fff; background: var(--surface); } }
.mu-navlinks a[aria-current="page"] { color: var(--flame); }
.mu-burger {
  margin-left: auto; width: 44px; height: 44px; cursor: pointer; font-size: 20px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-2);
}
.mu-sgt {
  display: none; align-items: center; gap: 8px; margin-left: auto;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 4px 12px 4px 6px;
  font: 600 12px var(--f-head); letter-spacing: .08em; color: var(--text-2);
}
.mu-sgt img { height: 22px; }
/* Desktop: a few primary links inline; the burger stays as "More" so every page remains reachable. */
@media (min-width: 900px) {
  .mu-navlinks, .mu-sgt { display: flex; }
  .mu-burger { margin-left: 0; }
}

/* Phone menu: full-width sheet under the nav, 48px rows, scrolls if the list outgrows the screen. */
.mu-menu {
  position: fixed; top: 56px; left: 0; right: 0; z-index: 49;
  max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-bottom: 1px solid var(--border);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .5);
  padding: 8px max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.mu-menu[hidden] { display: none; }
.mu-menu a {
  display: flex; align-items: center; min-height: 48px; padding: 0 12px; border-radius: 8px;
  font: 600 17px var(--f-head); letter-spacing: .06em; text-transform: uppercase; color: var(--text-2);
}
.mu-menu a:active { background: var(--surface); color: #fff; }
.mu-menu a[aria-current="page"] { color: var(--flame); }
.mu-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
@media (min-width: 900px) { .mu-menu { padding-left: max(16px, calc((100vw - var(--maxw)) / 2 + 16px)); padding-right: max(16px, calc((100vw - var(--maxw)) / 2 + 16px)); } }

/* Breadcrumb bar under the nav (non-sticky). Collapses to nothing while its target is empty. */
.mu-crumb .mu-wrap > div { font: 600 13px var(--f-head); letter-spacing: .08em; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu-crumb .mu-wrap > div:not(:empty) { padding: 2px 0; }
.mu-crumb a { display: inline-block; padding: 12px 0; color: var(--text-2); }
@media (hover: hover) { .mu-crumb a:hover { color: #fff; } }

/* ---------- Hero ---------- */
.mu-hero {
  background: radial-gradient(ellipse 70% 100% at 50% 0%, rgba(34, 197, 94, .16), transparent 70%);
  padding: 28px 0 8px;
}
.mu-hero__top { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.mu-hero__top img { height: 64px; width: auto; }
.mu-hero__top h1 { font: 44px/1 var(--f-display); letter-spacing: .1em; margin: 0; }
.mu-hero__top p { color: var(--text-2); font-size: 14px; margin: 4px 0 0; line-height: 1.35; }

/* ---------- Buttons ---------- */
.mu-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 13px var(--f-head); letter-spacing: .12em; text-transform: uppercase;
  padding: 11px 18px; min-height: 44px; border-radius: 8px; transition: .15s; cursor: pointer;
  background: var(--flame); color: #000; border: 0;
}
.mu-btn:active { filter: brightness(.92); }
@media (hover: hover) { .mu-btn:hover { filter: brightness(1.1); } }
.mu-btn--live { background: var(--live); }
.mu-btn--ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
@media (hover: hover) { .mu-btn--ghost:hover { color: var(--flame); border-color: rgba(249, 115, 22, .4); filter: none; } }

/* ---------- Live feature card ---------- */
.mu-live {
  display: grid; gap: 20px; padding: 22px;
  border: 1px solid rgba(251, 191, 36, .45); border-radius: 14px;
  background: radial-gradient(ellipse 100% 120% at 0% 0%, rgba(251, 191, 36, .15), transparent 60%), var(--card);
  box-shadow: 0 0 32px rgba(251, 191, 36, .12), 0 8px 24px rgba(0, 0, 0, .4);
}
@media (min-width: 800px) { .mu-live { grid-template-columns: 1.2fr 1fr; align-items: center; padding: 28px; } }
.mu-live h2 { font: 700 30px/1.1 var(--f-head); margin: 10px 0 6px; }
.mu-live .mu-btn { margin-top: 18px; width: 100%; justify-content: center; min-height: 48px; }
@media (min-width: 800px) { .mu-live .mu-btn { width: auto; } }
@media (min-width: 800px) { .mu-live.mu-live--single { grid-template-columns: 1fr; } }
.mu-meta { color: var(--text-2); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 10px; }

.mu-pulse { position: relative; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--live); }
.mu-pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--live); animation: mu-ping 1.6s ease-out infinite; }
@keyframes mu-ping { to { transform: scale(3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mu-pulse::after { animation: none; } }

.mu-minilb { background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .06); border-radius: var(--radius); padding: 6px 14px; }
.mu-minilb__head { padding: 8px 0 4px; display: flex; justify-content: space-between; }
.mu-minilb__row { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); font: 600 16px var(--f-head); }
.mu-minilb__row:last-child { border: 0; }
.mu-minilb__pos { color: var(--text-3); }
.mu-minilb__score { color: var(--live); font-variant-numeric: tabular-nums; }

/* ---------- Stat line (quiet — zero counts are omitted by the caller) ---------- */
.mu-statline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 28px; padding: 22px 0 6px; }
.mu-stat b { font: 32px var(--f-display); color: var(--flame); letter-spacing: .04em; margin-right: 8px; font-weight: 400; }
.mu-stat span { font: 600 12px var(--f-head); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }

/* ---------- Event row ---------- */
.mu-ev {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--border-hi);
  border-radius: var(--radius); padding: 14px 14px 14px 16px; margin-bottom: 8px; transition: .15s; min-height: 64px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 2px 6px rgba(0, 0, 0, .3);
}
a.mu-ev:active { background: var(--card-hi); border-left-color: var(--flame); }
@media (hover: hover) { a.mu-ev:hover { background: var(--card-hi); transform: translateY(-1px); border-color: var(--border-hi); border-left-color: var(--flame); } }
.mu-ev > div:first-child { min-width: 0; }
.mu-ev__name { font: 700 18px/1.2 var(--f-head); color: #fff; overflow-wrap: anywhere; }
/* Sub-line: tag on its own line, date/meta beneath — never wraps mid-phrase. */
.mu-ev__sub { font-size: 13px; color: var(--text-2); margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.mu-ev__sub > span:not(.mu-fmt) { white-space: nowrap; }
.mu-ev__winner { text-align: right; max-width: 130px; min-width: 0; }
.mu-ev__winner-name { font: 700 16px var(--f-head); color: var(--text); display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.mu-ev__winner-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mu-ev__winner-name::before { content: "🏆"; font-size: 12px; }
.mu-ev__winner-score { font-size: 13px; color: var(--text-3); }
.mu-ev--planned { background: transparent; border-style: dashed; box-shadow: none; }
.mu-ev--planned .mu-ev__name { color: var(--text-2); }

/* Neutral pill/tag — used for the format name on event rows and for status. */
.mu-fmt {
  display: inline-block; font: 600 12px var(--f-head); letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 4px;
}
.mu-tag {
  font: 600 12px var(--f-head); letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px;
}
.mu-more { display: block; text-align: center; border-radius: 8px; padding: 14px 10px; min-height: 48px; margin-top: 6px; font-size: 13px; cursor: pointer; background: none; width: 100%; }

/* ---------- Panel / standings / chips ---------- */
.mu-panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }
.mu-st { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; min-height: 48px; border-bottom: 1px solid var(--border); font: 600 17px var(--f-head); }
.mu-st:last-of-type { border: 0; }
.mu-st__pts { color: var(--text-2); font-variant-numeric: tabular-nums; }
.mu-medal { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #111; }
.mu-medal--1 { background: #fbbf24; } .mu-medal--2 { background: #d1d5db; } .mu-medal--3 { background: #d6914f; }
.mu-medal--n { background: transparent; color: var(--text-3); }
.mu-panel__link { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 8px; font: 600 13px var(--f-head); letter-spacing: .12em; text-transform: uppercase; color: var(--flame); }

.mu-chips { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mu-chip { display: inline-flex; align-items: center; min-height: 36px; font: 600 15px var(--f-head); letter-spacing: .04em; padding: 0 14px; border-radius: 999px; }
.mu-chip--hot { background: rgba(249, 115, 22, .14); color: var(--flame); }
.mu-chip--cold { background: rgba(96, 165, 250, .14); color: var(--cold); }

/* ---------- Footer note ---------- */
.mu-note { text-align: center; color: var(--text-3); font-size: 12px; padding: 20px 0 40px; border-top: 1px solid var(--border); }

/* ---------- Tables on phones ---------- */
/* Wrap a <table> in .mu-tablewrap (inside a .mu-clip card). On narrow OR short screens (a phone held sideways is
   wide but only ~390px tall) the PAGE scrolls and the sticky header pins under the 56px nav. On tall wide screens
   the table scrolls inside its own box capped at 100vh minus --mu-cap (default 12rem).
   .mu-clip must be used instead of overflow:hidden on the card — overflow:hidden would make the card the sticky
   header's scroll container and it would never pin to the viewport. */
.mu-clip { overflow: visible; overflow: clip; }
@media (max-width: 639px), (max-height: 699px) {
  .mu-tablewrap thead th { top: 56px; }
  .mu-tablewrap thead th:first-child { border-top-left-radius: 8px; }
  .mu-tablewrap thead th:last-child  { border-top-right-radius: 8px; }
}
@media (min-width: 640px) and (min-height: 700px) {
  .mu-tablewrap { overflow: auto; max-height: calc(100vh - var(--mu-cap, 12rem)); }
}

/* Tappable name pill (used for long lists of players). */
.mu-pill { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font: 600 15px var(--f-head); letter-spacing: .04em; transition: .15s; }
.mu-pill:active { background: var(--card-hi); color: #fff; }
@media (hover: hover) { .mu-pill:hover { color: var(--flame); border-color: rgba(249, 115, 22, .4); } }
