/* =========================================================================
   Roham Koohestani - portfolio26
   Concept: the page as a source file. JetBrains Mono carries the structure,
   Inter carries the prose, and the five palette accents behave like a syntax
   theme (teal = links/keywords, orange = numbers, pink = strings/highlights,
   purple = types/section bars, blue = urls).
   ========================================================================= */

:root {
  /* JetBrains palette */
  --bg: #000000;
  --text: #FFFFFF;
  --teal: #28B8A0;
  --orange: #FC801D;
  --pink: #FF318C;
  --purple: #6B57FF;
  --blue: #087CFA;
  --gray: #9DA0AA;
  --darkgray: #3C3F41;
  --codebg: #1E1F22;

  --panel: #0b0b0d;
  --hairline: #1c1d20;

  /* type */
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --rail-w: 132px;
  --content-max: 760px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--pink); color: #000; }

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

/* ---------------------------------------------------------------- nav */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(18px, 4vw, 40px);
  font-family: var(--mono);
  font-size: 13px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.92), rgba(0,0,0,0.55) 70%, transparent);
  backdrop-filter: blur(6px);
}
.nav__brand { color: var(--text); letter-spacing: -0.02em; }
.nav__brand b { color: var(--teal); font-weight: 700; }
.nav__links { display: flex; gap: clamp(10px, 2vw, 22px); align-items: center; }
.nav__links a { color: var(--gray); }
.nav__links a:hover { color: var(--text); text-decoration: none; }
.nav__links a.is-cta {
  color: var(--text);
  border: 1px solid var(--darkgray);
  padding: 5px 11px;
  border-radius: 6px;
}
.nav__links a.is-cta:hover { border-color: var(--teal); color: var(--teal); }
@media (max-width: 640px) {
  .nav__links a.hide-sm { display: none; }
}

/* ---------------------------------------------------------------- year rail */
.rail {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--rail-w);
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding-left: clamp(18px, 4vw, 40px);
  pointer-events: none;
  border-right: 1px solid var(--hairline);
}
.rail__item {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--darkgray);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: color 0.35s var(--ease);
}
.rail__item::before {
  content: "";
  width: 8px; height: 1px;
  background: var(--darkgray);
  transition: all 0.35s var(--ease);
}
.rail__item.is-active { color: var(--teal); }
.rail__item.is-active::before { width: 22px; height: 2px; background: var(--teal); }
@media (max-width: 1080px) { .rail { display: none; } }

/* ---------------------------------------------------------------- layout */
.wrap {
  max-width: var(--content-max);
  margin-left: max(var(--rail-w), calc(50vw - var(--content-max) / 2));
  margin-right: auto;
  padding: 0 clamp(18px, 5vw, 32px);
}
@media (max-width: 1080px) {
  .wrap { margin-left: auto; margin-right: auto; }
}

.station {
  padding: clamp(64px, 12vh, 130px) 0;
  border-top: 1px solid var(--hairline);
}
.station:first-of-type { border-top: none; }

.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gray);
  margin: 0 0 20px;
  letter-spacing: 0.01em;
}
.eyebrow .cmt { color: var(--darkgray); }
.eyebrow .k { color: var(--purple); }
.eyebrow .n { color: var(--orange); }

h1, h2, h3 { font-family: var(--mono); font-weight: 700; letter-spacing: -0.03em; line-height: 1.08; }
.station h2 {
  font-size: clamp(28px, 4.6vw, 46px);
  margin: 0 0 22px;
}
.lead { font-size: clamp(18px, 2.2vw, 21px); color: #e9e9ee; margin: 0 0 18px; }
.prose { color: #cfd0d6; margin: 0 0 16px; max-width: 62ch; }
.prose strong { color: var(--text); font-weight: 600; }
.tk-teal { color: var(--teal); }
.tk-orange { color: var(--orange); }
.tk-pink { color: var(--pink); }
.tk-purple { color: var(--purple); }

/* ---------------------------------------------------------------- reveal */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  border-top: none;
  overflow: hidden;
}
#hero-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
}
.hero__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: clamp(24px, 5vw, 56px);
  align-items: center;
  width: 100%;
}
@media (max-width: 820px) { .hero__grid { grid-template-columns: 1fr; } }

.hero__eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 22px;
}
.hero__eyebrow .dot { color: var(--teal); }
.hero h1 {
  font-size: clamp(34px, 6.6vw, 74px);
  margin: 0 0 26px;
  letter-spacing: -0.04em;
}
.hero h1 .hl { color: var(--teal); }
.hero__sub { font-size: clamp(16px, 2vw, 19px); color: var(--gray); max-width: 46ch; margin: 0 0 34px; }
.hero__sub b { color: var(--text); font-weight: 600; }

