/* ==========================================================================
   Muhammad Shurahbeel Bin Sajid — personal site
   Always-dark navy theme. Order: fonts → tokens → base → layout → intro →
   sections → components → dialog → motion
   ========================================================================== */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens (single dark navy theme) ---------- */
:root {
  color-scheme: dark;

  --bg: #0a1930;
  --bg-deep: #071325;
  --surface: #10233f;
  --surface-2: #162d50;
  --ink: #e6eefb;
  --ink-2: #a9b7d0;
  --ink-3: #7f8fad;
  --line: rgba(136, 165, 215, 0.16);
  --line-strong: rgba(136, 165, 215, 0.32);
  --accent: #7db2ff;
  --accent-solid: #2b65d9;
  --accent-solid-hover: #3a76ee;
  --accent-soft: rgba(125, 178, 255, 0.1);
  --shadow: 0 18px 40px -24px rgba(2, 8, 20, 0.9);

  /* Intro flow-field colours as "r, g, b" */
  --flow-a: 125, 178, 255;
  --flow-b: 230, 238, 251;
  --flow-alpha-a: 0.3;
  --flow-alpha-b: 0.07;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
body::before {
  /* soft depth: a lighter navy glow top-left, deeper navy bottom-right */
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1100px 720px at 8% -8%, rgba(43, 101, 217, 0.22), transparent 62%),
    radial-gradient(900px 700px at 110% 110%, var(--bg-deep), transparent 60%);
  pointer-events: none;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

h1, h2, h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

::selection {
  background: var(--accent-solid);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus {
  transform: none;
}

/* ---------- Layout ---------- */
.page {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 56px);
}

main {
  padding: 44px 0 28px;
}

@media (min-width: 1000px) {
  .page {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    column-gap: clamp(48px, 7vw, 104px);
  }
  main {
    padding: 84px 0 40px;
  }
}

/* ---------- Intro (profile panel; sticky on desktop) ---------- */
.intro {
  position: relative;
  isolation: isolate;
  padding: 44px 0 0;
}
.intro__canvas {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  -webkit-mask-image: radial-gradient(120% 95% at 35% 30%, #000 0%, transparent 76%);
  mask-image: radial-gradient(120% 95% at 35% 30%, #000 0%, transparent 76%);
  pointer-events: none;
}

.intro__main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 18px;
  align-items: center;
}

.avatar {
  grid-row: span 2;
  width: 84px;
  height: 84px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 32%, #2f5fae 0%, #152b52 70%);
  box-shadow: 0 0 0 5px rgba(125, 178, 255, 0.07);
}
.avatar img {
  width: 122%;
  max-width: none;
  height: auto;
  margin: 3% 0 0 -11%;
}

.intro__name {
  align-self: end;
  margin: 0;
  font-size: clamp(1.5rem, 1.1rem + 1.9vw, 1.95rem);
  font-weight: 680;
  line-height: 1.14;
  letter-spacing: -0.025em;
}
.intro__title {
  align-self: start;
  margin: 4px 0 0;
  color: var(--accent);
  font-size: 0.98rem;
  font-weight: 550;
}
.intro__statement {
  grid-column: 1 / -1;
  max-width: 38ch;
  margin: 20px 0 0;
  color: var(--ink-2);
}
.intro__statement em {
  color: var(--ink);
  font-style: normal;
  font-weight: 550;
}

.toc {
  display: none;
}

.intro__foot {
  margin-top: 26px;
}
.intro__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.socials {
  display: flex;
  gap: 6px;
  margin: 18px 0 0 -9px;
  padding: 0;
  list-style: none;
}
.socials a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.3s var(--ease-out);
}
.socials a:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-2px);
}
.intro__loc {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (min-width: 1000px) {
  .intro {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    height: 100vh;
    height: 100dvh;
    padding: 84px 0 56px;
    overflow: hidden auto;
    scrollbar-width: none;
  }
  .intro::-webkit-scrollbar {
    display: none;
  }
  .intro__main {
    display: block;
  }
  .avatar {
    width: 108px;
    height: 108px;
  }
  .intro__name {
    margin-top: 24px;
    font-size: clamp(1.9rem, 1.1rem + 1.5vw, 2.35rem);
  }
  .intro__title {
    margin-top: 10px;
    font-size: 1.05rem;
  }
  .intro__statement {
    margin-top: 16px;
    max-width: 34ch;
  }
  .toc {
    display: block;
    margin-top: 40px;
  }
  .toc ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .toc__link {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 7px 0;
    color: var(--ink-3);
    font-size: 1.2em;
    font-weight: 650;
    letter-spacing: 0.14em;
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.2s ease;
  }
  .toc__line {
    width: 28px;
    height: 1px;
    background: currentColor;
    opacity: 0.7;
    transition: width 0.35s var(--ease-out), background-color 0.2s ease, opacity 0.2s ease;
  }
  .toc__link:hover,
  .toc__link.is-active {
    color: var(--ink);
  }
  .toc__link:hover .toc__line,
  .toc__link.is-active .toc__line {
    width: 60px;
    background: var(--accent);
    opacity: 1;
  }
  .intro__foot {
    margin-top: 0;
  }
}

/* shorter laptop screens: tighten the sticky panel so nothing is cut off */
@media (min-width: 1000px) and (max-height: 890px) {
  .intro {
    gap: 20px;
    padding: 52px 0 36px;
  }
  .avatar {
    width: 88px;
    height: 88px;
  }
  .intro__name {
    margin-top: 18px;
  }
  .toc {
    margin-top: 26px;
  }
  .toc__link {
    padding: 5px 0;
  }
  main {
    padding-top: 52px;
  }
}
/* very short screens (e.g. 1366x768 laptops): photo sits beside the name */
@media (min-width: 1000px) and (max-height: 720px) {
  .intro {
    gap: 16px;
    padding: 40px 0 26px;
  }
  .intro__main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 16px;
    align-items: center;
  }
  .avatar {
    width: 76px;
    height: 76px;
  }
  .intro__name {
    margin-top: 0;
    font-size: 1.62rem;
  }
  .intro__title {
    margin-top: 4px;
    font-size: 0.98rem;
  }
  .intro__statement {
    grid-column: 1 / -1;
    font-size: 0.94rem;
  }
  .toc {
    grid-column: 1 / -1;
    margin-top: 18px;
  }
  .toc__link {
    padding: 3px 0;
  }
  .socials {
    margin-top: 10px;
  }
  .intro__loc {
    margin-top: 6px;
  }
  main {
    padding-top: 40px;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.3s var(--ease-out), background-color 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, box-shadow 0.3s var(--ease-out);
}
.btn svg {
  flex: none;
}
.btn:hover {
  transform: translateY(-2px);
}
.btn--primary {
  background: var(--accent-solid);
  color: #fff;
}
.btn--primary:hover {
  background: var(--accent-solid-hover);
  box-shadow: 0 12px 26px -14px var(--accent-solid-hover);
}
.btn--ghost {
  border-color: var(--line-strong);
  background: rgba(16, 35, 63, 0.5);
  color: var(--ink);
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn--sm {
  min-height: 40px;
  padding: 0 15px;
  font-size: 0.88rem;
}

.btn--cv {
  padding: 0 44px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
}
.text-link svg {
  transition: transform 0.3s var(--ease-out);
}
.text-link:hover {
  text-decoration: underline;
}
.text-link:hover svg {
  transform: translate(2px, -2px);
}

/* ---------- Sections ---------- */
.section {
  padding-bottom: clamp(56px, 7vw, 84px);
  scroll-margin-top: 28px;
}
@media (min-width: 1000px) {
  .section {
    scroll-margin-top: 84px;
  }
}
.section-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 26px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.5em;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.sub {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px 0 10px;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.005em;
}
.sub::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  background: var(--accent);
  transform: rotate(45deg);
}

/* About */
.lead {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.08rem, 1rem + 0.4vw, 1.2rem);
  font-weight: 450;
  line-height: 1.6;
}
.lead em {
  color: var(--accent);
  font-style: normal;
}
.prose p {
  margin: 0 0 14px;
  color: var(--ink-2);
}
.prose p:last-child {
  margin-bottom: 0;
}
.prose a {
  color: var(--ink);
  font-weight: 550;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
}
.prose a:hover {
  color: var(--accent);
}

