/* ===== GENERAL STYLE ===== */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #f8f8f8;
  color: rgb(50, 50, 50);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background 0.3s ease;
}

/* ===== TITLE BAR ===== */
.title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgb(30, 144, 255);
  color: white;
  padding: 10px 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.title-bar .left-section {
  display: flex;
  align-items: center;
}

.logo {
  height: 40px;
  cursor: pointer;
  margin-right: 10px;
}

.site-name {
  font-size: 1.5em;
  font-weight: bold;
}

/* ===== THEME BOX ===== */
.theme-box {
  display: flex;
  gap: 10px;
}

.theme-box button {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

#lightMode {
  background-color: rgb(30, 144, 255);
}

#darkMode {
  background-color: rgb(15, 37, 57);
}

/* ===== SEARCH BAR ===== */
.search-section {
  display: flex;
  justify-content: flex-end;
  padding: 10px 20px;
  background-color: #e7e6e6;
}

#searchBar {
  width: 300px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 8px;
}

/* ===== MAIN CONTENT ===== */
main {
  padding: 20px;
  width: 90%;
  max-width: 1000px;
  margin: 20px auto;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
}

/* ===== BIOGRAPHY CARDS ===== */
.bio-list {
  display: grid;
  gap: 15px;
  grid-template-columns: 1fr;
  align-items: stretch;
  overflow-y: auto;
  padding-bottom: 20px;
}

/* 2 columns for medium screens */
@media (min-width: 900px) {
  .bio-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 3 columns for large screens */
@media (min-width: 1400px) {
  .bio-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.bio-card {
  background-color: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.bio-card:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.bio-card h3 {
  margin-top: 0;
  color: rgb(30, 144, 255);
  font-size: 1.2em;
}

.bio-card pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  flex-grow: 1;
  overflow: hidden;
}

/* ===== EXPANDED BIO CARD (FULL PAGE MODE) ===== */
.bio-card.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 90vw;
  height: 90vh;
  z-index: 9999;
  overflow-y: auto;
  border-radius: 14px;
  background-color: white;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  animation: expandZoom 0.4s ease forwards;
}

.bio-card.expanded h3 {
  font-size: 1.6em;
  text-align: center;
  margin-bottom: 15px;
  color: rgb(30, 144, 255);
}

.bio-card.expanded pre {
  max-height: 80vh;
  overflow-y: auto;
}

/* Smooth zoom and fade animation */
@keyframes expandZoom {
  from {
    opacity: 0;
    transform: translate(-50%, -45%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes collapseZoom {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -55%) scale(0.9);
  }
}

/* Add a class to handle the closing animation */
.bio-card.collapsing {
  animation: collapseZoom 0.3s ease forwards;
}

/* ===== BACKGROUND DIM WHEN EXPANDED ===== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 9998;
}

body.no-scroll::before {
  opacity: 1;
  pointer-events: all;
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 15px;
  background-color: #e7e6e6;
  color: #555;
  margin-top: auto;
  font-size: 0.9em;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 900px) {
  #searchBar {
    width: 80%;
  }
  main {
    width: 95%;
    aspect-ratio: auto;
  }
}

@media (max-width: 600px) {
  .title-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .site-name {
    font-size: 1.3em;
  }
  #searchBar {
    width: 100%;
  }
  main {
    width: 95%;
    padding: 15px;
    aspect-ratio: auto;
  }
}
