/*
Theme Name: plnet
Theme URI: https://patrick.lidstone.net/
Author: Patrick Lidstone
Description: Instrument-panel theme for patrick.lidstone.net — an index for the self-hosted radio, workshop and software apps. Classic theme, no build step.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: plnet
*/

/* ------------------------------------------------------------------ *
 * Tokens — dark is the default (it's a rig panel), light is aluminium
 * ------------------------------------------------------------------ */
:root {
  --bg:        #0b0d0e;
  --bg-deep:   #070809;
  --panel:     #14181a;
  --panel-hi:  #191f22;
  --line:      #262d31;
  --line-soft: #1c2225;
  --ink:       #e6e9ea;
  --ink-dim:   #8b979c;
  --ink-faint: #59656a;

  --accent:      #ffb000;   /* phosphor amber */
  --accent-ink:  #ffb000;   /* amber used as text */
  --accent-haze: rgba(255, 176, 0, .14);
  --live:        #35d07f;

  --seam: 1px;
  --pad: clamp(20px, 3.2vw, 34px);
  --maxw: 1180px;

  --f-display: "IBM Plex Sans Condensed", "Arial Narrow", sans-serif;
  --f-body:    "IBM Plex Sans", system-ui, sans-serif;
  --f-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #dedbd4;
    --bg-deep:   #d5d1c9;
    --panel:     #f6f4f0;
    --panel-hi:  #fdfcfa;
    --line:      #a9a293;
    --line-soft: #c4beb2;
    --ink:       #12161a;
    --ink-dim:   #4e554e;
    --ink-faint: #6e6a60;

    --accent:      #b45c00;
    --accent-ink:  #8f4a00;
    --accent-haze: rgba(180, 92, 0, .12);
    --live:        #1d7a4c;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
}

/* film grain + vignette: atmosphere, not decoration */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .05;
  mix-blend-mode: overlay;
  background-image: 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='.82' numOctaves='3' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  background: radial-gradient(120% 90% at 50% 0%, transparent 55%, rgba(0,0,0,.42) 100%);
}
@media (prefers-color-scheme: light) {
  body::after { background: radial-gradient(120% 90% at 50% 0%, transparent 60%, rgba(90,80,60,.14) 100%); }
  body::before { opacity: .045; mix-blend-mode: multiply; }
}

a { color: inherit; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }

.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: #000; padding: 10px 16px; font-family: var(--f-mono);
}
.skip:focus { left: 12px; top: 12px; z-index: 200; }

:where(a, button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ *
 * Masthead — an engraved faceplate
 * ------------------------------------------------------------------ */
.masthead {
  border-bottom: var(--seam) solid var(--line);
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
}
.masthead .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding-block: 16px; flex-wrap: wrap;
}

.plate {
  display: inline-flex; align-items: baseline; gap: 2px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(19px, 2.1vw, 24px);
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 8px 14px 7px;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.16));
  border: 1px solid var(--line);
  text-shadow: 0 1px 0 rgba(255,255,255,.07), 0 -1px 0 rgba(0,0,0,.55);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), inset 0 -1px 0 rgba(0,0,0,.35);
  text-decoration: none;
}
.plate em { font-style: normal; color: var(--accent-ink); }

@media (prefers-color-scheme: light) {
  .plate { text-shadow: 0 1px 0 rgba(255,255,255,.9), 0 -1px 0 rgba(0,0,0,.10); }
}

.rack-meta {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: flex; align-items: center; gap: 10px;
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 8px var(--live);
}

/* ------------------------------------------------------------------ *
 * Hero — statement + a live FFT strip
 * ------------------------------------------------------------------ */
.hero { border-bottom: var(--seam) solid var(--line); background: var(--bg-deep); }
.hero .wrap { padding-block: clamp(48px, 7vw, 92px) 0; }

.eyebrow {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .26em;
  text-transform: uppercase; color: var(--accent-ink); margin: 0 0 20px;
}

.hero h1 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(34px, 6.4vw, 74px);
  line-height: .98;
  letter-spacing: -.005em;
  margin: 0;
  max-width: 16ch;
  text-wrap: balance;
}
.hero h1 .glow { color: var(--accent-ink); }

.hero-lede {
  margin: 22px 0 0;
  max-width: 56ch;
  color: var(--ink-dim);
  font-size: clamp(15px, 1.35vw, 18px);
}
.hero-lede p { margin: 0 0 .7em; }
.hero-lede p:last-child { margin-bottom: 0; }

/* FFT spectrum: 48 bars, staggered. Cheap, CSS-only, and it reads instantly. */
.spectrum {
  display: flex; align-items: flex-end; gap: 2px;
  height: clamp(56px, 8vw, 96px);
  margin-top: clamp(40px, 5vw, 64px);
  padding-inline: var(--pad);
  max-width: var(--maxw);
  margin-inline: auto;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.spectrum i {
  flex: 1 1 0;
  min-width: 0;
  /* align-items:flex-end shrinks flex children to content height (zero).
     The bars need an explicit box before scaleY() has anything to scale. */
  height: 100%;
  transform-origin: bottom;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-haze) 100%);
  animation: fft 1.5s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * -71ms);
}
.spectrum i:nth-child(3n)  { animation-duration: 2.1s; }
.spectrum i:nth-child(5n)  { animation-duration: 1.15s; }
.spectrum i:nth-child(7n)  { animation-duration: 2.7s; }
.spectrum i:nth-child(11n) { animation-duration: .95s; }

@keyframes fft {
  from { transform: scaleY(.06); }
  to   { transform: scaleY(1); }
}

