/* ==========================================================================
   Content Tree — a Ghost theme for studert.com
   The blog as a Sitecore content tree: posts are items, tags are templates.
   ========================================================================== */

/* 1. Fonts
   ========================================================================== */

@font-face {
    font-family: "Geist";
    src: url("../fonts/Geist-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Geist Mono";
    src: url("../fonts/GeistMono-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* 2. Tokens
   ========================================================================== */

:root {
    --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
    --font-body: var(--gh-font-body, var(--font-sans));
    --font-heading: var(--gh-font-heading, var(--font-sans));

    /* Sitecore red comes from Ghost's accent colour (Settings → Design). */
    --red: var(--ghost-accent-color, #EB1F1F);
    --action: color-mix(in srgb, var(--red) 88%, #000);
    --action-hover: color-mix(in srgb, var(--red) 74%, #000);
    --amber: #FFB547;
    --ok: #16A34A;

    --topbar-h: 56px;
    --tree-w: 300px;
    --inspector-w: 320px;
    --reading-size: 18px;
    --radius-s: 6px;
    --radius-m: 8px;
    --radius-l: 12px;
    --radius-xl: 14px;

    /* Chrome: tree, top bar, code. Dark in both themes. */
    --chrome: #141417;
    --chrome-2: #1B1B1F;
    --chrome-3: #232328;
    --chrome-line: #2A2A30;
    --chrome-text: #E7E7EA;
    --chrome-muted: #A1A1AA;
    --sel: color-mix(in srgb, var(--red) 16%, var(--chrome));
    --sel-line: color-mix(in srgb, var(--red) 42%, var(--chrome));

    /* Canvas: light theme */
    --canvas: #FAFAF8;
    --surface: #FFFFFF;
    --sunken: #F2F2EF;
    --line: #E4E4E0;
    --line-soft: #EDEDE9;
    --ink: #18181B;
    --ink-2: #27272A;
    --ink-3: #3F3F46;
    --muted: #5F5F66;
    --red-text: color-mix(in srgb, var(--red) 84%, #000);
    --red-soft: color-mix(in srgb, var(--red) 9%, #FFF);
    --red-ink: color-mix(in srgb, var(--red) 68%, #000);
    --info: #1D5FD1;
    --info-soft: #EAF1FD;
    --info-line: #C9DAF8;
    --warn: #8A5A00;
    --warn-soft: #FFF4DC;
    --warn-line: #F2DDAA;
    --hl: #FFE7B8;
    --shadow: 0 12px 32px -18px rgba(0, 0, 0, .35);

    /* Code */
    --code: #111114;
    --code-2: #18181C;
    --code-line: #26262C;
    --code-text: #E7E7EA;
    --code-muted: #8E8E97;
    --code-punc: #A1A1AA;
    --sx-type: #FF8577;
    --sx-fn: #FFC56E;
    --sx-var: #8BD5F0;
    --sx-str: #B9E08A;
    --sx-kw: #C9A7FF;
    --sx-num: #F5A97F;
    --sx-add: #4ADE80;
    --sx-del: #FF8A85;

    color-scheme: light;
}

[data-theme="dark"] {
    --chrome: #0B0B0D;
    --chrome-2: #121215;
    --chrome-3: #1A1A1E;
    --chrome-line: #222227;
    --canvas: #111113;
    --surface: #18181B;
    --sunken: #1E1E22;
    --line: #2A2A30;
    --line-soft: #222227;
    --ink: #F4F4F5;
    --ink-2: #E4E4E7;
    --ink-3: #C9C9CF;
    --muted: #A1A1AA;
    --red-text: color-mix(in srgb, var(--red) 66%, #FFF);
    --red-soft: color-mix(in srgb, var(--red) 16%, #111113);
    --red-ink: color-mix(in srgb, var(--red) 52%, #FFF);
    --info: #7FB0FF;
    --info-soft: #14223A;
    --info-line: #24406B;
    --warn: #F5C26B;
    --warn-soft: #2A2110;
    --warn-line: #4A3A18;
    --hl: #5A4415;
    --shadow: 0 16px 40px -18px rgba(0, 0, 0, .8);
    --code: #0B0B0D;
    --code-2: #131316;
    --code-line: #1F1F24;
    color-scheme: dark;
}

/* No-JS fallback: follow the system setting. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --chrome: #0B0B0D;
        --chrome-2: #121215;
        --chrome-3: #1A1A1E;
        --chrome-line: #222227;
        --canvas: #111113;
        --surface: #18181B;
        --sunken: #1E1E22;
        --line: #2A2A30;
        --line-soft: #222227;
        --ink: #F4F4F5;
        --ink-2: #E4E4E7;
        --ink-3: #C9C9CF;
        --muted: #A1A1AA;
        --red-text: color-mix(in srgb, var(--red) 66%, #FFF);
        --red-soft: color-mix(in srgb, var(--red) 16%, #111113);
        --red-ink: color-mix(in srgb, var(--red) 52%, #FFF);
        --info: #7FB0FF;
        --info-soft: #14223A;
        --info-line: #24406B;
        --warn: #F5C26B;
        --warn-soft: #2A2110;
        --warn-line: #4A3A18;
        --hl: #5A4415;
        --code: #0B0B0D;
        --code-2: #131316;
        --code-line: #1F1F24;
        color-scheme: dark;
    }
}

[data-text-size="s"] { --reading-size: 17px; }
[data-text-size="l"] { --reading-size: 20px; }

/* 3. Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--topbar-h) + 20px);
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; }
img { height: auto; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 2px;
    border-radius: 4px;
}

::selection { background: color-mix(in srgb, var(--red) 28%, transparent); }

.ct-i {
    width: 16px;
    height: 16px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ct-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.ct-skip {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 100;
    padding: 10px 14px;
    background: var(--ink);
    color: var(--canvas);
    border-radius: var(--radius-m);
}
.ct-skip:focus { top: 12px; }

.ct-mono { font-family: var(--font-mono); }

.ct-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

kbd, .ct-kbd {
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--surface);
    color: var(--ink);
}

/* 4. Buttons, chips, badges
   ========================================================================== */

.ct-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-m);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background .15s, border-color .15s, opacity .15s;
}
.ct-btn--sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.ct-btn--action { background: var(--action); color: #FFF; }
.ct-btn--action:hover { background: var(--action-hover); color: #FFF; }
.ct-btn--ink { background: var(--ink); color: var(--canvas); }
.ct-btn--ink:hover { opacity: .88; color: var(--canvas); }
.ct-btn--line { border-color: var(--line); color: var(--ink); font-weight: 550; }
.ct-btn--line:hover { border-color: var(--ink); }
.ct-btn .ct-kbd { background: transparent; border-color: currentColor; color: inherit; opacity: .7; }

.ct-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    background: var(--sunken);
    color: var(--ink);
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}
.ct-chip:hover { border-color: var(--ink); }
.ct-chip--primary { background: var(--red-soft); border-color: transparent; color: var(--red-ink); font-weight: 550; }
.ct-chip__n { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }

.ct-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
}
.ct-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.ct-dot--amber { background: var(--amber); }

/* 5. Top bar
   ========================================================================== */

.ct-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--topbar-h);
    padding: 0 12px 0 20px;
    background: var(--chrome);
    color: var(--chrome-text);
    border-bottom: 1px solid var(--chrome-line);
}

.ct-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #FFF;
    flex: none;
}
.ct-brand__name { font-weight: 650; font-size: 16px; letter-spacing: -.02em; }
.ct-brand img { height: 26px; width: auto; }

.ct-mark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 4px solid var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.ct-mark__eye {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 8px 1px rgba(255, 181, 71, .6);
}

.ct-path {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--chrome-muted);
}
.ct-path b { font-weight: 400; color: var(--chrome-text); }

.ct-topbar__search {
    flex: 1 1 200px;
    display: flex;
    justify-content: center;
    min-width: 0;
}
.ct-searchbox {
    width: 100%;
    max-width: 420px;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 0 12px;
    background: var(--chrome-2);
    border: 1px solid var(--chrome-line);
    border-radius: var(--radius-m);
    color: var(--chrome-muted);
    font-size: 13px;
    text-align: left;
}
.ct-searchbox:hover { border-color: #3A3A42; color: #D4D4D8; }
.ct-searchbox span:first-of-type { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ct-searchbox .ct-kbd { background: transparent; border-color: #3A3A42; color: var(--chrome-muted); border-bottom-width: 1px; }

.ct-topnav { display: flex; align-items: center; gap: 2px; font-size: 13px; }
.ct-topnav__link {
    padding: 9px 12px;
    border-radius: var(--radius-s);
    color: #D4D4D8;
    white-space: nowrap;
}
.ct-topnav__link:hover, .ct-topnav__link[aria-current="page"] { background: var(--chrome-3); color: #FFF; }

.ct-icon-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    border: 0;
    border-radius: var(--radius-s);
    background: transparent;
    color: #D4D4D8;
}
.ct-icon-btn:hover { background: var(--chrome-3); color: #FFF; }

.ct-tree-toggle { display: none; margin-left: -8px; }

.ct-theme { position: relative; }
.ct-theme__icon--dark, .ct-theme__icon--light { display: none; }
[data-theme="dark"] .ct-theme__icon--dark, [data-theme="light"] .ct-theme__icon--light { display: block; }
:root:not([data-theme]) .ct-theme__icon--light { display: block; }

.ct-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 60;
    min-width: 168px;
    padding: 4px;
    background: var(--chrome-2);
    border: 1px solid var(--chrome-line);
    border-radius: 10px;
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .7);
}
.ct-menu[hidden] { display: none; }
.ct-menu button {
    width: 100%;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-s);
    background: transparent;
    color: #D4D4D8;
    font-size: 13px;
    text-align: left;
}
.ct-menu button:hover { background: var(--chrome-3); color: #FFF; }
.ct-menu button[aria-checked="true"] { color: #FFF; }
.ct-menu button[aria-checked="true"]::after {
    content: "";
    margin-left: auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--amber);
}

/* 6. Shell
   ========================================================================== */

.ct-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - var(--topbar-h));
}

.ct-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ct-main > :last-child { margin-top: auto; }

/* 7. Content tree
   ========================================================================== */

.ct-tree {
    flex: 0 0 var(--tree-w);
    width: var(--tree-w);
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 12px 28px;
    background: var(--chrome);
    color: var(--chrome-text);
    border-right: 1px solid var(--chrome-line);
    scrollbar-width: thin;
    scrollbar-color: #3A3A42 transparent;
}

.ct-tree__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--chrome-muted);
}

.ct-tree__progress { margin: -4px 10px 14px; height: 3px; border-radius: 2px; background: var(--chrome-line); overflow: hidden; }
.ct-tree__progress span { display: block; height: 3px; width: 0; background: var(--amber); transition: width .1s linear; }

.ct-tree ul { list-style: none; margin: 0; padding: 0; }
.ct-tree__children {
    margin-left: 16px !important;
    padding-left: 6px !important;
    border-left: 1px solid var(--chrome-line);
}

.ct-node {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-s);
    background: transparent;
    color: #D4D4D8;
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
    white-space: nowrap;
}
.ct-node:hover { background: var(--chrome-3); color: #FFF; }
.ct-node > span:not(.ct-node__meta):not(.ct-node__twist):not(.ct-node__num) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ct-node .ct-i { width: 15px; height: 15px; color: var(--chrome-muted); }
.ct-node__twist { width: 12px; height: 12px; display: inline-flex; flex: none; color: var(--chrome-muted); transition: transform .15s; }
.ct-node__twist .ct-i { width: 12px; height: 12px; stroke-width: 2.4; }
.ct-node[aria-expanded="false"] .ct-node__twist, .ct-node[data-open="false"] .ct-node__twist { transform: rotate(-90deg); }
.ct-node__spacer { width: 12px; flex: none; }
.ct-node__meta { margin-left: auto; padding-left: 8px; font-family: var(--font-mono); font-size: 10px; color: var(--chrome-muted); }
.ct-node__num { font-family: var(--font-mono); color: var(--chrome-muted); flex: none; }
.ct-node--root .ct-i { color: var(--red); }

.ct-node[aria-current="page"], .ct-node.is-current {
    background: var(--sel);
    color: #FFF;
    box-shadow: inset 0 0 0 1px var(--sel-line);
}
.ct-node[aria-current="page"] .ct-i, .ct-node.is-current .ct-i { color: var(--amber); }
.ct-node.is-active-section { color: #FFF; background: var(--chrome-3); }
.ct-node.is-active-section .ct-node__num { color: #FF8577; }
.ct-node--announced { opacity: .75; font-style: italic; }
.ct-node--announced .ct-node__meta { color: var(--amber); font-style: normal; }

.ct-folder[hidden] { display: none; }
.ct-folder > ul[hidden] { display: none; }

.ct-tree__section {
    margin-top: 26px;
    padding: 0 10px 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--chrome-muted);
}

.ct-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px; }
.ct-tags a, .ct-tags button {
    padding: 6px 9px;
    border: 1px solid var(--chrome-line);
    border-radius: var(--radius-s);
    background: transparent;
    color: var(--chrome-text);
    font-size: 12px;
    line-height: 1.2;
}
.ct-tags a:hover { border-color: #4A4A52; color: #FFF; }
.ct-tags a span { color: var(--chrome-muted); }
.ct-tags a.is-current { border-color: var(--sel-line); background: var(--sel); }
.ct-tags.is-collapsed a:nth-of-type(n+9) { display: none; }
.ct-tags button { border-style: dashed; color: var(--chrome-muted); }

.ct-status {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 28px 10px 0;
    padding: 14px;
    background: var(--chrome-2);
    border: 1px solid var(--chrome-line);
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.45;
    color: #D4D4D8;
}
.ct-status__eye {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-m);
    background: var(--chrome-3);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ct-status__eye::after {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--amber);
    animation: ct-glow 3.2s ease-in-out infinite;
}
.ct-status strong { display: block; color: #FFF; font-weight: 600; }

.ct-tree__keys {
    margin: 22px 10px 0;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 2;
    color: var(--chrome-muted);
}
.ct-tree__keys kbd { background: transparent; border-color: #3A3A42; border-bottom-width: 1px; color: var(--chrome-muted); }

@keyframes ct-glow {
    0%, 100% { box-shadow: 0 0 12px 2px rgba(255, 181, 71, .45); }
    50% { box-shadow: 0 0 20px 6px rgba(255, 181, 71, .75); }
}

.ct-scrim {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(10, 10, 12, .6);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

/* 8. Tabs bar
   ========================================================================== */

.ct-tabs {
    position: sticky;
    top: var(--topbar-h);
    z-index: 20;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    background: var(--sunken);
    border-bottom: 1px solid var(--line);
}
.ct-tabs__list { display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: none; }
.ct-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-right: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}
.ct-tab:hover { color: var(--ink); }
.ct-tab[aria-selected="true"], .ct-tab--static {
    background: var(--canvas);
    color: var(--ink);
    font-weight: 550;
    box-shadow: inset 0 2px 0 var(--red);
}
.ct-tab .ct-i { width: 13px; height: 13px; color: var(--red); }
.ct-tab__n {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--line);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
}
.ct-tabs__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px 0 0;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}
.ct-tabs__tool {
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    background: transparent;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 13px;
}
.ct-tabs__tool:hover { border-color: var(--ink); }
.ct-tabs__tool .ct-i { width: 14px; height: 14px; }

/* 9. Sections & layout helpers
   ========================================================================== */

.ct-section { padding: 0 56px 56px; max-width: 1240px; }
.ct-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 14px;
}
.ct-section__title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}
.ct-section__link { font-size: 13px; color: var(--muted); }
.ct-section__link:hover { color: var(--red-text); }

.ct-hero { padding: 72px 56px 48px; max-width: 1180px; }
.ct-hero__path { margin-bottom: 26px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.ct-hero__title {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(52px, 8.2vw, 128px);
    line-height: .9;
    letter-spacing: -.055em;
    text-wrap: balance;
}
.ct-caret {
    display: inline-block;
    width: .42em;
    height: .78em;
    margin-left: .08em;
    background: var(--red);
    vertical-align: -.04em;
    animation: ct-caret 1.05s steps(1) infinite;
}
@keyframes ct-caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.ct-hero__lead { margin: 30px 0 0; max-width: 44ch; font-size: 22px; line-height: 1.5; color: var(--ink-3); }
.ct-hero__actions { margin-top: 34px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ct-byline-mini { margin-left: 8px; display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }

.ct-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    color: var(--canvas);
    font-size: 12px;
    font-weight: 650;
    object-fit: cover;
    overflow: hidden;
}
.ct-avatar--lg { width: 52px; height: 52px; font-size: 16px; }

/* 10. Item cards
   ========================================================================== */

.ct-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    transition: transform .2s, border-color .2s, box-shadow .2s;
}
.ct-card:hover { transform: translateY(-2px); border-color: var(--ink); box-shadow: var(--shadow); }
.ct-card:hover .ct-card__title { color: var(--red-text); }
.ct-card__img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--chrome); }
.ct-card__img--empty { display: flex; align-items: center; justify-content: center; color: var(--chrome-muted); }
.ct-card__img--empty .ct-i { width: 28px; height: 28px; }
.ct-card__body { display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 18px; }
.ct-card__path { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.ct-card__title { font-size: 18px; font-weight: 620; line-height: 1.25; letter-spacing: -.015em; transition: color .2s; }
.ct-card__meta { font-size: 13px; color: var(--muted); }

.ct-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ct-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

.ct-feature {
    display: flex;
    flex-wrap: wrap;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    transition: border-color .2s, box-shadow .2s;
}
.ct-feature:hover { border-color: var(--ink); box-shadow: var(--shadow); }
.ct-feature:hover .ct-feature__title { color: var(--red-text); }
.ct-feature__media { flex: 1 1 420px; min-width: 0; min-height: 360px; position: relative; background: var(--chrome); }
.ct-feature__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ct-feature__fields { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 16px; padding: 26px 28px 22px; }
.ct-feature__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}
.ct-feature__bar > span { display: inline-flex; align-items: center; gap: 6px; }
.ct-feature__bar .ct-status-text { font-weight: 500; color: var(--ink); }
.ct-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-field__label { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 600; color: var(--muted); }
.ct-feature__title { display: block; font-size: 30px; font-weight: 650; line-height: 1.08; letter-spacing: -.03em; transition: color .2s; }
.ct-feature__summary { display: block; font-size: 16px; line-height: 1.55; color: var(--ink-3); }
.ct-feature__stats {
    margin-top: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}
