/* Platform Page */

.platform-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-8);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* MODULE SECTIONS */
.module-section {
  border-bottom: 1px solid var(--color-divider);
  scroll-margin-top: 96px; /* clears the sticky header when jumped to via #flow/#pay/#connect/#reach */
}

.module-section--alt {
  background: var(--color-surface);
}

.module-inner {
  position: relative;
}

.module-tag {
  display: inline-block;
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: var(--space-8);
}

.module-tag--flow { background: rgba(184, 115, 51, 0.1); color: #5a2f0e; }
.module-tag--pay { background: rgba(67, 122, 34, 0.1); color: #2E5C10; }
.module-tag--connect { background: rgba(0, 100, 148, 0.1); color: #0b3751; }
.module-tag--reach { background: rgba(122, 57, 187, 0.1); color: #431673; }

[data-theme='dark'] .module-tag--flow { background: rgba(205, 139, 82, 0.15); color: var(--color-copper-light); }
[data-theme='dark'] .module-tag--pay { background: rgba(109, 170, 69, 0.15); color: #6daa45; }
[data-theme='dark'] .module-tag--connect { background: rgba(85, 145, 199, 0.15); color: #5591c7; }
[data-theme='dark'] .module-tag--reach { background: rgba(168, 111, 223, 0.15); color: #a86fdf; }

.module-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  align-items: center;
}

.module-content--reversed {
  direction: rtl;
}

.module-content--reversed > * {
  direction: ltr;
}

.module-title {
  font-size: var(--text-2xl);
  font-family: var(--font-display);
  color: var(--color-heading);
  margin-bottom: var(--space-2);
}

.module-tagline {
  font-size: var(--text-lg);
  font-family: var(--font-display);
  font-style: italic;
  color: var(--color-primary);
  margin-bottom: var(--space-5);
}

.module-body {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-6);
  max-width: 52ch;
}

.module-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.module-features li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: none;
}

.module-features svg {
  flex-shrink: 0;
  color: var(--color-primary);
}

/* MODULE DIAGRAM */
.module-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.module-diagram {
  width: 100%;
  max-width: 340px;
  padding: var(--space-8);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

/* FLOW DIAGRAM */
.flow-node {
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  margin-inline: auto;
  max-width: 220px;
  text-align: center;
}

.flow-node span {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}

.flow-node small {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.flow-node--trigger {
  border-color: rgba(184, 115, 51, 0.4);
  background: rgba(184, 115, 51, 0.06);
}

.flow-node--trigger span { color: var(--color-primary); }

.flow-node--complete {
  border-color: rgba(67, 122, 34, 0.4);
  background: rgba(67, 122, 34, 0.06);
}

.flow-node--complete span { color: #437a22; }
[data-theme='dark'] .flow-node--complete span { color: #6daa45; }

.flow-arrow {
  text-align: center;
  color: var(--color-border);
  font-size: 1.25rem;
  padding-block: var(--space-1);
  line-height: 1;
}

/* PAY DIAGRAM */
.pay-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.pay-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.pay-stat-value {
  font-size: var(--text-2xl);
  font-family: var(--font-display);
  color: var(--color-heading);
  line-height: 1;
}

.pay-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.pay-bar {
  height: 6px;
  background: var(--color-divider);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-1);
}

.pay-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-copper-dark), var(--color-copper-light));
  border-radius: var(--radius-full);
}

/* CONNECT DIAGRAM */
.connect-hub {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.connect-center {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  position: relative;
}

.connect-node {
  position: absolute;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.connect-node--top { top: 10px; left: 50%; transform: translateX(-50%); }
.connect-node--right { right: 10px; top: 50%; transform: translateY(-50%); }
.connect-node--bottom { bottom: 10px; left: 50%; transform: translateX(-50%); }
.connect-node--left { left: 10px; top: 50%; transform: translateY(-50%); }

/* REACH DIAGRAM */
.reach-pipeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pipeline-stage {
  display: grid;
  grid-template-columns: 80px 1fr 24px;
  align-items: center;
  gap: var(--space-3);
}

.pipeline-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.pipeline-bar {
  height: 6px;
  background: var(--color-divider);
  border-radius: var(--radius-full);
  
}

.pipeline-count {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: right;
}

@media (max-width: 860px) {
  .module-content {
    grid-template-columns: 1fr;
  }
  .module-content--reversed {
    direction: ltr;
  }
  .module-visual {
    order: -1;
  }
}

/* STATUS BADGE */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-full);
  background: rgba(143,74,22,0.1);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid rgba(143,74,22,0.25);
}
.status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  
  flex-shrink: 0;
}

/* ADVISORY BLOCK */
.advisory-block {
  margin-top: var(--sp-8);
  padding: var(--sp-5) var(--sp-6);
  border-left:1px solid var(--border);
  background: rgba(143,74,22,0.05);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.advisory-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--sp-2);
}
.advisory-body {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0;
}

/* FLOW CARD */
.flow-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.flow-step {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.flow-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
  
}
.flow-dot--pending {
  background: transparent;
  border: 2px solid var(--color-border);
  animation: none;
}
.flow-lbl {
  flex: 1;
}
.flow-status {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.flow-status--done    { color: #4a7c3f; }
.flow-status--running { color: var(--color-primary); }
.flow-status--pending { color: var(--color-text-faint); }

[data-theme="dark"] .flow-card {
  background: var(--color-surface-dark);
  border-color: rgba(255,255,255,0.08);
}

/* ═══════════════════════════════════════════════════════════
   REFRESH 2026-08 — level artwork
   .module-visual is a flex row (line 122). With the artwork added
   it has two children, which overflowed on phones. Stack them.
   This lives in platform.css because it must win over the rule above.
   ═══════════════════════════════════════════════════════════ */
.module-visual{
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
}
.module-visual > *{ max-width: 100%; }

.module-art{
  width: 100%; height: auto; display: block;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  box-shadow: 0 14px 8px -14px rgba(0,0,0,.55);
  transition:transform .8s var(--ease-out), border-color .4s, box-shadow .4s;
}
.module-visual:hover .module-art{
  transform: translateY(-4px);
  border-color: var(--color-primary);
  box-shadow: 0 18px 8px -14px rgba(0,0,0,0.32);
}
@media (min-width:900px){ .module-art{ border-radius:18px; } }

/* ═══════════════════════════════════════════════════════════
   Level artwork — device-appropriate presentation
   The panels are complete compositions: they already contain the
   spec-card data. So we never show both.
     DESKTOP  → full panel (readable at size); live spec-card hidden
     MOBILE   → panel hidden (its baked-in text is unreadable at 375px);
                live HTML text + spec-card shown, which ARE readable
   ═══════════════════════════════════════════════════════════ */

/* mobile first: no panel, keep the readable live content */
.module-art{ display:none; }

@media (min-width:900px){
  .module-art{
    display:block; width:100%; height:auto;
    border-radius:18px; border:1px solid var(--color-border);
    box-shadow:0 16px 8px -16px rgba(0,0,0,.6);
    transition:transform .8s var(--ease-out), border-color .4s, box-shadow .4s;
  }
  .module-visual:hover .module-art{
    transform:translateY(-4px);
    border-color:var(--color-primary);
    box-shadow:0 20px 8px -16px rgba(0,0,0,0.32);
  }
  /* the panel already shows this data — don't say it twice */
  .module-visual .spec-card{ display:none; }
}

/* <picture> wrapper needs the same treatment the <img> had */
picture.module-art{ display:none; }
picture.module-art img{ width:100%; height:auto; display:block; border-radius:18px; }
@media (min-width:900px){
  picture.module-art{
    display:block; border-radius:18px; overflow:hidden;
    border:1px solid var(--color-border);
    box-shadow:0 16px 8px -16px rgba(0,0,0,.6);
    transition:transform .8s var(--ease-out), border-color .4s, box-shadow .4s;
  }
  .module-visual:hover picture.module-art{
    transform:translateY(-4px); border-color:var(--color-primary);
    box-shadow:0 20px 8px -16px rgba(0,0,0,0.32);
  }
}

/* ═══════════════════════════════════════════════════════════
   THE PANELS ARE THE PAGE (Brian, 2026-08-02)
   Desktop ≥900px: each level shows its complete panel artwork.
   The equivalent HTML text is visually hidden but stays in the
   document for screen readers, search engines, and phones.
   Mobile <900px: panel hidden (baked text unreadable small);
   the live HTML text renders instead. Never both.
   ═══════════════════════════════════════════════════════════ */
@media (min-width:900px){
  .module-section .module-text{
    position:absolute !important; width:1px; height:1px;
    padding:0; margin:-1px; overflow:hidden;
    clip:rect(0 0 0 0); white-space:nowrap; border:0;
  }
  .module-section .module-content{ display:block; }
  .module-section picture.module-art{ max-width:1080px; margin:0 auto; }
}
@media (min-width:900px){
  /* the panel names itself — the eyebrow pill would say it twice */
  .module-section .module-pill{ display:none; }
}

/* ═══ Panels visible on EVERY device (Brian) — tap surfaces the reader ═══ */
picture.module-art{ display:block !important; border-radius:14px; overflow:hidden;
  border:1px solid var(--color-border); cursor:pointer; }
@media (max-width:899px){
  .module-section .module-text,
  .module-section .module-visual .spec-card,
  .module-section .module-pill{
    position:absolute !important; width:1px; height:1px; padding:0; margin:-1px;
    overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
  }
}
/* magnified reader */
.orv-lb{ position:fixed; inset:0; z-index:10000; background:rgba(6,4,3,.96);
  display:none; overflow:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; }
.orv-lb.open{ display:block; }
.orv-lb img{ width:210vw; max-width:none; display:block; padding:70px 0 40px; }
@media (min-width:820px){ .orv-lb img{ width:130vw; } }
.orv-lb-close{ position:fixed; top:14px; right:14px; z-index:10001; width:46px; height:46px;
  border-radius:50%; border:1.5px solid var(--color-primary); background:rgba(10,8,6,.85);
  color:#d9822b; font-size:28px; cursor:pointer; }
.orv-lb-hint{ position:fixed; top:24px; left:16px; z-index:10001; color:#9A9184;
  font-family:var(--font-mono); font-size:12px; letter-spacing:.02em; }

/* ═══ Mobile: panels fill the screen edge-to-edge and stack tight ═══
   width:100vw means the panel is exactly as wide as whatever phone it is
   on — bigger screen, bigger panel, bigger in-image text. Automatically. */
@media (max-width:899px){
  .module-section{ padding-top:10px !important; padding-bottom:10px !important; }
  .module-section .container,
  .module-section .container--normal,
  .module-section .module-inner{ padding-left:0 !important; padding-right:0 !important; max-width:none !important; }
  picture.module-art{
    /* near-full-bleed with a small safe inset so no panel edge is clipped */
    width:calc(100vw - 16px); max-width:calc(100vw - 16px);
    margin-left:calc(50% - 50vw + 8px); margin-right:calc(50% - 50vw + 8px);
    border-radius:10px;
  }
}
