/* dsh-redteam — long-form article styles
   Loaded after site.css on article pages only. Tokens and base components come
   from the site design system; everything here is article-specific. */

/* ------------------------------------------------------------ reading chrome */
.article-progress {
  position: fixed;
  inset: var(--header-offset) 0 auto 0;
  height: 2px;
  z-index: 40;
  background: transparent;
  pointer-events: none;
}
.article-progress i {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

/* ------------------------------------------------------------ article hero */
.article-head {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  padding-block: clamp(42px, 5.8vw, 74px) clamp(30px, 4vw, 46px);
}
.article-head::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 460px;
  background: var(--glow);
  pointer-events: none;
}
.article-head::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(70% 60% at 40% 0%, #000 25%, transparent 78%);
  opacity: 0.45;
  pointer-events: none;
}
.article-head-inner { position: relative; max-width: 900px; }
.article-head .eyebrow a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; }
.article-head .eyebrow a:hover { border-bottom-color: currentColor; text-decoration: none; }
.article-head h1 {
  font-size: clamp(2rem, 4.2vw, 3rem);
  letter-spacing: -0.032em;
  line-height: 1.05;
  max-width: 22ch;
}
.article-deck {
  margin-top: 18px;
  max-width: 64ch;
  font-size: clamp(1.02rem, 1.4vw, 1.16rem);
  line-height: 1.62;
  color: var(--muted);
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 26px;
  color: var(--faint);
  font-size: 13px;
}
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.article-meta a { color: var(--muted); }
.article-meta a:hover { color: var(--text); }

/* ------------------------------------------------------------ layout */
.article-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  padding-block: clamp(32px, 4.5vw, 56px) clamp(48px, 6vw, 80px);
}
.article-toc {
  position: sticky;
  top: calc(var(--header-offset) + 26px);
  max-height: calc(100vh - var(--header-offset) - 40px);
  max-height: calc(100dvh - var(--header-offset) - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border-left: 1px solid var(--line);
  padding-left: 18px;
  padding-right: 4px;
}
.article-toc h2 {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
  font-weight: 500;
}
/* The chapter rail is a second list: a hairline keeps it visually separate from
   the on-page contents instead of relying on an inline style. */
.article-toc .toc-sub {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.article-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; counter-reset: toc; }
.article-toc li { counter-increment: toc; }
.article-toc a {
  display: block;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.article-toc a::before {
  content: counter(toc, decimal-leading-zero) "  ";
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
}
.article-toc a:active { color: var(--text); background: var(--surface-3); text-decoration: none; }
.article-toc a[aria-current="true"] {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: inset 2px 0 var(--accent-strong);
}

/* ------------------------------------------------------------ prose */
.article-layout > * { min-width: 0; }
.prose { max-width: 74ch; min-width: 0; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 {
  margin-top: 2.3em;
  padding-top: 1.25em;
  border-top: 1px solid var(--line);
  font-size: clamp(1.36rem, 2.1vw, 1.66rem);
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--header-offset) + 24px);
}
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 {
  margin-top: 1.8em;
  font-size: 1.1rem;
  letter-spacing: -0.012em;
  scroll-margin-top: calc(var(--header-offset) + 24px);
}
.prose p, .prose li { color: var(--text-soft); line-height: 1.74; font-size: 1.01rem; }
.prose p.lede-inline { font-size: 1.08rem; color: var(--muted); }
.prose strong { color: var(--text); font-weight: 620; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { margin: 0; padding-left: 1.35em; display: grid; gap: 0.5em; }
.prose li::marker { color: var(--faint); }
.prose li > ul, .prose li > ol { margin-top: 0.5em; }
.prose blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: normal;
}
.prose blockquote p { color: var(--muted); }
.prose code {
  font-size: 0.88em;
  background: var(--surface-3);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--text);
}
.prose pre {
  margin: 1.5em 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: var(--text-soft); }
