/* Sportjan.tv — DEL2 fixture browser.
   The rink is the palette: cold desaturated blue-greys, so the club crests are
   the only saturated colour on screen. Red is the goal line and means exactly
   one thing — live now. */

:root {
  --ice-900: #0E1621;   /* page */
  --ice-850: #121C27;   /* sidebar */
  --ice-800: #16202D;   /* row */
  --ice-750: #1C2836;   /* row hover */
  --ice-line: #253444;
  --ice-050: #E6EDF3;
  --ice-300: #9DB0C2;
  --ice-400: #74889B;
  --live: #FF0000;      /* the brand red, straight off the wordmark */
  --radius: 3px;
}

body {
  background: var(--ice-900);
  color: var(--ice-050);
  font-family: Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: 1180px; margin: 0 auto; padding: 28px 20px 64px; }

/* ── masthead ─────────────────────────────────────────────────────── */
.masthead { margin: 0 0 26px; }
.masthead-logo { height: 46px; width: auto; display: block; }
@media (max-width: 575px) { .masthead-logo { height: 26px; } }

/* ── club rail ────────────────────────────────────────────────────── */
.rail { background: var(--ice-850); border: 1px solid var(--ice-line); border-radius: var(--radius); overflow: hidden; }
.rail-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  background: transparent; border: 0;
  border-left: 2px solid transparent;
  color: var(--ice-300);
  font-size: 0.82rem; width: 100%; text-align: left;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.rail-item:hover { background: var(--ice-750); color: var(--ice-050); }
.rail-item.is-active {
  background: var(--ice-800);
  border-left-color: var(--ice-050);
  color: var(--ice-050);
  font-weight: 500;
}
.rail-item:focus-visible { outline: 2px solid var(--ice-050); outline-offset: -2px; }
.rail-item img { width: 28px; height: 28px; object-fit: contain; flex: 0 0 28px; }
/* Wrap rather than truncate: this is a nav list, not a table column, and
   "Eispiraten Crimmitschau" does not fit a quarter-width rail on one line. */
.rail-name { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; font-size: 0.82rem; }
.rail-badge {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 2px;
  background: var(--ice-line); color: var(--ice-300);
  font-size: 0.66rem; display: flex; align-items: center; justify-content: center;
}
.fx-team .rail-badge { width: 36px; height: 36px; flex: 0 0 36px; font-size: .72rem; }
.rail-league { font-family: "Barlow Condensed", sans-serif; font-size: 1rem; font-weight: 600; letter-spacing: .04em; }

.section-title {
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-size: 1.32rem; font-weight: 600; color: var(--ice-050);
  margin: 0 0 2px; padding-bottom: .35rem;
  border-bottom: 1px solid var(--ice-line);
}

/* ── matchday ─────────────────────────────────────────────────────── */
.matchday {
  display: flex; align-items: baseline; gap: 0.8rem;
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-size: 1.18rem; font-weight: 600;
  color: var(--ice-050);
  margin: 26px 0 6px;
}
.matchday::after {
  content: ""; flex: 1; height: 1px; background: var(--ice-line);
}
.matchday:first-child { margin-top: 4px; }

/* ── fixture row ──────────────────────────────────────────────────── */
.fixture {
  display: grid;
  grid-template-columns: 3.6rem 1fr 1fr minmax(auto, max-content);
  align-items: center; gap: 0.9rem;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--ice-line);
  transition: background .12s ease;
}
.fixture:hover { background: var(--ice-800); }
.fixture:last-child { border-bottom: 0; }

