/*
Theme Name: Blue Distortion
Theme URI: https://bluedistortion.com
Author: Blue Distortion
Author URI: https://bluedistortion.com
Description: Dark electric theme for an experimental music archive. Album-art card grid, scanline texture, chromatic glitch accents, night-first with a day flip.
Version: 1.22.3
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bluedistortion
Tags: blog, dark, two-columns, custom-menu, featured-images, translation-ready
*/

/* ============================================
   BLUE DISTORTION
   ============================================ */

:root {
    /* Night (default). --bg matches the bottom pixel of the background
       image so the page blends seamlessly where the image ends. */
    --bg: #1f1f1f;
    --bg-image: url('assets/images/slanted-gradient-6.png');
    --bg-panel: #151e33;
    --border: #1b2440;
    --border-strong: #2b3a63;
    --text: #d5dbe8;
    --text-strong: #eef2fa;
    --text-dim: #7d8cb0;
    --accent: #4cc2ff;
    --glitch-cyan: rgba(34, 211, 238, 0.75);
    --glitch-magenta: rgba(244, 114, 182, 0.65);
    --glow: rgba(76, 194, 255, 0.14);

    /* Zen Maru Gothic everywhere (rounded, thick at 900); Plex Mono for
       code. Variable names kept from v1 to avoid touching every rule. */
    --font-display: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
    --font-sans: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
    --font-mono: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
    --font-code: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;
    --menu-overlay-bg: linear-gradient(160deg, rgba(8, 11, 22, 0.97) 0%, rgba(23, 17, 45, 0.95) 100%);

    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2rem;
    --space-5: 3rem;

    --content-width: 72rem;
    --prose-width: 42rem;
    --radius: 10px;

    --t-fast: 150ms ease;
    --t-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    color-scheme: dark;
}

/* --- Day version --- */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #c5c5c5;
        --bg-image: url('assets/images/slanted-gradient-6-light.png');
        --bg-panel: #ffffff;
        --border: #d9e0ef;
        --border-strong: #b9c6e2;
        --text: #232b3d;
        --text-strong: #0d1322;
        --text-dim: #3f4a66;
        --accent: #2563eb;
        --glitch-cyan: rgba(8, 145, 178, 0.5);
        --glitch-magenta: rgba(219, 39, 119, 0.4);
        --glow: rgba(37, 99, 235, 0.1);
        --menu-overlay-bg: linear-gradient(160deg, rgba(242, 245, 251, 0.97) 0%, rgba(216, 222, 240, 0.95) 100%);

        color-scheme: light;
    }
}

:root[data-theme="light"] {
    --bg: #c5c5c5;
    --bg-image: url('assets/images/slanted-gradient-6-light.png');
    --bg-panel: #ffffff;
    --border: #d9e0ef;
    --border-strong: #b9c6e2;
    --text: #232b3d;
    --text-strong: #0d1322;
    --text-dim: #3f4a66;
    --accent: #2563eb;
    --glitch-cyan: rgba(8, 145, 178, 0.5);
    --glitch-magenta: rgba(219, 39, 119, 0.4);
    --glow: rgba(37, 99, 235, 0.1);
    --menu-overlay-bg: linear-gradient(160deg, rgba(242, 245, 251, 0.97) 0%, rgba(216, 222, 240, 0.95) 100%);

    color-scheme: light;
}

/* --- Reset & base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    /* Keep focused / anchored targets clear of the sticky header (WCAG 2.4.11) */
    scroll-padding-top: 6rem;
}

body {
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--text);
    background-color: var(--bg);
    background-image: var(--bg-image);
    background-position: top left;
    background-size: 100% auto;
    background-repeat: no-repeat;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Slow color drift over the whole background (both modes). A fixed
   gradient layer whose hue rotates over a minute; sits above the body
   background image, below all content. */
@keyframes bd-drift {
    from { filter: hue-rotate(0deg); }
    to   { filter: hue-rotate(360deg); }
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(
        115deg,
        rgba(76, 194, 255, 0.16) 0%,
        rgba(160, 120, 255, 0.10) 40%,
        rgba(244, 114, 182, 0.12) 70%,
        rgba(34, 211, 238, 0.14) 100%
    );
    animation: bd-drift 60s linear infinite;
    pointer-events: none;
    z-index: -1;
}

