/* ==========================================================================
   Rodlip — landing page styles
   Two themes from one set of tokens:
     • Night sky (dark, default)  — the original rodlip.com black sky
     • Star atlas (light)         — the same sky printed in navy ink on paper
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Brand colours carried over from the old site */
  --void: #000000;        /* background */
  --starlight: #E8F0FF;   /* main text */
  --silver: #B8C6DB;      /* secondary text */
  --muted: #8D9BB3;       /* tertiary text, still 7:1 on black */
  --orbit: #3C9BD5;       /* links, orbits (PowerShell planet blue) */
  --navy: #1C2540;        /* planet bodies, quiet fills (C planet navy) */
  --amber: #FFB547;       /* the sun: interactive highlights and focus */
  --on-amber: #1A1100;

  --surface: #070B15;     /* demo windows */
  --surface-2: #0E1426;
  --line: rgba(184, 198, 219, 0.16);
  --line-strong: rgba(184, 198, 219, 0.32);

  /* Metallic wordmark stops; the darkest stop keeps 7:1 contrast */
  --metal: linear-gradient(100deg, #8D9BB3 0%, #FFFFFF 16%, #B8C6DB 32%, #E8F0FF 50%, #9AA9C2 66%, #FFFFFF 84%, #B8C6DB 100%);

  /* Type */
  --font-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Perfect-fourth scale on an 18px base */
  --step--1: 0.875rem;
  --step-0: 1.125rem;
  --step-1: 1.5rem;
  --step-2: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem);
  --step-3: clamp(2.1rem, 1.5rem + 2.6vw, 3.2rem);
  --step-hero: clamp(3.4rem, 1.2rem + 9vw, 8rem);

  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
  --radius-window: 12px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

/* Star atlas: light theme. Applied by OS preference unless the visitor picked night. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --void: #EEF2F8;
    --starlight: #14213D;
    --silver: #33415C;
    --muted: #4A5878;
    --orbit: #1F5F8B;
    --navy: #D5DEEC;
    --amber: #A65A00;
    --on-amber: #FFFFFF;
    --surface: #FFFFFF;
    --surface-2: #F5F7FB;
    --line: rgba(20, 33, 61, 0.14);
    --line-strong: rgba(20, 33, 61, 0.3);
    --metal: linear-gradient(100deg, #14213D 0%, #3C5A8A 18%, #14213D 36%, #2C4670 54%, #0B1730 72%, #3C5A8A 88%, #14213D 100%);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --void: #EEF2F8;
  --starlight: #14213D;
  --silver: #33415C;
  --muted: #4A5878;
  --orbit: #1F5F8B;
  --navy: #D5DEEC;
  --amber: #A65A00;
  --on-amber: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F5F7FB;
  --line: rgba(20, 33, 61, 0.14);
  --line-strong: rgba(20, 33, 61, 0.3);
  --metal: linear-gradient(100deg, #14213D 0%, #3C5A8A 18%, #14213D 36%, #2C4670 54%, #0B1730 72%, #3C5A8A 88%, #14213D 100%);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--void);
  color: var(--starlight);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  overflow-x: hidden;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
img, svg { display: block; }
[hidden] { display: none !important; } /* never let a component's display rule un-hide it */
button, input { font: inherit; color: inherit; }
code { font-family: var(--font-mono); font-size: 0.92em; }

a { color: var(--orbit); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--amber); color: var(--on-amber);
  padding: 0.6rem 1rem; border-radius: 6px; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* The sky canvas sits behind everything */
