/*
Theme Name: Anduro
Theme URI: https://andu.ro/
Author: andu.ro
Author URI: https://andu.ro/
Description: Minimal dark cyberpunk block theme for andu.ro. Terminal typography, neon accents pulled from the Anduro wave logo, a horizontal menu top and bottom, and a built-in live radio player. No build step, no jQuery, no external requests.
Requires at least: 6.7
Tested up to: 7.0
Requires PHP: 7.4
Version: 1.0.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: anduro
Tags: blog, one-column, full-site-editing, block-patterns, dark, custom-colors, custom-menu, editor-style, style-variations, accessibility-ready
*/

/*
 * Nearly all design tokens live in theme.json. This file only carries what
 * theme.json cannot express: the CRT overlay, motion, focus behaviour, the
 * sticky/fixed nav chrome, and the layout primitives used by the patterns.
 *
 * GLYPH CONSTRAINT: the bundled JetBrains Mono subsets cover latin +
 * latin-ext only. Box drawing (U+2500..), block elements (U+2588..),
 * dingbats and geometric shapes are NOT in the subset and would fall back to
 * a system font mid-line. Every rule, cursor, bullet and LIVE dot below is
 * therefore drawn with CSS, and prompts use plain ASCII '>' and '$'.
 */

/* ---------------------------------------------------------------- base --- */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scrollbar-color: var(--wp--preset--color--teal) var(--wp--preset--color--base);
}

body {
	/* Kill any chance of a sideways scrollbar on narrow screens. */
	overflow-x: hidden;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	font-variant-ligatures: none; /* JetBrains Mono ships code ligatures; prose reads better without */
}

::selection {
	background: var(--wp--preset--color--cyan);
	color: var(--wp--preset--color--base);
}

:focus-visible {
	outline: 2px solid var(--wp--preset--color--yellow);
	outline-offset: 3px;
	border-radius: 1px;
}

/* Do not paint a focus ring for pointer users on elements that ask for it. */
:focus:not(:focus-visible) {
	outline: none;
}

img,
picture,
svg,
video {
	max-width: 100%;
	height: auto;
}

/* ------------------------------------------------------- CRT scanlines --- */

/*
 * One fixed pseudo-element, one repeating gradient, no animation: this
 * composites on the GPU and never triggers layout or paint after first frame.
 */
body::after {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 9999;
	pointer-events: none;
	background-image: repeating-linear-gradient(
		to bottom,
		color-mix(
				in srgb,
				var(--wp--preset--color--cyan) var(--wp--custom--scanline-opacity),
				transparent
			)
			0 1px,
		transparent 1px 3px
	);
	/*
	 * No mix-blend-mode here on purpose. Blending a fixed, full-viewport layer
	 * forces the whole page into a composited group on every scroll; against a
	 * near-black background plain alpha compositing looks the same for free.
	 */
}

@media (prefers-reduced-motion: reduce) {
	body::after {
		display: none;
	}
}

/* Vignette so the neon reads brighter towards the centre. */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 9998;
	pointer-events: none;
	background: radial-gradient(
		120% 80% at 50% 0%,
		transparent 40%,
		rgba(0, 0, 0, 0.55) 100%
	);
}

/* ------------------------------------------------- visually hidden --- */

/*
 * Core defines .screen-reader-text in its block-library CSS, but only when
 * that bundle happens to be on the page. The radio player's button labels
 * depend on it, so the theme defines it itself and stays self-contained.
 */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip-path: inset(50%);
	word-wrap: normal !important;
}

/* ---------------------------------------------------------- skip link --- */

.skip-link {
	position: absolute;
	top: -100px;
	left: var(--wp--preset--spacing--20);
	z-index: 10000;
	padding: 0.75em 1.25em;
	background: var(--wp--preset--color--cyan);
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	text-decoration: none;
}

.skip-link:focus {
	top: var(--wp--preset--spacing--10);
}

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

.anduro-header {
	position: sticky;
	top: 0;
	z-index: 100;
	border-bottom: var(--wp--custom--rule);
	background: color-mix(in srgb, var(--wp--preset--color--base) 72%, transparent);
	-webkit-backdrop-filter: blur(10px) saturate(140%);
	backdrop-filter: blur(10px) saturate(140%);
}