/* Scanlines - the distortion */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 3px,
        rgba(125, 140, 176, 0.045) 3px,
        rgba(125, 140, 176, 0.045) 4px
    );
    pointer-events: none;
    z-index: 999;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--t-fast);
}

a:hover {
    color: var(--text-strong);
}

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

ul, ol {
    list-style: none;
}

button {
    font: inherit;
    cursor: pointer;
    background: none;
    border: none;
    color: inherit;
}

/* Keyboard focus is always visible (WCAG 2.4.7 / 2.4.11) */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* --- Header --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    /* No background at the top: the branding floats on the stripes.
       The gradient below fades in (slowly) once content reaches the
       header — see .is-scrolled, toggled from theme.js. */
    background: none;
}

.site-header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        to bottom,
        color-mix(in srgb, var(--bg-panel) 82%, transparent),
        color-mix(in srgb, var(--bg-panel) 58%, transparent)
    );
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid var(--border);
    opacity: 0;
    transition: opacity 1.1s ease;
    pointer-events: none;
}

.site-header.is-scrolled::before {
    opacity: 1;
}

.admin-bar .site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}

.header-inner {
    width: min(100% - 2.5rem, var(--content-width));
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* nowrap: a long tagline must truncate, never push the menu
       button onto a second row */
    flex-wrap: nowrap;
    gap: var(--space-3);
    padding-block: 0.9rem;
}

.header-inner .menu-toggle {
    flex-shrink: 0;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.site-title {
    /* Exactly the card-title treatment */
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 0.95rem + 0.8vw, 1.4rem);
    font-weight: 900;
    line-height: 1.2;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.site-title a {
    color: var(--text-strong);
    display: inline-block;
}

.site-title a:hover {
    color: var(--accent);
    text-shadow:
        -1.5px 0 var(--glitch-cyan),
        1.5px 0 var(--glitch-magenta);
    animation: bd-glitch 320ms steps(2, jump-none) 1;
}

/* Chromatic glitch: links jitter and split on hover (kept gentle) */
@keyframes bd-glitch {
    0% {
        text-shadow: -2px 0 var(--glitch-cyan), 2px 0 var(--glitch-magenta);
        transform: translate(0, 0);
    }
    25% {
        text-shadow: 1.5px 0 var(--glitch-cyan), -1.5px 0 var(--glitch-magenta);
        transform: translate(-0.5px, 0.5px);
    }
    50% {
        text-shadow: -1px 0 var(--glitch-cyan), 1px 0 var(--glitch-magenta);
        transform: translate(0.5px, -0.5px);
    }
    75% {
        text-shadow: 1.5px 0 var(--glitch-cyan), -1.5px 0 var(--glitch-magenta);
        transform: translate(-0.5px, 0);
    }
    100% {
        text-shadow: -2px 0 var(--glitch-cyan), 2px 0 var(--glitch-magenta);
        transform: translate(0, 0);
    }
}

.site-title a {
    display: block;
}

.site-tagline {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 700px) {
    .site-tagline {
        display: none;
    }
}

/* Hamburger */
.menu-toggle {
    padding: var(--space-1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    border-radius: 50%;
    transition: color var(--t-fast), transform var(--t-fast);
}

.menu-toggle:hover {
    color: var(--accent);
    transform: scale(1.08);
}

/* --- Full-screen menu overlay --- */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: var(--menu-overlay-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--t-normal), visibility var(--t-normal);
}

.menu-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.menu-dialog {
    text-align: center;
    padding: var(--space-4);
}

/* Overlay top bar mirrors the header container so the close icon sits
   exactly where the opener icon is. */
.menu-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: min(100% - 2.5rem, var(--content-width));
    margin-inline: auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-2);
    padding-block: 0.9rem;
}

