/* ==========================================================================
   Kingshot Help — design tokens
   Mirrors the kingshot-bot.com graphic charter (src/app/globals.css, .dark
   variant — the main site renders dark by default). The accent color set in
   Ghost Admin (Settings → Design) is available as var(--ghost-accent-color)
   and overrides --accent below.
   ========================================================================== */
:root {
    --bg: oklch(0.12 0.015 264);
    --bg-panel: oklch(0.18 0.02 264);
    --bg-panel-hover: oklch(0.22 0.02 264);
    --border: oklch(0.3 0.03 264);
    --text: oklch(0.95 0.01 264);
    --text-muted: oklch(0.7 0.02 264);
    --accent: var(--ghost-accent-color, oklch(0.7 0.27 274));
    --accent-2: oklch(0.65 0.25 192);
    --accent-glow: oklch(0.7 0.27 274 / 0.25);
    --gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    --font-heading: var(--gh-font-heading, "Geist", system-ui, sans-serif);
    --font-body: var(--gh-font-body, "Geist", system-ui, sans-serif);
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --container: 1160px;
    --container-narrow: 760px;
}

/* Base ------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.25; margin: 0 0 .5em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: var(--container-narrow); }

/* Buttons ---------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 14px; white-space: nowrap;
    transition: filter .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn-primary {
    background: var(--gradient); color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-ghost { color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-panel-hover); }

/* Header ----------------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: oklch(0.12 0.015 264 / 0.85); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.site-brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.site-brand:hover { text-decoration: none; }
.site-logo { height: 32px; width: auto; }
.site-logo-glyph { font-size: 24px; }
.site-title { font-family: var(--font-heading); font-weight: 700; font-size: 18px; }
.site-nav { flex: 1; }
.site-nav .nav { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.site-nav .nav a { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.site-nav .nav a:hover { color: var(--text); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.site-nav-product { display: flex; gap: 18px; }
.site-nav-product a { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.site-nav-product a:hover { color: var(--text); text-decoration: none; }
.btn-primary svg { vertical-align: -2px; margin-right: 6px; }
.search-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--bg-panel); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 14px; font-size: 14px; font-family: var(--font-body);
    cursor: pointer; transition: border-color .15s ease;
}
.search-btn:hover { border-color: var(--accent); color: var(--text); }

/* Hero ------------------------------------------------------------------- */
.hero { padding: 72px 0 56px; text-align: center;
    background: radial-gradient(ellipse 60% 80% at 50% -20%, oklch(0.7 0.27 274 / 0.18), transparent); }
