/* =====================================================================
   Mario A. Ciampini — personal site
   Colour tokens first: change --laser to re-theme the whole site.
   ===================================================================== */

:root {
  --laser: #1d3bff;          /* deep laser blue: main accent */
  --laser-soft: #4f6bff;
  --laser-glow: rgba(46, 84, 255, 0.55);
  --night: #060b26;          /* hero / header background */
  --night-2: #0d1640;
  --on-night: #eef1ff;
  --on-night-muted: #aab4e8;

  --bg: #fbfbfe;
  --surface: #ffffff;
  --band: #f1f3fc;
  --text: #12162e;
  --muted: #555c7a;
  --line: #e2e5f3;
  --link: #1d3bff;

  --radius: 14px;
  --wrap: 1100px;
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070a1c;
    --surface: #0e1330;
    --band: #0b1028;
    --text: #e7eaff;
    --muted: #9aa3cc;
    --line: #1f2752;
    --link: #8ea2ff;
    --laser-soft: #8ea2ff;
  }
}
:root[data-theme="dark"] {
  --bg: #070a1c; --surface: #0e1330; --band: #0b1028; --text: #e7eaff;
  --muted: #9aa3cc; --line: #1f2752; --link: #8ea2ff; --laser-soft: #8ea2ff;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; letter-spacing: -0.01em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 32px; } }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--surface); padding: 8px 12px; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(6, 11, 38, 0.88);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--on-night); text-decoration: none; }
.brand-mark {
  font: 700 13px/1 var(--font-head); letter-spacing: .08em;
  padding: 8px 7px; border-radius: 8px; color: #fff;
  background: linear-gradient(135deg, var(--laser), #6b3bff);
  box-shadow: 0 0 18px var(--laser-glow);
}
.brand-name { font: 600 17px var(--font-head); }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  color: var(--on-night-muted); text-decoration: none; font-weight: 500; font-size: 15px;
  padding: 8px 12px; border-radius: 8px;
}
.site-nav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.site-nav a.active { color: #fff; background: rgba(46, 84, 255, 0.28); }
.nav-toggle, .nav-burger { display: none; }

@media (max-width: 760px) {
  .nav-burger { display: block; width: 40px; height: 40px; cursor: pointer; position: relative; }
  .nav-burger span, .nav-burger span::before, .nav-burger span::after {
    position: absolute; left: 9px; width: 22px; height: 2px; background: var(--on-night); content: ""; transition: .2s;
  }
  .nav-burger span { top: 19px; }
  .nav-burger span::before { left: 0; top: -7px; }
  .nav-burger span::after { left: 0; top: 7px; }
  .site-nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column;
    background: var(--night); padding: 8px 16px 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .site-nav a { padding: 12px; font-size: 17px; }
  .nav-toggle:checked ~ .site-nav { display: flex; }
  .nav-toggle:checked + .nav-burger span { background: transparent; }
  .nav-toggle:checked + .nav-burger span::before { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked + .nav-burger span::after { transform: translateY(-7px) rotate(-45deg); }
  .brand-name { display: none; }
}

/* ---------- hero (home) ---------- */
.hero, .page-hero {
  position: relative; overflow: hidden; color: var(--on-night);
  background:
    radial-gradient(900px 500px at 85% 40%, rgba(46, 84, 255, 0.35), transparent 60%),
    radial-gradient(600px 400px at 0% 100%, rgba(107, 59, 255, 0.25), transparent 60%),
    linear-gradient(180deg, var(--night), var(--night-2));
}
.hero { padding: 72px 0 88px; }
@media (min-width: 900px) { .hero { padding: 110px 0 120px; } }

/* interference fringes, a nod to matter-wave interference */
.fringes {
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-radial-gradient(circle at 82% 45%, rgba(120,145,255,.16) 0 1px, transparent 1px 22px);
  -webkit-mask-image: radial-gradient(520px 420px at 82% 45%, #000 20%, transparent 75%);
          mask-image: radial-gradient(520px 420px at 82% 45%, #000 20%, transparent 75%);
}
/* the laser beam */
.beam {
  position: absolute; left: -10%; right: -10%; top: 62%; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(80,110,255,.0) 10%, rgba(120,150,255,.95) 55%, rgba(80,110,255,.0) 95%);
  box-shadow: 0 0 18px 2px var(--laser-glow), 0 0 60px 6px rgba(46,84,255,.25);
  transform: rotate(-4deg); opacity: .8;
  animation: beam 9s ease-in-out infinite alternate;
}
.hero .beam { top: auto; bottom: 34px; }
.page-hero .beam { top: 78%; transform: rotate(-2deg); opacity: .6; }
@keyframes beam { from { translate: -6% 0; } to { translate: 6% 0; } }
@media (prefers-reduced-motion: reduce) { .beam { animation: none; } html { scroll-behavior: auto; } }

.hero-inner { position: relative; display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .hero-inner { grid-template-columns: 1.5fr 1fr; } }
.kicker {
  margin: 0 0 14px; font: 600 13px/1.4 var(--font-head); text-transform: uppercase; letter-spacing: .14em;
  color: #9fb1ff;
}
.hero h1 { font-size: clamp(44px, 8vw, 84px); margin: 0 0 22px; font-weight: 700; letter-spacing: -0.03em; }
.glow {
  background: linear-gradient(90deg, #ffffff, #9fb1ff 45%, #5d79ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(46, 84, 255, 0.35);
}
.lead { font-size: clamp(18px, 2.2vw, 21px); line-height: 1.55; color: var(--on-night-muted); max-width: 40em; margin: 0; }
.lead strong { color: #fff; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
  display: inline-block; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 15px;
  text-decoration: none; transition: transform .15s, box-shadow .15s, background .15s;
}
.btn-primary { background: var(--laser); color: #fff; box-shadow: 0 6px 24px var(--laser-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 32px var(--laser-glow); }
.btn-ghost { color: var(--on-night); border: 1px solid rgba(255,255,255,.22); }
.btn-ghost:hover { background: rgba(255,255,255,.08); }

.hero-photo { margin: 0; justify-self: center; position: relative; order: -1; }
@media (min-width: 900px) { .hero-photo { order: 0; } }
.hero-photo img {
  display: block; width: 210px; height: 210px; object-fit: cover; object-position: 50% 20%;
  border-radius: 50%; border: 3px solid rgba(255,255,255,.9);
  box-shadow: 0 0 0 10px rgba(46,84,255,.18), 0 0 70px 10px var(--laser-glow);
}
@media (min-width: 900px) { .hero-photo img { width: 260px; height: 260px; } }

/* ---------- inner page hero ---------- */
.page-hero { padding: 56px 0 60px; }
.page-hero h1 { font-size: clamp(36px, 6vw, 56px); margin: 0; letter-spacing: -0.02em; }
.page-hero .lead { margin-top: 14px; }
.page-hero .wrap { position: relative; }

/* ---------- sections ---------- */
.section { padding: 64px 16px; }
@media (min-width: 700px) { .section { padding: 80px 32px; } }
.band { background: var(--band); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-title { font-size: clamp(26px, 3.5vw, 34px); margin: 0 0 28px; }
.section-title::after {
  content: ""; display: block; width: 48px; height: 3px; margin-top: 12px; border-radius: 3px;
  background: var(--laser); box-shadow: 0 0 12px var(--laser-glow);
}

.about { display: grid; gap: 40px; }
@media (min-width: 900px) { .about { grid-template-columns: 1.6fr 1fr; gap: 64px; } }
.facts {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; align-self: start;
}
.facts dl { margin: 0 0 20px; }
.facts dt { font: 600 12px var(--font-head); text-transform: uppercase; letter-spacing: .12em; color: var(--laser-soft); }
.facts dd { margin: 2px 0 14px; font-size: 15px; }

.cards { display: grid; gap: 18px; }
@media (min-width: 700px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cards { grid-template-columns: repeat(4, 1fr); } }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { border-color: var(--laser); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(29,59,255,.12); }
.card-num { font: 700 14px var(--font-head); color: var(--laser-soft); }
.card h3 { margin: 8px 0 8px; font-size: 19px; }
.card p { margin: 0; font-size: 15px; color: var(--muted); }

/* ---------- social ---------- */
.social { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.social a {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 14px; font-weight: 500; color: var(--text); text-decoration: none;
}
.social a:hover { border-color: var(--laser); color: var(--laser-soft); }

/* ---------- prose (Markdown pages) ---------- */
.prose { padding-top: 48px; padding-bottom: 72px; }
.about .prose { padding: 0; }
.prose > * { max-width: 760px; }
.prose h2 { font-size: 28px; margin: 56px 0 16px; }
.prose h2::after {
  content: ""; display: block; width: 40px; height: 3px; margin-top: 10px; border-radius: 3px;
  background: var(--laser); box-shadow: 0 0 10px var(--laser-glow);
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 20px; margin: 32px 0 8px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--laser-soft); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0; }
.prose blockquote {
  margin: 24px 0; padding: 16px 20px; border-left: 3px solid var(--laser);
  background: var(--band); border-radius: 0 var(--radius) var(--radius) 0; color: var(--muted);
}
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font: 600 13px var(--font-head); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }


/* research topics */
.topic { padding: 8px 0 8px; }
.topic + .topic { border-top: 1px solid var(--line); padding-top: 40px; margin-top: 40px; }
.topic-tag {
  display: inline-block; font: 600 12px var(--font-head); text-transform: uppercase; letter-spacing: .12em;
  color: var(--laser-soft); margin-bottom: 6px;
}
.topic h2 { margin-top: 0 !important; }

/* ---------- publications ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 40px; padding: 0; list-style: none; }
.chips a {
  display: inline-block; padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: var(--band); border: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.chips a:hover { border-color: var(--laser); color: var(--laser-soft); }
.pubs { list-style: none; padding: 0 !important; margin: 0; max-width: 860px !important; }
.pub { display: grid; grid-template-columns: 1fr; gap: 4px 20px; padding: 18px 0; border-bottom: 1px solid var(--line); margin: 0 !important; }
@media (min-width: 640px) { .pub { grid-template-columns: 56px 1fr; } }
.pub-year { font: 700 15px var(--font-head); color: var(--laser-soft); padding-top: 2px; }
.pub-title { font: 600 17px/1.4 var(--font-head); color: var(--text); text-decoration: none; }
.pub-title:hover { color: var(--laser-soft); text-decoration: underline; }
.pub-body p { margin: 4px 0 0; }
.pub-authors { font-size: 15px; color: var(--muted); }
.pub-authors .me { color: var(--text); }
.pub-venue { font-size: 15px; }
.pub-links { display: flex; gap: 8px; }
.pub-links a {
  font: 600 12px var(--font-head); letter-spacing: .06em; text-decoration: none;
  padding: 3px 9px; border-radius: 6px; border: 1px solid var(--line); color: var(--laser-soft);
}
.pub-links a:hover { border-color: var(--laser); }
.badge {
  display: inline-block; font: 600 12px var(--font-head); padding: 2px 8px; border-radius: 6px;
  background: rgba(29,59,255,.1); color: var(--laser-soft); margin-left: 4px;
}
.more { font-weight: 600; text-decoration: none; }
.pub-topic { scroll-margin-top: 80px; }
.pub-topic p.blurb { color: var(--muted); margin-top: -4px; }

/* placeholders */
.placeholder {
  border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center;
  color: var(--muted); background: var(--band);
}
.project-grid { display: grid; gap: 18px; max-width: none !important; }
@media (min-width: 700px) { .project-grid { grid-template-columns: repeat(2, 1fr); } }
.project-grid .card h3 { margin-top: 0; }
.project-meta { font-size: 13px; color: var(--muted); margin-top: 10px !important; }

/* ---------- footer ---------- */
.site-footer { background: var(--night); color: var(--on-night-muted); padding: 48px 0 24px; font-size: 15px; }
.site-footer a { color: var(--on-night); }
.footer-inner { display: grid; gap: 24px; }
@media (min-width: 760px) { .footer-inner { grid-template-columns: 1fr auto; align-items: start; } }
.footer-name { font: 600 18px var(--font-head); color: #fff; margin: 0 0 6px; }
.footer-inner p { margin: 0; }
.site-footer .social a { border-color: rgba(255,255,255,.15); color: var(--on-night); }
.site-footer .social a:hover { border-color: var(--laser-soft); color: #fff; }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  margin-top: 36px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px;
}

/* first column of CV/teaching tables = dates */
.prose td:first-child { white-space: nowrap; font: 600 14px/1.65 var(--font-head); color: var(--laser-soft); padding-right: 24px; }
.prose td:first-child strong { color: inherit; }
.prose .btn-primary { color: #fff; }