.menu-close {
    /* Identical to .menu-toggle so it occupies the exact same spot */
    padding: var(--space-1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    transition: color var(--t-fast), transform var(--t-fast);
}

.menu-close:hover {
    transform: scale(1.08);
}

.menu-close:hover {
    color: var(--accent);
}

.menu-nav ul {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.menu-nav a {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 1.6rem + 3.5vw, 4.2rem);
    font-weight: 900;
    line-height: 1.15;
    display: block;
    color: var(--text-strong);
    transition: color var(--t-fast);
}

.menu-nav a:hover,
.menu-nav .current-menu-item a {
    color: var(--accent);
    animation: bd-glitch 320ms steps(2, jump-none) 1;
}

/* Day/night flip: pill at the bottom of the overlay */
.theme-flip {
    position: absolute;
    bottom: var(--space-5);
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 0.4em 1.2em;
    transition: color var(--t-fast), border-color var(--t-fast);
}

.theme-flip:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.theme-flip-label {
    transform: translateY(-1px);
}

/* --- Main --- */
.site-main {
    display: block;
}

.site-container {
    width: min(100% - 2.5rem, var(--content-width));
    margin-inline: auto;
    padding-block: clamp(1.75rem, 4vw, 3rem);
}

.page-header {
    margin-bottom: var(--space-3);
}

.page-header .page-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.page-header .page-title::before {
    content: '// ';
    color: var(--accent);
}

.no-results {
    font-family: var(--font-mono);
    color: var(--text-dim);
}

/* --- Post list --- */
.posts-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
    max-width: 56rem;
    margin-inline: auto;
}

/* Rainbow left edge, slowly cycling. No shadows, no hover motion. */
@keyframes bd-rainbow {
    0%   { border-left-color: hsl(0, 75%, 62%); }
    17%  { border-left-color: hsl(60, 75%, 58%); }
    33%  { border-left-color: hsl(120, 60%, 55%); }
    50%  { border-left-color: hsl(180, 70%, 55%); }
    67%  { border-left-color: hsl(240, 75%, 65%); }
    83%  { border-left-color: hsl(300, 70%, 62%); }
    100% { border-left-color: hsl(360, 75%, 62%); }
}

.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-left: 4px solid hsl(200, 75%, 60%);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    animation: bd-rainbow 16s linear infinite;
}

/* Stagger the cycle so the list cascades through the spectrum */
.posts-list .card:nth-child(6n+2) { animation-delay: -2.7s; }
.posts-list .card:nth-child(6n+3) { animation-delay: -5.4s; }
.posts-list .card:nth-child(6n+4) { animation-delay: -8.1s; }
.posts-list .card:nth-child(6n+5) { animation-delay: -10.8s; }
.posts-list .card:nth-child(6n)   { animation-delay: -13.5s; }

/* Hover: soft glow pulsing at 1Hz. Runs alongside the rainbow border
   animation so the spectrum keeps cycling while hovered. */
@keyframes bd-glow-pulse {
    0%, 100% {
        box-shadow: 0 0 4px 0 var(--glow);
    }
    50% {
        box-shadow:
            0 0 14px 2px var(--glow),
            0 0 3px 0 color-mix(in srgb, var(--accent) 30%, transparent);
    }
}

.card:hover {
    animation:
        bd-rainbow 16s linear infinite,
        bd-glow-pulse 1s ease-in-out infinite;
}

.card-thumb {
    display: block;
    position: relative;
    width: clamp(104px, 20vw, 190px);
    /* Stretch to the full card height (min square-ish) so the image
       always fills its lane with no panel background showing. */
    align-self: stretch;
    min-height: clamp(104px, 20vw, 190px);
    flex-shrink: 0;
    overflow: hidden;
    border-right: 1px solid var(--border);
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.92);
}

/* Hover only: gentle static shimmer, clipped by the thumb's
   overflow:hidden so it never leaves its lane. Burst up front for
   immediate feedback, then rests and repeats. */
.card:hover .card-thumb img {
    animation: bd-img-glitch 2.8s linear infinite;
}

@keyframes bd-img-glitch {
    0%, 9%, 100% {
        transform: translateX(0);
        filter: saturate(0.92);
    }
    2% {
        transform: translateX(-1.5px);
        filter: saturate(1.06) hue-rotate(4deg);
    }
    4% {
        transform: translateX(1px);
        filter: saturate(0.85) hue-rotate(-3deg);
    }
    7% {
        transform: translateX(-0.5px);
        filter: saturate(1);
    }
}

