/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Georgia, serif;
  background: #fff;
  color: #1a1a1a;
}

:root {
  --gunmetal: #2c3539;
  --link-color: #1a1a2e;
  --meta-color: #666;
  --text-color: #333;
  --muted-color: #555;
  --border-color: #ddd;
  --light-border: #eee;
}

/* === Header === */
#header {
  background: linear-gradient(to bottom, var(--gunmetal) calc(100% - 15px), transparent 100%);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 4.5rem;
  padding-bottom: 0.8rem;
  position: relative;
}
#header h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: normal;
  font-variant: small-caps;
  font-family: "Copperplate", "Copperplate Gothic Light", "Georgia", serif;
  letter-spacing: 0.1em;
  color: #f5f5f5;
}
#header h1 a {
  color: #f5f5f5;
  text-decoration: none;
}
#header h1 a:hover {
  text-decoration: underline;
}
#header nav {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}
#header nav a {
  color: #ccc;
  text-decoration: none;
  font-size: 0.9rem;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  margin-left: 1.5rem;
}
#header nav a:hover {
  color: #fff;
}

/* === Content pages === */
#content {
  max-width: 52rem;
  margin: 2rem auto;
  padding: 0 2rem;
}
#content h2 {
  margin: 0 0 1rem;
}
#content .back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--meta-color);
  text-decoration: none;
  font-size: 0.9rem;
}
#content .back-link:hover {
  text-decoration: underline;
}
.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tag-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--light-border);
}
.tag-list a {
  color: var(--link-color);
  text-decoration: none;
}
.tag-list a:hover {
  text-decoration: underline;
}
.tag-count {
  color: var(--meta-color);
  font-size: 0.85rem;
}

/* === Content Container === */
#main-layout {
  max-width: 950px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 2rem;
}
#articles-col {
  flex: 1;
  min-width: 0;
}
#sidebar {
  width: 220px;
  flex-shrink: 0;
}
#sidebar h3 {
  margin: 0 0 0.8rem;
  font-size: 0.95rem;
  font-weight: normal;
  font-variant: small-caps;
  color: var(--meta-color);
  letter-spacing: 0.03em;
  text-align: center;
}
#tag-cloud {
  position: relative;
  min-height: 200px;
  margin: 0 auto;
}
.tag-cloud-link {
  display: inline-block;
  padding: 0.05rem 0.15rem;
  text-decoration: none;
  line-height: 1.1;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.tag-cloud-link:hover {
  opacity: 0.7;
  text-decoration: underline;
}
.view-all-tags {
  display: block;
  margin-top: 1rem;
  color: var(--link-color);
  text-decoration: none;
  font-size: 0.9rem;
  text-align: center;
}
.view-all-tags:hover {
  text-decoration: underline;
}
@media (max-width: 768px) {
  #main-layout {
    flex-direction: column;
  }
  #sidebar {
    width: 100%;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
  }
}

/* === Controls (Search + Sort) === */
#controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
#search {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem;
  font-family: Georgia, serif;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}
#sort {
  padding: 0.5rem;
  font-family: Georgia, serif;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}

/* === Article Cards === */
.article-card {
  border-bottom: 1px solid var(--border-color);
  padding: 1.2rem 0;
}
.article-card h2 {
  margin: 0;
  font-size: 1.3rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.article-card h2 a {
  color: var(--link-color);
  text-decoration: none;
}
.article-card h2 a:hover {
  text-decoration: underline;
}
.caret {
  font-size: 1rem;
  color: var(--meta-color);
  cursor: pointer;
  transition: transform 0.2s;
  user-select: none;
}
.caret:hover {
  color: #333;
}
.caret.expanded {
  transform: rotate(180deg);
}
.meta {
  color: var(--meta-color);
  font-size: 0.9rem;
  margin: 0.3rem 0;
}
.description {
  color: var(--text-color);
  font-size: 0.95rem;
  margin: 0.5rem 0 0;
}
.abstract {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--light-border);
  color: var(--muted-color);
  font-size: 0.95rem;
  line-height: 1.6;
}
.abstract p {
  margin: 0 0 0.8rem;
  text-align: justify;
}
.abstract p:last-child {
  margin-bottom: 0;
}
.abstract-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.3rem;
}
.abstract-footer p {
  margin: 0;
  flex: 1;
  text-align: justify;
}
.read-more {
  color: var(--link-color);
  text-decoration: none;
  font-variant: small-caps;
  font-size: 1rem;
  white-space: nowrap;
  margin-left: 1rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.read-more .finger {
  font-size: 1.6rem;
}
.read-more:hover {
  text-decoration: underline;
  background: #f5f5f5;
}

/* === Tags === */
.tag-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tag-list a {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: #f0f0f0;
  color: var(--link-color);
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9rem;
}
.tag-list a:hover {
  background: #e0e0e0;
}
.tag-count {
  color: var(--meta-color);
  font-size: 0.8rem;
}
.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--meta-color);
  text-decoration: none;
}
.back-link:hover {
  text-decoration: underline;
}

/* === No Results === */
#no-results {
  display: none;
  color: var(--meta-color);
  font-style: italic;
  padding: 2rem 0;
  text-align: center;
}

/* === Article Viewer (PDF) === */
#adobe-dc-view {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 100px;
  padding-bottom: 120px;
  height: calc(100vh - 100px);
}
#footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(to bottom, transparent 0%, var(--gunmetal) 15px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 101;
}
#footer-title {
  font-size: 1.4rem;
  font-weight: normal;
  font-variant: small-caps;
  font-family: "Copperplate", "Copperplate Gothic Light", "Georgia", serif;
  letter-spacing: 0.1em;
  color: #f5f5f5;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
#footer-title a {
  color: #f5f5f5;
  text-decoration: none;
}
#footer-title a:hover {
  text-decoration: underline;
}
#footer-title.visible {
  transform: translateY(0);
  opacity: 1;
}
#footer-icons {
  display: flex;
  gap: 1rem;
  align-items: center;
}
#footer-icons a {
  color: #f5f5f5;
  font-size: 1.1rem;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}
#footer-icons a:hover {
  opacity: 1;
}
.share-email-wrap {
  position: relative;
}
.share-email-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  background: var(--gunmetal);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  min-width: 140px;
  margin-bottom: 8px;
  z-index: 200;
}
.share-email-menu.open {
  display: block;
}
.share-email-menu a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  color: #f5f5f5;
  font-size: 0.9rem;
  white-space: nowrap;
  opacity: 1;
}
.share-email-menu a:hover {
  background: rgba(255,255,255,0.1);
}
#page-cover {
  display: none;
}

/* === Utility === */
em { font-style: italic; }
strong { font-weight: bold; }

/* === Build ID === */
.build-id {
  font-size: 0.55rem;
  color: #e0e0e0;
  text-align: center;
  padding: 0.4rem 0;
  user-select: none;
  cursor: default;
  letter-spacing: 0.02em;
}
#footer-bar .build-id {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.15);
}