/* ------------------------------------------------------------------ *
 * Section rules — engraved labels
 * ------------------------------------------------------------------ */
.rule {
  display: flex; align-items: center; gap: 16px;
  margin: clamp(56px, 6vw, 84px) 0 0;
}
.rule span {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .28em;
  text-transform: uppercase; color: var(--ink-faint); white-space: nowrap;
}
.rule::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

/* ------------------------------------------------------------------ *
 * Module grid — hairline seams via 1px gap over the line colour
 * ------------------------------------------------------------------ */
/* Seams are drawn per-module with box-shadow rather than by letting a
   background colour show through a 1px gap. A partially-filled last row
   then leaves the page background exposed -- reading as a vacant rack bay
   -- instead of a stray grey block. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: var(--seam);
  margin-top: 22px;
}

.module {
  position: relative;
  display: flex; flex-direction: column;
  gap: 10px;
  padding: 26px 24px 24px;
  background: var(--panel);
  box-shadow: 0 0 0 var(--seam) var(--line);
  text-decoration: none;
  isolation: isolate;
  transition: background .28s ease, transform .28s cubic-bezier(.2,.7,.2,1), box-shadow .28s ease;
}
.module::before { /* faceplate sheen */
  content: "";
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent 42%);
}
.module::after { /* amber wash on hover */
  content: "";
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(90% 70% at 10% 0%, var(--accent-haze), transparent 70%);
  opacity: 0;
  transition: opacity .3s ease;
}
.module:hover, .module:focus-visible { background: var(--panel-hi); transform: translateY(-2px); }
.module:hover::after, .module:focus-visible::after { opacity: 1; }

/* Full-row feature: at the common 3-column width the Radio rack then fills
   exactly (1 banner + 3 modules) with no vacant bay, and the mode ticker
   gets the full width to drift across. */
.module.is-feature { grid-column: 1 / -1; }

.m-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.m-idx {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .18em;
  color: var(--ink-faint);
}
.m-led {
  width: 7px; height: 7px; border-radius: 50%;
  background: #394246;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
  transition: background .28s ease, box-shadow .28s ease;
  flex: none;
}
@media (prefers-color-scheme: light) { .m-led { background: #bdb8ac; } }
.module:hover .m-led, .module:focus-visible .m-led {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), inset 0 0 0 1px rgba(0,0,0,.25);
}

.module h3 {
  font-family: var(--f-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .045em;
  font-size: clamp(19px, 1.7vw, 23px);
  line-height: 1.1;
  margin: 2px 0 0;
  color: var(--ink);
}
.module.is-feature h3 { font-size: clamp(23px, 2.3vw, 31px); }

.module p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 14.5px;
  line-height: 1.62;
  max-width: 62ch;
}

.m-foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-faint);
}
.m-arrow { color: var(--accent-ink); transition: transform .28s cubic-bezier(.2,.7,.2,1); }
.module:hover .m-arrow { transform: translateX(5px); }

.m-locked { color: var(--ink-faint); letter-spacing: .2em; }

/* mode ticker inside the feature module */
.ticker {
  margin-top: 14px;
  overflow: hidden;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding-block: 9px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.ticker div {
  display: inline-flex; gap: 26px;
  white-space: nowrap;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .16em;
  color: var(--ink-faint);
  animation: drift 46s linear infinite;
  will-change: transform;
}
.ticker span { opacity: .9; }
.ticker b { color: var(--accent-ink); font-weight: 400; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ------------------------------------------------------------------ *
 * Editable intro from the WordPress page content
 * ------------------------------------------------------------------ */
.page-body { margin-top: clamp(40px, 5vw, 60px); }
.page-body :is(h1,h2,h3) { font-family: var(--f-display); letter-spacing: .02em; }
.page-body a { color: var(--accent-ink); text-underline-offset: 3px; }
.page-body ul { padding-left: 1.1em; }

/* ------------------------------------------------------------------ */
.site-footer {
  margin-top: clamp(64px, 8vw, 110px);
  border-top: var(--seam) solid var(--line);
  background: var(--bg-deep);
}
.site-footer .wrap {
  padding-block: 26px;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
}
.site-footer a { color: var(--ink-dim); text-decoration: none; }
.site-footer a:hover { color: var(--accent-ink); }

/* ------------------------------------------------------------------ *
 * Interior pages (posts, 404) — inherit the panel, stay quiet
 * ------------------------------------------------------------------ */
.interior { padding-block: clamp(40px, 6vw, 76px); }
.interior h1 { font-family: var(--f-display); font-size: clamp(28px, 4vw, 46px); letter-spacing: .01em; margin: 0 0 .4em; }
.interior .entry { max-width: 72ch; }

/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .spectrum i { animation: none; }
  /* frozen, but still a spectrum: eight repeating heights */
  .spectrum i:nth-child(8n+1) { transform: scaleY(.30); }
  .spectrum i:nth-child(8n+2) { transform: scaleY(.62); }
  .spectrum i:nth-child(8n+3) { transform: scaleY(.18); }
  .spectrum i:nth-child(8n+4) { transform: scaleY(.86); }
  .spectrum i:nth-child(8n+5) { transform: scaleY(.44); }
  .spectrum i:nth-child(8n+6) { transform: scaleY(.71); }
  .spectrum i:nth-child(8n+7) { transform: scaleY(.24); }
  .spectrum i:nth-child(8n+8) { transform: scaleY(.53); }
  .ticker div { animation: none; }
  .module, .m-arrow, .m-led { transition: none; }
  .module:hover { transform: none; }
}
