/* =============================================================
   Vladimir Popa — personal site
   Single shared stylesheet. Edit the tokens in :root to reskin.
   ============================================================= */

/* ---- Design tokens ---------------------------------------- */
:root {
  /* palette */
  --paper:   #f2f1ec;   /* page background (cool warm-grey, not cream) */
  --panel:   #fbfaf7;   /* raised surfaces / cards                    */
  --ink:     #17181f;   /* primary text                              */
  --muted:   #64646f;   /* secondary text                            */
  --line:    #d8d6cd;   /* hairlines & borders                       */
  --accent:  #2743e0;   /* cobalt — links, marks, active state       */
  --accent-soft: #e6e9fb;

  /* type */
  --sans:  "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* scale & rhythm */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.92rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
  --step-1:  clamp(1.25rem, 1.16rem + 0.45vw, 1.6rem);
  --step-2:  clamp(1.6rem, 1.4rem + 1vw, 2.4rem);
  --step-3:  clamp(2.1rem, 1.7rem + 2vw, 3.6rem);
  --measure: 68ch;
  --gutter:  clamp(1.25rem, 5vw, 4rem);
  --radius:  3px;
}

/* ---- Reset-ish -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 6rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.65;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4, .brand, nav, .tag, button, .btn { font-family: var(--sans); }
h1, h2, h3, h4 { line-height: 1.12; font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

/* ---- Skip link ------------------------------------------- */
.skip {
  position: absolute; left: 0; top: -3rem;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; z-index: 100; border-radius: 0 0 var(--radius) 0;
  transition: top 0.15s ease;
}
.skip:focus { top: 0; }

/* ---- Layout container ------------------------------------- */
.wrap { width: min(72rem, 100%); margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: var(--measure); }

/* =============================================================
   Header + navigation (native <details> disclosure, zero JS)
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: 0.85rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-weight: 700; font-size: var(--step-0); letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--accent); }
.brand .mark { flex: none; }

.menu { position: relative; }
.menu-btn {
  list-style: none; cursor: pointer;
  font-size: var(--step--1); font-weight: 500;
  padding: 0.5rem 0.8rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel);
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.menu-btn::-webkit-details-marker { display: none; }
.menu-btn::after { content: "+"; font-family: var(--mono); }
.menu[open] .menu-btn::after { content: "\00d7"; }

.nav { display: flex; gap: 0.25rem; }
.nav a {
  color: var(--muted); text-decoration: none;
  font-size: var(--step--1); font-weight: 500;
  padding: 0.4rem 0.7rem; border-radius: var(--radius);
  white-space: nowrap; transition: color 0.15s ease, background 0.15s ease;
}
.nav a:hover { color: var(--ink); background: var(--panel); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* menu is a disclosure dropdown at every viewport width */
.menu .nav {
  display: none; position: absolute; right: 0; top: calc(100% + 0.5rem);
  flex-direction: column; min-width: 12rem;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.4rem;
  box-shadow: 0 12px 28px -18px rgba(20,20,30,0.5);
}
.menu[open] .nav { display: flex; }

/* =============================================================
   Hero (home page)
   ============================================================= */
.hero { padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 5vw, 4rem); position: relative; overflow: hidden; }
.hero-grid {
  display: grid; gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 780px) { .hero-grid { grid-template-columns: 1.4fr 1fr; } }
.hero .eyebrow { font-family: var(--sans); color: var(--accent); font-weight: 500; font-size: var(--step--1); margin: 0 0 0.75rem; }
.hero h1 { font-size: var(--step-3); margin: 0 0 1rem; max-width: 16ch; }
.hero p.lead { font-size: var(--step-1); color: var(--ink); margin: 0 0 1.6rem; max-width: 46ch; line-height: 1.4; }
.hero-figure { justify-self: center; }

/* subtle node-and-edge motif (graph theory nod) */
.graph { width: min(100%, 320px); height: auto; color: var(--accent); }
.graph .edge { stroke: currentColor; stroke-width: 1; opacity: 0.35; }
.graph .node { fill: var(--panel); stroke: currentColor; stroke-width: 1.5; }
.graph .node.filled { fill: currentColor; }

/* =============================================================
   Page header (interior pages)
   ============================================================= */
.page-head { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1rem, 3vw, 2rem); border-bottom: 1px solid var(--line); }
.page-head .kicker { font-family: var(--sans); font-weight: 500; color: var(--accent); font-size: var(--step--1); margin: 0 0 0.6rem; }
.page-head h1 { font-size: var(--step-2); margin: 0 0 0.8rem; }
.page-head p { color: var(--muted); max-width: var(--measure); margin: 0; }

