/* ==========================================================
   Teodor Burghelea — site styles
   Colours are defined once here; dark mode is automatic.
   ========================================================== */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #1f2328;
  --muted: #5d636b;
  --line: #e3e0d8;
  --accent: #23407a;        /* deep ink blue */
  --accent-2: #a3172e;      /* crimson, used sparingly */
  --accent-soft: #e8edf7;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --radius: 10px;
  --maxw: 1080px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1b1f26;
    --surface-2: #222730;
    --text: #e6e6e3;
    --muted: #a3a9b2;
    --line: #2f3540;
    --accent: #8fb0ee;
    --accent-2: #f07a8b;
    --accent-soft: #1f2a40;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--sans);
}
img, video, iframe { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 2.8rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); margin: 2.2em 0 .6em; }
h3 { font-size: 1.25rem; margin: 1.8em 0 .5em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; color: var(--text); text-decoration: none; line-height: 1.2; }
.brand small { display: block; font-family: var(--sans); font-weight: 400; font-size: .78rem; color: var(--muted); letter-spacing: .02em; }
.nav { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: .95rem; font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }

@media (max-width: 820px) {
  .menu-btn { display: block; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; padding: 8px 16px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
}

/* ---------- page heads ---------- */
.page-head { padding: 56px 0 24px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.page-head p { color: var(--muted); max-width: 70ch; font-size: 1.08rem; margin: 0; }
.eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); margin: 0 0 10px; }

main { padding-bottom: 80px; }
.prose { max-width: 74ch; }

/* ---------- home hero ---------- */
.hero { display: grid; grid-template-columns: 1.45fr 1fr; gap: 48px; align-items: center; padding: 56px 0 40px; }
.hero .lead { font-size: 1.15rem; color: var(--text); max-width: 60ch; }
.hero .role { color: var(--muted); font-size: 1.05rem; margin-bottom: 1.2em; }
.portrait { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; aspect-ratio: 4/5; object-fit: cover; object-position: 50% 20%; }
  .portrait-wrap { max-width: 380px; justify-self: end; width: 100%; }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 32px; }
  .hero .portrait-wrap { order: -1; max-width: 300px; justify-self: start; }
}

.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.4em; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px; font-size: .93rem; font-weight: 500;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0f1420; } }
.btn.primary:hover { filter: brightness(1.1); color: #fff; }

/* ---------- cards / grids ---------- */
.grid { display: grid; gap: 20px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
@media (max-width: 400px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 18px; box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; font-size: 1.12rem; }
.card p { color: var(--muted); font-size: .96rem; margin-bottom: .6em; }
a.card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
a.card .more { color: var(--accent); font-size: .9rem; font-weight: 500; }

/* ---------- figures & media ---------- */
figure { margin: 1.6em 0; }
figure img, figure video { border-radius: 8px; border: 1px solid var(--line); background: #fff; width: 100%; height: auto; }
figcaption { font-size: .88rem; color: var(--muted); margin-top: .6em; line-height: 1.5; }
figcaption b { color: var(--text); font-weight: 600; }
.fig-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.video-embed { position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.media-strip { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin-top: 24px; }
.media-strip figure { margin: 0; }
.media-strip video { height: 230px; width: 100%; object-fit: contain; background: #fff; }
@media (max-width: 820px) { .media-strip video { height: 180px; } .media-strip { grid-template-columns: 1fr 1fr; } .media-strip figure:first-child { grid-column: 1 / -1; } }

/* ---------- news ---------- */
.news { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.news li { position: relative; padding: 0 0 22px 24px; }
.news li::before { content: ""; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.news time { display: block; font-size: .82rem; font-weight: 600; color: var(--accent); letter-spacing: .03em; text-transform: uppercase; }
.news p { margin: 2px 0 0; }

/* ---------- two-column home layout ---------- */
.split { display: grid; grid-template-columns: 1.5fr 1fr; gap: 48px; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; gap: 0; } }
.side-box { background: var(--surface-2); border-radius: var(--radius); padding: 22px 24px; font-size: .96rem; }
.side-box h3 { margin-top: 0; }
.side-box + .side-box { margin-top: 20px; }

/* ---------- research sections ---------- */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; padding: 0; list-style: none; }
.toc a { display: block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-size: .9rem; color: var(--text); }
.toc a:hover { border-color: var(--accent); color: var(--accent); }
.topic { scroll-margin-top: 80px; padding-top: 8px; }
.topic + .topic { border-top: 1px solid var(--line); margin-top: 48px; }
.meta { font-size: .92rem; color: var(--muted); margin: -.3em 0 1em; }
.meta b { color: var(--text); font-weight: 600; }
.key-papers { font-size: .93rem; background: var(--surface-2); border-radius: 8px; padding: 14px 18px; margin: 1.2em 0; }
.key-papers b { display: block; margin-bottom: 4px; }
.key-papers ul { margin: 0; padding-left: 1.1em; }

/* feature: a large animation with text beside it */
.feature { display: grid; grid-template-columns: minmax(0, 560px) 1fr; gap: 40px; align-items: center; margin: 2.4em 0 1em; }
.feature figure { margin: 0; }
.feature h3 { margin-top: 0; }
@media (max-width: 820px) { .feature { grid-template-columns: 1fr; gap: 16px; } }

/* ---------- publications ---------- */
.pub-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 24px 0 8px; }
.pub-tools input {
  flex: 1 1 260px; padding: 10px 14px; font: inherit; font-size: .95rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
}
.pub-tools input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.pub-count { color: var(--muted); font-size: .9rem; }
.pub-year { font-family: var(--serif); font-size: 1.3rem; margin: 1.8em 0 .4em; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.pubs { list-style: none; padding: 0; margin: 0; }
.pubs li { display: grid; grid-template-columns: 2.6em 1fr; gap: 6px; padding: 10px 0; }
.pubs .n { color: var(--muted); font-size: .85rem; padding-top: 3px; font-variant-numeric: tabular-nums; }
.pubs .t { font-weight: 600; }
.pubs .a { color: var(--muted); font-size: .94rem; }
.pubs .a .me { color: var(--text); font-weight: 600; }
.pubs .j { font-size: .94rem; }
.pubs .j i { font-style: italic; }
.pubs .l { font-size: .85rem; margin-top: 2px; }
.pubs .l a { margin-right: 12px; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: 2px; }
.book { display: grid; grid-template-columns: 1fr; gap: 6px; }

/* ---------- team ---------- */
.people { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 32px; }
.people li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.people b { font-weight: 600; }
.people span { display: block; color: var(--muted); font-size: .92rem; }

/* ---------- teaching ---------- */
.course { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; margin: 24px 0; box-shadow: var(--shadow); }
.course h2 { margin-top: 0; font-size: 1.4rem; }
.course .level { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-2); }
.course h3 { font-size: 1.05rem; font-family: var(--sans); font-weight: 600; margin: 1.4em 0 .4em; }
.notes { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 40px; margin-top: 32px; }
@media (max-width: 820px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-grid dl { margin: 0; }
.contact-grid dt { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 20px; }
.contact-grid dd { margin: 4px 0 0; }
.map { width: 100%; aspect-ratio: 4/3; border: 1px solid var(--line); border-radius: var(--radius); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 40px; color: var(--muted); font-size: .88rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-footer a { color: var(--muted); }
