/* ============================================================
   Mahmoud Salhab — personal site
   No frameworks. Tokens → base → layout → components → motion.
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --bg:        #070a0f;
  --bg-soft:   #0b1017;
  --panel:     #0f1620;
  --panel-2:   #131c28;
  --line:      #1d2836;
  --line-soft: #16202c;
  --text:      #dde6f2;
  --muted:     #8496ad;
  --dim:       #5b6b80;
  --accent:    #4fd1c5;
  --accent-2:  #7c9cff;
  --amber:     #f0b429;
  --rose:      #f2777a;
  --shadow:    0 18px 50px -22px rgb(0 0 0 / 0.85);

  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", "Cascadia Mono",
          Menlo, Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;

  --wrap: 1120px;
  --r: 12px;
  --ease: cubic-bezier(.22, .68, .32, 1);
}

[data-theme="light"] {
  --bg:        #f6f8fb;
  --bg-soft:   #eef2f7;
  --panel:     #ffffff;
  --panel-2:   #f3f6fa;
  --line:      #dde5ee;
  --line-soft: #e8eef5;
  --text:      #0e1a29;
  --muted:     #55697f;
  --dim:       #7889a0;
  --accent:    #0f9b8e;
  --accent-2:  #4059d6;
  --amber:     #b7791f;
  --rose:      #c53b3e;
  --shadow:    0 16px 40px -24px rgb(15 34 60 / 0.35);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 86px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}

/* faint engineering grid behind everything */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(to right, var(--line-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: .5;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text); }

.wrap { width: min(var(--wrap), 100% - 2.5rem); margin-inline: auto; position: relative; z-index: 1; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: #04121a; padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.mono, .prompt, kbd { font-family: var(--mono); }
.prompt { color: var(--accent); user-select: none; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  backdrop-filter: blur(14px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}
.nav.is-stuck { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; gap: 1.25rem; height: 66px; }

.brand { font-family: var(--mono); font-size: .95rem; letter-spacing: -.01em; white-space: nowrap; }
.brand__mark { color: var(--accent); }
.brand__dim { color: var(--dim); }
.brand:hover .brand__dim { color: var(--accent-2); transition: color .25s; }

.nav__links { display: flex; gap: .25rem; margin-left: auto; font-family: var(--mono); font-size: .82rem; }
.nav__links a {
  position: relative; padding: .45rem .7rem; border-radius: 7px;
  color: var(--muted); transition: color .2s var(--ease), background-color .2s var(--ease);
}
.nav__links a::before { content: ""; opacity: 0; }
.nav__links a:hover { color: var(--text); background: var(--panel); }
.nav__links a.is-active { color: var(--accent); }
.nav__links a.is-active::after {
  content: ""; position: absolute; left: .7rem; right: .7rem; bottom: .1rem;
  height: 1.5px; background: var(--accent); border-radius: 2px;
}

.nav__tools { display: flex; align-items: center; gap: .4rem; }
.iconbtn {
  display: inline-flex; align-items: center; gap: .4rem;
  height: 36px; padding: 0 .6rem; border-radius: 9px;
  border: 1px solid var(--line); color: var(--muted); background: var(--panel);
  transition: color .2s, border-color .2s, transform .2s var(--ease);
}
.iconbtn:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-1px); }
.iconbtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.kbd-hint { font-size: .68rem; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: .05rem .3rem; }

.ico-sun { display: none; }
[data-theme="light"] .ico-sun { display: block; }
[data-theme="light"] .ico-moon { display: none; }

