/*
 * blog.css — shared stylesheet for adverseevent.ai/blog/
 *
 * Inherits the landing-page design tokens so articles feel like part
 * of the same site. Drop this file at /blog/blog.css.
 */

:root {
  --ink:        #0f172a;
  --ink-soft:   #334155;
  --line:       #cbd5e1;
  --line-soft:  #e2e8f0;
  --bg:         #f1f5f9;
  --paper:      #ffffff;
  --band:       #1e6091;
  --band-dark:  #174e75;
  --accent:     #b91c1c;
  --hint:       #64748b;
  --focus:      #2563eb;
  --good:       #15803d;
  --warn:       #b45309;
  --shadow:     0 1px 0 rgba(15,23,42,.04), 0 8px 30px -12px rgba(15,23,42,.18);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16.5px/1.65 "Source Sans 3","Source Sans Pro",system-ui,-apple-system,Segoe UI,sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* ============== Top bar (mirrors the rest of adverseevent.ai) ============== */

.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15,23,42,.04);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center;
  padding: 6px 16px;
  gap: 20px;
}

/* Brand block: logo image + two-tone wordmark, clickable. */
.brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--ink);
  padding: 3px 6px; margin-left: -6px;
  border-radius: 6px;
}
.brand:hover { background: var(--bg); }
.brand-logo {
  display: block;
  height: 28px; width: auto;
  object-fit: contain;
}
.brand .wordmark {
  font-size: 15px; font-weight: 700; letter-spacing: .01em;
  line-height: 1;
}
.brand .wordmark .blue { color: var(--band); }

/* Main menu */
nav.menu {
  display: flex; gap: 2px;
  margin-left: auto;
  align-items: center;
}
nav.menu a {
  position: relative;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600; font-size: 13.5px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background .12s, color .12s;
}
nav.menu a:hover { background: var(--bg); color: var(--ink); }
nav.menu a.active {
  color: var(--band);
  background: #e0f2fe;
}
nav.menu a.active::after {
  content: "";
  position: absolute; left: 12px; right: 12px; bottom: -7px;
  height: 2px; background: var(--band);
  border-radius: 2px 2px 0 0;
}

/* Account slot - the last menu item. On the blog this is just a Sign in
 * link (no JS-driven login state, since the blog is public reading). */
.account-slot { display: inline-flex; }
.account-slot .signin-link {
  /* Inherits the nav.menu a styling - no separate rule needed */
}

/* Mobile hamburger button - hidden on desktop, shown below 820px. */
.menu-toggle {
  display: none;
  appearance: none; background: none; border: 0;
  padding: 6px; border-radius: 6px; cursor: pointer;
  margin-left: auto;
}
.menu-toggle:hover { background: var(--bg); }

@media (max-width: 820px) {
  .topbar-inner { gap: 10px; padding: 6px 12px; flex-wrap: wrap; }
  .menu-toggle { display: inline-flex; }
  nav.menu {
    flex-basis: 100%;
    flex-direction: column;
    gap: 2px;
    max-height: 0; overflow: hidden;
    transition: max-height .2s ease;
    margin: 0;
    align-items: stretch;
  }
  nav.menu.open { max-height: 400px; padding-top: 8px; }
  nav.menu a { padding: 10px 12px; }
  nav.menu a.active::after { display: none; }
  nav.menu a.active {
    border-left: 3px solid var(--band);
    padding-left: 9px;
  }
}

/* ============== Article container ============== */

main.article-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

article.post {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 56px 64px;
  box-shadow: var(--shadow);
}

@media (max-width: 720px) {
  main.article-wrap { padding: 24px 12px 56px; }
  article.post      { padding: 32px 22px; border-radius: 10px; }
}

/* ============== Article header ============== */

article.post header.post-head { margin-bottom: 32px; }
article.post header.post-head .crumb {
  font-size: 13px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  margin-bottom: 16px;
}
article.post header.post-head .crumb a {
  color: var(--hint); text-decoration: none;
}
article.post header.post-head .crumb a:hover {
  color: var(--band); text-decoration: underline;
}
article.post h1.post-title {
  font-size: 34px; line-height: 1.2; letter-spacing: -.015em;
  font-weight: 800; margin: 0 0 14px;
  color: var(--ink);
}
@media (max-width: 720px) {
  article.post h1.post-title { font-size: 26px; }
}
article.post .post-meta {
  font-size: 14px;
  color: var(--hint);
  display: flex; gap: 16px; flex-wrap: wrap;
}
article.post .post-meta time::before { content: "Published "; }

/* ============== Article body typography ============== */

article.post .post-body { font-size: 16.5px; line-height: 1.7; color: var(--ink); }
article.post .post-body > * { max-width: 100%; }

/* Headings inside the article */
article.post .post-body h2 {
  font-size: 24px; line-height: 1.3; letter-spacing: -.005em;
  font-weight: 800; color: var(--ink);
  margin: 44px 0 14px;
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
  padding-top: 32px;
}
article.post .post-body h2:first-child {
  border-top: none; padding-top: 0; margin-top: 0;
}
article.post .post-body h3 {
  font-size: 19px; line-height: 1.35;
  font-weight: 700; color: var(--ink);
  margin: 28px 0 10px;
}
article.post .post-body h4 {
  font-size: 16.5px; line-height: 1.4;
  font-weight: 700; color: var(--ink);
  margin: 20px 0 8px;
}

