/* andrisetiawan.net — red/blue circuit theme, light and dark
   Background: the summit photo in its own colours, under a PCB circuit layer.
   Fonts: IBM Plex Sans, IBM Plex Sans Condensed, IBM Plex Mono (SIL OFL). */

@font-face {
  font-family: "Plex Sans";
  src: url("../fonts/plex-sans.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: "Plex Condensed";
  src: url("../fonts/plex-sans-condensed-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

/* ---------- themes ---------- */

/* Dark: dusk slate with blue #007BFF and red #E53935 (default, also without JS) */
:root {
  color-scheme: dark;
  --bg: #151a24;
  --panel: rgb(21 26 38 / .82);
  --panel-strong: rgb(12 16 26 / .6);
  --text: #eef0f5;
  --soft: #cfd5e2;
  --muted: #9aa3b8;
  --accent: #007bff;       /* blue: small highlights only */
  --neutral: #808080;      /* grey: typed roles, main button, icons */
  --sky: #e53935;          /* red: prompt */
  --sun: #e53935;          /* red: numbers, keys */
  --line: rgb(200 210 230 / .18);
  --on-accent: #ffffff;
  --logo: #007bff;
  --logo-badge: #eef3fa;
  --battery-full: #43a047;

  --shade-side: linear-gradient(90deg, rgb(14 18 28 / .86) 0%, rgb(14 18 28 / .55) 45%, rgb(14 18 28 / .15) 100%);
  --shade-bottom: linear-gradient(to bottom, rgb(14 18 28 / .1), rgb(14 18 28 / .45));
  --photo-filter: brightness(.85) saturate(.9);
  --grid: rgb(220 228 245 / .06);
  --grid-hi: rgb(0 123 255 / .35);
  --scanline: rgb(255 255 255 / .025);
  --beam: rgb(255 255 255 / .04);
  --vignette: rgb(0 0 0 / .55);
  --name-glow: 0 2px 28px rgb(0 0 0 / .45);

  /* read by the circuit canvas (r,g,b) */
  --trace: 220,228,245;
  --pulse-a: 0,123,255;
  --pulse-b: 229,57,53;
  --pulse-c: 236,236,244;
  --trace-alpha: .2;
}

/* Light: pale morning with the same blue and red */
[data-theme="light"] {
  color-scheme: light;
  --neutral: #808080;
  --bg: #f4f5f8;
  --panel: rgb(250 250 252 / .86);
  --panel-strong: rgb(234 237 244 / .9);
  --text: #1f2533;
  --soft: #3a4357;
  --muted: #5d667d;
  --accent: #007bff;
  --sky: #e53935;
  --sun: #e53935;
  --line: rgb(31 37 51 / .15);
  --on-accent: #ffffff;
  --logo: #007bff;
  --logo-badge: #ffffff;
  --battery-full: #2e7d32;

  --shade-side: linear-gradient(90deg, rgb(244 245 248 / .9) 0%, rgb(244 245 248 / .62) 45%, rgb(244 245 248 / .1) 100%);
  --shade-bottom: linear-gradient(to bottom, rgb(244 245 248 / 0), rgb(244 245 248 / .35));
  --photo-filter: brightness(1.04) saturate(.95);
  --grid: rgb(31 37 51 / .06);
  --grid-hi: rgb(0 123 255 / .28);
  --scanline: rgb(0 0 0 / .018);
  --beam: rgb(255 255 255 / .22);
  --vignette: rgb(120 126 140 / .22);
  --name-glow: 0 1px 0 rgb(255 255 255 / .6);

  --trace: 31,37,51;
  --pulse-a: 0,123,255;
  --pulse-b: 229,57,53;
  --pulse-c: 110,120,150;
  --trace-alpha: .22;
}

:root {
  --display: "Plex Condensed", "Arial Narrow", sans-serif;
  --sans: "Plex Sans", system-ui, sans-serif;
  --mono: "Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --hud-r: 10px;           /* rounded corner of HUD buttons */
  --wide: 72rem;
  --mx: -999px;
  --my: -999px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; overflow-x: clip; }
body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.65 var(--sans);
  transition: background-color 300ms ease, color 300ms ease;
}

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

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

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

.skip {
  position: fixed;
  left: var(--gutter);
  top: -4rem;
  z-index: 120;
  padding: .5rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  font: 500 .95rem var(--mono);
}
.skip:focus { top: 1rem; }

.ps1 { color: var(--sky); }
.cmd { color: var(--text); }

.caret {
  display: inline-block;
  width: .6em;
  height: 1.1em;
  margin-left: .15em;
  vertical-align: -.18em;
  background: var(--neutral);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- background stack ---------- */

.bg, .layer, .circuit {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.bg { z-index: 0; overflow: hidden; }
.bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
  filter: var(--photo-filter);
  transition: filter 300ms ease;
}

/* Shade only where text sits; the photo keeps its natural colours. */
.tint { z-index: 1; background: var(--shade-side), var(--shade-bottom); }

.grid, .grid-hi {
  z-index: 2;
  background-size: 40px 40px;
  background-position: center;
}
.grid {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 10%, transparent 75%);
          mask-image: radial-gradient(ellipse at center, #000 10%, transparent 75%);
}
/* Grid lights up around the pointer. */
.grid-hi {
  background-image:
    linear-gradient(var(--grid-hi) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-hi) 1px, transparent 1px);
  -webkit-mask-image: radial-gradient(circle 180px at var(--mx) var(--my), #000, transparent);
          mask-image: radial-gradient(circle 180px at var(--mx) var(--my), #000, transparent);
}

.circuit { z-index: 3; width: 100%; height: 100%; }

.scanlines { z-index: 4; background: repeating-linear-gradient(to bottom, var(--scanline) 0 1px, transparent 1px 3px); }
.beam {
  z-index: 4;
  inset: 0 0 auto 0;
  height: 30vh;
  background: linear-gradient(to bottom, transparent, var(--beam) 70%, transparent);
  animation: beam 10s linear infinite;
}
@keyframes beam { from { transform: translateY(-100%); } to { transform: translateY(440%); } }
.vignette { z-index: 4; background: radial-gradient(ellipse at center, transparent 50%, var(--vignette)); }

.topbar, main, .footer { position: relative; z-index: 10; }

/* ---------- loading screen ---------- */

/* Only shown when JS is running (theme-init.js adds .has-js before paint). */
.boot { display: none; }
.has-js .boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: var(--bg);
  color: var(--muted);
  font: 400 clamp(.8rem, 1.5vw, .95rem)/1.8 var(--mono);
  /* failsafe: never stays up longer than 6 s, even if JS is off */
  animation: boot-out 400ms ease 6s forwards;
  transition: opacity 450ms ease, visibility 0s linear 450ms;
}
.has-js .boot.is-done { opacity: 0; visibility: hidden; }
@keyframes boot-out { to { opacity: 0; visibility: hidden; } }

.boot-inner { display: grid; justify-items: center; gap: 1.5rem; width: min(26rem, 100%); }

/* loading-screen logo: no frame, just a soft glow that pulses blue → red */
.boot-logo {
  display: block;
  width: 88px;
  height: 88px;
  color: var(--logo);
  filter: drop-shadow(0 6px 24px rgb(0 123 255 / .35));
  animation: boot-pulse 1.6s ease-in-out infinite;
}
.boot-logo svg { width: 100%; height: 100%; }
@keyframes boot-pulse { 50% { filter: drop-shadow(0 6px 30px rgb(229 57 53 / .4)); } }

.boot-bar { width: 100%; height: 2px; background: var(--line); overflow: hidden; border-radius: 2px; }
.boot-bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--sun);   /* red loading bar */
  transform-origin: left;
  animation: boot-load 1.5s cubic-bezier(.4, 0, .2, 1) both;
}
@keyframes boot-load { from { transform: scaleX(0); } }

.boot-log { width: 100%; }
.boot-log p { margin: 0; opacity: 0; animation: boot-line 200ms ease forwards; }
.boot-log p:nth-child(1) { animation-delay: 150ms; }
.boot-log p:nth-child(2) { animation-delay: 450ms; }
.boot-log p:nth-child(3) { animation-delay: 750ms; }
.boot-log p:nth-child(4) { animation-delay: 1050ms; }
.boot-log p:nth-child(n+5) { animation-delay: 1300ms; }
@keyframes boot-line { to { opacity: 1; } }
.boot .ok { color: var(--accent); white-space: pre; }

/* ---------- top bar ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .9rem var(--gutter);
  transition: background-color 200ms ease, box-shadow 200ms ease;
}
.topbar.is-solid { background: var(--panel); backdrop-filter: blur(10px); box-shadow: 0 1px 0 var(--line); }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--text);
  font: 500 1rem var(--mono);
  text-decoration: none;
}
/* logo: just the blue head, no badge or frame */
.logo {
  display: block;
  width: 36px;
  height: 36px;
  flex: none;
  color: var(--logo);
}
.logo svg { width: 100%; height: 100%; }


.theme-toggle {
  margin-left: auto;
  flex: none;
  display: inline-grid;
  place-items: center;
  position: relative;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--hud-r);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.theme-toggle[hidden] { display: none; }
.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* show the icon of the theme you would switch TO */
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ---------- floating music button (bottom left, icon only) ---------- */

.music {
  position: fixed;
  left: clamp(1rem, 3vw, 1.75rem);
  bottom: clamp(1rem, 3vw, 1.75rem);
  z-index: 60;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--hud-r);
  background: var(--panel);
  color: var(--neutral);
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 24px rgb(0 0 0 / .2);
}
.music[hidden] { display: none; }
.music > * { grid-area: 1 / 1; }
.music .icon-note {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wave { display: none; align-items: center; gap: 3px; height: 20px; }
.wave i { width: 3px; height: 5px; border-radius: 2px; background: var(--neutral); }
.wave i:nth-child(even) { background: var(--sun); }
.music[aria-pressed="true"] .icon-note { display: none; }
.music[aria-pressed="true"] .wave { display: inline-flex; }
.music[aria-pressed="true"] .wave i { animation: wave 800ms ease-in-out infinite alternate; }
.music[aria-pressed="true"] .wave i:nth-child(2) { animation-delay: -200ms; }
.music[aria-pressed="true"] .wave i:nth-child(3) { animation-delay: -500ms; }
.music[aria-pressed="true"] .wave i:nth-child(4) { animation-delay: -650ms; }
@keyframes wave { to { height: 20px; } }

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

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 6rem var(--gutter) 4rem;
}

