/* ============================================================
   experience.css — 2026-11 design language (Apple / Linear)
   Loaded after index.css. index.css keeps every component's
   mechanics (accordions, Listen, YouTube card, modals); this file
   re-dresses them: one system font, tight display type, quiet
   surfaces, generous space. The single bold element is the stage —
   a brain rendered live on the GPU (experience.js).
   ============================================================ */

/* ---------- Tokens: light (Apple white) ---------- */
:root {
  --x-bg: #ffffff;
  --x-bg-alt: #f5f5f7;
  --x-tile: #f5f5f7;
  --x-text: #1d1d1f;
  --x-muted: #6e6e73;
  --x-faint: #86868b;
  --x-hair: rgba(0, 0, 0, 0.1);
  --x-link: #0066cc;
  --x-link-rgb: 0, 102, 204;
  --x-stage: #ffffff;

  --color-bg: var(--x-bg);
  --color-bg-alt: var(--x-bg-alt);
  --color-text: var(--x-text);
  --color-text-secondary: var(--x-muted);
  --color-text-tertiary: var(--x-faint);
  --color-accent: var(--x-link);
  --color-accent-light: #0077ed;
  --color-accent-rgb: var(--x-link-rgb);
  --color-border: var(--x-hair);
  --color-border-light: var(--x-hair);
  --color-card-bg: var(--x-tile);
  --color-card-shadow: transparent;
  --color-hero-bg: transparent;
  --color-section-alt-bg: transparent;
  --color-nav-bg: rgba(255, 255, 255, 0.72);
  --color-nav-bg-scrolled: rgba(255, 255, 255, 0.8);
  --color-nav-bg-mobile: rgba(255, 255, 255, 0.97);

  --x-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --x-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-display: var(--x-display);
  --font-prose: var(--x-font);
  --font-body: var(--x-font);

  --nav-height: 48px;
}

/* ---------- Tokens: dark (Apple black) ---------- */
:root[data-theme="dark"] {
  --x-bg: #000000;
  --x-bg-alt: #0a0a0b;
  --x-tile: #161617;
  --x-text: #f5f5f7;
  --x-muted: #a1a1a6;
  --x-faint: #86868b;
  --x-hair: rgba(255, 255, 255, 0.12);
  --x-link: #2997ff;
  --x-link-rgb: 41, 151, 255;
  --x-stage: #000000;

  --color-accent-light: #5aaeff;
  --color-nav-bg: rgba(0, 0, 0, 0.72);
  --color-nav-bg-scrolled: rgba(0, 0, 0, 0.8);
  --color-nav-bg-mobile: rgba(10, 10, 11, 0.97);
  --color-overlay: rgba(0, 0, 0, 0.8);
}

/* ---------- Ground: the old animated background layers rest ---------- */
html { background: var(--x-bg); }
body {
  font-family: var(--x-font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  color: var(--x-text);
  background: var(--x-bg);
}
body::before,
body::after,
.gradient-bg-container { display: none !important; }

a { color: var(--x-link); }
a:hover { color: var(--color-accent-light); text-decoration: underline; text-underline-offset: 3px; }
::selection { background: rgba(var(--x-link-rgb), 0.25); color: inherit; }

h1, h2, h3, h4, h5 {
  font-family: var(--x-display);
  font-weight: 600;
  letter-spacing: -0.028em;
  color: var(--x-text);
}
h2 { font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1.06; letter-spacing: -0.04em; }
h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); line-height: 1.15; }

/* Nothing slides in: the page simply is there. */
.fade-in, .fade-in.visible { opacity: 1 !important; transform: none !important; transition: none !important; }

