/* ==========================================================
   Tokens
   Every text token is checked against every surface it sits on
   (WCAG AA, 4.5:1). Code windows stay dark in both themes.
   ========================================================== */
:root {
  --bg: #0a0b0d;
  --bg-raise: #0e0f12;
  --surface: #111216;
  --surface-2: #17181d;
  --border: #23252c;
  --border-strong: #31333b;
  --text: #ececee;
  --muted: #9a9ba6; /* 6.4–7.1:1 */
  --faint: #82838e; /* 4.7–5.2:1 */
  --accent: #34d399; /* 9.2–10.2:1 */
  --accent-ink: #04261a;
  --hash: #fcd34d;
  --lane2: #f87171;
  --shadow: 0 24px 48px -24px rgb(0 0 0 / 0.7);

  --code-bg: #0c0d10;
  --code-bar: #131419;
  --code-border: #262830;
  --code-text: #e4e4e7;
  --code-dim: #8b8c97; /* 5.5–5.8:1 */
  --sx-prop: #7dd3fc;
  --sx-str: #86efac;
  --sx-num: #fdba74;
  --sx-key: #c4b5fd;

  --radius: 16px;
  --radius-sm: 10px;
  --container: 1160px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #fafafa;
  --bg-raise: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --border: #e3e4e8;
  --border-strong: #cfd1d7;
  --text: #0f1115;
  --muted: #555764; /* 6.5–7.2:1 */
  --faint: #6b6d78; /* 4.7–5.1:1 */
  --accent: #047857; /* 5.0–5.5:1, white on it 5.5:1 */
  --accent-ink: #ffffff;
  --hash: #8f5a07;
  --lane2: #c81e1e;
  --shadow: 0 24px 48px -28px rgb(15 17 21 / 0.35);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fafafa;
    --bg-raise: #f3f4f6;
    --surface: #ffffff;
    --surface-2: #f3f4f6;
    --border: #e3e4e8;
    --border-strong: #cfd1d7;
    --text: #0f1115;
    --muted: #555764;
    --faint: #6b6d78;
    --accent: #047857;
    --accent-ink: #ffffff;
    --hash: #8f5a07;
    --lane2: #c81e1e;
    --shadow: 0 24px 48px -28px rgb(15 17 21 / 0.35);
    color-scheme: light;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  scrollbar-color: var(--border-strong) var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

a {
  color: inherit;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 600;
  text-wrap: balance;
}

p {
  margin: 0;
}

code,
kbd,
pre {
  font-family: var(--mono);
}

input {
  caret-color: var(--accent);
}

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

.container {
  width: min(var(--container), 100% - 2rem);
  margin-inline: auto;
}

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

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus {
  top: 1rem;
}
/* sections receive focus programmatically on navigation; no ring needed there */
section[tabindex="-1"]:focus {
  outline: none;
}

/* inline stroke icon that sits in running text */
.i {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin-left: 0.25em;
  vertical-align: -0.12em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================
   Nav
   ========================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.is-scrolled {
  border-bottom-color: var(--border);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 60px;
}

.nav__logo {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}
.nav__logo .prompt {
  color: var(--accent);
}

.nav__links {
  display: flex;
  gap: 0.125rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__links a {
  display: block;
  padding: 0.4rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.825rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  transition: color 0.2s, background-color 0.2s;
}
.nav__links a::before {
  content: "./";
  color: var(--faint);
}
.nav__links a:hover {
  color: var(--text);
}
.nav__links a.is-active {
  color: var(--text);
  background: var(--surface-2);
}
.nav__links a.is-active::before {
  color: var(--accent);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.3rem;
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
}

.kbd-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 36px;
  padding: 0 0.5rem 0 0.8rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.kbd-btn span {
  margin-right: 1.5rem;
}
.kbd-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.kbd-btn__icon {
  display: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-moon {
  display: none;
}
:root[data-theme="light"] .icon-sun {
  display: none;
}
:root[data-theme="light"] .icon-moon {
  display: block;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-sun {
    display: none;
  }
  :root:not([data-theme="dark"]) .icon-moon {
    display: block;
  }
}

.nav__menu {
  display: none;
}

@media (max-width: 860px) {
  .kbd-btn span {
    display: none;
  }
  .kbd-btn {
    padding: 0 0.45rem;
  }
}
@media (max-width: 760px) {
  .nav__menu {
    display: grid;
  }
  .kbd-btn {
    width: 36px;
    justify-content: center;
    padding: 0;
  }
  .kbd-btn .kbd {
    display: none;
  }
  .kbd-btn__icon {
    display: block;
  }
  .nav__links {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 0.5rem 1rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav__links.is-open {
    display: flex;
  }
  .nav__links a {
    padding: 0.8rem 0.75rem;
    font-size: 1rem;
  }
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.25rem;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease-out), background-color 0.2s, border-color 0.2s;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn--primary {
  color: var(--bg);
  background: var(--text);
}
.btn--primary:hover {
  background: color-mix(in srgb, var(--text) 86%, var(--bg));
}
.btn--ghost {
  background: var(--surface);
  border-color: var(--border-strong);
}
.btn--ghost:hover {
  border-color: var(--muted);
}
.btn--lg {
  min-height: 52px;
  padding: 0 1.75rem;
  font-size: 1rem;
}
.btn__icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
}

/* ==========================================================
   Windows (terminal / code)
   One floating panel (the terminal) gets elevation; the rest
   are defined by their edge only.
   ========================================================== */
.window {
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--code-border);
  border-radius: 14px;
  overflow: hidden;
  text-align: left;
}
.window__bar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  height: 40px;
  padding: 0 0.9rem;
  background: var(--code-bar);
  border-bottom: 1px solid var(--code-border);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--code-dim);
}
.window__title {
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.window__hint code {
  color: var(--sx-str);
}
.hint-touch {
  display: none;
}
@media (hover: none) and (pointer: coarse) {
  .hint-fine {
    display: none;
  }
  .hint-touch {
    display: inline;
  }
}
.traffic {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}
.traffic i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff5f57;
}
.traffic i:nth-child(2) {
  background: #febc2e;
}
.traffic i:nth-child(3) {
  background: #28c840;
}
.tab {
  display: flex;
  align-items: center;
  align-self: stretch;
  margin-left: 0.5rem;
  padding: 0 1rem;
  color: var(--code-text);
  background: var(--code-bg);
  border-inline: 1px solid var(--code-border);
  box-shadow: inset 0 2px 0 #34d399;
}

.code {
  margin: 0;
  padding: 1.1rem 1.25rem;
  font-size: 0.85rem;
  line-height: 1.75;
  overflow-x: auto;
}
.code > code {
  display: block;
  white-space: normal; /* collapse the newlines between .ln blocks */
}
.code .ln {
  display: block;
  white-space: pre-wrap;
  padding-left: 2ch;
  text-indent: -2ch;
}
.code--numbered {
  counter-reset: ln;
  padding-left: 0.5rem;
}
.code--numbered .ln {
  counter-increment: ln;
  padding-left: calc(3.5rem + 2ch);
  position: relative;
}
.code--numbered .ln::before {
  content: counter(ln);
  position: absolute;
  left: 0;
  width: 2.25rem;
  text-align: right;
  text-indent: 0;
  color: var(--code-dim);
}

.sx-p {
  color: var(--sx-prop);
}
.sx-s {
  color: var(--sx-str);
}
.sx-n {
  color: var(--sx-num);
}
.sx-k {
  color: var(--sx-key);
}

/* ==========================================================
   Hero
   ========================================================== */
.hero {
  padding: clamp(4rem, 10vw, 7rem) 0 clamp(4rem, 8vw, 6rem);
}
.hero__inner {
  text-align: center;
}
.hero__title {
  margin: 0 auto;
  font-size: clamp(2.6rem, 7vw, 4.75rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.02;
}
.hero__accent {
  color: var(--accent);
}
.hero__lead {
  max-width: 44rem;
  margin: 1.5rem auto 0;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--muted);
  text-wrap: pretty;
}
.hero__lead strong {
  color: var(--text);
  font-weight: 500;
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2.25rem;
}

/* terminal: styled after a real bash session */
.terminal {
  --t-fg: #d4d4d8;
  --t-dim: #8b8c97;
  --t-green: #4ade80;
  --t-blue: #60a5fa;
  --t-yellow: #facc15;
  --t-cyan: #22d3ee;
  max-width: 860px;
  margin: clamp(3rem, 7vw, 4.5rem) auto 0;
  box-shadow: var(--shadow);
}
.terminal__body {
  height: 380px;
  padding: 0.75rem 1rem 1rem;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--t-fg);
  cursor: text;
  font-variant-ligatures: none;
  scrollbar-width: thin;
  scrollbar-color: var(--code-border) transparent;
}
.terminal__body b {
  font-weight: 600;
}
.terminal .line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.t-green {
  color: var(--t-green);
}
.t-blue {
  color: var(--t-blue);
}
.t-yellow {
  color: var(--t-yellow);
}
.t-cyan {
  color: var(--t-cyan);
}
.terminal .t-dim {
  color: var(--t-dim);
}
.terminal a {
  color: inherit;
  text-decoration: none;
}
.terminal a:hover {
  text-decoration: underline;
}

