/* Floodlight — a skin for the Power Play front end.
 *
 * Design direction 6, and the default look. Loaded after styles.css and
 * inert until Theme picks it.
 *
 * Scene: a rink has two light sources, not one. The rig above throws light
 * down onto the ice, and the ice throws a good deal of it straight back up,
 * which is why the boards and the first few rows always look lit from below.
 * So: a warm light at the top of the screen and a cold one at the bottom,
 * both anchored outside the frame so what lands on screen is the falloff
 * rather than the hotspot. A visible hotspot reads as a blob; the tail of
 * one reads as a room with a light in it.
 *
 * The footlight is deliberately quieter than the floodlight — 12 against 17
 * on night, 12 against 15 on day. It is the reflection, not the source, and
 * a reflection that outshines its source looks wrong without anyone being
 * able to say why.
 *
 * Dark is the arena at night. Light is the same rig in an afternoon game:
 * the arithmetic inverts, because you cannot add light to pale stock that is
 * already bright. There the lit areas keep the paper and everything else
 * cools off. Both grounds are designed, not inverted.
 *
 * The lit colour is --logo-lit, which is the goal horn until a manager picks
 * an accent and theirs after that. Nothing below names the horn literally;
 * do not reintroduce one, or a chosen colour will skip the lights.
 */

/* ------------------------------------------------------------ the night */

:root[data-theme="dark"] {
  --bg:          #08090b;
  --surface:     #11141a;
  --surface-2:   #171c23;
  --surface-3:   #212831;

  --line:        #242b34;
  --line-soft:   #161a20;

  --ink:         #e9edf1;
  --ink-muted:   #98a2ac;   /* 8.4:1 on --bg */
  --ink-faint:   #6f7880;   /* 4.6:1 on --bg, decoration only */

  --primary:     #ff5c2b;
  --primary-dim: #d44a1f;
  --primary-ink: #0b0c0e;
  --primary-wash: color-mix(in oklab, #ff5c2b 14%, transparent);

  --alert:       #ff4d4d;
  --alert-wash:  color-mix(in oklab, #ff4d4d 16%, transparent);
  --warn:        #e0a33c;

  /* Floodlight-only. The two lights, and how hard each is driven. */
  --fl-lit:      var(--logo-lit, #ff5c2b);
  --fl-ice:      #9ccbe6;
  --fl-flood:    17%;
  --fl-foot:     12%;
  --fl-flash:    30%;       /* a goal, for a few seconds */
  --fl-bar-ink:  #e9edf1;
}

/* --------------------------------------------------- the afternoon game */

:root[data-theme="light"] {
  --bg:          #edeeea;
  --surface:     #ffffff;
  --surface-2:   #e4e6e1;
  --surface-3:   #d7dad4;

  --line:        #d3d6d1;
  --line-soft:   #e2e4e0;

  --ink:         #14191a;
  --ink-muted:   #565f63;   /* 7.1:1 on --bg */
  --ink-faint:   #767f84;   /* 4.5:1 on --bg */

  /* The horn as drawn measures 2.8:1 on this stock — fine for a mark, not
     for a label. Darkened here, same hue, 5.5:1. The mark itself is not
     styled from --primary, so it keeps the colour it has everywhere else. */
  --primary:     #b23a12;
  --primary-dim: #8e2d0c;
  --primary-ink: #ffffff;
  --primary-wash: color-mix(in oklab, #b23a12 10%, transparent);

  --alert:       #b3261e;
  --alert-wash:  color-mix(in oklab, #b3261e 12%, transparent);
  --warn:        #8a6100;

  --fl-lit:      var(--logo-lit, #ff5c2b);
  --fl-ice:      #60a0c8;
  --fl-flood:    15%;
  --fl-foot:     12%;
  --fl-flash:    26%;
  --fl-bar-ink:  #14191a;
}

/* --------------------------------------------------------- the two lights */

/* Fixed rather than scrolled: a light in a room does not move when you
   scroll the page under it. Both sit behind everything and take no clicks. */
html { background: var(--bg); }

body::before,
body::after {
  content: "";
  position: fixed;
  left: 0; right: 0;
  pointer-events: none;
  z-index: 0;
}

/* The rig, centred above the top edge. */
body::before {
  top: 0;
  height: 62vh;
  background: radial-gradient(130% 92% at 50% 0%,
    color-mix(in srgb, var(--fl-lit) var(--fl-flood), transparent),
    transparent 70%);
}

/* The ice, throwing it back. Colour and strength both change on a goal, so
   they transition; the ground underneath never does. */
body::after {
  bottom: 0;
  height: 46vh;
  background: radial-gradient(120% 100% at 50% 100%,
    color-mix(in srgb, var(--fl-foot-colour, var(--fl-ice)) var(--fl-foot-now, var(--fl-foot)), transparent),
    transparent 74%);
  transition: background 420ms var(--ease);
}

/* One of your own players has just scored. Set by Theme.flash(), cleared a
   few seconds later. The footlight warms to the lit colour and brightens;
   it is never the only signal, because the points row says the same thing
   in words and numbers. */
:root[data-flash="1"] {
  --fl-foot-colour: var(--fl-lit);
  --fl-foot-now:    var(--fl-flash);
}

/* Content sits above the lights. */
.app { position: relative; z-index: 1; }

/* ------------------------------------------------------------ the chrome */

/* Both bars are transparent so the lights pass under them. The tab bar
   loses its rule entirely: once the bottom of the screen is lit, a hairline
   above it is doing nothing but looking like a template. */
.topbar {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line-soft);
}

.tabbar {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-top: none;
}

.topbar__sub { color: var(--ink-muted); }

/* ----------------------------------------------------------- the surfaces */

/* Cards step back. In a lit room the light is the depth, so a card needs a
   border or a fill, not both and not a shadow as well. */
.card {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid var(--line);
  box-shadow: none;
}

.panel.is-active { animation: none; }

/* The rink keeps its own ground rather than borrowing a surface, so the
   lights read across it instead of stopping at its edge. */
.ice {
  background: transparent;
  border-color: var(--line-soft);
}

.matchlist { gap: 2px; }
.match {
  background: color-mix(in srgb, var(--surface) 64%, transparent);
  border: 1px solid var(--line-soft);
  box-shadow: none;
}
.match__club { font-weight: 600; }
.match__time,
.match__score { font-variant-numeric: tabular-nums; }

.daygroup__day {
  color: var(--ink-faint);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 700;
}

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

/* styles.css paints these in oklch literals that only work on the dark
   ground. See the same block in terrace.css and formguide.css. */
:root[data-theme="light"] .topbar {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
}
:root[data-theme="light"] .tabbar {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
}
:root[data-theme="light"] .ice { background: transparent; border-color: var(--line-soft); }
:root[data-theme="light"] .ice__tag { color: var(--ink-faint); }
: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(--line); }
: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); }

/* The goal flash is the one piece of motion here that carries meaning, so
   it does not simply vanish under reduced motion: it holds the lit state
   and cuts, rather than sweeping up and down. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  body::after { transition: none !important; }
}