.iconbtn--menu { display: none; flex-direction: column; justify-content: center; gap: 4px; width: 38px; padding: 0; }
.iconbtn--menu span { display: block; width: 16px; height: 1.6px; background: currentColor; border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
.nav.is-open .iconbtn--menu span:nth-child(1) { transform: translateY(5.6px) rotate(45deg); }
.nav.is-open .iconbtn--menu span:nth-child(2) { opacity: 0; }
.nav.is-open .iconbtn--menu span:nth-child(3) { transform: translateY(-5.6px) rotate(-45deg); }

.nav__progress {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .1s linear;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  padding: 7.5rem 0 5rem;
  overflow: hidden;
}
.hero__canvas {
  position: absolute; inset: auto 0 0 0; width: 100%; height: 38%; opacity: .45; z-index: 0;
  mask-image: linear-gradient(to bottom, transparent, #000 45%);
}
/* neuron field — densest on the empty right side so it never fights the copy */
.hero__net {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .75;
  mask-image: linear-gradient(to right, transparent 2%, rgb(0 0 0 / .35) 30%, #000 62%);
}
@media (max-width: 900px) { .hero__net { opacity: .4; } }
.hero__glow {
  position: absolute; z-index: 0; top: -18%; left: 50%; translate: -50% 0;
  width: min(1000px, 120%); aspect-ratio: 1.6;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 16%, transparent), transparent 72%);
  filter: blur(20px); pointer-events: none;
}
.hero__inner { display: flex; flex-direction: column; align-items: flex-start; }

.terminal {
  width: min(560px, 100%);
  border: 1px solid var(--line); border-radius: var(--r);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: var(--shadow); overflow: hidden;
  margin-bottom: 2.2rem;
}
.terminal__bar {
  display: flex; align-items: center; gap: .4rem;
  padding: .55rem .8rem; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot--r { background: var(--rose); } .dot--y { background: var(--amber); } .dot--g { background: var(--accent); }
.terminal__title { margin-left: .6rem; font-family: var(--mono); font-size: .72rem; color: var(--dim); }
.terminal__body { padding: .9rem 1rem 1rem; font-family: var(--mono); font-size: .84rem; }
.terminal__body .line { margin: 0; }
.cmd::after {
  content: "▋"; color: var(--accent);
  animation: blink 1.05s steps(1) infinite;
}
.terminal.is-done .cmd::after { content: ""; }
@keyframes blink { 50% { opacity: 0; } }
.term-out { color: var(--muted); }
.term-out div { opacity: 0; animation: fadeUp .45s var(--ease) forwards; }
.term-out b { color: var(--text); font-weight: 600; }
.term-out .ok { color: var(--accent); }

.hero__name {
  font-size: clamp(2.9rem, 9vw, 5.6rem);
  line-height: .95; letter-spacing: -.035em; font-weight: 800;
  margin: 0 0 .6rem;
}
.hero__name .accent { color: var(--accent); }
.reveal-char-wrap { display: inline-block; }
.reveal-char-wrap .ch {
  display: inline-block; opacity: 0; transform: translateY(.45em) rotate(4deg);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.reveal-char-wrap .ch.on { opacity: 1; transform: none; }

.hero__role {
  font-family: var(--mono); font-size: clamp(.95rem, 2.4vw, 1.15rem);
  color: var(--accent-2); margin: 0 0 .35rem; letter-spacing: .02em;
}
.hero__tag { color: var(--muted); font-size: 1.05rem; margin: 0 0 2rem; max-width: 46ch; }

.hero__cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 3rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.2rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel);
  font-family: var(--mono); font-size: .85rem; color: var(--text);
  transition: transform .2s var(--ease), border-color .2s, background-color .2s, color .2s, box-shadow .25s;
}
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); color: var(--accent); }
.btn--primary {
  background: var(--accent); color: #04141a; border-color: var(--accent); font-weight: 600;
}
[data-theme="light"] .btn--primary { color: #fff; }
.btn--primary:hover { color: #04141a; box-shadow: 0 10px 30px -12px var(--accent); }
[data-theme="light"] .btn--primary:hover { color: #fff; }

.hero__stats { list-style: none; display: flex; flex-wrap: wrap; gap: 2.4rem; margin: 0; padding: 0; }
.hero__stats li { display: flex; flex-direction: column; }
.hero__stats .num {
  font-family: var(--mono); font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700;
  color: var(--text); line-height: 1.1;
}
.hero__stats .num span { color: var(--accent); }
.hero__stats .lab { font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); }

.scroll-cue {
  position: absolute; bottom: 1.6rem; left: 50%; translate: -50% 0;
  width: 22px; height: 34px; border: 1.5px solid var(--line); border-radius: 12px;
  display: grid; place-items: start center; padding-top: 6px; z-index: 2;
}
.scroll-cue span { width: 3px; height: 6px; border-radius: 2px; background: var(--accent); animation: cue 1.7s var(--ease) infinite; }
@keyframes cue { 0%,100% { transform: translateY(0); opacity: 1; } 60% { transform: translateY(11px); opacity: 0; } }

/* ---------- sections ---------- */
.section { padding: 6rem 0; position: relative; }
.section--contact { padding-bottom: 5rem; }

.sec-head {
  font-family: var(--mono); font-size: clamp(1.25rem, 3.4vw, 1.7rem); font-weight: 700;
  letter-spacing: -.01em; margin: 0 0 2.6rem; display: flex; align-items: baseline; gap: .6rem;
}
.sec-head::before {
  content: attr(data-index);
  font-size: .7rem; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 5px; padding: .1rem .4rem; letter-spacing: .06em;
}
.sec-slash { color: var(--dim); }
.sec-head::after {
  content: ""; flex: 1; height: 1px; margin-left: .4rem;
  background: linear-gradient(90deg, var(--line), transparent);
}

.sub-head {
  font-family: var(--mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .16em;
  color: var(--dim); margin: 0 0 1.1rem; font-weight: 600;
}
.sub-head.mt { margin-top: 2.6rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }

/* grid children default to min-width:auto, which lets wide content (the code
   block, long paper titles) push the whole page wider than the viewport */
.about > *, .two-col > *, .grid > *, .stack > * { min-width: 0; }

/* ---------- about ---------- */
.about { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: start; }
.about__text p { margin: 0 0 1.6rem; font-size: 1.06rem; color: var(--muted); }
.about__text p strong { color: var(--text); }

.focus { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.focus li {
  font-family: var(--mono); font-size: .78rem; padding: .35rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  transition: color .2s, border-color .2s, transform .2s var(--ease);
}
.focus li:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); }

.codecard {
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  background: var(--panel); box-shadow: var(--shadow);
}
.codecard__head {
  padding: .5rem .85rem; border-bottom: 1px solid var(--line); background: var(--panel-2);
  font-family: var(--mono); font-size: .72rem; color: var(--dim);
}
.codecard__body { margin: 0; padding: 1rem; overflow-x: auto; font-family: var(--mono); font-size: .78rem; line-height: 1.75; }
.codecard__body .k { color: var(--accent-2); }
.codecard__body .s { color: var(--amber); }
.codecard__body .n { color: var(--accent); }
.codecard__body .p { color: var(--dim); }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 2.2rem; }
.timeline__rail {
  position: absolute; left: 6px; top: .5rem; bottom: .5rem; width: 2px;
  background: var(--line); border-radius: 2px; overflow: hidden;
}
.timeline__rail i { display: block; width: 100%; height: 0; background: linear-gradient(180deg, var(--accent), var(--accent-2)); }

.job { position: relative; padding-bottom: 2.6rem; }
.job:last-child { padding-bottom: 0; }
.job::before {
  content: ""; position: absolute; left: calc(-2.2rem + 1px); top: .55rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line);
  transition: border-color .35s var(--ease), box-shadow .35s var(--ease);
}
.job.is-in::before { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.job--current::before { animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); }
  50%      { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 0%, transparent); }
}