.ct-feature__stats b { display: block; font-weight: 400; font-size: 13px; color: var(--ink); }

.ct-tile {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    transition: border-color .2s;
}
.ct-tile:hover { border-color: var(--ink); }
.ct-tile:hover .ct-tile__title { color: var(--red-text); }
.ct-tile__top { display: flex; align-items: center; justify-content: space-between; }
.ct-tile__top .ct-i { width: 20px; height: 20px; }
.ct-tile:first-child .ct-tile__top .ct-i { color: var(--red); }
.ct-tile__n { font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.ct-tile__title { font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.ct-tile__desc { font-size: 13px; line-height: 1.5; color: var(--muted); }

/* 11. Item list (table)
   ========================================================================== */

.ct-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.ct-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
    height: 38px;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
}
.ct-filter:focus-within { border-color: var(--ink); }
.ct-filter .ct-i { color: var(--muted); }
.ct-filter input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13px; outline: none; }

.ct-list { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.ct-list__head, .ct-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px 110px 72px;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
}
.ct-list__head { padding-block: 10px; background: var(--sunken); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.ct-row { border-bottom: 1px solid var(--line-soft); transition: background .15s; }
.ct-row:last-child { border-bottom: 0; }
.ct-row:hover { background: var(--sunken); }
.ct-row:hover .ct-row__title { color: var(--red-text); }
.ct-row[hidden] { display: none; }
.ct-row__item { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ct-row__thumb {
    width: 72px;
    height: 48px;
    flex: none;
    border-radius: var(--radius-s);
    overflow: hidden;
    background: var(--chrome);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chrome-muted);
}
.ct-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.ct-row__text { min-width: 0; }
.ct-row__title { display: block; font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; transition: color .15s; }
.ct-row__excerpt { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; color: var(--muted); }
.ct-row__tag { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; color: var(--muted); }
.ct-row__date, .ct-row__num { font-family: var(--font-mono); font-size: 12px; }
.ct-row__num, .ct-list__head span:last-child { text-align: right; }
.ct-row--start { background: var(--red-soft); }
.ct-list__empty { padding: 32px 16px; text-align: center; font-size: 14px; color: var(--muted); }

.ct-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}

