/* SpecPeek Engineering Deep Dive — long-form technical article layout
   Extends /styles.css tokens; zero inline styles for strict CSP style-src 'self'. */

.article-main {
  padding: 36px 0 76px;
}

.article-shell {
  max-width: 1060px;
  margin: 0 auto;
}

/* Header & metadata */
.article-header {
  max-width: 820px;
  margin-bottom: 26px;
}

.article-breadcrumb {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.article-breadcrumb a {
  color: var(--text-muted);
}

.article-breadcrumb a:hover {
  color: var(--cyan);
}

.article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.article-kicker-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(56, 189, 248, 0.08);
  color: var(--ice);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.article-meta-sep {
  opacity: 0.45;
}

.article-header h1 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.15vw, 2.52rem);
  line-height: 1.16;
  letter-spacing: -0.032em;
  font-weight: 800;
  color: #f8fafc;
  text-wrap: balance;
}

.article-header h1 code {
  font-size: 0.88em;
  color: var(--ice);
  background: rgba(56, 189, 248, 0.09);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 1px 7px;
  border-radius: 6px;
  font-weight: 700;
}

.article-dek {
  margin: 0 0 16px;
  font-size: 1.03rem;
  line-height: 1.62;
  color: var(--text-muted);
  max-width: 74ch;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-tags li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #b7c2d4;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 9px;
}

/* Cover figure */
.article-cover {
  margin: 0 0 38px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--bg-panel);
  box-shadow: 0 28px 70px -34px rgba(0, 0, 0, 0.9);
}

.article-cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1000 / 420;
  object-fit: cover;
  background: #0a0d14;
}

.article-cover figcaption {
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  background: #0a0c11;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.55;
  color: var(--text-dim);
}

/* Compact mobile/tablet pill CTA (shown only <=1040px when sticky .rail-card is hidden) */
.article-mobile-cta {
  display: none;
}

/* 2-column reading layout: ~72ch prose + sticky TOC rail */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 740px) 248px;
  gap: 44px;
  align-items: start;
  justify-content: space-between;
}

.article-rail {
  position: sticky;
  top: 76px;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.article-toc,
.rail-card {
  padding: 16px 18px;
  background: var(--card-grad), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--inset-hi);
}

.article-toc-title,
.rail-card-title {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.article-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.article-toc a {
  display: block;
  font-size: 0.82rem;
  line-height: 1.42;
  color: var(--text-muted);
  padding: 2px 0 2px 10px;
  border-left: 2px solid transparent;
  transition: color 0.14s ease, border-color 0.14s ease;
}

.article-toc a:hover {
  color: var(--ice);
  border-left-color: var(--cyan);
  text-decoration: none;
}

.rail-specs {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--text-muted);
}

.rail-specs li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.rail-specs li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.rail-specs strong {
  color: #e6edf7;
  font-weight: 600;
  text-align: right;
}

.rail-card .btn {
  width: 100%;
  margin-top: 12px;
}

/* Long-form engineering prose */
.article-prose {
  min-width: 0;
  max-width: 740px;
  font-size: 1.01rem;
  line-height: 1.76;
  color: #cfd6e3;
}

.article-prose > p:first-child {
  font-size: 1.06rem;
  color: #dde3ee;
}

.article-prose p {
  margin: 0 0 1.2em;
}

.article-prose strong {
  color: #f3f6fb;
  font-weight: 600;
}

.article-prose em {
  color: #e4eaf4;
}

.article-prose a {
  color: var(--ice);
  text-decoration: underline;
  text-decoration-color: rgba(125, 211, 252, 0.35);
  text-underline-offset: 3px;
}

.article-prose a:hover {
  color: #bae6fd;
  text-decoration-color: var(--cyan);
}

.article-prose code {
  font-size: 0.84em;
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.085);
  border: 1px solid rgba(56, 189, 248, 0.16);
  padding: 1px 5.5px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}

.article-prose h2 {
  margin: 2.35em 0 0.8em;
  padding-top: 1.35em;
  border-top: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
  line-height: 1.26;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: #f8fafc;
  scroll-margin-top: 76px;
}

.article-prose h2 code,
.article-prose h3 code {
  font-size: 0.88em;
  padding: 1px 6px;
}

.article-prose h3 {
  margin: 1.8em 0 0.65em;
  font-size: 1.1rem;
  line-height: 1.36;
  letter-spacing: -0.015em;
  font-weight: 700;
  color: #ecf2fa;
  scroll-margin-top: 76px;
}

.article-prose ol,
.article-prose ul {
  margin: 0 0 1.35em;
  padding-left: 1.45em;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.72em;
}

.article-prose li {
  min-width: 0;
  padding-left: 2px;
}

.article-prose li::marker {
  color: var(--cyan);
  font-weight: 600;
}

.article-prose li > ul {
  margin: 0.65em 0 0.25em;
  gap: 0.45em;
}

.article-prose li > .article-code {
  margin: 0.85em 0 0.75em;
}

/* Callouts */
.article-callout {
  margin: 1.55em 0;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-left: 3px solid var(--amber);
  background: rgba(245, 158, 11, 0.06);
  font-size: 0.93rem;
  line-height: 1.66;
  color: #e2e8f0;
}

.article-callout p {
  margin: 0;
}

.article-callout strong {
  color: #fde68a;
}