/* Progressive enhancement: solid bar where backdrop-filter is unsupported. */
@supports not (backdrop-filter: blur(10px)) {
	.anduro-header {
		background: var(--wp--preset--color--base);
	}
}

/*
 * flex-shrink:0 is load-bearing, not defensive. The logo sits in a flex row
 * beside the nav; with only the height pinned, the default flex-shrink:1 let
 * the nav squeeze the width while the height held, so at 320px the wordmark
 * rendered 45.6px wide instead of 73.4px — visibly squashed.
 */
.anduro-header__logo {
	flex-shrink: 0;
}

/*
 * Height is derived, not eyeballed: the wordmark's x-height is 143/544 of the
 * image, and the nav sits at 0.8125rem uppercase JetBrains Mono, whose cap
 * height is 0.73em. 0.8125 * 0.73 / (143/544) = 2.25rem makes the letterforms
 * in the logo optically the same size as the menu links beside it.
 *
 * object-fit is the second belt: if anything ever does constrain the box,
 * letterbox rather than distort the artwork.
 */
.anduro-header__logo img {
	display: block;
	width: auto;
	height: 2.25rem;
	object-fit: contain;
}

/* -------------------------------------------------------- navigation --- */

.anduro-nav .wp-block-navigation__container {
	gap: clamp(0.9rem, 3vw, 2rem);
}

.anduro-nav .wp-block-navigation-item__content {
	position: relative;
	padding-block: 0.35em;
	color: var(--wp--preset--color--text-dim);
	text-decoration: none;
	transition: color var(--wp--custom--transition);
}

.anduro-nav .wp-block-navigation-item__content:hover,
.anduro-nav .wp-block-navigation-item__content:focus-visible {
	color: var(--wp--preset--color--cyan);
	text-decoration: none;
}

/* Underline sweeps in from the left. */
.anduro-nav .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 1px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform var(--wp--custom--transition);
}

.anduro-nav .wp-block-navigation-item__content:hover::after,
.anduro-nav .wp-block-navigation-item__content:focus-visible::after,
.anduro-nav .current-menu-item .wp-block-navigation-item__content::after {
	transform: scaleX(1);
}

/* Current page reads as an active terminal target. */
.anduro-nav .current-menu-item .wp-block-navigation-item__content {
	color: var(--wp--preset--color--yellow);
}

/* Chromatic-split glitch on hover (moderate: hover only, no idle animation). */
@media (prefers-reduced-motion: no-preference) and (hover: hover) {
	.anduro-nav .wp-block-navigation-item__content:hover {
		animation: anduro-glitch 220ms steps(2, end) 1;
	}

	@keyframes anduro-glitch {
		0% {
			text-shadow: none;
			transform: translateX(0);
		}
		33% {
			text-shadow: -1px 0 var(--wp--preset--color--magenta), 1px 0 var(--wp--preset--color--cyan);
			transform: translateX(-1px);
		}
		66% {
			text-shadow: 1px 0 var(--wp--preset--color--magenta), -1px 0 var(--wp--preset--color--cyan);
			transform: translateX(1px);
		}
		100% {
			text-shadow: none;
			transform: translateX(0);
		}
	}
}

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

.anduro-footer {
	border-top: var(--wp--custom--rule);
	background: var(--wp--preset--color--base);
}

.anduro-footer__mark img {
	display: block;
	width: auto;
	height: 1.4rem;
	opacity: 0.55;
	transition: opacity var(--wp--custom--transition);
}

.anduro-footer__mark:hover img {
	opacity: 1;
}

/*
 * Below 48rem the footer navigation detaches into a thumb-reachable fixed
 * bar. env(safe-area-inset-bottom) clears the iOS home indicator; the body
 * gets matching padding so the last block is never hidden behind it.
 */
