/* =========================================================================
   Latent-Space Observatory — design system
   S. Mohammad H. Hosseini D.
   ========================================================================= */

/* ---- Design tokens ---------------------------------------------------- */
:root {
  /* backgrounds */
  --bg: #05070f;
  --bg-2: #080d1c;
  --bg-elev: #0a1122;

  /* glass panels */
  --panel: rgba(15, 23, 46, 0.55);
  --panel-strong: rgba(13, 20, 40, 0.82);
  --panel-solid: #0c1326;
  --border: rgba(120, 160, 240, 0.14);
  --border-strong: rgba(140, 180, 255, 0.28);

  /* text */
  --text: #e9edfb;
  --text-strong: #ffffff;
  --muted: #93a4c9;
  --muted-dim: #64749b;

  /* accents */
  --cyan: #38e1d6;
  --blue: #4c8dff;
  --violet: #a689fb;
  --gold: #e2b567;
  --accent: var(--cyan);

  /* accent glows */
  --glow-cyan: rgba(56, 225, 214, 0.35);
  --glow-blue: rgba(76, 141, 255, 0.35);
  --glow-violet: rgba(166, 137, 251, 0.32);
  --glow-gold: rgba(226, 181, 103, 0.28);

  /* type */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, "Cascadia Code", monospace;

  /* layout */
  --maxw: 1160px;
  --maxw-narrow: 820px;
  --nav-h: 68px;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --shadow-soft: 0 18px 50px -24px rgba(0, 0, 0, 0.85);
  --shadow-glow: 0 0 0 1px var(--border), 0 24px 60px -30px rgba(60, 120, 255, 0.35);
}

/* ---- Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

img, svg, canvas { display: block; max-width: 100%; }
/* keep MathJax inline math inline (overrides the svg reset above) */
mjx-container svg { display: inline-block; }
mjx-container[display="true"] { display: block; overflow-x: auto; overflow-y: hidden; max-width: 100%; }
a { color: var(--cyan); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--text-strong); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }
::selection { background: rgba(76, 141, 255, 0.32); color: #fff; }

/* ---- Cosmic background ------------------------------------------------ */
.cosmos {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
  display: block;
}
.cosmos-veil {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 78% -8%, rgba(76, 141, 255, 0.10), transparent 60%),
    radial-gradient(1000px 800px at 8% 12%, rgba(166, 137, 251, 0.08), transparent 55%),
    radial-gradient(900px 900px at 50% 118%, rgba(56, 225, 214, 0.07), transparent 60%),
    linear-gradient(180deg, rgba(5, 7, 15, 0.2), rgba(5, 7, 15, 0.72) 68%, var(--bg));
}