/* ---------- Cards ---------- */
.card {
  position: relative;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 35, 63, 0.62);
  transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.4s var(--ease-out),
    box-shadow 0.4s var(--ease-out);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 550;
}

.badge {
  padding: 2px 9px;
  border: 1px solid rgba(125, 178, 255, 0.4);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
}

/* ---------- Publication ---------- */
.pub__label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 0 0 14px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.pub__label em {
  color: var(--ink-2);
  font-style: normal;
}
.pub__title {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: clamp(1.12rem, 1rem + 0.6vw, 1.32rem);
  font-weight: 640;
  line-height: 1.36;
  letter-spacing: -0.012em;
}
.pub__authors {
  margin: 0 0 6px;
  color: var(--ink-2);
  font-size: 0.93rem;
  line-height: 1.6;
}
.pub__authors strong {
  color: var(--ink);
  font-weight: 650;
}
.pub__venue {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.88rem;
}
.pub__venue em {
  color: var(--ink-2);
}
.pub__venue a {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.results {
  margin: 24px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.results figcaption {
  margin-bottom: 16px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.bars {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label value"
    "track track";
  gap: 7px 12px;
  align-items: baseline;
}
.bar[data-value="93.1"] { --v: 93.1; }
.bar[data-value="78.2"] { --v: 78.2; }
.bar[data-value="77.3"] { --v: 77.3; }
.bar__label {
  grid-area: label;
  color: var(--ink-2);
  font-size: 0.9rem;
}
.bar--ours .bar__label {
  color: var(--ink);
  font-weight: 600;
}
.bar__label em {
  color: var(--accent);
  font-style: normal;
  font-weight: 450;
}
.bar__value {
  grid-area: value;
  color: var(--ink-2);
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1;
}
.bar--ours .bar__value {
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 700;
}
.bar__track {
  grid-area: track;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(136, 165, 215, 0.12);
}
.bar__fill {
  display: block;
  width: calc(var(--v, 0) * 1%);
  height: 100%;
  border-radius: inherit;
  background: rgba(169, 183, 208, 0.42);
  transform-origin: 0 50%;
}
.bar--ours .bar__fill {
  background: linear-gradient(90deg, var(--accent-solid), var(--accent));
}
.js .pub .bar__fill {
  transform: scaleX(0);
  transition: transform 1.5s var(--ease-out);
}
.js .pub.is-live .bar__fill {
  transform: none;
}
.js .pub.is-live .bar:nth-child(2) .bar__fill { transition-delay: 0.12s; }
.js .pub.is-live .bar:nth-child(3) .bar__fill { transition-delay: 0.24s; }

.pub__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.cite {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.cite summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.cite summary::-webkit-details-marker {
  display: none;
}
.cite summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1;
}
.cite[open] summary::before {
  content: "\2212";
}
.cite__hint {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.cite__body {
  position: relative;
  margin-top: 14px;
}
.cite pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.65;
}
.cite__copy {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.cite__copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}
html:not(.js) .cite__copy {
  display: none;
}

/* ---------- Experience rows ---------- */
.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}
.row {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 2px 22px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child {
  border-bottom: 0;
}
.row__date {
  margin: 3px 0 0;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.row__title {
  margin: 0;
  color: var(--ink);
  font-weight: 620;
  line-height: 1.45;
}
.row__title span {
  display: block;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 500;
}
.row__note {
  margin: 5px 0 0;
  color: var(--ink-2);
  font-size: 0.92rem;
  line-height: 1.6;
}
.more {
  margin: 22px 0 0;
}

@media (max-width: 560px) {
  .row {
    grid-template-columns: 1fr;
  }
  .row__date {
    margin: 0 0 2px;
  }
}

/* ---------- Projects ---------- */
.projects {
  display: grid;
  gap: 14px;
}
.project {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.project::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%), var(--accent-soft), transparent 45%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.project:hover {
  border-color: rgba(125, 178, 255, 0.45);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}
.project:hover::before {
  opacity: 1;
}
.project > * {
  position: relative;
}
.project__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.project__title a {
  color: var(--ink);
  text-decoration: none;
}
.project__title svg {
  color: var(--ink-3);
  transition: transform 0.3s var(--ease-out), color 0.2s ease;
}
.project:hover .project__title a,
.project:hover .project__title svg {
  color: var(--accent);
}
.project:hover .project__title svg {
  transform: translate(2px, -2px);
}
.stretched::after {
  /* makes the whole card clickable while keeping a single, labelled link */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.project .stretched:focus-visible {
  outline: none;
}
.project:focus-within {
  border-color: var(--accent);
}
.project__tagline {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 550;
}
.project > p:not([class]) {
  margin: 0 0 18px;
  color: var(--ink-2);
  font-size: 0.92rem;
  line-height: 1.65;
}
.project .tags {
  margin-top: auto;
}


/* ---------- Contact & footer ---------- */
.contact__text {
  max-width: 56ch;
  margin: 0 0 22px;
  color: var(--ink-2);
}
.contact__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.contact__clock {
  margin: 18px 0 0;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}
.contact__clock time {
  color: var(--ink-2);
}
#contact {
  padding-bottom: 48px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 0.82rem;
}
.site-footer p {
  margin: 0;
}

@media (max-width: 480px) {
  .intro__actions .btn,
  .contact__actions .btn {
    flex: 1 1 auto;
  }
  .contact__actions .btn {
    padding: 0 14px;
    font-size: 0.86rem;
  }
}

/* ---------- CV preview dialog ---------- */
.cv-modal {
  width: min(1040px, calc(100vw - 48px));
  height: min(92vh, 1240px);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.8);
}
.cv-modal[open] {
  animation: modal-in 0.35s var(--ease-out);
}
.cv-modal::backdrop {
  background: rgba(4, 10, 22, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.cv-modal__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.cv-modal__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 11px 12px 11px 22px;
  border-bottom: 1px solid var(--line);
}
.cv-modal__title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
}
.cv-modal__title span {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.cv-modal__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cv-modal__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}
.cv-modal__btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.cv-modal__close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.cv-modal__close:hover {
  border-color: var(--line-strong);
  background: var(--accent-soft);
}
.cv-modal__body {
  position: relative;
  flex: 1;
  background: var(--bg-deep);
}
.cv-modal__loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}
.cv-modal__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
html.modal-open {
  overflow: hidden;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* ---------- Motion ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.avatar { animation: fade-up 0.8s var(--ease-out) 0.05s both; }
.intro__name { animation: fade-up 0.8s var(--ease-out) 0.12s both; }
.intro__title { animation: fade-up 0.8s var(--ease-out) 0.18s both; }
.intro__statement { animation: fade-up 0.8s var(--ease-out) 0.24s both; }
.toc { animation: fade-up 0.8s var(--ease-out) 0.3s both; }
.intro__foot { animation: fade-up 0.8s var(--ease-out) 0.36s both; }

/* Scroll reveal (only when JS is running) */
.js .reveal {
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.js .reveal:not(.is-visible) {
  opacity: 0;
  transform: translateY(18px);
}

/* ---------- 404 page ---------- */
.notfound {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 80px 24px;
  text-align: center;
}
.notfound .notfound__code {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: clamp(3.4rem, 2rem + 8vw, 6rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}
.notfound h1 {
  margin: 0 0 12px;
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem);
  font-weight: 650;
  letter-spacing: -0.02em;
}
.notfound p {
  max-width: 44ch;
  margin: 0 auto 26px;
  color: var(--ink-2);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
  .js .reveal:not(.is-visible) {
    opacity: 1;
    transform: none;
  }
  .js .pub .bar__fill {
    transform: none;
  }
}

/* ---------- Architecture diagram ---------- */
.tech {
  margin: 24px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.tech .sub {
  margin: 0 0 16px;
}
.tech__frame {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-deep);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tech__svg {
  display: block;
  width: 100%;
  height: auto;
}
@media (max-width: 640px) {
  .tech__svg {
    min-width: 540px; /* keep labels legible; the frame scrolls horizontally */
  }
}

/* Static layers (work with or without JS) */
.tech__n {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1.4;
}
.tech__arrow {
  fill: var(--ink-3);
}
.tech__e {
  fill: none;
  stroke: rgba(127, 143, 173, 0.55);
  stroke-width: 1.6;
  marker-end: url(#tech-arrow);
}
.tech__t1 {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none;
}
.tech__t2 {
  fill: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-anchor: middle;
  pointer-events: none;
}

/* Highlight overlays: faint by default so the diagram reads without JS */
.tech__h {
  fill: rgba(125, 178, 255, 0.08);
  stroke: var(--accent);
  stroke-width: 1.8;
}
.tech__f {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 3 7;
}
.tech-phase {
  opacity: 0.55;
}
.js .reveal:not(.is-visible) .tech-phase {
  opacity: 0;
  transition: none;
}

/* Sequential pipeline animation once the section scrolls into view */
.js .reveal.is-visible .tech-phase {
  animation: tech-phase 7.2s linear infinite both;
  transition: opacity 0.4s var(--ease-out);
}
.js .reveal.is-visible .tech__march {
  animation: tech-march 1.1s linear infinite;
}
.js .reveal.is-visible .tech-p1 { animation-delay: 0s; }
.js .reveal.is-visible .tech-p2 { animation-delay: 1.2s; }
.js .reveal.is-visible .tech-p3 { animation-delay: 2.4s; }
.js .reveal.is-visible .tech-p4 { animation-delay: 3.6s; }
.js .reveal.is-visible .tech-p5 { animation-delay: 4.8s; }
.js .reveal.is-visible .tech-p6 { animation-delay: 6s; }

@keyframes tech-phase {
  0% { opacity: 0; }
  7% { opacity: 1; }
  22% { opacity: 1; }
  30% { opacity: 0; }
  100% { opacity: 0; }
}
@keyframes tech-march {
  to { stroke-dashoffset: -20; }
}

@media (prefers-reduced-motion: reduce) {
  .tech-phase {
    opacity: 0.85 !important;
    animation: none !important;
  }
  .tech__march {
    animation: none !important;
  }
}

/* ---------- Print ---------- */
@media print {
  .intro__canvas,
  .toc,
  .intro__actions,
  .cv-modal,
  .cite__copy,
  body::before {
    display: none !important;
  }
  html,
  body {
    background: #fff;
    color: #000;
  }
  .page {
    display: block;
  }
  .intro {
    position: static;
    height: auto;
    padding: 0 0 16px;
  }
  .js .reveal:not(.is-visible) {
    opacity: 1;
    transform: none;
  }
  .card {
    background: #fff;
    border-color: #ccc;
  }
  .intro__statement,
  .prose p,
  .row__note,
  .pub__authors,
  .lead,
  .row__title,
  .pub__title {
    color: #000;
  }
  .tech__frame {
    overflow-x: visible;
    border-color: #ccc;
  }
  .tech__svg {
    background: #fff;
  }
  .tech__t1,
  .tech__t2 {
    fill: #000;
  }
  .tech__e {
    stroke: #888;
  }
  .tech__arrow {
    fill: #888;
  }
}

/* ---------- Tech Flow Diagram Animations ---------- */
