/* Viktor Gradoux — personal academic website
   Plain HTML/CSS, no build step. Colours are tokens on :root; dark theme below. */

/* Self-hosted fonts (SIL Open Font License): Newsreader and Instrument Sans. */
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../fonts/newsreader-latin-standard-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url("../fonts/newsreader-latin-standard-italic.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/instrument-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/instrument-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/instrument-sans-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #fbfcfc;
  --surface: #ffffff;
  --ink: #15232b;
  --muted: #5b6b73;
  --rule: #dce3e6;
  --accent: #0f6e7a;
  --accent-ink: #0b5560;
  --accent-soft: #e4f1f2;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --measure: 860px;
  --gutter: 24px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a1f;
    --surface: #15232b;
    --ink: #e6edef;
    --muted: #9db0b7;
    --rule: #2a3b43;
    --accent: #5bc0c9;
    --accent-ink: #8bd6dc;
    --accent-soft: #17343a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1a1f;
  --surface: #15232b;
  --ink: #e6edef;
  --muted: #9db0b7;
  --rule: #2a3b43;
  --accent: #5bc0c9;
  --accent-ink: #8bd6dc;
  --accent-soft: #17343a;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
.ico { width: 1em; height: 1em; flex: none; fill: currentColor; }
.icon-btn .ico { width: 1.05em; height: 1.05em; }

a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; color: var(--accent-ink); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}
.site-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.site-name:hover { text-decoration: none; color: var(--accent); }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 6px 10px;
  border-radius: 6px;
}
.nav a:hover { color: var(--ink); text-decoration: none; background: var(--accent-soft); }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font-size: 1rem;
}
.icon-btn:hover { color: var(--ink); background: var(--accent-soft); }
.menu-btn { display: none; }

@media (max-width: 640px) {
  .menu-btn { display: inline-grid; }
  .nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    padding: 8px var(--gutter) 14px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 4px; }
  .nav .icon-btn { align-self: flex-start; }
}

/* ---------- Page ---------- */
main { padding: 56px 0 72px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
}
.page-title {
  font-size: clamp(2.2rem, 5vw, 3rem);
  margin-bottom: 8px;
}
.page-lede {
  color: var(--muted);
  margin: 0 0 40px;
  max-width: 62ch;
}

h2.section {
  font-size: 1.55rem;
  margin: 56px 0 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
h2.section:first-of-type { margin-top: 0; }

p { margin: 0 0 1em; }

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  grid-template-areas: "head photo" "text photo";
  column-gap: 48px;
  align-items: start;
}
.about-head { grid-area: head; }
.about-text { grid-area: text; }
.portrait { grid-area: photo; grid-row: 1 / span 2; padding-top: 8px; }
.about-name {
  font-size: clamp(2.6rem, 7vw, 3.6rem);
  line-height: 1.05;
  margin-bottom: 12px;
}
.about-role {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 32px;
}
.bio p { max-width: 64ch; }

.portrait figure { margin: 0; }
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 20%;
  border-radius: 4px;
  background: var(--rule);
}
.portrait figcaption {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}
.links a { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.links a:hover { color: var(--accent); }
.links .ico { color: var(--accent); }

@media (max-width: 720px) {
  .about { grid-template-columns: 1fr; grid-template-areas: "head" "photo" "text"; }
  .portrait { grid-row: auto; max-width: 180px; padding-top: 0; margin-bottom: 28px; }
  .about-role { margin-bottom: 24px; }
}

/* Featured paper on the About page */
.featured {
  margin-top: 56px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
.featured img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 200px;
}
.featured-body { padding: 24px 28px; }
.featured-kicker { font-size: 0.9rem; color: var(--accent); margin: 0 0 6px; font-weight: 600; }
.featured h2 { font-size: 1.6rem; margin-bottom: 4px; }
.featured .subtitle { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 1.1rem; margin: 0 0 12px; }
.featured p { font-size: 0.97rem; }

@media (max-width: 720px) {
  .featured { grid-template-columns: 1fr; }
  .featured img { max-height: 220px; }
}

/* ---------- Publication list ---------- */
.pubs { list-style: none; margin: 0; padding: 0; }
.pub {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
}
.pub:last-child { border-bottom: 0; }
.pub.no-thumb { grid-template-columns: 1fr; }

.pub-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--rule);
  background: var(--surface);
}
.pub-title {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.25;
  margin: 0 0 4px;
}
.pub-title .sub { display: block; font-style: italic; font-size: 1.05rem; color: var(--muted); margin-top: 2px; }
.pub-authors { margin: 0 0 2px; font-size: 0.97rem; }
.pub-authors .me { font-weight: 600; }
.pub-meta { margin: 0 0 12px; font-size: 0.9rem; color: var(--muted); }

.pub-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  appearance: none;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  padding: 7px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--accent); color: var(--bg); text-decoration: none; }
.btn[aria-expanded="true"] { background: var(--accent); color: var(--bg); }

.pub-panel {
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--accent-soft);
  border-radius: 6px;
  font-size: 0.95rem;
}
.pub-panel p:last-child { margin-bottom: 0; }
.pub-panel pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.talks-head { font-weight: 600; margin: 0 0 6px; }
.talks { list-style: none; margin: 0; padding: 0; }
.talks li { display: grid; grid-template-columns: 3.2em 1fr; gap: 8px; }
.talk-year { color: var(--muted); font-variant-numeric: tabular-nums; }
.pub-panel .kw { color: var(--muted); font-size: 0.9rem; }

@media (max-width: 640px) {
  .pub { grid-template-columns: 1fr; gap: 14px; }
  .pub-thumb { max-width: 260px; }
}

/* ---------- CV ---------- */
.cv-frame {
  width: 100%;
  height: 80vh;
  min-height: 520px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 28px 0 40px;
  font-size: 0.85rem;
  color: var(--muted);
}
.site-footer p { margin: 0 0 6px; max-width: 70ch; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