.hero-inner {
  position: relative;
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3.25rem) clamp(2rem, 5vw, 3.5rem);
}

/* HUD corner brackets */
.corner {
  position: absolute;
  width: clamp(14px, 2.2vw, 24px);
  height: clamp(14px, 2.2vw, 24px);
  border: 0 solid var(--accent);
}
.corner.tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.corner.tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; border-color: var(--line); }
.corner.bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; border-color: var(--line); }
.corner.br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

.prompt {
  margin: 0 0 .75rem;
  font: 400 clamp(.8rem, 1.2vw, .9rem)/1.5 var(--mono);
  color: var(--muted);
}

.name {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 9vw, 7rem);
  line-height: .92;
  letter-spacing: -.01em;
  text-shadow: var(--name-glow);
}

.roles {
  margin: 1.1rem 0 0;
  min-height: 1.6em;
  color: var(--neutral);
  font: 500 clamp(.95rem, 2vw, 1.35rem)/1.4 var(--mono);
}
.roles-arrow { color: var(--sun); margin-right: .4em; }

.tagline {
  max-width: 34em;
  margin: 1.5rem 0 0;
  color: var(--soft);
  font-size: clamp(.95rem, 1.4vw, 1.1rem);
  line-height: 1.6;
}

.hero-next {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  margin-top: 2.25rem;
  padding: .7rem 1.2rem;
  border-radius: 999px;
  background: var(--neutral);
  color: #ffffff;
  font: 500 .95rem var(--mono);
  text-decoration: none;
  transition: filter 160ms ease;
}
.hero-next::after {
  content: "";
  width: .5rem;
  height: .5rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.hero-next:hover { filter: brightness(1.1); }

/* entrance: one sequence for the hero */
@media (prefers-reduced-motion: no-preference) {
  .hero-inner > :not(.corner) { animation: rise 800ms cubic-bezier(.2, .7, .1, 1) both; }
  .hero-inner > .name      { animation-delay: 120ms; }
  .hero-inner > .roles     { animation-delay: 240ms; }
  .hero-inner > .tagline   { animation-delay: 360ms; }
  .hero-inner > .term      { animation-delay: 480ms; }
  .hero-inner > .hero-next { animation-delay: 600ms; }
  .corner { animation: lock 900ms cubic-bezier(.2, .8, .2, 1) 150ms both; }
  .corner.tl { --dx: -14px; --dy: -14px; }
  .corner.tr { --dx: 14px;  --dy: -14px; }
  .corner.bl { --dx: -14px; --dy: 14px; }
  .corner.br { --dx: 14px;  --dy: 14px; }
  .is-loading .hero-inner > *, .is-loading .corner { animation-play-state: paused; }
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes lock { from { opacity: 0; transform: translate(var(--dx), var(--dy)); } }

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

.content {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--gutter) 4rem;
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

.panel {
  position: relative;
  padding: clamp(2rem, 5vw, 3.5rem);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  transition: background-color 300ms ease;
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 0 solid var(--accent);
}
.panel::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 6px; }
.panel::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 6px; }

