/**
 * MAIN STYLESHEET
 * Eugenio Renedo - Academic Website
 * Last Updated: 2026-02-05
 *
 * Features:
 * - CSS Variables for dark/light mode theming
 * - Fixed navbar styles
 * - Reading progress bar
 * - Collapsible paper abstracts
 * - Responsive design with Bootstrap 5
 */

/* ============================================================
   CSS VARIABLES - LIGHT MODE (DEFAULT)
   ============================================================ */

:root {
  /* Colors */
  --bg-color: #ffffff;
  --text-color: #000000;
  --text-muted: #474f52;
  --text-subtle: #6c757d;       /* Light gray for secondary lines */
  --link-color: #b04f61;        /* Mauve - preserved from original */
  --border-color: #dee2e6;
  --card-bg: #ffffff;
  --shadow: rgba(0, 0, 0, 0.1);
  --navbar-bg: rgba(255, 255, 255, 0.95);

  /* Spacing */
  --navbar-height: 70px;
}

/* ============================================================
   CSS VARIABLES - DARK MODE
   ============================================================ */

[data-theme="dark"] {
  --bg-color: #0f1216;
  --text-color: #f2f4f8;
  --text-muted: #a4adb6;
  --text-subtle: #8b949e;
  --link-color: #d07082;
  --border-color: #2a2f36;
  --card-bg: #161b22;
  --shadow: rgba(0, 0, 0, 0.45);
  --navbar-bg: rgba(15, 18, 22, 0.9);
}


/* ============================================================
   BASE STYLES
   ============================================================ */

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI",
               Helvetica, Arial, sans-serif, "Apple Color Emoji",
               "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 17px;
  line-height: 1.6;
  padding-top: var(--navbar-height);
  transition: background-color 0.4s ease, color 0.4s ease;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: opacity 0.3s ease;
}

a:hover {
  opacity: 0.7;
  text-decoration: none;
}

/* ============================================================
   FIXED NAVBAR
   ============================================================ */

.navbar {
  display: flex;
}

.navbar.fixed-top {
  background: var(--navbar-bg);
  box-shadow: 0 2px 4px var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
  height: var(--navbar-height);
}

.navbar-brand {
  font-weight: 500;
  color: var(--text-color) !important;
}

.navbar-nav .nav-link {
  color: var(--text-color) !important;
  padding: 0.5rem 1rem;
  transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
  color: var(--link-color) !important;
}

.navbar-nav .nav-link.active {
  color: var(--link-color) !important;
  font-weight: 500;
}

/* Navbar items sit on the right on desktop (no brand on the left) */
@media (min-width: 576px) {
  .navbar-nav {
    margin-left: auto !important;
    margin-right: 0.5rem !important;
  }
}



/* Mobile navbar toggle */
.navbar-toggler {
  border-color: var(--border-color);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0, 0, 0, 0.55)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

[data-theme="dark"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Mobile collapsed menu - add background when expanded */
@media (max-width: 575px) {
  .navbar-collapse {
    background: var(--navbar-bg);
    padding: 1rem;
    margin-top: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px var(--shadow);
  }

  .navbar-nav {
    margin-left: 0 !important;
  }
}

/* ============================================================
   READING PROGRESS BAR
   ============================================================ */

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 1050;
  appearance: none;
  border: none;
  background: transparent;
}

#reading-progress::-webkit-progress-bar {
  background: transparent;
}

#reading-progress::-webkit-progress-value {
  background: var(--link-color);
  transition: width 0.1s ease;
}

#reading-progress::-moz-progress-bar {
  background: var(--link-color);
}

/* ============================================================
   PAPER ENTRIES & RESEARCH SECTIONS
   ============================================================ */

.research-section {
  margin-bottom: 3rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-color);
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.paper-entry {
  padding: 1.5rem;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--shadow);
  margin-bottom: 1.5rem;
  transition: box-shadow 0.3s ease, background-color 0.4s ease, color 0.4s ease;
}

.paper-entry:hover {
  box-shadow: 0 4px 6px var(--shadow);
}