/* 12. Template (tag) & author headers
   ========================================================================== */

.ct-head { padding: 56px 56px 32px; max-width: 1180px; display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.ct-head__icon {
    width: 72px;
    height: 72px;
    flex: none;
    border-radius: 16px;
    background: var(--chrome);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--red);
    overflow: hidden;
}
.ct-head__icon .ct-i { width: 34px; height: 34px; stroke-width: 1.8; }
.ct-head__icon img { width: 100%; height: 100%; object-fit: cover; }
.ct-head__text { flex: 1 1 400px; min-width: 0; }
.ct-head__kicker { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.ct-head__title { margin: 6px 0 0; font-family: var(--font-heading); font-weight: 700; font-size: clamp(40px, 5vw, 64px); line-height: .98; letter-spacing: -.05em; }
.ct-head__desc { margin: 16px 0 0; max-width: 58ch; font-size: 19px; line-height: 1.55; color: var(--ink-3); }

.ct-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
}
.ct-stats > div { padding: 14px 16px; border-right: 1px solid var(--line-soft); }
.ct-stats > div:last-child { border-right: 0; }
.ct-stats b { display: block; font-size: 26px; font-weight: 650; letter-spacing: -.03em; }
.ct-stats span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.ct-start {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    padding: 16px 18px;
    background: var(--chrome);
    color: var(--chrome-text);
    border-radius: var(--radius-xl);
}
.ct-start img { width: 96px; height: 64px; object-fit: cover; border-radius: var(--radius-m); flex: none; }
.ct-start__text { flex: 1 1 280px; min-width: 0; }
.ct-start__kicker { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--chrome-muted); }
.ct-start__title { display: block; margin-top: 4px; font-size: 18px; font-weight: 650; letter-spacing: -.02em; color: #FFF; }
.ct-start__cta { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid #3A3A42; border-radius: var(--radius-m); font-size: 13px; color: #FFF; }
.ct-start:hover .ct-start__cta { border-color: #FFF; }

/* 13. Article
   ========================================================================== */

.gh-canvas {
    display: grid;
    grid-template-columns:
        [full-start] minmax(20px, 1fr)
        [wide-start] minmax(0, 40px)
        [main-start] min(720px, calc(100% - 40px))
        [main-end] minmax(0, 40px)
        [wide-end] minmax(20px, 1fr)
        [full-end];
}
.gh-canvas > * { grid-column: main; min-width: 0; }
.gh-canvas > .kg-width-wide, .gh-canvas > .ct-code, .gh-canvas > .ct-code-group, .gh-canvas > .kg-code-card, .gh-canvas > pre { grid-column: wide; }
.gh-canvas > .kg-width-full { grid-column: full; }

.ct-article { padding-bottom: 56px; }
.ct-article__head { padding-top: 44px; }

.ct-cover { grid-column: wide; margin: 0 0 12px; }
.ct-cover__img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 8;
    object-fit: cover;
    object-position: center 40%;
    border-radius: var(--radius-xl);
    background: var(--chrome);
}
.ct-cover figcaption, .ct-cover__note { margin-top: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.ct-article__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 24px 0 18px; }
.ct-article__title {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(36px, 4.6vw, 56px);
    line-height: 1.03;
    letter-spacing: -.045em;
    text-wrap: balance;
}
.ct-article__lead { margin: 18px 0 0; font-size: 21px; line-height: 1.55; color: var(--ink-3); }
.ct-byline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 24px;
    font-size: 14px;
    color: var(--muted);
}
.ct-byline a { color: var(--ink); font-weight: 550; }
.ct-byline a:hover { color: var(--red-text); }
.ct-byline__sep { color: var(--line); }

/* Prose */
.gh-content {
    padding-top: 44px;
    font-size: var(--reading-size);
    line-height: 1.75;
    color: var(--ink-2);
    overflow-wrap: break-word;
}
.gh-content > * { margin-top: 0; margin-bottom: 24px; }
.gh-content > p:first-child { font-size: calc(var(--reading-size) + 3px); line-height: 1.6; color: var(--ink); }
.gh-content a { color: var(--red-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.gh-content a:hover { color: var(--ink); }
.gh-content strong, .gh-content b { font-weight: 650; color: var(--ink); }
.gh-content h2, .gh-content h3, .gh-content h4, .gh-content h5, .gh-content h6 {
    position: relative;
    font-family: var(--font-heading);
    color: var(--ink);
    text-wrap: balance;
}
.gh-content h2 { margin: 60px 0 18px; font-size: 32px; font-weight: 650; line-height: 1.15; letter-spacing: -.03em; }
.gh-content h3 { margin: 40px 0 12px; font-size: 21px; font-weight: 650; line-height: 1.3; letter-spacing: -.015em; }
.gh-content h4 { margin: 32px 0 10px; font-size: 18px; font-weight: 650; }
.gh-content h2 + *, .gh-content h3 + *, .gh-content h4 + * { margin-top: 0; }
.ct-h { display: flex; align-items: baseline; gap: 12px; }
.ct-h__num { font-family: var(--font-mono); font-size: 15px; font-weight: 500; color: var(--red-text); flex: none; }
.ct-h--rule { align-items: center; }
.ct-h__rule {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: var(--radius-m);
    background: var(--red-soft);
    color: var(--red-text);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ct-h__rule .ct-i { width: 16px; height: 16px; }
.ct-h__label { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--muted); flex: none; }
.ct-anchor {
    margin-left: 4px;
    font-family: var(--font-mono);
    font-size: .65em;
    font-weight: 400;
    color: var(--muted) !important;
    text-decoration: none !important;
    opacity: 0;
    transition: opacity .15s;
}
.gh-content :is(h2, h3):hover .ct-anchor, .ct-anchor:focus-visible { opacity: 1; }

.gh-content ul, .gh-content ol { padding-left: 0; list-style: none; }
.gh-content li { position: relative; padding-left: 32px; margin: 8px 0; }
.gh-content ul > li::before { content: "—"; position: absolute; left: 0; font-family: var(--font-mono); font-size: .75em; line-height: 2.3; color: var(--muted); }
.gh-content ol { counter-reset: ct-ol; }
.gh-content ol > li { counter-increment: ct-ol; }
.gh-content ol > li::before {
    content: counter(ct-ol, decimal-leading-zero);
    position: absolute;
    left: 0;
    font-family: var(--font-mono);
    font-size: .75em;
    line-height: 2.3;
    color: var(--red-text);
}
.gh-content li > ul, .gh-content li > ol { margin: 8px 0 0; }

.gh-content :not(pre) > code {
    padding: 1px 5px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--sunken);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: .86em;
    overflow-wrap: anywhere;
}

.gh-content hr {
    position: relative;
    height: 24px;
    margin: 40px 0;
    border: 0;
}
.gh-content hr::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--line);
}
.gh-content hr::after {
    content: "⋯";
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    padding: 0 12px;
    background: var(--canvas);
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--muted);
}