.job__meta { font-family: var(--mono); font-size: .74rem; color: var(--dim); letter-spacing: .04em; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.job__now { color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 999px; padding: 0 .45rem; font-size: .68rem; }
.job__role { font-size: 1.2rem; font-weight: 700; margin: .25rem 0 .1rem; letter-spacing: -.01em; }
.job__org { font-family: var(--mono); font-size: .86rem; color: var(--accent-2); margin: 0 0 .7rem; }
.job__org .conf { color: var(--dim); border-bottom: 1px dashed var(--line); cursor: help; }
.job__detail { margin: 0 0 .85rem; color: var(--muted); max-width: 78ch; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; margin: 0; padding: 0; }
.tags li {
  font-family: var(--mono); font-size: .7rem; padding: .18rem .5rem; border-radius: 5px;
  background: var(--panel); border: 1px solid var(--line-soft); color: var(--dim);
}

/* ---------- projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.8rem; }
.filter {
  font-family: var(--mono); font-size: .76rem; padding: .38rem .8rem; border-radius: 8px;
  border: 1px solid var(--line); color: var(--muted); background: var(--panel);
  transition: color .2s, border-color .2s, background-color .2s, transform .15s var(--ease);
}
.filter:hover { transform: translateY(-1px); color: var(--text); }
.filter.is-active { color: #04141a; background: var(--accent); border-color: var(--accent); font-weight: 600; }
[data-theme="light"] .filter.is-active { color: #fff; }
.filter .count { opacity: .6; margin-left: .3rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }

.card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  padding: 1.3rem 1.3rem 1.15rem;
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.card .tags { margin-top: auto; }
.card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%),
              color-mix(in srgb, var(--accent) 12%, transparent), transparent 65%);
  transition: opacity .3s;
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); box-shadow: var(--shadow); }
.card:hover::after { opacity: 1; }
.card.is-hidden { display: none; }

.card__top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .5rem; }
.card__cat { font-family: var(--mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .13em; color: var(--accent); }
.card__org { font-family: var(--mono); font-size: .68rem; color: var(--dim); }
.card__name { font-size: 1.08rem; font-weight: 700; margin: 0 0 .5rem; letter-spacing: -.01em; }
.card__detail { margin: 0 0 .9rem; font-size: .92rem; color: var(--muted); }
.card__detail.is-clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.card__more {
  align-self: flex-start; text-align: left;
  font-family: var(--mono); font-size: .72rem; color: var(--accent); margin-bottom: .8rem;
}
.card__more:hover { text-decoration: underline; }

/* ---------- research ---------- */
.papers { list-style: none; margin: 0; padding: 0; counter-reset: p; }
.papers li {
  position: relative; padding: 1rem 0 1rem 2.4rem; border-bottom: 1px solid var(--line-soft);
  transition: padding-left .25s var(--ease);
}
.papers li:hover { padding-left: 2.7rem; }
.papers li::before {
  counter-increment: p; content: "[" counter(p) "]";
  position: absolute; left: 0; top: 1rem; font-family: var(--mono); font-size: .74rem; color: var(--accent);
}
.papers .t { font-weight: 600; display: block; margin-bottom: .2rem; }
.papers a.t:hover { color: var(--accent); }
.papers .m { font-family: var(--mono); font-size: .74rem; color: var(--dim); }
.papers .m .v { color: var(--accent-2); }

.awards { list-style: none; margin: 0; padding: 0; }
.awards li { display: flex; gap: .7rem; padding: .55rem 0; color: var(--muted); }
.awards .medal { color: var(--amber); font-family: var(--mono); }
.awards b { color: var(--text); font-weight: 600; }

/* ---------- stack ---------- */
.stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.1rem; }
.stack__group {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); padding: 1.15rem 1.2rem;
  transition: border-color .3s, transform .3s var(--ease);
}
.stack__group:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); transform: translateY(-3px); }
.stack__title { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 0 0 .85rem; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li {
  font-family: var(--mono); font-size: .76rem; padding: .28rem .6rem; border-radius: 7px;
  background: var(--panel-2); border: 1px solid var(--line-soft); color: var(--muted);
  transition: color .18s, border-color .18s, transform .18s var(--ease);
}
.chips li:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-2px); }

