/* ==========================================================================
   Husnain Ahmed — Portfolio
   Terminal / IDE direction · code-dark + signal-green
   Type: JetBrains Mono (chrome, data, labels) + IBM Plex Sans (prose)
   Self-contained. No framework.
   ========================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul[class] { list-style: none; padding: 0; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

/* ---------- Design Tokens ---------- */
:root {
  /* Surfaces — code dark */
  --bg:            #020617;
  --bg-alt:        #060b1c;
  --surface:       #0b1120;
  --surface-2:     #0f172a;
  --surface-3:     #151f38;

  /* Hairlines */
  --line:          #1c2740;
  --line-strong:   #2c3a58;
  --line-accent:   rgba(34, 197, 94, 0.42);

  /* Text */
  --text:          #e2e8f0;
  --text-muted:    #94a3b8;
  --text-faint:    #7c8ba1;

  /* Signal + syntax */
  --accent:        #22c55e;
  --accent-dim:    #16a34a;
  --accent-wash:   rgba(34, 197, 94, 0.09);
  --cyan:          #38bdf8;
  --amber:         #fbbf24;
  --violet:        #a78bfa;
  --rose:          #fb7185;

  /* Type */
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Space — density 6/10 (standard) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Geometry — sharp by default */
  --radius:    2px;
  --radius-sm: 2px;
  --rail:      236px;
  --page:      1280px;
  --statusbar: 34px;

  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --dur:       320ms;
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; scroll-padding-top: var(--space-6); }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  padding-bottom: var(--statusbar);
}

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

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

/* Exposed engineering grid — the "visible structure" of the design */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 25%, transparent 78%);
}

/* Single restrained ambient glow, top-left, green not purple */
.grid-bg::after {
  content: "";
  position: absolute;
  top: -280px;
  left: -180px;
  width: 720px;
  height: 720px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.14) 0%, transparent 62%);
  filter: blur(20px);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: var(--space-3) var(--space-4);
  background: var(--accent);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}
.skip-link:focus { left: var(--space-4); top: var(--space-4); }

/* ---------- Page shell: rail + content (asymmetric) ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 0;
  max-width: var(--page);
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: 100vh;
}

.content {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding: 0 clamp(20px, 3.4vw, 52px) var(--space-8);
}

/* ---------- Left rail ---------- */
.rail {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - var(--statusbar));
  overflow-y: auto;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-5) var(--space-5);
  gap: var(--space-6);
}

.rail-id { display: flex; align-items: center; gap: var(--space-3); }

.rail-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.rail-id-text { display: flex; flex-direction: column; min-width: 0; }
.rail-name {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.rail-role {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.rail-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-2);
}

.rail-nav { display: flex; flex-direction: column; }

.rail-nav a {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: 10px 0 10px var(--space-3);
  border-left: 2px solid transparent;
  margin-left: -2px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.rail-nav a .idx { font-size: 10.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.rail-nav a:hover { color: var(--text); background: var(--surface); border-left-color: var(--line-strong); }
.rail-nav a:hover .idx { color: var(--text-muted); }
.rail-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-wash);
}
.rail-nav a.active .idx { color: var(--accent-dim); }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-4); }

.rail-social { display: flex; gap: var(--space-2); }
.rail-social a {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 15px;
  transition: all var(--dur) var(--ease);
}
.rail-social a:hover {
  color: var(--accent);
  border-color: var(--line-accent);
  background: var(--accent-wash);
}

.rail-kbd {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--line-strong);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: left;
  transition: all var(--dur) var(--ease);
}
.rail-kbd:hover { color: var(--text); border-color: var(--accent); border-style: solid; }

kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  line-height: 1;
}

/* ---------- Mobile topbar ---------- */
.topbar { display: none; }

.mobile-menu { display: none; }

/* ---------- Hero: terminal window ---------- */
.hero {
  padding: var(--space-8) 0 var(--space-7);
  border-bottom: 1px solid var(--line);
}

.term {
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  box-shadow: 0 24px 70px -32px rgba(0, 0, 0, 0.9);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
}
.term-dots { display: flex; gap: 6px; }
.term-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
}
.term-dots i:first-child { background: #3f4c68; }
.term-path { letter-spacing: 0.01em; }
.term-path b { color: var(--text-muted); font-weight: 500; }
.term-bar-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }

