/* ==========================================================
   Roberto Riggio — CV  ·  Bootstrap 5.3 theme
   ========================================================== */

:root {
  --cv-sidebar-w: 300px;
  --cv-accent: #c026d3;          /* magenta */
  --cv-accent-2: #ec4899;        /* pink */
  --cv-accent-rgb: 192, 38, 211;
  --cv-sidebar-bg: linear-gradient(165deg, #3b0a3f 0%, #701a75 45%, #831843 100%);
  --cv-radius: 1rem;

  --bs-primary: var(--cv-accent);
  --bs-primary-rgb: var(--cv-accent-rgb);
  --bs-link-color: var(--cv-accent);
  --bs-link-color-rgb: var(--cv-accent-rgb);
  --bs-link-hover-color: #86198f;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-bg: #f6f7fb;
  --bs-body-color: #1f2937;
  --bs-border-color: #e5e7eb;
  --bs-primary-bg-subtle: #fae8ff;
  --bs-primary-text-emphasis: #86198f;
}

[data-bs-theme="dark"] {
  --cv-accent: #e879f9;
  --cv-accent-rgb: 232, 121, 249;
  --cv-sidebar-bg: linear-gradient(165deg, #1a0519 0%, #3b0a3f 50%, #500724 100%);
  --bs-body-bg: #0d1117;
  --bs-body-color: #d1d5db;
  --bs-secondary-bg: #161b22;
  --bs-tertiary-bg: #1c2230;
  --bs-border-color: #2a3140;
  --bs-link-color: #f0abfc;
  --bs-link-color-rgb: 240, 171, 252;
  --bs-link-hover-color: #f5d0fe;
  --bs-primary-bg-subtle: rgba(232, 121, 249, .16);
  --bs-primary-text-emphasis: #f5d0fe;
}

html { scroll-behavior: smooth; scroll-padding-top: 1.5rem; }
@media (max-width: 991.98px) { html { scroll-padding-top: 76px; } }
body { font-size: .975rem; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, h5, .display-5 { font-family: "Space Grotesk", var(--bs-body-font-family); letter-spacing: -.01em; }

/* ---------------- Sidebar ---------------- */
.sidebar { color: #fae8ff; }
.sidebar .sidebar-inner {
  display: flex; flex-direction: column; height: 100%;
  padding: 2rem 1.25rem 1.25rem; overflow-y: auto;
}
@media (min-width: 992px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--cv-sidebar-w);
    background: var(--cv-sidebar-bg); z-index: 1030;
  }
  .main { margin-left: var(--cv-sidebar-w); }
}
@media (max-width: 991.98px) {
  .sidebar.offcanvas-lg { background: var(--cv-sidebar-bg); --bs-offcanvas-width: 300px; }
}

.profile-photo {
  width: 140px; height: 140px; object-fit: cover; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.18);
  box-shadow: 0 0 0 6px rgba(255,255,255,.06), 0 12px 30px rgba(0,0,0,.35);
}
.profile-name { color: #fff; font-size: 1.45rem; font-weight: 700; margin: 1rem 0 .15rem; }
.profile-role { color: #f5d0fe; font-size: .85rem; line-height: 1.45; margin-bottom: .9rem; }
.social { display: flex; justify-content: center; gap: .5rem; margin-bottom: 1.5rem; }
.social a {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(255,255,255,.1); color: #fff; font-size: 1.05rem; transition: .2s;
}
.social a:hover { background: #fff; color: #701a75; transform: translateY(-2px); text-decoration: none; }

#sideNav .nav-link {
  display: flex; align-items: center; gap: .75rem;
  color: #f5d0fe; padding: .5rem .85rem; border-radius: .6rem;
  font-size: .9rem; font-weight: 500; transition: background .15s, color .15s;
}
#sideNav .nav-link i { font-size: 1rem; opacity: .85; }
#sideNav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
#sideNav .nav-link.active { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 3px 0 0 var(--cv-accent-2); }

.sidebar-foot { margin-top: auto; padding-top: 1.25rem; text-align: center; }
.theme-toggle {
  color: #fae8ff; border: 1px solid rgba(255,255,255,.2); border-radius: 2rem;
  display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .9rem;
}
.theme-toggle:hover { background: rgba(255,255,255,.1); color: #fff; }

/* mobile top bar */
.topbar {
  background: color-mix(in srgb, var(--bs-body-bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--bs-border-color);
}
.topbar .navbar-brand { font-weight: 700; font-family: "Space Grotesk", sans-serif; }
.btn-icon { border: 0; color: var(--bs-body-color); padding: .25rem .5rem; }

/* ---------------- Main content ---------------- */
.content { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem 1rem; }
@media (min-width: 768px) { .content { padding: 3rem 2.5rem 1.5rem; } }

.cv-section {
  background: var(--bs-secondary-bg, #fff);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--cv-radius);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.08);
}
@media (min-width: 768px) { .cv-section { padding: 2.25rem 2.5rem; } }
[data-bs-theme="light"] .cv-section { background: #fff; }

.section-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.5rem; }
.section-head h2 { font-size: 1.6rem; font-weight: 700; margin: 0; }
.section-sub { margin: .1rem 0 0; font-size: .85rem; color: var(--bs-secondary-color); }
.section-icon {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: .8rem;
  display: grid; place-items: center; font-size: 1.3rem; color: #fff;
  background: linear-gradient(135deg, var(--cv-accent), var(--cv-accent-2));
  box-shadow: 0 6px 16px -6px rgba(var(--cv-accent-rgb), .6);
}

.sub-head {
  font-size: 1.05rem; font-weight: 700; margin: 2rem 0 .9rem;
  display: flex; align-items: center; gap: .5rem; color: var(--bs-emphasis-color);
}
.sub-head i { color: var(--cv-accent); }

/* hero */
.hero {
  background:
    radial-gradient(1200px 300px at 100% 0%, rgba(236,72,153,.10), transparent 60%),
    radial-gradient(800px 300px at 0% 0%, rgba(var(--cv-accent-rgb),.12), transparent 60%),
    var(--bs-secondary-bg, #fff);
}
[data-bs-theme="light"] .hero {
  background:
    radial-gradient(1200px 300px at 100% 0%, rgba(236,72,153,.10), transparent 60%),
    radial-gradient(800px 300px at 0% 0%, rgba(var(--cv-accent-rgb),.12), transparent 60%),
    #fff;
}
.eyebrow {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--cv-accent); margin-bottom: .4rem;
}
.text-gradient {
  background: linear-gradient(90deg, var(--cv-accent), var(--cv-accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-photo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; box-shadow: 0 8px 24px rgba(0,0,0,.15); }

.stat {
  height: 100%; padding: 1rem 1.1rem; border-radius: .9rem;
  background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color);
}
.stat-num {
  font-family: "Space Grotesk", sans-serif; font-size: 1.75rem; font-weight: 700; line-height: 1.1;
  background: linear-gradient(90deg, var(--cv-accent), var(--cv-accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { font-size: .8rem; color: var(--bs-secondary-color); margin-top: .2rem; }

.about-card { border-radius: .9rem; background: transparent; }
.about-card p { text-align: justify; hyphens: auto; }
.topic {
  font-size: .8rem; font-weight: 600; padding: .3rem .75rem; border-radius: 2rem;
  background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis);
}

/* ---------------- Lists ---------------- */
.icon-list { list-style: none; padding: 0; margin: 0; }
.icon-list li { display: flex; gap: .75rem; padding: .55rem 0; border-bottom: 1px dashed var(--bs-border-color); }
.icon-list li:last-child { border-bottom: 0; }
.icon-list li > i { color: var(--cv-accent); font-size: 1.05rem; line-height: 1.6; flex: 0 0 auto; }

/* publications */
.pub-toolbar {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; position: sticky; top: 0; z-index: 5;
  padding: .75rem 0; background: inherit;
}
@media (max-width: 991.98px) { .pub-toolbar { top: 56px; } }
.pub-toolbar .nav-pills { gap: .35rem; }
.pub-toolbar .nav-pills .nav-link {
  border-radius: 2rem; font-size: .85rem; font-weight: 600; padding: .4rem .9rem;
  color: var(--bs-body-color); background: var(--bs-tertiary-bg);
}
.pub-toolbar .nav-pills .nav-link .badge { background: rgba(var(--cv-accent-rgb), .15); color: var(--cv-accent); margin-left: .25rem; }
.pub-toolbar .nav-pills .nav-link.active { background: var(--cv-accent); color: #fff; }
.pub-toolbar .nav-pills .nav-link.active .badge { background: rgba(255,255,255,.25); color: #fff; }

.search-box { position: relative; flex: 1 1 240px; max-width: 340px; }
.search-box i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); }
.search-box .form-control { padding-left: 2.3rem; border-radius: 2rem; font-size: .9rem; }
.search-box .form-control:focus { border-color: var(--cv-accent); box-shadow: 0 0 0 .2rem rgba(var(--cv-accent-rgb), .2); }

.pub-list { padding-left: 2.4rem; margin: 0; }
.pub-list .pub, .pub-list li { padding: .6rem .25rem .6rem .35rem; border-bottom: 1px solid var(--bs-border-color); }
.pub-list li:last-child { border-bottom: 0; }
.pub-list li::marker { color: var(--bs-secondary-color); font-size: .8rem; font-weight: 600; }
.pub-list em { font-style: normal; font-weight: 600; color: var(--bs-emphasis-color); }
.pub-list .me { font-weight: 700; color: var(--cv-accent); }
.pub-list li > .bi-check2-circle, .pub-list li > i { display: none; }

/* turn the "(PDF)" / "(YouTube)" links into small pills */
.pub-list em a, .icon-list a[href$=".pdf"] {
  display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .03em;
  padding: .05rem .45rem; border-radius: .35rem; vertical-align: 1px;
  background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis);
}
.pub-list em a:hover { background: var(--cv-accent); color: #fff; text-decoration: none; }

.year-group { margin-bottom: 1rem; }
.year-label {
  display: flex; align-items: center; gap: .5rem; font-size: 1rem; font-weight: 700;
  margin: 1.25rem 0 .25rem; color: var(--bs-emphasis-color);
}
.year-label::after { content: ""; flex: 1; height: 1px; background: var(--bs-border-color); }
.year-label .badge { background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); font-weight: 600; }
mark { padding: 0 .1em; border-radius: .2em; background: rgba(250, 204, 21, .45); color: inherit; }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: .5rem; bottom: .5rem; width: 2px;
  background: linear-gradient(var(--cv-accent), var(--cv-accent-2)); opacity: .35; border-radius: 2px;
}
.timeline-item { position: relative; display: flex; gap: 1rem; padding: .55rem 0 .9rem; }
.timeline-dot {
  flex: 0 0 auto; width: 16px; height: 16px; margin-top: .35rem; border-radius: 50%;
  background: var(--bs-secondary-bg, #fff); border: 3px solid var(--cv-accent); position: relative; z-index: 1;
}
[data-bs-theme="light"] .timeline-dot { background: #fff; }
.timeline-item > div:last-child > a:first-child { font-weight: 700; }
.role { margin-top: .35rem; font-size: .88rem; color: var(--bs-secondary-color); }
.role .badge { color: var(--bs-primary-text-emphasis); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.live-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #22c55e; display: inline-block;
  box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

.date-chip {
  font-size: .78rem; font-weight: 600; padding: .15rem .6rem; border-radius: 2rem; align-self: flex-start;
  background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); white-space: nowrap;
}

.list-group-item .date-chip { white-space: normal; text-align: right; max-width: 55%; }

/* funding table */
.funding-table { font-size: .9rem; --bs-table-bg: transparent; }
.funding-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); font-weight: 700; }

/* code cards */
.code-card {
  border-radius: .9rem; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s;
  background: var(--bs-tertiary-bg);
}
.code-card:hover { transform: translateY(-3px); border-color: var(--cv-accent); box-shadow: 0 10px 24px -12px rgba(var(--cv-accent-rgb), .5); text-decoration: none; }
.code-card .card-title { font-size: 1.05rem; font-weight: 700; }
.code-card .bi-arrow-up-right { color: var(--cv-accent); }

.list-group-item-action:hover { text-decoration: none; }
.card { border-color: var(--bs-border-color); }
.card-header { background: var(--bs-tertiary-bg); }
.badge.text-bg-warning .bi { margin-right: .15rem; }
.timeline .badge.text-bg-warning { margin-left: .35rem; }

/* footer */
.site-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  font-size: .85rem; color: var(--bs-secondary-color); padding: 1rem .25rem 2rem;
}

/* reveal on scroll */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
  .reveal.in { opacity: 1; transform: none; }
}

@media print {
  .sidebar, .topbar, .pub-toolbar .search-box, .site-footer .back-top { display: none !important; }
  .main { margin: 0 !important; }
  .cv-section { box-shadow: none; break-inside: auto; }
  .tab-content > .tab-pane { display: block !important; opacity: 1 !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* dark mode: light-magenta active pill needs dark text */
[data-bs-theme="dark"] .pub-toolbar .nav-pills .nav-link.active { color: #2e0730; }
[data-bs-theme="dark"] .pub-toolbar .nav-pills .nav-link.active .badge { background: rgba(46, 7, 48, .18); color: #2e0730; }