/* ---- Typography ------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 550;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--text-strong);
  font-optical-sizing: auto;
}
h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
p { color: var(--text); }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cyan);
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}

/* ---- Layout ----------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.15rem, 4vw, 2.4rem); }
.narrow { max-width: var(--maxw-narrow); }
section { position: relative; padding-block: clamp(4rem, 9vw, 7rem); }
.section-head { margin-bottom: 2.6rem; max-width: 46rem; }
.section-head h2 { margin-top: 0.7rem; }
.section-head p { color: var(--muted); margin-top: 0.9rem; font-size: 1.05rem; }

.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); border: 0; }

/* ---- Navbar ----------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(7, 11, 24, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: var(--border);
}
.nav-inner { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.15rem, 4vw, 2.4rem); display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-family: var(--font-display); font-weight: 600; font-size: 1.06rem; color: var(--text-strong); letter-spacing: -0.01em; }
.brand:hover { color: var(--text-strong); }
.brand .glyph { width: 30px; height: 30px; flex: none; }
.brand .glyph circle, .brand .glyph line { transition: opacity 0.3s; }

.nav-links { display: flex; align-items: center; gap: 0.35rem; list-style: none; }
.nav-links a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  position: relative;
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover { color: var(--text-strong); background: rgba(120, 160, 240, 0.08); }
.nav-links a.active { color: var(--text-strong); }
.nav-links a.active::after {
  content: ""; position: absolute; left: 0.8rem; right: 0.8rem; bottom: 0.15rem; height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--violet)); border-radius: 2px;
}
.nav-cta {
  margin-left: 0.4rem; padding: 0.5rem 1rem !important; color: var(--text-strong) !important;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: linear-gradient(180deg, rgba(76,141,255,0.16), rgba(76,141,255,0.05)) !important;
}
.nav-cta:hover { box-shadow: 0 0 24px -6px var(--glow-blue); }

.nav-toggle { display: none; background: none; border: 1px solid var(--border); color: var(--text); width: 42px; height: 42px; border-radius: 10px; cursor: pointer; align-items: center; justify-content: center; }
.nav-toggle svg { width: 20px; height: 20px; }

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-body); font-weight: 550; font-size: 0.96rem;
  padding: 0.75rem 1.4rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); color: var(--text-strong);
  background: rgba(120, 160, 240, 0.06);
  transition: transform 0.2s var(--ease), box-shadow 0.3s var(--ease), background 0.3s, border-color 0.3s;
}
.btn:hover { color: var(--text-strong); transform: translateY(-2px); border-color: var(--cyan); box-shadow: 0 12px 30px -14px var(--glow-cyan); }
.btn-primary {
  background: linear-gradient(120deg, rgba(56,225,214,0.9), rgba(76,141,255,0.9));
  color: #04101a; border-color: transparent;
}
.btn-primary:hover { color: #04101a; box-shadow: 0 16px 40px -14px var(--glow-cyan); }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.85rem; }

/* ---- Hero ------------------------------------------------------------- */
.hero { min-height: 100svh; display: flex; align-items: center; padding-top: calc(var(--nav-h) + 2rem); padding-bottom: 4rem; }
.hero-grid { display: grid; grid-template-columns: 1.35fr 0.9fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; width: 100%; }
.hero-status {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.08em;
  color: var(--muted); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.4rem 0.9rem; background: var(--panel); backdrop-filter: blur(8px);
}
.hero-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.hero h1 {
  font-size: clamp(2.6rem, 6.6vw, 4.9rem);
  line-height: 1.02;
  margin: 1.3rem 0 0;
  letter-spacing: -0.03em;
}
.hero h1 .accent {
  background: linear-gradient(115deg, var(--cyan) 0%, var(--blue) 45%, var(--violet) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-identity { font-family: var(--font-mono); color: var(--muted); font-size: clamp(0.9rem, 1.6vw, 1.05rem); margin-top: 1.5rem; line-height: 1.6; }
.hero-identity .hl { color: var(--text); }
.hero-lede { color: var(--muted); font-size: 1.1rem; margin-top: 1.4rem; max-width: 34rem; }
.hero .btn-row { margin-top: 2.1rem; }

.hero-ticker { margin-top: 2.4rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 0.32rem 0.75rem;
  background: rgba(120,160,240,0.04); transition: color 0.2s, border-color 0.2s;
}
.chip:hover { color: var(--cyan); border-color: var(--border-strong); }

/* portrait */
.portrait-wrap { position: relative; display: grid; place-items: center; aspect-ratio: 1; max-width: 380px; margin-inline: auto; width: 100%; }
.portrait-orbit { position: absolute; inset: 0; pointer-events: none; }
.portrait-orbit svg { width: 100%; height: 100%; overflow: visible; }
.portrait-orbit .ring { fill: none; stroke: var(--border-strong); stroke-width: 1; opacity: 0.55; }
.portrait-orbit .node { fill: var(--cyan); }
.portrait-spin { animation: spin 44s linear infinite; transform-origin: 50% 50%; }
.portrait-spin.rev { animation-duration: 62s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.portrait {
  position: relative; width: 76%; aspect-ratio: 1; border-radius: 50%;
  overflow: hidden; border: 1px solid var(--border-strong);
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.9), inset 0 0 40px rgba(5,10,25,0.6);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; filter: saturate(0.96) contrast(1.02); }
.portrait::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 120%, rgba(56,225,214,0.18), transparent 55%), linear-gradient(200deg, transparent 55%, rgba(5,8,18,0.55)); }