/* Pre-rendered noise texture; only its opacity/position animate. */
.card-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/><feColorMatrix type='matrix' values='0 0 0 0 0.75 0 0 0 0 0.85 0 0 0 0 1 0.6 0.6 0.6 0 0'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
    mix-blend-mode: screen;
    opacity: 0;
}

.card:hover .card-thumb::after {
    animation: bd-static-flicker 2.8s linear infinite;
}

@keyframes bd-static-flicker {
    0%, 9%, 100% { opacity: 0; }
    2% { opacity: 0.11; background-position: 0 0; }
    4% { opacity: 0.06; background-position: 40px 60px; }
    7% { opacity: 0.09; background-position: -30px 20px; }
}

/* No featured image: a mini CSS television with static on its screen,
   little sibling of the big redistort set. Expands on card hover. */
.card-thumb--empty {
    background: linear-gradient(135deg, #12203f 0%, #0b1020 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-tv {
    display: flex;
    gap: 6%;
    width: 70%;
    aspect-ratio: 4 / 3;
    padding: 5%;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-left: 3px solid #003cb7;
    border-radius: 8px;
    transition: transform var(--t-normal);
}

.card:hover .mini-tv {
    transform: scale(1.12);
}

.mini-tv-screen {
    position: relative;
    flex: 1;
    background: #05070d;
    border: 1px solid #05070b;
    border-radius: 4px;
    overflow: hidden;
}

/* TV static: pre-rendered noise texture jumping around */
@keyframes bd-mini-static {
    to { background-position: 84px 42px; }
}

.mini-tv-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='84' height='84'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix type='matrix' values='0 0 0 0 0.7 0 0 0 0 0.8 0 0 0 0 1 0.7 0.7 0.7 0 0'/></filter><rect width='84' height='84' filter='url(%23n)'/></svg>");
    mix-blend-mode: screen;
    opacity: 0.45;
    animation: bd-mini-static 0.8s steps(2) infinite; /* <3 changes/sec (WCAG 2.3.1) */
}

.mini-tv-panel {
    width: 14%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22%;
}

.mini-led {
    width: 4px;
    height: 4px;
    border-radius: 50%;
}

.mini-led--cyan {
    background: #22d3ee;
    box-shadow: 0 0 4px 1px rgba(34, 211, 238, 0.5);
}

.mini-led--magenta {
    background: #f472b6;
    box-shadow: 0 0 4px 1px rgba(244, 114, 182, 0.5);
}

.mini-led--red {
    background: #ff5f5f;
    box-shadow: 0 0 4px 1px rgba(255, 95, 95, 0.55);
}

.card-body {
    padding: var(--space-2) var(--space-3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-1);
    flex: 1;
    min-width: 0;
}

.card-meta,
.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35em var(--space-2);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.card-meta a,
.post-meta a {
    color: var(--text-dim);
}

.card-meta a:hover,
.post-meta a:hover {
    color: var(--accent);
}

.card-title {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 0.95rem + 0.8vw, 1.4rem);
    font-weight: 900;
    line-height: 1.3;
    text-wrap: balance;
}

/* Cap runaway titles at two lines */
.card-title a {
    color: var(--text-strong);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title a:hover {
    color: var(--accent);
    text-shadow:
        -1.5px 0 var(--glitch-cyan),
        1.5px 0 var(--glitch-magenta);
    animation: bd-glitch 320ms steps(2, jump-none) 1;
}

/* Podcast/audio players do not belong in list cards: the excerpt stays
   text-only; the player lives on the single post. */
.card .mejs-container,
.card .wp-audio-shortcode,
.card audio,
.card .powerpress_player,
.card .powerpress_links {
    display: none;
}

.card-excerpt p {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-dim);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sticky .card-title::after,
article.sticky .card-title::after {
    content: ' *';
    color: var(--accent);
}

/* --- Single --- */
.single-article {
    max-width: var(--prose-width);
    margin-inline: auto;
}

.single-hero {
    margin: 0 auto var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* Full column width even for small old uploads (upscaled) so the frame
   is always filled edge to edge. */
.single-hero img {
    display: block;
    width: 100%;
    height: auto;
}

.single-title {
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 1.25rem + 2vw, 2.6rem);
    font-weight: 900;
    line-height: 1.2;
    text-wrap: balance;
    color: var(--text-strong);
    margin: var(--space-1) 0 var(--space-3);
}

.entry-content > * + * {
    margin-top: var(--space-2);
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-strong);
    line-height: 1.3;
    margin-top: var(--space-4);
}

