/* Salman Ahmed — site styles. Edit tokens at the top of :root to retheme. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../fonts/inter-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('../fonts/jetbrains-mono-normal.woff2') format('woff2'); }
@font-face { font-family: 'Newsreader'; font-style: italic; font-weight: 400 600; font-display: swap; src: url('../fonts/newsreader-italic.woff2') format('woff2'); }
@font-face { font-family: 'Newsreader'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../fonts/newsreader-normal.woff2') format('woff2'); }

/* =========================================================
   DESIGN TOKENS
   ========================================================= */
:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f3efe8;
  --text: #1f2430;
  --muted: #5b6270;
  --accent: #2b4c7e;
  --accent-soft: rgba(43, 76, 126, .09);
  --accent-2: #9a3b3b;
  --accent-2-soft: rgba(154, 59, 59, .09);
  --line: #e6e1d8;
  --shadow: 0 1px 2px rgba(31, 36, 48, .05), 0 8px 24px -12px rgba(31, 36, 48, .12);
  --serif: "Newsreader", "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --rail: 288px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}
[data-theme="dark"] {
  --bg: #12151c;
  --surface: #1a1f2a;
  --surface-2: #161a23;
  --text: #e7e3da;
  --muted: #9aa3b2;
  --accent: #8fb3e8;
  --accent-soft: rgba(143, 179, 232, .10);
  --accent-2: #e0b66b;
  --accent-2-soft: rgba(224, 182, 107, .10);
  --line: #2a3140;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 28px -14px rgba(0, 0, 0, .6);
}

/* =========================================================
   BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.7 var(--sans); -webkit-font-smoothing: antialiased;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--bg); padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }

/* scroll progress */
#progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 90; background: transparent; }
#progress i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: 0 50%; transform: scaleX(0); }

/* =========================================================
   LAYOUT
   ========================================================= */
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail);
  padding: 40px 28px 28px; display: flex; flex-direction: column; gap: 22px;
  background: var(--surface-2); border-right: 1px solid var(--line); z-index: 50;
  overflow-y: auto;
}
main { margin-left: var(--rail); }
.wrap { max-width: 820px; margin: 0 auto; padding: 0 40px; }
section { padding: 96px 0 24px; }
.eyebrow { font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 14px; display: block; }
.sec-title { font-size: clamp(28px, 4vw, 38px); margin-bottom: 8px; }
.sec-lead { color: var(--muted); max-width: 60ch; margin-bottom: 36px; }

/* rail contents */
.avatar-wrap { position: relative; width: 112px; height: 112px; }
.avatar-wrap::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 1px dashed var(--accent); opacity: .5; animation: spin 40s linear infinite;
}
.avatar { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); box-shadow: var(--shadow); }
@keyframes spin { to { transform: rotate(360deg); } }
.rail h1 { font-size: 26px; }
.rail .role { color: var(--muted); font-size: 14px; line-height: 1.5; margin-top: 6px; }
.rail .role a { color: var(--text); font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 8px;
  color: var(--muted); font-size: 14.5px; transition: color .2s, background .2s;
}
.nav a::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid currentColor; transition: all .25s var(--ease); }
.nav a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.nav a.active::before { background: var(--accent); border-color: var(--accent); transform: scale(1.35); }
.rail-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.icons { display: flex; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
  transition: transform .2s var(--ease), color .2s, border-color .2s;
  font: 700 13px var(--sans);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg.fill { fill: currentColor; stroke: none; }
/* Show the icon of the mode you would switch TO: moon in light mode, sun in dark mode */
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }

/* mobile top bar */
.topbar { display: none; }
.sheet { display: none; }

/* =========================================================
   HERO
   ========================================================= */