.sky {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  /* Solid-ish strip so nav text stays readable over the sky */
  background: color-mix(in srgb, var(--void) 82%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; gap: clamp(0.75rem, 3vw, 2rem);
  min-height: 3.75rem;
}
.nav__brand {
  font-family: var(--font-display); font-weight: 800; font-size: 1rem;
  color: var(--starlight); text-decoration: none; letter-spacing: 0.04em;
  margin-right: auto;
}
.nav__links { display: flex; gap: clamp(0.75rem, 3vw, 1.75rem); }
.nav__links a {
  color: var(--silver); text-decoration: none; font-size: var(--step--1);
  padding-block: 0.6rem; /* 44px tap target with line-height */
}
.nav__links a:hover { color: var(--starlight); }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: none; border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 0.45rem 0.85rem; min-height: 2.75rem; cursor: pointer;
  color: var(--silver); font-size: var(--step--1);
}
.theme-toggle:hover { color: var(--starlight); border-color: var(--silver); }
.theme-toggle__icon { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
@media (max-width: 30rem) {
  .theme-toggle__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .theme-toggle { padding: 0.45rem; width: 2.75rem; justify-content: center; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0.7rem 1.4rem;
  border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 700; font-size: var(--step-0); text-decoration: none; line-height: 1.2;
  cursor: pointer; transition: transform 0.15s var(--ease-out), background-color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--amber); color: var(--on-amber); }
.btn--primary:hover { background: color-mix(in srgb, var(--amber) 88%, var(--starlight)); text-decoration: none; }
.btn--ghost { color: var(--starlight); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--starlight); }
.btn--small { min-height: 2.75rem; padding: 0.5rem 1.1rem; font-size: var(--step--1); }

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
  min-height: calc(100svh - 3.75rem);
  padding-block: clamp(2.5rem, 6vw, 5rem);
}

/* The metallic wordmark from the old site, now with readable contrast */
.wordmark {
  position: relative;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-hero);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-left: -0.04em; /* optical alignment with the paragraph below */
  color: var(--starlight); /* fallback if background-clip isn't supported */
  background: var(--metal);
  background-size: 260% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* One sheen sweep on load; it repeats when you hover the name */
.is-loaded .wordmark { animation: sheen 2.6s var(--ease-out) 0.2s both; }
.wordmark:hover { animation: sheen 2.2s var(--ease-out) both; }
@keyframes sheen { from { background-position: 100% 50%; } to { background-position: 0% 50%; } }