.term-status { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); }
.pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16); }
  50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.04); }
}

.term-body { padding: clamp(20px, 3vw, 40px) clamp(18px, 3vw, 40px) clamp(24px, 3vw, 36px); }

.term-line {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: var(--space-2);
}
.term-line .prompt { color: var(--accent); user-select: none; }
.term-line .cmd { color: var(--text-muted); }

.hero-name {
  font-family: var(--mono);
  font-size: clamp(2.1rem, 6.2vw, 3.9rem);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -0.045em;
  color: var(--text);
  margin: var(--space-3) 0 var(--space-3);
}
.hero-name .caret {
  display: inline-block;
  width: 0.56em;
  height: 0.94em;
  vertical-align: text-bottom;
  margin-left: 0.08em;
  background: var(--accent);
  animation: blink 1.15s steps(1) infinite;
}
@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }

.hero-role {
  font-family: var(--mono);
  font-size: clamp(0.82rem, 1.5vw, 0.95rem);
  color: var(--text-muted);
  letter-spacing: 0.01em;
  margin-bottom: var(--space-5);
}

/* Syntax-highlighted stack declaration */
.code-block {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.85;
  border-left: 2px solid var(--line-strong);
  padding: var(--space-2) 0 var(--space-2) var(--space-4);
  margin-bottom: var(--space-5);
  overflow-x: auto;
}
.code-block .kw   { color: var(--violet); }
.code-block .var  { color: var(--cyan); }
.code-block .str  { color: var(--accent); }
.code-block .num  { color: var(--amber); }
.code-block .op   { color: var(--text-faint); }
.code-block .cm   { color: var(--text-faint); font-style: italic; }
.code-block .ind  { padding-left: 2ch; display: inline-block; }

.hero-tagline {
  max-width: 62ch;
  color: var(--text-muted);
  font-size: 15.5px;
  line-height: 1.72;
  margin-bottom: var(--space-5);
}

.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 46px;
  padding: 0 var(--space-5);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid var(--line-strong);
  transition: all var(--dur) var(--ease);
}
.btn i { font-size: 12px; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -12px rgba(34, 197, 94, 0.6);
}
.btn-ghost { color: var(--text); background: var(--surface-2); }
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
  transform: translateY(-2px);
}

/* ---------- Metrics strip ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--surface);
}
.metric {
  padding: var(--space-4) var(--space-4);
  border-left: 1px solid var(--line);
}
.metric:first-child { border-left: 0; }
.metric dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--space-1);
}
.metric dd {
  font-family: var(--mono);
  font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.metric dd .unit { font-size: 0.55em; color: var(--accent); font-weight: 500; margin-left: 2px; }

/* ---------- Sections ---------- */
section { padding: var(--space-8) 0; border-bottom: 1px solid var(--line); }
section:last-of-type { border-bottom: 0; }

.section-head { margin-bottom: var(--space-6); }
.section-index {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--space-3);
}
.section-index .num { color: var(--accent); font-variant-numeric: tabular-nums; }
.section-index .bar { flex: 1; height: 1px; background: var(--line); }

.section-head h2 {
  font-family: var(--mono);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.12;
  color: var(--text);
}
.section-head h2::before { content: "// "; color: var(--line-strong); font-weight: 500; }

.lead-sm {
  max-width: 66ch;
  margin-top: var(--space-3);
  color: var(--text-muted);
  font-size: 15px;
}

/* ---------- Skills: key/value manifest ---------- */
.skill-rows { border: 1px solid var(--line); }

.skill-row {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  border-top: 1px solid var(--line);
}
.skill-row:first-child { border-top: 0; }

.skill-key {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--surface);
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.skill-key::before { content: "\25b8"; color: var(--accent); }

.skill-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-4);
}
.skill-pills li {
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-muted);
  transition: all var(--dur) var(--ease);
}
.skill-pills li:hover {
  color: var(--accent);
  border-color: var(--line-accent);
  background: var(--accent-wash);
}

