/* styles.css */

:root {
  --primary: #634b35;      /* Rich dirt/rock brown */
  --accent: #687456;       /* Olive green from water reflection */
  --accent-hover: #4e5740; /* Darker olive */
  --bg-color: #f5f3ee;     /* Light sandstone/off-white */
  --card-bg: #ffffff;
  --text-main: #3b3530;    /* Dark earthy grey-brown */
  --text-muted: #7a7268;   /* Muted brownish grey */
  --border-color: #dfd8c8; /* Sandy border */
  --panel-bg: #ebe5d5;     /* Light tan */
}

body {
  font-family: "Lato", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  scroll-behavior: smooth;
}

.content-wrapper {
  max-width: 1000px;
  margin: 80px auto 40px auto;
  padding: 0 10px;
}

/* Hero Banner */
.banner-container {
  max-width: 1200px;
  margin: 46px auto 0 auto;
}

.banner-img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
}

/* About Section */
.about-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2.5rem;
  max-width: 800px;
  margin: 3rem auto;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.about-section h2 {
  color: var(--primary);
  font-weight: 700;
}

.about-section a {
  color: var(--accent);
  text-decoration: none;
}

.about-section a:hover {
  text-decoration: underline;
}

/* Recent Publications Grid Section */
.recent-section {
  background-color: #38342e; /* Deep earthy muddy brown */
  color: #f5f3ee;
  padding: 4rem 1rem;
  margin-top: 4rem;
}

.recent-container {
  max-width: 1000px;
  margin: 0 auto;
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.recent-card {
  background: var(--card-bg);
  color: var(--text-main);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.recent-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.recent-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-color);
}

.recent-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.recent-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.recent-card-authors {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.75rem;
}

.recent-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
  flex-grow: 1;
}

.recent-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.action-btn {
  flex: 1;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  color: var(--accent);
  padding: 0.4rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
}

.action-btn:hover {
  background: #dfd8c8;
  text-decoration: none;
}

.action-btn:focus-visible {
  outline: 2px solid var(--accent);outline-offset: 2px;
}

/* Floating Back to Top Button Styling */
#backToTopBtn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 99;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s ease, transform 0.2s ease;
}

#backToTopBtn.show {
  opacity: 1;
  visibility: visible;
}

#backToTopBtn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
}

#backToTopBtn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .recent-grid {
    grid-template-columns: 1fr;
  }
  #backToTopBtn { bottom: 20px; right: 20px; width: 40px; height: 40px; }
}

/* CV Page Styles */
.cv-section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  margin: 2.5rem 0 1.5rem 0;
  text-align: center;
  letter-spacing: 1px;
}

.cv-grid {
  display: grid;
  gap: 1.5rem;
}

.cv-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cv-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.cv-role {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 0.25rem 0;
}

.cv-org-date {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-style: italic;
}

.cv-badge {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--panel-bg); 
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
  font-style: normal;
}

.cv-details {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.6;
}

.cv-details a {
  color: var(--accent);
  text-decoration: none;
}

.cv-details a:hover {
  text-decoration: underline;
}

/* Projects Page Styles */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.project-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-color);
}

.project-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.project-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.project-date {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--panel-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
  align-self: flex-start;
}

.project-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
  flex-grow: 1;
}

.project-desc a {
  color: var(--accent);
  text-decoration: none;
}

.project-desc a:hover {
  text-decoration: underline;
}

/* Modifies the global .action-btn for Project cards */
.project-body .action-btn {
  width: 100%;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

@media (max-width: 768px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}

/* Publications Page Styles */
.action-btn:focus-visible, .filter-btn:focus-visible, .clear-search-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.search-section {
  max-width: 700px;
  margin: 2rem auto 3rem auto;
  text-align: center;
}

.search-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 1rem;
}

.search-input {
  width: 100%;
  padding: 1rem 3rem 1rem 3rem; /* padded right for clear button */
  font-size: 1.1rem;
  border: 2px solid var(--border-color);
  border-radius: 50px;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23a0aec0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>') no-repeat 1.2rem center;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(104, 116, 86, 0.15); /* olive accent */
}

.clear-search-btn {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.clear-search-btn:hover {
  color: var(--text-main);
  background-color: var(--border-color);
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.filter-btn {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Co-Author Bubbles */
.coauthor-section {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.coauthor-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.coauthor-bubbles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.coauthor-bubble {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.75rem 0.25rem 0.25rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.coauthor-bubble:hover, .coauthor-bubble.active {
  border-color: var(--accent);
  background: var(--panel-bg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.coauthor-img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--border-color); /* Placeholder colour */
  background-size: cover;
  background-position: center;
  display: inline-block;
  border: 1px solid white;
}

.coauthor-bubble:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Pub Cards */
.pub-grid {
  display: grid;
  gap: 1.5rem;
}

.pub-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.pub-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.pub-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.pub-venue-badge {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--panel-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.pub-citation {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
  flex-grow: 1;
}

.pub-citation strong {
  color: var(--text-main);
}

/* Action Bar */
.action-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.right-actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.action-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.action-btn:hover {
  background: var(--panel-bg);
  border-color: #cbd5e1;
}

.action-btn.active-tab {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.action-btn.external-btn {
  background: var(--panel-bg);
  color: var(--accent);
  border-color: transparent;
}

.action-btn.external-btn:hover {
  background: var(--border-color);
  text-decoration: none;
}

/* Expandable Panels */
.content-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  margin-top: 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-main);
  animation: fadeIn 0.3s ease;
}

.panel-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: bold;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

.book-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.book-image {
  width: 100px;
  border-radius: 4px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

@media (max-width: 600px) {
  .book-layout { flex-direction: column; }
  .right-actions { margin-left: 0; width: 100%; }
  .right-actions .action-btn { flex: 1; justify-content: center; }
}
/* --- Layout Fixes --- */

/* Stop Overview/Abstract buttons from stretching and crushing the right-side buttons */
.pub-card .action-btn {
  flex: none;
  white-space: nowrap; 
}

/* Pull all page content up to sit immediately below the navigation bar */
.content-wrapper {
  margin-top: 50px; 
}

/* Remove default heavy top padding from Projects and Publications headers */
header.w3-padding-32 {
  padding-top: 0.3rem !important;
}

/* Remove excess top margin from the first heading on the CV page */
.cv-section-title:first-of-type {
  margin-top: 0.5rem;
}