/* ============================================================
   Architecture Infographic Showcase
   ============================================================ */

.arch {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 0 60px;
}

/* TOC + infographic column (wide screens: sticky vertical nav) */
.arch-body {
  display: block;
}

.arch-stream {
  min-width: 0;
}

/* ── Hero ──────────────────────────────────────────────── */
.arch-hero {
  padding: 48px 0 32px;
  text-align: center;
}
.arch-hero-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 8px;
}
.arch-hero-title {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 10px;
  background: linear-gradient(135deg, #6366f1 0%, #a78bfa 40%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.arch-hero-sub {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 24px;
  line-height: 1.6;
}
.arch-hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}
.arch-stat {
  text-align: center;
}
.arch-stat-val {
  display: block;
  font-size: 28px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  line-height: 1;
}
.arch-stat-lbl {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Toolbar ───────────────────────────────────────────── */
.arch-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.arch-toc-toggle,
.arch-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s ease;
}
.arch-toc-toggle:hover,
.arch-export-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, .06);
}
.arch-export-btn {
  margin-left: auto;
}

/* ── Table of Contents ─────────────────────────────────── */
.arch-toc {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease, padding .35s ease;
  padding: 0;
  margin-bottom: 24px;
}
.arch-toc.arch-toc-open {
  /* Cap height so infographic content stays discoverable; scroll inside TOC */
  max-height: min(920px, 72vh);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 8px 8px 0;
}
.arch-toc-section {
  display: flex;
  flex-direction: column;
  margin-bottom: 6px;
}
.arch-toc-head {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 10px 4px;
  border-radius: 4px;
  transition: color .15s ease;
}
.arch-toc-head:hover {
  color: var(--text-primary);
}
.arch-toc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 3px 10px 3px 18px;
  border-radius: 4px;
  border-left: 2px solid transparent;
  transition: all .12s ease;
}
.arch-toc-item:hover {
  color: var(--text-primary);
  background: rgba(99, 102, 241, .04);
  border-left-color: rgba(99, 102, 241, .2);
}
.arch-toc-item.arch-toc-active {
  color: var(--accent);
  background: rgba(99, 102, 241, .06);
  border-left-color: var(--accent);
  font-weight: 600;
}
.arch-toc-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  width: 20px;
  flex-shrink: 0;
  text-align: right;
}
.arch-toc-active .arch-toc-num {
  color: var(--accent);
}

/* ── Section headers ───────────────────────────────────── */
.arch-section {
  margin-bottom: 48px;
  scroll-margin-top: 100px;
}
.arch-section-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
  padding-top: 16px;
}
.arch-section-num {
  font-size: 20px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  opacity: .5;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 2px;
}
.arch-section-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.arch-section-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Infographic cards ─────────────────────────────────── */
.arch-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  transition: border-color .2s ease;
  scroll-margin-top: 100px;
}
.arch-card:hover {
  border-color: rgba(99, 102, 241, .25);
}

.arch-card-number {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 36px;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  opacity: .06;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}

.arch-card-body {
  padding: 24px 28px 20px;
}

.arch-card-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 12px;
  line-height: 1.2;
}

.arch-card-narrative {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.75;
}
.arch-card-narrative p {
  margin: 0 0 10px;
}
.arch-card-narrative p:last-child {
  margin-bottom: 0;
}
.arch-card-narrative strong {
  color: var(--text-primary);
  font-weight: 700;
}
.arch-card-narrative code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: rgba(99, 102, 241, .08);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent);
}

/* Image area */
.arch-card-img-wrap {
  border-top: 1px solid var(--border);
  background: #0a1628;
  display: flex;
  align-items: center;
  justify-content: center;
}
.arch-card-img {
  width: 100%;
  display: block;
  max-height: 560px;
  object-fit: contain;
}

/* ── Pending image placeholder ─────────────────────────── */
.arch-card-img-pending {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background: linear-gradient(135deg, #0a1628 0%, #111827 100%);
  border-top: 1px dashed rgba(99, 102, 241, .2);
}
.arch-card-pending-label {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(99, 102, 241, .4);
  text-align: center;
  padding: 24px;
}

/* ── Footer ────────────────────────────────────────────── */
.arch-footer {
  text-align: center;
  padding-top: 20px;
}
.arch-footer-line {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 0 auto 12px;
}
.arch-footer-text {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: .5px;
}

/* ── Wide layout: vertical TOC pinned beside content ───── */
@media (min-width: 1024px) {
  .arch-toolbar .arch-toc-toggle {
    display: none;
  }
  .arch-body {
    display: grid;
    grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
    gap: 12px 40px;
    align-items: start;
  }
  .arch-body .arch-toc {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px) !important;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0;
    padding: 4px 10px 12px 0;
    /* Always visible on desktop regardless of .arch-toc-open */
  }
  .arch-body .arch-toc.arch-toc-open {
    max-height: calc(100vh - 40px) !important;
  }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 700px) {
  .arch-hero-title { font-size: 28px; }
  .arch-hero-stats { gap: 20px; }
  .arch-stat-val { font-size: 22px; }
  .arch-card-body { padding: 18px 18px 14px; }
  .arch-card-title { font-size: 16px; }
  .arch-card-narrative { font-size: 12px; }
  .arch-toc.arch-toc-open { columns: 1; }
  .arch-section,
  .arch-card { scroll-margin-top: 120px; }
}

/* ── Print / PDF Export ────────────────────────────────── */
@media print {
  /* Hide chrome */
  .sidebar, .arch-toolbar, .arch-toc, .toast-container,
  #auth-loading, #login-overlay, #readiness-overlay,
  #rewards-widget, #universal-opp-modal,
  .arch-hero-label { display: none !important; }

  .main { margin: 0 !important; padding: 0 !important; }
  .arch { max-width: 100%; padding: 0; }
  .arch-body { display: block !important; }

  /* Hero prints clean */
  .arch-hero { padding: 20px 0 16px; }
  .arch-hero-title {
    font-size: 32px;
    background: none;
    -webkit-text-fill-color: #111;
    color: #111;
  }
  .arch-hero-sub { color: #555; }
  .arch-stat-val { color: #111; font-size: 22px; }
  .arch-stat-lbl { color: #666; }

  /* Sections */
  .arch-section { margin-bottom: 24px; }
  .arch-section-head { padding-top: 8px; margin-bottom: 12px; }
  .arch-section-num { color: #6366f1; }
  .arch-section-title { color: #111; font-size: 18px; }
  .arch-section-sub { color: #666; }

  /* Cards — avoid breaks inside */
  .arch-card {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #ddd;
    margin-bottom: 16px;
    box-shadow: none;
  }
  .arch-card-number { opacity: .08; color: #000; }
  .arch-card-title { color: #111; font-size: 15px; }
  .arch-card-narrative { color: #333; font-size: 11px; line-height: 1.6; }
  .arch-card-narrative strong { color: #111; }
  .arch-card-narrative code {
    background: #f3f4f6;
    color: #4338ca;
    border: 1px solid #e5e7eb;
  }

  /* Images print full width */
  .arch-card-img-wrap { background: #f8fafc; border-top: 1px solid #e5e7eb; }
  .arch-card-img { max-height: 420px; }

  /* Footer */
  .arch-footer-line { background: #6366f1; }
  .arch-footer-text { color: #999; }

  /* Page setup */
  @page {
    size: A4 portrait;
    margin: 12mm 15mm;
  }
}
