/* Matchnight — a skin for the EIHL Fantasy front end.
 *
 * Design direction 2. Loaded after styles.css and inert until Theme picks it.
 *
 * Scene: the broadcast. A scorebug, a lower third, a results bar crawling
 * along the bottom. Dark is the night graphic, keyed over live footage. Light
 * is the studio version of the same bug — a pale desk instead of the arena,
 * with the bars still near-black so the graphic language survives.
 *
 * The big move on both grounds: the rink becomes a results list. A televised
 * line-up is read as rows with the score hard right, not as shirts on a map,
 * so .ice__row is turned on its side and each .jsy becomes a full-width row.
 * The club colour survives as the spine down the left of each one.
 *
 * The signature colour is the amber, and it lives in --primary so a
 * manager's accent replaces it. Nothing below names an amber literally.
 */

:root[data-theme="dark"] {
  --bg:          #05080a;
  --surface:     #0d1519;
  --surface-2:   #141c22;
  --surface-3:   #1d262d;

  --line:        #1f2a31;
  --line-soft:   #141c22;

  --ink:         #ffffff;
  --ink-muted:   #97a5ad;   /* 7.9:1 on --bg */
  --ink-faint:   #7b8992;   /* 5.7:1 on --bg */

  --primary:     #ffc53d;
  --primary-dim: #d9a52e;
  --primary-ink: #05080a;
  --primary-wash: rgba(255, 197, 61, 0.14);

  --alert:       #ff3b30;
  --alert-wash:  rgba(255, 59, 48, 0.16);
  --warn:        #ffb020;

  /* Matchnight-only. The chrome follows the ground; the scorebug does not.
     A broadcast bug is a dark graphic keyed over the picture, so .bank keeps
     its night colours on both grounds and carries its own ink. */
  --mn-bar:          #0a1014;   /* top and tab bars */
  --mn-bar-top:      #101820;
  --mn-ink-on-bar:   #ffffff;
  --mn-muted-on-bar: #97a5ad;
  --mn-bug:          #05080a;   /* the scorebug, dark in both grounds */
  --mn-bug-top:      #101820;
  --mn-bug-ink:      #ffffff;
  --mn-bug-muted:    #97a5ad;
  --mn-bug-accent:   #ffc53d;   /* the amber that sits on the dark bug */
  --mn-armband:      #c41a10;   /* --alert cannot carry white text */
  --mn-pos-g:        #ff9f6b;
  --mn-pos-d:        #8fc7ff;
}

:root[data-theme="light"] {
  --bg:          #eef1f3;
  --surface:     #ffffff;
  --surface-2:   #e2e7ea;
  --surface-3:   #d3dade;

  --line:        #c3ccd2;
  --line-soft:   #dde3e7;

  --ink:         #05080a;
  --ink-muted:   #4d5a63;   /* 7.4:1 on --bg */
  --ink-faint:   #5f6d76;   /* 5.4:1 on --bg */

  --primary:     #a06a00;   /* amber, darkened to carry white on a pale desk */
  --primary-dim: #815500;
  --primary-ink: #ffffff;
  --primary-wash: rgba(160, 106, 0, 0.12);

  --alert:       #c4271d;
  --alert-wash:  rgba(196, 39, 29, 0.12);
  --warn:        #8a6100;

  /* Chrome goes pale with the page: kept dark, the darkened amber the light
     ground needs measured 4.2:1 on it. The scorebug below stays dark. */
  --mn-bar:          #ffffff;
  --mn-bar-top:      #ffffff;
  --mn-ink-on-bar:   #05080a;
  --mn-muted-on-bar: #4d5a63;
  --mn-bug:          #05080a;
  --mn-bug-top:      #101820;
  --mn-bug-ink:      #ffffff;
  --mn-bug-muted:    #97a5ad;
  --mn-bug-accent:   #ffc53d;
  --mn-armband:      #c41a10;
  --mn-pos-g:        #8a4b1d;
  --mn-pos-d:        #1f5a8a;
}

:root {
  --radius-sm: 2px;
  --radius:    3px;
  --radius-lg: 4px;
  --shadow-1: none;
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.6);
  --mn-rule: 1px solid var(--line);
}

html, body {
  font-family: Saira, ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
}

/* Condensed for anything that is a number or a shout; the body face stays
   normal width so captions do not become a squeeze. */
