/* =========================================================
   Magnolia Insights — shared design system
   Two layouts in one file:
     .slide  → fullscreen concept slide (gradient, big type, CTA)
     .shell  → SaaS app frame (top navbar + sidebar + canvas)
   ========================================================= */

@import url('https://fonts.bunny.net/css?family=inter:400,500,600,700,800|jetbrains-mono:400,500');

:root {
  --bg: #fafbff;
  --surface: #ffffff;
  --surface-2: #f5f3ff;
  --ink: #0b0f23;
  --ink-soft: #475569;
  --ink-mute: #94a3b8;
  --line: #e4e7f0;
  --line-soft: #eef0f6;
  --brand: #4f46e5;
  --brand-deep: #3730a3;
  --brand-soft: #eef2ff;
  --brand-glow: #818cf8;
  --magnolia: #f4dcc1;
  --magnolia-deep: #b27c4a;
  --accent: #f97316;       /* Joe highlight */
  --accent-deep: #c2410c;
  --success: #10b981;
  --danger: #dc2626;
  --warning: #f59e0b;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(13,18,38,0.06);
  --shadow-md: 0 4px 14px rgba(13,18,38,0.08), 0 1px 2px rgba(13,18,38,0.04);
  --shadow-lg: 0 18px 50px rgba(13,18,38,0.15);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg, video { max-width: 100%; height: auto; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font-family: inherit; }
a { color: var(--brand); text-decoration: none; }

/* =========================================================
   SLIDE — full-bleed concept page
   ========================================================= */

.slide {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(circle at 15% 20%, rgba(129,140,248,0.18) 0, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(244,220,193,0.40) 0, transparent 40%),
    linear-gradient(180deg, #fefdfa 0%, #fafbff 100%);
  position: relative;
  overflow: hidden;
}

.slide.dark {
  background:
    radial-gradient(circle at 15% 20%, rgba(129,140,248,0.30) 0, transparent 50%),
    radial-gradient(circle at 85% 75%, rgba(249,115,22,0.20) 0, transparent 45%),
    linear-gradient(180deg, #0b0f23 0%, #1a1b3a 100%);
  color: #fafbff;
}
.slide.dark .lede { color: #cbd5f5; }
.slide.dark .progress-dot { background: rgba(255,255,255,0.25); }
.slide.dark .progress-dot.active { background: #fff; }
.slide.dark .chip { background: rgba(255,255,255,0.08); color: #cbd5f5; border-color: rgba(255,255,255,0.15); }
.slide.dark .arrow-link { color: rgba(255,255,255,0.7); }
.slide.dark .arrow-link:hover { color: #fff; }

.slide-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.5rem 2.5rem; font-size: 0.85rem;
}
.slide-top .brand-mark {
  display: flex; align-items: center; gap: 0.55rem;
  font-weight: 700; color: var(--ink); letter-spacing: -0.01em;
}
.slide.dark .slide-top .brand-mark { color: #fff; }
.brand-mark .dot {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, #818cf8 0%, #f97316 100%);
  display: inline-block;
}
.progress-dots { display: flex; gap: 6px; }
.progress-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(15,23,42,0.15);
}
.progress-dot.active { background: var(--brand); transform: scale(1.4); }
.progress-dot.passed { background: var(--brand-glow); }

.arrow-link {
  display: inline-flex; align-items: center; gap: 0.3rem;
  color: var(--ink-soft); font-size: 0.85rem;
  font-weight: 500;
}
.arrow-link:hover { color: var(--brand); }

.slide-body {
  max-width: 78rem; margin: 0 auto; padding: 0 2.5rem;
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 4rem;
  align-items: center; width: 100%;
}
.slide-body.center { grid-template-columns: 1fr; text-align: center; }
.slide-body.center .lede { margin-left: auto; margin-right: auto; }

.eyebrow {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.18em;
  padding: 0.32rem 0.7rem; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-deep);
  margin-bottom: 1.3rem;
}
.slide.dark .eyebrow { background: rgba(129,140,248,0.18); color: #c7d2fe; }

h1.title {
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  font-weight: 800; letter-spacing: -0.025em;
  margin: 0 0 1rem; line-height: 1.05;
}
h1.title em { font-style: normal; color: var(--brand); }
.slide.dark h1.title em { color: var(--brand-glow); }

.lede {
  font-size: clamp(1.05rem, 1.3vw, 1.25rem);
  color: var(--ink-soft); max-width: 36rem;
  margin: 0 0 1.8rem;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; }
.cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--brand); color: #fff;
  border: none; border-radius: 999px;
  padding: 0.85rem 1.45rem;
  font-size: 1.0rem; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.cta.warm { background: var(--accent); }
.cta.warm:hover { background: var(--accent-deep); }
.cta-secondary {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--ink-soft); font-size: 0.92rem; font-weight: 500;
  padding: 0.5rem 0.9rem; border-radius: 999px;
}
.cta-secondary:hover { color: var(--brand); background: var(--brand-soft); }

.slide-visual {
  display: flex; align-items: center; justify-content: center;
}
.visual-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 1.5rem 1.8rem; max-width: 28rem; width: 100%;
}
.slide.dark .visual-card { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); color: #fafbff; }

.big-stat { font-size: 4rem; font-weight: 800; color: var(--brand);
            letter-spacing: -0.03em; line-height: 1; }
.slide.dark .big-stat { color: var(--brand-glow); }
.big-stat-label { font-size: 0.8rem; color: var(--ink-mute);
                  text-transform: uppercase; letter-spacing: 0.1em; }

.slide-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.5rem 2.5rem; font-size: 0.85rem;
}
.foot-label { color: var(--ink-mute); font-family: var(--mono); font-size: 0.78rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.6rem; }
.chip {
  font-size: 0.8rem; padding: 0.32rem 0.7rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-soft);
  border: 1px solid var(--line);
}

@media (max-width: 800px) {
  .slide-body { grid-template-columns: 1fr; padding: 2rem 1.25rem; }
  .slide-top, .slide-foot { padding: 1rem 1.25rem; }
}

/* =========================================================
   SHELL — SaaS app frame (used by demo pages)
   ========================================================= */

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "logo  topnav"
    "side  main";
  height: 100vh; min-height: 100vh;
}

