/* ==========================================================================
   al-folio inspired theme — Tristan Lecourtois
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,400&family=Roboto+Mono:wght@400;500&display=swap');

/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
  --theme-color:       #0366d6;
  --theme-hover:       #024ea4;
  --text-color:        #212121;
  --text-muted:        #757575;
  --bg:                #f6f8fa;
  --bg-secondary:      #ffffff;
  --border:            #d0d7de;
  --card-shadow:       0 2px 8px rgba(0, 0, 0, 0.07);
  --card-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
  --navbar-height:     60px;
  --max-width:         960px;
  --radius:            6px;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-color);
  background-color: var(--bg);
}

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

/* ==========================================================================
   Navbar
   ========================================================================== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.navbar-brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: 0.01em;
  text-decoration: none;
}
.navbar-brand:hover {
  color: var(--theme-color);
  text-decoration: none;
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 1.8rem;
}
.navbar-nav a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color 0.15s;
}
.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--theme-color);
  text-decoration: none;
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  flex-direction: column;
  gap: 5px;
}
.navbar-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-color);
  border-radius: 2px;
}

.navbar-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 0.4rem;
  transition: color 0.15s;
}
.theme-toggle:hover {
  color: var(--theme-color);
}

/* ==========================================================================
   Page layout wrapper
   ========================================================================== */
.page-content {
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height) - 60px);
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding: 3.5rem 2rem 4rem;
}

/* ==========================================================================
   About page — two-column layout
   ========================================================================== */
.about-wrapper {
  display: flex;
  gap: 3.5rem;
  align-items: flex-start;
}

.profile-col {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: sticky;
  top: calc(var(--navbar-height) + 2rem);
}

.profile-photo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  margin-bottom: 1.1rem;
  border: 3px solid var(--border);
}

.profile-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.profile-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.3rem;
}

.profile-institution {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.profile-divider {
  width: 30px;
  height: 2px;
  background: var(--border);
  margin: 0.8rem auto;
}

.profile-social {
  list-style: none;
  width: 100%;
}
.profile-social li {
  margin-bottom: 0.45rem;
}
.profile-social a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.15s;
}
.profile-social a:hover {
  color: var(--theme-color);
  text-decoration: none;
}
.profile-social i {
  width: 16px;
  text-align: center;
  color: var(--text-muted);
}
.profile-social a:hover i {
  color: var(--theme-color);
}

.about-content {
  flex: 1;
  min-width: 0;
}
.about-content p {
  margin-bottom: 1rem;
  font-size: 0.97rem;
}
.about-list {
  margin: 0 0 1rem 1.2rem;
  font-size: 0.97rem;
}
.about-list li { margin-bottom: 0.5rem; }
.about-list a { color: var(--theme-color); }

/* ==========================================================================
   Publications
   ========================================================================== */
.pub-list { list-style: none; }

.pub-entry {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.pub-title { font-weight: 700; margin-bottom: 0.3rem; }
.pub-authors { font-size: 0.92rem; }
.pub-venue { font-size: 0.9rem; font-style: italic; color: var(--text-muted); margin-bottom: 0.3rem; }
.pub-links { font-size: 0.85rem; color: var(--text-muted); }
.pub-links a { color: var(--theme-color); }

/* ==========================================================================
   Section headings
   ========================================================================== */
.section-heading {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   News table
   ========================================================================== */
.news-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}
.news-table tr {
  border-bottom: 1px solid var(--border);
}
.news-table tr:last-child {
  border-bottom: none;
}
.news-table td {
  padding: 0.65rem 0;
  vertical-align: top;
  font-size: 0.9rem;
}
.news-date {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: 'Roboto Mono', monospace;
  padding-right: 1.5rem;
  width: 105px;
  padding-top: 0.7rem;
}
.news-text {
  color: var(--text-color);
  line-height: 1.55;
}
.news-text a { color: var(--theme-color); }

/* ==========================================================================
   Portfolio — project cards
   ========================================================================== */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 0.5rem;
  overflow-x: hidden;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  background: var(--bg);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.project-card:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: #c5c5c5;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.project-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
  line-height: 1.35;
}

.project-links {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.badge-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  font-size: 0.73rem;
  font-weight: 500;
  border: 1px solid;
  line-height: 1.5;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.badge-github {
  color: #24292e;
  border-color: #ccc;
}
.badge-github:hover {
  background: #24292e;
  color: #fff;
  border-color: #24292e;
  text-decoration: none;
}

.badge-report {
  color: var(--theme-color);
  border-color: var(--theme-color);
}
.badge-report:hover {
  background: var(--theme-color);
  color: #fff;
  text-decoration: none;
}

.project-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: 'Roboto Mono', monospace;
  display: block;
  margin-bottom: 0.5rem;
}

.project-description {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.6;
}

.project-card.has-thumb {
  display: flex;
  gap: 1.4rem;
  align-items: flex-start;
  max-width: 100%;
  overflow: hidden;
}

.project-thumb {
  width: 150px;
  height: 150px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  object-fit: cover;
  object-position: center;
}

/* Wide thumbnails (diagrams) keep their aspect ratio instead of a square crop */
.project-thumb.wide {
  width: 240px;
  height: auto;
}

.project-body {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

/* ==========================================================================
   Page title
   ========================================================================== */
.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   Blog — single post
   ========================================================================== */
.post-article {
  max-width: 740px;
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.6rem;
  color: var(--text-color);
}

.post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.post-content {
  font-size: 0.97rem;
  line-height: 1.8;
  color: var(--text-color);
}
.post-content p { margin-bottom: 1.2rem; }
.post-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.8rem;
}
.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}
.post-content ul {
  padding-left: 1.5rem;
  margin-bottom: 1.2rem;
}
.post-content ul li { margin-bottom: 0.5rem; }
.post-content a { color: var(--theme-color); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 1.4rem 2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--theme-color);
  text-decoration: underline;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 700px) {
  .navbar { padding: 0 1.2rem; }

  .navbar-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: var(--navbar-height);
    left: 0; right: 0;
    background: #fff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 0.8rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }
  .navbar-nav.open { display: flex; }
  .navbar-toggle { display: flex; }

  .about-wrapper {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
  }
  .profile-col {
    position: static;
    width: 100%;
    max-width: 260px;
  }
  .page-content { padding: 2rem 1.2rem 3rem; }
  .project-header {
    flex-direction: column;
    gap: 0.6rem;
  }
  .project-links { align-self: flex-start; }
  .project-card.has-thumb {
    flex-direction: column;
  }
  .project-thumb,
  .project-thumb.wide {
    width: 100%;
    height: auto;
  }
  .post-title { font-size: 1.5rem; }
}

/* ==========================================================================
   Dark Mode — Toggle-based (not system preference)
   ========================================================================== */
body.dark-mode {
  --text-color:        #f0f0f0;
  --text-muted:        #b0b0b0;
  --bg:                #0d1117;
  --bg-secondary:      #161b22;
  --border:            #30363d;
  --card-shadow:       0 2px 8px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.5);
}

body.dark-mode .navbar {
  background: var(--bg);
}


