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

/* Header & Titles */
.article-header-section {
  padding: 40px 0;
}
.article-breadcrumbs {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 15px;
  text-transform: uppercase;
}
.full-article-title {
  font-size: 2.5rem;
  color: var(--navy-blue);
  line-height: 1.2;
  margin-bottom: 20px;
}
.full-article-authors {
  font-size: 1.2rem;
  margin-bottom: 15px;
}

/* Abstract & Article Body Layout */
.article-body {
  background: var(--white);
  padding: 40px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  min-width: 0;
}

.abstract-box {
  background-color: rgba(245, 184, 0, 0.1);
  padding: 30px;
  border-left: 4px solid var(--gold-primary);
  margin-bottom: 40px;
}
.abstract-box h2 {
  margin-bottom: 15px;
  font-family: var(--font-sans);
  text-transform: uppercase;
  font-size: 1.1rem;
  letter-spacing: 1px;
}
.abstract-box p {
  margin-bottom: 15px;
}

.article-divider {
  border: 0;
  border-top: 1px solid #ccc;
  margin: 40px 0;
}

/* Figures & Tables */
.figure-placeholder {
  background-color: #eee;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ccc;
  margin: 20px 0 10px 0;
  font-family: var(--font-sans);
  color: #555;
}
.article-figure figcaption {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 20px;
}

/* --- Table Title UI --- */
.table {
  margin: 20px 0;
}
.table-title {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--text-main);
  margin: 35px 0 5px 0;
  font-weight: 600;
  text-align: left;
}
.table-title span {
  color: var(--navy-blue);
  text-transform: uppercase;
  font-weight: 700;
  margin-right: 8px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
}
.table-responsive .journal-table {
  margin: 0;
  min-width: 600px;
}
.journal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-family: var(--font-sans);
  font-size: 0.95rem;
}
.journal-table th,
.journal-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}
.journal-table th {
  background-color: var(--navy-blue);
  color: var(--white);
  font-weight: 600;
}
.journal-table tr:hover {
  background-color: #f9f9f9;
}

/* References */
.article-references h2 {
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
  display: block;
}
.article-references ol {
  margin-left: 20px;
  font-size: 0.95rem;
  text-align: justify;
  margin-top: 20px; /* Explicitly forces the gap in Edge */
}
.article-references li {
  margin-bottom: 12px;
}

/* Sticky Tools Sidebar */
.sticky-widget {
  position: sticky;
  top: 80px;
}
.tool-list {
  list-style: none;
}
.tool-list li {
  margin-bottom: 10px;
}
.toc-list {
  list-style: none;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  margin-top: 8px;
}
.toc-list li {
  margin-bottom: 8px;
}
.toc-list a {
  color: var(--text-main);
}
.toc-list a:hover {
  color: var(--navy-blue);
  font-weight: 600;
}

/* Affiliations Dropdown */
.author-affiliations-wrapper {
  margin-bottom: 25px;
}
.affiliations-toggle {
  background: none;
  border: none;
  color: var(--navy-blue);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.affiliations-toggle:hover {
  color: var(--gold-primary);
}
/* Smooth rotation for the dropdown arrow */
.toggle-icon {
  display: inline-block;
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.toggle-icon.rotated {
  transform: rotate(180deg);
}
.author-affiliations {
  /* Switch from display: none to a CSS Grid animation */
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;

  /* Reset margins/paddings so they animate smoothly too */
  margin-top: 0;
  padding-top: 0;
  border-top: 1px dashed transparent;

  /* The animation timing */
  transition:
    grid-template-rows 0.3s ease-out,
    opacity 0.3s ease-out,
    margin-top 0.3s ease-out,
    padding-top 0.3s ease-out,
    border-color 0.3s ease-out;
}

/* Moves the hidden overflow to the new wrapper */
.affiliations-inner {
  overflow: hidden;
}

.author-affiliations ol {
  padding-left: 25px;
  margin-left: 0;
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 0;
}

/* Styling for the separated corresponding author */
.corresponding-author {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-main);
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}
.corresponding-author strong {
  color: var(--navy-blue);
}

/* Adds a bit of breathing room between the authors to match your original design */
.author-affiliations li {
  margin-bottom: 6px;
}

.author-affiliations.expanded {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px dashed var(--border-color);
}

/* Article Metadata Panel (The Upgraded UI) */
.article-metadata-panel {
  background-color: #f8f9fa;
  border-left: 4px solid var(--navy-blue);
  border-radius: 0 4px 4px 0;
  padding: 16px 20px;
  margin-bottom: 35px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.article-history {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
}
.article-history span strong,
.article-doi-section strong {
  color: var(--navy-blue);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.8px;
  margin-right: 5px;
}
.history-divider {
  color: #d0d0d0;
  font-size: 1rem;
}
.article-doi-section {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  border-top: 1px dashed #e0e0e0;
  padding-top: 12px;
}
.article-doi-section a {
  color: var(--navy-blue);
  word-break: break-word;
  transition: color 0.2s;
}
.article-doi-section a:hover {
  color: var(--gold-primary);
}
.article-identifiers,
.author-affiliations,
.article-identifiers a {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* --- Fix: Move Article Tools above the Article on Mobile --- */
@media (max-width: 900px) {
  .article-grid {
    display: flex;
    flex-direction: column;
  }

  .article-sidebar {
    order: -1; /* Forces the sidebar to jump to the very top */
    margin-top: 0;
    margin-bottom: 10px;
  }

  .article-body {
    order: 2; /* Keeps the main article below the tools */
  }
}

/* Article Page Mobile Adjustments */
@media (max-width: 768px) {
  .article-header-section {
    padding: 25px 0;
  }
  .full-article-title {
    font-size: 1.8rem;
    margin-bottom: 15px;
  }
  .article-body {
    padding: 15px;
    width: 100%;
    overflow-x: hidden;
  }
  .abstract-box {
    padding: 15px;
    margin-bottom: 20px;
    width: 100%;
  }
  .article-sidebar {
    margin-top: 20px;
  }
  .sticky-widget {
    position: static;
  }
  .figure-placeholder {
    height: 200px;
  }
  .author-affiliations ol {
    margin-left: 15px;
    padding-right: 10px;
  }
  .article-identifiers {
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  .article-history {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .history-divider {
    display: none;
  }
}