.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; font-family: var(--mono); font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 8px;
  border: 1px solid var(--darkgray);
  color: var(--text);
  transition: all 0.25s var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn--primary { background: var(--teal); color: #001a15; border-color: var(--teal); font-weight: 700; }
.btn--primary:hover { background: #33d6bb; }
.btn:not(.btn--primary):hover { border-color: var(--teal); color: var(--teal); }

.portrait {
  position: relative;
  justify-self: center;
  width: min(320px, 78vw);
  aspect-ratio: 846 / 910;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--darkgray);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(1.02) contrast(1.02); }
.portrait::after {
  content: "";
  position: absolute; inset: 0;
  box-shadow: inset 0 -70px 90px -40px rgba(0,0,0,0.7);
  pointer-events: none;
}
.portrait__tag {
  position: absolute; left: 12px; bottom: 12px;
  font-family: var(--mono); font-size: 11px; color: var(--gray);
  background: rgba(0,0,0,0.55); padding: 4px 8px; border-radius: 5px;
  backdrop-filter: blur(3px);
}
.portrait__tag b { color: var(--teal); font-weight: 700; }

.scroll-cue {
  position: absolute;
  left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 1;
  font-family: var(--mono); font-size: 12px; color: var(--darkgray);
}
.scroll-cue span { color: var(--gray); }

/* ---------------------------------------------------------------- pillars */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 30px; }
@media (max-width: 720px) { .pillars { grid-template-columns: 1fr; } }
.pillar {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 22px 20px;
  position: relative;
  overflow: hidden;
}
.pillar::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.pillar:nth-child(1)::before { background: var(--teal); }
.pillar:nth-child(2)::before { background: var(--orange); }
.pillar:nth-child(3)::before { background: var(--pink); }
.pillar .q { font-family: var(--mono); font-size: 12px; color: var(--darkgray); margin-bottom: 10px; }
.pillar h3 { font-size: 17px; margin: 0 0 8px; letter-spacing: -0.02em; }
.pillar p { margin: 0; font-size: 14.5px; color: var(--gray); line-height: 1.6; }

/* ---------------------------------------------------------------- stat / calibration */
.statline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 14px; margin: 30px 0 8px; }
.bignum {
  font-family: var(--mono); font-weight: 800;
  font-size: clamp(44px, 9vw, 96px);
  color: var(--orange);
  letter-spacing: -0.04em; line-height: 1;
}
.bignum-label { font-family: var(--mono); font-size: 13px; color: var(--gray); max-width: 22ch; }

.viz { margin-top: 26px; background: var(--panel); border: 1px solid var(--hairline); border-radius: 12px; padding: 22px; }
.viz__cap { font-family: var(--mono); font-size: 12px; color: var(--gray); margin-top: 14px; }
.viz svg { display: block; width: 100%; height: auto; }

.calib-curve { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.4s var(--ease) 0.2s; }
.is-in .calib-curve { stroke-dashoffset: 0; }

/* agent graph */
.edge { stroke-dasharray: 200; stroke-dashoffset: 200; transition: stroke-dashoffset 0.9s var(--ease); }
.is-in .edge.e1 { stroke-dashoffset: 0; transition-delay: 0.15s; }
.is-in .edge.e2 { stroke-dashoffset: 0; transition-delay: 0.5s; }
.is-in .edge.e3 { stroke-dashoffset: 0; transition-delay: 0.85s; }
.is-in .edge.e4 { stroke-dashoffset: 0; transition-delay: 1.2s; }
.gnode { opacity: 0; transition: opacity 0.4s var(--ease); }
.is-in .gnode { opacity: 1; }
.gnode text { font-family: var(--mono); font-size: 12px; fill: var(--text); }

/* bars */
.bars { margin-top: 8px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 54px; align-items: center; gap: 12px; margin: 12px 0; font-family: var(--mono); font-size: 12px; }
.bar-row .lab { color: var(--gray); }
.bar-track { height: 12px; background: var(--codebg); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 6px; transition: width 1.1s var(--ease) 0.2s; }
.bar-fill.f-before { background: var(--teal); }
.bar-fill.f-after { background: var(--pink); }
.bar-row .val { color: var(--text); text-align: right; }

