/* =========================================================================
   Nihan Pol — Personal academic site
   Reimagined al-folio. Keeps the narrow-column / typographic-calm DNA,
   pushes harder on:
     - a typographic masthead inspired by pulsar timing residuals
     - sharper section rhythm (lowercase eyebrows, full-bleed rules)
     - an accent color driven by a CSS custom property (--theme)
     - denser publication & CV cards that still breathe
   ========================================================================= */

:root {
  /* accent overrides come from Tweaks via inline style on .root; these are the defaults */
  --theme-light: #CC0000;   /* Texas Tech red */
  --theme-dark:  #FF4D4D;   /* brighter Texas Tech red for dark mode */
  --col: 880px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- theme roots (override tokens.css semantics with bolder neutrals) ---------- */
.root {
  --bg: #ffffff;
  --bg-alt: #fafaf9;
  --fg: #0a0a0a;
  --fg-muted: #737373;
  --fg-soft: #a3a3a3;
  --card-bg: #ffffff;
  --divider: rgba(10, 10, 10, 0.08);
  --divider-strong: rgba(10, 10, 10, 0.18);
  --theme: var(--theme-light, #CC0000);
  --theme-bg-soft: color-mix(in oklch, var(--theme) 8%, var(--bg));
  --footer-bg: #0a0a0a;
  --footer-text: #d4d4d4;
  color: var(--fg);
  background: var(--bg);
  min-height: 100vh;
  transition: background-color .35s ease, color .35s ease;
}
.root.dark {
  --bg: #0b0b0c;
  --bg-alt: #131315;
  --fg: #ededed;
  --fg-muted: #9c9c9c;
  --fg-soft: #6a6a6a;
  --card-bg: #151517;
  --divider: rgba(255, 255, 255, 0.08);
  --divider-strong: rgba(255, 255, 255, 0.18);
  --theme: var(--theme-dark, #FF4D4D);
  --theme-bg-soft: color-mix(in oklch, var(--theme) 14%, var(--bg));
  --footer-bg: #050506;
  --footer-text: #9c9c9c;
}

/* ---------- layout primitives ---------- */
.container {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 24px;
}
.page {
  padding: 80px 0 160px;
}

/* ---------- navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--divider);
}
.nav-inner {
  max-width: var(--col);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--fg);
  text-decoration: none;
  margin-right: auto;
  white-space: nowrap;
}
.brand-mark {
  font-weight: 300;
  font-size: 1.1rem;
  letter-spacing: -0.005em;
}
.brand-mark .first { font-weight: 700; }
.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fg-soft);
  letter-spacing: 0.04em;
}
.nav-links {
  list-style: none; padding: 0; margin: 0;
  display: flex; gap: 22px; align-items: center;
}
.nav-links a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  transition: color .18s ease;
  position: relative;
  padding: 4px 0;
}
.nav-links a:hover { color: var(--fg); }
.nav-links a.active { color: var(--theme); font-weight: 500; }
.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -15px;
  height: 2px;
  background: var(--theme);
}
.theme-btn {
  background: none; border: 0;
  color: var(--fg-muted);
  cursor: pointer; padding: 0;
  font-size: 0.95rem;
  transition: color .18s ease;
}
.theme-btn:hover { color: var(--theme); }

/* ---------- masthead (about hero) ---------- */
.masthead { padding-top: 24px; padding-bottom: 8px; }
.masthead .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-soft);
  margin-bottom: 14px;
}
.masthead .name {
  font-family: var(--font-sans);
  font-weight: 200;
  font-size: clamp(3.2rem, 9vw, 7rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  margin: 0;
}
.masthead .name .first { font-weight: 800; }
.masthead .name .period { color: var(--theme); font-weight: 800; }
.masthead .role {
  margin-top: 26px;
  font-size: 1.2rem;
  color: var(--fg-muted);
  line-height: 1.45;
  max-width: 680px;
  font-weight: 300;
}
.masthead .role b { color: var(--fg); font-weight: 500; }

/* Hellings-Downs masthead — the signature NHz-GW detection figure */
.gw-mast, .pulsar-mast {
  margin: 44px auto 56px;
  max-width: 720px;
  border-top: 1px solid var(--divider-strong);
  border-bottom: 1px solid var(--divider-strong);
  padding: 20px 0 14px;
  position: relative;
  overflow: hidden;
}
.mast-disclaimer {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-soft);
  text-align: center;
  margin-top: 10px;
  padding: 0 4px;
}
.gw-mast .mast-labels, .pulsar-mast .labels {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-soft);
  margin-bottom: 8px;
}
.pulsar-mast svg { display: block; width: 100%; height: 120px; }
.gw-mast svg { display: block; width: 100%; height: auto; }
.gw-mast .mast-labels {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-soft);
  margin-bottom: 10px;
  padding: 0 4px;
}