.panel h2 {
  margin: 0 0 1.75rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1;
  letter-spacing: -.005em;
}

/* about */
.about-text p { margin: 0 0 1rem; max-width: 40em; font-size: 1rem; color: var(--soft); }
.about-text p:first-child { font-size: clamp(1.05rem, 1.6vw, 1.2rem); line-height: 1.55; color: var(--text); }

.release {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem 1.4rem;
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--panel-strong);
  font: 400 .85rem/1.75 var(--mono);
}
.release-cmd { margin: 0 0 .5rem; color: var(--muted); }
.release dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
  gap: 0 2rem;
  margin: 0;
}
.release dt { display: inline; color: var(--sun); }
.release dt::after { content: "="; color: var(--muted); }
.release dd { display: inline; margin: 0; color: var(--text); }

/* work */
.work {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr));
  gap: 2rem clamp(1.5rem, 4vw, 3rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.work li { padding-top: 1rem; border-top: 1px solid var(--line); }
.work h3 { margin: 0 0 .4rem; color: var(--text); font: 500 .95rem var(--mono); }
.work p { margin: 0; color: var(--soft); }

/* links + email */
.links-text { max-width: 36em; margin: 0 0 1.5rem; color: var(--soft); font-size: 1rem; }
.links { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0; padding: 0; list-style: none; }
.links a, .email-reveal {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--hud-r);
  background: transparent;
  color: var(--neutral);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}
