/* AttendFlow Guides — shared stylesheet for long-form educational guides.
   Token vocabulary mirrors blog-article.css; also carries the bridge tokens
   site-nav.js needs, so guide pages don't repeat an inline bridge <style>. */

/* ── Variables ─────────────────────────────────────────── */
:root {
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --border-color: #e2e8f0;
  --accent: #4F46E5;
  --accent-dim: rgba(79,70,229,0.09);
  --accent-border: rgba(79,70,229,0.25);
  --shadow-color: rgba(0,0,0,0.08);
  --ok: #059669;
  --ok-dim: rgba(52,211,153,0.12);
  --warn: #d97706;
  --warn-dim: rgba(245,158,11,0.12);
  --bad: #dc2626;
  --bad-dim: rgba(239,68,68,0.10);
  --header-height: 64px;
  /* site-nav.js bridge tokens */
  --bg-header: rgba(248,250,252,0.92);
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --accent-hover: #6366F1;
  --on-accent: #ffffff;
}
[data-theme="dark"] {
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #263449;
  --border-color: #1e3a52;
  --accent: #4F46E5;
  --accent-dim: rgba(79,70,229,0.12);
  --accent-border: rgba(79,70,229,0.28);
  --shadow-color: rgba(0,0,0,0.3);
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --bg-header: rgba(15,23,42,0.88);
  --bg-card: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #1e3a52;
  --border-subtle: #263449;
}

/* ── Reset / base ──────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.8; color: var(--text-primary);
  background: var(--bg-primary); padding-top: var(--header-height);
  overflow-x: hidden;
}
@keyframes fadeInUp { from{opacity:0;transform:translateY(22px);} to{opacity:1;transform:translateY(0);} }

/* ── Reading progress bar (guides.js) ──────────────────── */
#guideProgress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), #6366F1);
  z-index: 2000; transition: width 0.08s linear;
}

/* ── Layout ────────────────────────────────────────────── */
.guide-wrap { max-width: 860px; margin: 0 auto; padding: 2rem 1.25rem 5rem; }
.guide-container {
  background: var(--bg-secondary); padding: 3rem 3.25rem;
  border-radius: 20px;
  box-shadow: 0 8px 32px var(--shadow-color), 0 0 0 1px var(--border-color);
  animation: fadeInUp 0.5s ease 0.05s both;
}
@media (max-width: 640px) {
  .guide-wrap { padding: 1rem 0.75rem 4rem; }
  .guide-container { padding: 1.75rem 1.25rem; border-radius: 14px; }
}