/* in-page section nav */
.on-this-page {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem;
}
.on-this-page a {
  font-family: var(--sans); font-size: var(--step--1); font-weight: 500;
  text-decoration: none; color: var(--muted);
  padding: 0.35rem 0.75rem; border: 1px solid var(--line);
  border-radius: 999px; background: var(--panel);
  transition: color 0.15s, border-color 0.15s;
}
.on-this-page a:hover { color: var(--accent); border-color: var(--accent); }

/* =============================================================
   Generic content sections
   ============================================================= */
main { display: block; }
.section { padding-block: clamp(2.5rem, 6vw, 4rem); border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: 0; }
.section > .wrap > h2 { font-size: var(--step-2); margin: 0 0 0.4rem; }
.section .sub { color: var(--muted); margin: 0 0 2rem; max-width: var(--measure); }
.prose p { max-width: var(--measure); }
.prose h3 { font-size: var(--step-1); margin: 2rem 0 0.6rem; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: var(--step--1); font-weight: 500; text-decoration: none;
  padding: 0.6rem 1.1rem; border-radius: var(--radius);
  border: 1px solid var(--ink); color: var(--ink); background: transparent;
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1c34c0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* =============================================================
   Entry list (projects, publications, catalogue rows)
   ============================================================= */
.entries { list-style: none; margin: 0; padding: 0; }
.entry {
  display: grid; gap: 0.5rem 1.5rem; padding-block: 1.6rem;
  border-top: 1px solid var(--line);
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .entry { grid-template-columns: minmax(0,1fr) auto; align-items: start; } }
.entry:last-child { border-bottom: 1px solid var(--line); }
.entry h3, .entry h4 { font-size: var(--step-1); margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.entry h3 a, .entry h4 a { color: var(--ink); text-decoration: none; }
.entry h3 a:hover, .entry h4 a:hover { color: var(--accent); }
.entry .desc { color: var(--muted); margin: 0.35rem 0 0; max-width: 60ch; }
.entry .meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

/* tech / language tags */
.tag {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.02em;
  color: var(--muted); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.18rem 0.5rem; white-space: nowrap;
}
.tag.lang { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

.entry-links { display: flex; gap: 1rem; margin-top: 0.6rem; }
.entry-links a { font-family: var(--sans); font-size: var(--step--1); }

/* subsection group label */
.group-label {
  font-family: var(--sans); font-weight: 600; font-size: var(--step-0);
  color: var(--ink); margin: 2.5rem 0 0.5rem;
  padding-bottom: 0.4rem; border-bottom: 2px solid var(--ink);
  display: inline-block;
}

/* =============================================================
   Media / gallery grids (art, animation, music embeds)
   ============================================================= */
.gallery {
  display: grid; gap: 1rem; margin: 1.5rem 0 0;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.frame {
  border: 1px solid var(--line); background: var(--panel);
  border-radius: var(--radius); overflow: hidden;
}
.frame .placeholder {
  aspect-ratio: 4 / 3; display: grid; place-items: center;
  color: var(--muted); font-family: var(--mono); font-size: var(--step--1);
  background: repeating-linear-gradient(45deg, transparent 0 12px, color-mix(in srgb, var(--line) 45%, transparent) 12px 13px);
}
.frame figcaption { padding: 0.7rem 0.9rem; font-size: var(--step--1); color: var(--muted); }

.embed { position: relative; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-family: var(--mono); font-size: var(--step--1); text-align: center; padding: 1rem; }

/* two-column info split (e.g. studies facts) */
.split { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 760px) { .split { grid-template-columns: 2fr 1fr; } }
.factsheet { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 1.25rem 1.4rem; }
.factsheet dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; }
.factsheet dt { font-family: var(--sans); font-size: var(--step--1); color: var(--muted); }
.factsheet dd { margin: 0; }

/* =============================================================
   Socials
   ============================================================= */
.social-grid {
  display: grid; gap: 0.75rem; margin: 1.5rem 0 0;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.social-card {
  display: flex; align-items: center; gap: 0.9rem; text-decoration: none;
  border: 1px solid var(--line); background: var(--panel);
  border-radius: var(--radius); padding: 0.9rem 1.1rem; color: var(--ink);
  transition: border-color 0.15s, transform 0.15s;
}
.social-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.social-card .name { font-family: var(--sans); font-weight: 600; font-size: var(--step-0); }
.social-card .handle { color: var(--muted); font-size: var(--step--1); }
.social-card .ic { flex: none; color: var(--accent); }

/* =============================================================
   Footer
   ============================================================= */
.site-footer { padding-block: 2.5rem 3rem; border-top: 1px solid var(--line); background: var(--panel); margin-top: 2rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; align-items: center; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.footer-links a { font-family: var(--sans); font-size: var(--step--1); color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-note { color: var(--muted); font-size: var(--step--1); font-family: var(--sans); }

/* =============================================================
   A11y: focus, reduced motion
   ============================================================= */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