/* ---------- Navigation ---------- */
.nav {
  height: var(--nav-height);
  border-bottom: 1px solid var(--x-hair);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.nav.nav--scrolled { box-shadow: none; }
.nav-inner { max-width: 1080px; }
.nav-brand { font-family: var(--x-display); font-size: 1rem; font-weight: 600; letter-spacing: -0.015em; }
.nav-brand:hover { color: var(--x-text); text-decoration: none; }
.nav-links { gap: 1.6rem; }
.nav-links a { font-size: 0.75rem; font-weight: 400; letter-spacing: -0.01em; color: var(--x-text); opacity: 0.8; }
.nav-links a:hover, .nav-links a.active { opacity: 1; color: var(--x-text); text-decoration: none; }
.nav-links a::after { display: none; }
.nav-theme-toggle { color: var(--x-text); opacity: 0.8; margin-left: 1.2rem; }
.nav-search {
  margin-left: 0.6rem;
  background: none;
  border: 1px solid var(--x-hair);
  border-radius: 7px;
  padding: 0.12rem 0.45rem;
  cursor: pointer;
  color: var(--x-muted);
  line-height: 1;
}
.nav-search kbd { font: 500 0.6875rem var(--x-font); letter-spacing: 0; }
.nav-search i { display: none; font-size: 0.8rem; }
/* Touch screens have no shortcut to show: a magnifier instead of the key. */
@media (pointer: coarse) {
  .nav-search { border: 0; padding: 0.3rem; }
  .nav-search kbd { display: none; }
  .nav-search i { display: inline; }
}
.nav-search:hover { color: var(--x-text); border-color: var(--x-faint); }
.nav-star { color: var(--x-faint); }

/* ---------- The stage (hero) ---------- */
/* index.css sets p { text-align: left; max-width: var(--measure) } — the stage is centred. */
.stage .hero-inner p,
.stage-caption,
.stage-hud { text-align: center; max-width: none; margin-left: auto; margin-right: auto; }
.hero.stage {
  position: relative;
  height: 300vh;
  padding: 0;
  margin: 0;
  background: var(--x-stage);
  border: 0;
}
.stage-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.stage .hero-inner {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--nav-height) + 11vh);
  display: block;
  max-width: none;
  padding: 0 24px;
  text-align: center;
  will-change: opacity, transform;
}
.stage .hero-eyebrow {
  font: 500 clamp(1rem, 1.5vw, 1.25rem) var(--x-display);
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--x-muted);
  margin: 0 0 0.6rem;
}
.hero-director { font: 400 clamp(0.8125rem, 1.1vw, 0.9375rem) var(--x-font); letter-spacing: -0.005em; color: var(--x-faint);
  margin: -0.3rem auto 0.7rem !important; text-align: center; max-width: none; }