.hero__lede {
  margin-top: 1.5rem;
  font-size: var(--step-1);
  line-height: 1.4;
  max-width: 30ch;
  color: var(--starlight);
}
.hero__role { margin-top: 1rem; color: var(--silver); max-width: 40ch; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

/* ---------- The orrery ----------
   Canvas (#orbits) draws the orbit lines and planet trails.
   Planets are real <button>s, positioned each frame by main.js through
   --x / --y / --size / --depth / --z, and lit from the sun via --lx / --ly. */
.orrery { position: relative; display: grid; gap: 1.1rem; justify-items: center; }
.orrery__system {
  position: relative;
  width: min(100%, 38rem);
  aspect-ratio: 1 / 0.6;
}
.orrery__orbits { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* The sun: a white-hot core, an orange body and a slowly turning corona */
.sun {
  position: absolute; left: 50%; top: 50%;
  width: 12%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 46% 44%, #FFFFFF 0%, #FFF4C9 18%, #FFC94D 46%, #FF8A1F 78%, #F25C05 100%);
  box-shadow:
    0 0 18px 4px rgba(255, 176, 60, 0.75),
    0 0 60px 18px rgba(255, 128, 32, 0.35),
    0 0 140px 50px rgba(255, 110, 20, 0.12);
  z-index: 50;
}
.sun__corona {
  position: absolute; inset: -55%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 196, 90, 0.55) 0deg 3deg, transparent 3deg 15deg);
  -webkit-mask: radial-gradient(circle, transparent 34%, #000 36%, transparent 70%);
          mask: radial-gradient(circle, transparent 34%, #000 36%, transparent 70%);
  filter: blur(2px);
  opacity: 0.55;
  animation: corona 60s linear infinite;
}
@keyframes corona { to { transform: rotate(360deg); } }
.orrery.is-nova .sun { animation: nova 1.2s ease-out; }
@keyframes nova { 35% { transform: translate(-50%, -50%) scale(2.6); filter: brightness(1.5) saturate(1.3); } }

/* Planets */
.planet {
  position: absolute; left: 0; top: 0;
  width: var(--size); height: var(--size);
  min-width: 44px; min-height: 44px;          /* hit area never under 44px */
  transform: translate(calc(var(--x, 0px) - 50%), calc(var(--y, 0px) - 50%)) scale(var(--depth, 1));
  display: grid; place-items: center;
  padding: 0; border: 0; background: none; cursor: pointer;
  z-index: var(--z, 1);
  -webkit-tap-highlight-color: transparent;
}
.planet__body {
  position: relative;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  display: grid; place-items: center;
  /* 1: specular highlight facing the sun  2: night side  3: the planet's colour(s) */
  background:
    radial-gradient(circle at var(--lx, 35%) var(--ly, 30%), rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.12) 22%, rgba(255, 255, 255, 0) 42%),
    radial-gradient(circle at var(--lx, 35%) var(--ly, 30%), rgba(0, 0, 0, 0) 38%, rgba(0, 0, 0, 0.5) 100%),
    linear-gradient(135deg, var(--c) 50%, var(--c2, var(--c)) 50%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 0 26px -2px color-mix(in srgb, var(--c) 65%, transparent);
  filter: brightness(var(--lit, 1));
  transition: box-shadow 0.25s;
}
.planet__body svg {
  width: 50%; height: 50%;
  fill: var(--g, #fff);
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.35));
}
/* Selected and focused planets get a ring in their own colour */
.planet[aria-pressed="true"] .planet__body,
.planet:hover .planet__body {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.3),
    0 0 0 3px var(--void),
    0 0 0 5px var(--c),
    0 0 34px 2px color-mix(in srgb, var(--c) 70%, transparent);
}
.planet:focus-visible { outline: none; }
.planet:focus-visible .planet__body {
  box-shadow: 0 0 0 3px var(--void), 0 0 0 6px var(--amber), 0 0 34px 2px color-mix(in srgb, var(--c) 70%, transparent);
}
.planet__name {
  position: absolute; top: 100%; left: 50%;
  transform: translate(-50%, 8px);
  padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; white-space: nowrap;
  color: var(--starlight);
  background: color-mix(in srgb, var(--void) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.planet:hover .planet__name,
.planet:focus-visible .planet__name,
.planet[aria-pressed="true"] .planet__name { opacity: 1; }

/* Legend: which orbit is which */
.orrery__legend ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 1.4rem; }
.orrery__legend li {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: var(--step--1); color: var(--muted); transition: color 0.2s;
}
.orrery__legend svg { width: 1.9rem; height: 1rem; overflow: visible; }
.orrery__legend ellipse { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.orrery__legend ellipse.on { stroke: var(--silver); stroke-width: 1.8; }
.orrery__legend li.is-active { color: var(--starlight); }
.orrery__legend li.is-active ellipse.on { stroke: var(--ring-c, var(--amber)); }

/* The card that explains the selected planet */
.planet-card {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.9rem;
  width: min(100%, 30rem);
  min-height: 5.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--void) 72%, transparent);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.planet-card__badge {
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 45%),
    linear-gradient(135deg, var(--c) 50%, var(--c2, var(--c)) 50%);
  box-shadow: 0 0 18px -2px color-mix(in srgb, var(--c) 60%, transparent);
}
.planet-card__badge svg { width: 52%; height: 52%; fill: var(--g, #fff); }
.planet-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.05rem; line-height: 1.2; }
.planet-card__ring { font-size: 0.75rem; color: var(--muted); margin-left: 0.4rem; font-family: var(--font-body); font-weight: 400; }
.planet-card p { color: var(--silver); font-size: var(--step--1); margin-top: 0.2rem; }
.planet-card__hint { grid-column: 1 / -1; color: var(--muted) !important; text-align: center; }

.orrery__controls {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: var(--step--1); color: var(--silver);
}
.orrery__controls label { margin-right: 0.25rem; }

/* Range inputs, styled once for the whole page */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 9rem; height: 2.75rem; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--line-strong); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-strong); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px;
  border-radius: 50%; background: var(--amber); border: 2px solid var(--void);
}
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--amber); border: 2px solid var(--void); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 45%, transparent); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 45%, transparent); }

