/* ==========================================================================
   Kobra redesign — soupiska (squad page, /buly/).
   Enqueued only on pages containing [stm_players_carousel]; redesign.css is a
   dependency and supplies the palette, fonts and texture used here.

   Splash renders each player list as an Owl carousel four cards wide. That is
   replaced by roster.js with a grid and a group switcher — see the header
   comment there for why the carousel is rebuilt rather than restyled.
   ========================================================================== */

/* ---------- Hide what the JS replaces ----------
   Mirrored in CSS as well as in roster.js because the script runs at
   DOMContentLoaded, which is late enough for three carousels to paint first
   and then vanish.

   The `~` selectors clear the [vc_separator] and [stm_spacing] blocks that
   only existed to hold the carousels apart. They cannot reach the injected
   grid: it is inserted *before* the first .stm-player-ids, and `~` only
   matches following siblings. */
.stm-player-ids,
.stm-player-ids ~ .vc_separator,
.stm-player-ids ~ .stm-spacing,
.kobra-replaced {
	display: none !important;
}

.kobra-roster {
	margin: 0 0 10px;
}

/* ==========================================================================
   Group switcher
   ========================================================================== */
.kobra-roster-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 26px;
	padding: 0 0 20px;
	border-bottom: 1px solid var(--kobra-line);
}

/* ---------- The tabs are the site's own buttons ----------
   roster.js gives each one `kobra-btn` plus `kobra-btn-primary` when it is
   the selected group and `kobra-btn-ghost` otherwise — the same pair the
   homepage uses for "Rozpis zápasů" and "Fotogalerie". So the look is
   inherited from redesign.css rather than restated here, and the selected
   group stands out through the same solid-versus-outlined contrast the site
   already uses to mean "this is the one".

   Only the things a <button> needs that an <a> does not are set here: it
   carries a UA border and background of its own, and does not get a pointer
   cursor for free. */
.kobra-roster-tab {
	cursor: pointer;
	font-family: 'Bricolage Grotesque', sans-serif;
}

.kobra-roster-tab:focus-visible {
	outline: 2px solid var(--kobra-sky);
	outline-offset: 2px;
}

/* ---------- Restating the button component, because these are <button> ----
   On the homepage the same component is on <a> elements and needs none of
   this. Here they are real buttons — correct for a tablist — and the theme
   attacks bare `button` from two directions that `.kobra-btn` cannot answer
   on its own:

     hockey.css   .hockey #wrapper button   (1,1,1)  padding, font-size, bg
     styles.css   button                    !important on background-color

   The first carries an ID, so no number of classes beats it; the second is
   important, so only another important declaration can. Hence the `#wrapper`
   prefix — (1,3,0), comfortably above (1,1,1) — plus `!important` on the
   background alone, which is the one property styles.css defends that way.
   Everything else is settled on specificity as usual. */
.hockey #wrapper .kobra-roster-tab.kobra-btn {
	/* `.kobra-btn` declares inline-flex, but the theme's own `button` rule
	   forces display:block — which silently disabled the component's `gap`,
	   since gap only does anything in a flex or grid container. The label and
	   the count then sat flush against each other with no space at all. */
	display: inline-flex;
	align-items: center;
	gap: 12px;
	/* Splash's `margin-left: 10px` on every button through `#wrapper` — see the
	   note on `.kobra-filter-btn` in redesign.css. These tabs are their own
	   component rather than that one (they carry a count chip and more padding),
	   so they need their own copy. Measured on /buly/: the grid and the tab row
	   both start at x=63, and the first tab started at 73. */
	margin: 0;
	padding: 14px 26px;
	border-width: 1.5px;
	border-style: solid;
	border-radius: 3px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.2;
	text-transform: uppercase;
	background-color: transparent !important;
}
.hockey #wrapper .kobra-roster-tab.kobra-btn-primary {
	border-color: var(--kobra-yellow);
	background-color: var(--kobra-yellow) !important;
}
.hockey #wrapper .kobra-roster-tab.kobra-btn-ghost {
	border-color: rgba(234, 241, 248, 0.4);
}
.hockey #wrapper .kobra-roster-tab.kobra-btn-ghost:hover {
	border-color: var(--kobra-sky);
}

/* ---------- Keep the label's colour when hovering a focused tab ----------
   hockey.css whitens button text, but only for two states at once:

     .hockey #wrapper button:hover:focus,
     .hockey #wrapper button:hover:active { color: #fff !important; }

   which is why a plain hover looks fine and the bug only appears *after* a
   click: selecting a group focuses that button, and hovering it from then on
   matches :hover:focus and turns the label white on the yellow. Easy to miss
   when checking hover on its own — states have to be tested in combination.

   Both sides are important, so specificity decides: theirs is (1,3,1),
   these are (1,5,0). The lift and the yellow glow are untouched — the
   movement is wanted, only the colour change was not. */
.hockey #wrapper .kobra-roster-tab.kobra-btn-primary:hover,
.hockey #wrapper .kobra-roster-tab.kobra-btn-primary:focus,
.hockey #wrapper .kobra-roster-tab.kobra-btn-primary:hover:focus,
.hockey #wrapper .kobra-roster-tab.kobra-btn-primary:hover:active {
	color: #101a08 !important;
}
.hockey #wrapper .kobra-roster-tab.kobra-btn-ghost:hover,
.hockey #wrapper .kobra-roster-tab.kobra-btn-ghost:hover:focus,
.hockey #wrapper .kobra-roster-tab.kobra-btn-ghost:hover:active {
	color: var(--kobra-sky) !important;
}
.hockey #wrapper .kobra-roster-tab.kobra-btn-ghost:focus {
	color: var(--kobra-ice) !important;
}