h1, h2, h3,
.bank__figure, .jsy__num, .jsy__pts, .match__score,
.statgrid__value, .livegame__score, .prow__ppg {
  font-family: 'Saira Condensed', Saira, sans-serif;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { text-transform: uppercase; font-weight: 700; }
h1 { font-size: 1.32rem; }

/* ------------------------------------------------------------ the shell */

.topbar {
  background: linear-gradient(180deg, var(--mn-bar-top) 0%, var(--mn-bar) 100%);
  border-bottom: 2px solid var(--primary);
  backdrop-filter: none;
}
.topbar h1 { color: var(--mn-ink-on-bar); }
/* Scoped: app.js reuses .topbar__sub for muted captions throughout. */
.topbar .topbar__sub {
  color: var(--mn-muted-on-bar);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.64rem;
  font-weight: 500;
}
.topbar .motto { display: none; }

.gw-pill {
  border-radius: 2px;
  background: transparent;
  border-color: var(--line);
  color: var(--mn-ink-on-bar);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
}
.gw-pill b { color: var(--primary); }
.help-btn {
  border-radius: 2px;
  background: transparent;
  border-color: var(--line);
  color: var(--mn-muted-on-bar);
}
.topbar .help-btn:hover, .topbar .help-btn:focus-visible {
  color: var(--primary); border-color: var(--primary);
}
.identity .avatar { border-radius: 2px; }

.live-badge {
  background: var(--mn-armband);
  color: #ffffff;
  border-radius: 2px;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.tabbar {
  background: var(--mn-bar);
  border-top: 1px solid var(--line);
  backdrop-filter: none;
}
.tabbar button {
  color: var(--mn-muted-on-bar);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.62rem;
  font-weight: 600;
}
.tabbar button[aria-selected="true"],
.tabbar button[aria-selected="true"] svg { color: var(--primary); }

/* ------------------------------------------------- the scorebug (budget) */

.bank {
  background: linear-gradient(180deg, var(--mn-bug-top) 0%, var(--mn-bug) 100%);
  border: 0;
  border-bottom: 3px solid var(--mn-bug-accent);
  border-radius: 0;
  padding: 12px 16px 14px;
}
.bank__figure { font-size: 2.6rem; line-height: 0.9; color: var(--mn-bug-ink); }
.bank__figure.is-over { color: var(--alert); }
.bank__unit, .bank__stat span {
  color: var(--mn-bug-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.58rem;
  font-weight: 600;
}
.bank__stat b {
  color: var(--mn-bug-ink);
  font-family: 'Saira Condensed', sans-serif;
  font-size: 1.1rem;
}
.bank__track { background: #1d262d; border-radius: 0; height: 3px; }
.bank__fill { background: var(--mn-bug-accent); border-radius: 0; }
.bank__note { color: var(--mn-bug-muted); }

/* ------------------------------------------- the line-up, as a results list */

.ice {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}
.ice__markings { display: none; }          /* a scorebug has no rink furniture */

.ice__unit { margin-bottom: 0; }
.ice__tag {
  justify-content: flex-start;
  background: var(--surface);
  border-left: 3px solid var(--primary);
  padding: 5px 12px;
  margin-bottom: 0;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--ink-muted);
}
.ice__tag i { color: var(--primary); opacity: 1; }

/* Rows, not a map. .jsy's children are shirt, badge, name, club, points in
   that order, so a row direction gives the broadcast reading order for free. */
.ice__row { flex-direction: column; gap: 0; align-items: stretch; }

.jsy {
  width: 100%;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 0;
  border-bottom: var(--mn-rule);
  text-align: left;
  min-height: 46px;
}
.jsy:hover { transform: none; background: var(--surface); }

/* The shirt shrinks to a colour spine plus the squad number. */
.jsy__shirt {
  width: 34px; height: 46px;
  clip-path: none;
  border-left: 4px solid var(--club, var(--surface-3));
  background: transparent;
  flex: 0 0 auto;
}
.jsy:hover .jsy__shirt { filter: none; }
.jsy__num {
  font-size: 1.05rem;
  color: var(--ink-faint);
  text-shadow: none;
  font-weight: 700;
}
.jsy__name {
  flex: 1 1 auto;
  text-align: left;
  font-size: 0.92rem;
  font-weight: 600;
  max-width: none;
  /* This skin gives the name a full row, so one line is enough. Back to a
     plain block: the clamp box from styles.css reserves a second line here
     for nothing and trims the descenders off the first. */
  display: block;
  min-height: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  /* At 0.92rem the 1.15 line-height inherited from styles.css gives a 17px
     box for a line the font draws 20px tall, and overflow:hidden took the
     descenders off the j and y in a name like Bjorkly. One line, so let the
     font set its own leading. */
  line-height: normal;
  color: var(--ink);
}
.jsy__club {
  flex: 0 0 auto;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.6rem;
  color: var(--ink-faint);
}
.jsy__pts {
  flex: 0 0 auto;
  min-width: 46px;
  border-radius: 2px;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 2px 8px;
  background: var(--primary-wash);
  color: var(--primary);
}
.jsy__pts--zero  { background: var(--surface-2); color: var(--ink-faint); }
.jsy__pts--price { background: var(--surface-2); color: var(--ink-muted); }
.jsy__pts--neg   { background: var(--alert-wash); color: var(--alert); }

/* Did not play: the row stays full strength, the colour drains. Dimming the
   whole row to 45% would have pushed its caption under 4.5:1. */
.jsy--out { opacity: 1; }
.jsy--out .jsy__shirt { border-left-color: var(--surface-3); }
.jsy--out .jsy__name { color: var(--ink-muted); font-weight: 500; }

.jsy--empty { min-height: 46px; justify-content: flex-start; }
.jsy--empty .jsy__shirt {
  clip-path: none;
  border: 0;
  border-left: 4px dashed var(--surface-3);
  background: transparent;
}

/* The captain badge sits on the spine rather than floating off a corner. */
.jsy__badge {
  position: static;
  width: 18px; height: 18px;
  border-radius: 2px;
  border: 0;
  flex: 0 0 auto;
  font-size: 0.6rem;
}
/* The live red is too light to carry white text at this size: --alert gives
   3.5:1 where 4.5 is needed (classic has the same problem at 3.3:1). */
.jsy__badge--c { background: var(--mn-armband); color: #ffffff; }
.jsy__badge--v { background: var(--surface-3); color: var(--ink); }

/* ------------------------------------------------------------- the rest */

.card { background: var(--surface); border-color: var(--line); }
.btn {
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  font-size: 0.8rem;
}
.btn--primary { font-family: 'Saira Condensed', sans-serif; font-size: 1rem; font-weight: 700; }

.segmented { border-radius: 2px; }
.segmented button {
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 600;
}
.chip, .field, .guide__navlink, .seg-theme button, .field--stack input { border-radius: 2px; }
.seg-theme button { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.74rem; }

/* styles.css tints these with the position hue at 22% and uses the same hue
   for the text, which lands near 4:1. The forward chip takes the signature
   colour, so the goalie moves off it to stay distinguishable. */
.pos-chip { border-radius: 2px; }
.pos-chip--G { background: var(--surface-2); color: var(--mn-pos-g); }
.pos-chip--D { background: var(--surface-2); color: var(--mn-pos-d); }
.pos-chip--F { background: var(--primary-wash); color: var(--primary); }

.plist { gap: 0; }
.prow { border-bottom: var(--mn-rule); }
.prow__face { border-radius: 2px; }
.prow__name { font-weight: 600; }
/* Points per game decides a pick; price is a constraint. Swap their weight. */
.prow__price { font-size: 0.72rem; font-weight: 500; color: var(--ink-muted); }
.prow__ppg { font-size: 0.95rem; font-weight: 700; color: var(--ink); }

.table th {
  background: var(--surface);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.62rem;
}
.daygroup__day {
  background: var(--surface);
  border-left: 3px solid var(--primary);
  padding: 4px 12px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.62rem;
}
.match { border-radius: 2px; background: var(--surface); }
.match__dot { width: 4px; height: 26px; border-radius: 0; }
.match__club { font-weight: 600; font-size: 0.8rem; }

.matchlist { gap: 4px; }
.sheet { border-radius: 4px 4px 0 0; }
.avatar, .pdetail__face, .pdetail__initials { border-radius: 2px; }
.statgrid { border-radius: 2px; }
.livebar { border-radius: 2px; }
.livebar__dot { background: var(--mn-armband); }
.skeleton { border-radius: 2px; }
.ltag { border-radius: 2px; text-transform: uppercase; }

/* ------------------------------------------------ reclaiming light mode */

/* See the note in terrace.css: styles.css keeps the rink dark under
   :root[data-theme="light"] at (0,3,0), which beats the plain selectors
   above. Counterparts to styles.css:926-950. */
:root[data-theme="light"] .topbar {
  background: linear-gradient(180deg, var(--mn-bar-top) 0%, var(--mn-bar) 100%);
}
:root[data-theme="light"] .tabbar { background: var(--mn-bar); }
:root[data-theme="light"] .ice { background: transparent; border-color: transparent; }
:root[data-theme="light"] .ice__tag { color: var(--ink-muted); }
:root[data-theme="light"] .jsy__name { color: var(--ink); }
:root[data-theme="light"] .jsy__club { color: var(--ink-faint); }
:root[data-theme="light"] .jsy__badge { border-color: transparent; }
:root[data-theme="light"] .jsy--empty .jsy__shirt { border-color: var(--surface-3); }
:root[data-theme="light"] .jsy--empty .jsy__name,
:root[data-theme="light"] .jsy--empty .jsy__num { color: var(--ink-faint); }
:root[data-theme="light"] .jsy__pts--zero,
:root[data-theme="light"] .jsy__pts--price {
  background: var(--surface-2); color: var(--ink-muted);
}
:root[data-theme="light"] .jsy--out .jsy__name { color: var(--ink-muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
