/* =========================================================
   Terminal theme · Aarav Nair demo portfolio
   Dark, IDE-inspired. Plain CSS, no build step.
   ========================================================= */

:root {
  --bg: #0b0f0c;
  --bg-2: #0e140f;
  --panel: #111813;
  --line: #1e2a22;
  --line-2: #2a3a2f;
  --text: #d7e3d9;
  --text-hi: #eef6f0;
  --text-2: #a9b8ad;
  --muted: #7d8f82;
  --dim: #4f6355;
  --accent: #39ff88;
  --accent-ink: #06120a;
  --amber: #ffb547;
  --teal: #6fd3c4;

  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --display: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 12px;
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1200px;
  --topbar-h: 56px;
  --gap: clamp(16px, 2.2vw, 24px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(.875rem, .84rem + .18vw, .97rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle scanlines + film grain over everything (decorative only) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, .016) 0 1px, transparent 1px 3px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
}

[hidden] { display: none !important; }
img, svg { max-width: 100%; }
a { color: inherit; }
p { margin: 0 0 1em; }
h1, h2, h3 { text-wrap: balance; }
::selection { background: rgba(57, 255, 136, .28); color: var(--text-hi); }

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

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

.skip-link {
  position: absolute; left: 12px; top: -80px; z-index: 100;
  padding: 12px 18px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; text-decoration: none;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.ico { width: 16px; height: 16px; flex: none; }
.accent { color: var(--accent); }
.comment { color: var(--muted); }
.muted { color: var(--muted); }
.ps { color: var(--accent); font-weight: 700; }
.tok-kw { color: var(--teal); }
.tok-str, .tok-a { color: var(--amber); }
.tok-p { color: var(--muted); }
.tok-g { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 20px;
  border: 1px solid transparent; border-radius: 8px;
  font: inherit; font-size: 14px; font-weight: 500; line-height: 1.2;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .25s, background-color .2s, border-color .2s, color .2s;
}
.btn--primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 8px 28px -8px rgba(57, 255, 136, .6); }
.btn--ghost { background: rgba(17, 24, 19, .6); color: var(--text); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--accent); color: var(--text-hi); }
.btn--sm { min-height: 44px; padding: 0 16px; font-size: 13px; }
.btn:active { transform: translateY(0); }

/* ---------- Top bar (editor tabs) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 20, 15, .88);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: stretch; gap: 20px; height: var(--topbar-h); }

.brand {
  display: flex; align-items: center; gap: 10px; flex: none;
  color: var(--text-hi); text-decoration: none; font-weight: 700; font-size: 15px;
}
.brand__mark {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel);
  color: var(--accent); font-size: 13px; letter-spacing: -.08em;
}
.brand__dim { color: var(--muted); font-weight: 400; }

.nav { flex: 1; display: flex; align-items: stretch; min-width: 0; }
.tabs { list-style: none; margin: 0; padding: 0; display: flex; align-items: stretch; }
.tabs__head, .tab__hint { display: none; }
.tab {
  position: relative; display: flex; align-items: center; gap: 8px;
  height: 100%; padding: 0 16px;
  color: var(--muted); text-decoration: none; font-size: 13px; white-space: nowrap;
  border-right: 1px solid var(--line);
  transition: color .2s, background-color .2s;
}
.tabs li:nth-child(2) .tab { border-left: 1px solid var(--line); }
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .025); }
.tab[aria-current] { color: var(--text-hi); background: var(--bg); }
.tab[aria-current]::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent);
}
.tab[aria-current]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--bg);
}
.tab:focus-visible { outline-offset: -2px; }
.fi { min-width: 1.6em; text-align: center; font-size: 11px; font-weight: 700; }
.fi--md { color: var(--teal); }
.fi--json { color: var(--amber); }
.fi--yml { color: #9be7b4; }
.fi--log { color: #b6c4ba; }
.fi--sh { color: var(--accent); }

.topbar__cta { margin-left: auto; align-self: center; background: rgba(57, 255, 136, .08); color: var(--accent); border-color: rgba(57, 255, 136, .45); }
.topbar__cta:hover { background: var(--accent); color: var(--accent-ink); }
.nav-toggle { display: none; }

@media (max-width: 1179.98px) and (min-width: 960px) {
  .tab { padding: 0 13px; }
  .topbar__cta { display: none; } /* tabs need the room; hero + contact.sh cover it */
}