/* ---------- section headers ---------- */
.section { padding: 56px 0; }
.section + .section { border-top: 1px solid var(--divider); }
.section-head {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 28px;
}
.section-head h2 {
  font-size: clamp(1.6rem, 2.5vw, 2.1rem);
  font-weight: 300;
  letter-spacing: -0.015em;
  text-transform: lowercase;
  margin: 0;
  color: var(--fg);
}
.section-head .num {
  display: none;
}
.section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--divider-strong);
  align-self: center;
}
.section-head .more {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--divider-strong);
  padding-bottom: 1px;
}
.section-head .more:hover { color: var(--theme); border-color: var(--theme); }

/* ---------- about layouts ---------- */
/* three variants toggled via data-landing on .root */
.about-grid { display: grid; gap: 40px; align-items: start; }
.root[data-landing="classic"]   .about-grid { grid-template-columns: 1fr 220px; }
.root[data-landing="text-first"] .about-grid { grid-template-columns: 1fr; max-width: 720px; }
.root[data-landing="timing-array"] .about-grid { grid-template-columns: 1fr; }

.profile-card {
  border: 1px solid var(--divider);
  border-radius: 4px;
  overflow: hidden;
  background: var(--card-bg);
}
.profile-pic {
  aspect-ratio: 3/4;
  background: #0a0a1a url('../assets/profile.jpg') center/cover no-repeat;
  position: relative;
}
.profile-pic::after { content: none; }
.profile-glyph { display: none; }
.profile-meta {
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
  line-height: 1.7;
  border-top: 1px solid var(--divider);
}
.profile-meta .label { color: var(--fg-soft); margin-right: 6px; }

.prose {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--fg);
  max-width: 64ch;
}
.prose p { margin: 0 0 1.1rem; }
.prose a { color: var(--theme); text-decoration: none; border-bottom: 1px solid color-mix(in oklch, var(--theme) 40%, transparent); }
.prose a:hover { border-bottom-color: var(--theme); }

/* affiliations strip */
.affils {
  display: flex; flex-wrap: wrap; gap: 18px 28px;
  margin-top: 30px; padding: 18px 0;
  border-top: 1px solid var(--divider);
}
.affils .aff {
  display: flex; flex-direction: column; gap: 2px;
}
.affils .aff .k {
  font-family: var(--font-mono);
  font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--fg-soft);
}
.affils .aff .v {
  font-size: 0.95rem; color: var(--fg); font-weight: 500;
}

/* ---------- news (timeline) ---------- */
.news-list { list-style: none; padding: 0; margin: 0; }
.news-list li {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 14px 0;
  border-top: 1px dashed var(--divider);
  font-size: 0.98rem;
  line-height: 1.5;
}
.news-list li:first-child { border-top: 0; }
.news-list .date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
  padding-top: 3px;
  white-space: nowrap;
}
.news-list .pin {
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--theme);
  margin-right: 8px; vertical-align: middle;
}
.news-list em {
  color: var(--theme);
  font-style: normal;
  font-weight: 500;
}

/* ---------- publications ---------- */
.pub-filters {
  display: flex; gap: 6px; margin-bottom: 22px;
  flex-wrap: wrap;
}
.pub-filters button {
  border: 1px solid var(--divider-strong);
  background: transparent;
  color: var(--fg-muted);
  padding: 5px 12px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 2px;
  transition: all .15s ease;
}
.pub-filters button:hover { color: var(--fg); border-color: var(--fg-muted); }
.pub-filters button.active {
  color: var(--bg);
  background: var(--theme);
  border-color: var(--theme);
}
.root.dark .pub-filters button.active { color: #000; }

.pub-year {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 24px;
  padding: 28px 0;
  border-top: 1px solid var(--divider);
}
.pub-year:first-of-type { border-top: 1px solid var(--divider-strong); }
.pub-year .y {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--fg);
  font-weight: 500;
  position: sticky; top: 80px;
  align-self: start;
}
.pub-year .y small {
  display: block;
  font-size: 0.7rem;
  color: var(--fg-soft);
  font-weight: 400;
  margin-top: 4px;
}
.pub-list { display: grid; gap: 22px; }

.pub {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.pub .venue-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pub .venue {
  display: inline-block;
  background: var(--theme);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  border-radius: 2px;
}
.root.dark .pub .venue { color: #000; }
.pub .award {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--theme);
  border: 1px solid var(--theme);
  padding: 1px 8px;
  border-radius: 2px;
  letter-spacing: 0.04em;
}
.pub .title {
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--fg);
  margin-top: 2px;
}
.pub .authors {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.55;
}
.pub .authors em {
  font-style: normal;
  color: var(--fg);
  font-weight: 600;
  border-bottom: 1.5px solid var(--theme);
  padding-bottom: 1px;
}
.pub .authors .more { color: var(--fg-soft); }
.pub .meta {
  font-size: 0.85rem;
  color: var(--fg-muted);
  font-style: italic;
}
.pub .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.pub .actions a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  border: 1px solid var(--divider-strong);
  padding: 2px 8px;
  border-radius: 2px;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: all .15s ease;
}
.pub .actions a:hover {
  color: var(--theme);
  border-color: var(--theme);
}

