/* -------- General -------- */

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

a {
  color: #800000;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.email {
  font-family: monospace;
}


/* -------- Navbar -------- */

nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: #212529;
  padding: 0.5rem 0;
}

.navbar {
  display: flex;
  flex-wrap: nowrap;
  max-width: 75rem;
  margin: 0 auto;
  padding-left: 1em;
  height: auto;
  align-items: center;
}

.navbar .links {
  display: flex;
}

.navbar a {
  color: #bbb;
  font-family: monospace;
  margin-right: 1.25em;
}

.navbar a:hover {
  color: #fff;
  text-decoration: none;
}

.navbar a.home {
  color: #fff;
  font-size: 1.2em;
  font-weight: bold;
  margin-right: 2em;
  flex-shrink: 0;
}

.navbar a.home:hover {
  color: #e0e0e0;
}

.navbar .menu {
  display: none;
  font-size: 1.1rem;
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
}

.navbar .menu:hover {
  color: #fff;
}

.navbar .buttons {
  margin-left: auto;
  padding-right: 1rem;
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

.navbar .buttons button {
  width: 2rem;
}

@media (max-width: 850px) {
  .navbar .menu {
    display: block;
  }

  .navbar .links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    flex-direction: column;
    background: #212529;
  }

  .navbar .links a {
    padding: 0.75em 1em;
  }

  .navbar .links.active {
    display: flex;
  }

  .navbar .buttons {
    margin-left: 1rem;
  }
}

main {
  max-width: 75rem;
  margin: 0 auto;
  padding: 4.5rem 1rem 0.25rem 1rem;
}


/* -------- Profile header -------- */

#profile {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.5em;
  padding-bottom: 0.5rem;
}

#profile .photo {
  width: 200px;
  height: auto;
  padding: 0.25rem;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
}

#profile .content {
  flex: 1;
}

#profile .identity-logos {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

#profile .name {
  margin: 0 0.5em 0 0;
  font-size: 2rem;
  white-space: nowrap;
}

#profile .position {
  margin: 0 0.5em 0.25em 0;
  font-size: 1.5rem;
}

#profile .links {
  display: flex;
  gap: 0.75rem;
}

#profile .links a {
  text-decoration: none;
  color: black;
  font-size: 1.5rem;
}

#profile .links a:hover {
  color: #800000;
}

#profile .logos {
  display: flex;
  gap: 2em;
  align-items: center;
  margin-top: 1em;
}

#profile .enseirb-matmeca { height: 50px; }
#profile .labri           { height: 40px; }


#profile .affiliations {
  display: flex;
  gap: 1.5em;
  margin-top: 0.9rem;
}

#profile .affiliation {
  flex: 1;
  border: 1px solid #e9ecef;
  border-radius: 0.25rem;
  overflow: hidden;
  flex-direction: column;
}

#profile .affiliation .header {
  padding: 0.25rem 0.5rem;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  margin: 0;
  font-size: 1.2rem;
}

#profile .affiliation .header .icon {
  font-size: 1rem;
  margin-right: 0.75rem;
}

#profile .affiliation .content {
  padding: 0.75rem;
}

@media (max-width: 768px) {
  #profile { flex-direction: column; }
  #profile .identity-logos { flex-direction: column; }
  #profile .logos { margin-bottom: 1rem; }
  #profile .affiliations { flex-direction: column; }
}


/* -------- Sections -------- */

section {
  scroll-margin-top: 3.25rem;
  margin: 0 0.5rem 0.5rem;
}

section section {
  margin: 0;
}

section h2 {
  font-size: 1.75rem;
}

section h3 {
  font-size: 1.5rem;
}

section h4 {
  font-size: 1.25rem;
}


/* -------- About -------- */

#bio .timeline {
  padding-top: 1rem;
}

#bio .timeline .item {
  display: flex;
  margin-bottom: 1.5rem;
}

#bio .timeline .date {
  padding-right: 1rem;
  min-width: 10ch;
  text-align: right;
  white-space: nowrap;
}

#bio .timeline .icon {
  color: #800000;
  margin-right: 0.25rem;
}


/* -------- Publications -------- */

#publications .header {
  display: flex;
  gap: 2rem;
  align-items: center;
}

#publications .header h3 {
  margin: 0.5rem 0 0.25rem 0;
}

#publications .switch-view {
  display: flex;
  gap: 0.5rem;
}