/* Mobile: tabs become an "explorer" dropdown (only when JS is running) */
@media (max-width: 959.98px) {
  .nav { overflow-x: auto; scrollbar-width: none; }
  .js .nav { overflow: visible; justify-content: flex-end; }
  .js .nav-toggle {
    display: inline-flex; align-items: center; gap: 10px; align-self: center;
    min-height: 44px; padding: 0 14px;
    border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel);
    color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
  }
  .nav-toggle__icon { position: relative; width: 16px; height: 12px; }
  .nav-toggle__icon i {
    position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: var(--accent);
    transition: transform .25s var(--ease), opacity .2s;
  }
  .nav-toggle__icon i:nth-child(1) { top: 0; }
  .nav-toggle__icon i:nth-child(2) { top: 5px; width: 70%; }
  .nav-toggle__icon i:nth-child(3) { top: 10px; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__icon i:nth-child(1) { transform: translateY(5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle__icon i:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__icon i:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

  .js .tabs {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px;
    max-height: calc(100vh - var(--topbar-h)); overflow-y: auto;
    padding: 8px var(--gutter) 18px;
    background: var(--bg-2); border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .7);
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .2s, transform .25s var(--ease), visibility 0s .25s;
  }
  .js .tabs.is-open { visibility: visible; opacity: 1; transform: none; transition: opacity .2s, transform .25s var(--ease); }
  .js .tabs__head {
    display: block; padding: 6px 12px 8px;
    font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  }
  .js .tab { height: auto; min-height: 50px; padding: 0 12px; border: 0 !important; border-radius: 8px; font-size: 14px; }
  .js .tab__hint { display: block; margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--muted); }
  .js .tab[aria-current] { background: var(--panel); }
  .js .tab[aria-current]::before { top: 12px; bottom: 12px; right: auto; width: 2px; height: auto; }
  .js .tab[aria-current]::after { display: none; }
}
@media (max-width: 559.98px) { .topbar__cta { display: none; } }
@media (min-width: 560px) and (max-width: 959.98px) { .js .nav { flex: none; order: 3; } .topbar__cta { margin-left: auto; } }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(40px, 7vw, 96px) clamp(48px, 6vw, 80px);
  overflow: hidden;
  overflow: clip;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(57, 255, 136, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 136, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: center -1px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 65% 35%, #000 15%, transparent 72%);
  mask-image: radial-gradient(ellipse 75% 65% at 65% 35%, #000 15%, transparent 72%);
}
.hero::after {
  content: ""; position: absolute; pointer-events: none;
  width: min(900px, 90vw); aspect-ratio: 1; right: -18%; top: -30%;
  background: radial-gradient(closest-side, rgba(57, 255, 136, .09), transparent);
}
.hero__grid { position: relative; z-index: 1; display: grid; gap: clamp(36px, 5vw, 64px); align-items: center; }
@media (min-width: 1024px) { .hero__grid { grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr); } }

.status {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 22px; padding: 6px 14px 6px 12px;
  border: 1px solid var(--line-2); border-radius: 999px; background: rgba(17, 24, 19, .75);
  font-size: 12.5px; color: var(--text);
}
.status__dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.status__dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent);
  opacity: 0; animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: .6; } 80%, 100% { transform: scale(3); opacity: 0; } }

.hero__name {
  margin: 0 0 18px;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2.6rem, 1.3rem + 6.2vw, 6rem);
  line-height: .95; letter-spacing: -.035em; color: var(--text-hi);
}
.hero__role { margin: 0 0 18px; font-size: clamp(.78rem, .6rem + 1.1vw, 1.125rem); }
.hero__lede { max-width: 56ch; margin: 0; color: var(--text-2); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 26px; }
.hero__meta {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: var(--muted);
}
.hero__meta li { display: inline-flex; align-items: center; gap: 8px; }
.hero__meta .ico { color: var(--accent); opacity: .8; }
@media (max-width: 419.98px) { .hero__cta .btn { flex: 1 1 100%; } }