/* ==========================================================================
   SECTIONS
   ========================================================================== */
.projects, .stack, .about, .contact { padding-block: clamp(4.5rem, 9vw, 8rem); }

h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.015em;
}
.section-intro { margin-top: 1rem; color: var(--silver); max-width: 60ch; }

/* ---------- Projects ---------- */
.project {
  display: grid; gap: 1.5rem;
  margin-top: clamp(3rem, 6vw, 5rem);
}
.project--wide { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; gap: clamp(1.5rem, 4vw, 3.5rem); }
.project--flip { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.project-pair {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3.5rem);
}
.project-pair .project { align-content: start; }
.project > *, .project-pair > * { min-width: 0; } /* let wide demo content scroll instead of stretching the grid */

.project h3 {
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--step-2); line-height: 1.1;
}
.project__pitch { margin-top: 0.85rem; max-width: 52ch; }
.project__status { margin-top: 1rem; color: var(--muted); font-size: var(--step--1); }
.project__links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin-top: 1rem; }
.project__links a { font-weight: 700; padding-block: 0.4rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.tags li {
  font-size: 0.8rem; line-height: 1;
  padding: 0.4rem 0.6rem; border-radius: 4px;
  color: var(--silver); border: 1px solid var(--line-strong);
}
.tags--quiet { margin-top: 0.6rem; }

/* Demo frames: each one borrows the chrome of its own platform */
.demo { position: relative; }
.demo__hint { margin-top: 0.7rem; font-size: var(--step--1); color: var(--muted); max-width: 60ch; }
.demo__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: 0.9rem; }
.demo__status { font-size: var(--step--1); color: var(--silver); }

/* ----- Patability: a dark game launcher ----- */
.pat__steps {
  display: flex; gap: 0.35rem; margin-bottom: 0.75rem;
  counter-reset: step; font-size: 0.8rem; color: var(--muted);
}
.pat__steps li { counter-increment: step; flex: 1; padding-top: 0.5rem; border-top: 3px solid var(--line); transition: border-color 0.3s, color 0.3s; }
.pat__steps li::before { content: counter(step) ". "; }
.pat__steps li.is-done { border-color: var(--orbit); color: var(--silver); }
.pat__steps li.is-now { border-color: var(--amber); color: var(--starlight); }