@media (max-width: 47.999rem) {
	.anduro-footer__nav {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 100;
		padding-block: 0.6rem;
		padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
		border-top: var(--wp--custom--rule-strong);
		background: color-mix(in srgb, var(--wp--preset--color--base) 92%, transparent);
		-webkit-backdrop-filter: blur(10px) saturate(140%);
		backdrop-filter: blur(10px) saturate(140%);
	}

	body {
		padding-bottom: calc(3.25rem + env(safe-area-inset-bottom, 0px));
	}

	.anduro-footer__nav .wp-block-navigation__container {
		justify-content: space-around;
		gap: 0.5rem;
	}
}

/* ------------------------------------------------- terminal typography --- */

/* '>' prompt for section headings. ASCII only — see GLYPH CONSTRAINT above. */
.anduro-prompt::before {
	content: "> ";
	color: var(--wp--preset--color--teal);
	font-weight: 400;
}

/* '$' prompt for command-style lines. */
.anduro-cmd::before {
	content: "$ ";
	color: var(--wp--preset--color--green);
}

/* CSS-drawn block cursor (U+2588 is outside the font subset). */
.anduro-cursor::after {
	content: "";
	display: inline-block;
	width: 0.58em;
	height: 1.05em;
	margin-left: 0.12em;
	background: var(--wp--preset--color--cyan);
	vertical-align: text-bottom;
	animation: anduro-blink 1.1s steps(1) infinite;
}

@keyframes anduro-blink {
	0%,
	49% {
		opacity: 1;
	}
	50%,
	100% {
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.anduro-cursor::after {
		animation: none;
	}
}

/* Typewriter reveal. Width is set per-element from the string length so the
   steps() count and the ch width stay in sync. */
.anduro-type {
	display: inline-block;
	overflow: hidden;
	white-space: nowrap;
	vertical-align: bottom;
	max-width: 100%;
}

@media (prefers-reduced-motion: no-preference) {
	.anduro-type {
		width: 0;
		animation: anduro-typing 1.6s steps(var(--anduro-type-steps, 24), end) 200ms forwards;
	}

	@keyframes anduro-typing {
		to {
			width: var(--anduro-type-width, 24ch);
		}
	}
}

/* Neon text accent used sparingly on the hero. */
.anduro-glow {
	text-shadow: 0 0 18px color-mix(in srgb, var(--wp--preset--color--cyan) 45%, transparent);
}

/* ------------------------------------------------------------- panels --- */

/* Bordered terminal panel — CSS borders, not box-drawing characters. */
.anduro-panel {
	position: relative;
	border: var(--wp--custom--rule-strong);
	border-radius: 2px;
	background: var(--wp--preset--color--surface);
	padding: var(--wp--preset--spacing--30);
}

/* Corner ticks, drawn with borders on pseudo-elements. */
.anduro-panel::before,
.anduro-panel::after {
	content: "";
	position: absolute;
	width: 10px;
	height: 10px;
	border-color: var(--wp--preset--color--cyan);
	border-style: solid;
	pointer-events: none;
}

.anduro-panel::before {
	top: -1px;
	left: -1px;
	border-width: 2px 0 0 2px;
}

.anduro-panel::after {
	bottom: -1px;
	right: -1px;
	border-width: 0 2px 2px 0;
}

/* A label that sits on the panel's top border, like a fieldset legend. */
.anduro-panel__label {
	position: absolute;
	top: 0;
	left: var(--wp--preset--spacing--20);
	transform: translateY(-50%);
	padding-inline: 0.5em;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--text-dim);
	font-size: var(--wp--preset--font-size--xs);
	text-transform: uppercase;
	letter-spacing: 0.16em;
}

/* ------------------------------------------------------------ projects --- */

/*
 * Column layout for .anduro-projects comes from core's native grid layout
 * (layout.type = "grid", minimumColumnWidth) declared in the pattern. Doing it
 * here too would mean overriding core's generated rules; letting core own it
 * keeps the editor canvas and the front end identical.
 */

.anduro-card {
	container-type: inline-size;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--10);
	padding: var(--wp--preset--spacing--30);
	border: var(--wp--custom--rule);
	border-radius: 2px;
	background: var(--wp--preset--color--surface);
	transition: border-color var(--wp--custom--transition),
		transform var(--wp--custom--transition),
		box-shadow var(--wp--custom--transition);
}

