/* Ghostwriter base theme — CSS variable system for per-tenant theming */

:root {
    /* Brand tokens — overridden via Ghost code injection per tenant */
    --gw-color-primary: #6B46C1;
    --gw-color-primary-hover: #553C9A;
    --gw-color-bg: #0F0F13;
    --gw-color-surface: #1A1A22;
    --gw-color-surface-elevated: #252530;
    --gw-color-text: #F0EFF5;
    --gw-color-text-muted: #9B98B3;
    --gw-color-border: #2E2D3D;
    --gw-font-heading: 'Inter', system-ui, sans-serif;
    --gw-font-body: 'Inter', system-ui, sans-serif;
    --gw-radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    background: var(--gw-color-bg);
    color: var(--gw-color-text);
    font-family: var(--gw-font-body);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Nav */
.gw-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gw-color-border);
    background: var(--gw-color-surface);
    position: sticky;
    top: 0;
    z-index: 100;
}

.gw-nav__logo { text-decoration: none; color: var(--gw-color-text); font-weight: 700; }
.gw-nav__logo img { height: 40px; width: auto; }
.gw-nav__actions { display: flex; gap: 0.75rem; align-items: center; }

/* Buttons */
.gw-btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: var(--gw-radius);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border: none;
}
.gw-btn--primary { background: var(--gw-color-primary); color: #fff; }
.gw-btn--primary:hover { background: var(--gw-color-primary-hover); }
.gw-btn--ghost { background: transparent; color: var(--gw-color-text); border: 1px solid var(--gw-color-border); }
.gw-btn--ghost:hover { background: var(--gw-color-surface-elevated); }
.gw-btn--lg { padding: 0.75rem 2rem; font-size: 1.05rem; }

/* Layout */
main { flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; padding: 2rem 1.5rem; }

/* Section */
.gw-section { margin: 3rem 0; }
.gw-section__title { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.5rem; color: var(--gw-color-text); }

/* Grid */
.gw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem; }
.gw-courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; }

/* Cards */
.gw-card { background: var(--gw-color-surface); border-radius: var(--gw-radius); overflow: hidden; border: 1px solid var(--gw-color-border); transition: transform 0.15s; }
.gw-card:hover { transform: translateY(-2px); }
.gw-card img { width: 100%; height: 160px; object-fit: cover; display: block; }
.gw-card__content { padding: 1rem; }
.gw-card__content h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.gw-card__content h3 a { text-decoration: none; color: var(--gw-color-text); }
.gw-card__tag { font-size: 0.75rem; color: var(--gw-color-primary); text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 0.25rem; }

/* Course card */
.gw-course-card { background: var(--gw-color-surface); border-radius: var(--gw-radius); border: 1px solid var(--gw-color-border); overflow: hidden; }
.gw-course-card a { text-decoration: none; color: inherit; display: block; }
.gw-course-card__image { height: 140px; background-size: cover; background-position: center; }
.gw-course-card__content { padding: 1rem; }
.gw-course-card__title { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.gw-course-card__desc { font-size: 0.85rem; color: var(--gw-color-text-muted); margin-bottom: 0.5rem; }
.gw-course-card__count { font-size: 0.75rem; color: var(--gw-color-primary); }

/* Hero */
.gw-hero { position: relative; border-radius: var(--gw-radius); overflow: hidden; margin-bottom: 2rem; min-height: 400px; display: flex; align-items: flex-end; }
.gw-hero__image { position: absolute; inset: 0; background-size: cover; background-position: center; }
.gw-hero__image::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%); }
.gw-hero__content { position: relative; z-index: 1; padding: 2rem; }
.gw-hero__title { font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 800; margin-bottom: 1rem; }
.gw-hero__excerpt { color: rgba(255,255,255,0.8); margin-bottom: 1.5rem; max-width: 60ch; }

/* CTA */
.gw-cta { text-align: center; padding: 4rem 1rem; background: var(--gw-color-surface); border-radius: var(--gw-radius); margin: 2rem 0; }
.gw-cta h2 { font-size: 2rem; margin-bottom: 1rem; }
.gw-cta p { color: var(--gw-color-text-muted); max-width: 50ch; margin: 0 auto 2rem; }

/* Course page */
.gw-course-header { position: relative; padding: 3rem 0 2rem; margin-bottom: 2rem; }
.gw-course-header__image { border-radius: var(--gw-radius); height: 300px; background-size: cover; background-position: center; margin-bottom: 2rem; }
.gw-course-header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.gw-course-header__count { color: var(--gw-color-primary); margin-top: 0.5rem; }

/* Lesson list */
.gw-lesson-list { list-style: none; }
.gw-lesson-list__item { border-bottom: 1px solid var(--gw-color-border); }
.gw-lesson-list__item a { display: flex; align-items: center; gap: 1rem; padding: 0.875rem 0; text-decoration: none; color: var(--gw-color-text); }
.gw-lesson-list__item--locked a { color: var(--gw-color-text-muted); }
.gw-lesson-list__num { color: var(--gw-color-text-muted); font-size: 0.85rem; min-width: 2rem; }
.gw-lesson-list__lock { margin-left: auto; }

