/*
  article-detail.css
  ─────────────────────────────────────────────────────────────────────
  Styles for /hub/:id article pages (markdown-rendered content).

  Assumes the following are already in style.css (shared shell):
    - CSS custom properties (:root variables)
    - body, html reset
    - .container
    - nav / .nav-logo / .nav-links / .nav-wordmark
    - .site-footer
    - noise grain body::after

  Add Crimson Pro to your shared font import:
    &family=Crimson+Pro:ital,wght@0,300;0,400;1,300;1,400
  ─────────────────────────────────────────────────────────────────────
*/

/* ── Article-scoped tokens ── */
:root {
  --body-font: 'Crimson Pro', Georgia, serif;
  --body-size: 1.2rem;
  --body-lh:   1.85;
  --measure:   68ch;
}

/* ━━ ARTICLE HERO ━━ */
.article-hero {
  padding: 5rem 0 3rem;
  border-bottom: 1px solid var(--dim);
}

.article-eyebrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.eyebrow-line {
  width: 28px;
  height: 1px;
  background: var(--dim);
}
.eyebrow-label {
  font-size: .72rem;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow-date {
  font-size: .6rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-sep {
  color: var(--dim);
  font-size: .6rem;
}

.article-title {
  font-size: clamp(2.4rem, 4.5vw, 4.2rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.03em;
  margin-bottom: 1.5rem;
}

.article-lede {
  font-family: var(--body-font);
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.7;
  max-width: var(--measure);
  font-style: italic;
}

.article-tags {
  display: flex;
  gap: .4rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.article-tag {
  font-size: .65rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  padding: .22rem .65rem;
  border: 1px solid var(--dim);
  color: var(--muted);
  text-decoration: none;
  transition: color .2s, border-color .2s;
}
.article-tag:hover   { color: var(--accent); border-color: rgba(255,0,153,.3); }
.article-tag.primary { color: var(--accent); border-color: rgba(255,0,153,.3); }

/* ━━ ARTICLE LAYOUT ━━ */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 6rem;
  align-items: start;
  padding: 2rem 0 2rem;
}

/* No front matter — body needs to clear the fixed nav */
.article-layout--no-hero {
  padding-top: 1rem;
}

/* ━━ SIDEBAR ━━ */
.article-sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-label {
  font-size: .68rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 1rem 1.4rem .7rem;
  border-bottom: 1px solid var(--dim);
}

.sidebar-meta {
  padding: 1rem 1.4rem;
  font-size: .8rem;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: .06em;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.sidebar-meta span {
  color: var(--structure);
  font-weight: 800;
}

/* TOC */
.toc-list { list-style: none; padding: .4rem 0; }
.toc-item a {
  display: block;
  padding: .5rem 1.4rem;
  font-size: .8rem;
  font-weight: 300;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .03em;
  border-left: 2px solid transparent;
  transition: color .2s, border-color .2s;
  line-height: 1.4;
}
.toc-item a:hover  { color: var(--structure); }
.toc-item.active a { color: var(--accent); border-left-color: var(--accent); }

/* ━━ PROSE ━━ */
/*
  All goldmark-rendered markdown lands inside <article class="prose">.
  Every rule is scoped to .prose so nothing bleeds into the shell.
*/
.prose {
  font-family: var(--body-font);
  font-size: var(--body-size);
  line-height: var(--body-lh);
  color: #c8c8c8;
  /* max-width: var(--measure); */
}

.prose p { margin-bottom: 1.6em; }

/* Headings — Syne for contrast against Crimson Pro body */
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: 'Syne', sans-serif;
  color: var(--structure);
  letter-spacing: -.02em;
  margin: 0.5em 0 .8em;
  line-height: 1.15;
}
.prose h2 {
  font-size: 1.6rem;
  font-weight: 800;
  padding-bottom: .6em;
  border-bottom: 1px solid var(--dim);
}
.prose h3 { font-size: 1.15rem; font-weight: 800; }
.prose h4 {
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Remove top margin on paragraph immediately after a heading */
.prose h2 + p,
.prose h3 + p { margin-top: 0; }

/* Inline emphasis */
.prose strong { font-weight: 600; color: var(--structure); }
.prose em     { font-style: italic; }

/* Links */
.prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,0,153,.25);
  transition: border-color .2s;
}
.prose a:hover { border-color: var(--accent); }

/* Blockquote */
.prose blockquote {
  margin: 2em 0;
  padding: 1.6em 2em;
  border-left: 2px solid var(--accent);
  background: var(--card);
  font-style: italic;
  color: var(--muted);
}
.prose blockquote p      { margin-bottom: 0; }
.prose blockquote strong { color: var(--structure); }

/* Inline code */
.prose code {
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
  font-size: .82em;
  background: var(--card);
  border: 1px solid var(--dim);
  color: var(--accent);
  padding: .1em .4em;
  border-radius: 2px;
}

/* Code block */
.prose pre {
  background: var(--card-alt);
  border: 1px solid var(--dim);
  border-left: 2px solid var(--dim);
  padding: 1.6em 1.8em;
  overflow-x: auto;
  margin: 2em 0;
}
.prose pre code {
  background: none;
  border: none;
  color: #c8c8c8;
  padding: 0;
  font-size: .85rem;
  line-height: 1.7;
}

/* Lists */
.prose ul,
.prose ol   { padding-left: 1.4em; margin-bottom: 1.6em; }
.prose li   { margin-bottom: .5em; padding-left: .4em; }
.prose ul li::marker { color: var(--accent); }
.prose ol li::marker {
  color: var(--muted);
  font-family: 'Syne', sans-serif;
  font-size: .85em;
  font-weight: 800;
}
.prose li > ul,
.prose li > ol { margin: .5em 0 .5em 1em; }

/* Horizontal rule */
.prose hr {
  border: none;
  border-top: 1px solid var(--dim);
  margin: 0.5em 0;
}

/* ━━ PROSE — IMAGES ━━ */

/* Default: block image, full width */
.prose img {
  width: 100%;
  height: auto;
  display: block;
  opacity: .85;
  border: 1px solid var(--dim);
  margin: 2em 0;
}

/* Centered full-width hero image within article body */
.prose img.img-full {
  max-width: 520px;
  margin: 2em auto;
  border-radius: 6px;
  opacity: .9;
}

/* Mobile app screenshots — narrow, inline, rounded */
.prose img.screenshots {
  display: inline-block;
  width: 200px;
  border-radius: 12px;
  opacity: .9;
  margin: 1.5em .5em 1.5em 0;
  vertical-align: top;
  transition: opacity .25s, border-color .25s;
}
.prose img.screenshots:hover { opacity: 1; border-color: var(--muted); }

/* Centered variant */
.prose img.screenshots.center,
.prose img.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* macOS screenshots — wider, less rounded */
.prose img.img-macos {
  display: inline-block;
  width: 220px;
  border-radius: 5px;
  opacity: .9;
  margin: 1.5em .5em 1.5em 0;
  vertical-align: top;
  transition: opacity .25s, border-color .25s;
}
.prose img.img-macos:hover { opacity: 1; border-color: var(--muted); }

/* Inline screenshot groups — flex so they wrap on small screens */
.prose p:has(img.screenshots) {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1.6em;
}
.prose p:has(img.screenshots) img.screenshots { margin: 0; flex-shrink: 0; }

/* Neutralize legacy <font> spacers */
.prose font { display: inline-block; width: .75em; }

/* Accent color for inline product name spans */
.prose .theme-color { color: var(--accent); font-weight: inherit; }

/* ━━ PROSE — TABLES ━━ */

/* Data tables — bordered, for content like role comparisons */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2em 0;
  font-size: 1.0rem;
}
.prose th {
  font-family: 'Syne', sans-serif;
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: left;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--dim);
  font-weight: 400;
}
.prose td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--dim);
  color: var(--muted);
  font-family: var(--body-font);
}
.prose tr:last-child td { border-bottom: none; }
.prose tr:hover td      { background: var(--card); }

