/* ==========================================================================
   Shattershard — site styles
   ========================================================================== */

@font-face {
  font-family: "Harting";
  src: url("/assets/fonts/HartingPlain.woff") format("woff"),
       url("/assets/fonts/HartingPlain.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/IBMPlexMono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/IBMPlexMono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #000;
  --surface: #0b0b0c;
  --surface-2: #131315;
  --fg: #e6e6e6;
  --text: #cfd2d8;
  --muted: #b8bac1;
  --dim: #8e9098;
  --line: rgba(255, 255, 255, 0.16);
  --line-strong: rgba(255, 255, 255, 0.34);
  --accent: #d0343f;

  /* Harting gives the site its character: headings, titles, buttons, nav.
     Everything you actually read is set in IBM Plex Mono. */
  --font-display: "Harting", "IBM Plex Mono", "Courier New", ui-monospace, monospace;
  --font-text: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 10px;
  --gutter: clamp(16px, 4vw, 32px);
  --max: 1160px;
  --header-h: 60px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.brand,
.nav a,
.btn,
.chip,
.menu-title,
.menu-num,
.menu-state,
.pick-title,
.ref-grid a,
.empty-state {
  font-family: var(--font-display);
}

main {
  flex: 1;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--fg);
  font-weight: 400;
  line-height: 1.15;
}

a {
  color: inherit;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.2em;
  transition: color 0.2s, text-decoration-color 0.2s;
}

a:hover {
  color: var(--fg);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 1px dashed var(--fg);
  outline-offset: 4px;
  border-radius: 4px;
}

::selection {
  background: var(--accent);
  color: #fff;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--fg);
  color: #000;
  border-radius: 6px;
  transform: translateY(-150%);
  transition: transform 0.2s;
}

.skip-link:focus {
  transform: none;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(48px, 9vw, 110px);
}

.section-title {
  margin-bottom: clamp(28px, 5vw, 48px);
  text-align: center;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  color: var(--muted);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
  font-size: 1.05rem;
  white-space: nowrap;
}

.brand img {
  width: 28px;
  height: 28px;
}

.nav {
  display: flex;
  gap: clamp(4px, 2vw, 12px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  display: block;
  padding: 6px 10px;
  border: 1px dashed transparent;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.92rem;
  white-space: nowrap;
}

.nav a:hover {
  border-color: var(--line);
}

.nav a[aria-current="page"] {
  color: var(--fg);
  border-color: var(--line-strong);
}

.site-header nav {
  margin-left: auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-family: var(--font-text);
  font-size: 0.78rem;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.icon-btn:hover {
  color: var(--fg);
  border-color: var(--line-strong);
  background: var(--surface);
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

.icon-btn kbd {
  color: var(--dim);
  font-family: var(--font-text);
  font-size: 0.72rem;
}

/* Thin progress line while the router loads the next page */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--fg), transparent);
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0;
}

.is-navigating .site-header::after {
  opacity: 1;
  animation: nav-progress 0.9s var(--ease) infinite;
}

@keyframes nav-progress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); opacity: 0; }
}

/* Page swap animation (View Transitions API) */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.25s;
}

@media (max-width: 720px) {
  .icon-btn kbd {
    display: none;
  }

  .icon-btn {
    padding: 0;
  }
}

/* ---------- Mobile menu: nav becomes a dropdown under the header ---------- */

.nav-num,
.menu-toggle {
  display: none;
}

.menu-toggle svg path {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.25s var(--ease), opacity 0.2s;
}

.is-menu-open .menu-toggle .bar1 { transform: translateY(3.5px) rotate(45deg); }
.is-menu-open .menu-toggle .bar2 { opacity: 0; }
.is-menu-open .menu-toggle .bar3 { transform: translateY(-3.5px) rotate(-45deg); }

@media (max-width: 720px) {
  .menu-toggle {
    display: inline-flex;
  }

  .site-header nav {
    position: absolute;
    top: calc(100% + 8px);
    left: var(--gutter);
    right: var(--gutter);
    margin: 0;
    padding: 8px;
    background: rgba(8, 8, 9, 0.96);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.2s, visibility 0.2s, transform 0.25s var(--ease);
  }

  .is-menu-open .site-header nav {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav {
    flex-direction: column;
    gap: 2px;
  }

  .nav a {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 14px 14px;
    border-radius: 10px;
    font-size: 1.15rem;
  }

  .nav a[aria-current="page"] {
    background: var(--surface-2);
  }

  .nav-num {
    display: inline;
    color: var(--dim);
    font-family: var(--font-text);
    font-size: 0.75rem;
  }

  /* Dim the page behind the open menu (on body: the header's backdrop-filter
     would trap a fixed-position child inside the header) */
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
  }

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

/* ---------- Command palette ---------- */

.palette-open,
.palette-open body {
  overflow: hidden;
}

.palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  justify-items: center;
  align-items: start;
  padding: max(10vh, 16px) 16px 16px;
}