.article-question {
  margin: 2em 0 0;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(56, 189, 248, 0.26);
  border-left: 3px solid var(--cyan);
  background: rgba(56, 189, 248, 0.055);
  font-size: 0.95rem;
  line-height: 1.68;
  color: #dce5f2;
}

.article-question p {
  margin: 0;
}

/* Syntax-highlighted dark code blocks */
.article-code {
  max-width: 100%;
  min-width: 0;
  margin: 1.35em 0 1.55em;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: #06080c;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.article-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 15px;
  background: #0b0e14;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--text-muted);
}

.article-code-lang {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ice);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.article-code pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.81rem;
  line-height: 1.68;
  color: #dbe5f4;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
}

.article-code pre:focus-visible,
.article-table-wrap:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: -2px;
}

.article-code pre code {
  display: block;
  background: none;
  border: 0;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  overflow-wrap: normal;
  white-space: pre;
}

.tok-kw { color: #c084fc; }
.tok-fn { color: #7dd3fc; }
.tok-str { color: #6ee7b7; }
.tok-key { color: #93c5fd; }
.tok-num { color: #fcd34d; }
.tok-type { color: #f9a8d4; }
.tok-cmt { color: #768399; font-style: italic; }

/* Technical data tables */
.article-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 1.45em 0 1.65em;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  -webkit-overflow-scrolling: touch;
}

.article-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.55;
}

.article-table th,
.article-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
  vertical-align: top;
}

.article-table thead th {
  background: #0b0e14;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.article-table tbody tr:last-child td {
  border-bottom: 0;
}

.article-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.article-table td:first-child {
  color: #e6edf7;
  font-weight: 600;
}

.article-table code {
  font-size: 0.8em;
}

/* Bottom restrained engineering conversion card */
.article-cta-section {
  margin-top: 56px;
  padding-top: 38px;
  border-top: 1px solid var(--border);
}

.article-cta-card {
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(56, 189, 248, 0.25);
  background:
    radial-gradient(75% 110% at 0% 0%, rgba(56, 189, 248, 0.09), transparent 60%),
    radial-gradient(60% 100% at 100% 100%, rgba(16, 185, 129, 0.07), transparent 60%),
    var(--bg-card);
  box-shadow: var(--inset-hi);
}

.article-cta-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
}

.article-cta-kicker {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--emerald-bright);
}

.article-cta-head h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.2vw, 1.55rem);
  letter-spacing: -0.025em;
  line-height: 1.22;
  color: #f8fafc;
}

.article-cta-head p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 64ch;
}

.article-cta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.article-tool-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(7, 9, 13, 0.72);
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.article-tool-link:hover {
  text-decoration: none;
  border-color: rgba(56, 189, 248, 0.42);
  transform: translateY(-2px);
}

.article-tool-link h3 {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.35;
  color: #f8fafc;
}

.article-tool-link p {
  flex: 1;
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.article-tool-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--emerald-bright);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 999px;
  padding: 2px 8px;
}

.article-tool-go {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ice);
}

.article-cta-ext {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.article-cta-ext-copy {
  max-width: 56ch;
}

.article-cta-ext-copy strong {
  display: block;
  font-size: 0.96rem;
  color: #f8fafc;
  margin-bottom: 3px;
}

.article-cta-ext-copy span {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.article-cta-ext-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Responsive */
@media (max-width: 1040px) {
  .article-cover {
    margin-bottom: 18px;
  }

  .article-mobile-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 14px;
    max-width: 740px;
    margin: 0 0 24px;
    padding: 11px 15px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(56, 189, 248, 0.22);
    background:
      linear-gradient(135deg, rgba(56, 189, 248, 0.065), rgba(16, 185, 129, 0.04)),
      var(--bg-card);
    box-shadow: var(--inset-hi);
  }

  .article-mobile-cta-copy {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.42;
    color: #dbe5f4;
  }

  .article-mobile-cta-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
  }

  .article-mobile-cta-actions .btn {
    font-size: 0.78rem;
    padding: 6px 11px;
  }

  .article-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .article-rail {
    position: static;
    order: -1;
    max-width: 72ch;
  }

  .rail-card {
    display: none;
  }

  .article-cta-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .article-main {
    padding: 24px 0 56px;
  }

  .article-header h1 {
    font-size: 1.56rem;
    line-height: 1.18;
  }

  .article-dek {
    font-size: 0.94rem;
  }

  .article-cover {
    margin-bottom: 16px;
    border-radius: var(--radius-md);
  }

  .article-mobile-cta {
    margin-bottom: 20px;
    padding: 10px 12px;
    gap: 9px 10px;
  }

  .article-mobile-cta-copy {
    font-size: 0.71rem;
  }

  .article-mobile-cta-actions {
    width: 100%;
  }

  .article-mobile-cta-actions .btn {
    flex: 1 1 auto;
    font-size: 0.77rem;
    padding: 6px 10px;
  }

  .article-cover figcaption {
    padding: 9px 12px;
    font-size: 0.7rem;
  }

  .article-prose {
    font-size: 0.96rem;
    line-height: 1.72;
  }

  .article-code pre {
    padding: 13px 14px;
    font-size: 0.74rem;
  }

  .article-cta-card {
    padding: 20px 16px;
  }

  .article-cta-ext-actions {
    width: 100%;
    flex-direction: column;
  }

  .article-cta-ext-actions .btn {
    width: 100%;
    white-space: normal;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-tool-link:hover {
    transform: none;
  }
}