/* Image grid tables — headerless tables used for screenshot rows.
   Targeted via :not(:has(th)) since goldmark can't add classes
   to tables from markdown syntax. */
.prose table:not(:has(th)) {
  border: none;
  background: transparent;
}
.prose table:not(:has(th)) td {
  border: none;
  background: transparent;
  padding: .5rem;
  vertical-align: top;
  text-align: center;
}
.prose table:not(:has(th)) td img {
  width: 100%;
  height: auto;
  border: 1px solid var(--dim);
  border-radius: 10px;
  opacity: .9;
  margin: 0;
  display: block;
  transition: opacity .25s;
}
.prose table:not(:has(th)) td img:hover { opacity: 1; }

/* Images inside data table cells (e.g. Pattern Builder two-col layout) */
.prose table:has(th) td img {
  width: 100%;
  max-width: 220px;
  height: auto;
  border: 1px solid var(--dim);
  border-radius: 12px;
  opacity: .9;
  display: block;
  margin: .75rem auto 0;
}

/* ━━ PROSE — TWO-COLUMN DIV LAYOUT ━━ */
/*
  Used in markdown as:
    <div class="img-cols">
      <div class="img-col">...</div>
      <div class="img-col">...</div>
    </div>
  Blank lines required inside divs for goldmark to parse inner markdown.
*/
.prose .img-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  margin: 2em 0;
  align-items: start;
}
.prose .img-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.prose .img-col h4 {
  font-family: 'Syne', sans-serif;
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.prose .img-col p {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.75;
  margin: 0;
}
.prose .img-col img {
  width: 100%;
  max-width: 240px;
  height: auto;
  border: 1px solid var(--dim);
  border-radius: 12px;
  opacity: .9;
  margin: .5rem auto 0;
  display: block;
}

/* ━━ RESPONSIVE ━━ */
@media (max-width: 1024px) {
  .article-layout          { grid-template-columns: 1fr; gap: 3rem; }
  .article-sidebar         { position: static; }
}

@media (max-width: 640px) {
  .article-hero            { padding: 2rem 0 1rem; }
  .article-title           { font-size: 2.2rem; }
  .prose                   { font-size: 1.1rem; }
  .prose .img-cols         { grid-template-columns: 1fr; }
  .prose img.img-macos     { width: 160px; }
  .prose img.screenshots   { width: 160px; }
}