/* ==========================================================================
   Pierre Mariotto — Personal academic website
   Dark theme (v2) — muted dusk palette: soft lavender / lilac / dusty teal
   ========================================================================== */

:root {
  --bg: #141219;
  --bg-soft: #1b1823;
  --card: #262234;
  --card-glass: rgba(38, 34, 52, 0.7);
  --ink: #e8e5ef;
  --ink-soft: #bab6c9;
  --muted: #8d899c;
  --line: rgba(163, 150, 200, 0.14);
  --violet: #8f7fc0;
  --magenta: #c9a4d5;
  --cyan: #77afad;
  --accent: #a396c8;
  --accent-strong: #7f6fae;
  --accent-soft: rgba(163, 150, 200, 0.14);
  --gold: #c6a261;
  --radius: 16px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  --glow-violet: rgba(143, 127, 192, 0.35);
  --glow-cyan: rgba(119, 175, 173, 0.3);
  --glow-magenta: rgba(201, 164, 213, 0.3);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(163, 150, 200, 0.4); color: #fff; }

h1, h2, h3, .nav-brand { font-family: "Space Grotesk", "Inter", sans-serif; }

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

/* ---------- Scroll reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(min(var(--d, 0), 5) * 70ms);
  will-change: opacity, transform;
}
[data-reveal].visible { opacity: 1; transform: none; }

/* ---------- Top navigation ---------- */
.site-header {
  background: rgba(10, 13, 24, 0.78);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.nav { max-width: 1080px; margin: 0 auto; padding: 0 22px; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.nav-brand { font-weight: 700; font-size: 1.1rem; color: #fff; letter-spacing: 0.3px; white-space: nowrap; text-shadow: 0 0 16px var(--glow-violet); }
.nav-brand:hover { text-decoration: none; opacity: 0.9; }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a { color: #b9b5c8; padding: 8px 12px; border-radius: 10px; font-size: 0.97rem; transition: background 0.2s, color 0.2s; }
.nav-links a:hover { background: rgba(163, 150, 200, 0.14); color: #fff; text-decoration: none; }
.nav-links a.active { background: linear-gradient(120deg, var(--accent-strong), var(--magenta)); color: #fff; font-weight: 600; box-shadow: 0 0 18px var(--glow-violet); }

.nav-toggle { display: none; background: none; border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; border-radius: 10px; padding: 6px 12px; font-size: 1.2rem; cursor: pointer; }

/* ---------- Layout ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 44px 22px 60px; }

/* ---------- Hero (home) ---------- */
.hero { text-align: center; padding: 44px 0 10px; position: relative; overflow: hidden; }
.aurora {
  position: absolute; inset: -35%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(42% 42% at 22% 28%, var(--glow-violet), transparent 62%),
    radial-gradient(42% 42% at 80% 22%, var(--glow-cyan), transparent 62%),
    radial-gradient(36% 36% at 62% 82%, var(--glow-magenta), transparent 62%);
  filter: blur(40px);
  animation: aurora 16s ease-in-out infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate3d(0, 0, 0) scale(1);    filter: blur(40px); }
  100% { transform: translate3d(-2%, 3%, 0) scale(1.12); filter: blur(52px); }
}
.hero > :not(.aurora) { position: relative; z-index: 1; }
.hero .monogram, .hero h1, .hero .role, .hero .affil, .hero .badges { animation: riseIn 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hero h1 { animation-delay: 0.05s; }
.hero .role { animation-delay: 0.12s; }
.hero .affil { animation-delay: 0.19s; }
.hero .badges { animation-delay: 0.26s; }
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.hero .avatar { width: 132px; height: 132px; border-radius: 50%; object-fit: cover; border: 4px solid rgba(255, 255, 255, 0.18); box-shadow: var(--shadow); margin-bottom: 18px; }
.monogram {
  width: 132px; height: 132px; border-radius: 50%; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--violet) 0%, var(--magenta) 100%);
  color: #fff; font-size: 2.5rem; font-weight: 700; letter-spacing: 1px;
  border: 4px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 6px rgba(163, 150, 200, 0.2), 0 0 40px var(--glow-magenta), var(--shadow);
}
.monogram-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.hero h1 { margin: 0 0 6px; font-size: 2.3rem; letter-spacing: -0.5px; }
.grad-text {
  background: linear-gradient(90deg, var(--accent) 0%, var(--cyan) 38%, var(--magenta) 72%, var(--accent) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: shine 7s linear infinite, riseIn 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes shine { to { background-position: 200% center; } }
.hero .role { font-size: 1.15rem; color: var(--cyan); font-weight: 600; margin: 0 0 10px; }
.hero .affil { color: var(--muted); margin: 0 0 22px; }
.hero p.lead { max-width: 760px; margin: 0 auto 8px; }

.badges { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.badge { display: inline-flex; align-items: center; gap: 7px; background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(163, 150, 200, 0.3); border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; font-weight: 500; transition: border-color 0.2s, box-shadow 0.2s; }
.badge:hover { border-color: var(--violet); box-shadow: 0 0 16px var(--glow-violet); text-decoration: none; }

/* ---------- About (home) ---------- */
.about { margin: 8px 0 0; text-align: left; }
.about p { margin: 0 0 18px; color: var(--ink-soft); }
.full-width-content {
  max-width: 100%;
  margin: 0;
  padding: 0 22px;
}

/* ---------- Media containers ---------- */
.media-container {
  margin: 20px 0;
  text-align: center;
}

.media-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
}

.media-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
}

.media {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.media iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.media-row .media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-container img {
  display: inline-block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.media-credit {
  font-size: 0.78rem;
  line-height: 1.4;
  color: #6b7280;
  margin: 8px 0 0;
  width: 100%;
  text-align: left;
}

.media-credit a {
  color: inherit;
  text-decoration: underline;
}

.image-only {
  margin: 20px 0;
  text-align: center;
}

.image-only img {
  display: inline-block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.research-areas { list-style: none; margin: 0; padding: 0; }
.research-areas li { position: relative; padding-left: 20px; margin: 0 0 12px; color: var(--ink-soft); }
.research-areas li::before {
  content: ""; position: absolute; left: 0; top: 0.58em; width: 8px; height: 8px;
  border-radius: 3px; background: linear-gradient(135deg, var(--violet), var(--magenta));
  box-shadow: 0 0 10px var(--glow-magenta);
}
.research-areas strong { color: var(--ink); }
.about p,
.research-areas li {
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}

/* ---------- Cards (home links) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 22px; margin-top: 34px; }
.card {
  background: var(--card-glass);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}
a.card { color: inherit; display: block; }
a.card:hover {
  transform: translateY(-6px);
  border-color: var(--violet);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55), 0 0 30px var(--glow-violet);
  text-decoration: none;
}
.card .icon { font-size: 1.7rem; margin-bottom: 10px; display: inline-block; filter: drop-shadow(0 0 8px var(--glow-cyan)); }
.card h3 { margin: 0 0 6px; font-size: 1.15rem; color: var(--ink); }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.96rem; }
.card .more { margin-top: 14px; color: var(--cyan); font-weight: 600; font-size: 0.92rem; display: inline-block; transition: transform 0.25s; }
a.card:hover .more { transform: translateX(4px); }

/* ---------- Content pages ---------- */
.page-head { margin-bottom: 30px; }
.page-head h1 { font-size: 2rem; margin: 0 0 6px; letter-spacing: -0.3px; }
.page-head .sub { color: var(--muted); margin: 0; }

h2.section { font-size: 1.35rem; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin: 38px 0 16px; }
h2.section .n {
  color: var(--gold);
  font-family: "Space Grotesk", sans-serif;
  text-shadow: 0 0 14px rgba(232, 179, 75, 0.45);
}

/* CV timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 20px 26px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline > li::before {
  content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  border: 2px solid var(--bg); box-shadow: 0 0 12px var(--glow-violet);
}
.timeline .when { color: var(--cyan); font-weight: 600; font-size: 0.92rem; }
.timeline .what { font-weight: 600; }
.timeline .where { color: var(--muted); font-size: 0.95rem; }
.timeline .org-logo {
  display: inline-block;
  height: 0.95em;
  width: auto;
  vertical-align: -0.2em;
  margin-left: 3px;
  opacity: 0.95;
}

ul.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
ul.tags li {
  background: var(--card-glass);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.86rem;
  color: var(--ink-soft);
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
ul.tags li:hover { border-color: var(--violet); color: var(--ink); box-shadow: 0 0 14px var(--glow-violet); }
ul.tags a { color: inherit; }
ul.tags a:hover { text-decoration: none; color: var(--cyan); }

/* Publications list */
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 24px; }
.controls label { font-size: 0.9rem; color: var(--muted); }
.search {
  flex: 1 1 240px; padding: 10px 14px; font-size: 0.98rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card-glass); color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--accent-soft); }
select.filter {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card-glass); color: var(--ink); font-size: 0.95rem;
  transition: border-color 0.2s;
}
select.filter:focus { outline: none; border-color: var(--violet); }
.count { margin-left: auto; font-size: 0.9rem; color: var(--muted); }

.pub {
  background: var(--card-glass);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px; margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.pub:hover { border-color: rgba(163, 150, 200, 0.4); box-shadow: 0 0 24px rgba(163, 150, 200, 0.15); }
.pub h3 { margin: 0 0 6px; font-size: 1.08rem; line-height: 1.35; }
.pub .meta { color: var(--muted); font-size: 0.92rem; margin-bottom: 6px; }
.pub .venue { color: var(--ink-soft); font-style: italic; }
.pub .type-tag {
  display: inline-block; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase;
  color: #cdc1e8; background: rgba(163, 150, 200, 0.18); border: 1px solid rgba(163, 150, 200, 0.3);
  border-radius: 5px; padding: 2px 8px; margin-right: 8px; vertical-align: middle;
}
.pub .links { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.92rem; }
.pub .links a:hover { text-decoration: underline; }
.pub summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; margin-top: 8px; user-select: none; }
.pub details[open] summary { color: var(--accent); }
.pub .abstract { color: var(--ink-soft); font-size: 0.95rem; margin-top: 10px; }
.pub blockquote { border-left: 3px solid var(--accent-strong); margin: 16px 0; padding: 4px 16px; color: var(--ink-soft); }
.hide { display: none !important; }

/* Database page */
.dl-card {
  background:
    radial-gradient(120% 120% at 20% 10%, rgba(163, 150, 200, 0.28), transparent 55%),
    radial-gradient(120% 120% at 85% 90%, rgba(119, 175, 173, 0.2), transparent 55%),
    linear-gradient(135deg, #241f33 0%, #1b1823 100%);
  color: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px;
  box-shadow: var(--shadow), 0 0 40px rgba(163, 150, 200, 0.18);
  margin: 10px 0 26px;
}
.dl-card h2 { margin: 0 0 8px; font-size: 1.5rem; }
.dl-card p { margin: 0 0 18px; color: #c6c2d4; }
.btn {
  display: inline-block; background: #fff; color: #6e5da0; font-weight: 700;
  padding: 12px 22px; border-radius: 10px; font-size: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn:hover { background: #ece7f6; transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4); text-decoration: none; }
.btn.ghost { background: transparent; border: 2px solid #fff; color: #fff; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.12); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 26px 22px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Scrollbar */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #3a3550; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-strong); }

/* Responsive */
@media (max-width: 720px) {
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    background: rgba(10, 13, 24, 0.96);
    flex-direction: column; padding: 12px 22px 20px; gap: 6px;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  }
  .nav-links.open { display: flex; }
  .nav-links a { width: 100%; }
  .nav-toggle { display: block; }
  .hero h1 { font-size: 1.9rem; }
  .count { margin-left: 0; width: 100%; }
  .media-row { flex-direction: column; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
}

/* Mobile: Disable animations for better performance */
@media (max-width: 720px) {
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
    will-change: auto !important;
  }
  
  /* Ensure all reveal elements are visible on mobile */
  [data-reveal].visible {
    opacity: 1 !important;
    transform: none !important;
  }
  
  /* Disable additional animations and effects on mobile */
  .aurora {
    display: none !important;
  }
  
  .monogram-img {
    animation: none !important;
    filter: none !important;
  }
  
  .hero {
    background: none !important;
  }
  
  /* Remove blur effects on mobile */
  .site-header {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  
  /* Simplify transitions for mobile */
  .nav-links a {
    transition: none !important;
  }
  
  .btn {
    transition: none !important;
  }
  
  /* Disable hover effects on mobile */
  .card:hover, .pub:hover {
    transform: none !important;
    box-shadow: none !important;
  }
  
  /* Disable complex gradients on mobile */
  .dl-card {
    background: var(--card) !important;
  }
}