.palette[hidden] {
  display: none;
}

.palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade-in 0.15s ease-out;
}

.palette-box {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: min(560px, 80vh);
  overflow: hidden;
  background: #0b0b0c;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8);
  animation: palette-in 0.18s var(--ease);
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes palette-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
}

.palette-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.palette-input svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--dim);
}

.palette-input input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--fg);
  font-size: 16px;
}

.palette-input input::placeholder {
  color: var(--dim);
}

.palette-input kbd,
.palette-foot kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--dim);
  font-family: var(--font-text);
  font-size: 0.72rem;
}

.palette-list {
  flex: 1;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.palette-group {
  padding: 12px 10px 6px;
  color: var(--dim);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
}

.palette-item.is-selected {
  background: var(--surface-2);
  border-color: var(--line);
}

.palette-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--muted);
}

.palette-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.palette-icon svg {
  width: 20px;
  height: 20px;
}

.palette-icon.is-logo {
  background: #f2f2f4;
  border-radius: 8px;
}

.palette-icon.is-logo img {
  width: 22px;
  height: 22px;
}

.palette-mono {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  color: var(--fg);
  font-size: 0.85rem;
}

.palette-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.palette-title {
  color: var(--fg);
  font-size: 0.92rem;
}

.palette-desc {
  overflow: hidden;
  color: var(--dim);
  font-size: 0.78rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.palette-cat {
  flex-shrink: 0;
  color: var(--dim);
  font-size: 0.72rem;
}

.palette-ext {
  color: var(--dim);
  font-size: 0.8rem;
}

.palette-empty {
  padding: 36px 16px;
  color: var(--dim);
  text-align: center;
}

.palette-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.75rem;
}

.palette-foot span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

@media (hover: none) {
  .palette-foot {
    display: none;
  }
}

@media (max-width: 520px) {
  .palette-cat {
    display: none;
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  background: #000;
  color: var(--muted);
  border: 1px dashed var(--muted);
  border-radius: 8px;
  text-decoration: none;
  line-height: 1.2;
  text-align: center;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s, transform 0.2s var(--ease);
}

.btn:hover {
  color: var(--fg);
  border-color: var(--fg);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ---------- Glitch heading (text filled with an image) ---------- */

.glitch-text {
  --x: 50%;
  --y: 30%;
  margin: 0;
  background: url("/assets/img/misaimg.webp") var(--x) var(--y) / 160% auto no-repeat;
  background-color: var(--fg);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--fg);
  font-weight: 900;
  line-height: 0.9;
  text-align: center;
  overflow-wrap: break-word;
  transition: background-position 0.6s var(--ease);
}

@media (hover: none), (pointer: coarse) {
  .glitch-text {
    animation: pan 18s ease-in-out infinite alternate;
  }
}

@keyframes pan {
  from { background-position: 0% 20%; }
  to   { background-position: 100% 60%; }
}

/* ---------- Hero (home) ---------- */

.hero {
  min-height: calc(100svh - var(--header-h));
  display: grid;
  align-content: center;
  gap: clamp(24px, 4vw, 40px);
  padding-block: 24px 48px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: clamp(16px, 3vw, 32px);
}

.hero-art {
  position: relative;
  width: min(100%, 460px, 36svh);
  aspect-ratio: 1;
  margin-inline: auto;
  isolation: isolate;
}

.hero-logo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  filter: drop-shadow(0 0 60px rgba(208, 52, 63, 0.16));
  transition: transform 0.5s var(--ease);
}

/* ---------- Red glass shards around the logo (built by site.js) ---------- */

.hero-art.has-shards {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.shards {
  position: absolute;
  inset: -20%;
  width: 140%;
  max-width: none;                     /* the global svg { max-width: 100% } would squeeze it */
  height: 140%;
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 0 5px rgba(208, 52, 63, 0.35));
}

.shards-back { z-index: 0; }
.shards-front { z-index: 2; }

.shard,
.shard-body,
.shard-float {
  transform-box: fill-box;
  transform-origin: center;
}

/* Layer 1: parallax with the cursor (deeper shards move more) */
.shard {
  transform: translate(calc(var(--mx, 0) * var(--d) * 5px), calc(var(--my, 0) * var(--d) * 5px));
  transition: transform 0.9s var(--ease);
}