.scroll-cue { position: absolute; left: 50%; bottom: 1.6rem; transform: translateX(-50%); font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted-dim); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.scroll-cue .bar { width: 1px; height: 34px; background: linear-gradient(180deg, var(--cyan), transparent); animation: cue 2.4s ease-in-out infinite; }
@keyframes cue { 0%,100% { opacity: 0.3; transform: scaleY(0.6); } 50% { opacity: 1; transform: scaleY(1); } }

/* ---- Cards / panels --------------------------------------------------- */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}

/* ---- Research universe ------------------------------------------------ */
.research-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.15rem; }
.rcard {
  position: relative; padding: 1.7rem 1.6rem 1.5rem; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  overflow: hidden; transition: transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s;
}
.rcard::before { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.4s; background: radial-gradient(420px 220px at var(--mx, 30%) var(--my, 0%), var(--card-glow, var(--glow-cyan)), transparent 70%); }
.rcard:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow-soft); }
.rcard:hover::before { opacity: 1; }
.rcard[data-accent="cyan"]   { --card-glow: var(--glow-cyan);   --card-ink: var(--cyan); }
.rcard[data-accent="violet"] { --card-glow: var(--glow-violet); --card-ink: var(--violet); }
.rcard[data-accent="gold"]   { --card-glow: var(--glow-gold);   --card-ink: var(--gold); }
.rcard .motif { width: 54px; height: 54px; margin-bottom: 1.1rem; color: var(--card-ink); }
.rcard h3 { font-size: 1.28rem; margin-bottom: 0.5rem; }
.rcard .r-summary { color: var(--muted); font-size: 0.98rem; }
.rcard .r-detail { color: var(--muted); font-size: 0.92rem; margin-top: 0.8rem; max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.5s var(--ease), opacity 0.4s, margin-top 0.4s; }
.rcard:hover .r-detail, .rcard:focus-within .r-detail { max-height: 260px; opacity: 1; }
.rcard .r-links { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; margin-top: 1rem; font-family: var(--font-mono); font-size: 0.76rem; }
.rcard .r-links a { color: var(--card-ink); }
.rcard .r-index { position: absolute; top: 1.3rem; right: 1.4rem; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted-dim); }