.hero-small { padding: 48px 0 24px; text-align: left; }
.hero-title { font-size: clamp(32px, 5vw, 48px); }
.hero-subtitle { color: var(--text-muted); font-size: 18px; max-width: 640px; margin: 0 auto 32px; }
.hero-small .hero-subtitle { margin: 0; }
.hero-search {
    display: inline-flex; align-items: center; gap: 12px;
    width: min(560px, 100%); padding: 14px 20px;
    background: var(--bg-panel); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 15px; font-family: var(--font-body); cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.hero-search:hover { border-color: var(--accent); box-shadow: 0 0 0 4px oklch(0.7 0.27 274 / 0.12); }

/* Sections / grids ------------------------------------------------------- */
.section-title { font-size: 22px; margin: 0 0 20px; }
.categories, .latest, .related { padding: 32px 0; }
.card-grid, .post-grid {
    display: grid; gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.category-card {
    display: block; padding: 24px;
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text);
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.category-card:hover { text-decoration: none; border-color: var(--accent); background: var(--bg-panel-hover); transform: translateY(-2px); }
.category-card h3 { font-size: 17px; margin-bottom: 6px; }
.category-card p { color: var(--text-muted); font-size: 14px; margin: 0 0 12px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.category-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; margin-bottom: 12px; }
.category-count { color: var(--accent); font-size: 13px; font-weight: 600; }

/* Post cards ------------------------------------------------------------- */
.post-card {
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: border-color .15s ease, transform .15s ease;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-card-link { display: block; color: var(--text); }
.post-card-link:hover { text-decoration: none; }
.post-card-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.post-card-content { padding: 20px; }
.post-card-tag { color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.post-card-title { font-size: 17px; margin: 8px 0; }
.post-card-excerpt { color: var(--text-muted); font-size: 14px; margin: 0 0 14px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-meta { color: var(--text-muted); font-size: 13px; display: flex; gap: 8px; }

/* Article ---------------------------------------------------------------- */
.article-header { padding: 48px 24px 8px; }
.article-breadcrumb { display: flex; gap: 8px; color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.article-title { font-size: clamp(28px, 4vw, 40px); }
.article-excerpt { color: var(--text-muted); font-size: 18px; }
.article-meta { color: var(--text-muted); font-size: 14px; display: flex; gap: 8px; margin-top: 8px; }
.article-image { margin: 24px auto; padding: 0 24px; }
.article-image img { border-radius: var(--radius); }
.article-content { padding: 16px 24px 48px; }

/* Ghost content styles */
.gh-content > * + * { margin-top: 1.2em; }
.gh-content h2 { font-size: 26px; margin-top: 1.8em; }
.gh-content h3 { font-size: 21px; margin-top: 1.5em; }
.gh-content img { border-radius: var(--radius); }
.gh-content blockquote {
    margin: 1.5em 0; padding: 12px 20px;
    border-left: 3px solid var(--accent);
    background: var(--bg-panel); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-muted);
}
.gh-content code {
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 4px; padding: 2px 6px; font-size: .9em;
}
.gh-content pre {
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 16px 20px; overflow-x: auto;
}
.gh-content pre code { background: none; border: none; padding: 0; }
.gh-content hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.gh-content .kg-callout-card { border-radius: var(--radius-sm); }
.gh-content table { width: 100%; border-collapse: collapse; }
.gh-content th, .gh-content td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.gh-content th { background: var(--bg-panel); }

/* Koenig gallery and bookmark cards.
   Required by gscan, which the CI runs with --fatal, and genuinely missing:
   an editor who dropped a gallery or a link bookmark into an article got
   unstyled markup. */
.kg-gallery-container { display: flex; flex-direction: column; gap: 8px; margin: 1.5em 0; }
.kg-gallery-row { display: flex; gap: 8px; }
.kg-gallery-image img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }

.kg-bookmark-card { margin: 1.5em 0; }
.kg-bookmark-container {
    display: flex; align-items: stretch; min-height: 100px;
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden; color: var(--text);
}
.kg-bookmark-container:hover { border-color: var(--accent); text-decoration: none; }
.kg-bookmark-content { flex: 1 1 auto; padding: 18px 20px; min-width: 0; }
.kg-bookmark-title { font-family: var(--font-heading); font-weight: 600; font-size: 15px; }
.kg-bookmark-description {
    margin-top: 6px; color: var(--text-muted); font-size: 14px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kg-bookmark-metadata {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin-top: 12px; color: var(--text-muted); font-size: 13px;
}
.kg-bookmark-icon { width: 18px; height: 18px; border-radius: 4px; }
.kg-bookmark-author, .kg-bookmark-publisher { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kg-bookmark-thumbnail { flex: 0 0 180px; max-width: 180px; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 600px) {
    .kg-bookmark-container { flex-direction: column-reverse; }
    .kg-bookmark-thumbnail { flex: 0 0 auto; max-width: none; aspect-ratio: 16 / 9; }
}

/* Koenig editor wide/full-width image cards */
.kg-width-wide { width: 100%; max-width: calc(var(--container-narrow) + 200px); margin-left: auto; margin-right: auto; }
.kg-width-full {
    width: 100vw; max-width: 100vw;
    position: relative; left: 50%; right: 50%;
    margin-left: -50vw; margin-right: -50vw;
}
.kg-width-full img { border-radius: 0; }

/* Pagination ------------------------------------------------------------- */
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 32px 0; color: var(--text-muted); font-size: 14px; }

/* Footer ----------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 40px 0; }
.footer-inner { display: flex; flex-direction: column; gap: 16px; }
.footer-desc { color: var(--text-muted); font-size: 14px; margin: 4px 0 0; }
.footer-nav .nav { display: flex; flex-wrap: wrap; gap: 16px; list-style: none; margin: 0; padding: 0; }
.footer-nav .nav a { color: var(--text-muted); font-size: 14px; }
.footer-copy { color: var(--text-muted); font-size: 13px; margin: 0; }

/* Home page -------------------------------------------------------------- */
.home { padding-bottom: 24px; }
.home > section { padding: 28px 0; }

.home-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }
.home-chips a {
    padding: 6px 14px; border-radius: 999px;
    background: var(--bg-panel); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 13.5px; font-weight: 500;
}
.home-chips a:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }

/* Start here ------------------------------------------------------------- */
.home-steps {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px;
}
.home-steps a {
    display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto;
    column-gap: 12px; row-gap: 4px; height: 100%;
    padding: 16px 18px; border-radius: var(--radius);
    background: var(--bg-panel); border: 1px solid var(--border); color: var(--text);
}
.home-steps a:hover { border-color: var(--accent); text-decoration: none; }
.home-step-n {
    grid-row: 1 / span 2;
    width: 28px; height: 28px; border-radius: 999px;
    display: grid; place-items: center;
    background: var(--gradient); color: #fff;
    font-family: var(--font-heading); font-weight: 700; font-size: 14px;
}
.home-step-t { font-family: var(--font-heading); font-weight: 600; font-size: 15px; }
.home-step-x { color: var(--text-muted); font-size: 13.5px; }

/* Most read -------------------------------------------------------------- */
.home-popular-list {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px;
}
.home-popular-list a {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    background: var(--bg-panel); border: 1px solid var(--border); color: var(--text);
}
.home-popular-list a:hover { border-color: var(--accent); text-decoration: none; }
.home-popular-title { font-size: 14.5px; font-weight: 500; }
.home-popular-tag {
    flex: 0 0 auto; color: var(--text-muted); font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
}

/* Category panels -------------------------------------------------------- */
.home-cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.home-cat {
    padding: 20px 22px; border-radius: var(--radius);
    background: var(--bg-panel); border: 1px solid var(--border);
}
.home-cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.home-cat-title { font-size: 17px; margin: 0; }
.home-cat-title a { color: var(--text); }
.home-cat-count { flex: 0 0 auto; color: var(--text-muted); font-size: 12.5px; }
.home-cat-desc { color: var(--text-muted); font-size: 13.5px; margin: 6px 0 0; }
.home-cat-list { list-style: none; margin: 12px 0 0; padding: 0; }
.home-cat-list li + li { margin-top: 2px; }
.home-cat-list a {
    display: block; padding: 5px 8px; margin-left: -8px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-size: 13.5px; line-height: 1.45;
}
.home-cat-list a:hover { background: var(--bg-panel-hover); color: var(--text); text-decoration: none; }
.home-cat-more { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 600; }

/* Still stuck ------------------------------------------------------------ */
.home-ask {
    text-align: center; margin-top: 8px;
    padding: 32px 24px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-panel);
}
.home-ask h2 { font-size: 20px; margin: 0 0 6px; }
.home-ask p { color: var(--text-muted); margin: 0 auto 18px; max-width: 520px; }
.home-ask-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* Docs layout ------------------------------------------------------------
   Three columns on a wide screen: topic tree, article, table of contents.
   The tree is the internal linking for the whole help centre, so it ships in
   the served HTML of every article and category page, not injected later. */
.docs-shell {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr) 216px;
    gap: 40px;
    align-items: start;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
}
.docs-main { min-width: 0; }
.docs-main .gh-content { max-width: var(--container-narrow); }

/* Sidebar ---------------------------------------------------------------- */
.docs-sidebar {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 32px 20px 24px 0;
    border-right: 1px solid var(--border);
}
.docs-nav-heading {
    font-family: var(--font-heading); font-weight: 700; font-size: 12px;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-muted); margin: 0 0 12px;
}
.docs-nav-groups, .docs-nav-list { list-style: none; margin: 0; padding: 0; }
.docs-nav-group + .docs-nav-group { margin-top: 2px; }
.docs-nav-group-title {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 10px; border-radius: var(--radius-sm);
    font-family: var(--font-heading); font-weight: 600; font-size: 14px;
    color: var(--text); cursor: pointer; list-style: none;
}
.docs-nav-group-title::-webkit-details-marker { display: none; }
.docs-nav-group-title:hover { background: var(--bg-panel-hover); }
.docs-nav-count {
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 999px; padding: 1px 7px;
}
.docs-nav-list { margin: 2px 0 10px; padding-left: 10px; border-left: 1px solid var(--border); }
.docs-nav-link, .docs-nav-all a {
    display: block; padding: 5px 10px; border-radius: var(--radius-sm);
    font-size: 13.5px; line-height: 1.45; color: var(--text-muted);
}
.docs-nav-link:hover, .docs-nav-all a:hover {
    background: var(--bg-panel-hover); color: var(--text); text-decoration: none;
}
.docs-nav-link.is-current {
    background: var(--bg-panel); color: var(--text); font-weight: 600;
    box-shadow: inset 2px 0 0 var(--accent);
}
.docs-nav-all a { color: var(--accent); font-size: 12.5px; }