/* Lesson page */
.gw-lesson__content { max-width: 72ch; margin: 0 auto; }
.gw-lesson__title { font-size: 2rem; margin: 1rem 0; }
.gw-lesson__body { margin-top: 2rem; }
.gw-breadcrumb { font-size: 0.85rem; color: var(--gw-color-text-muted); margin-bottom: 0.5rem; }
.gw-breadcrumb a { color: var(--gw-color-primary); text-decoration: none; }

/* Paywall */
.gw-paywall { max-width: 640px; margin: 0 auto; text-align: center; }
.gw-paywall__image { width: 100%; border-radius: var(--gw-radius); margin-bottom: 1.5rem; max-height: 300px; object-fit: cover; }
.gw-paywall h1 { font-size: 1.75rem; margin-bottom: 1rem; }
.gw-paywall__gate { margin-top: 3rem; padding: 2.5rem; background: var(--gw-color-surface); border-radius: var(--gw-radius); border: 1px solid var(--gw-color-border); }
.gw-paywall__gate h2 { margin-bottom: 0.75rem; }
.gw-paywall__gate p { color: var(--gw-color-text-muted); margin-bottom: 1.5rem; }

/* Footer */
.gw-footer { margin-top: auto; border-top: 1px solid var(--gw-color-border); padding: 2rem 1.5rem; background: var(--gw-color-surface); }
.gw-footer__inner { max-width: 1200px; margin: 0 auto; text-align: center; }
.gw-footer__brand { margin-top: 1rem; font-size: 0.75rem; color: var(--gw-color-text-muted); }
.gw-footer__brand a { color: var(--gw-color-text-muted); text-decoration: underline; }

/* Responsive */
@media (max-width: 640px) {
    .gw-nav__actions .gw-btn:not(.gw-btn--primary) { display: none; }
    .gw-grid { grid-template-columns: 1fr; }
    .gw-hero { min-height: 300px; }
}

/* Koenig editor content */
.kg-canvas { max-width: 100%; }
.kg-card { margin: 1.5rem 0; }
.kg-image-card img { border-radius: var(--gw-radius); max-width: 100%; }
.kg-video-card { background: #000; border-radius: var(--gw-radius); overflow: hidden; }

/* Bunny embed container */
.gw-bunny-player { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--gw-radius); margin: 1.5rem 0; }
.gw-bunny-player iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

/* ── Ghost Koenig required classes ─────────────────────────────────────── */
.kg-width-wide {
    margin-left: calc(50% - min(50vw, 720px));
    margin-right: calc(50% - min(50vw, 720px));
    width: auto;
    max-width: min(100vw, 1440px);
}

.kg-width-full {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    width: 100vw;
}

.kg-content-wide { max-width: 1280px; margin: 0 auto; }

/* Koenig gallery */
.kg-gallery-container { display: flex; flex-direction: column; }
.kg-gallery-row { display: flex; flex-direction: row; gap: 0.5rem; margin-bottom: 0.5rem; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }

/* Koenig bookmark card */
.kg-bookmark-card { border: 1px solid var(--gw-color-border); border-radius: var(--gw-radius); overflow: hidden; }
.kg-bookmark-container { display: flex; text-decoration: none; color: inherit; }
.kg-bookmark-content { padding: 1rem; flex: 1; }
.kg-bookmark-title { font-weight: 600; }
.kg-bookmark-description { color: var(--gw-color-text-muted); font-size: 0.9rem; }
.kg-bookmark-thumbnail img { width: 160px; height: 100%; object-fit: cover; }

/* Koenig callout */
.kg-callout-card { display: flex; gap: 1rem; padding: 1.25rem; background: var(--gw-color-surface); border-radius: var(--gw-radius); border-left: 4px solid var(--gw-color-primary); margin: 1.5rem 0; }
.kg-callout-emoji { font-size: 1.5rem; }

/* Koenig toggle */
.kg-toggle-card { border: 1px solid var(--gw-color-border); border-radius: var(--gw-radius); }
.kg-toggle-heading { padding: 1rem; cursor: pointer; font-weight: 600; }
.kg-toggle-content { padding: 0 1rem 1rem; display: none; }
.kg-toggle-card[open] .kg-toggle-content { display: block; }

/* Koenig button */
.kg-btn { display: inline-block; padding: 0.75rem 1.5rem; background: var(--gw-color-primary); color: #fff; border-radius: var(--gw-radius); text-decoration: none; font-weight: 600; }

/* Progress bar (continue watching) */
.gw-progress-bar { height: 3px; background: var(--gw-color-border); border-radius: 2px; margin-top: 0.5rem; }
.gw-progress-bar__fill { height: 100%; background: var(--gw-color-primary); border-radius: 2px; }