.email-reveal[hidden] { display: none; }
.links a:hover, .email-reveal:hover { border-color: var(--accent); color: var(--accent); background: var(--panel-strong); }
.links svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* after reveal: the address itself, normal size */
.links .email-link {
  display: inline-flex;
  gap: .55rem;
  width: auto;
  height: 50px;
  padding: 0 1.1rem 0 .9rem;
  border-radius: var(--hud-r);
  color: var(--text);
  font: 400 .85rem var(--mono);
  text-decoration: none;
}
.links .email-link svg { color: var(--neutral); }

/* footer */
.footer {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1rem var(--gutter) 6rem;   /* room for the floating music button */
  color: var(--muted);
  font: 400 .8rem/1.7 var(--mono);
}
.footer p { margin: 0; }
.footer-exit { margin-top: .4rem !important; }

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .wordmark-text { font-size: .95rem; }
  .tint { background: var(--shade-side), var(--shade-bottom); }
  :root { --shade-side: linear-gradient(rgb(14 18 28 / .7), rgb(14 18 28 / .7)); }
  [data-theme="light"] { --shade-side: linear-gradient(rgb(244 245 248 / .78), rgb(244 245 248 / .78)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .boot-log p { opacity: 1; }
  .has-js .boot.is-done { display: none; }
}

/* ---------- error page ---------- */

.error-page .hero-inner { max-width: 52rem; }
.error-page .name { font-size: clamp(5rem, 16vw, 10rem); }

.bg picture { display: contents; }

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

.term {
  max-width: 40rem;
  margin-top: 1.75rem;
  padding: .85rem 1rem .7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  backdrop-filter: blur(6px);
  font: 400 .85rem/1.6 var(--mono);
}
.term[hidden] { display: none; }
.term-out { max-height: 14rem; overflow-y: auto; overscroll-behavior: contain; }
.term-out:empty { display: none; }
.term-out p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--soft); }
.term-out .t-cmd { color: var(--muted); }
.term-out .t-cmd .ps1 { color: var(--sky); }
.term-out .t-err { color: var(--sun); }
.term-out .t-ok { color: var(--accent); }
.term-out a { color: var(--accent); }
.term-out:not(:empty) + .term-line { margin-top: .5rem; }
.term-line { display: flex; align-items: center; gap: .6rem; cursor: text; }
.term-in {
  flex: 1;
  min-width: 0;
  padding: .2rem 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  caret-color: var(--accent);
}
.term-in::placeholder { color: var(--muted); opacity: .8; }
.term-in:focus { outline: none; }
.term:focus-within { border-color: var(--neutral); }

