/* ==========================================================
   David Combei — personal site
   ========================================================== */

:root {
  --bg: #fbfbfd;
  --bg-tint: #f3f4f8;
  --surface: #ffffff;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --accent-2: #0891b2;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 2px 4px rgba(15, 23, 42, 0.05), 0 18px 40px rgba(15, 23, 42, 0.10);
  --radius: 16px;
  --logo-bg: #ffffff;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020;
    --bg-tint: #0f1529;
    --surface: #131a31;
    --text: #e8ecf5;
    --text-2: #b4bdd0;
    --text-3: #8b95ab;
    --line: #232c47;
    --accent: #8b8cf8;
    --accent-2: #38bdf8;
    --accent-soft: rgba(139, 140, 248, 0.12);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 40px rgba(0, 0, 0, 0.35);
    --logo-bg: #f1f5f9;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

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;
}

img { max-width: 100%; display: block; }

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

h1, h2, h3 { margin: 0; line-height: 1.2; color: var(--text); }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; }

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
}
.nav__brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
  white-space: nowrap;
}
.nav__brand:hover { text-decoration: none; }
.nav__links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__links a {
  display: block;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.nav__links a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 72px 0 0;
  overflow: hidden;
  isolation: isolate;
}
.hero__glow {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 520px;
  z-index: -1;
  background:
    radial-gradient(40% 60% at 20% 30%, rgba(79, 70, 229, 0.16), transparent 70%),
    radial-gradient(35% 55% at 80% 20%, rgba(8, 145, 178, 0.14), transparent 70%);
  filter: blur(10px);
}
.hero__grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 56px;
  align-items: center;
}
.hero__photo {
  position: relative;
}
.hero__photo::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  opacity: 0.85;
  transform: rotate(-3deg);
  z-index: -1;
}
.hero__photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 20%;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  background: var(--surface);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(79, 70, 229, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4rem);
  margin: 16px 0 12px;
}
.hero__lead {
  font-size: 1.18rem;
  color: var(--text-2);
  max-width: 40ch;
  margin: 0 0 24px;
}
.hero__lead strong { color: var(--text); font-weight: 600; }

.affil {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  max-width: 560px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.affil:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.affil__logo {
  width: 120px;
  height: 64px;
  object-fit: contain;
  padding: 4px 6px;
  border-radius: 10px;
  background: var(--logo-bg);
  flex: none;
}
.affil__name { display: block; font-weight: 600; line-height: 1.35; }
.affil__sub { display: block; font-size: 0.88rem; color: var(--text-3); }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color 0.2s, transform 0.2s, color 0.2s;
}
.pill img { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; }
.pill svg { width: 20px; height: 20px; }
.pill:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.pill--accent { background: var(--accent); border-color: var(--accent); color: #fff; padding-left: 12px; }
.pill--accent:hover { color: #fff; filter: brightness(1.08); }

/* Waveform */
.wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 90px;
  margin-top: 56px;
  padding-inline: 16px;
  opacity: 0.55;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
}
.wave span {
  flex: 1;
  min-width: 2px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  transform-origin: center;
  animation: bar 1.6s ease-in-out infinite alternate;
}
@keyframes bar {
  from { transform: scaleY(0.45); }
  to { transform: scaleY(1); }
}

/* ---------- Sections ---------- */
.section { padding: 88px 0; }
.section--tint { background: var(--bg-tint); border-block: 1px solid var(--line); }
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.section h2 { font-size: clamp(1.8rem, 3.6vw, 2.4rem); margin-bottom: 36px; }

/* About */
.about {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 48px;
  align-items: start;
}
.about__text p { margin: 0 0 18px; color: var(--text-2); }
.about__text strong { color: var(--text); }
.interests {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.interests h3 { font-size: 1rem; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chips li {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.4;
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.card:hover { text-decoration: none; transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.card__logo {
  height: 140px;
  display: grid;
  place-items: center;
  padding: 22px;
  background: var(--logo-bg);
  border-bottom: 1px solid var(--line);
}
.card__logo img { max-height: 96px; max-width: 85%; object-fit: contain; }
.card__logo img[src$=".svg"] { width: 85%; max-height: 110px; }
.card__body { padding: 18px 20px 22px; }
.card__body h3 { font-size: 1.05rem; margin-bottom: 6px; }
.card__body p { margin: 0; font-size: 0.9rem; color: var(--text-3); line-height: 1.5; }

/* Publications */
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.pub {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 20px;
  align-items: start;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pub:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.pub__year {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.4;
}
.pub__title { font-size: 1.08rem; font-weight: 600; line-height: 1.4; margin-bottom: 6px; }
.pub__authors { margin: 0; color: var(--text-2); font-size: 0.94rem; line-height: 1.5; }
.pub__authors .me { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.pub__venue { margin: 4px 0 0; color: var(--text-3); font-size: 0.9rem; font-style: italic; line-height: 1.5; }
.pub__pdf {
  align-self: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.2s, color 0.2s;
}
.pub__pdf:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* Timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 28px;
  border-left: 2px solid var(--line);
  display: grid;
  gap: 32px;
}
.timeline li { position: relative; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -36px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-tint);
  border: 3px solid var(--accent);
}
.timeline__date {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.timeline h3 { font-size: 1.1rem; margin: 2px 0 6px; }
.timeline p { margin: 0; color: var(--text-2); max-width: 70ch; }

/* Footer */
.footer { padding: 56px 0 40px; }
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.footer__title { margin: 0 0 4px; font-family: var(--serif); font-size: 1.6rem; font-weight: 600; }
.footer__mail { font-size: 1.1rem; font-weight: 600; word-break: break-all; }
.footer__affil { margin: 6px 0 0; color: var(--text-3); font-size: 0.9rem; }
.footer__copy { margin: 0; color: var(--text-3); font-size: 0.85rem; }

/* Reveal animation (only when JS is available) */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wave span, .badge__dot { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { padding-top: 48px; }
  .hero__grid { grid-template-columns: 1fr; gap: 36px; }
  .hero__photo { width: min(240px, 70%); margin-inline: auto; }
  .hero__text { text-align: center; }
  .hero__lead { margin-inline: auto; }
  .affil { margin-inline: auto; text-align: left; }
  .links { justify-content: center; }
  .about { grid-template-columns: 1fr; gap: 28px; }
  .wave { height: 64px; margin-top: 40px; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav__brand { display: none; }
  .nav__inner { justify-content: center; }
  .nav__links { gap: 0; overflow-x: auto; scrollbar-width: none; }
  .nav__links a { padding: 6px 9px; font-size: 0.85rem; }
  .section { padding: 64px 0; }
  .pub { grid-template-columns: 1fr; gap: 8px; padding: 18px; }
  .pub__pdf { justify-self: start; }
  .affil__logo { width: 92px; height: 52px; }
}