.t-table {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 3ch;
}
.t-table.t-indent {
  padding-left: 2ch;
}
.t-key {
  white-space: nowrap;
}
.t-ls {
  display: flex;
  flex-wrap: wrap;
  column-gap: 3ch;
}

.t-neofetch {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 4ch;
  align-items: start;
  padding: 0.35em 0;
}
.t-logo {
  margin: 0;
  font: inherit;
  line-height: inherit;
  color: var(--t-green);
  font-weight: 600;
}
.t-swatches {
  display: flex;
  margin-top: 1.45em;
}
.t-swatches i {
  width: 3ch;
  height: 1.45em;
}

/* input line with a block cursor */
.terminal__input {
  display: flex;
  white-space: pre;
}
/* while the intro types, the live prompt collapses but stays focusable */
.terminal.is-busy .terminal__input,
.terminal__input.is-pending {
  height: 0;
  overflow: hidden;
}
.t-ps {
  flex-shrink: 0;
}
.t-field {
  position: relative;
  flex: 1;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.t-field input {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  font-family: inherit;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  color: transparent;
  caret-color: transparent;
  background: none;
  border: 0;
  outline: none;
  opacity: 0;
}
.t-cursor {
  box-shadow: inset 0 0 0 1px var(--t-fg);
}
.terminal.is-focused .t-cursor,
.t-cursor--live {
  color: var(--code-bg);
  background: var(--t-fg);
  box-shadow: none;
  animation: blink 1.06s steps(1) infinite;
}
.terminal.is-focused {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
/* bullet lines in `cat` output keep a hanging indent when they wrap */
.t-hang {
  padding-left: 2ch;
  text-indent: -2ch;
}

/* popup terminal (palette → Open terminal, Ctrl+`) */
.term-dialog {
  width: min(860px, calc(100% - 2rem));
  max-width: none;
  margin: 10vh auto auto;
  padding: 0;
  background: none;
  border: 0;
  overflow: visible;
}
.term-dialog::backdrop {
  background: rgb(0 0 0 / 0.55);
}
.term-dialog[open] {
  animation: pop 0.18s var(--ease-out);
}
.terminal--popup {
  margin: 0;
  max-width: none;
  box-shadow: 0 32px 64px -24px rgb(0 0 0 / 0.6);
}
.terminal--popup .terminal__body {
  height: min(460px, 65vh);
}
.terminal--popup.is-focused {
  outline: none;
}
.window__hint kbd {
  font-family: inherit;
  color: var(--code-text);
}
/* touch has no Esc key: the red light closes the popup, and the title gets the room */
@media (hover: none) and (pointer: coarse) {
  .terminal--popup .window__hint {
    display: none;
  }
}
.traffic__close {
  position: relative;
  width: 11px;
  height: 11px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ff5f57;
  cursor: pointer;
}
/* a 44px hit area around the 11px light */
.traffic__close::before {
  content: "";
  position: absolute;
  inset: -16px;
}
.traffic__close:hover {
  background: #ff3b30;
}

@media (max-width: 600px) {
  .terminal__body {
    height: 360px;
    padding: 0.6rem 0.75rem 0.75rem;
    font-size: 0.75rem;
  }
  .t-logo {
    display: none;
  }
  .t-neofetch {
    grid-template-columns: 1fr;
  }
  .t-table {
    column-gap: 2ch;
  }
}

/* ==========================================================
   Sections
   ========================================================== */
.section {
  padding: clamp(4.5rem, 11vw, 8rem) 0;
  border-top: 1px solid var(--border);
}

/* heading and its shell command share one line; the command is an
   annotation beside the heading, never a label above it */
.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.section__title {
  font-size: clamp(2.1rem, 5.5vw, 3.5rem);
  letter-spacing: -0.035em;
}
.cmd {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--muted);
}
.cmd__ps {
  color: var(--accent);
  margin-right: 0.4rem;
}

/* ==========================================================
   Bento (about)
   ========================================================== */
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-areas:
    "bio bio now now"
    "bio bio clock edu"
    "quote quote quote quote"
    "kmeans kmeans kmeans off"
    "rc rc rc rc";
  gap: 1rem;
}
.tile {
  position: relative;
  margin: 0;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tile__title {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
}
.tile__sub {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.tile--bio {
  grid-area: bio;
  padding: 1.75rem;
}
.bio__head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.avatar {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
}
.bio__name {
  font-size: 1.35rem;
}
.bio__role {
  margin-top: 0.2rem;
  font-size: 0.925rem;
  color: var(--muted);
}
.tile--bio p:not(.bio__role) {
  max-width: 60ch;
  color: var(--muted);
  line-height: 1.65;
}
.tile--bio .bio__lead {
  font-size: 1.15rem;
  color: var(--text);
}
.tile--bio p + p {
  margin-top: 1rem;
}
.tile--bio strong {
  color: var(--text);
  font-weight: 500;
}

.tile--now {
  grid-area: now;
}
.now-list {
  display: grid;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.now-list li {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}
.now-list strong {
  display: block;
  font-weight: 500;
}
.now-list span {
  color: var(--muted);
  font-size: 0.925rem;
}
.now-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 0.55rem;
  border-radius: 50%;
  border: 1.5px solid var(--faint);
}
.now-dot--live {
  background: var(--accent);
  border-color: var(--accent);
}

.tile--clock {
  grid-area: clock;
}
.clock {
  font-family: var(--mono);
  font-size: clamp(1.75rem, 3.4vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.tile--edu {
  grid-area: edu;
}
.edu {
  display: grid;
  gap: 0.85rem;
  margin: 0;
}
.edu dt {
  font-weight: 500;
  font-size: 0.95rem;
}
.edu dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.tile--quote {
  grid-area: quote;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: end;
  gap: 1rem 3rem;
  padding: clamp(1.75rem, 4vw, 2.75rem);
}
.tile--quote blockquote {
  margin: 0;
}
.tile--quote blockquote p {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.tile--quote figcaption {
  max-width: 44ch;
  color: var(--muted);
  font-size: 0.95rem;
}

.tile--kmeans {
  grid-area: kmeans;
  padding: 0;
  background: var(--code-bg);
  border-color: var(--code-border);
  color: var(--code-text);
}
.nb-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--code-border);
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--code-bar);
}
.nb-head code {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nb-in {
  color: var(--sx-prop);
  flex-shrink: 0;
}
.nb-iter {
  margin-left: auto;
  color: #34d399;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
#kmeans {
  display: block;
  width: 100%;
  height: 300px;
}

.tile--off {
  grid-area: off;
}

/* Lebanese Red Cross band: solid red, white type (5.9:1 light, 7.1:1 dark),
   a heartbeat trace along the bottom. The cross emblem itself is protected
   (Geneva Conventions), so it is deliberately not drawn. */
.tile--rc {
  --rc: #c8102e;
  --rc-ink: #ffffff;
  --rc-soft: #ffe1e5;
  grid-area: rc;
  position: relative;
  display: grid;
  padding: clamp(1.75rem, 4vw, 3rem) clamp(1.5rem, 4vw, 3rem) clamp(5.5rem, 9vw, 6rem);
  color: var(--rc-ink);
  background: var(--rc);
  border-color: transparent;
}
:root:not([data-theme="light"]) .tile--rc {
  --rc: #a50e24;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .tile--rc {
    --rc: #c8102e;
  }
}
.rc__text {
  position: relative;
  z-index: 1;
  max-width: 46rem;
}
.rc__title {
  font-size: clamp(1.6rem, 3.6vw, 2.5rem);
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--rc-ink);
}
.rc__sub {
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--rc-soft);
}
.rc__body {
  margin-top: 1.25rem;
  font-size: 1.05rem;
  color: var(--rc-ink);
}
.rc__list {
  display: grid;
  gap: 0.6rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--rc-soft);
}
.rc__list li {
  position: relative;
  padding-left: 1.4rem;
}
.rc__list li::before {
  content: "+";
  position: absolute;
  left: 0;
  font-family: var(--mono);
  color: var(--rc-ink);
}
.rc__list a {
  color: var(--rc-ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.tile--rc ::selection {
  background: var(--rc-ink);
  color: var(--rc);
}
.tile--rc :focus-visible {
  outline-color: var(--rc-ink);
}
.rc__ecg {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1.25rem;
  width: 100%;
  height: 56px;
  overflow: visible;
}
.rc__ecg path {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.rc__ecg-base {
  stroke: rgb(255 255 255 / 0.28);
  stroke-width: 1.5;
}
/* a bright pulse travels along the trace */
.rc__ecg-beat {
  stroke: #ffffff;
  stroke-width: 2.25;
  stroke-dasharray: 140 1400;
  stroke-dashoffset: 140;
  animation: ecg 3.2s linear infinite;
}
@keyframes ecg {
  to {
    stroke-dashoffset: -1400;
  }
}
/* slides in from the left the first time it is scrolled to */
.tile--rc.will-slide {
  opacity: 0;
  transform: translateX(-64px);
  transition: opacity 0.6s var(--ease-out), transform 0.9s var(--ease-out);
}
.tile--rc.will-slide .rc__text > * {
  opacity: 0;
  transform: translateX(-24px);
  transition: opacity 0.5s var(--ease-out), transform 0.7s var(--ease-out);
}
.tile--rc.will-slide.is-in,
.tile--rc.will-slide.is-in .rc__text > * {
  opacity: 1;
  transform: none;
}
.tile--rc.is-in .rc__text > :nth-child(2) {
  transition-delay: 0.12s;
}
.tile--rc.is-in .rc__text > :nth-child(3) {
  transition-delay: 0.2s;
}
.tile--rc.is-in .rc__text > :nth-child(4) {
  transition-delay: 0.28s;
}
.off-list {
  display: grid;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.off-list strong {
  color: var(--text);
  font-weight: 500;
}

@media (max-width: 960px) {
  .bento {
    grid-template-columns: repeat(2, 1fr);
    grid-template-areas:
      "bio bio"
      "now now"
      "clock edu"
      "quote quote"
      "kmeans kmeans"
      "off off"
      "rc rc";
  }
  .tile--quote {
    grid-template-columns: 1fr;
    align-items: start;
  }
}
@media (max-width: 560px) {
  .bento {
    grid-template-columns: 1fr;
    grid-template-areas: "bio" "now" "clock" "edu" "quote" "kmeans" "off" "rc";
  }
  #kmeans {
    height: 240px;
  }
}

/* ==========================================================
   Experience (git log)
   ========================================================== */
.gitlog {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 820px;
}
.commit {
  position: relative;
  padding: 0 0 3.25rem 4.75rem;
}
.commit:last-child {
  padding-bottom: 0;
}

.commit__meta {
  font-family: var(--mono);
  font-size: 0.825rem;
  color: var(--muted);
  line-height: 1.7;
}
.commit__meta .sx-hash {
  color: var(--hash);
}
.commit__meta .t-dim {
  color: var(--faint);
}
.ref {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 999px;
}
.ref--tag {
  color: var(--hash);
  border-color: color-mix(in srgb, var(--hash) 45%, transparent);
}
.ref--muted {
  color: var(--faint);
  border-color: var(--border-strong);
}

.commit__title {
  margin: 0.75rem 0 0;
  font-size: clamp(1.3rem, 2.6vw, 1.65rem);
  letter-spacing: -0.025em;
}
.commit__title span {
  color: var(--muted);
  font-weight: 400;
}
.commit__msg {
  max-width: 64ch;
  margin-top: 0.75rem;
  font-size: 1.075rem;
  color: var(--text);
  text-wrap: pretty;
}
.commit__msg strong {
  font-weight: 600;
}

.commit__details {
  margin: 0.9rem 0 1.25rem;
}
.commit__details summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  padding: 0 0.75rem 0 0.55rem;
  font-family: var(--mono);
  font-size: 0.825rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
  transition: color 0.2s, border-color 0.2s;
}
.commit__details summary::-webkit-details-marker {
  display: none;
}
.commit__details summary:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.commit__details summary svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s var(--ease-out);
}
.commit__details[open] summary svg {
  transform: rotate(90deg);
}
.commit__details .hide,
.commit__details[open] .show {
  display: none;
}
.commit__details[open] .hide {
  display: inline;
}
.commit__body {
  max-width: 64ch;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}
.commit__body li {
  position: relative;
  padding-left: 1.4rem;
}
.commit__body li + li {
  margin-top: 0.6rem;
}
.commit__body li::before {
  content: "+";
  position: absolute;
  left: 0;
  font-family: var(--mono);
  color: var(--accent);
}
.commit__body em {
  color: var(--text);
  font-style: normal;
  font-weight: 500;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tags li {
  padding: 0.15rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* ==========================================================
   Projects
   ========================================================== */
.filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  padding: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.filter {
  min-height: 34px;
  padding: 0 0.8rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.filter:hover {
  color: var(--text);
}
.filter.is-active {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.projects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.project {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.25s, transform 0.3s var(--ease-out);
}
.project:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.project[hidden] {
  display: none;
}
.project.is-flash {
  animation: card-flash 1.4s var(--ease-out);
}
@keyframes card-flash {
  0%,
  35% {
    border-color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }
  100% {
    outline: 2px solid transparent;
    outline-offset: 3px;
  }
}
.project h3 {
  font-size: 1.5rem;
  letter-spacing: -0.025em;
}
.project__sub {
  margin-top: -0.35rem;
  font-size: 0.9rem;
  color: var(--faint);
}
.project p:not(.project__sub) {
  max-width: 62ch;
  color: var(--muted);
  font-size: 0.975rem;
}
.project em {
  color: var(--text);
  font-style: normal;
  font-weight: 500;
}
.project .tags {
  margin-top: 0.25rem;
}
.project__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}
.project__path {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--faint);
}
.project__path strong {
  color: var(--muted);
  font-weight: 500;
}
.folder {
  position: relative;
  width: 14px;
  height: 11px;
  border-radius: 2px;
  background: var(--accent);
}
.folder::before {
  content: "";
  position: absolute;
  left: 0;
  top: -3px;
  width: 6px;
  height: 4px;
  border-radius: 2px 2px 0 0;
  background: inherit;
}
.lang {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.lang i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
}

/* the featured project is open layout, not a card holding a card */
.project--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 2.5rem;
  padding: 0 0 2.5rem;
  margin-bottom: 1.5rem;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}
.project--featured:hover {
  transform: none;
}
.project--featured .project__main {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.project--featured h3 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  letter-spacing: -0.035em;
}
.project--featured p:not(.project__sub) {
  font-size: 1.05rem;
}
.project--featured .project__foot {
  margin-top: 0.5rem;
}
.project__links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
}
.link--muted {
  color: var(--muted);
}
.link--muted:hover {
  color: var(--text);
}

/* compact `ls -l` list for smaller repos */
.more {
  margin-top: clamp(3rem, 6vw, 4rem);
}
.more[hidden] {
  display: none;
}
.more__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-bottom: 1rem;
}
.more__title {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.more__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.more__row {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr) 7rem 5.5rem;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  padding: 0.9rem 0.25rem;
  border-bottom: 1px solid var(--border);
}
.more__row[hidden] {
  display: none;
}
.more__name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--text);
  overflow-wrap: anywhere;
}
.more__name .folder {
  flex-shrink: 0;
}
.more__desc {
  color: var(--muted);
  font-size: 0.95rem;
}
.more__row .link {
  justify-self: end;
}
@media (max-width: 760px) {
  .more__row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 1rem 0.25rem;
  }
  .more__desc {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .more__row .lang {
    grid-row: 3;
  }
  .more__row .link {
    grid-row: 3;
  }
}