.pat__window {
  display: grid; grid-template-columns: 8.5rem 1fr;
  min-height: 15rem;
  border-radius: var(--radius-window);
  background: #0D1018; color: #E6E9F0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.pat__side { display: grid; align-content: start; gap: 0.2rem; padding: 0.9rem 0.6rem; background: #141824; font-size: 0.8rem; }
.pat__side-item { padding: 0.35rem 0.55rem; border-radius: 6px; color: #A9B0C2; }
.pat__side-item.is-on { background: #232A3D; color: #fff; }
.pat__main { position: relative; display: grid; align-content: start; gap: 0.6rem; padding: 1rem; font-size: 0.85rem; }
.pat__empty { color: #8C93A6; }
.pat__row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.6rem 0.75rem; border-radius: 8px; background: #171C29;
  animation: rowIn 0.35s var(--ease-out);
}
.pat__chip { background: #2D5DA8; color: #fff; padding: 0.15rem 0.55rem; border-radius: 999px; font-weight: 700; }
.pat__bar { flex: 0 0 40%; height: 6px; border-radius: 6px; background: #2A3042; overflow: hidden; }
.pat__bar > span { display: block; height: 100%; width: 0; background: #4FA3E0; transition: width 1.1s var(--ease-out); }
.pat__bar.is-full > span { width: 100%; }
.pat__library { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; animation: rowIn 0.35s var(--ease-out); }
.pat__tile {
  aspect-ratio: 3 / 4; border-radius: 8px;
  display: grid; align-items: end; padding: 0.45rem;
  background: linear-gradient(160deg, #3A4A7A, #1C2540); font-size: 0.72rem; font-weight: 700;
  transition: box-shadow 0.3s;
}
.pat__tile--ghost { background: #171C29; }
.pat__tile.is-playing { box-shadow: 0 0 0 2px #FFB547, 0 0 24px rgba(255, 181, 71, 0.4); }
.pat__game {
  position: absolute; left: 22%; right: 0.8rem; top: 0.8rem; bottom: 22%; border-radius: 8px;
  box-shadow: 0 18px 40px -8px rgba(0, 0, 0, 0.8);
  background: #05070C; border: 1px solid #2A3042; overflow: hidden;
  animation: rowIn 0.4s var(--ease-out);
}
/* A tiny ship bouncing around: the game "running" */
.pat__ship {
  position: absolute; width: 14px; height: 14px; background: #FFB547;
  clip-path: polygon(50% 0, 100% 100%, 50% 75%, 0 100%);
  animation: shipX 2.3s linear infinite alternate, shipY 1.7s linear infinite alternate;
}
.pat__game::before {
  content: "your-game.exe"; position: absolute; left: 0; right: 0; top: 0;
  padding: 0.25rem 0.5rem; font-size: 0.68rem; color: #A9B0C2; background: #141824;
}
@keyframes shipX { from { left: 4%; } to { left: 92%; } }
@keyframes shipY { from { top: 20%; } to { top: 86%; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } }

/* ----- GlassSnap: the one place glass is earned (the app is literally Liquid Glass) ----- */
.desk {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: var(--radius-window);
  background:
    radial-gradient(120% 80% at 20% 110%, #2E5FBF 0%, transparent 55%),
    radial-gradient(90% 70% at 90% -10%, #3C9BD5 0%, transparent 60%),
    #1C2540;
  user-select: none; -webkit-user-select: none;
}
.desk__picker {
  position: absolute; left: 50%; top: 5%;
  display: flex; gap: 0.4rem; padding: 0.4rem;
  transform: translate(-50%, -140%);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px) saturate(1.4); -webkit-backdrop-filter: blur(10px) saturate(1.4);
  transition: transform 0.28s var(--ease-out);
  z-index: 5;
}
.desk.is-picking .desk__picker { transform: translate(-50%, 0); }
.layout { position: relative; width: 3.4rem; aspect-ratio: 16 / 10; }
.layout span {
  position: absolute; border-radius: 3px;
  background: rgba(255, 255, 255, 0.28); border: 1.5px solid rgba(255, 255, 255, 0.55);
  /* positioned from data-zone by demos.js, inset by 1px gaps */
}
.layout span.is-hot { background: #FFB547; border-color: #FFF3D6; }
.desk__preview {
  position: absolute; border-radius: 8px; opacity: 0;
  background: rgba(255, 255, 255, 0.18); border: 1.5px solid rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.15s, left 0.2s var(--ease-out), top 0.2s var(--ease-out), width 0.2s var(--ease-out), height 0.2s var(--ease-out);
  pointer-events: none;
}
.desk__preview.is-on { opacity: 1; }
.win {
  position: absolute; left: 22%; top: 30%; width: 46%; height: 52%;
  display: grid; grid-template-rows: auto 1fr;
  border-radius: 8px; overflow: hidden;
  background: rgba(248, 250, 255, 0.92); color: #1C2540;
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.55);
  z-index: 3;
}
.win.is-snapping { transition: left 0.32s var(--ease-out), top 0.32s var(--ease-out), width 0.32s var(--ease-out), height 0.32s var(--ease-out); }
.win.is-dragging { opacity: 0.92; }
.win:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.win__bar {
  display: flex; align-items: center; gap: 5px; padding: 0.4rem 0.55rem;
  touch-action: none; /* only the title bar captures touch, so the page still scrolls over the desk */
  background: rgba(225, 231, 242, 0.95); font-size: 0.7rem; cursor: grab;
}
.win__bar:active { cursor: grabbing; }
.win__bar i { width: 9px; height: 9px; border-radius: 50%; background: #FF5F57; }
.win__bar i:nth-child(2) { background: #FEBC2E; }
.win__bar i:nth-child(3) { background: #28C840; }
.win__bar span { margin-left: auto; margin-right: auto; color: #4A5878; }
.win__body { display: grid; align-content: start; gap: 6px; padding: 0.7rem; }
.win__body b { height: 6px; border-radius: 3px; background: #CBD3E2; }
.win__body b:nth-child(2) { width: 80%; } .win__body b:nth-child(3) { width: 90%; } .win__body b:nth-child(4) { width: 55%; }

/* ----- Plip: a native Mac outline view ----- */
.plip {
  border-radius: var(--radius-window); overflow: hidden;
  background: #FFFFFF; color: #1D1D1F;
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 0.82rem;
  box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.6);
}
.plip__head, .plip__row { display: grid; grid-template-columns: minmax(0, 1.25fr) 5.5rem minmax(0, 1.1fr); align-items: center; }
.plip__head { padding: 0.45rem 0.75rem; background: #F2F2F5; color: #6E6E73; font-size: 0.72rem; border-bottom: 1px solid #E3E3E8; }
.plip__row { min-height: 2.1rem; padding: 0 0.75rem; border-bottom: 1px solid #F0F0F3; }
.plip__row:nth-child(even) { background: #FAFAFC; }
.plip__key { display: flex; align-items: center; gap: 0.25rem; padding-left: calc(var(--depth) * 1rem); font-weight: 700; min-width: 0; }
.plip__key span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plip__type { color: #6E6E73; }
.plip__val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 0.78rem; }
.plip__twisty {
  width: 1.6rem; height: 1.6rem; flex: none; border: 0; background: none; padding: 0; cursor: pointer;
  display: grid; place-items: center; color: #6E6E73; border-radius: 4px;
}
.plip__twisty::before { content: ""; border: 5px solid transparent; border-left: 7px solid currentColor; border-right: 0; transition: transform 0.2s var(--ease-out); }
.plip__twisty[aria-expanded="true"]::before { transform: rotate(90deg); }
.plip__twisty:focus-visible { outline: 2px solid #0A64D6; outline-offset: 0; }
.plip__spacer { width: 1.6rem; flex: none; }
/* Children collapse smoothly with the grid 0fr → 1fr trick */
.plip__kids { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.28s var(--ease-out); }
.plip__kids > div { overflow: hidden; }
.plip__kids.is-closed { grid-template-rows: 0fr; }
.plip__input {
  width: 100%; border: 1px solid #C7C7CC; border-radius: 5px; padding: 0.15rem 0.4rem;
  background: #fff; color: #1D1D1F; font-family: var(--font-mono); font-size: 0.78rem;
}
.plip__input:focus-visible { outline: 2px solid #0A64D6; outline-offset: 0; border-radius: 5px; }
.switch {
  position: relative; width: 2.1rem; height: 1.25rem; border-radius: 999px; border: 0; padding: 0; cursor: pointer;
  background: #D1D1D6; transition: background-color 0.2s;
}
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: calc(1.25rem - 4px); aspect-ratio: 1; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform 0.2s var(--ease-out); }
.switch[aria-checked="true"] { background: #34C759; }
.switch[aria-checked="true"]::after { transform: translateX(0.85rem); }
.switch:focus-visible { outline: 2px solid #0A64D6; outline-offset: 2px; }
.switch-wrap { display: inline-flex; align-items: center; gap: 0.4rem; }
.plip__foot { display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; padding: 0.5rem 0.75rem; background: #F2F2F5; border-top: 1px solid #E3E3E8; }
.plip__fmt-label { color: #6E6E73; font-size: 0.75rem; }
.seg { display: inline-flex; background: #E3E3E8; border-radius: 7px; padding: 2px; }
.seg button { border: 0; background: none; padding: 0.3rem 0.75rem; border-radius: 5px; font-size: 0.75rem; cursor: pointer; color: #1D1D1F; min-height: 2rem; }
.seg button[aria-checked="true"] { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); font-weight: 700; }
.seg button:focus-visible { outline: 2px solid #0A64D6; outline-offset: 1px; }
.plip__source {
  margin: 0; height: 11.5rem; overflow: auto;
  padding: 0.75rem; background: #1D1F27; color: #D8DEE9;
  font-family: var(--font-mono); font-size: 0.74rem; line-height: 1.5;
  white-space: pre; tab-size: 2;
}
.plip__source:focus-visible { outline: 3px solid var(--amber); outline-offset: -3px; border-radius: 0; }
.plip__source .x-tag { color: #8FBCDB; }
.plip__source .x-off { color: #949FB5; }
.plip__source .x-asc { color: #A3BE8C; }
.plip__source .x-new { background: rgba(255, 181, 71, 0.28); border-radius: 2px; }

/* ----- LowerYourVoice: a flat, square-cornered Windows panel ----- */
.lyv {
  position: relative; overflow: hidden;
  background: #F3F3F3; color: #1B1B1B;
  border: 1px solid #C9C9C9; border-radius: 8px;
  box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.6);
  font-family: "Segoe UI Variable", "Segoe UI", var(--font-body);
}
.lyv__titlebar { padding: 0.5rem 0.9rem; font-size: 0.78rem; background: #FFFFFF; border-bottom: 1px solid #E5E5E5; }
.lyv__body { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1.5rem; padding: 1.1rem; }
.lyv__meter {
  grid-column: 1 / -1; position: relative; height: 1.4rem; border-radius: 3px;
  background: #E1E1E1; overflow: hidden;
}
.lyv__fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #0F7B0F 0%, #0F7B0F 55%, #C29C00 75%, #C42B1C 100%);
  background-size: var(--meter-w, 100%) 100%;
  transition: width 0.08s linear;
}
.lyv__threshold { position: absolute; top: -2px; bottom: -2px; width: 3px; background: #1B1B1B; left: var(--thr, 58%); }
.lyv__readout { grid-column: 1 / -1; font-size: 0.8rem; color: #5F5F5F; margin-top: -0.4rem; font-variant-numeric: tabular-nums; }
.lyv__field { display: grid; gap: 0.1rem; font-size: 0.82rem; }
.lyv__field input[type="range"] { width: 100%; }
.lyv input[type="range"]::-webkit-slider-runnable-track { background: #8A8A8A; }
.lyv input[type="range"]::-moz-range-track { background: #8A8A8A; }
.lyv input[type="range"]::-webkit-slider-thumb { background: #005FB8; border-color: #fff; }
.lyv input[type="range"]::-moz-range-thumb { background: #005FB8; border-color: #fff; }
.lyv__scale { display: flex; justify-content: space-between; font-size: 0.72rem; color: #5F5F5F; margin-top: -0.6rem; }
.lyv__check { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; min-height: 2.75rem; cursor: pointer; }
.lyv__check input { width: 1.1rem; height: 1.1rem; accent-color: #005FB8; }
.lyv input:focus-visible { outline: 2px solid #1B1B1B; outline-offset: 2px; }
.lyv__toast {
  position: absolute; right: 0.8rem; top: 2.6rem; z-index: 2;
  max-width: 15rem; padding: 0.8rem 1rem;
  background: #C42B1C; color: #fff; border-radius: 6px; font-size: 0.85rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  animation: toastIn 0.35s var(--ease-out);
}
.lyv__toast strong { font-size: 1.1rem; display: block; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } }

/* ----- Also built ----- */
.also-title {
  margin-top: clamp(3.5rem, 7vw, 6rem);
  font-family: var(--font-display); font-weight: 500; font-size: var(--step-1);
}
.also {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem 2.5rem;
  margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
}
.also h4 { font-size: var(--step-0); }
.also p { margin-top: 0.35rem; color: var(--silver); font-size: var(--step--1); max-width: 40ch; }

/* ---------- Stack ---------- */
.stack__grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem 2.5rem;
  margin-top: 2.5rem;
}
.stack__group h3 {
  font-family: var(--font-display); font-weight: 500; font-size: 1.05rem;
  padding-bottom: 0.75rem; border-bottom: 2px solid var(--orbit);
}
.stack__group dl { display: grid; }
.stack__group dl > div { padding-block: 0.7rem; border-bottom: 1px solid var(--line); }
.stack__group dt { font-weight: 700; }
.stack__group dd { color: var(--muted); font-size: var(--step--1); }

/* ---------- About ---------- */
.about__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2rem clamp(2rem, 6vw, 5rem);
  margin-top: 2.5rem;
}
.about__story p { font-size: var(--step-1); line-height: 1.45; max-width: 34ch; }
.about__story p + p { margin-top: 1.25rem; font-size: var(--step-0); line-height: 1.55; color: var(--silver); max-width: 52ch; }
.about__work h3 { font-family: var(--font-display); font-weight: 500; font-size: var(--step-1); }
.about__job { margin-top: 0.35rem; color: var(--muted); }
.about__list { margin-top: 1.25rem; display: grid; gap: 0.85rem; }
.about__list li { position: relative; padding-left: 1.5rem; max-width: 60ch; }
/* Tiny orbit markers instead of bullets */
.about__list li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 0.55rem; height: 0.55rem; border-radius: 50%;
  border: 1.5px solid var(--orbit);
}

/* ---------- Contact + footer ---------- */
.contact { border-top: 1px solid var(--line); }
.contact__lede { margin-top: 1rem; font-size: var(--step-1); line-height: 1.4; max-width: 34ch; }
.todo {
  margin-top: 1.5rem; display: inline-block;
  padding: 0.5rem 0.8rem; border: 1.5px dashed var(--amber); border-radius: 6px;
  color: var(--amber); font-size: var(--step--1);
}
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem;
  padding-block: 2rem 3rem; color: var(--muted); font-size: var(--step--1);
  border-top: 1px solid var(--line);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 60rem) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 2.5rem; }
  .orrery { margin-top: 1rem; }
  .project--wide, .project--flip, .project-pair { grid-template-columns: minmax(0, 1fr); }
  .project .project__text { order: -1; } /* on one column, every project reads title → sketch */
  .project-pair .project { margin-top: clamp(3rem, 6vw, 5rem); }
  .project-pair { gap: 0; }
  .stack__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about__grid { grid-template-columns: 1fr; }
  .also { grid-template-columns: 1fr; }
}
@media (max-width: 34rem) {
  .nav__links { gap: 0.9rem; }
  .stack__grid { grid-template-columns: 1fr; }
  .pat__window { grid-template-columns: 1fr; }
  .pat__side { display: none; }
  .pat__steps { font-size: 0.72rem; }
  .lyv__body { grid-template-columns: 1fr; }
  .plip__head, .plip__row { grid-template-columns: minmax(0, 1.2fr) 4.2rem minmax(0, 1fr); }
  .orrery__controls input[type="range"] { width: 7rem; }
}

/* ==========================================================================
   REDUCED MOTION: everything still works, nothing drifts on its own
   ========================================================================== */
@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;
  }
  .pat__ship { left: 45%; top: 45%; }
}