/* ---------- Terminal window (hero + contact) ---------- */
.term {
  position: relative; min-width: 0;
  background: linear-gradient(180deg, rgba(19, 27, 21, .97), rgba(13, 19, 15, .97));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .03);
}
.term__bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.dots { display: flex; gap: 7px; flex: none; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #2b3a30; }
.term:hover .dots i:nth-child(1) { background: #e5675e; }
.term:hover .dots i:nth-child(2) { background: var(--amber); }
.term:hover .dots i:nth-child(3) { background: var(--accent); }
.term__title {
  flex: 1; min-width: 0; margin: 0; padding-right: 51px; text-align: center;
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.term__body { padding: 18px clamp(14px, 2.4vw, 22px) 22px; font-size: clamp(11.5px, .55rem + .55vw, 14px); line-height: 1.8; }
.tl { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-hi); }
.tl--out { color: var(--text-2); }
.tl:not(.tl--out):not(:first-child) { margin-top: .55em; }
.caret {
  display: none; width: .62em; height: 1.2em; margin-left: 1px;
  background: var(--accent); vertical-align: -.25em;
}
.tl--last .caret { display: inline-block; animation: blink 1.1s steps(1) infinite; }
.tl.is-active .caret { display: inline-block; }
@keyframes blink { 50% { opacity: 0; } }

/* Typing mode (added by JS when motion is allowed) */
.term.is-anim .tl { opacity: 0; }
.term.is-anim .tl.is-on { opacity: 1; }
.term.is-anim .cmd { display: inline-block; vertical-align: top; overflow: hidden; white-space: pre; }

/* ---------- Hero stats ---------- */
.stats {
  list-style: none; margin: clamp(44px, 6vw, 76px) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); } }
.stat {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: clamp(14px, 2vw, 20px);
  background: rgba(17, 24, 19, .7); border: 1px solid var(--line); border-radius: var(--radius);
}
.stat__num {
  font-family: var(--display); font-weight: 700; line-height: 1; letter-spacing: -.02em;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); color: var(--text-hi);
}
.stat__num small { margin-left: 3px; font-size: .5em; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.stat__label { font-size: 12.5px; line-height: 1.5; color: var(--muted); }

/* ---------- Sections ---------- */
.section { position: relative; padding-block: clamp(64px, 8vw, 104px); border-top: 1px solid rgba(30, 42, 34, .7); }
[id] { scroll-margin-top: calc(var(--topbar-h) + 12px); }
.sec-head { margin-bottom: clamp(28px, 4vw, 48px); }
.sec-crumb { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }
.sec-crumb::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-2), transparent); }
.sec-num { color: var(--accent); font-weight: 700; }
.sec-file { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-file b { color: var(--text); font-weight: 500; }
.sec-title {
  margin: 0;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2rem, 1.25rem + 3.2vw, 3.5rem);
  line-height: 1.05; letter-spacing: -.03em; color: var(--text-hi);
}
.sec-title .glyph { color: var(--accent); font-family: var(--mono); font-weight: 400; opacity: .85; }
.sec-sub { margin: 16px 0 0; font-size: 13.5px; color: var(--text-2); }

/* Shared panel shells */
.editor, .panel, .card, .avatar-card, .envfile {
  position: relative; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}