.projects__empty:empty {
  display: none;
}
.projects__empty {
  margin-top: 1rem;
  color: var(--muted);
}

@media (max-width: 860px) {
  .projects {
    grid-template-columns: 1fr;
  }
  .project--featured {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
}

/* ==========================================================
   Stack
   ========================================================== */
.stack {
  max-width: 980px;
}
@media (max-width: 600px) {
  .stack .code {
    font-size: 0.75rem;
  }
  .code--numbered .ln {
    padding-left: calc(2.25rem + 2ch);
  }
  .code--numbered .ln::before {
    width: 1.5rem;
  }
}

/* ==========================================================
   Contact
   ========================================================== */
.contact__inner {
  max-width: 760px;
}
.contact__head {
  margin-bottom: 2.5rem;
  text-align: center;
}
.contact__title {
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  letter-spacing: -0.04em;
}
.contact__lead {
  max-width: 34rem;
  margin: 1.25rem auto 0;
  color: var(--muted);
  font-size: 1.1rem;
}
.contact__list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  font-family: var(--mono);
  font-size: 0.9rem;
}
.contact__list li {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 48px;
  padding: 0.25rem 1.25rem;
}
.contact__list li:hover {
  background: rgb(255 255 255 / 0.03);
}
.flag {
  flex: 0 0 5.5rem;
  color: var(--sx-key);
}
.contact__list a {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--code-text);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.contact__list a:hover {
  color: #34d399;
}
.copy {
  min-height: 32px;
  padding: 0 0.7rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--code-dim);
  background: none;
  border: 1px solid var(--code-border);
  border-radius: 6px;
  cursor: pointer;
}
.copy:hover {
  color: var(--code-text);
  border-color: var(--code-dim);
}
.contact__cta {
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
}
@media (max-width: 520px) {
  .contact__list li {
    flex-wrap: wrap;
    gap: 0 0.75rem;
    padding: 0.5rem 1rem;
  }
  .flag {
    flex-basis: 100%;
  }
}