/* ---------- battery = scroll progress ---------- */

.battery {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  color: var(--muted);
  font: 500 .8rem var(--mono);
}
.battery[hidden] { display: none; }
.battery + .theme-toggle { margin-left: .9rem; }
.battery-body {
  position: relative;
  width: 30px;
  height: 15px;
  padding: 2px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}
.battery-fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 1px;
  background: var(--sun);
  transition: width 120ms linear, background-color 200ms ease;
}
.battery.is-ok .battery-fill { background: var(--neutral); }
.battery.is-full .battery-fill { background: var(--battery-full); }
.battery.is-low .battery-body, .battery.is-low .battery-tip { animation: low-batt 1s steps(1) infinite; }
@keyframes low-batt { 50% { opacity: .45; } }
/* truly empty (0%): whole icon turns red and blinks fast */
.battery.is-empty { color: var(--sun); }
.battery.is-empty .battery-body, .battery.is-empty .battery-tip, .battery.is-empty .battery-pct { animation: empty-batt .4s steps(1) infinite; }
@keyframes empty-batt { 50% { opacity: .15; } }
.battery-tip { width: 3px; height: 6px; margin-left: 1px; border-radius: 0 1px 1px 0; background: currentColor; }
.battery-pct { min-width: 4ch; margin-left: .45rem; text-align: right; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: clamp(1rem, 3vw, 1.75rem);
  z-index: 90;
  max-width: min(32rem, calc(100vw - 8rem));
  padding: .7rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgb(0 0 0 / .25);
  color: var(--text);
  font: 400 .85rem/1.5 var(--mono);
  transform: translate(-50%, 0);
  transition: opacity 250ms ease, transform 250ms ease;
}
.toast[hidden] { display: block; visibility: hidden; opacity: 0; transform: translate(-50%, 12px); }
.toast.is-warn { border-left-color: var(--sun); }

/* phones: one line, beside the music button */
@media (max-width: 640px) {
  .toast {
    /* from just right of the music button (its left offset + 50px + .5rem gap)
       to .5rem before the right edge of the screen; never on top of the button */
    left: calc(clamp(1rem, 3vw, 1.75rem) + 50px + .5rem);
    right: .5rem;
    bottom: clamp(1rem, 3vw, 1.75rem);
    width: auto;
    max-width: none;
    height: 50px;
    padding: 0 .55rem;
    line-height: 48px;   /* 50px minus the 1px borders: text centred like the music icon */
    font-size: clamp(.62rem, 3vw, .78rem);
    white-space: nowrap;   /* one line: JS shrinks the font until the text fits */
    overflow: hidden;
    transform: none;
  }
  .toast[hidden] { display: block; transform: translateY(12px); }
}

/* ---------- what this website knows about you ---------- */

.you-text { max-width: 40em; margin: 0 0 1.75rem; color: var(--soft); }
.you {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
  gap: 1rem 2rem;
  margin: 0;
}
.you:empty::before { content: attr(data-empty); color: var(--muted); font-style: italic; }
.you div { padding-top: .6rem; border-top: 1px solid var(--line); }
.you dt { color: var(--muted); font: 400 .78rem var(--mono); }
.you dd { margin: .15rem 0 0; color: var(--text); font: 500 .9rem/1.4 var(--mono); overflow-wrap: anywhere; }
.you dd.is-good { color: var(--accent); }
.you dd.is-bad { color: var(--sun); }