article.post .post-body p { margin: 0 0 18px; }
article.post .post-body ul,
article.post .post-body ol { margin: 0 0 18px; padding-left: 22px; }
article.post .post-body li { margin-bottom: 6px; }
article.post .post-body li > ul,
article.post .post-body li > ol { margin-top: 6px; margin-bottom: 6px; }

article.post .post-body a {
  color: var(--band); text-decoration: underline; text-underline-offset: 2px;
}
article.post .post-body a:hover { color: var(--band-dark); }

article.post .post-body strong { font-weight: 700; color: var(--ink); }
article.post .post-body em { font-style: italic; }

/* Inline code and code blocks */
article.post .post-body code {
  font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace;
  font-size: 0.88em;
  background: #f1f5f9;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 5px;
  color: #be185d;
}
article.post .post-body pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 16px 18px;
  margin: 0 0 22px;
  overflow-x: auto;
  font-size: 13.5px; line-height: 1.55;
}
article.post .post-body pre code {
  background: transparent; border: 0; padding: 0; color: inherit;
  font-size: inherit;
}

/* Tables */
article.post .post-body table {
  width: 100%; border-collapse: collapse;
  margin: 0 0 22px; font-size: 14.5px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
}
article.post .post-body th,
article.post .post-body td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
article.post .post-body th {
  background: #f8fafc;
  font-weight: 700;
  color: var(--ink);
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
article.post .post-body tr:last-child td { border-bottom: 0; }
article.post .post-body td { color: var(--ink-soft); }
article.post .post-body table { display: block; overflow-x: auto; }

/* Blockquote - default is a regular citation (italic, neutral). */
article.post .post-body blockquote {
  margin: 24px 0;
  padding: 12px 22px;
  border-left: 4px solid var(--line);
  background: #f8fafc;
  color: var(--ink-soft);
  font-style: italic;
  border-radius: 0 6px 6px 0;
}
article.post .post-body blockquote p { margin-bottom: 10px; }
article.post .post-body blockquote p:last-child { margin-bottom: 0; }

/* Blockquote variant: the product callout. Matches blockquotes whose first
 * paragraph contains the "A note from AdverseEvent.ai:" marker. Modern
 * browsers (~95% market share as of 2026) support :has() so this works. */
article.post .post-body blockquote:has(strong:first-child) {
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-left: 4px solid var(--band);
  border-radius: 10px;
  color: var(--ink);
  padding: 20px 24px;
  font-style: normal;
}
article.post .post-body blockquote:has(strong:first-child) strong {
  color: var(--band-dark);
}

/* Horizontal rule */
article.post .post-body hr {
  border: 0;
  height: 1px;
  background: var(--line-soft);
  margin: 36px 0;
}

/* ============== Article footer (footnote: linked articles + author meta) ============== */

article.post footer.post-foot {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
  color: var(--hint);
}

/* ============== Final CTA card (after the article) ============== */

.post-cta {
  max-width: 760px;
  margin: 32px auto 0;
  padding: 0 24px;
}
.post-cta-card {
  background: linear-gradient(135deg, #1e6091 0%, #174e75 100%);
  color: #fff;
  border-radius: 12px;
  padding: 36px 40px;
  text-align: center;
  box-shadow: var(--shadow);
}
.post-cta-card h3 {
  margin: 0 0 8px; font-size: 22px; font-weight: 800;
}
.post-cta-card p {
  margin: 0 0 18px; opacity: .92; font-size: 15px;
}
.post-cta-card a.btn {
  display: inline-block;
  background: #fff; color: var(--band);
  font-weight: 700; font-size: 14.5px;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  transition: transform .08s;
}
.post-cta-card a.btn:hover { transform: translateY(-1px); }

/* ============== Site footer ============== */

/* The blog uses the shared site footer fetched from /code/footer.html
 * (same pattern as the rest of adverseevent.ai). The mount div just
 * needs a top margin so the fetched footer doesn't crash into the
 * post-CTA card above it. The fetched footer brings its own styling. */
#footer-mount { margin-top: 48px; }

/* ============== Blog index page ============== */

main.index-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}
main.index-wrap h1 {
  font-size: 32px; line-height: 1.2;
  font-weight: 800; color: var(--ink);
  margin: 0 0 12px; letter-spacing: -.01em;
}
main.index-wrap .index-sub {
  font-size: 17px; color: var(--ink-soft);
  margin: 0 0 36px; max-width: 640px;
}
.post-list { display: grid; gap: 18px; }
.post-list-item {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 24px 28px;
  text-decoration: none;
  color: inherit;
  transition: transform .08s, box-shadow .12s, border-color .12s;
}
.post-list-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--band);
}
.post-list-item h2 {
  margin: 0 0 8px; font-size: 19px; line-height: 1.35;
  font-weight: 700; color: var(--ink);
}
.post-list-item .item-meta {
  font-size: 13px; color: var(--hint);
  margin-bottom: 12px;
  text-transform: uppercase; letter-spacing: .05em; font-weight: 600;
}
.post-list-item .item-desc {
  font-size: 14.5px; line-height: 1.55;
  color: var(--ink-soft); margin: 0;
}