/* ==========================================================
   Status bar footer
   ========================================================== */
.statusbar {
  border-top: 1px solid var(--border);
  background: var(--bg-raise);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.statusbar__inner {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 36px;
  flex-wrap: wrap;
}
.statusbar__group {
  display: flex;
  flex-wrap: wrap;
}
.sb-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
}
a.sb-item:hover {
  color: var(--text);
  background: var(--surface-2);
}
.sb-item--accent {
  color: var(--accent);
}
.sb-item svg:not(.i) {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
@media (max-width: 600px) {
  .sb-hide-sm {
    display: none;
  }
}

/* ==========================================================
   Command palette
   ========================================================== */
.palette {
  width: min(600px, calc(100% - 2rem));
  margin: 12vh auto auto;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 32px 64px -24px rgb(0 0 0 / 0.55);
  overflow: hidden;
}
.palette::backdrop {
  background: rgb(0 0 0 / 0.55);
}
.palette[open] {
  animation: pop 0.18s var(--ease-out);
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}
.palette__search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
}
.palette__search svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--faint);
  stroke-width: 2;
  stroke-linecap: round;
}
.palette__search input {
  flex: 1;
  min-width: 0;
  height: 54px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: none;
  border: 0;
  outline: none;
}
.palette__search input::placeholder {
  color: var(--faint);
}
.palette__list {
  max-height: min(480px, 60vh);
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  scrollbar-width: thin;
}
.palette__group {
  padding: 0.6rem 0.75rem 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--faint);
}
.palette__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0 0.75rem;
  font-size: 0.95rem;
  border-radius: 10px;
  cursor: pointer;
}
.pi-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--faint);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pi-hint {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
}
.palette__item[aria-selected="true"] {
  background: var(--surface-2);
}
.palette__item[aria-selected="true"] .pi-icon {
  stroke: var(--accent);
}
.palette__empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}
.palette__foot {
  display: flex;
  gap: 1.25rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--faint);
}
.palette__foot span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ==========================================================
   Toast
   ========================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--bg);
  background: var(--text);
  border-radius: 10px;
  transform: translate(-50%, 1rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.3s var(--ease-out);
}
.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==========================================================
   Touch: every control reaches a 44px hit area
   ========================================================== */
