/* ============================================================
   articles.css
   ------------------------------------------------------------
   Article body styling only. The header, navigation, sidebar and
   footer come from the shared shell in /inc/, so this file is
   what styleblog.css used to be minus everything the shell now
   provides.

   Every colour is a theme token. The old file hardcoded #ca8d1c
   borders and #f0e6d2 panels, which is why articles stayed on a
   parchment ground while the rest of the site moved to the night
   sky.
   ============================================================ */

/* ---- running text ------------------------------------------ */

.article-body {
  max-width: 68ch;
  font-family: var(--font-prose);
  color: var(--text-primary);
  font-size: 1.05rem;
  line-height: 1.72;
}

.article-body > :first-child { margin-top: 0; }

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  font-family: var(--font-display);
  color: var(--text-primary);
  line-height: 1.2;
  text-wrap: balance;
  margin: 2.2rem 0 .7rem;
}
.article-body h1 { font-size: 1.9rem; }
.article-body h2 {
  font-size: 1.45rem;
  color: var(--gold);
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--border);
}
.article-body h3 { font-size: 1.2rem; }
.article-body h4 { font-size: 1.05rem; color: var(--text-secondary); }

.article-body p { margin: 0 0 1.1rem; }

.article-body a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.article-body a:hover { color: var(--text-primary); }

.article-body ul,
.article-body ol { margin: 0 0 1.2rem; padding-left: 1.4rem; }
.article-body li { margin: 0 0 .4rem; }

.article-body blockquote {
  margin: 1.4rem 0;
  padding: .1rem 0 .1rem 1.1rem;
  border-left: 3px solid var(--gold-soft);
  color: var(--text-secondary);
  font-style: italic;
}

.article-body code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: .08em .35em;
}

.article-body hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: .95rem;
}
.article-body th,
.article-body td {
  text-align: left;
  padding: .5rem .7rem;
  border-bottom: 1px solid var(--border);
}
.article-body th {
  font-family: var(--font-display);
  color: var(--gold);
  font-weight: 600;
}

/* Wide content must scroll in its own box rather than pushing the page. */
.article-body .scroll-x { overflow-x: auto; }

/* ---- images ------------------------------------------------- */

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.Article-Image-left,
.Article-Image-right {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin: 1.4rem 0;
}
.Article-Image-left  { justify-content: flex-start; }
.Article-Image-right { flex-direction: row-reverse; }

.Article-Image-left img,
.Article-Image-right img {
  max-width: 260px;
  min-width: 120px;
  border: 2px solid var(--gold-soft);
  border-radius: 8px;
  cursor: zoom-in;
}

.Article-image-Left-container { flex-shrink: 0; }
.Article-image-Left-container img {
  height: 200px;
  object-fit: contain;
  display: block;
}

@media (max-width: 640px) {
  .Article-Image-left,
  .Article-Image-right { flex-direction: column; gap: .9rem; }
  .Article-Image-left img,
  .Article-Image-right img { max-width: 100%; }
}

/* ---- embedded map ------------------------------------------- */

.map-embed {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 420px;
  margin: 1.2rem 0;
  border: 2px solid var(--gold-soft);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-0);
}
.map-embed iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---- glossary tabs ------------------------------------------ */

#glossary-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 1.2rem 0 1.4rem;
}
#glossary-tabs button {
  font-family: var(--font-display);
  font-size: .9rem;
  padding: .45rem .9rem;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
#glossary-tabs button:hover {
  border-color: var(--gold-soft);
  color: var(--text-primary);
}
#glossary-tabs button.active,
#glossary-tabs button[aria-selected="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--surface-0);
  font-weight: 600;
}

/* ---- image zoom overlay ------------------------------------- */

#image-zoom-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(4, 6, 16, .88);
  justify-content: center;
  align-items: center;
  padding: 3vmin;
}
#image-zoom-overlay.active { display: flex; }

#zoom-image-wrapper { position: relative; max-width: 94vw; max-height: 94vh; }
#zoomed-img {
  max-width: 94vw;
  max-height: 94vh;
  border-radius: 8px;
  border: 2px solid var(--gold-soft);
  display: block;
}
#zoom-close-button {
  position: absolute;
  top: -.4rem;
  right: -.4rem;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1.4rem;
  line-height: 1;
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
}
#zoom-close-button:hover { border-color: var(--gold); color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  #glossary-tabs button { transition: none; }
}