/* Drawer trigger, hidden on desktop ------------------------------------- */
.docs-nav-toggle {
    display: none;
    align-items: center; gap: 8px;
    margin: 20px 0 0; padding: 9px 14px;
    background: var(--bg-panel); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: 14px; font-weight: 500; cursor: pointer;
}
.docs-nav-toggle:hover { border-color: var(--accent); }

/* Table of contents ------------------------------------------------------ */
.docs-aside {
    position: sticky; top: 88px;
    max-height: calc(100vh - 112px); overflow-y: auto;
    padding: 36px 0 24px;
}
.docs-aside[hidden] { display: none; }
.docs-aside-title {
    font-family: var(--font-heading); font-weight: 700; font-size: 12px;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-muted); margin: 0 0 10px;
}
.docs-toc { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.docs-toc-item.is-sub { padding-left: 12px; }
.docs-toc-link {
    display: block; padding: 4px 10px; margin-left: -1px;
    font-size: 13px; line-height: 1.4; color: var(--text-muted);
    border-left: 2px solid transparent;
}
.docs-toc-link:hover { color: var(--text); text-decoration: none; }
.docs-toc-link.is-active { color: var(--text); border-left-color: var(--accent); }

/* Article inside the docs grid. The old layout got its horizontal padding
   from .container-narrow wrappers; the grid supplies that now. */
.docs-main .article-header { padding: 32px 0 8px; }
.docs-main .article-content { padding: 16px 0 48px; }
.docs-main .article-image { margin: 24px 0; padding: 0; }
.docs-main .related { padding: 24px 0 48px; border-top: 1px solid var(--border); }
.docs-main .hero-title { margin-top: 28px; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 1180px) {
    .docs-shell { grid-template-columns: 252px minmax(0, 1fr); }
    .docs-aside { display: none; }
}

@media (max-width: 920px) {
    .docs-shell { grid-template-columns: 1fr; gap: 0; }
    .docs-nav-toggle { display: inline-flex; }
    /* Collapsed by default below this width: the tree would otherwise push
       the article a full screen down. */
    .docs-sidebar {
        display: none;
        position: static; max-height: none; overflow: visible;
        border-right: 0; border-bottom: 1px solid var(--border);
        padding: 8px 0 16px;
    }
    .docs-shell.is-nav-open .docs-sidebar { display: block; }
}

@media (max-width: 800px) {
    .site-nav { display: none; }
    .site-nav-product { display: none; }
    .search-btn span { display: none; }
    .hero { padding: 48px 0 36px; }
}
