/*
 * Anarchapulco TV site chrome: sticky header + footer.
 * Palette deliberately matches the streaming library so the two read as one product.
 */

:root {
	--tv-bg:      #0b0d10;
	--tv-panel:   #16191f;
	--tv-ink:     #f2f4f7;
	--tv-muted:   #98a2b0;
	--tv-accent:  #ffd400;
	--tv-hair:    rgba(255, 255, 255, .10);
	--tv-bar-h:   68px;
}

/* The theme's header is gone, so the page itself supplies the dark ground. */
body.has-avms-chrome {
	background: var(--tv-bg);
	color: var(--tv-ink);
}
body.has-avms-chrome .wp-site-blocks { padding-top: 0; }

/* ----------------------------------------------------------------- header */

.avms-chrome {
	position: sticky;
	top: 0;
	z-index: 1000;
	height: var(--tv-bar-h);
	display: flex;
	align-items: center;
	background: linear-gradient(to bottom, rgba(11, 13, 16, .92), rgba(11, 13, 16, .55));
	transition: background .22s ease, border-color .22s ease, backdrop-filter .22s ease;
	border-bottom: 1px solid transparent;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* Once the page moves, commit to a solid bar so posters can't muddy the links. */
.avms-chrome.is-scrolled {
	background: rgba(11, 13, 16, .94);
	border-bottom-color: var(--tv-hair);
	-webkit-backdrop-filter: saturate(140%) blur(12px);
	backdrop-filter: saturate(140%) blur(12px);
}

.avms-chrome *,
.avms-chrome *::before,
.avms-chrome *::after { box-sizing: border-box; }

.avms-chrome__inner {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 26px;
	padding: 0 4vw;
}

.avms-chrome__logo { display: flex; align-items: center; flex: 0 0 auto; text-decoration: none; }
/* The supplied logo is artwork for a LIGHT header (avg luminance 72, mostly dark
   pixels on transparency), so on this dark bar it has to be knocked out to white.
   A proper light-variant asset would restore the multicolour starburst. */
.avms-chrome__logo img {
	height: 38px; width: auto; display: block;
	filter: brightness(0) invert(1);
}
.avms-chrome__wordmark {
	color: var(--tv-ink); font-weight: 800; font-size: 1.05rem;
	letter-spacing: .02em; text-transform: uppercase;
}

.avms-chrome__nav { flex: 1 1 auto; min-width: 0; }
.avms-chrome__nav ul {
	list-style: none; margin: 0; padding: 0;
	display: flex; align-items: center; gap: 4px; flex-wrap: nowrap;
}
.avms-chrome__nav a {
	display: block; padding: 8px 12px; border-radius: 4px;
	color: var(--tv-muted); font-size: .9rem; font-weight: 500;
	text-decoration: none; white-space: nowrap;
	transition: color .15s ease, background .15s ease;
}
.avms-chrome__nav a:hover { color: var(--tv-ink); background: rgba(255, 255, 255, .07); }
.avms-chrome__nav .is-current a { color: var(--tv-ink); font-weight: 700; }
.avms-chrome__nav .is-current a::after {
	content: ""; display: block; height: 2px; margin-top: 5px;
	background: var(--tv-accent); border-radius: 2px;
}

.avms-chrome__actions { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; }
.avms-chrome__who { color: var(--tv-muted); font-size: .84rem; }
.avms-chrome__btn {
	display: inline-block; padding: 8px 16px; border-radius: 4px;
	font-size: .86rem; font-weight: 700; text-decoration: none;
	color: var(--tv-ink); background: rgba(255, 255, 255, .11);
	transition: background .15s ease;
	white-space: nowrap;
}
.avms-chrome__btn:hover { background: rgba(255, 255, 255, .2); }
.avms-chrome__btn--primary { background: var(--tv-ink); color: #0b0d10; }
.avms-chrome__btn--primary:hover { background: #fff; }

.avms-chrome__burger {
	display: none; flex: 0 0 auto;
	width: 38px; height: 34px; padding: 7px 6px;
	background: none; border: 0; cursor: pointer;
	flex-direction: column; justify-content: space-between;
}
.avms-chrome__burger span {
	display: block; height: 2px; width: 100%; border-radius: 2px;
	background: var(--tv-ink); transition: transform .2s ease, opacity .2s ease;
}
.avms-chrome.is-open .avms-chrome__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.avms-chrome.is-open .avms-chrome__burger span:nth-child(2) { opacity: 0; }
.avms-chrome.is-open .avms-chrome__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ----------------------------------------------------------------- footer */

.avms-foot {
	background: #08090b;
	border-top: 1px solid var(--tv-hair);
	color: var(--tv-muted);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	margin-top: 0;
}
.avms-foot *, .avms-foot *::before, .avms-foot *::after { box-sizing: border-box; }

.avms-foot__inner {
	max-width: 1280px; margin: 0 auto;
	padding: 52px 4vw 34px;
	display: grid; gap: 34px;
	grid-template-columns: 1.4fr 1fr 1fr;
}
.avms-foot__brand img { height: 44px; width: auto; margin-bottom: 14px; filter: brightness(0) invert(1); opacity: .9; }
.avms-foot__brand p { margin: 0; font-size: .9rem; line-height: 1.6; max-width: 34ch; }

.avms-foot h3 {
	color: var(--tv-ink); font-size: .78rem; font-weight: 700;
	letter-spacing: .14em; text-transform: uppercase;
	margin: 0 0 14px;
}
.avms-foot ul { list-style: none; margin: 0; padding: 0; }
.avms-foot li { margin: 0 0 9px; }
.avms-foot a { color: var(--tv-muted); font-size: .9rem; text-decoration: none; transition: color .15s ease; }
.avms-foot a:hover { color: var(--tv-ink); }

.avms-foot__base {
	border-top: 1px solid var(--tv-hair);
	padding: 18px 4vw;
	font-size: .82rem;
	text-align: center;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
	.avms-chrome__nav a { padding: 8px 9px; font-size: .86rem; }
	.avms-chrome__inner { gap: 16px; }
}

@media (max-width: 860px) {
	.avms-chrome__burger { display: flex; order: 3; margin-left: auto; }
	.avms-chrome__actions { order: 2; margin-left: auto; }
	.avms-chrome__nav {
		order: 4;
		position: absolute; left: 0; right: 0; top: var(--tv-bar-h);
		background: rgba(11, 13, 16, .98);
		border-bottom: 1px solid var(--tv-hair);
		max-height: 0; overflow: hidden;
		transition: max-height .25s ease;
		-webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
	}
	.avms-chrome.is-open .avms-chrome__nav { max-height: 70vh; }
	.avms-chrome__nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: 8px 4vw 16px; }
	.avms-chrome__nav a { padding: 13px 4px; font-size: 1rem; border-radius: 0; }
	.avms-chrome__nav .is-current a::after { display: none; }
	.avms-chrome__nav .is-current a { color: var(--tv-accent); }
	.avms-foot__inner { grid-template-columns: 1fr; gap: 28px; }
}

@media (prefers-reduced-motion: reduce) {
	.avms-chrome, .avms-chrome *, .avms-foot * { transition: none !important; }
}

/* ------------------------------------------------- Subscribe call to action */

.avms-chrome__nav .is-cta { margin-left: 6px; }
.avms-chrome__nav .is-cta a {
	background: var(--tv-accent);
	color: #0b0d10;
	font-weight: 700;
	padding: 8px 18px;
	border-radius: 999px;
}
.avms-chrome__nav .is-cta a:hover { background: #ffe14d; color: #0b0d10; }
/* It's already a button; the current-page underline would just muddy it. */
.avms-chrome__nav .is-cta.is-current a::after { display: none; }

/* -------------------------------------------------------------- account menu */

.avms-acct { position: relative; flex: 0 0 auto; }

.avms-acct__btn {
	display: block; padding: 0; border: 0; background: none; cursor: pointer;
	border-radius: 50%; line-height: 0;
	box-shadow: 0 0 0 2px transparent;
	transition: box-shadow .15s ease;
}
.avms-acct__btn:hover,
.avms-acct.is-open .avms-acct__btn { box-shadow: 0 0 0 2px var(--tv-accent); }

.avms-acct__pic {
	display: block; width: 36px; height: 36px;
	border-radius: 50%; object-fit: cover;
	background: #2a3039;
}
.avms-acct__pic--initial {
	display: flex; align-items: center; justify-content: center;
	color: var(--tv-ink); font-weight: 700; font-size: 1rem; line-height: 1;
}

.avms-acct__menu {
	position: absolute; right: 0; top: calc(100% + 12px);
	min-width: 236px;
	background: #14171d;
	border: 1px solid var(--tv-hair);
	border-radius: 8px;
	box-shadow: 0 18px 44px rgba(0, 0, 0, .6);
	padding: 6px;
	z-index: 1200;
}
.avms-acct__menu[hidden] { display: none; }

.avms-acct__head {
	display: flex; align-items: center; gap: 10px;
	padding: 10px 10px 12px;
	border-bottom: 1px solid var(--tv-hair);
	margin-bottom: 6px;
}
.avms-acct__head .avms-acct__pic { width: 40px; height: 40px; }
.avms-acct__name { display: block; color: var(--tv-ink); font-weight: 700; font-size: .9rem; }
.avms-acct__mail {
	display: block; color: var(--tv-muted); font-size: .76rem;
	max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.avms-acct__menu a {
	display: block; padding: 10px 10px; border-radius: 5px;
	color: var(--tv-muted); font-size: .88rem; text-decoration: none;
	transition: background .14s ease, color .14s ease;
}
.avms-acct__menu a:hover { background: rgba(255, 255, 255, .07); color: var(--tv-ink); }
.avms-acct__out {
	border-top: 1px solid var(--tv-hair);
	margin-top: 6px; padding-top: 12px !important;
}

@media (max-width: 860px) {
	/* In the collapsed nav the CTA should read as a button, not a full-width bar. */
	.avms-chrome__nav .is-cta { margin: 10px 0 0; }
	.avms-chrome__nav .is-cta a { display: inline-block; }
	.avms-acct__menu { right: -4px; min-width: 210px; }
}

/* ----------------------------------------------------------------- search */

.avms-search {
	flex: 0 1 300px;
	position: relative;
	display: flex;
	align-items: center;
	margin-left: auto;
}
.avms-search__icon {
	position: absolute; left: 11px;
	width: 17px; height: 17px;
	fill: var(--tv-muted);
	pointer-events: none;
}
.avms-search input[type="search"] {
	width: 100%;
	padding: 9px 12px 9px 34px;
	border-radius: 999px;
	border: 1px solid var(--tv-hair);
	background: rgba(255, 255, 255, .06);
	color: var(--tv-ink);
	font-size: .86rem;
	font-family: inherit;
	outline: none;
	transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
	-webkit-appearance: none; appearance: none;
}
.avms-search input[type="search"]::placeholder { color: var(--tv-muted); }
.avms-search input[type="search"]:focus {
	background: rgba(255, 255, 255, .12);
	border-color: rgba(255, 255, 255, .28);
	box-shadow: 0 0 0 3px rgba(255, 212, 0, .16);
}
.avms-search input[type="search"]::-webkit-search-cancel-button { filter: invert(1); opacity: .6; }

/* WordPress ships this class; the theme may not when its header is gone. */
.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px;
	padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 1240px) { .avms-search { flex-basis: 220px; } }
@media (max-width: 860px) {
	.avms-search { order: 5; flex: 1 1 100%; margin: 0 0 12px; }
	.avms-chrome { height: auto; padding: 10px 0; }
	.avms-chrome__inner { flex-wrap: wrap; row-gap: 10px; }
	.avms-chrome__nav { top: 100%; }
}

/* --------------------------------------------- flush billboard under header */

/* The block theme puts 70px of margin on <main> and another 70px of padding on
   its first group. Under a full-bleed billboard that reads as a dead band, so
   close it - but only on library pages, which is what .has-avms-flush marks. */
/* These two values arrive as INLINE style attributes from the block template
   (`margin-top:var(--wp--preset--spacing--60)` on <main>, `padding-top` on its
   first group), and an inline style outranks any selector. !important is the
   only way short of filtering the block output, and it is scoped to library
   pages so nothing else is affected. */
body.has-avms-flush .wp-site-blocks > main {
	margin-block-start: 0 !important;
	margin-top: 0 !important;
}
body.has-avms-flush .wp-site-blocks > main > .wp-block-group:first-child {
	padding-top: 0 !important;
}

/* ------------------------------------------------- full-height page shell */

/* Short pages (an empty cart, checkout, Live) left the footer floating mid-screen
   with a large void beneath it. Make the body a flex column so the content area
   grows to fill the viewport and the footer is pushed to the bottom.
   `min-height: 100dvh` handles mobile browser chrome; the vh line is the fallback. */
html { background: var(--tv-bg); }

body.has-avms-chrome {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
}
/* The content area takes the slack. `flex: 1 0 auto` (not `1 1 auto`) so long
   pages are never squashed below their natural height. */
body.has-avms-chrome .wp-site-blocks { flex: 1 0 auto; }
body.has-avms-chrome .avms-foot { flex: 0 0 auto; margin-top: auto; }

/* The sticky header is a flex item now; without this it can be stretched by
   `align-items: stretch` and lose its fixed bar height. */
body.has-avms-chrome .avms-chrome { flex: 0 0 auto; }