.stage .hero-name {
  font-family: var(--x-display);
  font-size: clamp(3.4rem, 9.2vw, 8.6rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.02;
  margin: 0;
  /* background-clip: text paints only inside the box: room below for the ş cedilla. */
  padding-bottom: 0.14em;
  background: linear-gradient(180deg, var(--x-text) 35%, var(--x-faint) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stage .hero-name .hero-honorific {
  display: block;
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  font-style: normal;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: -0.1rem 0 0.9rem;
  color: var(--x-muted);
  -webkit-text-fill-color: var(--x-muted);
}
.hero-motto {
  font: 600 clamp(1.35rem, 2.4vw, 2rem) var(--x-display);
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--x-text);
  margin: 0.35rem auto 0;
  max-width: 24ch;
}
.hero-fields {
  font-size: clamp(0.875rem, 1.1vw, 1rem);
  color: var(--x-muted);
  margin: 0.7rem auto 0;
  max-width: 46rem;
  text-wrap: balance;
  letter-spacing: -0.01em;
}
.stage .hero-links { justify-content: center; gap: 0.5rem 1.6rem; margin-top: 1.4rem; }
.stage .hero-links a {
  font-size: 1rem;
  font-weight: 400;
  color: var(--x-link);
  border: 0;
  padding: 0;
}
.stage .hero-links a::after { content: ' ›'; }
.stage-caption,
.stage-hud {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--x-faint);
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.stage-caption { bottom: 52px; opacity: 0; transition: opacity 0.4s; }
.stage-hud { bottom: 28px; }
.stage-hud b { color: var(--x-text); font-weight: 500; }

/* ---------- Statement ---------- */
.statement { padding: 6rem 0 4rem; }
.statement .section-inner { max-width: 1080px; }
.statement .hero-roles {
  max-width: none;
  margin: 3rem 0 0;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.5rem 2rem;
  font-size: 0.9375rem;
  color: var(--x-muted);
}
.statement .hero-roles span { display: block; line-height: 1.4; }
.statement .hero-roles span::before { display: none; }
.statement .hero-roles a { color: var(--x-text); font-weight: 600; border: 0; }

/* ---------- Sections ---------- */
.section, .section--alt { background: transparent; border-top: 0; padding: 4.5rem 0; }
.section--alt { background: var(--x-bg-alt); }
.section-inner, .footer-inner, .statement .section-inner { max-width: 1080px; padding: 0 24px; }
.section-header { margin-bottom: 2rem; }
.section-label {
  display: block;
  font: 600 1rem var(--x-display);
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--x-muted);
  margin-bottom: 0.5rem;
}
.section-label::before { display: none; }
.section-header h2 { margin: 0; }

/* About */
.about-grid { gap: 4.5rem; }
.about-text p { font-size: 1.1875rem; line-height: 1.5; color: var(--x-text); max-width: 60ch; margin-bottom: 1.1rem; }
.about-text h3, .about-aside h3 { margin: 3rem 0 1.25rem; }
.about-aside h3:first-of-type { margin-top: 2.2rem; }
.about-portrait { margin: 0; width: 132px; }
.about-portrait img {
  width: 100%;
  aspect-ratio: 478 / 640;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}
.timeline { border-left: 0; padding-left: 0; }
.timeline-item { padding: 0 0 1.6rem; margin: 0; border-left: 0; }
.timeline-item::before { display: none; }
.timeline-year { display: block; text-transform: none; letter-spacing: -0.005em; font-size: 0.875rem; font-weight: 500; color: var(--x-muted); }
.timeline-title { font-size: 1.1875rem; font-weight: 600; letter-spacing: -0.02em; color: var(--x-text); }
.timeline-desc { font-size: 0.9375rem; color: var(--x-muted); }
.timeline-desc em { font-style: normal; }
.info-list li { border-color: var(--x-hair); }
.info-label { text-transform: none; letter-spacing: -0.005em; font-size: 0.875rem; font-weight: 500; color: var(--x-muted); }
.info-value { font-size: 0.9375rem; color: var(--x-text); }
.scope-list li { padding: 1rem 0; }
.scope-list strong { font-weight: 600; }

/* Publications */
.pub-category { margin-bottom: 2.5rem; }
.pub-cat-title {
  font: 600 1.5rem var(--x-display);
  letter-spacing: -0.025em;
  text-transform: none;
  color: var(--x-text);
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--x-hair);
  margin-bottom: 0;
}
.pub-item { grid-template-columns: 3rem minmax(0, 1fr); padding: 1.35rem 0; border-color: var(--x-hair); }
.pub-number { font-size: 0.875rem; font-weight: 400; color: var(--x-faint); }
.pub-year { font-size: 0.8125rem; font-weight: 500; letter-spacing: 0; color: var(--x-muted); }
.pub-title { font-family: var(--x-font); font-size: 1.125rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.pub-title-en { font-weight: 400; color: var(--x-muted); }
.pub-authors { font-size: 0.875rem; color: var(--x-muted); }
.pub-venue { font-size: 0.875rem; font-style: normal; color: var(--x-faint); }
.expand-btn {
  border: 0;
  padding: 0;
  margin-top: 1.5rem;
  font: 400 1.0625rem var(--x-font);
  letter-spacing: -0.015em;
  color: var(--x-link);
}
.expand-btn:hover { text-decoration: underline; text-underline-offset: 3px; background: none; }

/* Projects */
.project-row { padding: 1.35rem 0; border-color: var(--x-hair); }
.project-years { font-size: 0.875rem; color: var(--x-muted); font-variant-numeric: tabular-nums; }
.project-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.02em; }
.project-funder { font-size: 0.875rem; color: var(--x-muted); }
.project-status { text-transform: none; letter-spacing: 0; font-size: 0.75rem; font-weight: 500; border-radius: 999px; }