/* ---------- Experience: commit-log timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: var(--space-5); }

.exp {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: var(--space-5);
  padding-left: calc(var(--space-5) + 6px);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.exp::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line-strong);
  transition: background var(--dur) var(--ease);
}
.exp:hover { border-color: var(--line-strong); background: var(--surface-2); }
.exp:hover::before { background: var(--accent); }

.exp-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.exp-top h3 {
  font-family: var(--mono);
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.exp-date {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  padding: 3px 8px;
  border: 1px solid var(--line-accent);
  background: var(--accent-wash);
  white-space: nowrap;
}

/* meta table — ROLE / COMPANY / LOCATION */
.exp-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 2px var(--space-4);
  font-family: var(--mono);
  font-size: 12px;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px dashed var(--line);
}
.exp-meta dt {
  color: var(--text-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 10.5px;
  padding-top: 3px;
}
.exp-meta dd { color: var(--text-muted); }
.exp-meta dd.hl { color: var(--cyan); }

.exp-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: var(--space-4) 0 var(--space-3);
}
.exp-label:first-of-type { margin-top: 0; }

.bullets { display: flex; flex-direction: column; gap: var(--space-3); }
.bullets li {
  position: relative;
  padding-left: var(--space-5);
  color: var(--text-muted);
  font-size: 14.75px;
  line-height: 1.66;
}
.bullets li::before {
  content: "+";
  position: absolute;
  left: 0;
  top: -1px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
}

.link-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.link-chips a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--cyan);
  transition: all var(--dur) var(--ease);
}
.link-chips a::before { content: "\2197"; color: var(--text-faint); font-size: 10px; }
.link-chips a:hover {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.08);
  transform: translateY(-1px);
}
.link-chips a:hover::before { color: var(--cyan); }

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.project {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface);
  transition: background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.project:hover {
  background: var(--surface-2);
  box-shadow: inset 0 2px 0 0 var(--accent);
}

.project-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.project-head h3 {
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.project-year {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.project > p {
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.65;
  flex: 1;
}

.project-tech { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.project-tech li {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 3px 7px;
  border: 1px solid var(--line);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--line);
}
.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
  transition: all var(--dur) var(--ease);
}
.project-links a:hover {
  color: var(--accent);
  border-color: var(--line-accent);
  background: var(--accent-wash);
}

/* ---------- Education ---------- */
.edu-grid { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.edu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface);
  transition: background-color var(--dur) var(--ease);
}
.edu:hover { background: var(--surface-2); }
.edu-info h3 {
  font-family: var(--mono);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}
.edu-info .subheading {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}
.edu-date {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Interests ---------- */
.interests-grid { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.interests-grid li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted);
  transition: all var(--dur) var(--ease);
}
.interests-grid li i { color: var(--text-faint); font-size: 13px; }
.interests-grid li:hover { border-color: var(--line-strong); color: var(--text); background: var(--surface-2); }
.interests-grid li:hover i { color: var(--accent); }

/* ---------- Publications ---------- */
.pub {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  background: var(--surface);
  transition: background-color var(--dur) var(--ease);
}
.pub:hover { background: var(--surface-2); }
.pub > i { color: var(--accent); font-size: 15px; margin-top: 4px; }
.pub a {
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  border-bottom: 1px solid var(--line-strong);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.pub a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Contact block ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  min-height: 76px;
  transition: background-color var(--dur) var(--ease);
}
.contact-item:hover { background: var(--surface-2); }
.contact-item > i { color: var(--accent); font-size: 15px; }
.contact-item .ci-body { display: flex; flex-direction: column; min-width: 0; }
.contact-item .ci-key {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.contact-item .ci-val {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* ---------- Status bar (IDE bottom bar) ---------- */
.statusbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: var(--statusbar);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-4);
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  overflow-x: auto;
  scrollbar-width: none;
}
.statusbar::-webkit-scrollbar { display: none; }
.statusbar span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.statusbar .sb-branch { color: var(--accent); }
.statusbar .sb-right { margin-left: auto; }
.statusbar b { color: var(--text-muted); font-weight: 500; }

/* ---------- Command palette ---------- */
.palette {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  padding: clamp(48px, 12vh, 140px) var(--space-4) var(--space-4);
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.palette.open { display: block; }

.palette-panel {
  max-width: 560px;
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.95);
  animation: paletteIn 220ms var(--ease-out);
}
@keyframes paletteIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.99); }
  to   { opacity: 1; transform: none; }
}

