/* --- Jump Link Offsets & Smooth Scrolling --- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

/* Article page specific styles */
.article-page {
  margin-top: 40px;
}

.breadcrumb {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 30px;
}

.breadcrumb a {
  color: var(--text-muted);
}
.breadcrumb a:hover {
  color: var(--journal-blue);
}

.article-grid {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 50px;
}

/* CRITICAL FIX: Prevents wide tables from blowing out the CSS grid and shrinking the sidebar */
.article-content {
  min-width: 0;
}

.article-header {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.article-title {
  font-size: 2.2rem;
  line-height: 1.25;
  margin: 15px 0;
  color: #111;
  font-weight: 700;
}

.author-list {
  font-size: 1.15rem;
  margin-bottom: 20px;
}

.author {
  color: var(--journal-blue);
}

.affiliations {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
  margin-bottom: 20px;
}

.article-dates {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  background: var(--bg-light);
  padding: 15px;
  border-left: 3px solid var(--journal-orange);
  border-radius: 0 4px 4px 0;
  color: var(--text-muted);
}

.article-dates strong {
  color: var(--journal-blue);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.article-history {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
  margin-bottom: 8px;
}

.history-divider {
  color: #cccccc;
}

.article-doi-section {
  margin-top: 8px;
}

.article-doi-section a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Article Body Sections --- */
.article-section {
  margin-bottom: 40px;
}

.article-section h2 {
  color: var(--journal-blue);
  margin-bottom: 15px;
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 5px;
}

.article-section h3 {
  margin: 20px 0 10px;
  font-size: 1.2rem;
}

.article-section p {
  margin-bottom: 15px;
  text-align: justify;
  font-size: 1.05rem;
}

.abstract {
  background: #fdfdfd;
  padding: 25px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.keywords {
  margin-top: 20px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

/* --- Figures Utilities (Imported from AOSOpen & tailored) --- */
.figure-placeholder {
  background-color: var(--bg-light);
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  margin: 20px 0 10px 0;
  font-family: var(--font-ui);
  color: var(--text-muted);
  border-radius: 4px;
}

.article-figure figcaption {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.article-figure img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 20px auto;
  /* border: 1px solid var(--border-color); */
  border-radius: 4px;
}

/* --- Dynamic Table Styling (From table_cleaner.php) --- */
.table-title {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  color: var(--text-main);
  margin: 35px 0 5px 0;
  font-weight: 600;
  text-align: left;
}

.table-title span {
  color: var(--journal-blue);
  text-transform: uppercase;
  font-weight: 700;
  margin-right: 8px;
}

.table-footnote {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.4;
  text-align: left;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  margin: 20px 0;
}

.journal-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  min-width: 600px;
}

.journal-table th,
.journal-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.journal-table th {
  background-color: var(--journal-blue);
  color: #ffffff;
  font-weight: 600;
}

.journal-table tr:hover {
  background-color: #f9f9f9;
}

/* --- Dynamic References Styling (From reference_cleaner.php) --- */
.article-references ol {
  margin-left: 20px;
  font-size: 0.95rem;
  text-align: justify;
  margin-top: 20px;
}

.article-references li {
  margin-bottom: 12px;
}

/* --- Sidebar Tools --- */
.sidebar-box {
  border: 1px solid var(--border-color);
  padding: 20px;
  margin-bottom: 25px;
  border-radius: 4px;
  background: var(--bg-light);
}

.sidebar-box h3 {
  font-family: var(--font-ui);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  color: var(--journal-blue);
}

.btn-primary {
  display: inline-block;
  background: var(--journal-blue);
  color: white !important;
  padding: 12px;
  text-align: center;
  border-radius: 4px;
  font-family: var(--font-ui);
  font-weight: 600;
  margin-bottom: 10px;
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background: var(--journal-cyan);
}

.btn-outline {
  display: inline-block;
  border: 1px solid var(--journal-blue);
  color: var(--journal-blue) !important;
  padding: 10px 16px;
  border-radius: 4px;
  font-family: var(--font-ui);
  font-weight: 600;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-outline:hover {
  background: var(--journal-blue);
  color: white !important;
}

.full-width {
  width: 100%;
  display: block;
}

.toc-list {
  list-style: none;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}

.toc-list li {
  margin-bottom: 10px;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 900px) {
  .article-grid {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }

  .article-sidebar {
    order: -1;
    margin-top: 0;
    margin-bottom: 10px;
  }

  .article-body,
  .article-content {
    order: 2;
  }
}

@media (max-width: 768px) {
  .article-header {
    padding-bottom: 15px;
  }

  .full-article-title {
    font-size: 1.8rem;
  }

  /* --- NEW MOBILE OVERRIDES FOR THE DATES BOX --- */
  .article-history {
    flex-direction: column; /* Stacks the dates vertically */
    align-items: flex-start;
    gap: 8px;
  }

  .history-divider {
    display: none; /* Hides the awkward vertical lines on mobile */
  }

  .article-doi-section {
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px dashed var(--border-color); /* Adds a clean separator above the DOI */
  }
}