.entry-content a {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border-strong);
}

.entry-content a:hover {
    text-decoration-color: var(--accent);
}

.entry-content blockquote {
    font-family: var(--font-mono);
    font-size: 0.95em;
    border-left: 2px solid var(--accent);
    padding-left: var(--space-2);
    color: var(--text-dim);
}

.entry-content ul {
    list-style: square;
    padding-left: var(--space-3);
}

.entry-content ol {
    list-style: decimal;
    padding-left: var(--space-3);
}

.entry-content pre,
.entry-content code {
    font-family: var(--font-code);
    font-size: 0.9em;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.entry-content code {
    padding: 0.1em 0.4em;
}

.entry-content pre {
    padding: var(--space-2);
    overflow-x: auto;
}

.entry-content img {
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* Audio players (podcast posts): panel-toned, full width */
.entry-content audio,
.entry-content .wp-audio-shortcode,
.entry-content .mejs-container {
    width: 100% !important;
    max-width: 100%;
}

.entry-content .mejs-container,
.entry-content .mejs-container .mejs-controls {
    background: var(--bg-panel);
    border-radius: 8px;
}

.entry-content .mejs-container {
    border: 1px solid var(--border);
}

.entry-content .mejs-time-rail .mejs-time-total {
    background: var(--border);
}

.entry-content .mejs-time-rail .mejs-time-current {
    background: var(--accent);
}

.entry-content audio {
    border-radius: 8px;
}

.entry-content .powerpress_links {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-dim);
}

.entry-tags {
    margin-top: var(--space-4);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.entry-tags a {
    display: inline-block;
    padding: 0.25em 0;
    color: var(--text-dim);
}

.entry-tags a::before {
    content: '#';
    color: var(--accent);
}

.entry-tags a:hover {
    color: var(--accent);
}

/* --- Pagination / post navigation --- */
.pagination,
.post-navigation {
    margin-top: var(--space-4);
    font-family: var(--font-mono);
}

.pagination .nav-links,
.post-navigation .nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.post-navigation .nav-links {
    justify-content: space-between;
}

.pagination .page-numbers,
.post-navigation .nav-links a {
    display: inline-flex;
    padding: 0.4em 0.2em;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
}

.pagination a:hover,
.post-navigation .nav-links a:hover {
    color: var(--accent);
}

.pagination .page-numbers.current {
    color: var(--accent);
}

.pagination .page-numbers.current::before {
    content: '[';
}

.pagination .page-numbers.current::after {
    content: ']';
}

.pagination a.next::after,
.post-navigation .nav-previous a::after {
    content: '>>';
}

.pagination a.prev::before,
.post-navigation .nav-next a::before {
    content: '<<';
}

/* --- The television (redistort embed) --- */
.tv-section {
    margin-bottom: var(--space-5);
}

.tv-set {
    position: relative;
    max-width: 56rem;
    margin: var(--space-2) auto 0;
}

.tv-body {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: stretch;
    gap: 3.5%;
    padding: 3.5%;
    /* Styled like the post cards; left strip in the cobalt from the top
       of the background image. */
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-left: 4px solid #003cb7;
    border-radius: var(--radius);
}

.tv-screen {
    position: relative;
    flex: 1;
    aspect-ratio: 4 / 3;
    background: #000;
    border: 2px solid #05070b;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.8);
}

/* Supersampled tube: the iframe renders at Nx size and is scaled down,
   so the app inside draws at increased resolution (dense, sharp pixels). */
.tv-screen {
    --tv-res: 2;
}

.tv-screen iframe {
    position: absolute;
    inset: 0;
    width: calc(100% * var(--tv-res));
    height: calc(100% * var(--tv-res));
    transform: scale(calc(1 / var(--tv-res)));
    transform-origin: top left;
    border: 0;
}

/* CRT glass: scanlines, corner vignette, a soft reflection */
.tv-screen-glass {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background:
        radial-gradient(ellipse at 28% 18%, rgba(255, 255, 255, 0.09), transparent 42%),
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 3px,
            rgba(0, 0, 0, 0.09) 3px,
            rgba(0, 0, 0, 0.09) 4px
        );
    box-shadow: inset 0 0 42px 8px rgba(0, 0, 0, 0.5);
}

.tv-panel {
    width: 15%;
    max-width: 104px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10%;
    padding-block: 2%;
}

/* LED strip where the knobs used to be */
.tv-leds {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding-block: 6%;
}

@keyframes bd-led-breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.tv-led {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    animation: bd-led-breathe 3.4s ease-in-out infinite;
}

.tv-led--cyan {
    background: #22d3ee;
    box-shadow: 0 0 9px 2px rgba(34, 211, 238, 0.55);
}

.tv-led--green {
    background: #4ade80;
    box-shadow: 0 0 9px 2px rgba(74, 222, 128, 0.55);
    animation-delay: -0.7s;
}

.tv-led--amber {
    background: #fbbf24;
    box-shadow: 0 0 9px 2px rgba(251, 191, 36, 0.55);
    animation-delay: -1.4s;
}

.tv-led--magenta {
    background: #f472b6;
    box-shadow: 0 0 9px 2px rgba(244, 114, 182, 0.55);
    animation-delay: -2.1s;
}

.tv-led--red {
    background: #ff5f5f;
    box-shadow: 0 0 9px 2px rgba(255, 95, 95, 0.6);
    animation-delay: -2.8s;
}

.tv-speaker {
    width: 74%;
    flex: 1;
    min-height: 42px;
    border-radius: 6px;
    border: 1px solid #0d0f15;
    background: repeating-linear-gradient(
        to bottom,
        #10131b 0,
        #10131b 3px,
        #1d212c 3px,
        #1d212c 6px
    );
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.tv-feet {
    display: flex;
    justify-content: space-between;
    padding: 0 10%;
}

.tv-feet span {
    width: 13%;
    height: 15px;
    background: linear-gradient(#1c202b, #0d0f15);
    border-radius: 0 0 7px 7px;
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: var(--space-5);
    padding: var(--space-4) 0;
}

/* Footer spans the full viewport width */
.footer-inner {
    width: 100%;
    padding-inline: clamp(1.25rem, 4vw, 3rem);
}

.footer-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

@media (min-width: 640px) {
    .footer-top {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 960px) {
    .footer-top {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

.footer-heading {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: var(--space-2);
}

.footer-heading::before {
    content: '// ';
    color: var(--accent);
}

.footer-about p {
    font-size: 0.95rem;
    color: var(--text-dim);
    max-width: 46ch;
}

.footer-nav ul {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.footer-nav a {
    display: inline-block;
    padding: 0.25em 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.footer-nav a {
    display: inline-block;
}

.footer-nav a:hover {
    color: var(--accent);
    animation: bd-glitch 320ms steps(2, jump-none) 1;
}

.footer-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    padding-top: var(--space-3);
}

/* --- Search form (footer, 404, search page) --- */
.search-form {
    display: flex;
    gap: var(--space-1);
    max-width: 22rem;
}

.search-form label {
    flex: 1;
    min-width: 0;
}

.search-field {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5em 0.9em;
    transition: border-color var(--t-fast);
}

.search-field:focus {
    outline: none;
    border-color: var(--accent);
}

.search-field::placeholder {
    color: var(--text-dim);
}

.search-submit {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5em 1em;
    flex-shrink: 0;
    transition: color var(--t-fast), border-color var(--t-fast);
}

.search-submit:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* --- Comments --- */
.comments-area {
    max-width: var(--prose-width);
    margin: var(--space-5) auto 0;
}

.comments-title,
.comment-reply-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--text-strong);
    margin-bottom: var(--space-3);
}

.comments-title::before,
.comment-reply-title::before {
    content: '// ';
    color: var(--accent);
}

.comment-list {
    margin-bottom: var(--space-4);
}

.comment-list > .comment {
    border-top: 1px solid var(--border);
    padding: var(--space-3) 0;
}

.comment-list .children {
    padding-left: var(--space-3);
    border-left: 1px solid var(--border);
    margin-top: var(--space-3);
}

.comment-list .children .comment {
    padding: var(--space-2) 0;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-1);
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.6em;
    font-weight: 700;
    color: var(--text-strong);
}

.comment-author .avatar {
    border-radius: 50%;
    border: 1px solid var(--border);
}

.comment-metadata {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.comment-metadata a {
    color: var(--text-dim);
}

.comment-metadata a:hover {
    color: var(--accent);
}

.bypostauthor > .comment-body .comment-author .fn::after {
    content: ' *';
    color: var(--accent);
}

.comment-content {
    max-width: 60ch;
}

.comment-content > * + * {
    margin-top: var(--space-1);
}

.reply {
    margin-top: var(--space-1);
}

.reply a {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.no-comments {
    font-family: var(--font-mono);
    color: var(--text-dim);
    margin-bottom: var(--space-3);
}

/* Comment form */
.comment-form label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 0.3em;
}

.comment-form p {
    margin-bottom: var(--space-2);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55em 0.9em;
    transition: border-color var(--t-fast);
}

.comment-form textarea {
    min-height: 8rem;
    resize: vertical;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.comment-notes,
.logged-in-as {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.comment-form .form-submit input {
    width: auto;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55em 1.4em;
    cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast);
}

.comment-form .form-submit input:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.comment-navigation .nav-links {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    margin-bottom: var(--space-3);
}

/* --- 404 --- */
.error-404 {
    max-width: var(--prose-width);
    margin-inline: auto;
    text-align: center;
    padding-block: var(--space-5);
}

.error-code {
    font-family: var(--font-display);
    font-size: clamp(4rem, 3rem + 8vw, 8rem);
    font-weight: 900;
    line-height: 1;
    color: var(--accent);
    text-shadow:
        -3px 0 var(--glitch-cyan),
        3px 0 var(--glitch-magenta);
}

.error-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.2rem);
    font-weight: 900;
    color: var(--text-strong);
    margin-top: var(--space-1);
}

.error-text {
    color: var(--text-dim);
    margin-top: var(--space-2);
}

.error-search {
    margin-top: var(--space-3);
    display: flex;
    justify-content: center;
}

.error-home {
    margin-top: var(--space-3);
    font-family: var(--font-mono);
    font-weight: 700;
}

.footer-meta a {
    display: inline-block;
    padding: 0.25em 0;
    color: var(--text-dim);
}

.footer-meta a:hover {
    color: var(--accent);
}

/* --- Utilities --- */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.screen-reader-text:focus {
    clip: auto;
    width: auto;
    height: auto;
    margin: 0;
    padding: var(--space-1) var(--space-2);
    background: var(--bg-panel);
    color: var(--accent);
    z-index: 100000;
    text-decoration: none;
}

.skip-link {
    position: absolute;
    top: 0;
    left: 0;
}

/* --- WordPress core classes --- */
.alignleft {
    float: left;
    margin: 0.5em 1.5em 1em 0;
}

.alignright {
    float: right;
    margin: 0.5em 0 1em 1.5em;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.wp-caption {
    max-width: 100%;
}

.wp-caption-text,
.gallery-caption {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: var(--space-1);
}

.bypostauthor {
    display: block;
}

/* --- Reduced motion: no glitch jitter --- */
/* Visitor switched motion off (overlay toggle); same effect as reduced-motion. */
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
}

html[data-motion="off"] {
    scroll-behavior: auto;
}

/* Motion toggle: sits just above the day/night flip in the overlay */
.motion-flip {
    position: absolute;
    bottom: calc(var(--space-5) + 3.2rem);
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.3em 0.9em;
    transition: color var(--t-fast), border-color var(--t-fast);
}

.motion-flip:hover {
    color: var(--accent);
    border-color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Print --- */
@media print {
    .site-header,
    .site-footer,
    .pagination,
    .theme-flip {
        display: none;
    }

    body::before,
    body::after {
        display: none;
    }
}