@media (pointer: coarse) {
  .icon-btn,
  .kbd-btn {
    width: 44px;
    height: 44px;
  }
  .nav__logo {
    min-height: 44px;
  }
  .filter {
    min-height: 44px;
  }
  .copy {
    min-width: 56px;
    min-height: 44px;
  }
  .link,
  .commit__details summary {
    min-height: 44px;
  }
  .sb-item {
    min-height: 44px;
  }
}

/* ==========================================================
   Boot sequence
   ========================================================== */
.boot {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  background: #07080a;
  color: #c9c9cf;
  font-family: var(--mono);
  font-size: clamp(0.75rem, 1.6vw, 0.875rem);
  line-height: 1.6;
}
.no-boot .boot {
  display: none;
}
.is-booting {
  overflow: hidden;
}
.boot__log {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
}
.b-head {
  color: #f4f4f5;
  font-weight: 600;
}
.b-ok {
  color: #4ade80;
  font-weight: 600;
}
.boot__skip {
  color: #8b8c97;
  font-size: 0.75rem;
}
/* the CRT turns off: collapse to a bright line, then to a dot */
.boot.is-off {
  animation: boot-off 0.5s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}
@keyframes boot-off {
  0% {
    transform: none;
    filter: none;
  }
  55% {
    transform: scale(1, 0.004);
    filter: brightness(2.5);
  }
  100% {
    transform: scale(0, 0.004);
    filter: brightness(4);
    opacity: 0;
  }
}
/* the hero assembles right after the boot screen clears */
.is-booted .hero__inner > * {
  animation: rise 0.8s var(--ease-out) both;
}
.is-booted .hero__inner > :nth-child(2) {
  animation-delay: 0.08s;
}
.is-booted .hero__inner > :nth-child(3) {
  animation-delay: 0.16s;
}
.is-booted .hero__inner > :nth-child(4) {
  animation-delay: 0.26s;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

/* ==========================================================
   Theme switch: CRT power cycle (View Transitions)
   ========================================================== */
html.vt-crt::view-transition {
  background: #000;
}
html.vt-crt::view-transition-old(root) {
  animation: crt-off 0.26s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}
html.vt-crt::view-transition-new(root) {
  animation: crt-on 0.42s 0.22s var(--ease-out) both;
}
@keyframes crt-off {
  60% {
    transform: scale(1, 0.006);
    filter: brightness(3);
  }
  100% {
    transform: scale(0, 0.006);
    filter: brightness(5);
  }
}
@keyframes crt-on {
  0% {
    transform: scale(0, 0.006);
    filter: brightness(5);
  }
  40% {
    transform: scale(1, 0.006);
    filter: brightness(3);
  }
  100% {
    transform: none;
    filter: none;
  }
}

/* ==========================================================
   Live location
   ========================================================== */
.nav__path {
  color: var(--muted);
}
@media (min-width: 761px) {
  .statusbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
  }
  body {
    padding-bottom: 36px;
  }
  html {
    scroll-padding-bottom: 48px;
  }
}