/* ---- Project grid ----------------------------------------------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-bottom: 2.2rem; align-items: center; }
.filter-btn {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.02em;
  color: var(--muted); background: rgba(120,160,240,0.05); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.45rem 0.95rem; cursor: pointer; transition: all 0.2s var(--ease);
}
.filter-btn:hover { color: var(--text-strong); border-color: var(--border-strong); }
.filter-btn.active { color: #04101a; background: linear-gradient(120deg, var(--cyan), var(--blue)); border-color: transparent; }
.filter-search { margin-left: auto; }
.filter-search input {
  font-family: var(--font-body); font-size: 0.88rem; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.5rem 1rem 0.5rem 2.2rem; width: 220px; max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2393a4c9' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 0.8rem center;
}
.filter-search input:focus { outline: none; border-color: var(--cyan); }

.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1.3rem; }
.pcard {
  position: relative; display: flex; flex-direction: column; border-radius: var(--radius);
  background: var(--panel-strong); border: 1px solid var(--border); overflow: hidden;
  transition: transform 0.4s var(--ease), border-color 0.4s, box-shadow 0.4s;
  backdrop-filter: blur(8px);
}
.pcard:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: 0 30px 60px -30px rgba(0,0,0,0.9), 0 0 0 1px var(--border-strong); }
.pcard-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-elev); }
.pcard-media img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; transform: scale(1.02); transition: transform 0.6s var(--ease), opacity 0.4s; filter: saturate(0.9) brightness(0.92); }
.pcard:hover .pcard-media img { transform: scale(1.08); opacity: 1; }
.pcard-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,12,26,0.15), rgba(8,12,26,0.85)); }
.pcard-cat { position: absolute; top: 0.85rem; left: 0.9rem; z-index: 2; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cyan); background: rgba(6,10,22,0.7); border: 1px solid var(--border); border-radius: 999px; padding: 0.28rem 0.7rem; backdrop-filter: blur(6px); }
.pcard-body { padding: 1.25rem 1.35rem 1.4rem; display: flex; flex-direction: column; flex: 1; }
.pcard-body h3 { font-size: 1.22rem; margin-bottom: 0.4rem; }
.pcard-tagline { color: var(--muted); font-size: 0.94rem; flex: 1; }
.pcard-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 1.1rem; }
.pcard-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 0.18rem 0.5rem; }
.pcard-arrow { color: var(--cyan); transition: transform 0.3s var(--ease); flex: none; }
.pcard:hover .pcard-arrow { transform: translate(4px, -4px); }
.pcard-link { position: absolute; inset: 0; z-index: 3; }
.cat-heading { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin: 2.8rem 0 1.3rem; display: flex; align-items: center; gap: 0.9rem; }
.cat-heading::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }
.cat-heading:first-child { margin-top: 0; }
.no-results { color: var(--muted); font-family: var(--font-mono); font-size: 0.9rem; padding: 2rem 0; display: none; }

/* ---- Project detail --------------------------------------------------- */
.detail-hero { padding-top: calc(var(--nav-h) + 3.5rem); padding-bottom: 1rem; }
.back-link { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.4rem; margin-bottom: 1.6rem; }
.back-link:hover { color: var(--cyan); }
.detail-hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); margin: 0.7rem 0 0.6rem; }
.detail-tagline { color: var(--muted); font-size: 1.2rem; max-width: 40rem; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.6rem; align-items: center; }
.meta-pill { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.34rem 0.85rem; background: var(--panel); }
.meta-pill.status { color: var(--gold); border-color: var(--glow-gold); }
.detail-figure { margin: 2.4rem 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--bg-elev); }
.detail-figure img { width: 100%; object-fit: cover; }
.detail-body { max-width: var(--maxw-narrow); }
.detail-section { margin-bottom: 2.4rem; }
.detail-section h2 { font-size: 1.5rem; margin-bottom: 0.9rem; display: flex; align-items: baseline; gap: 0.7rem; }
.detail-section h2::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); flex: none; transform: translateY(-2px); }
.detail-section p { color: var(--text); margin-bottom: 0.9rem; }
.equation { margin: 1.3rem 0; padding: 1.1rem 1.3rem; border-radius: var(--radius-sm); background: rgba(8,13,28,0.7); border: 1px solid var(--border); border-left: 2px solid var(--cyan); overflow-x: auto; }
.detail-links { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.6rem 0 0; }
.detail-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.detail-nav a { font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); max-width: 45%; }
.detail-nav a:hover { color: var(--cyan); }
.detail-nav .lbl { display: block; color: var(--muted-dim); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 0.2rem; }

/* ---- Publications ----------------------------------------------------- */
.pub-list { display: flex; flex-direction: column; gap: 1rem; position: relative; }
.pub-item {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: 1.4rem;
  padding: 1.4rem 1.5rem; border-radius: var(--radius); background: var(--panel);
  border: 1px solid var(--border); transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
  backdrop-filter: blur(8px);
}
.pub-item:hover { border-color: var(--border-strong); transform: translateX(4px); box-shadow: var(--shadow-soft); }
.pub-year { font-family: var(--font-display); font-size: 1.5rem; color: var(--muted-dim); font-weight: 600; line-height: 1; padding-top: 0.15rem; min-width: 3.4rem; }
.pub-year .selected-star { display: block; color: var(--gold); font-size: 0.8rem; margin-top: 0.4rem; }
.pub-title { font-family: var(--font-display); font-size: 1.24rem; color: var(--text-strong); font-weight: 550; line-height: 1.25; }
.pub-authors { color: var(--muted); font-size: 0.92rem; margin-top: 0.4rem; }
.pub-authors .me { color: var(--cyan); font-weight: 600; }
.pub-venue { color: var(--muted-dim); font-size: 0.88rem; font-style: italic; margin-top: 0.25rem; }
.pub-abstract { color: var(--muted); font-size: 0.92rem; margin-top: 0.7rem; }
.pub-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.9rem; }
.pub-status { font-family: var(--font-mono); font-size: 0.7rem; color: var(--gold); border: 1px solid var(--glow-gold); border-radius: 999px; padding: 0.2rem 0.6rem; }
.pub-link { font-family: var(--font-mono); font-size: 0.74rem; color: var(--cyan); border: 1px solid var(--border); border-radius: 6px; padding: 0.2rem 0.6rem; }
.pub-link:hover { border-color: var(--cyan); }

