/* Fonts: Monocraft (Minecraft-style) and Pixelify Sans, self-hosted (SIL OFL, see assets/fonts/) */
@font-face {
  font-family: "Monocraft";
  src: url("assets/fonts/Monocraft.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Monocraft";
  src: url("assets/fonts/Monocraft-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("assets/fonts/PixelifySans-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

/* Accent palettes. acc-d is used on dark backgrounds, acc-l on light ones.
   Each pair passes WCAG AA against its background and its button text. */
:root, :root[data-accent="diamond"] { --acc-d: #4fd6e0; --acc-l: #0e7490; --ink-d: #04191c; }
:root[data-accent="emerald"]  { --acc-d: #3ee08a; --acc-l: #10743f; --ink-d: #04190d; }
:root[data-accent="amethyst"] { --acc-d: #c08cff; --acc-l: #7a3fd6; --ink-d: #1a0b30; }
:root[data-accent="lapis"]    { --acc-d: #6f9dff; --acc-l: #2350d6; --ink-d: #06122e; }
:root[data-accent="redstone"] { --acc-d: #ff5c6c; --acc-l: #c0263f; --ink-d: #2b050b; }
:root[data-accent="gold"]     { --acc-d: #ffd04d; --acc-l: #8a6500; --ink-d: #241a00; }
:root[data-accent="copper"]   { --acc-d: #ff9a5a; --acc-l: #b04a10; --ink-d: #2a1203; }

/* Tokens. Dark is the default look; light follows the system or the toggle. */
:root {
  --bg: #090c14;
  --surface: #10151f;
  --surface-2: #171e2c;
  --line: #263048;
  --edge: #03050a;
  --text: #e7edf7;
  --muted: #a0abc0;
  --accent: var(--acc-d);
  --accent-ink: var(--ink-d);
  --accent-soft: color-mix(in srgb, var(--acc-d) 14%, transparent);
  --accent-shadow: color-mix(in srgb, var(--acc-d) 26%, #000);
  --text-shadow: color-mix(in srgb, var(--text) 18%, #000);
  --bevel-hi: rgb(255 255 255 / 0.3);
  --bevel-lo: rgb(0 0 0 / 0.4);
  --code-kw: var(--acc-d);
  --code-fn: #e7edf7;
  --code-str: #e3c27a;
  --code-var: #8fc4e8;
  --code-num: #e39a7a;

  --radius: 0;
  --wrap: 74rem;
  --gutter: 1.5rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --mc: "Monocraft", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --body: "Pixelify Sans", "Monocraft", ui-sans-serif, system-ui, sans-serif;
  --tap: 2.75rem; /* 44px minimum touch target */

  /* z-index scale */
  --z-nav: 20;
  --z-skip: 30;
  --z-toast: 40;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eef2f8;
  --surface: #ffffff;
  --surface-2: #e0e7f1;
  --line: #c5cfdf;
  --edge: #232c3d;
  --text: #0e1422;
  --muted: #465064;
  --accent: var(--acc-l);
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--acc-l) 12%, transparent);
  --accent-shadow: color-mix(in srgb, var(--acc-l) 20%, var(--bg));
  --text-shadow: color-mix(in srgb, var(--text) 14%, var(--bg));
  --bevel-hi: rgb(255 255 255 / 0.55);
  --bevel-lo: rgb(0 0 0 / 0.22);
  --code-kw: var(--acc-l);
  --code-fn: #0e1422;
  --code-str: #8a5a00;
  --code-var: #1d5f8f;
  --code-num: #a34a26;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef2f8;
    --surface: #ffffff;
    --surface-2: #e0e7f1;
    --line: #c5cfdf;
    --edge: #232c3d;
    --text: #0e1422;
    --muted: #465064;
    --accent: var(--acc-l);
    --accent-ink: #ffffff;
    --accent-soft: color-mix(in srgb, var(--acc-l) 12%, transparent);
    --accent-shadow: color-mix(in srgb, var(--acc-l) 20%, var(--bg));
    --text-shadow: color-mix(in srgb, var(--text) 14%, var(--bg));
    --bevel-hi: rgb(255 255 255 / 0.55);
    --bevel-lo: rgb(0 0 0 / 0.22);
    --code-kw: var(--acc-l);
    --code-fn: #0e1422;
    --code-str: #8a5a00;
    --code-var: #1d5f8f;
    --code-num: #a34a26;
    color-scheme: light;
  }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth; scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  caret-color: var(--accent); scrollbar-color: var(--line) var(--bg);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 {
  margin: 0; font-family: var(--mc); font-weight: 700; line-height: 1.15;
  letter-spacing: 0; text-wrap: balance;
  text-shadow: 0.08em 0.08em 0 var(--text-shadow);
}
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font: inherit; color: inherit; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.code__body { scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
html:not(.js) .js-only { display: none !important; }

.wrap {
  width: 100%; max-width: var(--wrap); margin: 0 auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: var(--z-skip);
  background: var(--accent); color: var(--accent-ink);
  padding: 0.625rem 0.875rem; font: 700 0.875rem/1 var(--mc);
}
.skip:focus { top: 1rem; }

/* Minecraft-style raised controls: dark outline plus a light top-left and dark bottom-right bevel. */
.btn, .icon-btn {
  border: 2px solid var(--edge); border-radius: var(--radius);
  box-shadow: inset 2px 2px 0 var(--bevel-hi), inset -2px -3px 0 var(--bevel-lo);
  cursor: pointer;
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease), border-color 0.15s var(--ease),
    background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.btn:active, .icon-btn:active {
  transform: translateY(2px);
  box-shadow: inset -2px -2px 0 var(--bevel-hi), inset 2px 3px 0 var(--bevel-lo);
}
.btn {
  display: inline-flex; align-items: center; gap: 0.625rem;
  min-height: 3rem; padding: 0 1.25rem;
  font: 700 0.9375rem/1 var(--mc); white-space: nowrap;
}
.btn .ph { font-size: 1.125rem; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: var(--surface-2); color: var(--text); }
.btn--sm { min-height: 2.5rem; padding: 0 0.875rem; font-size: 0.8125rem; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 2.5rem; height: 2.5rem; padding: 0;
  background: var(--surface-2); color: var(--text); font-size: 1.125rem;
}
.icon-btn[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); }

@media (hover: hover) and (pointer: fine) {
  .btn:hover, .icon-btn:hover { border-color: var(--text); }
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: var(--z-nav);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 2px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.nav__inner { height: 4rem; display: flex; align-items: center; gap: 2rem; }
.logo {
  font: 700 1.375rem/1 var(--mc); color: var(--text);
  text-shadow: 0.1em 0.1em 0 var(--text-shadow);
}
.logo--sm { font-size: 1.0625rem; }
.nav__links { display: flex; gap: 1.75rem; margin-right: auto; }
.nav__links a { color: var(--muted); font: 400 0.875rem/1 var(--mc); padding: 0.5rem 0; transition: color 0.2s; }
.nav__links a:hover { color: var(--text); }
.nav__actions { display: flex; align-items: center; gap: 0.625rem; }
.menu-btn { display: none; }

/* Accent color picker */
.accent-picker { position: relative; }
.accent-menu {
  position: absolute; top: calc(100% + 0.625rem); right: 0;
  display: grid; grid-template-columns: repeat(7, 2rem); gap: 0.5rem;
  padding: 0.75rem; border: 2px solid var(--edge); background: var(--surface);
  box-shadow: 0 0.75rem 2rem color-mix(in srgb, var(--bg) 70%, transparent);
  transform-origin: top right;
}
.accent-menu[hidden] { display: none; }
.swatch {
  width: 2rem; height: 2rem; padding: 0; cursor: pointer;
  background: var(--sw); border: 2px solid var(--edge); border-radius: var(--radius);
  box-shadow: inset 2px 2px 0 rgb(255 255 255 / 0.35), inset -2px -2px 0 rgb(0 0 0 / 0.3);
  forced-color-adjust: none;
  transition: transform 0.15s var(--ease), outline-color 0.15s var(--ease);
}
.swatch[aria-checked="true"] { outline: 3px solid var(--text); outline-offset: 2px; }

/* Hero */
.hero {
  padding: 4.5rem 0 5rem; display: flex; align-items: center;
  min-height: calc(100vh - 8rem); min-height: calc(100dvh - 8rem);
}
.hero__grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 3.5rem; align-items: center; }
.hero__title { font-size: clamp(2.5rem, 5.4vw, 4.5rem); line-height: 1.1; }
.hero__title em { font-style: normal; color: var(--accent); text-shadow: 0.08em 0.08em 0 var(--accent-shadow); }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto; height: 80%; pointer-events: none;
  background: radial-gradient(50% 60% at 70% 30%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}
.hero__sub { margin-top: 1.5rem; font-size: 1.1875rem; color: var(--muted); max-width: 44ch; }
.hero__ctas { margin-top: 2.25rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* Typed headline: script.js wraps each character in a span; the block cursor blinks after the last one. */
.type-char { display: inline-block; white-space: pre; }
.type-cursor {
  display: inline-block; width: 0.55em; height: 0.12em; margin-left: 0.08em;
  background: currentColor; vertical-align: baseline; color: var(--text);
  box-shadow: 0.08em 0.08em 0 var(--text-shadow);
}

/* Code block (real Skript and Java) */
.code { margin: 0; background: var(--surface); border: 2px solid var(--line); overflow: hidden; }
.code__tabs { display: flex; border-bottom: 2px solid var(--line); overflow-x: auto; }
.code__tab {
  display: flex; align-items: center; gap: 0.5rem;
  min-height: var(--tap); padding: 0 1.125rem; margin-bottom: -2px;
  font: 400 0.8125rem/1 var(--mc); color: var(--muted);
  background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.code__tab:hover { color: var(--text); }
.code__tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); background: var(--surface-2); }
.code__tab .ph { font-size: 1rem; }
.code__tab[aria-selected="true"] .ph { color: var(--accent); }
.code__body {
  margin: 0; padding: 1.125rem 0; overflow-x: auto; min-height: calc(16 * 1.75em + 2.25rem);
  font: 400 0.8125rem/1.75 var(--mc); color: var(--muted); tab-size: 4;
  counter-reset: line;
}
.code__body[hidden] { display: none; }
.code__body:focus-visible { outline-offset: -3px; }
.code__body code { display: block; min-width: max-content; white-space: normal; }
.ln { display: block; padding: 0 1.25rem 0 0; white-space: pre; }
.ln::before {
  counter-increment: line; content: counter(line);
  display: inline-block; width: 3.4em; padding-right: 1.2em; text-align: right;
  color: color-mix(in srgb, var(--muted) 55%, transparent); user-select: none;
}
.kw { color: var(--code-kw); font-weight: 700; }
.fn { color: var(--code-fn); font-weight: 700; }
.str { color: var(--code-str); }
.var { color: var(--code-var); }
.num { color: var(--code-num); }

/* Tools strip */
.tools { border-block: 2px solid var(--line); padding: 1.25rem 0; }
.tools__list { display: flex; flex-wrap: wrap; gap: 0.625rem 2rem; }
.tools__list li { font: 400 0.875rem/1.4 var(--mc); color: var(--muted); white-space: nowrap; }
.tools__list li:first-child { color: var(--text); }

/* Sections */
.section { padding: 7rem 0; }
.section__title { font-size: clamp(1.75rem, 3.4vw, 2.625rem); max-width: 20ch; }

/* Servers: 2 items, 2 cells */
.bento {
  margin-top: 3rem;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem;
}
.tile {
  position: relative; overflow: hidden;
  border: 2px solid var(--line);
  padding: 1.75rem; display: flex; flex-direction: column; gap: 1.75rem;
  background: var(--surface);
  transition: border-color 0.2s var(--ease);
}
.tile > * { position: relative; }
.tile h3 { font-size: 1.5rem; }
.tile p { margin-top: 0.625rem; color: var(--muted); max-width: 44ch; }
.tile--pattern { justify-content: space-between; }
.tile--feature {
  justify-content: space-between; min-height: 24rem;
  background:
    radial-gradient(120% 90% at 100% 0%, var(--accent-soft), transparent 60%),
    var(--surface);
}
.tile--feature h3 { font-size: clamp(2rem, 3.6vw, 2.75rem); }
.tile__icon {
  position: absolute; right: -1.5rem; top: 2.5rem; font-size: 13.75rem;
  color: var(--accent); opacity: 0.1; pointer-events: none;
  transform-origin: 30% 70%;
  transition: transform 0.45s var(--ease), opacity 0.3s var(--ease);
}
.tile--pattern::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-conic-gradient(var(--surface-2) 0 25%, transparent 0 50%) 0 0 / 1.25rem 1.25rem;
  -webkit-mask-image: linear-gradient(200deg, #000, transparent 70%);
  mask-image: linear-gradient(200deg, #000, transparent 70%);
}
.mark {
  width: 3.25rem; height: 3.25rem; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  border: 2px solid var(--edge);
  box-shadow: inset 3px 3px 0 var(--bevel-hi), inset -3px -3px 0 var(--bevel-lo);
  font: 700 1.625rem/1 var(--mc);
  transition: transform 0.2s var(--ease);
}
.tags { display: flex; gap: 0.375rem; margin-bottom: 0.75rem; }
.tags li {
  font: 400 0.75rem/1 var(--mc); padding: 0.375rem 0.5625rem;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

.tags { flex-wrap: wrap; }
.tags .tag--role { background: var(--accent); color: var(--accent-ink); border-color: var(--edge); }

@media (hover: hover) and (pointer: fine) {
  .tile:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
}

/* Skills: three grouped columns under the title */
.skills__groups { margin-top: 3rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
.skills__group h3 {
  font-size: 1.125rem; text-shadow: none;
  padding-bottom: 0.875rem; border-bottom: 2px solid var(--line);
}
.skills__group ul { display: grid; gap: 1.625rem; margin-top: 1.5rem; }
.skills__group li { display: grid; grid-template-columns: 2.5rem 1fr; gap: 0.875rem; align-items: start; }
.skills__group li .ph {
  width: 2.5rem; height: 2.5rem; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 1.25rem;
  border: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.skills__group strong { display: block; font: 700 1.0625rem/1.4 var(--body); }
.skills__group span { display: block; color: var(--muted); font-size: 1rem; margin-top: 0.125rem; }

/* Macros band */
.macros { background: var(--surface); border-block: 2px solid var(--line); }
.macros__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3.5rem; align-items: center; }
.macros__copy p { margin-top: 1.25rem; font-size: 1.1875rem; color: var(--muted); max-width: 42ch; }
.keys-wrap { display: grid; justify-items: end; gap: 1rem; }
.keys {
  display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: flex-end;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
kbd {
  min-width: 4rem; height: 4rem; padding: 0 1.125rem;
  display: inline-grid; place-items: center;
  font: 400 0.9375rem/1 var(--mc); color: var(--text);
  background: var(--bg); border: 2px solid var(--edge);
  box-shadow: inset 2px 2px 0 var(--bevel-hi), inset 0 -5px 0 var(--line);
  cursor: pointer;
  transition: transform 0.08s var(--ease), box-shadow 0.08s var(--ease), background-color 0.3s var(--ease);
}
kbd.key--wide { min-width: 7.5rem; }
kbd.key--accent {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: inset 2px 2px 0 var(--bevel-hi), inset 0 -5px 0 color-mix(in srgb, var(--accent) 55%, #000);
}
kbd.is-pressed { transform: translateY(4px); box-shadow: inset 0 -1px 0 var(--line); }
kbd.key--accent.is-pressed { box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--accent) 55%, #000); }
.keys__hint { font: 400 0.8125rem/1.5 var(--mc); color: var(--muted); text-align: right; max-width: 34ch; }

/* Contact */
.contact { padding: 8rem 0; text-align: center; }
.contact__inner { display: flex; flex-direction: column; align-items: center; }
.contact__title { font-size: clamp(2rem, 4.4vw, 3.5rem); max-width: 18ch; }
.contact__inner > p { margin-top: 1.125rem; color: var(--muted); font-size: 1.1875rem; }
/* Discord-style profile card */
.profile {
  position: relative; width: min(100%, 22rem); margin-top: 2.25rem; text-align: left;
  background: var(--surface); border: 2px solid var(--edge);
  box-shadow: 0 1.25rem 3rem color-mix(in srgb, var(--bg) 60%, transparent);
}
.profile__banner {
  height: 7.125rem; overflow: hidden; border-bottom: 2px solid var(--edge);
  background: repeating-conic-gradient(color-mix(in srgb, var(--accent) 38%, #000) 0 25%, color-mix(in srgb, var(--accent) 24%, #000) 0 50%) 0 0 / 1rem 1rem;
}
.profile__banner img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 45%; }
.profile__banner { position: relative; }
.profile__avatar {
  position: absolute; top: 3.5rem; left: 0.625rem; width: 6.25rem; height: 6.25rem;
  background: #050505; border: 6px solid var(--surface); outline: 2px solid var(--edge);
  transition: transform 0.25s var(--ease);
}
.profile__avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Live status dot (Lanyard). Colors match Discord's meanings, so they ignore the accent. */
.profile__status {
  position: absolute; right: -0.625rem; bottom: -0.625rem; width: 1.5rem; height: 1.5rem;
  border: 4px solid var(--surface); background: #80848e;
}
.profile__status[data-state="online"] { background: #23a55a; }
.profile__status[data-state="idle"] { background: #f0b232; }
.profile__status[data-state="dnd"] { background: #f23f43; }
.profile__bubble {
  position: absolute; top: 7.75rem; left: 7.75rem; right: 0.75rem;
  padding: 0.375rem 0.625rem; background: var(--surface-2); border: 2px solid var(--line);
  font: 400 0.875rem/1.35 var(--body); color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile__activity { margin-top: 0.375rem; font: 400 0.875rem/1.4 var(--body); color: var(--text); }
.profile__body { padding: 3.75rem 1rem 1rem; }
.profile__name { font: 700 1.375rem/1.2 var(--mc); user-select: all; text-shadow: 0.08em 0.08em 0 var(--text-shadow); }
.profile__app { display: flex; align-items: center; gap: 0.375rem; margin-top: 0.25rem; font: 400 0.8125rem/1.4 var(--mc); color: var(--muted); }
.profile__about, .profile__menu { margin-top: 0.875rem; background: var(--surface-2); border: 2px solid var(--line); }
.profile__about { padding: 0.875rem; }
.profile__about h3 { font-size: 0.8125rem; text-shadow: none; color: var(--muted); }
.profile__about p { margin-top: 0.5rem; white-space: pre-line; font-size: 1rem; line-height: 1.5; }
.profile__row {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 3rem; padding: 0 0.875rem;
  background: none; border: 0; text-align: left; cursor: pointer;
  font: 400 1rem/1.2 var(--body); color: var(--text);
  transition: background-color 0.15s var(--ease);
}
.profile__row + .profile__row { border-top: 2px solid var(--line); }
.profile__row .ph { font-size: 1.25rem; color: var(--muted); }
.profile__row .profile__ext { margin-left: auto; font-size: 1rem; }
.profile__row:active { background: var(--accent-soft); }
.profile__row.is-done .ph { color: var(--accent); }
.profile__row:focus-visible { outline-offset: -3px; }
@media (hover: hover) and (pointer: fine) {
  .profile__row:hover { background: var(--accent-soft); }
}
.contact__status { margin-top: 0.875rem; min-height: 1.6em; font-size: 0.9375rem; color: var(--muted); }

/* Footer */
.footer {
  border-top: 2px solid var(--line); color: var(--muted); font: 400 0.8125rem/1.4 var(--mc);
  padding: 1.75rem 0 max(1.75rem, env(safe-area-inset-bottom));
}
.footer__inner { display: flex; align-items: center; gap: 1.5rem; }
.footer__inner a { margin-left: auto; padding: 0.75rem 0; }
.footer__inner a:hover { color: var(--text); }

/* Minecraft-style "Achievement Get!" toast. Game UI colors on purpose, so it looks the same in both themes. */
.toast {
  position: fixed; z-index: var(--z-toast);
  top: calc(5rem + env(safe-area-inset-top)); right: max(1rem, env(safe-area-inset-right));
  display: flex; align-items: center; gap: 0.875rem; padding: 0.75rem 1.125rem 0.75rem 0.75rem;
  background: #212121; color: #fff; border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #555, inset -2px -2px 0 #111, 0 0.75rem 2rem rgb(0 0 0 / 0.35);
}
.toast[hidden] { display: none; }
.toast__icon {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem;
  background: #8b8b8b; border: 2px solid #373737; box-shadow: inset 2px 2px 0 #555, inset -2px -2px 0 #fff;
  font-size: 1.375rem; color: #fff;
}
.toast__text { display: grid; gap: 0.25rem; font: 400 0.875rem/1.2 var(--mc); }
.toast__text strong { color: #ffff55; font-weight: 400; }

/* XP-orb style pixels drifting up behind the hero */
.hero { position: relative; overflow: hidden; }
.hero > .wrap { position: relative; }
.orbs { position: absolute; inset: 0; pointer-events: none; display: none; }
.orbs span {
  position: absolute; bottom: -1rem; width: 0.5rem; height: 0.5rem;
  background: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
  opacity: 0;
}
.orbs span:nth-child(1)  { left: 6%;  --dur: 9s;  --delay: 0s;   --x: 1.5rem; }
.orbs span:nth-child(2)  { left: 18%; --dur: 12s; --delay: 2.5s; --x: -1rem; width: 0.375rem; height: 0.375rem; }
.orbs span:nth-child(3)  { left: 31%; --dur: 10s; --delay: 5s;   --x: 2rem; }
.orbs span:nth-child(4)  { left: 44%; --dur: 13s; --delay: 1s;   --x: -1.5rem; width: 0.625rem; height: 0.625rem; }
.orbs span:nth-child(5)  { left: 52%; --dur: 8s;  --delay: 6.5s; --x: 1rem; }
.orbs span:nth-child(6)  { left: 63%; --dur: 11s; --delay: 3.5s; --x: -2rem; width: 0.375rem; height: 0.375rem; }
.orbs span:nth-child(7)  { left: 72%; --dur: 9.5s; --delay: 8s;  --x: 1.25rem; }
.orbs span:nth-child(8)  { left: 81%; --dur: 12.5s; --delay: 4.5s; --x: -1rem; width: 0.625rem; height: 0.625rem; }
.orbs span:nth-child(9)  { left: 90%; --dur: 10.5s; --delay: 7s; --x: 1.5rem; }
.orbs span:nth-child(10) { left: 97%; --dur: 14s; --delay: 9.5s; --x: -1.25rem; width: 0.375rem; height: 0.375rem; }

/* Smooth recolor when the accent changes (color only, so it stays on under reduced motion). */
.recoloring, .recoloring * {
  transition: color 0.4s var(--ease), background-color 0.4s var(--ease), border-color 0.4s var(--ease),
    box-shadow 0.4s var(--ease), text-shadow 0.4s var(--ease) !important;
}

/* Motion (only when the visitor allows it) */
@media (prefers-reduced-motion: no-preference) {
  /* Hero: headline types in like chat, then the rest arrives. */
  .js .type-char { opacity: 0; animation: char-in 0.18s steps(2, end) forwards; animation-delay: calc(var(--c) * 45ms); }
  @keyframes char-in { from { opacity: 0; transform: translateY(0.25em); } to { opacity: 1; transform: none; } }
  /* The cursor stays hidden while typing, then blinks. */
  .js .type-cursor { opacity: 0; animation: blink 1.06s steps(1, end) calc(var(--td, 0) * 1ms) infinite; }
  @keyframes blink { 0% { opacity: 1; } 50% { opacity: 0; } }

  .js .reveal { opacity: 0; transform: translateY(1.125rem); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); transition-delay: calc(var(--d, 0) * 1ms); }
  .js .reveal.is-in { opacity: 1; transform: none; }

  /* Code lines arrive top to bottom, and again when the tab changes. */
  .js .code.is-in .code__body:not([hidden]) .ln { animation: line-in 0.45s var(--ease) both; animation-delay: calc(var(--d0, 250) * 1ms + var(--l, 0) * 40ms); }
  @keyframes line-in { from { opacity: 0; transform: translateX(-0.5rem); } to { opacity: 1; transform: none; } }

  /* Server tiles arrive as a list. */
  .js .bento .tile { opacity: 0; transform: translateY(1.5rem); }
  .js .bento.is-in .tile { animation: tile-in 0.6s var(--ease) forwards; animation-delay: calc(var(--t, 0) * 90ms); }
  @keyframes tile-in { to { opacity: 1; transform: none; } }

  /* Menus open from their button. */
  .accent-menu:not([hidden]), .nav.is-open .nav__links { animation: pop-in 0.18s var(--ease); }
  @keyframes pop-in { from { opacity: 0; transform: translateY(-0.375rem) scale(0.97); } }

  /* Section titles wipe in left to right in pixel steps. */
  .js .wipe { clip-path: inset(-0.3em 100% -0.3em -0.3em); }
  .js .wipe.is-in { animation: wipe 0.7s steps(14, end) forwards; }
  @keyframes wipe { to { clip-path: inset(-0.3em -0.3em -0.3em -0.3em); } }

  /* Lists (skills, tools) arrive item by item. */
  .js .stagger > * { opacity: 0; transform: translateY(0.75rem); }
  .js .stagger.is-in > * { animation: rise 0.5s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 70ms); }
  @keyframes rise { to { opacity: 1; transform: none; } }

  /* Profile card pops in, then the live status dot pulses while online. */
  .js .profile { opacity: 0; transform: translateY(1.5rem) scale(0.96); }
  .js .profile.is-in { animation: card-in 0.7s var(--ease) forwards; }
  @keyframes card-in { to { opacity: 1; transform: none; } }
  .profile__status[data-state="online"] { animation: status-pulse 2s steps(6, end) infinite; }
  @keyframes status-pulse { 0% { box-shadow: 0 0 0 0 rgb(35 165 90 / 0.6); } 100% { box-shadow: 0 0 0 0.625rem rgb(35 165 90 / 0); } }

  /* The banner slowly drifts and zooms so the card feels alive. */
  .profile__banner img { animation: banner-drift 16s ease-in-out infinite alternate; transform-origin: 60% 40%; }
  @keyframes banner-drift {
    from { transform: scale(1.04) translate(-1.5%, 0); }
    to { transform: scale(1.16) translate(2%, -3%); }
  }

  /* XP orbs drift up and sway; paused while the hero is off screen. */
  .orbs { display: block; }
  .orbs span { animation: orb var(--dur) linear var(--delay) infinite; }
  .orbs.is-paused span { animation-play-state: paused; }
  @keyframes orb {
    0% { opacity: 0; transform: translate(0, 0); }
    10% { opacity: 0.55; }
    50% { transform: translate(var(--x), -45vh); }
    85% { opacity: 0.35; }
    100% { opacity: 0; transform: translate(0, -90vh); }
  }

  /* Achievement toast slides in from the right. */
  .toast.is-in { animation: toast-in 0.45s var(--ease) both; }
  .toast.is-out { animation: toast-out 0.3s ease-in both; }
  @keyframes toast-in { from { transform: translateX(calc(100% + 2rem)); } }
  @keyframes toast-out { to { transform: translateX(calc(100% + 2rem)); } }

  /* Enchanted-item glint sweeps across the accent words now and then. */
  @supports (background-clip: text) or (-webkit-background-clip: text) {
    .js .hero__title em .type-char {
      background: linear-gradient(110deg, var(--accent) 40%, color-mix(in srgb, var(--accent) 35%, #fff) 50%, var(--accent) 60%) 0 0 / 300% 100%;
      -webkit-background-clip: text; background-clip: text; color: transparent;
      text-shadow: none;
      animation: char-in 0.18s steps(2, end) forwards, glint 5s linear 2.5s infinite;
      animation-delay: calc(var(--c) * 45ms), calc(2.5s + var(--c) * 40ms);
    }
    .js .hero__title em { text-shadow: none; filter: drop-shadow(0.08em 0.08em 0 var(--accent-shadow)); }
    @keyframes glint { 0% { background-position: 100% 0; } 30%, 100% { background-position: 0 0; } }
  }

  /* Feedback */
  .swatch:active { transform: scale(0.9); }
  .is-done .ph { animation: pop 0.3s steps(3, end); }
  @keyframes pop { 50% { transform: scale(1.35); } }

  @media (hover: hover) and (pointer: fine) {
    .swatch:hover { transform: scale(1.1); }
    .tile--feature:hover .tile__icon { transform: rotate(-14deg); opacity: 0.16; }
    .tile:hover .mark { transform: translateY(-3px); }
    .profile:hover .profile__avatar { transform: translateY(-3px); }
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .type-cursor { display: none; }
}

/* Theme switch: the new theme spreads out from the toggle (View Transitions, where supported). */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Accessibility preferences */
@media (prefers-contrast: more) {
  :root { --muted: var(--text); --line: var(--text); }
}
@media (prefers-reduced-transparency: reduce) {
  .nav { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (forced-colors: active) {
  .btn, .icon-btn, kbd, .mark, .tags li, .code__tab[aria-selected="true"] { border: 2px solid CanvasText; }
  .type-cursor { background: CanvasText; }
}

/* Touch and pen: every control gets at least a 44px target. */
@media (pointer: coarse) {
  .icon-btn { width: var(--tap); height: var(--tap); }
  .btn--sm { min-height: var(--tap); }
  .swatch { width: var(--tap); height: var(--tap); }
  .accent-menu { grid-template-columns: repeat(4, var(--tap)); }
  .nav__links a { padding: 0.875rem 0; }
}

/* Tablet */
@media (max-width: 1023px) {
  .hero__grid, .macros__grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .skills__groups { grid-template-columns: 1fr 1fr; }
  .keys-wrap { justify-items: start; }
  .keys { justify-content: flex-start; }
  .keys__hint { text-align: left; }
  .hero { min-height: 0; }
}

/* Phone */
@media (max-width: 767px) {
  :root { --gutter: 1rem; }
  .nav__inner { gap: 0.75rem; }
  .menu-btn { display: inline-grid; }
  .nav__links { display: none; }
  html:not(.js) .nav__links { display: flex; gap: 1rem; }
  .nav.is-open .nav__links {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    padding: 0.5rem max(var(--gutter), env(safe-area-inset-left)) 1rem;
    background: var(--bg); border-bottom: 2px solid var(--line);
  }
  .nav.is-open .nav__links a { font-size: 1rem; color: var(--text); padding: 0.875rem 0; border-bottom: 2px solid var(--line); }
  .nav__actions { margin-left: auto; gap: 0.5rem; }
  .nav__actions > .btn--sm { display: none; }
  .hero { padding: 3rem 0 3.5rem; }
  .section { padding: 4.5rem 0; }
  .bento { grid-template-columns: 1fr; }
  .tile--feature { min-height: 20rem; }
  .skills__groups { grid-template-columns: 1fr; }
  .code__body { font-size: 0.75rem; }
  kbd { min-width: 3.25rem; height: 3.25rem; padding: 0 0.875rem; font-size: 0.875rem; }
  kbd.key--wide { min-width: 6rem; }
  .contact { padding: 5.5rem 0; }
  .footer__inner { flex-wrap: wrap; gap: 0.75rem 1.25rem; }
}

/* Short screens such as phones in landscape */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { min-height: 0; padding: 2.5rem 0; }
}

/* Print: plain and ink-friendly */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --muted: #333; --line: #999; }
  .nav, .hero__ctas, .accent-picker, .keys-wrap, [data-copy], .footer a, .skip { display: none !important; }
  h1, h2, h3, .logo { text-shadow: none !important; }
  .section, .contact { padding: 2rem 0; }
  .js .reveal, .js .bento .tile, .js .type-char, .js .stagger > *, .js .profile { opacity: 1 !important; transform: none !important; animation: none !important; }
  .js .wipe { clip-path: none !important; }
  .orbs, .toast { display: none !important; }
}
