/* ============================================================
   Giovanni Bartolomeo – Academic Portfolio
   Dark minimal theme  |  2026
   ============================================================ */

/* ── Custom properties ───────────────────────────────────── */
:root {
  --bg:          #0d0f12;
  --surface:     #161b22;
  --surface-2:   #1c2128;
  --border:      #30363d;
  --text:        #c9d1d9;
  --text-muted:  #8b949e;
  --accent:      #58a6ff;
  --accent-hover:#79b8ff;
  --gold:        #e3b341;
  --heading:     #f0f6fc;
  --red:         #f85149;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Mono', monospace;
  --sidebar-w: 240px;
  --content-max: 820px;
  --radius: 8px;
  --transition: 150ms ease;
}

/* ── Reset / base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ── Layout ───────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
  max-width: 1400px;
  margin-inline: auto;
  /* soft vertical border on very wide screens */
  box-shadow: 0 0 0 1px var(--border);
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  z-index: 100;
  overflow-y: auto;
  align-self: flex-start;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.profile { text-align: center; }
.profile-img {
  width: 90px; height: 90px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.75rem;
  border: 2px solid var(--border);
}
.profile-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.3;
}
.profile-role {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 0.15rem; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--surface-2);
  color: var(--heading);
}
.sidebar-nav a .nav-icon { font-size: 0.95em; opacity: 0.8; }

/* social */
.sidebar-social {
  margin-top: auto;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.sidebar-social a {
  color: var(--text-muted);
  font-size: 1.15rem;
  transition: color var(--transition);
}
.sidebar-social a:hover { color: var(--accent); }

/* ── Mobile top-bar ───────────────────────────────────────── */
.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 200;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}
.mobile-bar-name {
  font-weight: 700;
  color: var(--heading);
  font-size: 0.95rem;
}
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: background var(--transition);
}
.hamburger:hover { background: var(--surface-2); }

.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.7);
}
.mobile-nav.open { display: block; }
.mobile-nav-inner {
  position: absolute;
  top: 0; left: 0;
  width: 260px; height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}
.mobile-nav-close {
  align-self: flex-end;
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 1.3rem; line-height: 1;
}
.mobile-nav .sidebar-nav { display: flex; }
.mobile-nav .sidebar-social { display: flex; }

/* ── Main content ─────────────────────────────────────────── */
.content {
  flex: 1;
  max-width: calc(var(--content-max) + 4rem);
  min-width: 0;
  padding: 3rem 2rem;
  margin-inline: auto;
}

/* ── Section ─────────────────────────────────────────────── */
section {
  padding-top: 4rem;  padding-bottom: 3rem;  margin-top: -4rem;   /* offset for sticky nav highlight */
}
section + section { border-top: 1px solid var(--border); }

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 0.5rem;
}

/* ── About ────────────────────────────────────────────────── */
#about { padding-top: 0; margin-top: 0; border-top: none; }
.about-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
}
.about-bio h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--heading);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
.about-bio .tagline {
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 1rem;
  font-weight: 500;
}
.about-bio p { color: var(--text); margin-bottom: 0.75rem; font-size: 0.95rem; }
.about-img {
  width: 180px;
  height: 180px;
  border-radius: var(--radius);
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--border);
}
.about-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  text-decoration: none;
}
.btn:hover { background: var(--border); color: var(--heading); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0f12;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #0d0f12; }

/* ── Show More / Show Less collapse button ────────────────── */
.show-more-btn {
  display: inline-flex;
  margin-top: 1rem;
  align-self: flex-start;
}

/* ── Filter pills ─────────────────────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.filter-pill {
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-pill:hover,
.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0f12;
  font-weight: 600;
}

/* ── Publication / Student card ───────────────────────────── */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pub-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: border-color var(--transition);
}
.pub-card:hover { border-color: var(--accent); }

.pub-cover {
  width: 120px;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.pub-body { display: flex; flex-direction: column; gap: 0.35rem; }
.pub-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.4;
}
.pub-title a { color: inherit; }
.pub-title a:hover { color: var(--accent); }
.pub-authors { font-size: 0.8rem; color: var(--text-muted); }
.pub-venue { font-size: 0.8rem; color: var(--text); font-style: italic; }
.pub-meta { font-size: 0.78rem; color: var(--text-muted); }
.pub-footer { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; align-items: center; }
.award-badge {
  background: rgba(227,179,65,0.15);
  border: 1px solid rgba(227,179,65,0.4);
  color: var(--gold);
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-weight: 600;
}
.artifact-badge { height: 2.5rem; }
.pub-category-hidden { display: none; }