/* ---------- Editor (about.md / stack.yml) ---------- */
.editor__bar {
  display: flex; align-items: stretch; justify-content: space-between; gap: 12px;
  min-height: 42px; padding-right: 16px;
  border-bottom: 1px solid var(--line); background: var(--bg-2);
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 12.5px;
}
.editor__file {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 16px; background: var(--panel); border-right: 1px solid var(--line); color: var(--text);
  border-top-left-radius: var(--radius);
}
.editor__file::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--accent); border-top-left-radius: var(--radius); }
.editor__meta { display: flex; align-items: center; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.editor__body { padding: 18px clamp(14px, 2.4vw, 24px) 22px 0; counter-reset: ln; font-size: clamp(.86rem, .83rem + .15vw, .95rem); }
.ml { position: relative; margin: 0; min-height: 1.7em; padding-left: 3.4em; color: var(--text-2); counter-increment: ln; }
.ml::before {
  content: counter(ln); position: absolute; left: 0; width: 2.4em; text-align: right;
  color: var(--dim); user-select: none; -webkit-user-select: none;
}
.ml + .ml:not(.ml--blank):not(.ml--li) { margin-top: .1em; }
.md-mark { color: var(--dim); }
.ml strong { color: var(--amber); font-weight: 500; }
.ml--h1 { color: var(--text-hi); font-weight: 700; }
.ml--h2 { color: var(--teal); font-weight: 700; }
.ml--li { padding-left: calc(3.4em + 2ch); text-indent: -2ch; }
.ml--li .md-mark { color: var(--accent); }
.ml--quote { color: var(--muted); }

/* Code colouring (stack.yml) */
.code .ml { white-space: pre-wrap; color: var(--text); }
.code .ml--in { padding-left: calc(3.4em + 2ch); }
.code .k { color: var(--teal); }
.code .s { color: var(--amber); }
.code .c { color: var(--muted); }
.code .p { color: var(--muted); }

/* ---------- About ---------- */
.about { display: grid; gap: var(--gap); }
@media (min-width: 900px) {
  .about { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
  .profile { position: sticky; top: calc(var(--topbar-h) + 24px); }
}
.profile { display: grid; gap: var(--gap); min-width: 0; }
@media (min-width: 600px) and (max-width: 899.98px) { .profile { grid-template-columns: 1fr 1fr; } }

.avatar-card { display: flex; align-items: center; gap: 18px; padding: 18px; }
.avatar {
  position: relative; flex: none; width: clamp(84px, 22vw, 112px); aspect-ratio: 1;
  border-radius: 10px; overflow: hidden;
  background: linear-gradient(160deg, #1f5536, #0f2619 70%);
  border: 1px solid var(--line-2);
}
.avatar svg { display: block; width: 100%; height: 100%; }
.avatar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .16) 0 1px, transparent 1px 3px);
}
.avatar-card__meta { min-width: 0; }
.avatar-card__meta p { margin: 0; }
.avatar-card__name { font-family: var(--display); font-weight: 700; font-size: 1.3rem; color: var(--text-hi); line-height: 1.2; }
.avatar-card__handle { font-size: 13px; color: var(--muted); }
.avatar-card__online { display: flex; align-items: center; gap: 8px; margin-top: 8px !important; font-size: 12.5px; color: var(--text-2); }
.dot-on { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(57, 255, 136, .7); flex: none; }

.envfile { padding: 18px 20px; font-size: 13.5px; }
.envfile__title { margin: 0 0 10px; color: var(--muted); }
.envfile__list { margin: 0; display: grid; gap: 5px; }
.envfile__list div { display: flex; flex-wrap: wrap; }
.envfile__list dt { color: var(--teal); }
.envfile__list dt::after { content: "="; color: var(--muted); }
.envfile__list dd { margin: 0; color: var(--amber); overflow-wrap: anywhere; }
.envfile__list dd.num { color: var(--accent); }