/* ---- Teaching --------------------------------------------------------- */
.teach-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.4rem; }
.tcard { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: var(--panel-strong); border: 1px solid var(--border); transition: transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s; }
.tcard:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow-soft); }
.tcard-media { aspect-ratio: 16/9; overflow: hidden; background: var(--bg-elev); position: relative; }
.tcard-media img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }
.tcard-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(8,12,26,0.75)); }
.tcard-role { position: absolute; bottom: 0.8rem; left: 1rem; z-index: 2; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cyan); }
.tcard-body { padding: 1.35rem 1.5rem 1.6rem; }
.tcard-body h3 { font-size: 1.3rem; margin-bottom: 0.3rem; }
.tcard-inst { color: var(--muted); font-size: 0.9rem; }
.tcard-inst .fmt { color: var(--muted-dim); }
.tcard-summary { color: var(--muted); font-size: 0.94rem; margin-top: 0.9rem; }
.tcard-topics { list-style: none; margin-top: 1.1rem; display: flex; flex-direction: column; gap: 0.45rem; }
.tcard-topics li { position: relative; padding-left: 1.3rem; color: var(--text); font-size: 0.9rem; }
.tcard-topics li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 6px; height: 6px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 8px var(--violet); }

/* ---- CV --------------------------------------------------------------- */
.cv-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.4rem; margin-bottom: 1rem; }
.cv-note { font-size: 0.85rem; color: var(--muted-dim); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 0.75rem 1rem; margin-bottom: 2.6rem; font-family: var(--font-mono); }
.cv-section { margin-bottom: 2.8rem; }
.cv-section > h2 { font-size: 1.6rem; margin-bottom: 1.4rem; display: flex; align-items: center; gap: 0.8rem; }
.cv-section > h2 .idx { font-family: var(--font-mono); font-size: 0.8rem; color: var(--cyan); }
.timeline { position: relative; padding-left: 1.9rem; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: linear-gradient(180deg, var(--cyan), var(--violet), transparent); }
.tl-item { position: relative; padding-bottom: 1.8rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: calc(-1.9rem + 2px); top: 0.45rem; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--cyan); box-shadow: 0 0 10px var(--glow-cyan); }
.tl-item.todo::before { border-color: var(--muted-dim); box-shadow: none; }
.tl-period { font-family: var(--font-mono); font-size: 0.76rem; color: var(--cyan); letter-spacing: 0.04em; }
.tl-title { font-family: var(--font-display); font-size: 1.16rem; color: var(--text-strong); margin-top: 0.2rem; }
.tl-org { color: var(--muted); font-size: 0.92rem; }
.tl-org .loc { color: var(--muted-dim); }
.tl-details { list-style: none; margin-top: 0.55rem; display: flex; flex-direction: column; gap: 0.3rem; }
.tl-details li { position: relative; padding-left: 1.1rem; color: var(--text); font-size: 0.92rem; }
.tl-details li::before { content: "▹"; position: absolute; left: 0; color: var(--muted-dim); }
.tl-item.todo { padding: 0.9rem 1.1rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); margin-bottom: 1rem; }
.tl-item.todo .tl-title, .tl-item.todo .tl-details li { color: var(--muted); }
.todo-badge { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--glow-gold); border-radius: 4px; padding: 0.1rem 0.4rem; margin-left: 0.6rem; }

.skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.2rem; }
.skill-group h3 { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.8rem; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-tags span { font-size: 0.84rem; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 0.35rem 0.7rem; background: var(--panel); }
.cv-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.cv-list li { position: relative; padding-left: 1.3rem; color: var(--text); }
.cv-list li::before { content: ""; position: absolute; left: 0; top: 0.65em; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); }