/* ── News / Timeline ──────────────────────────────────────── */
.news-list { display: flex; flex-direction: column; gap: 0; }
.news-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0 1rem;
  position: relative;
  padding-bottom: 1.5rem;
}
.news-item:last-child { padding-bottom: 0; }
.news-item:last-child .news-line { display: none; }
.news-date-col { text-align: right; padding-top: 0.1rem; }
.news-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--mono);
  white-space: nowrap;
}
.news-dot-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.news-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  flex-shrink: 0;
  margin-top: 0.35rem;
}
.news-line {
  width: 1px;
  flex: 1;
  background: var(--border);
  margin-top: 3px;
}
.news-body { padding-left: 0.5rem; }
.news-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 0.25rem;
}
.news-content { font-size: 0.85rem; color: var(--text); margin-bottom: 0.5rem; }
.news-picture {
  width: 100%;
  max-width: 340px;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* 4-col timeline rework for larger screens */
.news-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.news-row {
  display: grid;
  grid-template-columns: 90px 20px 1fr;
  gap: 0 0.75rem;
  padding-bottom: 1.75rem;
  position: relative;
}
.news-row:last-child { padding-bottom: 0; }
.news-time {
  text-align: right;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-family: var(--mono);
  padding-top: 0.25rem;
  line-height: 1.3;
}
.news-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.news-connector-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  margin-top: 0.3rem;
  flex-shrink: 0;
}
.news-connector-line {
  width: 1px;
  flex: 1;
  background: var(--border);
  margin-top: 2px;
}
.news-row:last-child .news-connector-line { display: none; }
.news-body-col .news-title { font-size: 0.92rem; font-weight: 600; color: var(--heading); }
.news-body-col .news-text { font-size: 0.84rem; color: var(--text); margin-top: 0.2rem; }
.news-body-col img {
  max-width: 300px;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-top: 0.6rem;
}

/* ── Projects ─────────────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 1rem;
}
.github-embed {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
}
.github-embed img { width: 100%; display: block; }
.github-stats {
  grid-column: 1 / -1;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.github-stats img { width: 100%; }

/* ── Awards ───────────────────────────────────────────────── */
.awards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.award-card {
  background: var(--surface);
  border: 1px solid rgba(227,179,65,0.25);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  transition: border-color var(--transition);
}
.award-card:hover { border-color: var(--gold); }
.award-icon { font-size: 1.5rem; flex-shrink: 0; padding-top: 0.1rem; }
.award-info {}
.award-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.2rem;
}
.award-event { font-size: 0.8rem; color: var(--text-muted); }
.award-year { font-size: 0.78rem; color: var(--gold); font-weight: 600; margin-top: 0.2rem; }

/* ── Blog ─────────────────────────────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.blog-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.blog-date { font-size: 0.75rem; color: var(--text-muted); font-family: var(--mono); }
.blog-title { font-size: 0.95rem; font-weight: 700; color: var(--heading); line-height: 1.4; }
.blog-excerpt { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }
.blog-tag {
  font-size: 0.73rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  display: inline-block;
}
.blog-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem 0;
}

/* Blog modal */
.blog-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  padding: 2rem 1rem;
}
.blog-modal-overlay.open { display: flex; justify-content: center; align-items: flex-start; }
.blog-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 720px;
  padding: 2rem;
  position: relative;
}
.blog-modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  transition: background var(--transition), color var(--transition);
}
.blog-modal-close:hover { background: var(--surface-2); color: var(--heading); }
.blog-modal-content h1,
.blog-modal-content h2,
.blog-modal-content h3 { color: var(--heading); margin: 1.25rem 0 0.6rem; line-height: 1.3; }
.blog-modal-content h1 { font-size: 1.5rem; }
.blog-modal-content h2 { font-size: 1.2rem; }
.blog-modal-content h3 { font-size: 1.05rem; }
.blog-modal-content p { margin-bottom: 0.9rem; font-size: 0.9rem; line-height: 1.75; }
.blog-modal-content ul, .blog-modal-content ol { padding-left: 1.5rem; margin-bottom: 0.9rem; font-size: 0.9rem; }
.blog-modal-content li { margin-bottom: 0.3rem; }
.blog-modal-content code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--accent);
}
.blog-modal-content pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.blog-modal-content pre code {
  background: none; border: none; padding: 0;
  font-size: 0.85rem; color: var(--text);
}
.blog-modal-content blockquote {
  border-left: 3px solid var(--accent);
  margin-left: 0;
  padding-left: 1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.9rem;
}
.blog-modal-content img { max-width: 100%; border-radius: 6px; margin: 0.75rem 0; }
.blog-modal-content a { color: var(--accent); }
.blog-modal-content table {
  width: 100%; border-collapse: collapse;
  margin-bottom: 1rem; font-size: 0.85rem;
}
.blog-modal-content th, .blog-modal-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.blog-modal-content th { background: var(--surface-2); color: var(--heading); }

/* ── Contact ──────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.contact-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.contact-block h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}
.contact-block p, .contact-block a {
  font-size: 0.88rem;
  color: var(--text);
  display: block;
  margin-bottom: 0.3rem;
}
.social-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }
.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text);
  transition: border-color var(--transition), color var(--transition);
}
.social-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Footer ───────────────────────────────────────────────── */
footer {
  margin-top: 4rem;
  padding: 2rem 0 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Utilities ────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
.text-muted { color: var(--text-muted); }
.mono { font-family: var(--mono); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { display: none; }
  .mobile-bar { display: flex; }
  .content { padding: 1.5rem 1.25rem; }
  .about-grid { grid-template-columns: 1fr; }
  .about-img { width: 100px; height: 100px; order: -1; }
  .pub-card { grid-template-columns: 80px 1fr; }
  .pub-cover { width: 80px; aspect-ratio: 3/4; }
  .news-body-col img {
    width: 100%;
    max-width: 100vw;
    height: auto;
    box-sizing: border-box;
  }
}

@media (max-width: 520px) {
  .pub-card { grid-template-columns: 1fr; }
  .pub-cover {
    width: 100%;
    max-width: 220px;
    aspect-ratio: 3/4;
    object-fit: cover;
    margin-left: auto;
    margin-right: auto;
    display: block;
  }
  .awards-grid { grid-template-columns: 1fr; }
  .blog-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}

/* ── Scrollbar styling ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