/* ---------- teaching ---------- */
.teach-grid { display: grid; gap: 20px; grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) { .teach-grid { grid-template-columns: 1fr; } }
.course {
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: 20px 22px;
  background: var(--card-bg);
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color .2s ease, transform .2s ease;
}
.course:hover { border-color: var(--theme); transform: translateY(-1px); }
.course .code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--theme);
  letter-spacing: 0.06em;
}
.course h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--fg);
  line-height: 1.3;
}
.course .term {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}
.course p {
  margin: 6px 0 0;
  font-size: 0.92rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* ---------- cv ---------- */
.cv-block { margin-top: 32px; }
.cv-block:first-child { margin-top: 0; }
.cv-block h3 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-soft);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--divider);
}
.cv-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 20px;
  padding: 10px 0;
  align-items: baseline;
}
.cv-item .when {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-muted);
}
.cv-item .what .role {
  font-size: 0.98rem;
  color: var(--fg);
  font-weight: 500;
}
.cv-item .what .place {
  font-size: 0.88rem;
  color: var(--fg-muted);
  margin-top: 1px;
}

/* ---------- group ---------- */
.group-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 720px) { .group-grid { grid-template-columns: repeat(2, 1fr); } }
.person {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border: 1px solid var(--divider);
  border-radius: 4px;
  background: var(--card-bg);
  transition: border-color .2s ease;
}
.person:hover { border-color: var(--theme); }
.person .avatar {
  aspect-ratio: 1/1;
  border-radius: 4px;
  background: linear-gradient(140deg, var(--theme-bg-soft), var(--bg-alt));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-slab);
  font-weight: 300;
  font-size: 2.2rem;
  color: var(--theme);
}
.person .name { font-weight: 500; font-size: 0.95rem; color: var(--fg); }
.person .role {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}
.group-joining {
  margin-top: 28px;
  padding: 18px 20px;
  border-left: 3px solid var(--theme);
  background: var(--theme-bg-soft);
  border-radius: 0 4px 4px 0;
  font-size: 0.95rem;
  line-height: 1.5;
}
.group-joining strong { color: var(--theme); }

/* ---------- contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
@media (max-width: 720px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card {
  border-top: 1px solid var(--divider-strong);
  padding-top: 18px;
}
.contact-card h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  margin: 0 0 10px;
}
.contact-card p { margin: 2px 0; font-size: 0.98rem; color: var(--fg); line-height: 1.55; }
.contact-card a { color: var(--theme); border-bottom: 1px solid color-mix(in oklch, var(--theme) 40%, transparent); }
.contact-card a:hover { border-bottom-color: var(--theme); }

.social-row {
  display: flex; gap: 18px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--divider);
  font-size: 1.3rem;
}
.social-row a {
  color: var(--fg-muted);
  transition: color .15s ease;
}
.social-row a:hover { color: var(--theme); }

/* ---------- footer ---------- */
.footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 0.78rem;
  padding: 30px 0;
  margin-top: 60px;
}
.footer-inner {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.footer a { color: inherit; text-decoration: underline; text-decoration-color: var(--theme); text-underline-offset: 3px; }
.footer-colophon {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: color-mix(in oklch, var(--footer-text) 60%, transparent);
}

/* ---------- density variant ---------- */
.root[data-density="compact"] .section { padding: 36px 0; }
.root[data-density="compact"] .pub-year { padding: 18px 0; }
.root[data-density="compact"] .page { padding: 56px 0 100px; }
.root[data-density="compact"] .prose { font-size: 1rem; line-height: 1.55; }

/* ---------- tweaks panel ---------- */
.tweaks-fab {
  position: fixed; right: 18px; bottom: 18px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--fg); color: var(--bg);
  border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 90;
}
.tweaks-panel {
  position: fixed; right: 18px; bottom: 72px;
  width: 300px;
  background: var(--card-bg);
  border: 1px solid var(--divider-strong);
  border-radius: 6px;
  padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  z-index: 90;
  font-size: 0.88rem;
}
.tweaks-panel h5 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 12px;
  font-weight: 500;
}
.tweaks-panel label {
  display: block;
  font-size: 0.72rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 14px 0 6px;
}
.tweaks-panel .opts {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.tweaks-panel .opts button {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--divider-strong);
  background: transparent;
  color: var(--fg);
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 3px;
  font-family: var(--font-sans);
  transition: all .12s ease;
}
.tweaks-panel .opts button.sel {
  background: var(--theme);
  color: var(--bg);
  border-color: var(--theme);
}
.root.dark .tweaks-panel .opts button.sel { color: #000; }
.tweaks-swatch-row { display: flex; gap: 8px; }
.tweaks-swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--divider);
  cursor: pointer;
  transition: transform .12s;
}
.tweaks-swatch.sel { border-color: var(--fg); transform: scale(1.1); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .masthead .name { font-size: 3rem; }
  .news-list li { grid-template-columns: 1fr; gap: 2px; }
  .news-list .date { padding-top: 0; }
  .pub-year { grid-template-columns: 1fr; gap: 8px; }
  .pub-year .y { position: static; }
  .cv-item { grid-template-columns: 1fr; gap: 2px; }
}
