/* ===========================================================
   Article — long-form interactive page
   Uses base tokens from ../colors_and_type.css
   =========================================================== */

html, body {
  margin: 0; padding: 0;
  background: var(--bg-primary);
  color: var(--fg-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
*, *::before, *::after { box-sizing: border-box; }
::selection { background: rgba(74,222,128,.28); color: #fff; }
a { color: inherit; }
button { font-family: inherit; }

/* article-prose: where the verbatim article text lives */
.prose {
  max-width: 680px;
  margin: 0 auto;
  font-size: 18px;
  line-height: 1.72;
  color: var(--fg-primary);
  letter-spacing: -0.005em;
}
.prose p {
  margin: 0 0 22px;
  font-size: 18px;
  line-height: 1.72;
  color: #D1D5DB;
}
.prose p em {
  color: var(--fg-secondary);
  font-style: italic;
}
.prose p strong {
  color: var(--fg-primary);
  font-weight: 600;
}
.prose p code {
  font-size: 0.9em;
}
.prose hr {
  border: none;
  height: 1px;
  background: var(--border-subtle);
  margin: 64px auto;
  max-width: 120px;
}
.prose h2 {
  font-size: 34px;
  letter-spacing: -.02em;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 24px;
  color: var(--fg-primary);
}
.prose h3 {
  font-size: 22px;
  letter-spacing: -.01em;
  font-weight: 600;
  line-height: 1.25;
  margin: 56px 0 16px;
  color: var(--fg-primary);
}
.prose ul {
  padding-left: 0;
  margin: 0 0 24px;
  list-style: none;
}
.prose ul li {
  position: relative;
  padding-left: 22px;
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 1.65;
  color: #D1D5DB;
}
.prose ul li::before {
  content: '—';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--brand-green);
  font-family: var(--font-mono);
}

/* artifact rail — wider than prose, can overflow on the right */
.artifact-frame {
  max-width: 1180px;
  margin: 56px auto 56px;
  padding: 0 28px;
}
.artifact-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}

.artifact-head {
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.artifact-head .live {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--brand-green);
  padding: 3px 8px;
  background: rgba(74,222,128,.08);
  border: 1px solid rgba(74,222,128,.22);
  border-radius: 4px;
  font-size: 10px;
}
.artifact-head .live::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand-green);
  box-shadow: 0 0 6px rgba(74,222,128,.7);
  animation: pulse 1.6s ease-in-out infinite;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-fg);
  font-weight: 500;
}

.principle-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-muted);
  letter-spacing: .08em;
}

.kbd {
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  color: var(--fg-primary);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}

@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
@keyframes blink { 50% { opacity: 0 } }
@keyframes slideBar { 0% { transform: translateX(-100%) } 100% { transform: translateX(350%) } }
@keyframes spinSlow { to { transform: rotate(360deg) } }
@keyframes float { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
@keyframes drift { 0%, 100% { transform: translate(0, 0) } 50% { transform: translate(8px, -10px) } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px) } to { opacity: 1; transform: none } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* simple range slider */
.range {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
  outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--brand-green);
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(74,222,128,.18);
  border: 2px solid var(--bg-primary);
}
.range::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--brand-green);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
}

/* progress reading line */
.read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-lime), var(--brand-green));
  z-index: 100;
  transition: width .1s linear;
  box-shadow: 0 0 12px rgba(74,222,128,.5);
}

/* =====================================================================
   Mobile responsiveness
   The v3 source ships desktop-only; these rules collapse multi-column
   artifacts to single column and tighten paddings on small screens.
   Inline styles dominate, so !important is required.
   ===================================================================== */
@media (max-width: 900px) {
  /* Article hero region */
  .article-hero { padding: 64px 18px 24px !important; }
  .article-author-card { flex-direction: column !important; gap: 14px !important; padding: 18px !important; }
  .article-byline-strip { flex-wrap: wrap; gap: 8px 14px !important; }
  .article-nav-inner { gap: 12px !important; padding: 12px 16px !important; }

  /* Prose padding */
  .prose { padding: 0 18px !important; }

  /* MAU growth two-pane artifact -> stacked */
  .mau-growth-grid { grid-template-columns: 1fr !important; }
  .mau-growth-grid > div:first-child { border-right: none !important; border-bottom: 1px solid var(--border-subtle); }

  /* Generic: any 2-column grid inside an artifact-frame collapses */
  .artifact-frame [style*="gridTemplateColumns"],
  .artifact-frame > div > div[style*="grid-template-columns"] { /* harmless if not present */ }
}

@media (max-width: 768px) {
  .article-nav-meta { display: none !important; }

  /* Section paddings shrink */
  section { padding-left: 0 !important; padding-right: 0 !important; }
  section > div { max-width: 100% !important; }

  /* All inline 2-col / 3-col grids inside the article body collapse to 1 col.
     Targets style attribute substring -- works because v3 uses inline styles. */
  body > #root [style*="grid-template-columns"][style*="1fr 280px"],
  body > #root [style*="grid-template-columns"][style*="1fr 60px 1fr"],
  body > #root [style*="grid-template-columns"][style*="1.2fr 1fr"],
  body > #root [style*="grid-template-columns"][style*="minmax(0,1.25fr)"],
  body > #root [style*="grid-template-columns"][style*="40px 1fr 1fr"],
  body > #root [style*="grid-template-columns"][style*="180px 1fr 1fr"],
  body > #root [style*="grid-template-columns"][style*="76px 130px 150px"],
  body > #root [style*="grid-template-columns"][style*="repeat(5, 1fr)"],
  body > #root [style*="grid-template-columns"][style*="repeat(3, 1fr)"],
  body > #root [style*="grid-template-columns"][style*="repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
    min-height: unset !important;
  }

  /* Right-borders that visually separate horizontal panels become bottom-borders */
  body > #root [style*="border-right"] { border-right: none !important; }

  /* Tighten artifact internal padding */
  .artifact-card,
  body > #root [style*="padding: '32px 28px'"],
  body > #root [style*="padding: '26px 28px'"],
  body > #root [style*="padding: '24px 28px'"],
  body > #root [style*="padding: '24px 26px'"],
  body > #root [style*="padding: '20px 22px'"],
  body > #root [style*="padding: '52px 32px'"] {
    padding: 18px !important;
  }

  /* Header rows of tables that use grid (Principles tables) align left */
  body > #root [style*="padding: '14px 24px'"],
  body > #root [style*="padding: '12px 24px'"],
  body > #root [style*="padding: '11px 22px'"],
  body > #root [style*="padding: '12px 22px'"] {
    padding: 12px 16px !important;
  }

  /* Hero h1 already uses clamp; force margin reset */
  h1 { letter-spacing: -0.02em !important; }

  /* Path artifact label row may overflow */
  .article-hero svg + div { font-size: 10px !important; }
}

@media (max-width: 480px) {
  .article-hero { padding: 48px 14px 20px !important; }
  .prose { padding: 0 14px !important; }
  /* Hide the long meta hint on the path tile */
  .article-hero [style*="▸ live"] { display: none !important; }
}