.prose pre .cmt { color: var(--faint); }
.prose pre .hl { color: var(--accent); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

/* tables */
.prose .table-wrap {
  overflow-x: auto;
  margin: 1.6em 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
.prose thead th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.prose tbody td { padding: 11px 16px; border-top: 1px solid var(--line); color: var(--text-soft); vertical-align: top; }
.prose tbody tr:hover td { background: var(--surface); }

/* figures */
.prose figure {
  margin: 1.9em 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.prose figure > svg,
.prose figure > img { display: block; width: 100%; height: auto; background: var(--bg-soft); }
.prose figure > img { border-bottom: 1px solid var(--line); }
.prose figcaption {
  padding: 11px 16px;
  font-size: 12.5px;
  color: var(--faint);
  line-height: 1.55;
  border-top: 1px solid var(--line);
}
.prose figcaption b { color: var(--muted); font-weight: 600; }

/* diagram primitives — used by inline SVG figures */
.dgm { font-family: var(--mono); }
.dgm .box { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.dgm .box-accent { fill: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); stroke: color-mix(in srgb, var(--accent) 55%, transparent); stroke-width: 1; }
.dgm .lbl { fill: var(--text); font-size: 12px; font-weight: 600; }
.dgm .sub { fill: var(--muted); font-size: 10.5px; }
.dgm .edge { stroke: var(--line-strong); stroke-width: 1.2; fill: none; }
.dgm .edge-accent { stroke: var(--accent); stroke-width: 1.4; fill: none; }
.dgm .glyph { fill: var(--muted); }
.dgm .num { fill: var(--accent); font-size: 10.5px; }

/* callouts */
.callout {
  margin: 1.7em 0;
  padding: 15px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  font-size: 14px;
  color: var(--text-soft);
}
.callout.warn { border-left-color: var(--warn); }
.callout.ok { border-left-color: var(--ok); }
.callout p { color: inherit; font-size: inherit; line-height: 1.6; margin: 0; }
.callout p + p { margin-top: 8px; }
.callout .k {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
}

/* takeaways */
.takeaways {
  margin: 2.2em 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.takeaways h2 {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.takeaways ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.takeaways li { font-size: 14px; line-height: 1.6; color: var(--muted); }

/* sources */
.sources { margin-top: 2.6em; padding-top: 1.4em; border-top: 1px solid var(--line); }
.sources h2 { margin: 0 0 10px; padding: 0; border: 0; font-size: 0.95rem; }
.sources ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.sources li { font-size: 13px; color: var(--muted); line-height: 1.5; }
.sources a { color: var(--muted); }
.sources a:hover { color: var(--accent); }

/* article footer blocks */
.article-footer { margin-top: 2.6em; display: grid; gap: 16px; }
.article-author {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.article-author img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-strong); }
.article-author .who { display: grid; gap: 2px; }
.article-author .who b { font-size: 14.5px; color: var(--text); }
.article-author .who span { font-size: 12.5px; color: var(--muted); }
.article-author .links { margin-left: auto; display: flex; gap: 8px; }
.article-author .links a {
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.article-author .links a:active { color: var(--text); border-color: var(--line-strong); text-decoration: none; }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.cta-row p { margin: 0; flex: 1 1 260px; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.cta-row p b { color: var(--text); }

.article-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 2.4em;
}
.article-nav a {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
}
.article-nav a:active { border-color: var(--line-strong); text-decoration: none; }
.article-nav .dir {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
}
.article-nav .ttl { font-size: 14px; font-weight: 600; color: var(--text); }
.article-nav .next { text-align: right; }

/* ------------------------------------------------------------ article index */
.insights-head { padding-block: clamp(40px, 6vw, 72px) clamp(24px, 3vw, 36px); border-bottom: 1px solid var(--line); }
.insights-head h1 { font-size: clamp(2rem, 4.4vw, 3rem); letter-spacing: -0.03em; }
.insights-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 6px; }
.insights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-block: clamp(28px, 4vw, 44px) clamp(48px, 6vw, 80px);
}
.insight-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.insight-card:active { border-color: var(--line-strong); background: var(--surface-2); text-decoration: none; }
.insight-card::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: -1px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, var(--accent-strong), transparent);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.insight-card:hover::after,
.insight-card:focus-visible::after { opacity: 1; }
.insight-card .cat {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.insight-card h2 { margin: 10px 0 8px; font-size: 1.12rem; letter-spacing: -0.015em; line-height: 1.28; }
.insight-card p { flex: 1; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.insight-card .foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
}
.insight-card .foot .more { margin-left: auto; color: var(--accent); font-weight: 600; font-size: 12.5px; }
.insight-card[hidden] { display: none; }

/* ------------------------------------------------------------ hover
   Pointer-only decoration; touch gets the :active states above. */
@media (hover: hover) and (pointer: fine) {
  .article-toc a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
  .insight-card:hover { border-color: var(--line-strong); background: var(--surface-2); transform: translateY(-2px); text-decoration: none; }
  .article-author .links a:hover { color: var(--text); border-color: var(--line-strong); text-decoration: none; }
  .article-nav a:hover { border-color: var(--line-strong); text-decoration: none; }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .article-toc a { display: flex; align-items: center; min-height: 40px; }
  .article-author .links a { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 12px; }
  .takeaways li,
  .sources li,
  .callout,
  .callout p,
  .insight-card p,
  .cta-row p { font-size: 16px; line-height: 1.6; }
  .article-author .who b { font-size: 16px; }
  .article-author .who span { font-size: 13.5px; }
}

@media (max-width: 1000px) {
  .article-layout { grid-template-columns: 1fr; gap: 22px; }
  .article-toc {
    position: static;
    max-height: none;
    overflow: visible;
    border-left: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    background: var(--surface);
  }
  .article-toc a { display: flex; align-items: center; min-height: 40px; padding: 6px 9px; font-size: 14px; }
  .article-toc ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .article-head { padding-block: 34px 26px; }
  .article-head h1 { font-size: clamp(1.9rem, 8.6vw, 2.6rem); }
  .article-deck { margin-top: 14px; font-size: 1.02rem; }
  .article-meta { margin-top: 20px; }
  .article-layout { gap: 18px; padding-block: 24px 52px; }

  /* The table of contents becomes one scrollable chip rail instead of a wall. */
  .article-toc { padding: 12px 14px 8px; }
  .article-toc h2 { margin-bottom: 8px; }
  .article-toc ol {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 0 6px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
  }
  .article-toc li { flex: none; scroll-snap-align: start; }
  .article-toc a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-soft);
    font-size: 13.5px;
    white-space: nowrap;
  }
  .article-toc a::before { margin-right: 6px; }

  .prose { max-width: none; }
  .prose h2 { margin-top: 2em; padding-top: 1.1em; }
  .prose p, .prose li { font-size: 1.02rem; line-height: 1.68; }
  .prose blockquote { padding-left: 14px; }

  /* Wide diagrams keep their labels legible and scroll inside the frame. */
  .prose figure { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .prose figure > svg { min-width: 620px; }
  .prose figcaption { position: sticky; left: 0; }
  .prose pre { font-size: 12.5px; }

  .takeaways { padding: 18px; }
  .article-author { flex-wrap: wrap; }
  .article-author .links { margin-left: 0; width: 100%; }
  .article-author .links a { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 12px; }
  .article-nav { grid-template-columns: 1fr; gap: 10px; }
  .article-nav .next { text-align: left; }
  .prose table { min-width: 460px; }

  .insights-grid { grid-template-columns: 1fr; }
  .insights-filters { gap: 6px; }
  .insight-card { padding: 18px; }
  .insight-card h2 { font-size: 1.08rem; }
  .insight-card p { font-size: 16px; }
}