/* ==========================================================
   Git graph
   ========================================================== */
.gitlog-wrap {
  position: relative;
}
.gitgraph {
  position: absolute;
  left: 0;
  top: 0;
  width: 72px;
  overflow: visible;
  pointer-events: none;
}
.gg-track {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 2;
}
.gg-ink {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}
.gg-open {
  stroke-dasharray: 3 5;
}
.gg-lane0 {
  stroke: var(--accent);
  --lane: var(--accent);
}
.gg-lane1 {
  stroke: var(--hash);
  --lane: var(--hash);
}
.gg-lane2 {
  stroke: var(--lane2);
  --lane: var(--lane2);
}
.gg-node {
  fill: var(--bg);
  stroke-width: 2.5;
  transform-box: fill-box;
  transform-origin: center;
  transition: fill 0.3s, transform 0.45s var(--ease-out);
}
.gg-node:not(.is-lit) {
  stroke: var(--border-strong);
}
.gg-node.is-lit {
  fill: var(--lane);
  transform: scale(1.12);
}
.gg-node.gg-root.is-lit {
  fill: var(--bg);
  stroke: var(--faint);
  transform: none;
}
.ref--branch {
  color: var(--hash);
  border-color: color-mix(in srgb, var(--hash) 45%, transparent);
}
.ref--live {
  color: var(--lane2);
  border-color: color-mix(in srgb, var(--lane2) 45%, transparent);
}
.inline-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

/* ==========================================================
   Filters: sliding pill + tool-filter status
   ========================================================== */
.filters {
  position: relative;
}
.filters__pill {
  position: absolute;
  top: 0.25rem;
  bottom: 0.25rem;
  left: 0.25rem;
  width: 0;
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: transform 0.38s var(--ease-out), width 0.38s var(--ease-out), opacity 0.2s;
}
.filter {
  position: relative;
}
.filter.is-active {
  background: none;
  box-shadow: none;
}
.link-btn {
  padding: 0;
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.projects__empty b {
  color: var(--text);
  font-weight: 600;
}

/* ==========================================================
   Cards: open-in-terminal
   ========================================================== */
.term-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 30px;
  padding: 0 0.6rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s var(--ease-out);
}
.term-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.term-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.term-btn:active {
  transform: scale(0.96);
}
.project__links {
  align-items: center;
}
@media (pointer: coarse) {
  .term-btn {
    min-height: 44px;
  }
}

/* ==========================================================
   Micro-motion
   ========================================================== */
.i {
  transition: transform 0.25s var(--ease-out);
}
a:hover > .i,
a:focus-visible > .i {
  transform: translate(2px, -2px);
}
.btn:active {
  transform: translateY(0) scale(0.97);
}
.copy.is-done {
  color: #4ade80;
  border-color: #4ade80;
}
.code .ln {
  transition: opacity 0.25s, transform 0.35s var(--ease-out);
}
.code .ln.is-pending {
  opacity: 0;
  transform: translateX(-6px);
}

/* ==========================================================
   stack.json tokens + shared tooltip
   ========================================================== */
.tok {
  cursor: pointer;
  border-radius: 3px;
  transition: background-color 0.15s;
}
.tok:hover,
.tok:focus-visible {
  background: rgb(134 239 172 / 0.14);
  outline-offset: 1px;
}
.tok-tip {
  position: fixed;
  z-index: 300;
  max-width: 320px;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 16px 32px -16px rgb(0 0 0 / 0.5);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.15s, transform 0.2s var(--ease-out);
}
.tok-tip.is-on {
  opacity: 1;
  transform: none;
}
.tok-tip__hint {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
}

/* ==========================================================
   Language stats
   ========================================================== */
.langs {
  max-width: 980px;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}
.langs__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-bottom: 1rem;
}
.langs__title {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.langs__bar {
  display: flex;
  gap: 2px;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}
.langs__seg {
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s var(--ease-out), filter 0.2s;
}
.langs__bar.is-in .langs__seg {
  transform: none;
}
.langs__seg:hover {
  filter: brightness(1.25);
}
.langs__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}
.langs__legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.langs__legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.langs__legend span {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.langs__note {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--faint);
}

/* ==========================================================
   Terminal extras
   ========================================================== */
.t-red {
  color: #f87171;
}
/* vim takes over the terminal (alternate screen); the input stays focusable but invisible */
.terminal.in-vim .t-out {
  display: none;
}
.terminal.in-vim .terminal__input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}
.terminal.in-vim .terminal__body {
  overflow: hidden;
}
.t-vim {
  white-space: pre;
  overflow: hidden;
}
.t-vim b {
  font-weight: 600;
}
.vim-err {
  color: #ffffff;
  background: #c81e1e;
}