/* Quotes: Ghost's first style is a note, the alternate style a pull quote. */
.gh-content blockquote:not(.kg-blockquote-alt) {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 14px;
    margin-inline: 0;
    padding: 16px 18px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-l);
    font-size: .9em;
    line-height: 1.6;
    color: var(--ink-2);
}
.gh-content blockquote:not(.kg-blockquote-alt)::before {
    content: "";
    width: 22px;
    height: 22px;
    margin-top: 2px;
    background: var(--ink);
    -webkit-mask: var(--ct-quote-icon) center / contain no-repeat;
    mask: var(--ct-quote-icon) center / contain no-repeat;
}
.gh-content blockquote p { margin: 0; }
.gh-content blockquote.kg-blockquote-alt {
    margin: 40px 0;
    padding: 0;
    border: 0;
    font-size: 34px;
    font-weight: 650;
    font-style: normal;
    line-height: 1.18;
    letter-spacing: -.035em;
    text-align: left;
    color: var(--ink);
}
.gh-content blockquote.kg-blockquote-alt::before { content: "“"; color: var(--red); }
.gh-content blockquote.kg-blockquote-alt::after { content: "”"; color: var(--red); }

:root {
    --ct-quote-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1'/%3E%3Cpath d='M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1'/%3E%3C/svg%3E");
}