/* ── Breadcrumb ────────────────────────────────────────── */
.breadcrumb {
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
  font-size: 0.8125rem; color: var(--text-tertiary); margin: 0 0 1.25rem 0.25rem;
}
.breadcrumb a { color: var(--text-tertiary); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span[aria-hidden] { opacity: 0.5; }
.breadcrumb .current { color: var(--text-secondary); font-weight: 500; }

/* ── Article header ────────────────────────────────────── */
.guide-container h1 {
  font-size: clamp(1.75rem, 4.5vw, 2.375rem);
  font-weight: 800; letter-spacing: -0.04em; line-height: 1.18;
  margin-bottom: 0.875rem;
}
.guide-meta {
  display: flex; align-items: center; gap: 0.625rem; flex-wrap: wrap;
  font-size: 0.8125rem; color: var(--text-tertiary);
  margin-bottom: 1.5rem; padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}
.guide-tag {
  display: inline-flex; align-items: center;
  background: var(--accent-dim); border: 1px solid var(--accent-border);
  color: var(--accent); border-radius: 9999px;
  padding: 0.2rem 0.625rem; font-size: 0.6875rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.guide-lead { font-size: 1.125rem; color: var(--text-secondary); line-height: 1.75; margin-bottom: 1.5rem; }

/* ── Body content ──────────────────────────────────────── */
.guide-container h2 {
  font-size: 1.4375rem; font-weight: 700; letter-spacing: -0.02em;
  line-height: 1.3; margin: 2.75rem 0 0.875rem;
  padding-top: 0.5rem; scroll-margin-top: calc(var(--header-height) + 16px);
}
.guide-container h3 {
  font-size: 1.125rem; font-weight: 600; line-height: 1.4;
  margin: 2rem 0 0.625rem; scroll-margin-top: calc(var(--header-height) + 16px);
}
.guide-container h4 {
  font-size: 1rem; font-weight: 600; line-height: 1.4;
  margin: 1.5rem 0 0.5rem; color: var(--text-primary);
}
.guide-container p { margin-bottom: 1.25rem; color: var(--text-secondary); font-size: 1.0625rem; line-height: 1.8; }
.guide-container ul, .guide-container ol { margin: 0 0 1.25rem 1.5rem; color: var(--text-secondary); }
.guide-container li { margin-bottom: 0.5rem; font-size: 1.0625rem; line-height: 1.7; }
.guide-container li > ul, .guide-container li > ol { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.guide-container strong { color: var(--text-primary); font-weight: 700; }
.guide-container a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.guide-container a:hover { color: #6366F1; }
.guide-container blockquote {
  margin: 1.75rem 0; padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0;
  background: var(--accent-dim); color: var(--text-secondary);
  font-size: 1.0625rem; line-height: 1.75;
}
.guide-container blockquote p { margin-bottom: 0; color: inherit; }
.guide-container hr { border: none; border-top: 1px solid var(--border-color); margin: 2.5rem 0; }
.guide-container code {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: 5px; padding: 0.15em 0.45em; font-size: 0.875em;
  color: var(--accent);
}

/* ── Table of contents ─────────────────────────────────── */
.toc {
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: 14px; padding: 1.25rem 1.5rem; margin: 0 0 2rem;
}
.toc-title {
  font-size: 0.8125rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-tertiary); margin-bottom: 0.75rem;
}
.toc ol { margin: 0 0 0 1.25rem; columns: 2; column-gap: 2rem; }
.toc li { margin-bottom: 0.45rem; font-size: 0.9375rem; line-height: 1.5; break-inside: avoid; }
.toc a { color: var(--text-secondary); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 640px) { .toc ol { columns: 1; } }

/* ── Callouts ──────────────────────────────────────────── */
.callout {
  margin: 1.75rem 0; padding: 1.125rem 1.375rem;
  border-radius: 12px; display: flex; gap: 0.875rem; align-items: flex-start;
}
.callout-icon { font-size: 1.125rem; line-height: 1.4; flex-shrink: 0; }
.callout-body { flex: 1; min-width: 0; }
.callout-body p { margin-bottom: 0; font-size: 0.9375rem; line-height: 1.65; }
.callout-body p + p { margin-top: 0.5rem; }
.callout.info    { background: var(--accent-dim); border: 1px solid var(--accent-border); }
.callout.warning { background: var(--warn-dim); border: 1px solid rgba(245,158,11,0.25); }
.callout.success { background: var(--ok-dim); border: 1px solid rgba(52,211,153,0.22); }

/* ── Tables (always wrapped for horizontal scroll) ─────── */
.table-scroll { overflow-x: auto; margin: 0 0 1.5rem; border-radius: 10px; border: 1px solid var(--border-color); }
.guide-container table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; min-width: 480px; }
.guide-container caption {
  text-align: left; font-size: 0.8125rem; color: var(--text-tertiary);
  padding: 0.6rem 1rem; caption-side: bottom;
}
.guide-container th, .guide-container td {
  padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.guide-container th {
  background: var(--bg-tertiary); font-weight: 700; color: var(--text-primary);
  font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap;
}
.guide-container tr:last-child td { border-bottom: none; }

/* ── Figures / SVG diagrams ────────────────────────────── */
.guide-figure { margin: 2rem 0; }
.guide-figure svg { display: block; width: 100%; height: auto; }
.guide-figure figcaption {
  font-size: 0.8125rem; color: var(--text-tertiary); text-align: center;
  margin-top: 0.625rem; line-height: 1.5;
}
.diagram-box {
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: 14px; padding: 1.25rem;
}

/* ── Step-by-step list ─────────────────────────────────── */
.steps { list-style: none; margin: 1.5rem 0; counter-reset: step; }
.steps > li {
  position: relative; padding: 0 0 1.5rem 3.25rem; counter-increment: step;
  border-left: 2px solid var(--border-color); margin: 0 0 0 1.125rem;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0.25rem; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: -1.2rem; top: -0.15rem;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9375rem;
  box-shadow: 0 2px 10px rgba(79,70,229,0.35);
}
.steps > li > strong:first-child { display: block; margin-bottom: 0.25rem; font-size: 1.0625rem; }

/* ── Interactive widget shell ──────────────────────────── */
.widget {
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: 16px; padding: 1.5rem; margin: 2rem 0;
}
.widget-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1.0625rem; font-weight: 700; margin-bottom: 1rem; color: var(--text-primary); }
.widget-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.875rem; margin-bottom: 1rem; }
.widget label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.3rem; }
.widget input[type="number"], .widget input[type="text"], .widget input[type="date"], .widget input[type="time"], .widget select {
  width: 100%; padding: 0.6rem 0.75rem; font: inherit; font-size: 0.9375rem;
  color: var(--text-primary); background: var(--bg-secondary);
  border: 1px solid var(--border-color); border-radius: 10px;
  transition: border-color 0.2s;
}
.widget input:focus, .widget select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.widget-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 0.65rem 1.375rem; border-radius: 10px; font: inherit;
  font-size: 0.9375rem; font-weight: 700;
  box-shadow: 0 2px 14px rgba(79,70,229,0.35);
  transition: background 0.2s, transform 0.15s;
}
.widget-btn:hover { background: #6366F1; transform: translateY(-1px); }
.widget-btn:active { transform: translateY(0); }
.widget-result {
  margin-top: 1.125rem; padding: 1rem 1.25rem;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: 12px; font-size: 0.9375rem; color: var(--text-secondary);
}
.widget-result[hidden] { display: none; }
.widget-result .big { font-size: 1.75rem; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.widget-result.ok { border-color: rgba(52,211,153,0.4); }
.widget-result.warn { border-color: rgba(245,158,11,0.4); }
.widget-note { margin-top: 0.625rem; font-size: 0.8125rem; color: var(--text-tertiary); }

/* ── FAQ (details/summary) ─────────────────────────────── */
.faq-list { margin: 1.5rem 0; }
.faq-list details {
  border: 1px solid var(--border-color); border-radius: 12px;
  margin-bottom: 0.625rem; background: var(--bg-secondary);
  overflow: hidden; transition: border-color 0.2s;
}
.faq-list details[open] { border-color: var(--accent-border); }
.faq-list summary {
  cursor: pointer; padding: 0.9375rem 1.25rem;
  font-size: 1rem; font-weight: 600; color: var(--text-primary);
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  -webkit-user-select: none; user-select: none;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+"; font-size: 1.25rem; font-weight: 400; color: var(--text-tertiary);
  flex-shrink: 0; transition: transform 0.2s;
}
.faq-list details[open] summary::after { transform: rotate(45deg); color: var(--accent); }
.faq-list .faq-a { padding: 0 1.25rem 1rem; }
.faq-list .faq-a p { font-size: 0.9375rem; margin-bottom: 0.625rem; }
.faq-list .faq-a p:last-child { margin-bottom: 0; }
.faq-list .faq-a ul, .faq-list .faq-a ol { font-size: 0.9375rem; margin-bottom: 0.625rem; }

/* ── Key takeaways ─────────────────────────────────────── */
.takeaways {
  background: linear-gradient(135deg, var(--accent-dim), transparent 70%), var(--bg-tertiary);
  border: 1px solid var(--accent-border); border-radius: 16px;
  padding: 1.5rem 1.75rem; margin: 2.5rem 0;
}
.takeaways h2 { margin: 0 0 0.875rem; padding: 0; font-size: 1.25rem; }
.takeaways ul { margin: 0 0 0 1.25rem; }
.takeaways li { margin-bottom: 0.625rem; font-size: 1rem; }

/* ── References ────────────────────────────────────────── */
.references { margin: 1.5rem 0 0; }
.references ol { margin: 0.75rem 0 0 1.25rem; }
.references li { font-size: 0.875rem; color: var(--text-tertiary); margin-bottom: 0.5rem; line-height: 1.6; overflow-wrap: break-word; }
.references a { color: var(--text-secondary); }

/* ── Related links / CTA ───────────────────────────────── */
.related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.875rem; margin: 1.25rem 0 0;
}
.related-card {
  display: block; padding: 1rem 1.125rem;
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: 12px; text-decoration: none !important;
  transition: border-color 0.2s, transform 0.15s;
}
.related-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.related-card b { display: block; color: var(--text-primary); font-size: 0.9375rem; margin-bottom: 0.25rem; }
.related-card span { color: var(--text-tertiary); font-size: 0.8125rem; line-height: 1.5; display: block; }
.app-cta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: 16px; padding: 1.25rem 1.5rem; margin: 2.5rem 0 0;
}
.app-cta img { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; }
.app-cta .cta-copy { flex: 1; min-width: 200px; }
.app-cta .cta-copy b { display: block; color: var(--text-primary); font-size: 1rem; }
.app-cta .cta-copy span { color: var(--text-tertiary); font-size: 0.875rem; }
.app-cta .widget-btn { text-decoration: none !important; color: #fff !important; }

/* ── Footer ────────────────────────────────────────────── */
.guide-footer {
  max-width: 860px; margin: 0 auto; padding: 0 1.25rem 3rem;
  text-align: center; font-size: 0.8125rem; color: var(--text-tertiary);
}
.guide-footer a { color: var(--text-secondary); text-decoration: none; margin: 0 0.5rem; }
.guide-footer a:hover { color: var(--accent); }

/* ── Responsive type ───────────────────────────────────── */
@media (max-width: 640px) {
  .guide-container h2 { font-size: 1.25rem; }
  .guide-container p, .guide-container li { font-size: 1rem; }
  .guide-container th, .guide-container td { padding: 0.625rem 0.75rem; }
  .steps > li { padding-left: 2.75rem; }
}