/* ---- Home sub-sections ------------------------------------------------ */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.about-lede { font-family: var(--font-display); font-size: clamp(1.3rem, 2.4vw, 1.7rem); line-height: 1.4; color: var(--text-strong); margin-bottom: 1.6rem; }
.about-body p { color: var(--muted); margin-bottom: 1.1rem; }
.about-body p strong { color: var(--text); font-weight: 600; }
.facts { display: flex; flex-direction: column; gap: 0.4rem; }
.fact { padding: 1rem 1.2rem; border-radius: var(--radius-sm); background: var(--panel); border: 1px solid var(--border); }
.fact .k { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); }
.fact .v { color: var(--text); font-size: 0.95rem; margin-top: 0.25rem; }
.status-strip { margin-top: 1.4rem; font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); border-left: 2px solid var(--cyan); padding: 0.4rem 0 0.4rem 0.9rem; }

.home-sub-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.2rem; }
.home-sub-head .section-head { margin-bottom: 0; }
.view-all { font-family: var(--font-mono); font-size: 0.84rem; color: var(--cyan); display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.view-all:hover { gap: 0.7rem; }

.news-list { list-style: none; display: flex; flex-direction: column; gap: 0.2rem; }
.news-item { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: 0; }
.news-date { font-family: var(--font-mono); font-size: 0.8rem; color: var(--cyan); }
.news-body { color: var(--text); font-size: 0.95rem; }

/* ---- Contact / footer ------------------------------------------------- */
.contact { text-align: center; }
.contact h2 { font-size: clamp(2rem, 5vw, 3.2rem); }
.contact .lead { color: var(--muted); max-width: 34rem; margin: 1.1rem auto 2rem; font-size: 1.1rem; }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem; }
.social {
  display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.65rem 1.1rem;
  border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
  background: var(--panel); font-size: 0.9rem; transition: all 0.25s var(--ease);
}
.social:hover { color: var(--text-strong); border-color: var(--cyan); transform: translateY(-2px); box-shadow: 0 10px 26px -14px var(--glow-cyan); }
.social svg { width: 18px; height: 18px; }

footer.site {
  border-top: 1px solid var(--border); padding: 2.4rem 0; margin-top: 2rem;
  background: linear-gradient(180deg, transparent, rgba(8,12,26,0.6));
}
.foot-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.foot-brand { font-family: var(--font-display); color: var(--text); font-size: 1rem; }
.foot-meta { font-family: var(--font-mono); font-size: 0.76rem; color: var(--muted-dim); }
.foot-meta a { color: var(--muted); }

/* ---- Scroll reveal ---------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }

/* scroll progress bar */
.scroll-progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 200; background: linear-gradient(90deg, var(--cyan), var(--violet)); box-shadow: 0 0 10px var(--glow-cyan); }