.anduro-card:hover,
.anduro-card:focus-within {
	border-color: var(--wp--preset--color--cyan);
	box-shadow: var(--wp--preset--shadow--glow-cyan);
}

@media (prefers-reduced-motion: no-preference) {
	.anduro-card:hover,
	.anduro-card:focus-within {
		transform: translateY(-2px);
	}
}

.anduro-card__meta {
	color: var(--wp--preset--color--text-dim);
	font-size: var(--wp--preset--font-size--xs);
	text-transform: uppercase;
	letter-spacing: 0.14em;
}

/* Cards respond to their own width, so they behave in any column count. */
@container (min-width: 22rem) {
	.anduro-card {
		padding: var(--wp--preset--spacing--40);
	}
}

.anduro-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-top: auto;
	padding-top: var(--wp--preset--spacing--20);
	list-style: none;
	padding-inline-start: 0;
}

.anduro-tags li {
	padding: 0.15em 0.55em;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--teal) 50%, transparent);
	border-radius: 2px;
	color: var(--wp--preset--color--teal);
	font-size: var(--wp--preset--font-size--xs);
}

/* ---------------------------------------------------------------- hero --- */

.anduro-hero {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: min(78dvh, 44rem);
	padding-block: var(--wp--preset--spacing--60);
}

.anduro-hero__logo img {
	display: block;
	width: clamp(15rem, 58vw, 34rem);
	height: auto;
}

.anduro-hero__line {
	margin-block: var(--wp--preset--spacing--10) var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--lg);
	color: var(--wp--preset--color--text);
}

.anduro-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
}

/*
 * The case that normally breaks: a phone rotated to landscape. Viewport is
 * wide but only ~390px tall, so a vh-based hero would push everything off
 * screen. Collapse it and shrink the logo.
 */
@media (orientation: landscape) and (max-height: 32rem) {
	.anduro-hero {
		min-height: 0;
		padding-block: var(--wp--preset--spacing--30);
	}

	.anduro-hero__logo img {
		width: clamp(11rem, 34vw, 20rem);
	}

	.anduro-header {
		position: static;
	}
}

/* ------------------------------------------------------------ content --- */

.anduro-meta {
	color: var(--wp--preset--color--text-dim);
	font-size: var(--wp--preset--font-size--xs);
	text-transform: uppercase;
	letter-spacing: 0.14em;
}

/* Horizontal rule as a scan line rather than a solid bar. */
.wp-block-separator {
	border: none;
	height: 1px;
	background: linear-gradient(
		90deg,
		transparent,
		var(--wp--preset--color--teal) 20%,
		var(--wp--preset--color--teal) 80%,
		transparent
	);
	opacity: 1;
}

/* Lists get a CSS-drawn marker instead of a unicode bullet. */
.anduro-list {
	list-style: none;
	padding-inline-start: 0;
}

.anduro-list li {
	position: relative;
	padding-inline-start: 1.4em;
}

.anduro-list li::before {
	content: "";
	position: absolute;
	left: 0.15em;
	top: 0.62em;
	width: 0.45em;
	height: 0.45em;
	background: var(--wp--preset--color--yellow);
	transform: rotate(45deg);
}

/* --------------------------------------------------------- pagination --- */

.wp-block-query-pagination .wp-block-query-pagination-numbers .page-numbers,
.wp-block-query-pagination-next,
.wp-block-query-pagination-previous {
	padding: 0.35em 0.7em;
	border: var(--wp--custom--rule);
	border-radius: 2px;
	text-decoration: none;
}

.wp-block-query-pagination .page-numbers.current {
	border-color: var(--wp--preset--color--cyan);
	color: var(--wp--preset--color--yellow);
}

/* ------------------------------------------------------------- print --- */

@media print {
	.anduro-header,
	.anduro-footer__nav,
	body::before,
	body::after {
		display: none !important;
	}

	body {
		padding-bottom: 0;
		background: #fff;
		color: #000;
	}
}