.palette-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--line);
}
.palette-input-wrap .prompt { font-family: var(--mono); color: var(--accent); font-size: 14px; }
#paletteInput {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
}
#paletteInput::placeholder { color: var(--text-faint); }

.palette-list { max-height: 44vh; overflow-y: auto; padding: var(--space-2) 0; }
.palette-list li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: 0 var(--space-4);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-left: 2px solid transparent;
}
.palette-list li[aria-selected="true"] {
  background: var(--accent-wash);
  border-left-color: var(--accent);
  color: var(--text);
}
.palette-list li .pl-kind {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-left: auto;
}
.palette-list li[aria-selected="true"] .pl-kind { color: var(--accent); }
.palette-list .pl-empty { color: var(--text-faint); cursor: default; border-left-color: transparent; }

.palette-foot {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-faint);
}
.palette-foot span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Footer ---------- */
.site-footer {
  padding: var(--space-7) 0 var(--space-6);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  justify-content: space-between;
}
.site-footer .footer-tagline { color: var(--text-muted); }

/* ---------- Scroll reveal ---------- */
[data-animate] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 420ms var(--ease-out), transform 420ms var(--ease-out);
}
[data-animate].is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  :root { --statusbar: 30px; }

  .shell { grid-template-columns: minmax(0, 1fr); border: 0; }
  .content { border-left: 0; padding: 0 clamp(16px, 4vw, 28px) var(--space-7); }

  /* rail becomes a sticky topbar */
  .rail { display: none; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    /* .content is padded, so bleed the bar back out to the viewport edges */
    margin: 0 calc(-1 * clamp(16px, 4vw, 28px));
    padding: var(--space-3) clamp(16px, 4vw, 28px);
    background: rgba(2, 6, 23, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .rail-id { flex: 1; min-width: 0; }
  .topbar-actions { display: flex; align-items: center; gap: var(--space-2); }

  .icon-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 12px;
    transition: all var(--dur) var(--ease);
  }
  .icon-btn:hover, .icon-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--line-accent); }
  .icon-btn svg { width: 18px; height: 18px; }

  .mobile-menu {
    display: none;
    position: fixed;
    top: 63px;
    left: clamp(16px, 4vw, 28px);
    right: clamp(16px, 4vw, 28px);
    z-index: 90;
    flex-direction: column;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.9);
  }
  .mobile-menu.open { display: flex; }
  .mobile-menu a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 48px;
    padding: 0 var(--space-4);
    border-top: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text-muted);
  }
  .mobile-menu a:first-child { border-top: 0; }
  .mobile-menu a .idx { font-size: 10.5px; color: var(--text-faint); }
  .mobile-menu a.active { color: var(--accent); background: var(--accent-wash); }

  .hero { padding: var(--space-6) 0 var(--space-6); }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .skill-row { grid-template-columns: minmax(0, 1fr); }
  .skill-key { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 560px) {
  section { padding: var(--space-7) 0; }
  .term-path { display: none; }
  .exp { padding: var(--space-4); padding-left: calc(var(--space-4) + 6px); }
  .exp-meta { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .exp-meta dt { margin-top: var(--space-2); }
  .btn { width: 100%; justify-content: center; }
  .statusbar { gap: var(--space-3); font-size: 10px; }
  .statusbar .sb-hide-sm { display: none; }
}

/* ---------- Motion / print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-animate] { opacity: 1; transform: none; }
  .hero-name .caret { animation: none; opacity: 1; }
  .pip { animation: none; }
}

@media print {
  .rail, .topbar, .statusbar, .palette, .mobile-menu, .grid-bg, .hero-actions { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .shell { display: block; max-width: none; border: 0; }
  .content { border: 0; padding: 0; }
  .term, .exp, .project, .edu, .pub, .metrics { border-color: #bbb; background: #fff; }
  .hero-name, .section-head h2, .exp-top h3, .project-head h3 { color: #000; }
  .term-body p, .bullets li, .project > p { color: #222; }
  a { color: #000; }
}

/* ---------- Language toggle (rail) ---------- */
.rail-lang {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
  transition: all var(--dur) var(--ease);
}
.rail-lang i { color: var(--text-faint); font-size: 12px; }
.rail-lang #langLabel {
  margin-left: auto;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.rail-lang:hover { color: var(--text); border-color: var(--accent); }
.rail-lang:hover i { color: var(--accent); }