/* ---------- lists ---------- */
.plainlist { list-style: none; margin: 0; padding: 0; }
.plainlist li { padding: .85rem 0; border-bottom: 1px solid var(--line-soft); }
.plainlist .t { font-weight: 600; }
.plainlist .m { font-family: var(--mono); font-size: .75rem; color: var(--dim); }
.plainlist .d { color: var(--muted); font-size: .93rem; margin: .35rem 0 0; }

.courses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.courses li { display: flex; gap: .8rem; padding: .5rem 0; border-bottom: 1px dashed var(--line-soft); font-size: .93rem; }
.courses .y { font-family: var(--mono); font-size: .75rem; color: var(--accent); flex: none; width: 3rem; padding-top: .18rem; }
.courses .o { color: var(--dim); font-family: var(--mono); font-size: .74rem; }

.langs { list-style: none; margin: 0; padding: 0; }
.langs li { padding: .55rem 0; }
.langs .row { display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: .35rem; }
.langs .lvl { font-family: var(--mono); font-size: .74rem; color: var(--dim); }
.langs .bar { height: 5px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--line-soft); overflow: hidden; }
.langs .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 1.1s var(--ease); }

/* ---------- contact ---------- */
.contact__lead { font-size: 1.15rem; color: var(--muted); max-width: 58ch; margin: 0 0 2rem; }
.contact__links { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; }
.clink {
  display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  transition: transform .25s var(--ease), border-color .25s, background-color .25s;
}
.clink:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.clink svg { width: 19px; height: 19px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.clink .lab { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); display: block; }
.clink .val { font-size: .95rem; word-break: break-word; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 2.2rem 0 3rem; background: var(--bg-soft); position: relative; z-index: 1; }
.footer__inner { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; align-items: center; font-family: var(--mono); font-size: .78rem; color: var(--dim); }
.footer p { margin: 0; }

