/*
 * PostHog reveal.js theme
 * Built from .interface-design/slides.md + system.md tokens.
 *
 * Brand rules honored here:
 *  - Sentence case (we never text-transform titles)
 *  - Borders-first, shadows rare: the signature hard shadow is `0 3px 0 <border>`
 *  - Brand red (#F54E00) reserved for branding moments, NOT status
 *  - Accent (orange light / yellow dark) points at ONE thing per slide
 *  - Open Runde is the brand font; Inter is the documented fallback when it
 *    isn't available. Drop Open Runde woff2s in fonts/ and add an @font-face
 *    to upgrade — everything below already prefers it.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Code+Pro:wght@400;500;600&display=swap');

:root {
    /* Brand */
    --ph-red: #f54e00;       /* branding only */
    --ph-blue: #1d4aff;
    --ph-yellow: #f9bd2b;

    /* Light surfaces (posthog-3000) */
    --ph-bg: #eeefe9;            /* warm cream fallback */
    /* Signature deck gradient — copied from posthog.com slide system:
       warm beige -> soft purple-blue, top to bottom, black text. */
    --ph-bg-gradient: linear-gradient(180deg, #FFF1D5 0%, #DAE0EB 100%);
    --ph-surface: #ffffff;       /* cards / code blocks */
    --ph-surface-2: #f3f4ef;     /* secondary fill */
    --ph-surface-3: #e9eae3;

    /* Text */
    --ph-text: #151515;          /* neutral-950 */
    --ph-text-secondary: #55564f;/* neutral-750 */
    --ph-text-tertiary: #76776f;

    /* Borders-first depth */
    --ph-border: #d0d1c9;
    --ph-border-strong: #b9bab1;
    --ph-shadow: 3px;            /* hard-shadow offset */

    /* Accent — "look here", one focal point per slide */
    --ph-accent: hsl(19, 100%, 48%);     /* orange */
    --ph-accent-soft: hsl(19, 100%, 48%, 0.12);

    /* Semantic — only when we genuinely mean status */
    --ph-danger: #db3707;
    --ph-warning: #f7a501;
    --ph-success: #388600;

    --r-sm: 4px;
    --r: 6px;
    --r-lg: 10px;

    --font-body: 'Open Runde', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-title: 'Open Runde', 'MatterSQ', 'Inter', -apple-system, sans-serif;
    --font-mono: 'Source Code Pro', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* ---- Base deck ---------------------------------------------------------- */
.reveal {
    font-family: var(--font-body);
    font-size: 36px;
    font-weight: 400;
    color: var(--ph-text);
    -webkit-font-smoothing: antialiased;
}
.reveal-viewport { background: var(--ph-bg-gradient); background-color: var(--ph-bg); }

.reveal .slides {
    text-align: left;
}
.reveal .slides section {
    height: 100%;
}

/* Headings — sentence case, never uppercased */
.reveal h1, .reveal h2, .reveal h3, .reveal h4 {
    font-family: var(--font-title);
    color: var(--ph-text);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
    text-transform: none;
    margin: 0 0 0.4em 0;
}
.reveal h1 { font-size: 2.05em; }
.reveal h2 { font-size: 1.55em; }
.reveal h3 { font-size: 1.15em; font-weight: 600; }

.reveal p { line-height: 1.4; margin: 0 0 0.6em 0; }
.reveal strong { font-weight: 600; }
.reveal em { font-style: normal; color: var(--ph-accent); font-weight: 600; }

.reveal a { color: var(--ph-blue); text-decoration: none; border-bottom: 1px solid currentColor; }

.reveal ul, .reveal ol { margin: 0 0 0 1em; }
.reveal li { margin: 0.35em 0; line-height: 1.35; }
.reveal li::marker { color: var(--ph-accent); }

/* ---- Reusable slide components ------------------------------------------ */

/* Small uppercase label (mirrors h5 token: uppercase + letter-spacing) */
.reveal .kicker {
    font-family: var(--font-title);
    font-size: 0.5em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.075em;
    color: var(--ph-accent);
    margin: 0 0 0.6em 0;
    display: block;
}

.reveal .lead {
    font-size: 1.15em;
    color: var(--ph-text-secondary);
    max-width: 22ch;
}

/* Big stat */
.reveal .stat { font-family: var(--font-title); font-weight: 700; font-size: 2.4em; line-height: 1; letter-spacing: -0.02em; }
.reveal .stat-label { color: var(--ph-text-secondary); font-size: 0.7em; }

/* Cards — borders-first with the signature hard shadow */
.reveal .card {
    background: var(--ph-surface);
    border: 1px solid var(--ph-border);
    border-radius: var(--r);
    box-shadow: 0 var(--ph-shadow) 0 var(--ph-border);
    padding: 0.7em 0.85em;
}
.reveal .card.accent { border-color: var(--ph-accent); box-shadow: 0 var(--ph-shadow) 0 var(--ph-accent); }
.reveal .card.data { border-color: var(--ph-blue); box-shadow: 0 var(--ph-shadow) 0 #cdd7ff; }

.reveal .pill {
    display: inline-block;
    font-size: 0.6em;
    font-weight: 600;
    font-family: var(--font-mono);
    padding: 0.15em 0.6em;
    border-radius: 999px;
    border: 1px solid var(--ph-border-strong);
    background: var(--ph-surface);
    color: var(--ph-text-secondary);
}
.reveal .pill.data { border-color: var(--ph-blue); color: var(--ph-blue); }
.reveal .pill.ingest { border-color: var(--ph-accent); color: var(--ph-accent); }

/* Columns */
.reveal .cols { display: flex; gap: 0.8em; align-items: flex-start; }
.reveal .cols > * { flex: 1; min-width: 0; }
.reveal .cols.center { align-items: center; }

/* Callout / gotcha (uses semantic warning, NOT brand red) */
.reveal .gotcha {
    border-left: 4px solid var(--ph-warning);
    background: var(--ph-surface);
    border-radius: 0 var(--r) var(--r) 0;
    padding: 0.5em 0.8em;
    font-size: 0.8em;
}
.reveal .gotcha .gotcha-label {
    font-family: var(--font-title); font-weight: 600; color: #9a6800; font-size: 0.85em;
    text-transform: uppercase; letter-spacing: 0.05em;
}

.reveal .todo {
    border: 2px dashed var(--ph-danger);
    border-radius: var(--r);
    padding: 0.4em 0.7em;
    font-size: 0.62em;
    color: var(--ph-danger);
    font-family: var(--font-mono);
    background: #fff;
}
.reveal .todo b { color: var(--ph-danger); }

.reveal .muted { color: var(--ph-text-secondary); }
.reveal .small { font-size: 0.7em; }
.reveal .xsmall { font-size: 0.58em; }

/* ---- Code blocks -------------------------------------------------------- */
.reveal pre {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.46em;
    line-height: 1.45;
    box-shadow: 0 var(--ph-shadow) 0 var(--ph-border);
    border: 1px solid var(--ph-border);
    border-radius: var(--r);
    margin: 0.3em 0;
}
.reveal pre code {
    background: var(--ph-surface);
    color: var(--ph-text);
    padding: 0.9em 1.1em;
    border-radius: var(--r);
    max-height: 560px;
    overflow: auto;
    -webkit-font-smoothing: auto;
}
.reveal code { font-family: var(--font-mono); }
.reveal :not(pre) > code {
    background: var(--ph-surface-3);
    border: 1px solid var(--ph-border);
    border-radius: var(--r-sm);
    padding: 0.05em 0.35em;
    font-size: 0.85em;
}

/* ---- Title / section slides -------------------------------------------- */
.reveal section.title-slide { display: flex; flex-direction: column; justify-content: center; height: 100%; }
.reveal section.title-slide h1 { font-size: 2.4em; font-weight: 700; }

.reveal section.section-divider {
    display: flex; flex-direction: column; justify-content: center; height: 100%;
}
.reveal section.section-divider h2 { font-size: 2.2em; font-weight: 700; }
.reveal .section-num { font-family: var(--font-mono); color: var(--ph-accent); font-size: 0.9em; }

/* ---- Chrome: progress, slide number, controls -------------------------- */
.reveal .progress { color: var(--ph-accent); height: 4px; }
.reveal .slide-number { background: transparent; color: var(--ph-text-tertiary); font-family: var(--font-mono); font-size: 16px; }
.reveal .controls { color: var(--ph-text-tertiary); }

/* Persistent footer brand line */
.deck-footer {
    position: fixed; bottom: 14px; left: 22px; z-index: 30;
    font-family: var(--font-mono); font-size: 14px; color: var(--ph-text-tertiary);
}
.deck-footer b { color: var(--ph-red); font-weight: 700; }

/* ---- Diagram helpers (pure CSS boxes for the pipeline) ------------------ */
.reveal .node {
    border: 1px solid var(--ph-border-strong);
    border-radius: var(--r);
    background: var(--ph-surface);
    box-shadow: 0 var(--ph-shadow) 0 var(--ph-border);
    padding: 0.5em 0.7em;
    text-align: center;
    font-size: 0.7em;
}
.reveal .node .node-title { font-family: var(--font-title); font-weight: 600; font-size: 1em; }
.reveal .node .node-sub { color: var(--ph-text-secondary); font-size: 0.78em; font-family: var(--font-mono); }
.reveal .node.kafka { border-color: #6b4fbb; box-shadow: 0 var(--ph-shadow) 0 #d8cef0; }
.reveal .node.ingest { border-color: var(--ph-accent); box-shadow: 0 var(--ph-shadow) 0 var(--ph-accent-soft); }
.reveal .node.data { border-color: var(--ph-blue); box-shadow: 0 var(--ph-shadow) 0 #cdd7ff; }
.reveal .arrow { display: flex; align-items: center; justify-content: center; color: var(--ph-text-tertiary); font-size: 1.4em; padding: 0 0.1em; }
/* arrows never stretch to a flex column */
.reveal .cols > .arrow, .reveal .pipe-row > .arrow { flex: 0 0 auto; }
.reveal .node .node-title, .reveal .node .node-sub { white-space: nowrap; }

/* Horizontal pipeline row: nodes size to content, arrows stay thin */
.reveal .pipe-row { display: flex; align-items: center; gap: 0.35em; }
.reveal .pipe-row > .node { flex: 0 1 auto; }

.reveal .stack { display: flex; flex-direction: column; gap: 0.45em; }

/* ---- Dark variant (optional; toggle with `data-theme-dark` on body) ----- */
body.dark {
    --ph-bg: #1c1d22;
    --ph-surface: #25262c;
    --ph-surface-2: #2c2d34;
    --ph-surface-3: #32333a;
    --ph-text: #eeefe9;
    --ph-text-secondary: #b6b7b0;
    --ph-text-tertiary: #8a8b84;
    --ph-border: #3a3b42;
    --ph-border-strong: #4b4c54;
    --ph-accent: hsl(43, 94%, 57%); /* yellow accent in dark */
    --ph-accent-soft: hsl(43, 94%, 57%, 0.14);
}

/* ---- highlight.js — PostHog light palette ------------------------------- */
.reveal .hljs { background: transparent; color: var(--ph-text); }
.reveal .hljs-comment, .reveal .hljs-quote { color: #8a8b84; font-style: italic; }
.reveal .hljs-keyword, .reveal .hljs-selector-tag, .reveal .hljs-built_in, .reveal .hljs-meta { color: #1d4aff; font-weight: 600; }
.reveal .hljs-string, .reveal .hljs-attr, .reveal .hljs-template-string { color: #388600; }
.reveal .hljs-number, .reveal .hljs-literal { color: #b5400a; }
.reveal .hljs-title, .reveal .hljs-title.function_, .reveal .hljs-section { color: #a621c8; font-weight: 600; }
.reveal .hljs-type, .reveal .hljs-class .hljs-title { color: #30abc6; }
.reveal .hljs-name { color: #f54e00; }
.reveal .hljs-attribute { color: #9a6800; }
.reveal .hljs-emphasis { font-style: italic; }
.reveal .hljs-strong { font-weight: 700; }
.reveal .hljs-deletion { background: #fbe3da; }
.reveal .hljs-addition { background: #e3f0d8; }

/* ---- Memes — real Imgflip images, downloaded and served locally -------- */
.reveal .meme-tag {
    display: inline-block; font-family: var(--font-mono); font-size: 0.5em;
    text-transform: uppercase; letter-spacing: 0.1em; color: var(--ph-accent);
    border: 1px dashed var(--ph-accent); border-radius: 999px;
    padding: 0.1em 0.7em; margin-bottom: 0.5em;
}

/* Real meme images (downloaded from Imgflip, served locally) */
.reveal .meme-img {
    display: block; margin: 0 auto; max-width: 100%; max-height: 500px;
    border: 1px solid var(--ph-border); border-radius: var(--r);
    box-shadow: 0 var(--ph-shadow) 0 var(--ph-border);
}
.reveal .meme-slide { text-align: center; }
.reveal .meme-slide .meme-cap { margin-top: 0.5em; }

/* Max the hedgehog — corner accents on bookend/divider slides only */
.reveal .hog { position: absolute; bottom: 0; right: 12px; max-height: 240px; width: auto; pointer-events: none; z-index: 2; }

/* QR code card — closing slide. Own flex row inside the section so it
   doesn't depend on overriding reveal's section styling. */
.reveal .closing-row { display: flex; align-items: center; gap: 1.6em; width: 100%; }
.reveal .closing-row .closing-text { flex: 1; min-width: 0; }
.reveal .qr-card { flex: 0 0 auto; text-align: center; }
.reveal .qr-card img { width: 220px; height: 220px; display: block; background: #fff; border: 1px solid var(--ph-border); border-radius: var(--r); box-shadow: 0 var(--ph-shadow) 0 var(--ph-border); padding: 10px; }
.reveal .qr-card .qr-cap { font-family: var(--font-mono); font-size: 14px; color: var(--ph-text-secondary); margin-top: 12px; line-height: 1.35; }
