/* ============================================================
   article.css — shared styles for jeremiahdillon.com/writing/
   Reuses the design tokens from the homepage (index.html) so
   article pages stay visually consistent with the rest of the
   site. Edit here once; every article + the template updates.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #ffffff;
  --bg-alt:       #f6f9fc;
  --bg-subtle:    #fafbfc;
  --text:         #0a2540;
  --text-2:       #425466;
  --text-3:       #8898aa;
  --indigo:       #5851ea;
  --indigo-deep:  #3d35c7;
  --indigo-soft:  rgba(88, 81, 234, 0.07);
  --indigo-mid:   rgba(88, 81, 234, 0.14);
  --border:       #e3e8ef;
  --border-light: #f0f4f8;
  --shadow-sm:    0 1px 3px rgba(10,37,64,0.08), 0 1px 2px rgba(10,37,64,0.04);
  --shadow-md:    0 4px 16px rgba(10,37,64,0.08), 0 2px 6px rgba(10,37,64,0.04);
  --font:         'Plus Jakarta Sans', system-ui, sans-serif;
  --mono:         'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', monospace;
  --max:          1100px;   /* nav + footer width, matches homepage */
  --measure:      720px;    /* article reading column width        */
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--indigo); }

/* ---------- NAV (mirrors homepage) ---------- */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 2.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}
.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-alt); }
.nav-cta {
  color: var(--indigo) !important;
  background: var(--indigo-soft) !important;
  border: 1px solid var(--indigo-mid) !important;
}
.nav-cta:hover {
  background: rgba(88,81,234,0.12) !important;
  color: var(--indigo-deep) !important;
}

/* ---------- ARTICLE SHELL ---------- */
.article-wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Breadcrumb (visible + mirrored in BreadcrumbList JSON-LD) */
.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.breadcrumb a { color: var(--text-3); text-decoration: none; transition: color 0.15s; }
.breadcrumb a:hover { color: var(--indigo); }
.breadcrumb .sep { color: var(--border); }
.breadcrumb [aria-current="page"] { color: var(--text-2); }

/* ---------- ARTICLE HEADER ---------- */
.article-header { margin-bottom: 2.5rem; }
.article-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--indigo);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.article-title {
  font-size: clamp(2rem, 5vw, 2.85rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 1rem;
}
.article-dek {
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 1.5rem;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-3);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.article-meta .author { color: var(--text-2); font-weight: 600; }
.article-meta .dot { color: var(--border); }

/* ---------- ARTICLE BODY ---------- */
.article-body { font-size: 1.0625rem; color: var(--text-2); }
.article-body > * + * { margin-top: 1.5rem; }

.article-body p { line-height: 1.8; }
.article-body strong { color: var(--text); font-weight: 700; }
.article-body em { font-style: italic; }
.article-body a {
  color: var(--indigo);
  text-decoration: underline;
  text-decoration-color: var(--indigo-mid);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}
.article-body a:hover { text-decoration-color: var(--indigo); }

/* Headings within the article */
.article-body h2 {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 3rem;
}
.article-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-top: 2.5rem;
}
.article-body h2 + p, .article-body h3 + p { margin-top: 0.75rem; }

/* Section divider */
.article-body hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 3rem 0;
}
/* Optional decorative centered divider: <hr class="dots"> */
.article-body hr.dots {
  background: none;
  text-align: center;
  height: auto;
}
.article-body hr.dots::before {
  content: '· · ·';
  color: var(--text-3);
  letter-spacing: 0.4em;
  font-size: 1.1rem;
}

/* Lists */
.article-body ul, .article-body ol { padding-left: 1.4rem; }
.article-body li { line-height: 1.8; margin-top: 0.5rem; }
.article-body li::marker { color: var(--text-3); }
.article-body ul li::marker { color: var(--indigo); }

/* Figures / inline images */
.article-body figure { margin: 2.5rem 0; }
.article-body figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.article-body figcaption {
  font-size: 0.82rem;
  color: var(--text-3);
  text-align: center;
  margin-top: 0.75rem;
  line-height: 1.5;
}
/* Lead/header image sits flush, a touch larger */
.article-lead { margin: 0 0 2.5rem; }
.article-lead img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.article-lead figcaption {
  font-size: 0.82rem;
  color: var(--text-3);
  text-align: center;
  margin-top: 0.75rem;
}

/* Blockquote / pull quote */
.article-body blockquote {
  border-left: 3px solid var(--indigo);
  background: var(--indigo-soft);
  padding: 1.1rem 1.4rem;
  border-radius: 0 10px 10px 0;
  margin: 2rem 0;
}
.article-body blockquote p { color: var(--text); font-size: 1.05rem; line-height: 1.7; }
.article-body blockquote p + p { margin-top: 0.75rem; }
.article-body blockquote cite {
  display: block;
  font-style: normal;
  font-size: 0.85rem;
  color: var(--text-3);
  margin-top: 0.6rem;
}
.article-body blockquote cite a { color: var(--text-3); }