#publications .switch-view button {
  font-family: monospace;
  background: #fff;
  border: 1px solid #495057;
  border-radius: 0.25rem;
  overflow: hidden;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#publications .switch-view button.active {
  background: #495057;
  color: #fff;
}

#publications .switch-view button:hover:not(.active) {
  background: #eee;
}

#publications #by-year, #publications #by-type {
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: opacity 1s ease, height 1s ease;
}

#publications #by-year.active, #publications #by-type.active {
  opacity: 1;
  height: auto;
}

.publication {
  display: flex;
  align-items: flex-start;
  padding: 0.5rem;
}

.pub {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.phd { background: #ffd500;}
.b   { background: #ef942d;}
.j   { background: #c32b72; }
.jn  { background: #e080a5; }
.c   { background: #196ca3; }
.cn  { background: #4d8fc3; }
.a   { background: #a3c8e0; }
.p   { background: #606b70; }

.publication .ref {
  font-family: monospace;
  font-size: 0.9rem;
  min-width: 2.5rem;
  margin: 0.1rem 1rem 0 1rem;
  text-align: right;
}

.publication .title {
  font-weight: bold;
}

.publication .venue {
  font-style: italic;
}

#publications h4 {
  margin-bottom: 0.75rem;
}


/* -------- Tables -------- */

table {
  border-collapse: collapse;
}

th, td {
  padding: 0.5rem 1rem;
}

tr:nth-child(odd) {
  background: #f8f9fa;
}

tr:nth-child(even) {
  background: #ffffff;
}

tr  {
  border-bottom: 1px solid #ccc;
}

th {
  text-align: left;
  font-weight: bold;
  background: #fff;
}

table {
  table-layout: auto;
  width: 100%;
}


/* -------- Students and projects-------- */

#students h4 {
  margin-bottom: 0.5rem;
}

table.students col.name,
table.projects col.name {
  width: 30%;
}

table.students col.date,
table.projects col.date {
  width: 10%;
}

table.students td:nth-child(2),
table.students th:nth-child(2),
table.projects td:nth-child(2),
table.projects th:nth-child(2) {
  white-space: nowrap;
  min-width: 8ch;
}

#students .icon {
  padding-right: 0.5rem;
}


/* -------- Teaching -------- */

#teaching h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

table.teaching col.name {
  width: 40%;
}

#teaching .past p {
  color: #999;
  font-style: italic;
  margin: 1rem 0 0.25rem 0;
}


/* -------- Dark mode -------- */

#toggleDark {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: #bbb;
  padding: 0 1rem;
  transition: color 0.3s, transform 0.2s;
  margin-left: auto;
}

#toggleDark:hover {
  color: #fff;
}

body.dark {
  background: #121212;
  color: #e0e0e0;
}

body.dark a {
  color: #467be3;
}

body.dark .navbar .home {
  color: #fff;
}

body.dark .navbar a {
  color: #bbb;
}

body.dark .navbar a:hover {
  color: #fff;
}

body.dark .navbar a.home:hover {
  color: #e0e0e0;
}

body.dark #profile .photo {
  border: 1px solid #484848;
}

body.dark #profile .links a {
  color: #c0c0c0;
}

body.dark #profile .links a:hover {
  color: #467be3;
}

body.dark #profile .affiliation {
  border: 1px solid #484848;
}

body.dark #profile .affiliation .header {
  background: #212529;
  border-bottom: 1px solid #484848;
}

body.dark #bio .timeline .icon {
  color: #467be3;
}

body.dark #publications .switch-view button {
  border: 1px solid #484848;
}

body.dark #publications .switch-view button:not(.active) {
  background: #e0e0e0;
}

body.dark #publications .switch-view button:hover:not(.active) {
  background: #c0c0c0;
}

body.dark tr:nth-child(odd) {
  background: #1b1b1b;
}

body.dark tr:nth-child(even) {
  background: #121212;
}

body.dark tr  {
  border-bottom: 1px solid #484848;
}

body.dark th {
  background: #121212;
}


/* -------- Monospace mode -------- */

#toggleMonospace {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: #bbb;
  padding: 0 1rem;
  transition: color 0.3s, transform 0.2s;
}

#toggleMonospace:hover {
  color: #fff;
}

body.monospace section {
  font-family: monospace;
}

body.monospace #profile .name {
  font-family: monospace;
}


body.monospace #profile .position {
  font-family: monospace;
}