/* ---- Full-screen dynamics trailer ------------------------------------- */
.trailer { position: relative; height: 100svh; min-height: 640px; width: 100%; overflow: hidden; }
#dynamics { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.trailer-veil {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(130% 80% at 50% -6%, rgba(6,9,18,0.62), transparent 42%),
    radial-gradient(130% 80% at 50% 106%, rgba(5,7,15,0.92), transparent 52%),
    radial-gradient(80% 70% at 50% 50%, transparent 55%, rgba(5,7,15,0.45));
}
.trailer-inner {
  position: relative; z-index: 2; display: flex; flex-direction: column; justify-content: space-between;
  height: 100%; width: 100%; max-width: var(--maxw); margin-inline: auto;
  padding: calc(var(--nav-h) + 2.2rem) clamp(1.15rem, 4vw, 2.4rem) 4.2rem; pointer-events: none;
}
.trailer-top { max-width: 42rem; }
.trailer-title { font-size: clamp(2.4rem, 6.2vw, 4.6rem); line-height: 1.03; letter-spacing: -0.03em; margin: 0.9rem 0 0; }
.trailer-title .accent {
  background: linear-gradient(115deg, var(--cyan) 0%, var(--blue) 48%, var(--violet) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.trailer-sub { color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.16rem); margin-top: 1.1rem; max-width: 34rem; }
.trailer-bottom { display: flex; flex-direction: column; gap: 1.1rem; }
.dyn-readout { min-height: 4.6rem; }
.dyn-readout .dyn-name { display: block; font-family: var(--font-display); font-size: 1.35rem; color: var(--text-strong); }
.dyn-readout .dyn-eq { display: block; font-family: var(--font-mono); font-size: clamp(0.8rem, 1.4vw, 0.95rem); color: var(--cyan); margin-top: 0.25rem; }
.dyn-readout .dyn-note { display: block; font-size: 0.86rem; color: var(--muted); margin-top: 0.4rem; max-width: 36rem; }
.dyn-controls { pointer-events: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.dyn-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.42rem; }
.dyn-group-label { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.18em; color: var(--muted-dim); width: 2.6rem; flex: none; }
.dyn-btn {
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted);
  background: rgba(10,16,34,0.5); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.4rem 0.85rem; cursor: pointer; transition: all 0.2s var(--ease);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.dyn-btn:hover { color: var(--text-strong); border-color: var(--border-strong); transform: translateY(-1px); }
.dyn-btn.active { color: #04101a; background: linear-gradient(120deg, var(--cyan), var(--violet)); border-color: transparent; box-shadow: 0 8px 22px -10px var(--glow-cyan); }
/* geometry (curvature) controls */
.geo-btn {
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted);
  background: rgba(10,16,34,0.5); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.4rem 0.85rem; cursor: pointer; transition: all 0.2s var(--ease);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.geo-btn:hover { color: var(--text-strong); border-color: var(--border-strong); transform: translateY(-1px); }
.geo-btn.active { color: #120c04; background: linear-gradient(120deg, var(--gold), var(--cyan)); border-color: transparent; box-shadow: 0 8px 22px -10px var(--glow-gold); }
.dyn-curv { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-dim); transition: opacity 0.2s; }
.dyn-curv.disabled { opacity: 0.32; pointer-events: none; }
.dyn-curv input[type="range"] { -webkit-appearance: none; appearance: none; width: 92px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--violet), var(--cyan)); outline: none; cursor: pointer; }
.dyn-curv input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--text-strong); border: 2px solid var(--cyan); box-shadow: 0 0 8px var(--glow-cyan); cursor: pointer; }
.dyn-curv input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--text-strong); border: 2px solid var(--cyan); box-shadow: 0 0 8px var(--glow-cyan); cursor: pointer; }
.trailer-scroll {
  position: absolute; left: 50%; bottom: 1.3rem; transform: translateX(-50%); z-index: 3; pointer-events: auto;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted);
}
.trailer-scroll:hover { color: var(--cyan); }
.trailer-scroll .bar { width: 1px; height: 32px; background: linear-gradient(180deg, var(--cyan), transparent); animation: cue 2.4s ease-in-out infinite; }
.trailer-legend { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 0.2rem; font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted-dim); }
.trailer-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.trailer-legend i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; }
.trailer-legend .sink { color: var(--cyan); } .trailer-legend .source { color: var(--violet); } .trailer-legend .saddle { color: var(--gold); }

/* ---- Blog ------------------------------------------------------------- */
.blog-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.2rem; }
.blog-card {
  position: relative; display: flex; flex-direction: column; padding: 1.5rem 1.5rem 1.4rem;
  border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border);
  backdrop-filter: blur(8px); transition: transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s;
}
.blog-card:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow-soft); }
.blog-card .post-meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--cyan); letter-spacing: 0.04em; }
.blog-card h3 { font-size: 1.3rem; margin: 0.5rem 0 0.4rem; }
.blog-card p { color: var(--muted); font-size: 0.94rem; flex: 1; }
.blog-card .post-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 1rem; }
.blog-card .read { font-family: var(--font-mono); font-size: 0.76rem; color: var(--cyan); margin-top: 1rem; display: inline-flex; align-items: center; gap: 0.4rem; }
.blog-card:hover .read { gap: 0.6rem; }
.blog-card .card-link { position: absolute; inset: 0; z-index: 3; }