/* Layer 2: spread / burst / assemble along the shard's own direction */
.shard-body {
  --spread: 0;
  --spin: 0deg;
  transform: translate(calc(var(--ux) * var(--spread) * 1px), calc(var(--uy) * var(--spread) * 1px)) rotate(var(--spin));
  transition: transform 1.1s cubic-bezier(0.2, 1.35, 0.35, 1), opacity 0.6s;
}

/* Layer 3: slow idle float */
.shard-float {
  animation: shard-float var(--t, 8s) ease-in-out var(--delay, 0s) infinite alternate;
}

@keyframes shard-float {
  from { transform: translate(0, 0) rotate(0deg); }
  to   { transform: translate(var(--fx), var(--fy)) rotate(var(--fr)); }
}

.shard polygon {
  stroke: rgba(255, 210, 210, 0.45);
  stroke-width: 0.12;
  stroke-linejoin: round;
}

.shard .glint {
  fill: none;
  stroke: rgba(255, 255, 255, 0.8);
  stroke-width: 0.18;
  stroke-linecap: round;
}

.hero-art:hover .shard-body {
  --spread: calc(var(--r) * 0.05);
  --spin: calc(var(--rot) * 0.15);
}

.hero-art.is-burst .shard-body {
  --spread: var(--burst);
  --spin: var(--rot);
  transition: transform 0.45s cubic-bezier(0.1, 0.8, 0.2, 1), opacity 0.3s;
}

.hero-art.is-burst .hero-logo {
  transform: scale(0.94);
  transition-duration: 0.15s;
}

/* Before the first reveal: shards wait far out and fly in */
.hero-art.is-scattered .shard-body {
  --spread: calc(var(--burst) * 1.6);
  --spin: calc(var(--rot) * -1.5);
  opacity: 0;
  transition: none;
}

/* Impact flash on click */
.shards-flash {
  position: absolute;
  inset: 20%;
  z-index: 3;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 90, 100, 0.45), transparent 65%);
  opacity: 0;
  transform: scale(0.4);
  pointer-events: none;
}

.hero-art.is-burst .shards-flash {
  animation: shard-flash 0.6s ease-out;
}

@keyframes shard-flash {
  20% { opacity: 1; }
  to  { opacity: 0; transform: scale(1.4); }
}

@media (prefers-reduced-motion: reduce) {
  .shard-float {
    animation: none;
  }
}

/* "Shattershard" is 12 monospace glyphs (~7.4em) — size it to fit its column */
.hero .glitch-text {
  font-size: clamp(2rem, 11.5vw, 4.6rem);
}

@media (min-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero .glitch-text {
    font-size: clamp(2rem, 5.6vw, 5.2rem);
  }

  .hero-art {
    width: min(100%, 460px, 70svh);
  }
}

/* ---------- Home menu ---------- */

.menu {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 1000px;
  margin-inline: auto;
}

.menu-item {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "num arrow"
    "icon icon"
    "title title"
    "sub sub";
  align-content: start;
  gap: 4px;
  min-height: 150px;
  padding: 16px 18px 18px;
  overflow: hidden;
  background: #000;
  color: var(--muted);
  border-radius: 12px;
  text-decoration: none;
  isolation: isolate;
  transition: transform 0.35s var(--ease), color 0.25s, background-color 0.25s;
}

/* Soft light that follows the cursor inside the tile */
.menu-item::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(220px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.09), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.menu-item:hover,
.menu-item:focus-visible {
  color: var(--fg);
  background: var(--surface);
  transform: translateY(-4px);
}

.menu-item:hover::before,
.menu-item:focus-visible::before {
  opacity: 1;
}

.menu-item:focus-visible {
  outline: none;
}

/* Dashed frame drawn in SVG so the dashes can "march" on hover */
.menu-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.menu-frame rect {
  x: 0.5px;
  y: 0.5px;
  width: calc(100% - 1px);
  height: calc(100% - 1px);
  rx: 12px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 5 4;
  opacity: 0.7;
  transition: stroke 0.25s, opacity 0.25s;
}

.menu-item:hover .menu-frame rect,
.menu-item:focus-visible .menu-frame rect {
  stroke: var(--fg);
  opacity: 1;
  animation: march 0.6s linear infinite;
}

@keyframes march {
  to { stroke-dashoffset: -9; }
}