.shell-logo {
  grid-area: logo;
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0 1.1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #1f1f47 0%, #2d1b69 100%);
  color: #fff;
}
.shell-logo .dot {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, #818cf8 0%, #f97316 100%);
}
.shell-logo .name { font-weight: 700; letter-spacing: -0.01em; font-size: 0.97rem; }
.shell-logo .name span { color: #a5b4fc; font-weight: 500; }

.shell-topnav {
  grid-area: topnav;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.crumb {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.85rem; color: var(--ink-soft);
}
.crumb .sep { color: var(--ink-mute); }
.crumb .here { color: var(--ink); font-weight: 600; }

.topnav-actions { display: flex; align-items: center; gap: 0.8rem; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.78rem;
}
.search-mock {
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 0.35rem 0.7rem; border-radius: 999px;
  color: var(--ink-mute); font-size: 0.82rem; min-width: 16rem;
}

.shell-side {
  grid-area: side;
  background: linear-gradient(180deg, #fafbff 0%, #f5f3ff 100%);
  border-right: 1px solid var(--line);
  padding: 0.6rem 0.5rem;
  overflow-y: auto;
}
.side-section-label {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-mute); padding: 0.8rem 0.7rem 0.3rem;
  font-weight: 600;
}
.side-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.7rem; border-radius: 6px;
  font-size: 0.88rem; color: var(--ink-soft);
  text-decoration: none; font-weight: 500;
  margin: 1px 0;
}
.side-link:hover { background: var(--surface); color: var(--ink); }
.side-link.active {
  background: var(--brand); color: #fff;
  box-shadow: 0 2px 8px rgba(79,70,229,0.30);
}
.side-link .icn {
  width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.shell-main {
  grid-area: main;
  overflow-y: auto;
  background: var(--bg);
}
.canvas {
  max-width: 1240px; padding: 1.5rem 2rem 4.5rem; margin: 0 auto;
}
.canvas-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.9rem;
}
.canvas-header h1 {
  font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 0.2rem; line-height: 1.2;
}
.canvas-header .sub {
  color: var(--ink-soft); font-size: 0.92rem;
}
.toolbar {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}

/* slideshow footer pinned to canvas bottom (in-flow, not fixed) */
.deck-foot {
  position: fixed; bottom: 1.1rem; right: 1.25rem;
  display: flex; gap: 0.5rem; z-index: 50;
}
.deck-foot a {
  background: rgba(11,15,35,0.92); color: #fff;
  font-family: var(--font); font-size: 0.85rem; font-weight: 500;
  padding: 0.55rem 1rem; border-radius: 999px;
  box-shadow: var(--shadow-md); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.deck-foot a:hover { background: var(--brand); }
.deck-foot a.primary { background: var(--brand); }
.deck-foot a.primary:hover { background: var(--brand-deep); }

/* ----------- shared UI primitives used inside demos ----------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 1.05rem 1.2rem;
}
.card-tight { padding: 0.85rem 1rem; }
.card h3 { margin: 0 0 0.55rem; font-size: 0.98rem; font-weight: 600;
           letter-spacing: -0.01em; }
.card-label {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-mute); font-weight: 600; margin-bottom: 0.3rem;
}
.card-stat {
  font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.card-stat.brand { color: var(--brand); }

.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { min-width: 0; }
.col { flex: 1 1 0; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; font-size: 0.88rem; }
.kv dt { color: var(--ink-mute); font-weight: 500; }
.kv dd { margin: 0; color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--brand); color: #fff;
  border: none; border-radius: 7px;
  padding: 0.5rem 0.95rem;
  font-family: var(--font); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: background 0.15s ease;
}
.btn:hover { background: var(--brand-deep); }
.btn.ghost {
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--line); box-shadow: none;
}
.btn.ghost:hover { background: var(--surface-2); color: var(--brand); }
.btn.warm { background: var(--accent); }
.btn.warm:hover { background: var(--accent-deep); }
.btn.danger { background: var(--danger); }

button.chip-toggle {
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem; font-weight: 500; cursor: pointer;
}
button.chip-toggle:hover { color: var(--brand); border-color: var(--brand-glow); }
button.chip-toggle.active {
  background: var(--brand); color: #fff; border-color: var(--brand);
  box-shadow: 0 1px 4px rgba(79,70,229,0.30);
}

table.tidy {
  width: 100%; border-collapse: collapse; font-size: 0.88rem;
}
table.tidy th, table.tidy td {
  border-bottom: 1px solid var(--line-soft);
  padding: 0.45rem 0.6rem; text-align: left;
}
table.tidy th {
  color: var(--ink-mute); font-weight: 600; font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--surface-2);
}
table.tidy tr.highlight { background: #fff7ed; }
table.tidy tr.highlight td { font-weight: 600; }
table.tidy .num { text-align: right; font-variant-numeric: tabular-nums; }

.pill { display: inline-block; padding: 0.16rem 0.55rem; border-radius: 999px;
        font-family: var(--font); font-size: 0.72rem; font-weight: 600;
        background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }
.pill.ok { background: #ecfdf5; color: var(--success); border-color: #a7f3d0; }
.pill.warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.pill.danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.pill.brand { background: var(--brand-soft); color: var(--brand-deep); border-color: #c7d2fe; }
.pill.warm { background: #fff7ed; color: var(--accent-deep); border-color: #fed7aa; }

.code-block {
  font-family: var(--mono); font-size: 0.78rem;
  background: #0b0f23; color: #e4e7ef;
  border-radius: var(--radius-sm); padding: 0.75rem 0.95rem;
  overflow-x: auto;
}

input[type="range"] { width: 100%; accent-color: var(--brand); }

.joe-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.6rem; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 0.75rem; font-weight: 600;
  box-shadow: 0 2px 8px rgba(249,115,22,0.30);
}

/* loose grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.85rem; }
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }

  /* On mobile the desktop app-shell (fixed 100vh + internal scroll + sidebar grid)
     doesn't work. Flow it as a normal scrolling document instead. */
  .shell {
    display: block;
    height: auto;
    min-height: 100vh;
  }
  .shell-logo { border-right: none; padding: 0.7rem 1.1rem; }
  .shell-topnav { padding: 0.65rem 1rem; }
  .crumb { flex-wrap: wrap; font-size: 0.78rem; }

  /* Sidebar becomes a horizontal, scrollable nav strip so demos stay reachable */
  .shell-side {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0.75rem;
    border-right: none;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }
  .shell-side::-webkit-scrollbar { display: none; }
  .shell-side .side-section-label { display: none; }
  .shell-side .side-link { flex: none; white-space: nowrap; margin: 0; }

  .shell-main { overflow: visible; height: auto; }
  .canvas { padding: 1.1rem 1rem 2rem; }
  .canvas-header { flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .canvas-header h1 { font-size: 1.3rem; }
  .toolbar { gap: 0.4rem; }

  /* the floating prev/next pills duplicate the now-horizontal top nav */
  .deck-foot { display: none; }
}

.muted { color: var(--ink-mute); }
.small { font-size: 0.84rem; }
.tabular { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