/* request headers the browser sent (built by youPanel() in site.js) */
.you-headers { margin-top: 1.75rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.you-headers summary { cursor: pointer; color: var(--muted); font: 400 .78rem var(--mono); }
.you-headers summary:hover, .you-headers[open] summary { color: var(--text); }
.you-headers summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.you-headers pre {
  margin: .75rem 0 0; padding: 1rem; max-height: 22rem; overflow: auto;
  background: rgb(127 127 127 / .12); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); font: 400 .8rem/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.you-headers pre b { color: var(--sun); font-weight: 500; }
.you-note { margin: .6rem 0 0; color: var(--muted); font-size: .8rem; }

@media (max-width: 640px) {
  .battery-pct { display: none; }
}

.error-status { color: var(--sun); margin-top: -.4rem; }
.error-home::after { transform: rotate(135deg); }

/* ---------- HUD buttons: rounded box with two corner brackets ----------
   Used by the theme toggle, music button, social icons and the email button. */

.theme-toggle::before, .theme-toggle::after,
.music::before, .music::after,
.links a::before, .links a::after,
.email-reveal::before, .email-reveal::after,
.email-copy::before, .email-copy::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  border: 0 solid var(--accent);
  pointer-events: none;
  transition: transform 180ms ease, border-color 180ms ease;
}
.theme-toggle::before, .music::before, .links a::before, .email-reveal::before, .email-copy::before {
  top: -1px;
  left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
  border-top-left-radius: var(--hud-r);
}
.theme-toggle::after, .music::after, .links a::after, .email-reveal::after, .email-copy::after {
  right: -1px;
  bottom: -1px;
  border-right-width: 2px;
  border-bottom-width: 2px;
  border-bottom-right-radius: var(--hud-r);
  border-color: var(--neutral);
}

/* hover / focus: brackets lock outward, box lights up */
.theme-toggle:hover, .music:hover, .links a:hover, .email-reveal:hover,
.theme-toggle:focus-visible, .music:focus-visible, .links a:focus-visible, .email-reveal:focus-visible,
.email-copy:hover, .email-copy:focus-visible {
  border-color: var(--line);
  background: var(--panel-strong);
  color: var(--accent);
}
.theme-toggle:hover::before, .music:hover::before, .links a:hover::before, .email-reveal:hover::before,
.theme-toggle:focus-visible::before, .music:focus-visible::before, .links a:focus-visible::before, .email-reveal:focus-visible::before,
.email-copy:hover::before, .email-copy:focus-visible::before {
  transform: translate(-3px, -3px);
}
.theme-toggle:hover::after, .music:hover::after, .links a:hover::after, .email-reveal:hover::after,
.theme-toggle:focus-visible::after, .music:focus-visible::after, .links a:focus-visible::after, .email-reveal:focus-visible::after,
.email-copy:hover::after, .email-copy:focus-visible::after {
  transform: translate(3px, 3px);
}
/* playing music: brackets stay locked out */
.music[aria-pressed="true"]::before { transform: translate(-3px, -3px); }
.music[aria-pressed="true"]::after { transform: translate(3px, 3px); }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  body { font-size: .9375rem; }
  .term { font-size: .78rem; padding: .7rem .8rem .6rem; }
  .term-out { max-height: 11rem; }
  /* iOS zooms into inputs under 16px: the input stays 16px but is drawn at 13px */
  .term-line { overflow: hidden; }
  .term-in { font-size: 16px; transform: scale(.78); transform-origin: 0 50%; margin-right: -28.3%; }
  .tagline { font-size: .9rem; }
  .about-text p, .links-text, .you-text { font-size: .9375rem; }
  .about-text p:first-child { font-size: 1rem; }
  .panel { padding: 1.5rem 1.25rem; }
  .panel h2 { margin-bottom: 1.25rem; }
  .release { padding: 1rem; }
  .release dl { font-size: .78rem; }
  .you dd { font-size: .85rem; }
  .footer { font-size: .75rem; }
}

/* email copy button (appears after the address is revealed) */
.email-item { display: flex; gap: .75rem; flex-wrap: wrap; }
.email-copy {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--hud-r);
  background: transparent;
  color: var(--neutral);
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}
.email-copy svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.email-copy .icon-check { display: none; }
.email-copy.is-copied { color: var(--accent); }
.email-copy.is-copied .icon-copy { display: none; }
.email-copy.is-copied .icon-check { display: block; }
.visually-hidden-copy { position: fixed; top: -100px; left: 0; width: 1px; height: 1px; opacity: 0; }