.hero { position: relative; min-height: 100vh; display: flex; align-items: center; padding: 120px 0 80px; overflow: hidden; }
#graph { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero .wrap { position: relative; }
.hero .hello { font: 500 14px var(--mono); color: var(--accent); margin-bottom: 18px; display: block; }
.hero h2 { font-size: clamp(40px, 7vw, 68px); font-weight: 500; letter-spacing: -.025em; }
.hero h2 em { font-style: italic; color: var(--accent); }
.hero .typed-line { font-size: clamp(18px, 2.4vw, 23px); color: var(--muted); margin: 22px 0 30px; min-height: 2.9em; max-width: 34ch; }
.caret { display: inline-block; width: 2px; height: 1.1em; background: var(--accent-2); vertical-align: -.18em; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 34px; }
.chip {
  font: 500 12.5px var(--mono); padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
}
.btns { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 10px;
  font-weight: 600; font-size: 14.5px; cursor: pointer; border: 1px solid var(--accent);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s;
}
.btn.primary { background: var(--accent); color: var(--bg); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.scroll-cue { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); color: var(--muted); font: 11px var(--mono); letter-spacing: .2em; text-transform: uppercase; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.scroll-cue i { width: 1px; height: 34px; background: linear-gradient(var(--muted), transparent); animation: drop 2s var(--ease) infinite; transform-origin: top; }
@keyframes drop { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* =========================================================
   CARDS / ABOUT / THEMES
   ========================================================= */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; box-shadow: var(--shadow);
  transition: transform .35s var(--ease), border-color .3s, box-shadow .35s var(--ease);
}
.card:hover { transform: translateY(-5px); border-color: var(--accent); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 30px 0 0; }
.fact { text-align: center; padding: 18px 10px; }
.fact b { display: block; font: 600 34px var(--serif); color: var(--accent); }
.fact span { font-size: 13px; color: var(--muted); }
.themes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.theme .ico { width: 42px; height: 42px; border-radius: 11px; background: var(--accent-soft); display: grid; place-items: center; margin-bottom: 14px; color: var(--accent); }
.theme .ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme h3 { font-size: 19px; margin-bottom: 6px; }
.theme p { color: var(--muted); font-size: 14.5px; margin: 0 0 12px; }
.theme a { font-size: 13.5px; font-weight: 600; }

/* =========================================================
   SELECTED WORK
   ========================================================= */
.featured { display: grid; gap: 16px; }
.feat { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: start; }
.badge {
  font: 600 12px var(--mono); padding: 8px 12px; border-radius: 8px; text-align: center; line-height: 1.3;
  background: var(--accent-2-soft); color: var(--accent-2); min-width: 78px;
}
.badge small { display: block; font-weight: 400; opacity: .85; }
.feat h3 { font-size: 19px; margin-bottom: 6px; }
.feat .by { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.mini { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font: 500 12.5px var(--sans); padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--text); background: var(--surface); cursor: pointer; transition: all .2s;
}
.pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* =========================================================
   NEWS
   ========================================================= */
.news { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.news li { position: relative; padding: 0 0 22px 28px; }
.news li::before {
  content: ""; position: absolute; left: -5px; top: 9px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--c, var(--accent)); box-shadow: 0 0 0 4px var(--bg);
}
.news time { font: 500 12px var(--mono); color: var(--muted); display: block; }
.news .tag { font: 600 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--c, var(--accent)); margin-right: 8px; }
.news p { margin: 2px 0 0; }
.t-paper { --c: var(--accent); } .t-patent { --c: #2f8a6b; } .t-career { --c: var(--accent-2); } .t-award { --c: #b8860b; }
#sentinel { height: 1px; }
.more { margin-top: 6px; }

/* =========================================================
   PUBLICATIONS
   ========================================================= */
.tools { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 12px 0; margin-bottom: 8px; }
.search {
  width: 100%; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: 15px var(--sans); transition: border-color .2s, box-shadow .2s;
}
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.filters { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }
.filters .pill { white-space: nowrap; }
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.year { font: 600 13px var(--mono); color: var(--accent-2); letter-spacing: .1em; margin: 30px 0 12px; display: flex; align-items: center; gap: 12px; }
.year::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pub { padding: 18px 0; border-bottom: 1px solid var(--line); animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.pub h3 { font-size: 17.5px; font-weight: 600; margin-bottom: 4px; }
.pub .au { font-size: 14px; color: var(--muted); }
.pub .au strong { color: var(--text); }
.pub .ve { font: 12.5px var(--mono); color: var(--accent); margin: 6px 0 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.type { font: 600 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); }
.cite-box { display: none; margin-top: 12px; position: relative; }
.cite-box.open { display: block; animation: rise .35s var(--ease) both; }
.cite-box pre { margin: 0; padding: 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font: 12px/1.6 var(--mono); overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.copy { position: absolute; top: 8px; right: 8px; }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }

/* =========================================================
   TIMELINE
   ========================================================= */
.timeline { position: relative; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline .draw { position: absolute; left: 7px; top: 6px; width: 2px; height: 0; background: linear-gradient(var(--accent), var(--accent-2)); }
.tl { position: relative; margin-bottom: 28px; }
.tl::before {
  content: ""; position: absolute; left: -34px; top: 5px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line); transition: all .5s var(--ease);
}
.tl.in::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.tl .when { font: 500 12px var(--mono); color: var(--accent-2); }
.tl h3 { font-size: 19px; margin: 2px 0; }
.tl p { color: var(--muted); font-size: 14.5px; margin: 0; }

/* awards / service / contact */
.ledger { list-style: none; padding: 0; margin: 0; }
.ledger li { display: grid; grid-template-columns: 90px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ledger b { font: 600 13px var(--mono); color: var(--accent-2); padding-top: 2px; }
.svc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.svc .chip { background: var(--surface); border-color: var(--line); color: var(--text); }
.svc .chip b { color: var(--accent); font-weight: 600; margin-left: 6px; }
.contact-card { display: grid; gap: 6px; }
footer { padding: 70px 0 50px; text-align: center; color: var(--muted); font-size: 13px; }

.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 60; opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: all .3s var(--ease);
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }

/* =========================================================
   REVEAL ON SCROLL (only hidden when JS is available)
   ========================================================= */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 960px) {
  .rail { display: none; }
  main { margin-left: 0; }
    .topbar {
    display: flex; position: fixed; inset: 0 0 auto 0; height: 60px; z-index: 80; align-items: center; justify-content: space-between;
    padding: 0 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .topbar b { font: 600 19px var(--serif); }
  .topbar .row { display: flex; gap: 8px; }
  .sheet {
    display: flex; flex-direction: column; justify-content: center; gap: 4px; position: fixed; inset: 0; z-index: 70;
    background: var(--bg); padding: 80px 32px 32px; opacity: 0; pointer-events: none; transition: opacity .35s var(--ease);
  }
  .sheet.open { opacity: 1; pointer-events: auto; }
  .sheet a { font: 500 30px var(--serif); color: var(--text); padding: 8px 0; transform: translateY(14px); opacity: 0; transition: all .45s var(--ease); transition-delay: calc(var(--i) * 45ms); }
  .sheet.open a { transform: none; opacity: 1; }
  .sheet a.active { color: var(--accent); }
  .wrap { padding: 0 22px; }
  section { padding-top: 72px; }
  .hero { padding-top: 100px; }
}
@media (max-width: 600px) {
  .themes { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .fact { display: flex; align-items: baseline; gap: 14px; justify-content: center; }
  .feat { grid-template-columns: 1fr; gap: 12px; }
  .badge { justify-self: start; }
  .ledger li { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}
@media print {
  .rail, .topbar, .sheet, #progress, .to-top, #graph, .scroll-cue, .tools { display: none !important; }
  main { margin: 0; } .js .reveal { opacity: 1; transform: none; } section { padding-top: 24px; }
}

/* =========================================================
   ADDITIONS FOR THE JEKYLL BUILD
   ========================================================= */
[hidden] { display: none !important; }
.pub .au a, .news a { text-decoration: underline; text-underline-offset: 3px; }

/* simple pages (bio) */
.simple-bar { display: flex; align-items: center; justify-content: space-between; max-width: 820px; margin: 0 auto; padding: 22px 22px 0; }
.simple-bar a.back { font: 500 13px var(--mono); }
.simple { max-width: 820px; margin: 0 auto; padding: 40px 22px 80px; }
.simple h1 { font-size: clamp(30px, 5vw, 44px); margin-bottom: 28px; }
.bio-block { margin-bottom: 34px; }
.bio-block h2 { font-size: 20px; margin-bottom: 10px; }
.bio-block p { margin-bottom: 14px; }