.fx-time {
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 1.02rem; font-weight: 600; color: var(--ice-300);
}
.fixture.is-live .fx-time { color: var(--live); }
.fx-live {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--live); margin-right: 0.35rem; vertical-align: 0.12em;
}
.fx-team { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.fx-team img { width: 36px; height: 36px; object-fit: contain; flex: 0 0 36px; }
.fx-name {
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-size: 1.04rem; font-weight: 500; letter-spacing: .005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fx-note { color: var(--ice-400); font-size: 0.76rem; margin-top: 1px; }
.fx-actions { display: flex; align-items: center; gap: 0.35rem; justify-self: end; flex-wrap: wrap; }

/* ── controls ─────────────────────────────────────────────────────── */
.btn-ice, .btn-ice:focus {
  background: transparent; color: var(--ice-300);
  border: 1px solid var(--ice-line); border-radius: var(--radius);
  font-size: 0.78rem; padding: 0.24rem 0.7rem; line-height: 1.5;
  white-space: nowrap;
}
.btn-ice:hover { background: var(--ice-050); color: var(--ice-900); border-color: var(--ice-050); }
.btn-ice:disabled { color: var(--ice-400); opacity: .5; background: transparent; border-style: dashed; }
.btn-ice.is-primary { color: var(--ice-050); border-color: var(--ice-300); }

.feed-head {
  font-size: 0.68rem; color: var(--ice-400); padding: .3rem .8rem .15rem;
  border-top: 1px solid var(--ice-line); margin-top: .2rem;
}
.dropdown-menu { background: var(--ice-850); border: 1px solid var(--ice-line); border-radius: var(--radius); }
.dropdown-item { color: var(--ice-300); font-size: .8rem; }
.dropdown-item:hover { background: var(--ice-750); color: var(--ice-050); }

.quality { font-size: .74rem; color: var(--ice-400); font-variant-numeric: tabular-nums; }
.empty { color: var(--ice-400); padding: 2.5rem 0; }

/* ── tabs ─────────────────────────────────────────────────────────── */
.nav-tabs { border-bottom: 1px solid var(--ice-line); gap: .2rem; }
.nav-tabs .nav-link {
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-size: 1.02rem; font-weight: 500; letter-spacing: .01em;
  color: var(--ice-400); background: transparent;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  padding: .3rem .8rem;
}
.nav-tabs .nav-link:hover { color: var(--ice-050); border-bottom-color: var(--ice-line); }
.nav-tabs .nav-link.active {
  color: var(--ice-050); background: transparent; border-bottom-color: var(--ice-050);
}

/* ── narrow screens ───────────────────────────────────────────────────
   The rail becomes a horizontal bar above the fixtures: a stacked column of
   fourteen clubs pushed every match below the fold. A fixture keeps its time
   column and stacks the two sides under each other -- the away side must not
   land in the time column, which truncated it to a single letter.

   The cut is at 900px, not at the usual tablet 768px, because the four-column
   fixture needs roughly 880px before the team columns stop clipping names:
   at 768px they were 97px wide and every name was truncated. */
@media (max-width: 899px) {
  .shell { padding: 18px 12px 48px; }

  /* Crests only, as a row of circles you swipe -- the names cost more width
     than they earn here, and a crest is recognisable on its own. */
  .rail {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.65rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0.2rem 0 0.5rem;
  }
  .rail::-webkit-scrollbar { display: none; }

  .rail-item {
    width: auto;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-left: 0;
    background: transparent;
  }
  .rail-item:hover { background: transparent; }
  .rail-item.is-active { background: transparent; border-left: 0; }

  .rail-item img,
  .rail-item .rail-badge {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    border-radius: 50%;
    background: var(--ice-800);
    padding: 5px;
    box-sizing: border-box;
    border: 2px solid var(--ice-line);
    transition: border-color .12s ease;
  }
  .rail-item.is-active img,
  .rail-item.is-active .rail-badge {
    border-color: var(--ice-050);
    border-width: 3px;
  }
  .rail-item:focus-visible img,
  .rail-item:focus-visible .rail-badge { border-color: var(--live); }
  .rail-item:focus-visible { outline: none; }

  /* The crest carries the identity; labels would halve how many fit. */
  .rail-name, .rail-league { display: none; }

  .fixture {
    grid-template-columns: 3.2rem minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    row-gap: 0.25rem;
    column-gap: 0.55rem;
    padding: 0.65rem 0.5rem;
  }
  /* time on the left, the two sides stacked in the middle, action on the
     right spanning both rows -- underneath, it pushed every fixture taller. */
  .fixture > .fx-time    { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
  .fixture > .fx-home    { grid-column: 2; grid-row: 1; }
  .fixture > .fx-away    { grid-column: 2; grid-row: 2; }
  .fixture > .fx-actions {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: end;
    max-width: 7.2rem;
  }
  /* Let the long label wrap instead of stealing width from the team names. */
  .fx-actions .btn-ice {
    white-space: normal;
    line-height: 1.15;
    padding: 0.3rem 0.5rem;
    font-size: 0.72rem;
  }

  .fx-team img { width: 26px; height: 26px; flex: 0 0 26px; }
  .fx-team .rail-badge { width: 26px; height: 26px; flex: 0 0 26px; }
  .fx-name { font-size: 0.98rem; }
  .masthead-logo { height: 34px; }
  .section-title { font-size: 1.15rem; }
  .nav-tabs .nav-link { padding: .3rem .55rem; font-size: .95rem; }
}

/* Between the stacked layout and a roomy desktop the table still fits, but
   only just: tighten the gaps and the action label rather than clip names. */
@media (min-width: 900px) and (max-width: 1199px) {
  .fixture { column-gap: 0.6rem; padding-left: 0.6rem; padding-right: 0.6rem; }
  .fx-name { font-size: 0.97rem; }
  .btn-ice { padding: 0.24rem 0.5rem; font-size: 0.74rem; }
  .rail-item { padding: 0.5rem 0.6rem; }
}

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