.menu-num {
  grid-area: num;
  color: var(--dim);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.menu-arrow,
.menu-state {
  grid-area: arrow;
  justify-self: end;
}

.menu-arrow {
  width: 14px;
  height: 14px;
  color: var(--dim);
  transition: transform 0.3s var(--ease), color 0.25s;
}

.menu-item:hover .menu-arrow {
  color: var(--fg);
  transform: translate(3px, -3px);
}

.menu-icon {
  grid-area: icon;
  display: flex;
  align-items: flex-end;
  height: 40px;
  margin: 10px 0 8px;
  color: var(--muted);
  transition: color 0.25s, transform 0.35s var(--ease);
}

.menu-icon svg {
  width: 30px;
  height: 30px;
}

.menu-item:hover .menu-icon {
  color: var(--fg);
  transform: scale(1.08);
  transform-origin: left bottom;
}

.menu-title {
  grid-area: title;
  color: var(--fg);
  font-size: 1.12rem;
  line-height: 1.2;
}

.menu-sub {
  grid-area: sub;
  overflow: hidden;
  color: var(--dim);
  font-size: 0.78rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.menu-hint {
  color: var(--dim);
  font-size: 0.78rem;
  text-align: center;
}

.menu-hint kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

@media (hover: none) {
  .menu-hint {
    display: none;
  }
}

/* Radio tile: equalizer + live state */
.menu-state {
  color: var(--dim);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.eq {
  gap: 4px;
}

.eq i {
  width: 5px;
  height: 30%;
  background: currentColor;
  border-radius: 2px;
  transition: height 0.3s;
}

.eq i:nth-child(2) { height: 55%; }
.eq i:nth-child(3) { height: 40%; }
.eq i:nth-child(4) { height: 70%; }
.eq i:nth-child(5) { height: 45%; }

.menu-radio.is-playing .menu-icon {
  color: var(--accent);
}

.menu-radio.is-playing .eq i {
  animation: eq 0.9s ease-in-out infinite alternate;
}

.menu-radio.is-playing .eq i:nth-child(2) { animation-duration: 0.7s; animation-delay: -0.2s; }
.menu-radio.is-playing .eq i:nth-child(3) { animation-duration: 1.1s; animation-delay: -0.5s; }
.menu-radio.is-playing .eq i:nth-child(4) { animation-duration: 0.8s; animation-delay: -0.1s; }
.menu-radio.is-playing .eq i:nth-child(5) { animation-duration: 1s; animation-delay: -0.4s; }

@keyframes eq {
  from { height: 15%; }
  to   { height: 100%; }
}

.menu-radio.is-playing .menu-state {
  color: var(--accent);
}

.menu-radio.is-loading .menu-state {
  animation: blink 0.8s steps(2) infinite;
}

@media (max-width: 900px) {
  .menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .menu {
    gap: 10px;
  }

  .menu-item {
    min-height: 0;
    padding: 12px 14px 14px;
  }

  .menu-icon {
    height: 28px;
    margin: 6px 0 4px;
  }

  .menu-icon svg {
    width: 24px;
    height: 24px;
  }

  .menu-title {
    font-size: 0.98rem;
  }

  .menu-sub {
    font-size: 0.7rem;
  }
}

/* ---------- Page heading (inner pages) ---------- */

.page-head {
  display: grid;
  justify-items: center;
  gap: clamp(28px, 5vw, 48px);
  padding-block: clamp(48px, 10vw, 120px) clamp(24px, 4vw, 48px);
}

.page-head .glitch-text {
  font-size: clamp(3rem, 13vw, 8rem);
}

/* ---------- Toolbar (search + filters) ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.search {
  position: relative;
  flex: 1 1 260px;
}

.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
}

.search input {
  width: 100%;
  min-height: 44px;
  padding: 10px 44px 10px 40px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-size: 16px; /* prevents iOS zoom on focus */
  transition: border-color 0.2s;
}

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

.search input:focus {
  outline: none;
  border-color: var(--fg);
}

.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--dim);
  font: inherit;
  font-size: 0.8rem;
  pointer-events: none;
}

.search input:focus + kbd,
.search input:not(:placeholder-shown) + kbd {
  display: none;
}