/* ---------- Splash's decorative slab behind every <button> ----------
   The theme hangs two skewed layers off each button: `::after` is a solid red
   slab and `::before` a red 4px outline, both a few pixels larger than the
   button and sitting at z-index -1 / -2. On the comment form that slab is the
   button, so there it was recoloured. Here it is not — `.kobra-btn` draws its
   own flat shape — and because the unselected tabs are transparent, the red
   showed straight through them.

   Removed rather than recoloured: a skewed slab behind a flat outlined button
   would be a second shape competing with the first, and the same slanted
   motif already earns its keep on the comment button and the news date
   badges. `display: none` takes both layers out in one rule instead of
   chasing a background, an outline and a border separately — the lesson from
   the comment button, where the outline survived two attempts because it is a
   different property from the background. */
.hockey #wrapper .kobra-roster-tab.kobra-btn::before,
.hockey #wrapper .kobra-roster-tab.kobra-btn::after {
	display: none !important;
	content: none !important;
}

/* The count rides along inside the button as a quiet annotation rather than
   a second label. Its two states track the button it sits in: pale on the
   outlined ones, dark on the solid yellow one. */
.kobra-roster-tab-count {
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba(234, 241, 248, 0.1);
	font-size: 11px;
	font-weight: 800;
	line-height: 1.5;
	color: var(--kobra-mist);
	transition: color .18s ease, background-color .18s ease;
}
.kobra-roster-tab.kobra-btn-ghost:hover .kobra-roster-tab-count {
	color: var(--kobra-sky);
}
.kobra-roster-tab.kobra-btn-primary .kobra-roster-tab-count {
	background: rgba(16, 26, 8, 0.16);
	color: #101a08;
}

/* Shown only when there is no switcher to name the group. */
.kobra-roster-heading {
	margin: 0 0 20px;
	font-family: 'Bricolage Grotesque', sans-serif;
	font-size: 24px;
	font-weight: 800;
	color: var(--kobra-ice);
}

/* ==========================================================================
   The grid
   ==========================================================================
   auto-fill + minmax so the column count follows the viewport rather than
   being fixed at Splash's four: six or seven across on a wide screen, two on
   a phone. 170px is about the narrowest a portrait photo with a name under it
   stays legible. */
.kobra-roster-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr));
	gap: 22px;
}

/* ==========================================================================
   Player card
   ========================================================================== */
.kobra-player {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--kobra-line);
	border-radius: 4px;
	background-color: var(--kobra-navy);
	background-image: var(--kobra-ice-texture);
	background-repeat: repeat;
	text-decoration: none;
	transition: border-color .18s ease, transform .18s ease;
}
/* .hockey a paints every link black at (0,1,1); .kobra-roster .kobra-player
   is (0,2,0) and wins without !important. The same applies to the name and
   position below, which are spans inside that link. */
.kobra-roster .kobra-player,
.kobra-roster .kobra-player:focus {
	color: var(--kobra-ice);
}
.kobra-roster .kobra-player:hover {
	border-color: var(--kobra-sky);
	transform: translateY(-3px);
}
.kobra-roster .kobra-player:focus-visible {
	outline: 2px solid var(--kobra-sky);
	outline-offset: 2px;
}

.kobra-player-photo {
	position: relative;
	/* Square, so a portrait and a landscape headshot occupy the same box and
	   the grid rows stay even. */
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--kobra-navy-2);
}
.kobra-player-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* Faces sit in the upper half of a headshot; centring crops foreheads. */
	object-position: center 20%;
	display: block;
	transition: transform .3s ease;
}
.kobra-roster .kobra-player:hover .kobra-player-photo img {
	transform: scale(1.05);
}

/* ---------- Jersey number ----------
   Splash printed this in white with no backing, absolutely positioned across
   the bottom edge of the photo — so on a pale photo it simply disappeared,
   which is the "unreadable numbers" bug. A solid yellow chip with dark text
   is legible over any photograph, and sitting it in the corner keeps it clear
   of the face. Omitted entirely for the eleven players who have no number. */
.kobra-player-number {
	position: absolute;
	top: 0;
	left: 0;
	min-width: 38px;
	padding: 5px 10px;
	border-bottom-right-radius: 4px;
	background: var(--kobra-yellow);
	color: #101a08;
	font-family: 'Bricolage Grotesque', sans-serif;
	font-size: 16px;
	font-weight: 800;
	line-height: 1.2;
	text-align: center;
	letter-spacing: -0.01em;
}

.kobra-player-body {
	display: flex;
	flex-direction: column;
	gap: 3px;
	/* flex:1 so every card's body is the same height even when one name wraps
	   to two lines and its neighbour's doesn't. */
	flex: 1 1 auto;
	padding: 12px 14px 14px;
}
.kobra-player-name {
	font-family: 'Bricolage Grotesque', sans-serif;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
	color: var(--kobra-ice);
	text-wrap: pretty;
}
.kobra-player-position {
	font-family: 'Bricolage Grotesque', sans-serif;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--kobra-mist);
}
.kobra-roster .kobra-player:hover .kobra-player-name {
	color: var(--kobra-yellow);
}

/* ==========================================================================
   Narrow screens
   ========================================================================== */
@media (max-width: 600px) {
	.kobra-roster-grid {
		/* Two across rather than one — these cards are mostly photo, and a
		   single column would make each one enormous. */
		grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
		gap: 14px;
	}
	.kobra-roster-tabs {
		gap: 8px;
		margin-bottom: 20px;
	}
	.hockey #wrapper .kobra-roster-tab.kobra-btn {
		padding: 11px 16px;
		font-size: 12px;
	}
	.kobra-player-name {
		font-size: 14px;
	}
}