/* code sample */
.code {
  margin-top: 24px;
  background: var(--codebg);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  overflow: hidden;
}
.code__bar { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--hairline); }
.code__bar i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.code__bar i:nth-child(1) { background: var(--pink); }
.code__bar i:nth-child(2) { background: var(--orange); }
.code__bar i:nth-child(3) { background: var(--teal); }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; color: #d7d8de; }
.code .cmt { color: var(--darkgray); }
.code .kw { color: var(--purple); }
.code .fn { color: var(--blue); }
.code .str { color: var(--pink); }
.code .old { color: var(--gray); text-decoration: line-through; text-decoration-color: var(--darkgray); }
.code .new { color: var(--teal); }

/* tags */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; font-family: var(--mono); font-size: 12px; }
.tags span { border: 1px solid var(--darkgray); color: var(--gray); padding: 5px 10px; border-radius: 20px; }

/* ---------------------------------------------------------------- close */
.close { text-align: left; }
.close h2 { font-size: clamp(30px, 5.2vw, 56px); }
.close .prose { font-size: 18px; }

/* footer */
.foot {
  border-top: 1px solid var(--hairline);
  padding: 40px 0 60px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--darkgray);
}
.foot a { color: var(--gray); }
.foot a:hover { color: var(--teal); text-decoration: none; }
.foot__links { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 18px; }

/* =========================================================================
   Academic page
   ========================================================================= */
.ac-body { }
.ac-head {
  max-width: 920px; margin: 0 auto; padding: 120px clamp(20px, 5vw, 40px) 20px;
  display: grid; grid-template-columns: 96px 1fr; gap: 26px; align-items: center;
}
@media (max-width: 560px) { .ac-head { grid-template-columns: 1fr; gap: 16px; } }
.ac-avatar { width: 96px; height: 96px; border-radius: 12px; overflow: hidden; border: 1px solid var(--darkgray); }
.ac-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ac-head h1 { font-size: clamp(26px, 4vw, 38px); margin: 0 0 6px; }
.ac-role { font-family: var(--mono); font-size: 14px; color: var(--teal); margin: 0 0 4px; }
.ac-aff { font-size: 14px; color: var(--gray); margin: 0 0 12px; }
.ac-social { display: flex; flex-wrap: wrap; gap: 16px; font-family: var(--mono); font-size: 13px; }

.ac-statement {
  max-width: 920px; margin: 0 auto; padding: 6px clamp(20px, 5vw, 40px) 30px;
  color: #cfd0d6; font-size: 16px; border-bottom: 1px solid var(--hairline);
}

.ac-section { max-width: 920px; margin: 0 auto; padding: 40px clamp(20px, 5vw, 40px); border-bottom: 1px solid var(--hairline); }
.ac-section > h2 {
  font-size: 15px; color: var(--gray); font-weight: 500; letter-spacing: 0.04em;
  text-transform: uppercase; margin: 0 0 22px; display: flex; align-items: center; gap: 12px;
}
.ac-section > h2::before { content: ""; width: 18px; height: 3px; background: var(--purple); border-radius: 2px; }

.ac-yeargroup { font-family: var(--mono); font-size: 12px; color: var(--darkgray); margin: 20px 0 12px; }
.pub { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--hairline); }
.pub:first-of-type { border-top: none; }
.pub__yr { font-family: var(--mono); font-size: 13px; color: var(--orange); }
.pub__title { font-size: 16px; font-weight: 600; margin: 0 0 6px; color: var(--text); line-height: 1.4; }
.pub__authors { font-size: 14px; color: var(--gray); margin: 0 0 6px; }
.pub__authors .me { color: var(--teal); font-weight: 600; }
.pub__venue { font-family: var(--mono); font-size: 12.5px; color: var(--gray); margin: 0 0 10px; }
.pub__venue .role { color: var(--purple); }
.pub__links { display: flex; flex-wrap: wrap; gap: 14px; font-family: var(--mono); font-size: 12.5px; }
.chip {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  padding: 2px 8px; border-radius: 12px; border: 1px solid var(--darkgray); color: var(--gray);
  margin-left: 8px; vertical-align: middle;
}
.chip.review { color: var(--orange); border-color: var(--orange); }

.ac-row { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--hairline); }
.ac-row:first-of-type { border-top: none; }
.ac-row .when { font-family: var(--mono); font-size: 12.5px; color: var(--gray); }
.ac-row h3 { font-family: var(--sans); font-size: 16px; font-weight: 600; margin: 0 0 4px; letter-spacing: 0; }
.ac-row p { margin: 0; font-size: 14px; color: var(--gray); }
@media (max-width: 560px) {
  .pub { grid-template-columns: 1fr; gap: 6px; }
  .ac-row { grid-template-columns: 1fr; gap: 4px; }
}

.backlink { font-family: var(--mono); font-size: 13px; }