@media (hover: none) {
  .search kbd {
    display: none;
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Phones: each chip group becomes one swipeable row instead of a tall wall */
@media (max-width: 600px) {
  .toolbar .chips {
    flex-wrap: nowrap;
    width: calc(100% + 2 * var(--gutter));
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
  }

  .toolbar .chips::-webkit-scrollbar {
    display: none;
  }

  .toolbar .chip {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

.chip {
  min-height: 36px;
  padding: 6px 14px;
  background: transparent;
  color: var(--dim);
  border: 1px dashed var(--line);
  border-radius: 999px;
  font-size: 0.88rem;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.chip:hover {
  color: var(--fg);
  border-color: var(--line-strong);
}

.chip[aria-pressed="true"] {
  color: #000;
  background: var(--muted);
  border-color: var(--muted);
}

.result-count {
  width: 100%;
  color: var(--dim);
  font-size: 0.85rem;
}

.empty-state {
  padding: 48px 0;
  text-align: center;
  color: var(--dim);
}

/* ---------- Cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.25s, background-color 0.25s, transform 0.25s var(--ease);
}

.card:hover,
.card:focus-within {
  border-color: var(--line-strong);
  background: var(--surface-2);
  transform: translateY(-3px);
}

.card[hidden] {
  display: none;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.card-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  object-fit: contain;
}

.card-title {
  color: var(--fg);
  font-size: 1.15rem;
  line-height: 1.25;
}

/* Whole card is clickable via the title link */
.card-title a {
  text-decoration: none;
}

.card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.card-title a:focus-visible {
  outline: none;
}

.card:has(.card-title a:focus-visible) {
  outline: 1px dashed var(--fg);
  outline-offset: 3px;
}

.card-text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--dim);
}

.tag {
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.card-mono {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--fg);
  font-size: 1.3rem;
}

.card-arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-left: auto;
  color: var(--dim);
  transition: transform 0.25s var(--ease), color 0.25s;
}

.card:hover .card-arrow {
  color: var(--fg);
  transform: translate(2px, -2px);
}

/* Sits above the card's full-size link overlay so it stays clickable */
.card-cmd {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  background: #000;
  color: var(--dim);
  border: 1px dashed var(--line);
  border-radius: 6px;
  text-align: left;
  transition: color 0.2s, border-color 0.2s;
}

.card-cmd:hover {
  color: var(--fg);
  border-color: var(--line-strong);
}

.card-cmd code {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.card-cmd code::before {
  content: "$ ";
  color: var(--accent);
}

.card-cmd svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.card-download {
  color: var(--accent);
}

/* ---------- Feature block (image + link list) ---------- */

.feature {
  display: grid;
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
}

.feature-img {
  width: 100%;
  height: 100%;
  min-height: 300px;
  max-height: 560px;
  object-fit: cover;
  border-radius: var(--radius);
}

@media (min-width: 768px) {
  .feature {
    grid-template-columns: 1fr 1fr;
  }
}

.link-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px dashed transparent;
  border-radius: var(--radius);
  transition: border-color 0.25s, background-color 0.25s;
}

.link-item:hover,
.link-item:focus-within {
  border-color: var(--line-strong);
  background: var(--surface);
}

.link-item-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
}

.link-item-icon svg {
  width: 22px;
  height: 22px;
}

.link-item h3 {
  font-size: 1.2rem;
}

.link-item p {
  font-size: 0.85rem;
  color: var(--muted);
}

.link-item a {
  text-decoration: none;
}

.link-item a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.link-item a:focus-visible {
  outline: none;
}

.link-item:has(a:focus-visible) {
  outline: 1px dashed var(--fg);
  outline-offset: 3px;
}

.link-item:hover .card-arrow {
  color: var(--fg);
  transform: translate(2px, -2px);
}

/* ---------- Referrals ---------- */

.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ref-grid a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 14px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 1.05rem;
  text-decoration: none;
  transition: border-color 0.25s, background-color 0.25s, color 0.25s;
}

.ref-grid a:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.ref-grid a:hover .card-arrow {
  color: var(--fg);
  transform: translate(2px, -2px);
}

/* ---------- Parallax window ---------- */

.parallax {
  position: relative;
  height: 80vh;
  height: 80svh;
  clip-path: inset(0);
  /* Fade the artwork itself into the black page instead of covering it with a
     black overlay: an overlay and the image share the same fractional clip edge,
     so the edge row of pixels is half-covered by both and the image shows through */
  --fade: transparent, rgba(0, 0, 0, 0.04) 7%, rgba(0, 0, 0, 0.16) 14%, rgba(0, 0, 0, 0.36) 21%,
    rgba(0, 0, 0, 0.62) 28%, #000 35%, #000 65%, rgba(0, 0, 0, 0.62) 72%, rgba(0, 0, 0, 0.36) 79%,
    rgba(0, 0, 0, 0.16) 86%, rgba(0, 0, 0, 0.04) 93%, transparent;
  -webkit-mask-image: linear-gradient(var(--fade));
  mask-image: linear-gradient(var(--fade));
}

.parallax::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("/assets/img/misaimg.webp") center / cover no-repeat;
  filter: brightness(0.55);
}

/* The artwork already fades to black, so a border line there would only show the seam */
main:has(> .parallax:last-child) + .site-footer {
  border-top-color: transparent;
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: 40px calc(40px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.92rem;
  position: relative;
  background: var(--bg);
}

.site-footer .container {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
}

.copy-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  color: var(--dim);
  border: 1px dashed var(--line);
  border-radius: 6px;
  transition: color 0.2s, border-color 0.2s;
}