/* meltdown: a section glitches out when its folder is removed (layout is kept, so nothing jumps) */
.is-rm {
  animation: rm-out 0.28s steps(1, end) forwards !important;
}
@keyframes rm-out {
  0% {
    opacity: 1;
  }
  20% {
    opacity: 0.15;
  }
  40% {
    opacity: 0.9;
    transform: translateX(-3px);
  }
  60% {
    opacity: 0.05;
  }
  80% {
    opacity: 0.5;
    transform: translateX(2px);
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}
/* kernel panic + reboot: a full-screen console above everything, including open dialogs */
.panic {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: clamp(1rem, 3vw, 2rem);
  border: 0;
  background: #000;
  color: #d4d4d8;
  font-family: var(--mono);
  font-size: clamp(0.68rem, 1.4vw, 0.85rem);
  line-height: 1.55;
}
/* the panic window itself covers the screen; a transparent backdrop lets the CRT collapse
   reveal the restored page instead of a black void */
.panic::backdrop {
  background: transparent;
}
.panic pre {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
}
.panic.is-off {
  animation: boot-off 0.5s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

.t-snake {
  line-height: 1.15;
  touch-action: none;
  user-select: none;
}

/* ==========================================================
   Entity graph
   ========================================================== */
.graph {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1rem;
}
.graph__canvas {
  position: relative;
  min-height: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.graph__svg {
  display: block;
  width: 100%;
  height: 560px;
  touch-action: none;
  user-select: none;
}
.graph__legend {
  position: absolute;
  left: 1rem;
  bottom: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  pointer-events: none;
}
.graph__legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.lg {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.lg--me {
  background: var(--accent);
}
.lg--ctx {
  border: 2px solid var(--text);
}
.lg--proj {
  background: var(--surface);
  border: 2px solid var(--accent);
}
.lg--tool {
  width: 7px;
  height: 7px;
  background: var(--faint);
}
.g-edge {
  stroke: var(--border-strong);
  stroke-width: 1.25;
  transition: stroke 0.2s, opacity 0.2s;
}
.g-node {
  cursor: grab;
  transition: opacity 0.2s;
}
.g-node:active {
  cursor: grabbing;
}
.g-node:focus {
  outline: none;
}
.g-node circle {
  transition: r 0.25s var(--ease-out), stroke-width 0.2s;
}
.g-node text {
  font-size: 12px;
  fill: var(--muted);
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.g-hit {
  fill: transparent;
  stroke: none !important;
}
.g-node--me circle:not(.g-hit) {
  fill: var(--accent);
}
.g-node--me text {
  font-size: 14px;
  font-weight: 600;
  fill: var(--text);
}
.g-node--ctx circle:not(.g-hit) {
  fill: var(--surface);
  stroke: var(--text);
  stroke-width: 2;
}
.g-node--ctx text {
  font-weight: 600;
  fill: var(--text);
}
.g-node--proj circle:not(.g-hit) {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
}
.g-node--proj text {
  font-weight: 500;
  fill: var(--text);
}
.g-node--tool circle:not(.g-hit) {
  fill: var(--faint);
}
.g-node--tool text {
  font-family: var(--mono);
  font-size: 11px;
}
.graph.is-focusing .g-node:not(.is-near) {
  opacity: 0.18;
}
.graph.is-focusing .g-edge:not(.is-near) {
  opacity: 0.12;
}
.g-edge.is-near {
  stroke: var(--accent);
}
.g-node.is-selected circle:not(.g-hit),
.g-node:focus-visible circle:not(.g-hit) {
  stroke: var(--accent);
  stroke-width: 3;
}
.g-node.is-selected text {
  fill: var(--text);
}
.graph__panel {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.graph__hint {
  color: var(--muted);
  font-size: 0.95rem;
}
.gp-kind {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--faint);
}
.gp-title {
  margin: 0.25rem 0 0.35rem;
  font-size: 1.35rem;
}
.gp-sub {
  font-size: 0.9rem;
  color: var(--muted);
}
.gp-body {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.gp-list {
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.gp-list button {
  padding: 0.2rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.gp-list button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.gp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.gp-actions .btn {
  min-height: 38px;
  padding: 0 0.9rem;
  font-size: 0.85rem;
}
@media (max-width: 900px) {
  .graph {
    grid-template-columns: 1fr;
  }
  .graph__canvas,
  .graph__svg {
    min-height: 0;
    height: 460px;
  }
}
/* narrow screens: tool names appear only when their node is in focus */
@media (max-width: 600px) {
  .graph__canvas,
  .graph__svg {
    height: 540px;
  }
  .g-node--tool text {
    opacity: 0;
    transition: opacity 0.2s;
  }
  .graph.is-focusing .g-node--tool.is-near text {
    opacity: 1;
  }
}

/* ==========================================================
   Reduced motion
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* right-click menu */
.ctx {
  position: fixed;
  z-index: 650; /* above the game screens (.sx is 600) */
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  min-width: 220px;
  padding: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 16px 32px -16px rgb(0 0 0 / 0.6);
  font-size: 0.875rem;
}
.ctx[hidden] {
  display: none;
}
.ctx button {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
  padding: 0.4rem 0.6rem;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 6px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ctx button:hover,
.ctx button:focus-visible {
  background: var(--surface-2);
  outline: none;
}
.ctx kbd {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
}
.ctx hr {
  margin: 0.3rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.ctx button[hidden] {
  display: none;
}
.xray * {
  outline: 1px dashed var(--accent);
  font-family: var(--mono) !important;
}
/* CRT: set on <html> so a colour filter covers the page without breaking fixed/sticky children.
   The screen bend is an illusion (rounded glass corners, vignette, glare), not a real warp. */
.crt {
  filter: contrast(1.18) saturate(1.3) brightness(1.04) sepia(0.08);
  text-shadow: 0 0 3px rgb(52 211 153 / 0.55), 1px 0 rgb(255 0 80 / 0.18), -1px 0 rgb(0 200 255 / 0.18);
}
.crt body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  border-radius: 7vmin / 6vmin;
  background:
    radial-gradient(120% 90% at 30% 8%, rgb(255 255 255 / 0.07), transparent 45%),
    radial-gradient(ellipse at center, transparent 50%, rgb(0 0 0 / 0.55)),
    repeating-linear-gradient(0deg, rgb(0 0 0 / 0.32) 0 1px, transparent 1px 3px);
  box-shadow: inset 0 0 6vmin 1vmin rgb(0 0 0 / 0.75), 0 0 0 100vmax #000; /* black bezel outside the rounded glass */
}
@media (prefers-reduced-motion: no-preference) {
  .crt body::after {
    animation: crt-flicker 0.12s steps(2) infinite;
  }
}
@keyframes crt-flicker {
  50% {
    opacity: 0.94;
  }
}
.is-fall {
  transition: transform 0.5s cubic-bezier(0.7, 0, 0.84, 0), opacity 0.5s;
  transition-delay: calc(var(--i) * 0.12s);
  transform: translateY(60vh) rotate(2deg);
  opacity: 0;
}

/* game secrets (js/secrets.js) */
.sx {
  position: fixed;
  inset: 0;
  z-index: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s;
}
.sx.is-on {
  opacity: 1;
}
.sx-hk {
  width: 100%;
  height: 100%;
  pointer-events: auto;
  cursor: pointer;
}
/* Dark Souls: a dark band, widely-tracked Garamond capitals that slowly spread */
.sx-died {
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, rgb(0 0 0 / 0.55), rgb(0 0 0 / 0.92));
  transition-duration: 1.6s;
}
.sx-band {
  width: 100%;
  padding: 1.6rem 0;
  text-align: center;
  background: linear-gradient(90deg, transparent, rgb(0 0 0 / 0.85) 18%, rgb(0 0 0 / 0.85) 82%, transparent);
}
.sx-died span,
.sx-bonfire span {
  display: inline-block;
  font: 500 clamp(2.4rem, 10vw, 7rem) / 1 "EB Garamond", Garamond, Georgia, serif;
  letter-spacing: 0.08em;
  transition: letter-spacing 5s linear, transform 5s linear;
}
.sx-died span {
  color: #9b1c1c;
  text-shadow: 0 3px 22px rgb(155 28 28 / 0.45);
}
.sx-died.is-on span {
  letter-spacing: 0.24em;
  transform: scale(1.06);
}
.sx-bonfire {
  display: grid;
  place-items: center;
  background: rgb(0 0 0 / 0.55);
}
.sx-bonfire span {
  position: relative;
  color: #e9c46a;
  text-shadow: 0 3px 26px rgb(233 196 106 / 0.6);
  transition-duration: 4s;
}
.sx-bonfire.is-on span {
  letter-spacing: 0.2em;
}
.sx-flare {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgb(255 190 90 / 0.5), transparent 55%);
  transform: scale(0.3);
  transition: transform 3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sx-bonfire.is-on .sx-flare {
  transform: scale(1.6);
}
/* GTA V: desaturated screen, red lowercase-feel title with a heavy display face */
.sx-wasted {
  display: grid;
  place-items: center;
  background: rgb(0 0 0 / 0.3);
  backdrop-filter: grayscale(1) contrast(1.15) brightness(0.8);
  box-shadow: inset 0 0 18vw rgb(0 0 0 / 0.7);
  transition-duration: 1s;
}
.sx-wband {
  width: 100%;
  padding: 1rem 0;
  text-align: center;
  background: linear-gradient(90deg, transparent, rgb(0 0 0 / 0.55) 20%, rgb(0 0 0 / 0.55) 80%, transparent);
}
.sx-wasted span {
  display: inline-block;
  font: 400 clamp(3rem, 14vw, 9rem) / 1 "Bowlby One", Impact, sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #c8352b;
  text-shadow: 0 4px 0 rgb(0 0 0 / 0.5);
  transform: scale(1.5);
  transition: transform 1.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sx-wasted.is-on span {
  transform: scale(1);
}
/* GTA VI: Vice City sunset */
.sx-vice {
  display: grid;
  place-items: center;
  background: linear-gradient(#1a0538, #b0267a 55%, #ff7a3d 85%);
  transform: translateY(100%);
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s;
}
.sx-vice.is-on {
  transform: none;
}
.sx-vsvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.sx-sun {
  transform: translateY(70px);
  transition: transform 3s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s;
}
.sx-vice.is-on .sx-sun {
  transform: none;
}
.sx-vtitle {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  margin-bottom: 14vh;
  text-align: center;
  font-family: var(--font);
  color: #fff;
}
.sx-vtitle small {
  font-size: clamp(0.8rem, 2vw, 1.1rem);
  letter-spacing: 0.4em;
  text-transform: uppercase;
}
.sx-vtitle b {
  font-size: clamp(5rem, 22vw, 14rem);
  line-height: 0.9;
  color: #ff6fb0;
  text-shadow: 0 4px 0 #6d1d6b;
}
.sx-vtitle em {
  font-style: normal;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: clamp(0.75rem, 1.8vw, 1rem);
}
/* ULTRAKILL style meter */
.sx-style {
  position: fixed;
  z-index: 590;
  right: 1.25rem;
  top: 40%;
  width: 200px;
  text-align: right;
  font-family: var(--mono);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--c, #fff);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.sx-style.is-on {
  opacity: 1;
}
.sx-style.is-pop {
  animation: sx-pop 0.3s ease-out;
}
@keyframes sx-pop {
  50% {
    transform: scale(1.18);
  }
}
.sx-rank {
  font-size: 3.2rem;
  line-height: 1;
  text-shadow: 0 0 18px var(--c);
}
.sx-rname {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  min-height: 1em;
}
.sx-bar {
  height: 6px;
  margin-top: 0.4rem;
  background: rgb(255 255 255 / 0.12);
}
.sx-bar i {
  display: block;
  height: 100%;
  background: var(--c);
  transform-origin: left;
}
.sx-log {
  min-height: 5.5em;
  margin-bottom: 0.4rem;
  font-size: 0.7rem;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

/* hint under the terminal; gone after the first right-click, and on touch (no right-click) */
.psst {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.1rem auto 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
}
.psst b {
  color: var(--accent);
  font-weight: 600;
}
.psst svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.psst svg path:last-child {
  fill: var(--accent); /* the right button */
  stroke: none;
}
@media (hover: none) {
  .psst {
    display: none;
  }
}

/* a search result you jumped to */
.search-hit {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
  animation: search-hit 2.4s ease-out forwards;
}
@keyframes search-hit {
  70% {
    outline-color: var(--accent);
  }
  100% {
    outline-color: transparent;
  }
}
.palette__item .pi-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette__item .pi-hint {
  flex: none;
  margin-left: auto;
}