.post-hero { padding-top: calc(var(--nav-h) + 3.5rem); padding-bottom: 0.5rem; }
.post-hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0.8rem 0 0.7rem; }
.post-meta-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.post-meta-row .dot { color: var(--muted-dim); }

/* long-form prose */
.prose { max-width: var(--maxw-narrow); font-size: 1.06rem; }
.prose > * + * { margin-top: 1.1rem; }
.prose h2 { font-size: 1.7rem; margin-top: 2.4rem; }
.prose h3 { font-size: 1.3rem; margin-top: 1.8rem; }
.prose p { color: var(--text); }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(56,225,214,0.4); }
.prose strong { color: var(--text-strong); }
.prose ul, .prose ol { padding-left: 1.4rem; color: var(--text); display: flex; flex-direction: column; gap: 0.4rem; }
.prose li::marker { color: var(--cyan); }
.prose blockquote { border-left: 2px solid var(--cyan); padding: 0.3rem 0 0.3rem 1.2rem; color: var(--muted); font-style: italic; }
.prose code { font-family: var(--font-mono); font-size: 0.88em; background: rgba(120,160,240,0.1); border: 1px solid var(--border); border-radius: 5px; padding: 0.1em 0.4em; }
.prose pre { background: rgba(8,13,28,0.8); border: 1px solid var(--border); border-left: 2px solid var(--violet); border-radius: var(--radius-sm); padding: 1.1rem 1.3rem; overflow-x: auto; }
.prose pre code { background: none; border: 0; padding: 0; font-size: 0.86rem; color: var(--text); }
.prose img { border-radius: var(--radius-sm); border: 1px solid var(--border); margin-inline: auto; }
.prose hr { border: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); margin: 2rem 0; }
.prose .equation { font-size: 1rem; }

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero-media { order: -1; }
  .portrait-wrap { max-width: 260px; }
  .trailer-inner { padding-bottom: 3.4rem; }
  .dyn-readout { min-height: 4rem; }
  .dyn-btn { font-size: 0.7rem; padding: 0.34rem 0.7rem; }
  .trailer-legend { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .nav-links {
    position: fixed; top: var(--nav-h); left: 0; right: 0; width: 100%;
    z-index: 120; flex-direction: column; align-items: stretch;
    gap: 0.2rem; padding: 1rem clamp(1.15rem, 4vw, 2.4rem) 1.6rem;
    background: rgba(7,11,24,0.97); backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border); transform: translateY(-120%);
    transition: transform 0.4s var(--ease); box-shadow: var(--shadow-soft);
    pointer-events: none;
  }
  .nav-links.open { pointer-events: auto; }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 0.85rem 0.6rem; font-size: 1rem; }
  .nav-links a.active::after { display: none; }
  .nav-cta { margin: 0.5rem 0 0; text-align: center; }
  .nav-toggle { display: inline-flex; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .trailer { height: auto; }
  .trailer-scroll { display: none; }
  .trailer-inner { padding-bottom: 2.4rem; }
  .btn-row { width: 100%; }
  .btn { flex: 1; justify-content: center; }
  .filter-search { margin-left: 0; width: 100%; }
  .filter-search input { width: 100%; }
  .pub-item { grid-template-columns: 1fr; gap: 0.5rem; }
  .pub-year { display: flex; align-items: baseline; gap: 0.6rem; font-size: 1.1rem; }
  .pub-year .selected-star { margin: 0; }
  .news-item { grid-template-columns: 1fr; gap: 0.15rem; }
  .detail-nav { flex-direction: column; }
  .detail-nav a { max-width: 100%; }
}

/* ---- Reduced motion --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .portrait-spin { animation: none; }
  .hero-status .dot { animation: none; }
}

/* ---- Print (CV) ------------------------------------------------------- */
@media print {
  .cosmos, .cosmos-veil, .nav, footer.site, .scroll-progress, .cv-actions { display: none !important; }
  body { background: #fff; color: #111; }
  .cv-note, .tl-item.todo { display: none !important; }
  a { color: #111; }
}