/* Teaching */
.courses-list { gap: 1rem; }
.course-card {
  background: var(--x-tile);
  border: 0;
  border-radius: 22px;
  box-shadow: none;
}
.course-card-header { padding: 1.6rem 1.8rem !important; }
.course-code { text-transform: none; letter-spacing: -0.01em; font: 600 1.25rem var(--x-display); color: var(--x-text); }
.accordion-header { font-size: 1rem; font-weight: 500; letter-spacing: -0.015em; }
.accordion-item { border-color: var(--x-hair); }
.material-resource-link { font-size: 0.9375rem; color: var(--x-link); }
.material-type { text-transform: none; letter-spacing: 0; }

/* Announcements */
.announcement-item { padding: 1.6rem 0; border-color: var(--x-hair); }
.announcement-date { text-transform: none; letter-spacing: 0; font-size: 0.875rem; color: var(--x-muted); font-variant-numeric: tabular-nums; }
.announcement-tag { text-transform: none; letter-spacing: 0; border-radius: 999px; }

/* Contact */
.contact-label { text-transform: none; letter-spacing: -0.005em; font-size: 0.875rem; font-weight: 500; color: var(--x-muted); }
.contact-value { font-size: 1rem; color: var(--x-text); }
.contact-icon { background: var(--x-tile); border: 0; color: var(--x-text); }
.social-icon { border-color: var(--x-hair); color: var(--x-text); }
.social-icon:hover { background: var(--x-tile); border-color: var(--x-hair); color: var(--x-text); text-decoration: none; }

/* Footer */
.footer { background: var(--x-bg-alt); border-top: 1px solid var(--x-hair); font-size: 0.75rem; color: var(--x-faint); }
.footer a { color: var(--x-muted); }

/* Feature surfaces that stay (Listen, YouTube card, modals) adopt the tokens. */
.listen-modal, .yt-promo, .login-modal-content, .success-content {
  font-family: var(--x-font);
  border-radius: 18px;
}

@media (max-width: 768px) {
  .hero.stage { height: 220vh; }
  .stage .hero-inner { top: calc(var(--nav-height) + 8vh); }
  .statement { padding: 6rem 0 3.5rem; }
  .section, .section--alt { padding: 3rem 0; }
  /* One column: the portrait leads the section (it sits inside .about-aside in the
     markup, which would otherwise put it below the whole CV text). */
  .about-grid { gap: 2rem; }
  .about-aside { display: contents; }
  .about-portrait { order: -1; width: 120px; }
  .about-aside h3:first-of-type { margin-top: 3rem; }
}