/* Tables (Markdown / HTML cards) */
.gh-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    font-size: .82em;
    line-height: 1.5;
}
.gh-content th, .gh-content td { padding: 10px 14px; border-top: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.gh-content thead th { border-top: 0; background: var(--sunken); font-size: .9em; font-weight: 600; color: var(--muted); }

/* 14. Code
   ========================================================================== */

/* Without JS (and before it runs) code is still dark, padded and scrollable. */
.gh-content pre {
    margin: 0 0 24px;
    padding: 14px 18px;
    overflow-x: auto;
    background: var(--code) !important;
    border: 1px solid var(--code-line);
    border-radius: var(--radius-l);
    color: var(--code-text);
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.8;
    tab-size: 4;
    text-shadow: none !important;
}
.gh-content pre code {
    display: block;
    padding: 0;
    border: 0;
    background: none !important;
    color: inherit;
    font: inherit;
    text-shadow: none !important;
    white-space: pre;
}
.gh-content .kg-code-card { margin: 0 0 24px; }
.gh-content .kg-code-card pre { margin: 0; }
.gh-content .kg-code-card figcaption { padding: 8px 2px 0; font-size: 13px; color: var(--muted); }

.ct-code {
    margin: 0 0 24px;
    overflow: hidden;
    background: var(--code);
    border: 1px solid var(--code-line);
    border-radius: var(--radius-l);
    color: var(--code-text);
}
.ct-code pre, .gh-content .ct-code pre {
    margin: 0;
    padding: 14px 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
}
.ct-code__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 0 6px 0 16px;
    border-bottom: 1px solid var(--code-line);
}
.ct-code__label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #D4D4D8;
    line-height: 1.3;
}
.ct-code__dot { width: 8px; height: 8px; flex: none; border-radius: 2px; background: var(--dot, #85858E); }
.ct-code__file { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ct-code__lang { color: var(--code-muted); white-space: nowrap; }
.ct-code__diff { white-space: nowrap; }
.ct-code__diff .add { color: var(--sx-add); }
.ct-code__diff .del { color: var(--sx-del); }
.ct-code__actions { display: flex; gap: 2px; flex: none; }
.ct-code__btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-s);
    background: transparent;
    color: #A1A1AA;
}
.ct-code__btn:hover { background: #26262C; color: #FFF; }
.ct-code__btn[aria-pressed="true"] { color: var(--amber); }
.ct-code__btn.is-done { color: var(--sx-add); }
.ct-code figcaption {
    padding: 10px 16px;
    border-top: 1px solid var(--code-line);
    font-size: 13px;
    line-height: 1.5;
    color: #A1A1AA;
}
.ct-code figcaption code { color: #E7E7EA; font-family: var(--font-mono); background: none; border: 0; padding: 0; }
.ct-code__cap-n { margin-right: 8px; font-family: var(--font-mono); color: #E7E7EA; }

.ct-code code { display: block; min-width: max-content; }
.ct-line {
    display: block;
    position: relative;
    padding: 0 20px 0 64px;
    min-height: 1.8em;
}
.ct-line::before {
    content: attr(data-n);
    position: absolute;
    left: 0;
    width: 44px;
    text-align: right;
    color: var(--code-muted);
    user-select: none;
    -webkit-user-select: none;
}
.ct-code--nonum .ct-line { padding-left: 18px; }
.ct-code--nonum .ct-line::before { display: none; }
.ct-line--hl { background: rgba(255, 197, 110, .08); box-shadow: inset 2px 0 0 var(--amber); }
.ct-line--add { background: rgba(74, 222, 128, .1); }
.ct-line--add::before { content: attr(data-n) " +"; color: var(--sx-add); width: 52px; }
.ct-line--del { background: rgba(255, 107, 102, .1); }
.ct-line--del::before { content: attr(data-n) " −"; color: var(--sx-del); width: 52px; }
.ct-code.is-wrapped code { min-width: 0; }
.ct-code.is-wrapped .ct-line { white-space: pre-wrap; overflow-wrap: anywhere; }

.ct-code__body { position: relative; overflow-x: auto; }
.ct-code.is-collapsed .ct-code__body { max-height: calc(16 * 1.8em + 14px); overflow: hidden; font-size: 13.5px; }
.ct-code.is-collapsed .ct-code__body::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 96px;
    background: linear-gradient(to bottom, transparent, var(--code));
    pointer-events: none;
}
.ct-code__more {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-top: 1px solid var(--code-line);
    background: var(--code-2);
    color: #E7E7EA;
    font-family: var(--font-mono);
    font-size: 12px;
}
.ct-code__more:hover { color: #FFF; background: #1E1E23; }
.ct-code__more .ct-i { width: 14px; height: 14px; }
.ct-code:not(.is-collapsed) .ct-code__more .ct-i { transform: rotate(180deg); }

/* Tabs for consecutive captioned code cards */
.ct-code-group { margin: 0 0 24px; overflow: hidden; background: var(--code); border: 1px solid var(--code-line); border-radius: var(--radius-l); }
.ct-code-group > .ct-code { margin: 0; border: 0; border-radius: 0; }
.ct-code-group > .ct-code[hidden] { display: none; }
.ct-code-group > .ct-code > .ct-code__bar { display: none; }
.ct-code-group__bar { display: flex; align-items: stretch; justify-content: space-between; border-bottom: 1px solid var(--code-line); }
.ct-code-group__tabs { display: flex; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ct-code-group__tab {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border: 0;
    background: transparent;
    color: #A1A1AA;
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: nowrap;
}
.ct-code-group__tab:hover { color: #FFF; }
.ct-code-group__tab[aria-selected="true"] { background: var(--code-2); color: #FFF; box-shadow: inset 0 -2px 0 var(--red); }
.ct-code-group__bar .ct-code__actions { align-items: center; padding-right: 6px; }

/* Syntax tokens (beat any Prism theme injected through Code Injection) */
.ct-code .token, .gh-content pre .token { background: none !important; text-shadow: none !important; }
.ct-code .token.comment, .ct-code .token.prolog, .ct-code .token.doctype, .ct-code .token.cdata { color: var(--code-muted); font-style: italic; }
.ct-code .token.punctuation, .ct-code .token.operator { color: var(--code-punc); }
.ct-code .token.keyword, .ct-code .token.atrule, .ct-code .token.important, .ct-code .token.boolean, .ct-code .token.builtin { color: var(--sx-kw); }
.ct-code .token.class-name, .ct-code .token.tag, .ct-code .token.selector, .ct-code .token.namespace, .ct-code .token.constant, .ct-code .token.symbol, .ct-code .token.deleted { color: var(--sx-type); }
.ct-code .token.function, .ct-code .token.attr-name, .ct-code .token.method { color: var(--sx-fn); }
.ct-code .token.variable, .ct-code .token.property, .ct-code .token.key, .ct-code .token.parameter { color: var(--sx-var); }
.ct-code .token.string, .ct-code .token.char, .ct-code .token.attr-value, .ct-code .token.regex, .ct-code .token.url, .ct-code .token.inserted { color: var(--sx-str); }
.ct-code .token.number, .ct-code .token.unit, .ct-code .token.hexcode { color: var(--sx-num); }
.ct-code .token.bold { font-weight: 700; }
.ct-code .token.italic { font-style: italic; }
.ct-code .token.coord, .ct-code .token.prefix.inserted { color: var(--sx-add); }
.ct-code .token.prefix.deleted { color: var(--sx-del); }

/* 15. Callouts
   ========================================================================== */

.gh-content .kg-callout-card {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 14px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    font-size: calc(var(--reading-size) - 2px);
    line-height: 1.6;
    color: var(--ink-2);
}
.gh-content .kg-callout-card-grey { background: var(--sunken); }
.gh-content .kg-callout-card-white { background: var(--surface); }
.gh-content .kg-callout-card-pink { background: color-mix(in srgb, #EC4899 8%, var(--surface)); border-color: color-mix(in srgb, #EC4899 25%, transparent); }
.gh-content .kg-callout-card-purple { background: color-mix(in srgb, #8B5CF6 8%, var(--surface)); border-color: color-mix(in srgb, #8B5CF6 25%, transparent); }
.gh-content .kg-callout-card-blue { background: var(--info-soft); border-color: var(--info-line); }
.gh-content .kg-callout-card-yellow { background: var(--warn-soft); border-color: var(--warn-line); }
.gh-content .kg-callout-card-red { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.gh-content .kg-callout-card-green { background: color-mix(in srgb, var(--ok) 9%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.gh-content .kg-callout-card-accent { background: var(--chrome); border-color: var(--chrome); color: var(--chrome-text); }
.gh-content .kg-callout-card-accent strong, .gh-content .kg-callout-card-accent a { color: #FFF; }
.gh-content .kg-callout-emoji { font-size: 20px; line-height: 1.4; }
.gh-content .kg-callout-text strong, .gh-content .kg-callout-text b { font-weight: 600; }
.ct-callout__icon { color: var(--ink); padding-top: 2px; }
.ct-callout__icon .ct-i { width: 22px; height: 22px; }
.ct-callout__label {
    display: block;
    margin-bottom: 2px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.ct-callout--tip .ct-callout__icon, .ct-callout--tip .ct-callout__label { color: var(--info); }
.ct-callout--warn .ct-callout__icon, .ct-callout--warn .ct-callout__label { color: var(--warn); }

/* 🤖 callouts become the item's workflow history */
.gh-content .kg-callout-card.ct-history {
    display: block;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
    border-color: var(--line);
    border-radius: var(--radius-xl);
}
.ct-history__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line-soft);
}
.ct-history__patch {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 9px;
    background: var(--chrome);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #E7E7EA;
}
.ct-history__patch .ct-i { width: 20px; height: 20px; stroke-width: 1.8; }
.ct-history__patch, .ct-head__icon { --ct-eye: var(--amber); }
.ct-history__title { flex: 1; min-width: 0; font-size: 16px; font-weight: 650; letter-spacing: -.015em; color: var(--ink); line-height: 1.3; }
.ct-history__title small { display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.ct-history__body { padding: 16px 18px 18px; font-size: 15px; line-height: 1.65; color: var(--ink-3); }

/* 16. Bookmarks
   ========================================================================== */

.gh-content .kg-bookmark-card { margin: 0 0 24px; }
.gh-content .kg-bookmark-container {
    display: flex;
    min-height: 120px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    color: var(--ink) !important;
    text-decoration: none !important;
    transition: border-color .2s;
}
.gh-content .kg-bookmark-container:hover { border-color: var(--ink); }
.gh-content .kg-bookmark-container:hover .kg-bookmark-title { color: var(--red-text); }
.kg-bookmark-content { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; padding: 14px 18px; order: 2; }
.kg-bookmark-title { font-size: 16px; font-weight: 650; line-height: 1.3; letter-spacing: -.015em; transition: color .2s; }
.kg-bookmark-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-3);
}
.kg-bookmark-metadata { display: flex; align-items: center; gap: 8px; margin-top: auto; font-size: 12px; color: var(--muted); min-width: 0; }
.kg-bookmark-icon { width: 16px; height: 16px; border-radius: 3px; }
.kg-bookmark-author, .kg-bookmark-publisher { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kg-bookmark-publisher::before { content: "·"; margin-right: 8px; }
.kg-bookmark-thumbnail { position: relative; flex: 0 0 168px; order: 1; background: var(--chrome); }
.kg-bookmark-thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ct-bookmark__path { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ct-bookmark__path .ct-i { width: 13px; height: 13px; color: var(--red); }
.ct-bookmark--external .kg-bookmark-thumbnail { order: 3; flex-basis: 140px; }

/* 17. Figures, galleries, lightbox
   ========================================================================== */

.gh-content .kg-image-card { margin: 0 0 28px; }
.gh-content .kg-image-card img { display: block; margin: 0 auto; border-radius: var(--radius-l); }
.gh-content .kg-image-card.kg-width-full img { border-radius: 0; width: 100%; }
.gh-content figcaption { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--muted); text-align: left; }

.ct-figure {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
}
.gh-content .ct-figure img { border-radius: 0; width: auto; max-width: 100%; margin: 0 auto; }
.ct-figure__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 0 8px 0 16px;
    border-bottom: 1px solid var(--line-soft);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}
.ct-figure__name { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ct-figure__name span { opacity: .75; }
.ct-figure__zoom {
    width: 36px;
    height: 30px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    background: transparent;
    color: var(--ink);
    cursor: zoom-in;
}
.ct-figure__zoom:hover { border-color: var(--ink); }
.ct-figure figcaption { margin: 0; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.ct-fig-n { margin-right: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--ink); }
.ct-figure img, .kg-gallery-image img { cursor: zoom-in; }

.gh-content .kg-gallery-card { margin: 0 0 28px; }
.gh-content .kg-gallery-image img { border-radius: var(--radius-m); }

.ct-lightbox {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 24px 28px;
    border: 0;
    background: rgba(8, 8, 10, .94);
    color: #E7E7EA;
}
.ct-lightbox::backdrop { background: transparent; }
.ct-lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; gap: 14px; }
.ct-lightbox__bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 12px; color: #A1A1AA; }
.ct-lightbox__stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; }
.ct-lightbox__stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius-s); }
.ct-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #3A3A42;
    border-radius: 50%;
    background: rgba(11, 11, 13, .7);
    color: #FFF;
}
.ct-lightbox__nav--prev { left: 0; }
.ct-lightbox__nav--next { right: 0; }
.ct-lightbox__nav[hidden] { display: none; }
.ct-lightbox__caption { max-width: 900px; margin: 0 auto; font-size: 14px; line-height: 1.5; color: #D4D4D8; text-align: center; }
.ct-lightbox .ct-kbd { background: transparent; border-color: #3A3A42; color: #A1A1AA; border-bottom-width: 1px; }
.ct-lightbox__close { color: #E7E7EA; }

/* 18. Other Ghost cards
   ========================================================================== */

.gh-content .kg-toggle-card {
    padding: 0 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    box-shadow: none;
}
.gh-content .kg-toggle-heading { padding: 14px 0; cursor: pointer; }
.gh-content .kg-toggle-heading-text { font-size: 16px; font-weight: 600; color: var(--ink); }
.gh-content .kg-toggle-card-icon { color: var(--muted); }
.gh-content .kg-toggle-content { padding-bottom: 16px; font-size: 16px; line-height: 1.65; color: var(--ink-3); }

.gh-content .kg-button-card a.kg-btn-accent, .kg-btn-accent { background: var(--action) !important; border-radius: var(--radius-m); font-weight: 600; }
.gh-content .kg-button-card a { text-decoration: none; }

.gh-content .kg-file-card-container, .gh-content .kg-audio-card, .gh-content .kg-product-card-container {
    background: var(--surface) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--radius-l) !important;
    color: var(--ink) !important;
}
.gh-content .kg-file-card a { text-decoration: none; }

.gh-content .kg-header-card { border-radius: var(--radius-xl); }
.gh-content .kg-header-card.kg-width-full { border-radius: 0; }

.gh-content .kg-signup-card { border-radius: var(--radius-xl); }
.gh-content .kg-signup-card.kg-width-full { border-radius: 0; }

.gh-content .kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.gh-content .kg-embed-card iframe { border-radius: var(--radius-l); }

.gh-content .kg-video-card { border-radius: var(--radius-l); overflow: hidden; }

/* 19. Article footer
   ========================================================================== */

.ct-article__foot { padding-top: 16px; }
.ct-next {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    padding: 16px 18px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-l);
}
.ct-next__icon { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--sunken); display: flex; align-items: center; justify-content: center; }
.ct-next__text { flex: 1 1 260px; min-width: 0; }
.ct-next__kicker { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.ct-next__title { display: block; margin-top: 4px; font-size: 17px; font-weight: 650; letter-spacing: -.015em; }

.ct-author {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}
.ct-author__name { font-size: 17px; font-weight: 650; }
.ct-author__name a:hover { color: var(--red-text); }
.ct-author__bio { margin: 4px 0 10px; font-size: 15px; line-height: 1.6; color: var(--ink-3); }
.ct-author__links { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; }
.ct-author__links a { color: var(--red-text); text-decoration: underline; text-underline-offset: 3px; }

.ct-siblings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 40px; }
.ct-sibling {
    display: block;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    transition: border-color .2s;
}
.ct-sibling:hover { border-color: var(--ink); }
.ct-sibling:hover .ct-sibling__title { color: var(--red-text); }
.ct-sibling--next { text-align: right; }
.ct-sibling--empty { background: transparent; border-style: dashed; }
.ct-sibling__kicker { display: flex; justify-content: space-between; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.ct-sibling__title { display: block; margin-top: 6px; font-size: 16px; font-weight: 600; line-height: 1.3; transition: color .2s; }
.ct-sibling--empty .ct-sibling__title { color: var(--muted); }

.ct-comments { margin-top: 48px; }

/* 20. Inspector
   ========================================================================== */

.ct-inspector {
    flex: 0 0 var(--inspector-w);
    width: var(--inspector-w);
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    padding: 24px 20px 40px;
    background: var(--sunken);
    border-left: 1px solid var(--line);
    scrollbar-width: thin;
}
.ct-inspector__title { margin: 26px 0 12px; }
.ct-inspector > .ct-inspector__title:first-child { margin-top: 0; }
.ct-fields { margin: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.ct-fields > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.ct-fields > div:last-child { border-bottom: 0; }
.ct-fields dt { color: var(--muted); white-space: nowrap; }
.ct-fields dd { margin: 0; min-width: 0; text-align: right; overflow-wrap: anywhere; }
.ct-fields .ct-mono { font-size: 12px; }
.ct-fields dd.ct-flex { display: inline-flex; align-items: center; gap: 6px; }

.ct-mini {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: border-color .2s;
}
.ct-mini + .ct-mini { margin-top: 10px; }
.ct-mini:hover { border-color: var(--ink); }
.ct-mini:hover .ct-mini__title { color: var(--red-text); }
.ct-mini img, .ct-mini__ph { width: 64px; height: 48px; flex: none; border-radius: var(--radius-s); object-fit: cover; background: var(--chrome); display: flex; align-items: center; justify-content: center; color: var(--chrome-muted); }
.ct-mini__title { display: block; font-size: 13px; font-weight: 550; line-height: 1.3; transition: color .2s; }
.ct-mini__meta { display: block; font-size: 12px; color: var(--muted); }
.ct-mini--link { padding: 10px 12px; }
.ct-mini--link .ct-i { color: var(--muted); }
.ct-mini--link .ct-mini__title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.ct-share { display: flex; flex-wrap: wrap; gap: 8px; }
.ct-share a, .ct-share button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    font-size: 13px;
    color: var(--ink);
}
.ct-share a:hover, .ct-share button:hover { border-color: var(--ink); }
.ct-share .ct-i { width: 14px; height: 14px; }

/* 21. Subscribe
   ========================================================================== */

.ct-subscribe {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
    background: var(--chrome);
    color: var(--chrome-text);
    border-radius: var(--radius-xl);
}
.ct-subscribe__text { flex: 1 1 300px; min-width: 0; }
.ct-subscribe__kicker { font-family: var(--font-mono); font-size: 12px; color: var(--chrome-muted); }
.ct-subscribe__title { margin: 8px 0 0; font-size: 26px; font-weight: 650; line-height: 1.1; letter-spacing: -.03em; color: #FFF; }
.ct-subscribe__desc { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--chrome-muted); }
.ct-subscribe--stack { flex-direction: column; align-items: stretch; padding: 18px; border-radius: var(--radius-l); }
.ct-subscribe--stack .ct-subscribe__title { font-size: 16px; letter-spacing: -.02em; margin: 0; }
.ct-subscribe--stack .ct-subscribe__desc { font-size: 13px; }

.ct-form { flex: 1 1 340px; display: flex; flex-wrap: wrap; gap: 8px; }
.ct-subscribe--stack .ct-form { flex: none; flex-direction: column; }
.ct-form input[type="email"] {
    flex: 1 1 200px;
    min-height: 46px;
    padding: 0 14px;
    background: var(--chrome-2);
    border: 1px solid var(--chrome-line);
    border-radius: var(--radius-m);
    color: #E7E7EA;
    font-size: 14px;
}
.ct-form input[type="email"]::placeholder { color: #8E8E97; }
.ct-form input[type="email"]:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: transparent; }
.ct-form .ct-btn { min-height: 46px; }
.ct-form__msg { display: none; flex-basis: 100%; font-size: 13px; line-height: 1.5; }
.ct-form.success .ct-form__msg--ok { display: block; color: var(--sx-add); }
.ct-form.error .ct-form__msg--err { display: block; color: #FF8A85; }
.ct-form.success input, .ct-form.success button { display: none; }
.ct-form.loading button { opacity: .6; pointer-events: none; }

/* 22. Home extras & footer
   ========================================================================== */

.ct-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px 56px 28px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
}
.ct-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.ct-footer a:hover { color: var(--red-text); }

/* 23. Pages: profile, talks
   ========================================================================== */

.ct-profile { padding: 56px 56px 40px; max-width: 1180px; display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start; }
.ct-profile__mark {
    position: relative;
    width: 168px;
    height: 168px;
    flex: none;
    border-radius: 50%;
    background: var(--chrome);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ct-profile__ring {
    width: 136px;
    height: 136px;
    border-radius: 50%;
    border: 18px solid var(--red);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -.04em;
}
.ct-profile__ring img { width: 100%; height: 100%; object-fit: cover; }
.ct-profile__eye {
    position: absolute;
    right: 18px;
    bottom: 22px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--amber);
    border: 4px solid var(--chrome);
    animation: ct-glow 3.2s ease-in-out infinite;
}
.ct-profile__text { flex: 1 1 420px; min-width: 0; }
.ct-profile__handle { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.ct-profile__name { margin: 8px 0 0; font-family: var(--font-heading); font-weight: 700; font-size: clamp(44px, 5.6vw, 72px); line-height: .95; letter-spacing: -.055em; }
.ct-profile__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.ct-profile__bio { margin: 22px 0 0; max-width: 58ch; font-size: 20px; line-height: 1.6; color: var(--ink-2); }

.ct-versions { padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); }
.ct-versions__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.ct-versions__title { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.ct-versions__grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.ct-versions__cell { text-align: center; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.ct-versions__box { height: 44px; margin-bottom: 6px; border-radius: var(--radius-m); border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; font-weight: 600; }
.ct-versions__cell.is-on .ct-versions__box { border: 0; background: var(--red); color: #FFF; }
.ct-versions__cell.is-latest .ct-versions__box { background: var(--ink); color: var(--canvas); box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--red); }
.ct-versions__cell.is-latest { color: var(--ink); font-weight: 600; }

/* "Label: link" lists become General Link fields */
.gh-content ul.ct-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gh-content ul.ct-links > li { margin: 0; padding: 0; }
.gh-content ul.ct-links > li::before { display: none; }
.ct-link {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 52px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink) !important;
    text-decoration: none !important;
    font-size: 15px;
    line-height: 1.3;
}
.ct-link:hover { border-color: var(--ink); }
.ct-link small { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.ct-link .ct-i { color: var(--muted); }
.ct-link--static { cursor: default; }
.ct-link--static:hover { border-color: var(--line); }

/* Speaker engagements */
.ct-talks-top { display: flex; flex-wrap: wrap; gap: 16px; }
.ct-chart { flex: 2 1 520px; min-width: 0; margin: 0; padding: 20px 22px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); }
.ct-chart figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.ct-chart figcaption b { font-size: 15px; font-weight: 650; }
.ct-chart__plot { position: relative; height: 132px; }
.ct-chart__grid { position: absolute; left: 0; right: 0; top: 0; border-top: 1px dashed var(--line); }
.ct-chart__grid span { position: absolute; right: 0; top: -15px; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.ct-chart__bars { position: absolute; inset: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; align-items: end; border-bottom: 1px solid var(--ink-3); }
.ct-bar { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.ct-bar__fill { width: 100%; max-width: 34px; border-radius: 4px 4px 0 0; background: var(--ink-3); transition: background .15s; }
.ct-bar:hover .ct-bar__fill, .ct-bar:focus-visible .ct-bar__fill { background: var(--red); }
.ct-bar__tip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 9px;
    border-radius: var(--radius-s);
    background: var(--chrome);
    color: #FFF;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
    z-index: 2;
}
.ct-bar:hover .ct-bar__tip, .ct-bar:focus-visible .ct-bar__tip { opacity: 1; }
.ct-chart__axis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; margin-top: 8px; font-family: var(--font-mono); font-size: 10px; color: var(--muted); text-align: center; }
.ct-talk-stats { flex: 1 1 240px; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ct-talk-stats > div { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); }
.ct-talk-stats b { display: block; font-size: 34px; font-weight: 700; letter-spacing: -.04em; line-height: 1.1; }
.ct-talk-stats span { font-size: 13px; color: var(--muted); }

.ct-segments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.ct-segments button {
    min-height: 36px;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    color: var(--ink);
    font-size: 13px;
}
.ct-segments button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--canvas); }

.ct-events__year {
    padding: 8px 16px;
    background: var(--sunken);
    border-bottom: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}
.ct-event {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) 110px 24px;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    transition: background .15s;
}
.ct-event:hover { background: var(--sunken); }
.ct-event:hover .ct-event__title { color: var(--red-text); }
.ct-event[hidden] { display: none; }
.ct-event__date { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.ct-event__title { display: block; font-size: 16px; font-weight: 600; transition: color .15s; }
.ct-event__where { font-size: 13px; color: var(--muted); }
.ct-event__type { justify-self: start; }
.ct-event__type--talk { background: var(--red-soft); color: var(--red-ink); border-color: transparent; font-weight: 550; }
.ct-event__type--hosting { background: var(--sunken); }
.ct-event .ct-i { color: var(--muted); width: 14px; height: 14px; }

/* 24. Views: snippets & figures panels
   ========================================================================== */

.ct-view { padding: 44px 40px 72px; max-width: 880px; margin: 0 auto; width: 100%; }
.ct-view[hidden] { display: none; }
.ct-view__item { margin-bottom: 28px; }
.ct-view__ctx { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.ct-view__ctx a { color: var(--ink); font-weight: 550; }
.ct-view__ctx a:hover { color: var(--red-text); }
.ct-view__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ct-view__fig { margin: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.ct-view__fig img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; cursor: zoom-in; background: var(--sunken); }
.ct-view__fig figcaption { padding: 10px 12px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.ct-view__empty { padding: 48px 0; text-align: center; color: var(--muted); }
[data-ct-view="snippets"] .ct-article, [data-ct-view="figures"] .ct-article { display: none; }

/* Focus mode */
.ct-focus .ct-tree, .ct-focus .ct-inspector { display: none; }

/* 25. Search palette
   ========================================================================== */

.ct-search {
    width: min(720px, calc(100vw - 32px));
    max-height: min(680px, calc(100vh - 120px));
    margin: 88px auto auto;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .6);
    color: var(--ink);
}
.ct-search::backdrop { background: rgba(10, 10, 12, .55); backdrop-filter: blur(3px); }
.ct-search[open] { display: flex; flex-direction: column; }
.ct-search__head { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 16px; border-bottom: 1px solid var(--line-soft); }
.ct-search__head .ct-i { width: 18px; height: 18px; color: var(--muted); }
.ct-search__input { flex: 1; min-width: 0; height: 40px; border: 0; background: transparent; font-size: 18px; outline: none; }
.ct-search__input::-webkit-search-cancel-button { display: none; }
.ct-search__scopes { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.ct-search__scopes button {
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    background: var(--surface);
    font-size: 12px;
}
.ct-search__scopes button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.ct-search__scopes span { font-family: var(--font-mono); opacity: .7; margin-left: 4px; }
.ct-search__results { flex: 1; min-height: 120px; overflow-y: auto; padding: 8px 8px 12px; }
.ct-search__group { display: flex; justify-content: space-between; padding: 12px 12px 6px; }
.ct-res {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 48px;
    padding: 6px 12px;
    border-radius: var(--radius-m);
    color: var(--ink);
}
.ct-res:hover { background: var(--sunken); }
.ct-res[aria-selected="true"] { background: var(--red-soft); box-shadow: inset 2px 0 0 var(--red); }
.ct-res__icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--sunken); }
.ct-res__icon .ct-i { width: 15px; height: 15px; }
.ct-res__title { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; font-weight: 550; }
.ct-res__title--mono { font-family: var(--font-mono); font-size: 13px; }
.ct-res__path { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.ct-res__meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ct-res mark { background: var(--hl); color: inherit; border-radius: 3px; padding: 0 1px; }
.ct-search__empty { padding: 48px 24px; text-align: center; font-size: 15px; color: var(--ink-3); }
.ct-search__empty small { display: block; margin-bottom: 8px; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.ct-search__foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--sunken);
    border-top: 1px solid var(--line-soft);
    font-size: 12px;
    color: var(--muted);
}
.ct-search__foot > span { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* 26. 404
   ========================================================================== */

.ct-404 { flex: 1; display: flex; align-items: center; justify-content: center; gap: 56px; padding: 56px; flex-wrap: wrap; }
.ct-404__media { position: relative; width: 380px; max-width: 100%; aspect-ratio: 380 / 520; border-radius: 18px; overflow: hidden; background: var(--chrome); }
.ct-404__media img { width: 100%; height: 100%; object-fit: cover; object-position: 30% center; }
.ct-404__media span { position: absolute; left: 14px; top: 14px; padding: 5px 8px; border-radius: var(--radius-s); background: rgba(11, 11, 13, .8); font-family: var(--font-mono); font-size: 11px; color: #E7E7EA; }
.ct-404__text { max-width: 560px; min-width: 0; }
.ct-404__code { font-family: var(--font-mono); font-size: 13px; color: var(--red-text); }
.ct-404__title { margin: 12px 0 0; font-weight: 700; font-size: clamp(40px, 5vw, 60px); line-height: .98; letter-spacing: -.05em; }
.ct-404__pre {
    margin: 24px 0 0;
    padding: 16px 18px;
    background: var(--sunken);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.8;
    color: var(--ink-3);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.ct-404__pre span { color: var(--muted); }

/* 27. Mobile outline bar
   ========================================================================== */

.ct-outline-bar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 16px;
    z-index: 45;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 8px 14px;
    background: var(--chrome);
    border: 1px solid var(--chrome-line);
    border-radius: var(--radius-xl);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .6);
    color: #E7E7EA;
    transform: translateY(140%);
    transition: transform .25s;
}
.ct-outline-bar.is-visible { transform: none; }
.ct-outline-bar__n { font-family: var(--font-mono); font-size: 12px; color: #FF8577; }
.ct-outline-bar__title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.ct-outline-bar__pct { font-family: var(--font-mono); font-size: 11px; color: #A1A1AA; }
.ct-outline-bar button { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: var(--chrome-3); color: #FFF; }

/* 28. Responsive
   ========================================================================== */

@media (max-width: 1240px) {
    .ct-inspector { display: none; }
    .ct-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
    .ct-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
    :root { --topbar-h: 56px; }
    .ct-tree-toggle { display: inline-flex; }
    .ct-tree {
        position: fixed;
        z-index: 60;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100%;
        width: min(336px, 88vw);
        transform: translateX(-102%);
        transition: transform .25s ease;
        box-shadow: 20px 0 60px -20px rgba(0, 0, 0, .7);
    }
    .ct-tree .ct-node { min-height: 40px; font-size: 14px; }
    .ct-tree-open .ct-tree { transform: none; }
    .ct-tree-open .ct-scrim { opacity: 1; pointer-events: auto; }
    .ct-tree-open { overflow: hidden; }
    .ct-tree__close { display: inline-flex !important; }
    .ct-outline-bar { display: flex; }
    .ct-focus .ct-tree { display: block; }
    .ct-section, .ct-hero, .ct-head, .ct-profile { padding-left: 24px; padding-right: 24px; }
    .ct-footer { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 720px) {
    .ct-topbar { gap: 4px; padding: 0 8px; }
    .ct-path, .ct-topnav__link, .ct-searchbox span, .ct-searchbox .ct-kbd { display: none; }
    .ct-topbar__search { flex: 1; justify-content: flex-end; }
    .ct-searchbox { width: 40px; height: 40px; padding: 0; justify-content: center; border-color: transparent; background: transparent; color: #E7E7EA; }
    .ct-tabs__meta, .ct-tabs__tool span { display: none; }
    .ct-hero { padding-top: 40px; padding-bottom: 32px; }
    .ct-hero__title { font-size: 60px; }
    .ct-hero__lead { font-size: 17px; }
    .ct-hero__actions .ct-btn { flex: 1 1 100%; }
    .ct-byline-mini { margin-left: 0; }
    .ct-section { padding-left: 20px; padding-right: 20px; padding-bottom: 32px; }
    .ct-grid, .ct-grid--4 { grid-template-columns: 1fr; }
    .ct-feature__media { min-height: 220px; flex-basis: 100%; }
    .ct-feature__fields { padding: 16px; }
    .ct-feature__title { font-size: 22px; }
    .ct-list__head { display: none; }
    .ct-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
    .ct-row__tag { display: none; }
    .ct-row__date { display: none; }
    .ct-row__thumb { width: 64px; height: 44px; }
    .ct-row__excerpt { display: none; }
    .ct-event { grid-template-columns: 70px minmax(0, 1fr); }
    .ct-event__type, .ct-event > .ct-i { display: none; }
    .ct-head { padding-top: 36px; }
    .ct-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ct-stats > div:nth-child(2n) { border-right: 0; }
    .gh-canvas {
        grid-template-columns: [full-start] 20px [wide-start] 0 [main-start] minmax(0, 1fr) [main-end] 0 [wide-end] 20px [full-end];
    }
    .gh-canvas > .kg-width-wide, .gh-canvas > .ct-code, .gh-canvas > .ct-code-group, .gh-canvas > pre, .gh-canvas > .kg-code-card { grid-column: full; }
    .gh-canvas > .ct-code, .gh-canvas > .ct-code-group, .gh-canvas > pre, .gh-canvas > .ct-figure.kg-width-wide { border-radius: 0; border-left: 0; border-right: 0; }
    .ct-cover { grid-column: full; }
    .ct-cover__img { border-radius: 0; aspect-ratio: 4 / 3; }
    .ct-cover figcaption, .ct-cover__note { padding: 0 20px; }
    .ct-article__head { padding-top: 0; }
    .gh-content { padding-top: 28px; }
    .gh-content h2 { font-size: 25px; margin-top: 44px; }
    .gh-content h3 { font-size: 18px; margin-top: 32px; }
    .gh-content blockquote.kg-blockquote-alt { font-size: 26px; }
    .ct-siblings { grid-template-columns: 1fr; }
    .ct-sibling--next { text-align: left; }
    .gh-content ul.ct-links { grid-template-columns: 1fr; }
    .ct-view { padding: 28px 20px 96px; }
    .ct-view__grid { grid-template-columns: 1fr; }
    .ct-profile__mark { width: 120px; height: 120px; }
    .ct-profile__ring { width: 96px; height: 96px; border-width: 13px; font-size: 26px; }
    .ct-profile__eye { right: 10px; bottom: 14px; }
    .ct-404 { padding: 32px 20px; gap: 28px; }
    .ct-search { margin-top: 16px; max-height: calc(100vh - 32px); }
    .ct-search__foot > span:first-child { display: none; }
    .ct-figure__name span, [data-ct-words-inline], [data-ct-words-sep] { display: none !important; }
    .kg-bookmark-thumbnail { display: none; }
    .ct-footer { padding: 18px 20px 96px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
}

@media print {
    .ct-topbar, .ct-tree, .ct-inspector, .ct-tabs, .ct-outline-bar, .ct-subscribe, .ct-share, .ct-scrim, .ct-code__actions, .ct-code__more { display: none !important; }
    .ct-code.is-collapsed .ct-code__body { max-height: none; }
    body { background: #FFF; }
}