/* ---------- command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 200; display: grid; place-items: start center; padding-top: 12vh; }
.palette[hidden] { display: none; }
.palette__backdrop { position: absolute; inset: 0; background: rgb(2 5 10 / .68); backdrop-filter: blur(3px); animation: fade .2s var(--ease); }
.palette__panel {
  position: relative; width: min(600px, 92vw);
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / .9); overflow: hidden;
  animation: pop .22s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.palette__inputwrap { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.palette__inputwrap input {
  flex: 1; background: none; border: 0; outline: none; color: var(--text);
  font-family: var(--mono); font-size: .95rem;
}
.palette__inputwrap input::placeholder { color: var(--dim); }
.palette__inputwrap kbd { font-size: .66rem; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: .1rem .35rem; }
.palette__list { list-style: none; margin: 0; padding: .4rem; max-height: 50vh; overflow-y: auto; }
.palette__list li {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 8px;
  cursor: pointer; font-size: .9rem;
}
.palette__list li .type { font-family: var(--mono); font-size: .66rem; color: var(--dim); margin-left: auto; text-transform: uppercase; letter-spacing: .1em; }
.palette__list li.is-sel { background: var(--panel-2); color: var(--accent); }
.palette__empty { padding: 1.2rem; text-align: center; color: var(--dim); font-family: var(--mono); font-size: .82rem; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 2rem; translate: -50% 0; z-index: 300;
  padding: .7rem 1.1rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); box-shadow: var(--shadow);
  font-family: var(--mono); font-size: .82rem;
  opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast.is-on { opacity: 1; transform: translateY(0); }

/* ---------- reveal motion ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .65s var(--ease), transform .65s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .about, .two-col { grid-template-columns: 1fr; gap: 2.2rem; }
  .nav__links {
    position: fixed; inset: 66px 0 auto 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: .6rem 1.25rem 1.2rem; font-size: .95rem;
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
  }
  .nav.is-open .nav__links { opacity: 1; transform: none; pointer-events: auto; }
  .nav__links a { padding: .7rem .2rem; border-bottom: 1px solid var(--line-soft); border-radius: 0; }
  .nav__links a.is-active::after { display: none; }
  .iconbtn--menu { display: flex; }
  .kbd-hint { display: none; }
  .section { padding: 4.5rem 0; }
  .hero__stats { gap: 1.6rem 2rem; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .terminal { font-size: .78rem; }
  .hero { padding-top: 6rem; }
  .hero__cta .btn { flex: 1 1 auto; justify-content: center; }
  .hero__stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4rem 1rem; }
  .scroll-cue { display: none; }
  .grid { grid-template-columns: 1fr; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero__canvas { display: none; }
}

/* ---------- print ---------- */
@media print {
  .nav, .hero__canvas, .hero__glow, .scroll-cue, .palette, .toast, .filters, .hero__cta, .footer__meta { display: none !important; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .section { padding: 1.2rem 0; break-inside: avoid; }
  .card, .stack__group, .codecard { border-color: #ccc; box-shadow: none; }
}