.copy-btn:hover {
  color: var(--fg);
  border-color: var(--line-strong);
}

.copy-btn svg {
  width: 14px;
  height: 14px;
}

.copyright {
  color: var(--dim);
}

/* ---------- Floating UI: radio + to-top + toast ---------- */

.radio {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(340px, calc(100vw - 96px));
  padding: 6px 14px 6px 6px;
  background: rgba(11, 11, 12, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  font-size: 0.82rem;
}

.radio-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  padding: 0;
  overflow: hidden;
  background: var(--surface-2) center / cover no-repeat;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.radio-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.radio-btn svg {
  position: relative;
  width: 16px;
  height: 16px;
}

.radio-btn .icon-pause,
.radio.is-playing .radio-btn .icon-play {
  display: none;
}

.radio.is-playing .radio-btn .icon-pause {
  display: block;
}

.radio.is-loading .radio-btn svg {
  animation: blink 0.8s steps(2) infinite;
}

@keyframes blink {
  50% { opacity: 0.2; }
}

.radio-info {
  min-width: 0;
  line-height: 1.25;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--dim);
  font-size: 0.72rem;
}

.radio-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
}

.radio.is-playing .radio-live {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: blink 1.6s ease-in-out infinite;
}

.radio-track {
  overflow: hidden;
  color: var(--fg);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.to-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: rgba(11, 11, 12, 0.88);
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s var(--ease), color 0.2s;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  color: var(--fg);
}

.to-top svg {
  width: 18px;
  height: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 60;
  padding: 10px 18px;
  background: var(--fg);
  color: #000;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 10px);
  transition: opacity 0.25s, visibility 0.25s, transform 0.25s var(--ease);
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* Keep room so floating UI never covers the footer text */
body.has-radio .site-footer {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* ---------- Reveal on scroll ---------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--delay, 0s);
}

.js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* ---------- AI page ---------- */

.page-lead {
  margin-top: calc(-1 * clamp(8px, 2vw, 20px));
  color: var(--dim);
  font-size: 0.9rem;
  text-align: center;
}

.picks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.picks li {
  display: flex;
}

.pick {
  position: relative;
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 18px;
  overflow: hidden;
  background: #000;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  text-align: left;
  transition: border-color 0.25s, background-color 0.25s, transform 0.3s var(--ease);
}

.pick::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--cat), transparent 70%);
  opacity: 0.12;
  transition: opacity 0.3s, transform 0.4s var(--ease);
}

.pick:hover {
  border-color: var(--cat);
  background: var(--surface);
  transform: translateY(-3px);
}

.pick:hover::after {
  opacity: 0.3;
  transform: scale(1.3);
}

.pick-icon {
  margin-bottom: 8px;
  color: var(--cat);
}

.pick-icon svg {
  width: 28px;
  height: 28px;
}

.pick-title {
  color: var(--fg);
  font-size: 1.02rem;
  line-height: 1.25;
}

.pick-sub {
  color: var(--dim);
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  .picks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (max-width: 520px) {
  .pick {
    padding: 14px;
  }

  .pick-icon svg {
    width: 22px;
    height: 22px;
  }

  .pick-title {
    font-size: 0.9rem;
  }

  .pick-sub {
    font-size: 0.7rem;
  }
}

.ai-card {
  overflow: hidden;
}

.ai-card::before {
  content: "";
  position: absolute;
  inset: -1px 16px auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cat), transparent);
  opacity: 0.55;
  transition: opacity 0.25s;
}

.ai-card:hover::before,
.ai-card:focus-within::before {
  opacity: 1;
}

.ai-card:hover,
.ai-card:focus-within,
.card[style*="--cat"]:hover,
.card[style*="--cat"]:focus-within {
  border-color: color-mix(in srgb, var(--cat) 45%, transparent);
  box-shadow: 0 10px 40px -18px var(--cat);
}

.ai-logo {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  background: #f2f2f4;
  border-radius: 11px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.ai-logo img {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  object-fit: contain;
}

.ai-cat,
.cat-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: var(--cat);
  font-size: 0.75rem;
}

.ai-cat::before,
.cat-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cat);
}

.tag-hl {
  color: var(--muted);
  border-color: var(--line-strong);
}

.chip-cat::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  vertical-align: 0.12em;
  border-radius: 50%;
  background: var(--cat);
}

.chip-cat[aria-pressed="true"] {
  background: var(--cat);
  border-color: var(--cat);
}

.chip-cat[aria-pressed="true"]::before {
  background: #000;
}

/* ---------- Terminal page ---------- */

code,
kbd {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
}

p code,
p kbd,
.step-text code,
.step-text kbd,
figcaption kbd {
  padding: 1px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--fg);
}