.paper-title {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.paper-authors {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.paper-links {
  margin-top: 1rem;
}

/* ============================================================
   COLLAPSIBLE ABSTRACTS (HTML5 <details> element)
   ============================================================ */

details.paper-abstract {
  margin-top: 0.75rem;
}

summary.abstract-toggle {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.95rem;
  user-select: none;
  list-style: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

summary.abstract-toggle:hover {
  color: var(--link-color);
}

/* Boxed plus/minus after "Abstract" */
summary.abstract-toggle::after {
  content: "+";
  display: inline-block;
  width: 14px;
  height: 14px;
  line-height: 12px;
  margin-left: 6px;
  border: 1px solid currentColor;
  text-align: center;
  font-weight: 700;
  vertical-align: 1px;
}

details[open] summary.abstract-toggle::after {
  content: "\2212";
}

/* Hide default browser disclosure triangle */
summary.abstract-toggle::-webkit-details-marker {
  display: none;
}

.abstract-content {
  margin-top: 0.75rem;
  padding: 1rem;
  background: var(--bg-color);
  border-left: 3px solid var(--link-color);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  border-radius: 0 4px 4px 0;
}

/* ============================================================
   SEMANTIC COLOR CLASSES (preserved from original)
   ============================================================ */

span.coauthors {
  color: var(--link-color);
}

span.coauthors a {
  color: inherit;
}

span.links {
  color: var(--link-color);
}

span.links a {
  color: inherit;
}

span.status {
  color: var(--link-color);
}

span.status a {
  color: inherit;
}

span.abstract {
  color: var(--text-muted);
}

span.abstract a {
  color: inherit;
}

span.extra-info {
  color: var(--text-muted);
}

span.extra-info a {
  color: inherit;
}

/* ============================================================
   TEACHING SECTION
   ============================================================ */

.teaching-section {
  margin-bottom: 3rem;
}

.course-entry {
  padding: 1.5rem;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--shadow);
  margin-bottom: 1.5rem;
  transition: box-shadow 0.3s ease, background-color 0.4s ease, color 0.4s ease;
}

.course-entry:hover {
  box-shadow: 0 4px 6px var(--shadow);
}

.course-title {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.course-details {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.course-links a {
  color: var(--link-color);
  margin-right: 1.5rem;
}

/* ============================================================
   HOME PAGE / PROFILE SECTION
   ============================================================ */

.profile-section {
  margin-top: 2rem;
}

.profile-photo {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
}

.center-image {
  text-align: center;
}

.center-image img {
  display: inline-block;
  margin: 0 auto;
}

/* Home page fits on one laptop screen: tight top margin, capped photo */
.home {
  margin-top: 1rem;
}

.home-photo {
  max-height: 340px;
  width: auto;
  position: relative;
  top: 12px;   /* centers the photo between the navbar and the letter-writers line */
}

.home-links a {
  margin-right: 2.5rem;
}

.refs-label {
  font-weight: 700;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-color);
}

.referee {
  margin-bottom: 0.75rem;   /* gap when the columns stack on phones */
}

/* Shrink-wrap the block so the label's rule ends where the last referee does */
.refs {
  display: inline-block;
}

@media (min-width: 768px) {
  .referee {
    margin-right: 6rem;
  }
  .referee:last-child {
    margin-right: 0;
  }
}

/* Big name heading on the home page: first name bold, surname light */
.home-name {
  font-size: 2.6rem;
  font-weight: 300;
  color: var(--text-color);
  margin-bottom: 1.25rem;
}

.home-name strong {
  font-weight: 700;
}

/* Research page: "Presented at" lines in a light gray, icon included */
.paper-presentations,
.paper-presentations span.status {
  color: var(--text-subtle) !important;
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.5rem 0 2rem 0;
  margin-top: 4rem;
  transition: border-color 0.4s ease, color 0.4s ease, background-color 0.4s ease;
}

footer .row {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

footer .col-12 {
  display: flex;
  flex-direction: column-reverse;
}

footer .col-md-6 {
  width: 100%;
  text-align: center;
}

footer .col-md-6.text-end {
  text-align: center;
}

footer p {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

footer a {
  color: var(--text-muted);
  transition: color 0.3s ease;
}

footer a:hover {
  color: var(--link-color);
}

/* Social media icons in footer */
.social-media-icons {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: -1.8rem;
  margin-bottom: 0.8rem;
}

.social-media-icons a {
  font-size: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 3.2rem;
}

/* ============================================================
   THEME TOGGLE
   ============================================================ */

.theme-toggle-item {
  display: flex;
  align-items: center;
  margin-left: 0.5rem !important;   /* links + toggle sit together on the right */
}

.theme-toggle-btn {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle-btn:hover {
  background: var(--card-bg);
  color: var(--link-color);
}

.theme-toggle-btn:focus {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(176, 79, 97, 0.25);
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.text-muted {
  color: var(--text-muted) !important;
}

.border-top {
  border-top-color: var(--border-color) !important;
}

.border-bottom {
  border-bottom-color: var(--border-color) !important;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

/* Mobile adjustments */
@media (max-width: 576px) {
  body {
    font-size: 16px;
  }

  .paper-entry, .course-entry {
    padding: 1rem;
  }

  .section-title {
    font-size: 1.3rem;
  }

  .paper-title, .course-title {
    font-size: 1.1rem;
  }

  .social-media-icons a {
    margin-left: 0.75rem;
    font-size: 1.3rem;
  }

  .theme-toggle-item {
    margin-top: 0.25rem;
  }
}

/* Tablet adjustments */
@media (min-width: 577px) and (max-width: 768px) {
  .social-media-icons a {
    font-size: 1.4rem;
  }
}

/* Print styles */
@media print {
  body {
    padding-top: 0;
  }

  .navbar, #reading-progress, #theme-toggle {
    display: none;
  }

  .paper-entry, .course-entry {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  details[open] .abstract-content {
    display: block;
  }
}