/* Callout / note box */
.callout {
  display: flex;
  gap: 0.9rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.3rem;
  margin: 2rem 0;
}
.callout-icon {
  flex-shrink: 0;
  width: 1.5rem; height: 1.5rem;
  color: var(--indigo);
}
.callout-body { font-size: 0.95rem; color: var(--text-2); line-height: 1.65; }
.callout-body strong { color: var(--text); }
.callout-body > * + * { margin-top: 0.5rem; }
.callout.accent { background: var(--indigo-soft); border-color: var(--indigo-mid); }

/* Inline code + code blocks */
.article-body code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--indigo-soft);
  color: var(--indigo-deep);
  padding: 0.12em 0.4em;
  border-radius: 5px;
}
.article-body pre {
  background: #1e1e1e;
  border-radius: 10px;
  padding: 1.4rem 1.6rem;
  overflow-x: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.12);
}
.article-body pre code {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.7;
  background: none;
  color: #d4d4d4;
  padding: 0;
  border-radius: 0;
  white-space: pre;
}

/* Code window (matches homepage "Why?" component) for titled code blocks */
.code-window {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.12);
  margin: 2.5rem 0;
}
.code-titlebar {
  background: #323232;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.code-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #ffbd2e; }
.dot-green  { background: #28c840; }
.code-filename {
  font-size: 0.75rem;
  color: #9d9d9d;
  margin-left: 0.375rem;
  font-family: var(--mono);
}
.code-window .code-body {
  background: #1e1e1e;
  padding: 1.4rem 1.6rem;
  overflow-x: auto;
}
.code-window pre { box-shadow: none; padding: 0; border-radius: 0; }

/* Syntax tokens (VS Code-style) — used in <pre><code> and .code-window.
   Stay true to a real syntax theme: comments green, keys blue, strings
   orange, punctuation muted. Bold variants add hierarchy where wanted. */
.tok-hd  { color: #6a9955; font-weight: 700; }   /* heading comment — bold green */
.tok-cmt { color: #6a9955; }                     /* comment        — green       */
.tok-lbl { color: #9cdcfe; font-weight: 700; }   /* key / label    — bold blue    */
.tok-key { color: #9cdcfe; }                     /* key            — blue         */
.tok-str { color: #ce9178; }                     /* string value   — warm orange  */
.tok-num { color: #b5cea8; }                     /* number         — soft green    */
.tok-pun { color: #808080; }                     /* punctuation    — gray          */

/* ---------- LIGHTBOX ---------- */
.article-body figure img,
.article-lead img { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  background: rgba(10, 37, 64, 0.66);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.lightbox.open { opacity: 1; }
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 82vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 1.1rem;
  right: 1.3rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.28); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 2rem 0; }
.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.article-body th, .article-body td {
  text-align: left;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.article-body thead th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.article-body tbody tr:hover { background: var(--bg-subtle); }

/* "Built with" credit line (italic colophon at article end) */
.article-colophon {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-3);
  margin-top: 2.5rem;
}

/* ---------- DISTRIBUTION / CANONICAL NOTE ---------- */
.distribution {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: center;
}
.distribution a {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.distribution a:hover { color: var(--indigo); }
.distribution .dot { color: var(--border); }

/* ---------- AUTHOR BIO ---------- */
.author-bio {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-top: 3rem;
  padding: 1.75rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.author-bio img {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.author-bio-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.author-bio-name a { color: inherit; text-decoration: none; }
.author-bio-name a:hover { color: var(--indigo); }
.author-bio-text { font-size: 0.9rem; color: var(--text-2); line-height: 1.6; }
.author-bio-links { margin-top: 0.6rem; display: flex; flex-wrap: wrap; gap: 0.9rem; }
.author-bio-links a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-3);
  text-decoration: none;
}
.author-bio-links a:hover { color: var(--indigo); }

/* ---------- ARTICLE FOOTER NAV ---------- */
.article-foot-nav {
  margin-top: 3rem;
  display: flex;
  justify-content: center;
}
.back-to-writing {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--indigo);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.back-to-writing:hover { color: var(--indigo-deep); }

/* ---------- SITE FOOTER (mirrors homepage) ---------- */
footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-copy { font-size: 0.825rem; color: var(--text-3); }
.footer-copy a { color: inherit; }
.footer-links { display: flex; gap: 1.5rem; list-style: none; }
.footer-links a {
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .nav-inner { padding: 0 1.25rem; gap: 0.5rem; }
  .nav-links { gap: 0.1rem; }
  .nav-links a { padding: 0.4rem 0.55rem; font-size: 0.82rem; }
  .article-wrap { padding: 1.5rem 1.25rem 3rem; }
  .footer-inner { padding: 1.75rem 1.25rem; flex-direction: column; align-items: flex-start; }
  .author-bio { flex-direction: column; gap: 1rem; }
}
@media (max-width: 480px) {
  .nav-logo { display: none; }
  .nav-links a { padding: 0.4rem 0.45rem; font-size: 0.8rem; }
}