/* Colors taken from the Brogrammer Terminal.app profile */
.term {
  --t-fg: #d6dbe5;
  --t-green: #2dc55e;
  --t-yellow: #ffcc3e;
  --t-red: #f8111a;
  --t-blue: #2a84d2;
  --t-cursor: #1eaa29;
  --t-ghost: #005f5f;

  max-width: 860px;
  margin: 0 auto;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.term-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding-inline: 14px;
  background: #1c1c1e;
  border-bottom: 1px solid #000;
}

.term-bar span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f57;
}

.term-bar span:nth-child(2) { background: #febc2e; }
.term-bar span:nth-child(3) { background: #28c840; }

.term-bar p {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #8e8e93;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.78rem;
  pointer-events: none;
}

.term-body {
  margin: 0;
  padding: 18px 20px 22px;
  overflow-x: auto;
  color: var(--t-fg);
  font-family: "LigaSFMono Nerd Font", "SF Mono", ui-monospace, Menlo, monospace;
  font-size: clamp(0.72rem, 2.4vw, 0.95rem);
  line-height: 1.55;
}

.term-body b { font-weight: 700; }
.t-fg { color: var(--t-fg); }
.t-green { color: var(--t-green); }
.t-yellow { color: var(--t-yellow); }
.t-red { color: var(--t-red); }
.t-blue { color: var(--t-blue); }
.t-ghost { color: var(--t-ghost); }

.t-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--t-cursor);
  animation: blink 1s steps(2) infinite;
}

.term figcaption {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.82rem;
}

.steps {
  display: grid;
  gap: 14px;
  max-width: 860px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 22px 22px 22px 76px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  counter-increment: step;
}

.step::before {
  content: counter(step);
  position: absolute;
  left: 22px;
  top: 20px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  color: var(--fg);
  font-family: var(--font-text);       /* Harting's digits sit below the centre of the circle */
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1;
}

.step h3 {
  font-size: 1.2rem;
}

.step-text {
  font-size: 0.9rem;
  line-height: 1.65;
}

.step-text b {
  color: var(--fg);
  font-weight: 400;
}

.step .btn {
  justify-self: start;
}

.step .card-cmd code {
  font-size: 0.8rem;
}

@media (max-width: 560px) {
  .step {
    padding: 64px 16px 18px;
  }

  .step::before {
    left: 16px;
    top: 16px;
  }
}

.code {
  max-width: 860px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.85rem;
}

.code-actions {
  display: flex;
  gap: 6px;
}

.code-actions .chip {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.code pre {
  max-height: 520px;
  margin: 0;
  padding: 18px 20px;
  overflow: auto;
  color: #d6dbe5;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  tab-size: 4;
}

.code pre .c { color: var(--dim); }

.code-body summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  list-style: none;
  transition: color 0.2s, background-color 0.2s;
}

.code-body summary::-webkit-details-marker {
  display: none;
}

.code-body summary::before {
  content: "▸";
  transition: transform 0.2s;
}

.code-body[open] summary::before {
  transform: rotate(90deg);
}

.code-body summary:hover {
  color: var(--fg);
  background: var(--surface-2);
}

.code-body[open] summary {
  border-bottom: 1px solid var(--line);
}

.aliases {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 10px;
  max-width: 860px;
  margin: 0 auto;
}

.aliases div {
  padding: 12px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.aliases dt {
  color: #2dc55e;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.95rem;
}

.aliases dd {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Terminal page: one-line installer above the steps */
.one-liner {
  display: grid;
  gap: 14px;
  max-width: 860px;
  margin: 0 auto 18px;
  padding: 22px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%), var(--surface);
  border: 1px dashed color-mix(in srgb, var(--accent) 70%, transparent);
  border-radius: var(--radius);
}

.one-liner h3 {
  margin-bottom: 6px;
  font-size: 1.2rem;
}

.one-liner a {
  color: var(--fg);
}

.one-liner .card-cmd code {
  font-size: 0.9rem;
}

/* ---------- "?" shortcuts panel (reuses the palette shell) ---------- */

.help-box {
  width: min(520px, 100%);
}

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 14px 18px;
  border-bottom: 1px solid var(--line);
}

.help-head h2 {
  font-size: 1.15rem;
}

.help-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
}

.help-list div {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
}

.help-list div:hover {
  background: var(--surface-2);
}

.help-list dt {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--dim);
}

.help-list dd {
  margin: 0;
  color: var(--text);
  font-size: 0.88rem;
}

.help-list kbd,
.help-head kbd {
  min-width: 24px;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--fg);
  font-family: var(--font-text);
  font-size: 0.78rem;
  text-align: center;
}