/* ---------- Projects ---------- */
.projects { display: grid; gap: var(--gap); }
@media (min-width: 720px) {
  .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card--featured { grid-column: 1 / -1; }
  .card--featured .card__thumb { aspect-ratio: 2 / 1; }
}
@media (min-width: 1024px) {
  .card.card--featured { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .card--featured .card__thumb {
    aspect-ratio: auto; min-height: 280px; height: 100%;
    border-bottom: 0; border-right: 1px solid var(--line);
    border-radius: var(--radius) 0 0 var(--radius);
  }
}
.card { display: flex; flex-direction: column; transition: border-color .25s; }
.card:hover { border-color: var(--line-2); }
.card__thumb {
  display: grid; place-items: center; overflow: hidden;
  aspect-ratio: 16 / 10;
  background-color: #0d140f;
  background-image: radial-gradient(rgba(125, 143, 130, .16) 1px, transparent 1.3px);
  background-size: 14px 14px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card__thumb svg { display: block; width: 100%; height: 100%; font-family: var(--mono); }
.card__thumb .t-head { font-family: var(--display); }
.card__body { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: clamp(18px, 2.2vw, 22px); }
.card--featured .card__body { justify-content: center; padding: clamp(20px, 3.4vw, 40px); }
.card__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.card__title {
  margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0;
  font-family: var(--mono); font-size: 1.05rem; font-weight: 700; color: var(--text-hi);
  overflow-wrap: anywhere;
}
.card__title .ico { color: var(--muted); }
.card__owner { color: var(--muted); font-weight: 400; }
.card--featured .card__title { font-size: clamp(1.05rem, 1rem + .35vw, 1.3rem); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px solid; border-radius: 999px; font-size: 12px; line-height: 1.4;
}
.badge--amber { color: var(--amber); border-color: rgba(255, 181, 71, .35); background: rgba(255, 181, 71, .08); }
.card__desc { margin: 0; color: var(--text-2); font-size: .93em; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.tags li {
  padding: 2px 9px; border-radius: 6px; font-size: 12px;
  color: #b4f3cc; background: rgba(57, 255, 136, .07); border: 1px solid rgba(57, 255, 136, .15);
}
.card__foot {
  margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
}
.card__stats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.card__stats li { display: inline-flex; align-items: center; gap: 6px; }
.lang-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.card__links { display: flex; gap: 6px; }
.card__links a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 13px;
  transition: border-color .2s, color .2s;
}
.card__links a:hover { border-color: var(--accent); color: var(--accent); }

/* Thumbnail micro-animations */
.t-scan { animation: scan 2.6s ease-in-out infinite alternate; }
@keyframes scan { to { transform: translateY(92px); } }
.t-bus { transform: translate(160px, 60px); animation: bus 14s linear infinite alternate; }
@keyframes bus {
  0% { transform: translate(30px, 160px); }
  11.6% { transform: translate(30px, 110px); }
  30.2% { transform: translate(110px, 110px); }
  41.9% { transform: translate(110px, 60px); }
  65.1% { transform: translate(210px, 60px); }
  81.4% { transform: translate(210px, 130px); }
  100% { transform: translate(290px, 130px); }
}
.t-bus__ring, .t-ping { transform-box: fill-box; transform-origin: center; animation: ring 1.8s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.6); opacity: .55; } 100% { transform: scale(1.7); opacity: 0; } }
.t-ping { animation-name: ping-soft; }
@keyframes ping-soft { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.t-caret { animation: blink 1.1s steps(1) infinite; }

/* Cursor-following border glow (pointer devices only; JS sets --mx/--my) */
@media (hover: hover) and (pointer: fine) {
  .glow::before, .glow::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    opacity: 0; transition: opacity .4s;
  }
  .glow::before {
    z-index: 3; padding: 1px;
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(57, 255, 136, .8), rgba(57, 255, 136, .18) 45%, transparent 70%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
  }
  .glow::after {
    z-index: 2;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(57, 255, 136, .045), transparent 45%);
  }
  .glow-live .glow::before, .glow-live .glow::after { opacity: 1; }
}

/* ---------- Skills ---------- */
.skills { display: grid; gap: var(--gap); }
@media (min-width: 1024px) { .skills { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } .heat-panel { grid-column: 1 / -1; } }
.skills__side { display: grid; gap: var(--gap); align-content: start; min-width: 0; }
@media (min-width: 640px) and (max-width: 1023.98px) { .skills__side { grid-template-columns: 1fr 1fr; } }
.panel { padding: clamp(18px, 2.2vw, 24px); }
.panel__title { margin: 0 0 16px; font-size: 13px; color: var(--text); }

.langbar { display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); }
.langbar span { flex: 0 1 var(--w); background: var(--c); transform-origin: left center; }
.js .langbar span { transform: scaleX(0); transition: transform .9s var(--ease); }
.js .is-in .langbar span { transform: none; }
.langbar span:nth-child(2) { transition-delay: .12s; }
.langbar span:nth-child(3) { transition-delay: .24s; }
.langbar span:nth-child(4) { transition-delay: .36s; }
.langbar span:nth-child(5) { transition-delay: .48s; }
.langlegend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0 0; padding: 0; font-size: 12.5px; color: var(--text-2); }
.langlegend li { display: inline-flex; align-items: center; }
.langlegend i { width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--c); }
.langlegend b { margin-left: 6px; color: var(--muted); font-weight: 400; }

.now { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 13.5px; color: var(--text-2); }
.now li { position: relative; padding-left: 1.8em; }
.now li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }

/* Contribution heatmap */
.heat-panel { display: grid; gap: 22px; padding: clamp(18px, 2.4vw, 28px); }
@media (min-width: 1100px) { .heat-panel { grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 36px; } }
.heat-info p { margin: 0; }
.heat-info__num { font-family: var(--display); font-weight: 700; font-size: clamp(2.2rem, 1.8rem + 1.5vw, 3rem); line-height: 1; color: var(--text-hi); letter-spacing: -.02em; }
.heat-info__label { margin: 6px 0 16px !important; font-size: 13px; color: var(--muted); }
.heat-info__list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px 24px; font-size: 12.5px; }
@media (min-width: 560px) and (max-width: 1099.98px) { .heat-info__list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.heat-info__list li { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.heat-info__list span { color: var(--muted); }
.heat-info__list b { color: var(--text); font-weight: 500; white-space: nowrap; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.heat-legend i { width: 11px; height: 11px; border-radius: 2px; background: #18241c; }
.heat-legend i:first-of-type { margin-left: 4px; }
.heat-legend i:last-of-type { margin-right: 4px; }

.heat-scroll {
  overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 8px; min-width: 0;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.heat-scroll:focus-visible { outline-offset: 4px; }
.heat { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 6px 8px; min-width: 600px; }
.heat__months, .heat__grid { display: grid; gap: 3px; }
.heat__months { grid-template-columns: repeat(52, minmax(0, 1fr)); font-size: 10.5px; color: var(--muted); line-height: 1.2; }
.heat__months span { white-space: nowrap; }
.heat__days { display: grid; grid-template-rows: repeat(7, minmax(0, 1fr)); gap: 3px; font-size: 10px; line-height: 1; color: var(--muted); }
.heat__days span { display: flex; align-items: center; }
.heat__grid { grid-template-rows: repeat(7, auto); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.heat__grid i { display: block; aspect-ratio: 1; border-radius: 2px; background: #18241c; }
.heat .l1, .heat-legend .l1 { background: #0f4d2c; }
.heat .l2, .heat-legend .l2 { background: #188a45; }
.heat .l3, .heat-legend .l3 { background: #27c266; }
.heat .l4, .heat-legend .l4 { background: var(--accent); }
.js .heat__grid i { opacity: 0; transform: scale(.35); transition: opacity .45s ease, transform .45s var(--ease); }
.js .heat-panel.is-in .heat__grid i { opacity: 1; transform: none; }

/* ---------- Experience (git log) ---------- */
.exp { display: grid; gap: clamp(28px, 4vw, 56px); }
@media (min-width: 1024px) {
  .exp { grid-template-columns: minmax(0, .8fr) minmax(0, 1.6fr); align-items: start; }
  .exp__head { position: sticky; top: calc(var(--topbar-h) + 32px); margin-bottom: 0; }
}
.exp__note { max-width: 40ch; margin: 16px 0 0; color: var(--text-2); font-size: .95em; }
.gitlog { list-style: none; margin: 0; padding: 0; }
.commit { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); }
.commit__graph { position: relative; }
.commit__graph::before { content: ""; position: absolute; left: 13px; top: 0; bottom: 0; width: 2px; background: var(--line-2); }
.commit:first-child .commit__graph::before { top: 14px; }
.commit--root .commit__graph::before { bottom: auto; height: 14px; }
.node {
  position: absolute; z-index: 1; left: 8px; top: 8px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.node--head { background: var(--accent); box-shadow: 0 0 0 4px rgba(57, 255, 136, .15), 0 0 16px rgba(57, 255, 136, .5); }
.node--edu { border-color: var(--teal); }
.node--root { border-color: var(--muted); }
.node--branch { left: 28px; top: 30px; border-color: var(--amber); }
.branch-fork, .branch-merge { position: absolute; left: 0; width: 44px; height: 28px; overflow: visible; }
.branch-fork { top: 0; }
.branch-merge { bottom: 0; }
.commit--branch .commit__graph::after { content: ""; position: absolute; left: 33px; top: 27px; bottom: 27px; width: 2px; background: var(--amber); }
.commit__body { min-width: 0; padding-bottom: clamp(28px, 3.5vw, 40px); }
.commit--branch .commit__body { padding-left: 24px; padding-top: 24px; padding-bottom: calc(clamp(28px, 3.5vw, 40px) + 12px); }
.commit--root .commit__body { padding-bottom: 0; }
.commit__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 6px; font-size: 12.5px; line-height: 1.6; }
.hash { color: var(--amber); }
.ref { padding: 0 8px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 11.5px; color: var(--muted); }
.ref--head { color: var(--accent); border-color: rgba(57, 255, 136, .4); background: rgba(57, 255, 136, .08); }
.ref--tag { color: var(--amber); border-color: rgba(255, 181, 71, .4); background: rgba(255, 181, 71, .08); }
.ref--edu { color: var(--teal); border-color: rgba(111, 211, 196, .35); }
.commit__date { margin-left: auto; color: var(--muted); }
.commit__title {
  margin: 0 0 8px; font-family: var(--display); font-weight: 600;
  font-size: clamp(1.08rem, 1rem + .5vw, 1.35rem); line-height: 1.3; letter-spacing: -.01em; color: var(--text-hi);
}
.commit__title code { font-family: var(--mono); font-size: .82em; font-weight: 500; color: var(--accent); }
.commit__desc { max-width: 62ch; margin: 0; color: var(--text-2); font-size: .95em; }
.tags--sm { margin-top: 12px; }

/* ---------- Contact ---------- */
.contact { display: grid; gap: clamp(32px, 5vw, 64px); }
@media (min-width: 1024px) { .contact { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: start; } }
.contact__info { min-width: 0; }
@media (min-width: 640px) and (max-width: 1023.98px) {
  .contact__info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 40px; align-items: start; }
  .contact__info > .sec-head, .contact__lede { grid-column: 1 / -1; }
  .contact__details { margin-bottom: 0; }
}
.contact__lede { max-width: 46ch; margin: -8px 0 28px; color: var(--text-2); }
.contact__details { margin: 0 0 28px; font-size: 14px; }
.contact__details div {
  display: grid; grid-template-columns: 7ch minmax(0, 1fr); gap: 12px; align-items: center;
  min-height: 48px; border-bottom: 1px dashed var(--line);
}
.contact__details dt { color: var(--muted); }
.contact__details dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.contact__details a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--text-hi); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 5px;
  transition: color .2s, text-decoration-color .2s;
}
.contact__details a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.tree { font-size: 14px; }
.tree__root { margin: 0 0 2px; color: var(--teal); }
.tree__list { list-style: none; margin: 0; padding: 0; }
.tree__list li { position: relative; padding-left: 3.2ch; }
.tree__list li::before { content: ""; position: absolute; left: .7ch; top: 0; bottom: 0; border-left: 1px solid var(--line-2); }
.tree__list li:last-child::before { bottom: 50%; }
.tree__list li::after { content: ""; position: absolute; left: .7ch; top: 50%; width: 1.7ch; border-top: 1px solid var(--line-2); }
.tree__list a { display: flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0; text-decoration: none; color: var(--text); }
.tree__key { flex: none; min-width: 9ch; color: var(--text-hi); }
.tree__arrow { flex: none; color: var(--muted); transition: transform .2s var(--ease), color .2s; }
.tree__val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); transition: color .2s; }
.tree__list a:hover .tree__val, .tree__list a:hover .tree__arrow { color: var(--accent); }
.tree__list a:hover .tree__arrow { transform: translateX(3px); }

/* Terminal form */
.cform { display: grid; gap: 18px; padding: 20px clamp(16px, 3vw, 28px) 26px; }
.cform__intro { margin: 0; font-size: 13.5px; color: var(--text); }
.field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field label, .field legend { padding: 0; font-size: 13.5px; color: var(--text); }
.field--choice legend { margin-bottom: 8px; }
.gt { color: var(--accent); }
.field input, .field textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  font: inherit; font-size: 16px; line-height: 1.5; color: var(--text-hi);
  background: rgba(11, 15, 12, .7); border: 1px solid var(--line); border-radius: 8px;
  caret-color: var(--accent);
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(57, 255, 136, .16); }
.field [aria-invalid="true"] { border-color: var(--amber); }
.field__err { margin: 0; font-size: 12.5px; color: var(--amber); }
.field__err:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 8px; font-size: 13px; color: var(--text-2);
  transition: border-color .2s, color .2s, background-color .2s;
}
.chip span::before { content: "( )"; margin-right: 8px; color: var(--muted); white-space: pre; }
.chip input:checked + span { border-color: var(--accent); color: var(--text-hi); background: rgba(57, 255, 136, .08); }
.chip input:checked + span::before { content: "(•)"; color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip:hover span { border-color: var(--muted); }
.cform__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
@media (max-width: 419.98px) { .cform__actions .btn { flex: 1 1 100%; } }

.cform-done { display: grid; gap: 6px; padding: 24px clamp(16px, 3vw, 28px) 28px; font-size: 14px; }
.cform-done:focus { outline: none; }
.cform-done p { margin: 0; overflow-wrap: anywhere; }
.cform-done .ok { color: var(--accent); }
.cform-done .ok b { color: var(--text-hi); font-weight: 500; }
.cform-done .warn { color: var(--amber); }
.cform-done .muted { margin-top: 6px; }
.cform-done .btn { justify-self: start; margin-top: 14px; }

/* ---------- Footer / status bar ---------- */
.footer { border-top: 1px solid var(--line); background: var(--bg-2); }
.footer__row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px;
  padding-block: 18px; font-size: 13px; color: var(--muted);
}
.footer__row p { margin: 0; }
.footer__copy { color: var(--text); }
.footer__top { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--text); text-decoration: none; }
.footer__top:hover { color: var(--accent); }
.statusbar { background: #10301e; border-top: 1px solid #184a2d; }
.statusbar__row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 18px; min-height: 30px; padding-block: 5px; font-size: 11.5px; color: #c4d8ca; }
.statusbar__branch { color: var(--accent); font-weight: 700; }
.statusbar__right { margin-left: auto; }
@media (max-width: 639.98px) {
  .footer__row { flex-direction: column; align-items: flex-start; }
  .statusbar__right { display: none; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 80;
  width: max-content; max-width: min(92vw, 480px);
  padding: 12px 16px; border-radius: 10px;
  background: #0f1711; border: 1px solid var(--line-2);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .85);
  font-size: 13px; color: var(--text);
  opacity: 0; pointer-events: none; transform: translate(-50%, 16px);
  transition: opacity .25s, transform .3s var(--ease);
}
.toast::before { content: "› "; color: var(--accent); font-weight: 700; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal on scroll (only when JS has run) ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease) var(--d, 0s), transform .7s var(--ease) var(--d, 0s); }
.js .card.reveal { transition: opacity .7s var(--ease) var(--d, 0s), transform .7s var(--ease) var(--d, 0s), border-color .25s; }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Pausing: off-screen / hidden tab ---------- */
.is-off, .is-off *, .is-off *::before, .is-off *::after,
.tab-hidden *, .tab-hidden *::before, .tab-hidden *::after { animation-play-state: paused !important; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; transition-delay: 0s !important;
  }
  .js .reveal, .js .reveal.is-in { opacity: 1; transform: none; }
  .js .heat__grid i, .js .langbar span { opacity: 1; transform: none; }
}

/* ---------- Large screens: keep things calm ---------- */
@media (min-width: 1600px) {
  :root { --topbar-h: 60px; }
  body { font-size: 1rem; }
}


/* ===== Demo chrome: "All themes" link back to the Spectrix gallery =====
   Not part of the portfolio design itself. Sits under the header/menu and toasts;
   hidden (via the inline script next to it) when the page runs inside the gallery's device preview. */
.demo-back {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px 0 14px;
  text-decoration: none;
  white-space: nowrap;
  animation: demo-back-in .6s .8s backwards cubic-bezier(.2, .8, .2, 1);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--text-hi);
  font: 500 13px/1 var(--mono);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .55);
  transition: border-color .2s ease, color .2s ease;
}
.demo-back[hidden] { display: none; }
.demo-back svg { width: 18px; height: 18px; flex: none; transition: transform .25s ease; }
.demo-back:hover svg,
.demo-back:focus-visible svg { transform: translateX(-3px); }
.demo-back svg { color: var(--accent); }
.demo-back:hover,
.demo-back:focus-visible { border-color: var(--accent); color: var(--accent); }

@keyframes demo-back-in { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: reduce) {
  .demo-back { animation: none; transition: none; }
  .demo-back svg { transition: none; }
}