/* ---------- ⌘K palette (experience.js) ---------- */
.palette {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: start center;
  padding-top: 14vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.palette[hidden] { display: none; }
.palette-box {
  width: min(660px, 92vw);
  background: var(--x-bg);
  border: 1px solid var(--x-hair);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.palette-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: var(--x-text);
  font: 500 1.125rem var(--x-font);
  letter-spacing: -0.015em;
  padding: 1.15rem 1.3rem;
  border-bottom: 1px solid var(--x-hair);
}
.palette-input::-webkit-search-cancel-button { display: none; }
.palette-list { list-style: none; margin: 0; padding: 0.4rem; max-height: 52vh; overflow: auto; }
.palette-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9375rem;
}
.palette-list li[aria-selected="true"] { background: rgba(var(--x-link-rgb), 0.12); }
.palette-t { color: var(--x-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-k { color: var(--x-faint); font-size: 0.8125rem; white-space: nowrap; }
.palette-empty { color: var(--x-muted); cursor: default; }
.palette-foot {
  display: flex;
  gap: 1.2rem;
  margin: 0;
  padding: 0.6rem 1.2rem;
  border-top: 1px solid var(--x-hair);
  font-size: 0.75rem;
  color: var(--x-faint);
}
.palette-hit { animation: x-hit 1.6s ease-out; border-radius: 10px; }
@keyframes x-hit { from { background: rgba(var(--x-link-rgb), 0.18); } to { background: transparent; } }

/* No WebGL2: the stage keeps its words and gives up its height. */
.hero.stage.stage--static { height: auto; }
.stage--static .stage-pin { position: relative; height: auto; padding: calc(var(--nav-height) + 6rem) 0 4rem; }
.stage--static .hero-inner { position: relative; top: 0; }
.stage--static .stage-canvas,
.stage--static .stage-caption,
.stage--static .stage-hud { display: none; }

/* ---------- Background music control (experience.js) ---------- */
.nav-music {
  margin-left: 1.2rem;
  background: none;
  border: 0;
  padding: 0.3rem;
  cursor: pointer;
  color: var(--x-text);
  opacity: 0.8;
  font-size: 0.85rem;
  line-height: 1;
}
.nav-music:hover { opacity: 1; }
.nav-music + .nav-theme-toggle { margin-left: 0.6rem; }

/* ---------- Text written into the brain ---------- */
.brain-text {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  width: min(46rem, 76vw);
  text-align: center;
  pointer-events: none;
}
.brain-text p { max-width: none; margin: 0; text-align: center; }
.brain-text .hero-statement {
  font: 700 clamp(1.5rem, 3.6vw, 3.1rem) var(--x-display);
  letter-spacing: -0.035em;
  line-height: 1.14;
}
.brain-director {
  margin-top: 1.1rem !important;
  font: 500 clamp(0.75rem, 1.05vw, 0.9375rem) var(--x-font);
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.brain-text .w {
  display: inline-block;
  color: transparent;
  text-shadow: none;
  transition: color 0.9s ease, text-shadow 1.4s ease, opacity 0.9s ease;
  opacity: 0.25;
}
.brain-director .w { color: transparent; }
/* Lit words glow with the signal's own colour, then settle to a soft halo. */
.brain-text .w.on {
  opacity: 1;
  color: #f5f5f7;
  text-shadow: 0 0 6px rgba(var(--x-link-rgb), 0.95), 0 0 22px rgba(var(--x-link-rgb), 0.65), 0 0 44px rgba(var(--x-link-rgb), 0.35);
}
.brain-director .w.on { color: #c9d4ff; }
/* Light theme: the brain is a grey ceramic, so the words are white with a dark halo. */
:root:not([data-theme="dark"]) .brain-text .w.on {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 14px rgba(0, 0, 0, 0.55), 0 0 26px rgba(var(--x-link-rgb), 0.55);
}
:root:not([data-theme="dark"]) .brain-director .w.on { color: #f2f4ff; }
/* Reading fallback: no WebGL (static stage) shows the text as plain copy. */
.stage--static .brain-text { position: relative; left: 0; top: 0; transform: none; width: auto; max-width: 34rem; margin: 2rem auto 0; padding: 0 24px; }
.stage--static .brain-text .w { color: var(--x-text); opacity: 1; text-shadow: none; }
@media (max-width: 768px) { .brain-text { top: 60%; width: 88vw; } .brain-text .hero-statement { font-size: clamp(1.25rem, 6vw, 1.7rem); } }
@media (prefers-reduced-motion: reduce) { .brain-text .w { transition: none; } }

/* Founder line sits under the Director line in the opening. */
.hero-founder { margin-top: -0.4rem !important; }
.hero-founder a { color: var(--x-muted); font-weight: 600; }
.hero-founder a:hover { color: var(--x-text); }

/* The ad slot section after Teaching keeps the same rhythm as the others (index.css adds more when ads are off). */
.section--after-ad, html.ads-off .section--after-ad { padding-top: 3rem; }