.help-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 520px) {
  .help-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ---------- "Build my Mac": pick buttons + Brewfile tray ---------- */

.card.is-pickable .card-top {
  padding-right: 40px;                 /* room for the + button */
}

/* Long single-word names (balenaEtcher, zsh-syntax-highlighting) must be able to
   shrink and wrap, or they run under the + button */
.card-top > div {
  min-width: 0;
}

.card-title {
  overflow-wrap: anywhere;
}

.pick-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;                          /* above the card's full-size link overlay */
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: #000;
  color: var(--dim);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s, transform 0.2s var(--ease);
}

.pick-btn svg {
  width: 14px;
  height: 14px;
}

.pick-btn .tick,
.card.is-picked .pick-btn .plus {
  display: none;
}

.card.is-picked .pick-btn .tick {
  display: block;
}

.pick-btn:hover {
  color: var(--fg);
  border-color: var(--fg);
  transform: scale(1.06);
}

.card.is-picked {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent) inset;
}

.card.is-picked .pick-btn {
  color: #fff;
  background: var(--accent);
  border-style: solid;
  border-color: var(--accent);
}

.brew-tray {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 42;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  width: min(760px, calc(100vw - 2 * var(--gutter)));
  padding: 12px 14px 12px 18px;
  background: rgba(11, 11, 12, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px dashed var(--accent);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s, visibility 0.25s, transform 0.3s var(--ease);
}

.brew-tray.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.brew-tray-info {
  display: grid;
  flex: 1 1 220px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.brew-tray-info b {
  color: var(--fg);
  font-weight: 500;
}

.brew-tray-info code {
  overflow: hidden;
  color: var(--dim);
  font-size: 0.75rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brew-tray-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-sm {
  min-height: 36px;
  padding: 7px 14px;
  font-size: 0.9rem;
}

.btn-accent {
  color: #fff;
  background: var(--accent);
  border-style: solid;
  border-color: var(--accent);
}

.btn-accent:hover {
  color: #fff;
  background: #e0464f;
  border-color: #e0464f;
}

/* Keep the end of the list reachable above the tray */
body.has-brew-tray .site-footer {
  padding-bottom: calc(200px + env(safe-area-inset-bottom));
}

@media (max-width: 600px) {
  .brew-tray {
    padding: 12px;
  }

  .brew-tray-actions {
    width: 100%;
  }

  .brew-tray-actions .btn {
    flex: 1;
  }
}

/* ---------- 404 maze ---------- */

.maze {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: 100%;
}

.maze-board {
  --cols: 29;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  width: min(100%, 640px);
  padding: 10px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  font-family: var(--font-text);
  font-size: min(calc((min(100vw - 2 * var(--gutter), 640px) - 22px) / var(--cols) * 0.95), 20px);
  line-height: 1;
  touch-action: none;                  /* swipes move the player, not the page */
  user-select: none;
  -webkit-user-select: none;
}

.maze-board span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  color: var(--dim);
}

.maze-board .is-wall {
  color: #3a3a3f;
  background: #141416;
}

.maze-board .is-trail {
  color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.maze-board .is-player {
  color: #fff;
  background: var(--accent);
  border-radius: 3px;
  font-weight: 500;
  box-shadow: 0 0 12px var(--accent);
}

.maze-board .is-exit {
  color: #2dc55e;
  animation: blink 1.2s ease-in-out infinite;
}

.maze.is-bump .maze-board {
  animation: bump 0.18s;
}

@keyframes bump {
  30% { transform: translateX(-3px); }
  70% { transform: translateX(3px); }
}

.maze.is-won .maze-board {
  border-color: #2dc55e;
  box-shadow: 0 0 40px rgba(45, 197, 94, 0.25);
}

.maze-status {
  min-height: 1.6em;
  color: var(--muted);
  font-size: 0.9rem;
}

.maze-pad {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-areas: ". up ." "left down right";
  gap: 6px;
}

.maze-pad button {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
}

.maze-pad [data-maze-dir="0,-1"] { grid-area: up; }
.maze-pad [data-maze-dir="-1,0"] { grid-area: left; }
.maze-pad [data-maze-dir="0,1"] { grid-area: down; }
.maze-pad [data-maze-dir="1,0"] { grid-area: right; }

/* Keyboard users don't need the pad */
@media (hover: hover) and (pointer: fine) {
  .maze-pad {
    display: none;
  }
}

/* ---------- 404 ---------- */

.not-found {
  min-height: calc(100svh - var(--header-h) - 140px);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 28px;
  padding-block: 48px;
  text-align: center;
}

.not-found .glitch-text {
  font-size: clamp(6rem, 30vw, 14rem);
}

/* ---------- Motion preferences ---------- */

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

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

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
