/* ==========================================================================
   MNR — Music Nerd Radio
   1. Fonts   2. Tokens   3. Base   4. TV shell   5. Menu
   6. Channel change   7. Homepage   8. Inner pages   9. Motion preferences
   ========================================================================== */

/* 1. Fonts ---------------------------------------------------------------- */
@font-face {
	font-family: "VCR OSD Mono";
	src: url("../fonts/vcr-osd-mono.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: block;
}
@font-face {
	font-family: "Archivo Black";
	src: url("../fonts/archivo-black-latin-400-normal.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Archivo Black";
	src: url("../fonts/archivo-black-latin-ext-400-normal.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Archivo";
	src: url("../fonts/archivo-latin-wght-normal.woff2") format("woff2-variations");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Archivo";
	src: url("../fonts/archivo-latin-ext-wght-normal.woff2") format("woff2-variations");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Archivo";
	src: url("../fonts/archivo-latin-wght-italic.woff2") format("woff2-variations");
	font-weight: 100 900;
	font-style: italic;
	font-display: swap;
}

/* 2. Tokens --------------------------------------------------------------- */
:root {
	/* Colour — one signal colour, everything else is the dark of the tube. */
	--mnr-blue: #002cfe;        /* signal blue: the no-input screen (Figma) */
	--mnr-black: #04050c;       /* screen black: inner pages */
	--mnr-navy: #0a0f3d;        /* tube navy: panels, image placeholders */
	--mnr-white: #ffffff;       /* phosphor white */
	--mnr-grey: #9aa3c7;        /* tape grey: secondary text on black */
	--mnr-rule: rgba(255, 255, 255, 0.22);

	/* Type — OSD for interface, Archivo Black for titles, Archivo for reading. */
	--font-osd: "VCR OSD Mono", "Courier New", monospace;
	--font-display: "Archivo Black", "Archivo", "Arial Black", sans-serif;
	--font-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;

	/* Layout */
	--edge: 26px;               /* distance of the menu icon from the screen corner (Figma) */
	--icon: 36px;               /* menu / close icon box (Figma draws 53px; reduced on request) */
	--bar: var(--wp-admin--admin-bar--height, 0px);
	--measure: 44rem;
	--gutter: clamp(1.25rem, 5vw, 4rem);

	/* The video is 16:9 and always covers the screen, so its real height is
	   whichever is larger. Hero text is sized from it to stay locked to the logo. */
	--screen-h: max(100vh, 56.25vw);
}
@supports (height: 100svh) {
	:root { --screen-h: max(100svh, 56.25vw); }
}

/* 3. Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
	background: var(--mnr-black);
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}
body {
	margin: 0;
	min-height: 100vh;
	background: var(--mnr-black);
	color: var(--mnr-white);
	font-family: var(--font-body);
	font-size: 1.125rem;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}
body.home { background: var(--mnr-blue); }
body.menu-open { overflow: hidden; }

img, video, iframe { max-width: 100%; }
img, video { height: auto; display: block; }

a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { text-decoration-style: dotted; }

:focus-visible { outline: 2px solid var(--mnr-white); outline-offset: 4px; }

::selection { background: var(--mnr-white); color: var(--mnr-blue); }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
.skip-link {
	position: fixed;
	left: 50%; top: calc(var(--bar) + 8px);
	transform: translate(-50%, -300%);
	z-index: 100;
	padding: 0.5rem 1rem;
	background: var(--mnr-white);
	color: var(--mnr-blue);
	font-family: var(--font-osd);
	text-transform: uppercase;
	text-decoration: none;
}
.skip-link:focus { transform: translate(-50%, 0); }

/* 4. TV shell (never reloads) --------------------------------------------- */
.tv-toggle,
.tv-menu__close {
	display: grid;
	place-items: center;
	width: var(--icon);
	height: var(--icon);
	padding: 0;
	border: 0;
	background: none;
	color: var(--mnr-white);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.tv-toggle svg,
.tv-menu__close svg { display: block; width: 100%; height: 100%; }

.tv-toggle {
	position: fixed;
	top: calc(var(--edge) + var(--bar));
	left: var(--edge);
	z-index: 50;
}
.tv-toggle:hover svg,
.tv-menu__close:hover svg { filter: drop-shadow(3px 0 0 rgba(255, 255, 255, 0.35)); }

.home-link {
	position: fixed;
	/* The logo file has empty space around the letters; these offsets line the letters up with the menu icon. */
	top: calc(var(--edge) + var(--bar) - 5px);
	right: calc(var(--edge) - 2px);
	z-index: 50;
	display: block;
	line-height: 0;
}
.home-link img { display: block; height: 46px; width: auto; }
body.home .home-link { display: none; }
html.osd-on .home-link { visibility: hidden; }


/* 5. Menu ------------------------------------------------------------------ */
.tv-menu {
	position: fixed;
	inset: 0;
	z-index: 60;
	display: grid;
	place-items: center;
	padding: calc(var(--edge) + var(--icon) + var(--bar)) 0 calc(var(--edge) + var(--icon));
	background: var(--mnr-blue);
	overflow-y: auto;
	visibility: hidden;
}
.tv-menu.is-open { visibility: visible; }

.tv-menu__close {
	position: absolute;
	top: calc(var(--edge) + var(--bar));
	right: var(--edge);
}

/* Sizes are in em so the whole list scales as one object: 45px type, 425px column (Figma). */
.tv-menu__list {
	list-style: none;
	margin: 0;
	padding: 0;
	width: min(100%, 9.45em);
	display: flex;
	flex-direction: column;
	gap: 0.245em;
	font-family: var(--font-osd);
	font-size: clamp(1.75rem, 10.45vw, 2.8125rem);
	line-height: 1;
	text-transform: uppercase;
	text-align: center;
}
.tv-menu__list li {
	margin: 0;
	padding: 0.222em 0.51em;
}
.tv-menu__list a {
	display: block;
	color: var(--mnr-white);
	text-decoration: none;
	overflow-wrap: anywhere;
}
.tv-menu__list a:focus-visible { outline: none; }

/* The OSD cursor: one ▸ that glides from line to line (moved by main.js). No blinking. */
.tv-menu__list { position: relative; }
.tv-menu__list li.tv-menu__cursor {
	position: absolute;
	left: 0.36em;
	top: 0;
	width: 0.62em;
	height: 0.6em;
	margin-top: -0.3em;
	padding: 0;
	background: var(--mnr-white);
	clip-path: polygon(0 0, 100% 50%, 0 100%);
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
}
@keyframes osd-cursor-on {
	0%   { opacity: 0; }
	100% { opacity: 1; }
}

/* Without JavaScript the menu is simply always on the page, below the content. */
.no-js .tv-toggle, .no-js .tv-menu__close { display: none; }
.no-js .tv-menu { position: static; visibility: visible; }

/* 6. Channel change ---------------------------------------------------------- */
.channel {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	transform-origin: 50% 50vh;
}
html.is-changing .channel { will-change: transform, filter; }
html.is-changing { cursor: progress; }

.tv-static {
	position: fixed;
	inset: 0;
	z-index: 80;
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	background: #111;
}
.tv-static canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	image-rendering: pixelated;
}

.tv-osd {
	position: fixed;
	top: calc(var(--edge) + var(--bar) + 8px);
	right: calc(var(--edge) + 6px);
	z-index: 85;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.15em;
	max-width: 70vw;
	font-family: var(--font-osd);
	font-size: clamp(1.25rem, 4.5vw, 2.25rem);
	line-height: 1;
	text-transform: uppercase;
	text-align: right;
	color: #3dff5f;
	text-shadow: 0.06em 0.06em 0 rgba(0, 0, 0, 0.75);
	visibility: hidden;
	pointer-events: none;
}
.tv-osd__name {
	font-size: 0.6em;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* 7. Homepage -------------------------------------------------------------- */
.hero {
	position: relative;
	flex: none;
	overflow: hidden;
	background: var(--mnr-blue);
	--hero-h: 100vh;
	--screen-h: max(var(--hero-h), 56.25vw);
	height: var(--hero-h);
	min-height: 380px;
}
.hero--short { --hero-h: 72vh; }
@supports (height: 100svh) {
	.hero { --hero-h: 100svh; }
	.hero--short { --hero-h: 72svh; }
}
.hero__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 50%;
}
/* Numbers come from the Figma frames: text starts 8.3% of the picture height
   below centre, is 3.9% of it tall and wraps at 42% of it wide. */
.hero__text {
	position: absolute;
	left: 50%;
	top: calc(50% + var(--screen-h) * 0.083);
	width: min(calc(var(--screen-h) * 0.422), calc(100vw - 2rem));
	margin: 0;
	transform: translateX(-50%);
	font-family: var(--font-osd);
	font-weight: 400;
	font-size: min(calc(var(--screen-h) * 0.039), 9.2vw);
	line-height: 1;
	text-align: center;
	text-transform: uppercase;
	text-wrap: balance;
	overflow-wrap: anywhere;
	color: var(--mnr-white);
	text-shadow: 0 0 0.35em rgba(255, 255, 255, 0.28);
}
.hero--short .hero__text { width: min(calc(var(--screen-h) * 0.62), calc(100vw - 2rem)); }
.hero__sub { display: block; margin-top: 0.7em; font-size: 0.5em; }

/* A page with its own video or image: no MNR logo to sit under, so the text is centred. */
.hero--own { background: var(--mnr-black); }
.hero--own::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(4, 5, 12, 0.38);
}
.hero--own .hero__text {
	z-index: 1;
	top: 50%;
	transform: translate(-50%, -50%);
	font-size: min(calc(var(--screen-h) * 0.06), 10vw);
}

.home-blocks {
	background: var(--mnr-black);
	padding: clamp(3rem, 8vw, 6rem) var(--gutter);
}
.home-blocks > * { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.home-blocks > .alignwide { max-width: 75rem; }
.home-blocks > .alignfull { max-width: none; margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1); }

/* 8. Inner pages (provisional until designed) ------------------------------- */
.page-wrap {
	max-width: calc(var(--measure) + var(--gutter) * 2);
	margin: 0 auto;
	padding: clamp(2.5rem, 7vw, 5rem) var(--gutter) clamp(3rem, 8vw, 6rem);
	width: 100%;
}
.page-wrap--wide { max-width: 80rem; }
.page-wrap--center {
	min-height: 100vh;
	display: grid;
	align-content: center;
	justify-items: center;
	gap: 2rem;
	text-align: center;
}

.page-head { margin-bottom: clamp(2rem, 6vw, 4rem); }

.kicker {
	margin: 0 0 2rem;
	font-family: var(--font-osd);
	font-size: 1.125rem;
	line-height: 1;
	text-transform: uppercase;
	color: var(--mnr-grey);
}
.kicker a { color: inherit; text-decoration: none; }
.kicker a:hover { color: var(--mnr-white); }

.page-title {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 400;
	font-size: clamp(2.5rem, 9vw, 6rem);
	line-height: 0.92;
	letter-spacing: -0.035em;
	text-transform: uppercase;
	text-wrap: balance;
	overflow-wrap: anywhere;
}

.page-cover { margin: 0 0 clamp(2rem, 6vw, 4rem); }
.page-cover img { width: 100%; }

/* Reading text and editor blocks */
.prose > * { margin-top: 0; margin-bottom: 1.4em; }
.prose > *:last-child { margin-bottom: 0; }
.prose h2, .prose h3, .prose h4 {
	font-family: var(--font-display);
	font-weight: 400;
	line-height: 1;
	letter-spacing: -0.025em;
	text-transform: uppercase;
	margin-top: 2em;
	margin-bottom: 0.6em;
	text-wrap: balance;
}
.prose h2 { font-size: clamp(1.75rem, 5vw, 2.75rem); }
.prose h3 { font-size: clamp(1.375rem, 3.5vw, 1.875rem); }
.prose h4 { font-size: 1.25rem; }
.prose a { color: var(--mnr-white); }
.prose blockquote {
	margin-left: 0;
	margin-right: 0;
	padding-left: 1.25rem;
	border-left: 4px solid var(--mnr-blue);
	font-size: 1.375rem;
	line-height: 1.35;
}
.prose figure { margin-left: 0; margin-right: 0; }
.prose figcaption,
.prose .wp-element-caption {
	margin-top: 0.6rem;
	font-family: var(--font-osd);
	font-size: 0.875rem;
	text-transform: uppercase;
	color: var(--mnr-grey);
	text-align: left;
}
.prose hr { border: 0; border-top: 1px solid var(--mnr-rule); margin: 3em 0; }
.prose code, .prose pre { font-family: var(--font-osd); }
.prose pre { padding: 1rem; background: var(--mnr-navy); overflow-x: auto; }
.prose .wp-block-button__link {
	border-radius: 0;
	background: var(--mnr-blue);
	color: var(--mnr-white);
	font-family: var(--font-osd);
	text-transform: uppercase;
	text-decoration: none;
	padding: 0.7em 1.2em;
}
.prose .wp-block-button__link:hover { background: var(--mnr-white); color: var(--mnr-blue); }
.prose .wp-block-embed iframe, .prose .wp-block-video video { width: 100%; }
.prose input[type="text"], .prose input[type="email"], .prose textarea {
	width: 100%;
	padding: 0.75rem;
	border: 1px solid var(--mnr-rule);
	border-radius: 0;
	background: transparent;
	color: var(--mnr-white);
	font: inherit;
}

/* Articles list */
.listing { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--mnr-rule); }
.listing__item { border-bottom: 1px solid var(--mnr-rule); }
.listing__link {
	display: grid;
	grid-template-columns: 6.5rem 1fr;
	gap: 1rem;
	align-items: baseline;
	padding: 1.25rem 0;
	text-decoration: none;
}
.listing__meta { font-family: var(--font-osd); font-size: 1rem; color: var(--mnr-grey); }
.listing__title {
	font-family: var(--font-display);
	font-size: clamp(1.375rem, 4vw, 2.25rem);
	line-height: 1;
	letter-spacing: -0.03em;
	text-transform: uppercase;
	text-wrap: balance;
}
.listing__link { position: relative; }
.listing__link::before {
	content: "";
	position: absolute;
	left: -1.15rem;
	top: 1.3rem;
	width: 0.7rem;
	height: 0.7rem;
	background: var(--mnr-white);
	clip-path: polygon(0 0, 100% 50%, 0 100%);
	opacity: 0;
}
.listing__link:hover::before,
.listing__link:focus-visible::before { opacity: 1; animation: osd-cursor-on 0.35s ease-out both; }
.listing__link:hover .listing__meta,
.listing__link:focus-visible .listing__meta { color: var(--mnr-white); }
@media (max-width: 480px) {
	.listing__link { grid-template-columns: 1fr; gap: 0.4rem; }
}

/* Archive grid */
.tapes {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
	gap: clamp(1rem, 3vw, 2rem);
}
.tape__link { display: block; text-decoration: none; }
.tape__image {
	display: block;
	aspect-ratio: 4 / 5;
	background: var(--mnr-navy);
	overflow: hidden;
}
.tape__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: grayscale(1) contrast(1.1);
	transition: filter 0.5s ease;
}
.tape__link:hover .tape__image img,
.tape__link:focus-visible .tape__image img { filter: none; }
.tape__name {
	display: block;
	margin-top: 0.75rem;
	font-family: var(--font-display);
	font-size: 1.5rem;
	line-height: 1;
	letter-spacing: -0.03em;
	text-transform: uppercase;
}


/* Empty states */
.no-signal {
	padding: clamp(3rem, 10vw, 6rem) 1rem;
	background: var(--mnr-blue);
	text-align: center;
	font-family: var(--font-osd);
	text-transform: uppercase;
	line-height: 1;
}
.page-wrap--center .no-signal { background: none; padding: 0; }
.no-signal__title { margin: 0 0 0.5em; font-size: clamp(2rem, 8vw, 3.5rem); }
.no-signal__line { margin: 0; font-size: clamp(1rem, 3.6vw, 1.375rem); }

/* Pagination + footer */
.pagination { margin-top: 3rem; font-family: var(--font-osd); text-transform: uppercase; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.pagination a { text-decoration: none; }
.pagination .current { color: var(--mnr-grey); }

.site-footer {
	margin-top: auto;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.5rem 2rem;
	padding: 1.5rem var(--gutter) 2rem;
	border-top: 1px solid var(--mnr-rule);
	font-family: var(--font-osd);
	font-size: 0.875rem;
	text-transform: uppercase;
	color: var(--mnr-grey);
}

/* 9. Motion preferences ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
	.tape__image img { transition: none; }
}

.channel:focus { outline: none; }
