/* 05 The games: the title, then four small live cards on the light grey, one per format.
   Stand vs stand, Conquer the city, Supporters' clubs, Walk to the stadium: all inside one fanbase
   (teams of the club's own fans, never another club). Names and a type tag only;
   each card's graphic moves on its own while the page is on screen (formats.js). */
.fmts { --club: #d7192d; --team-b: #e0a200; background: var(--paper); } /* team B: the club's second colour */
:root[data-theme='dark'] .fmts { --team-b: #f2b821; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .fmts { --team-b: #f2b821; } }

.fmts__inner { display: grid; justify-items: center; row-gap: clamp(28px, 4vh, 44px); }
.fmts__head { text-align: center; max-width: 1000px; }
.fmts__idx.feat__idx { display: flex; justify-content: center; align-items: baseline; gap: 12px; margin: 0 0 18px; font-family: var(--body); font-size: 14px; color: var(--slate); }
.fmts__title { margin: 0; font-family: var(--display); font-stretch: var(--display-stretch); font-weight: 800; font-size: clamp(40px, 4vw, 60px); line-height: 1.02; letter-spacing: -0.025em; color: var(--ink); text-wrap: balance; }
.fmts__title em { font-style: normal; color: var(--blue); white-space: nowrap; }

.fmts__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 24px); width: 100%; }
.game { position: relative; display: flex; flex-direction: column; aspect-ratio: 3 / 4; max-height: calc(100vh - var(--nav-h) - 260px); min-height: 300px; padding: 20px; border-radius: var(--r-card, 24px); background: var(--infield); overflow: hidden; }
.game__tag { margin: 4px 0 0; font-family: var(--mono); font-size: 12px; color: var(--slate); }
.game__name { margin: 0; font-family: var(--display); font-stretch: var(--display-stretch); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: var(--ink); }
.game__viz { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; align-content: center; min-height: 0; }

/* The cards rise in one after another when the page arrives. */
.js .fmts .game { opacity: 0; transform: translateY(24px); transition: opacity 600ms var(--ease), transform 700ms var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
.js .fmts.is-in .game { opacity: 1; transform: none; }
.game:nth-child(2) { --i: 1; } .game:nth-child(3) { --i: 2; } .game:nth-child(4) { --i: 3; }

/* Stand vs stand: two teams of the same fans, the movement index score, a tug of war bar. */
.derby { width: 100%; gap: 18px; }
.derby__teams { display: flex; justify-content: space-between; width: 100%; }
.derby__team { display: grid; justify-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--slate); }
.derby__crest { display: grid; place-items: center; width: 46px; height: 52px; border-radius: 10px 10px 23px 23px; background: var(--club); color: #fff; font-family: var(--display); font-style: normal; font-weight: 800; font-size: 20px; }
.derby__team--b .derby__crest { background: var(--team-b); color: #0b0f1a; }
.derby__score { display: flex; align-items: baseline; gap: 10px; margin: 0; font-family: var(--display); font-stretch: var(--display-stretch); font-weight: 800; font-size: clamp(40px, 3.6vw, 56px); line-height: 1; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.derby__score span { color: var(--slate); font-weight: 500; }
.derby__score b { display: inline-block; font-weight: inherit; transition: transform 380ms var(--ease), color 380ms ease; }
.derby__score b.is-up { transform: translateY(-6px); color: var(--club); }
.derby__score b[data-b].is-up { color: var(--team-b); }
.derby__bar { width: 100%; height: 8px; border-radius: 4px; background: var(--team-b); overflow: hidden; }
.derby__bar i { display: block; height: 100%; width: calc(var(--a) * 100%); background: var(--club); border-right: 2px solid var(--infield); transition: width 900ms var(--ease); }
.derby__day { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--slate); }

/* Conquer the city: streets as tiles; the runner turns them club red. */
.city { width: min(100%, 220px); height: auto; overflow: visible; }
.city__c { fill: var(--hex-empty); transition: fill 420ms ease; }
.city__c[data-o='1'] { fill: var(--club); }
.city__c[data-o='2'] { fill: var(--team-b); }
.city__run { fill: #fff; stroke: var(--ink); stroke-width: 2.5; transition: cx 300ms linear, cy 300ms linear; }

/* Supporters' clubs: four rows that swap places as the scores move. */
.tbl { position: relative; justify-self: stretch; width: 100%; height: 200px; margin: 0; padding: 0; list-style: none; }
.tbl li { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px; border-radius: 12px; background: var(--surface); font-size: 15px; font-weight: 600; color: var(--ink); transform: translateY(calc(var(--r, 0) * 52px)); transition: transform 700ms var(--ease), box-shadow 300ms ease; }
.tbl li:nth-child(2) { --r: 1; } .tbl li:nth-child(3) { --r: 2; } .tbl li:nth-child(4) { --r: 3; }
.tbl li b { margin-left: auto; font-family: var(--mono); font-weight: 500; color: var(--slate); font-variant-numeric: tabular-nums; }
.tbl__n { width: 16px; font-family: var(--mono); font-weight: 500; font-size: 13px; color: var(--slate); }
.tbl li.is-top { box-shadow: inset 0 0 0 2px var(--club); }
.tbl li.is-top b { color: var(--club); }

/* Walk to the stadium: the steps ring and the kick-off countdown. */
.walk { position: relative; gap: 14px; }
.walk__ring { grid-area: 1 / 1; width: min(100%, 190px); transform: rotate(-90deg); }
.walk__ring circle { fill: none; stroke: var(--hex-empty); stroke-width: 10; }
.walk__ring .walk__fill { stroke: var(--club); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p) * 100); transition: stroke-dashoffset 500ms var(--ease); }
.walk__steps { grid-area: 1 / 1; display: grid; justify-items: center; margin: 0; }
.walk__steps b { font-family: var(--display); font-stretch: var(--display-stretch); font-weight: 800; font-size: 32px; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.walk__steps span { font-size: 12px; color: var(--slate); }
.walk__ko { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--slate); }
.walk__ko b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) {
  .fmts__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game { aspect-ratio: auto; height: 340px; max-height: none; }
}
@media (max-width: 600px) {
  .fmts__grid { grid-template-columns: minmax(0, 1fr); }
  .game { height: 320px; }
}
@media (prefers-reduced-motion: reduce) {
  .js .fmts .game { opacity: 1; transform: none; transition: none; }
  .city__c, .city__run, .tbl li, .walk__fill, .derby__bar i, .derby__score b { transition: none; }
}
