/* =============================================
   General Stylesheet for Content Pages
   ============================================= */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800;900&family=Newsreader:opsz,wght@6..72,400..800&display=swap");

/* ================= Reset & Base ================= */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: #ffffff;
  color: #121212;
  font-family: "Newsreader", Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

/* ================= Layout Structure ================= */
.page-container {
  display: flex;
  min-height: 100vh;
}

/* ================= Left Content Area (3/4 width) ================= */
.content-area {
  flex: 3;
  padding: 60px 60px 100px 80px;
  margin-right: 320px; /* Space for fixed sidebar */
}

.content-wrapper {
  max-width: 900px;
}

/* ================= Right Sidebar (1/4 width) ================= */
.sidebar {
  flex: 1;
  max-width: 320px;
  background: #fafafa;
  border-left: 1px solid #e7e3dc;
  display: flex;
  flex-direction: column;
  padding: 40px 30px;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar header */
.sidebar-name {
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  color: #121212;
  margin: 0 0 0 0;
}

/* Sidebar image */
.sidebar-image {
  margin: 0px 0;
  display: flex;
  justify-content: left;
  align-items: left;
  height: 300px;
}

.sidebar-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0.85;
}

.sidebar-image {
  position: relative; /* Allows absolute positioning for children */
  justify-content: center; /* Better centers the content */
  align-items: center;
}

.sidebar-image-display {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.sidebar-image-display.active {
  opacity: 1;
}

/* Ensure the image inside scales correctly */
.sidebar-image-display img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0.85;
}

/* Sidebar navigation */
.sidebar-nav {
  margin: 20px 0 auto 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-nav a,
.sidebar-nav .current {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  color: #121212;
  display: block;
  transition: color 0.2s ease;
}

.sidebar-nav a:hover {
  color: #d21f26;
}

.sidebar-nav .current {
  color: #d21f26;
  position: relative;
  cursor: default;
}

.sidebar-nav .current::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #d21f26;
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
}

.sidebar-title {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5a5856;
  margin-bottom: 6px;
  line-height: 1.3;
}

.sidebar-keywords {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d21f26;
  line-height: 1.4;
}

/* ================= Content Typography ================= */
h1 {
  font-family: "Newsreader", Georgia, serif;
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  color: #d21f26;
  margin: 0 0 30px 0;
}

h2 {
  font-family: "Newsreader", Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  color: #121212;
  margin: 40px 0 20px 0;
}

p {
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.3rem;
  line-height: 1.7;
  color: #121212;
  margin: 0 0 20px 0;
}

.lead {
  font-size: 1.3rem;
  line-height: 1.7;
  color: #5a5856;
  margin-bottom: 30px;
}

a {
  color: #d21f26;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

a:hover {
  border-bottom-color: #d21f26;
}

/* ================= Paper Entries ================= */
.paper-entry {
  border-top: 0;
  padding: 10px 0; 
}

.paper-header {
  cursor: pointer;
  user-select: none;
}

.paper-title-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.paper-chevron {
  color: #5a5856;
  font-size: 0.8rem;
  transition: transform 0.2s ease;
  display: inline-block;
}

.paper-chevron.open {
  transform: rotate(90deg);
}

.paper-title {
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
  color: #121212;
  flex: 1;
}

.paper-header:hover .paper-title {
  color: #d21f26;
}

.paper-meta-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.paper-meta {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 0.9rem;
  color: #5a5856;
}

.paper-meta .journal {
  font-style: italic;
}

.paper-pdf {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #d21f26;
  text-decoration: none;
  border: none;
}

.paper-pdf:hover {
  text-decoration: underline;
  border: none;
}

.paper-description {
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.6;
  color: #5a5856;
  margin-top: 8px;
}

.paper-body {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #f0f0f0;
  max-height: 0; /* Use max-height instead of display */
  overflow: hidden; /* Hide the content when collapsed */
  transition: max-height 0.3s ease-out; /* Animate the transition */
}

.paper-body.open {
  display: block;
}

.paper-body p {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 15px;
}

/* ================= Mobile Styles ================= */
@media (max-width: 968px) {
  .page-container {
    flex-direction: column;
  }
  
  /* Mobile header */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    max-width: none;
    flex-direction: column;
    padding: 0;
    background: #ffffff;
    border-left: none;
    border-bottom: 1px solid #e7e3dc;
    z-index: 100;
  }

  .sidebar-name {
    font-size: 1.3rem;
    margin: 0;
    padding: 12px 20px 8px 20px;
    text-align: center;
  }
  
  .sidebar-image,
  .sidebar-footer {
    display: none;
  }
  
  .sidebar-nav {
    margin: 0;
    padding: 10px 20px 12px 20px;
  }
  
  .sidebar-nav ul {
    flex-direction: row;
    justify-content: center;
    gap: 20px;
  }
  
  .sidebar-nav a,
  .sidebar-nav .current {
    font-size: 0.95rem;
  }
  
  /* Adjust content area */
  .content-area {
    margin-top: 85px; /* Height of fixed header */
    padding: 30px 20px 60px 20px;
    flex: 1;
    width: 100%;
  }
  
  h1 {
    font-size: 2.2rem;
  }
  
  h2 {
    font-size: 1.6rem;
  }
  
  .paper-title {
    font-size: 1.2rem;
  }
  
  .paper-meta-line {
    flex-direction: column;
    gap: 5px;
  }
  
  .paper-pdf {
    display: inline-block;
  }
}

/* ================= Utility Classes ================= */
.section {
  margin-bottom: 50px;
}

.meta {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  color: #5a5856;
  margin-bottom: 20px;
}

.accent {
  color: #d21f26;
}