/*
 * Hive's look for the blog. Colours are the app's own themes
 * (Hive src/renderer/styles/globals.css): Honey in light mode, OLED Dark in
 * dark mode, following the reader's system like the app's "Match system".
 * Geist and Geist Mono, as in the app.
 */

/*
 * Each colour is a light-dark() pair: Honey, then OLED Dark. With no saved
 * choice the page follows the system; the theme menu (assets/js/site.js) sets
 * data-theme on <html>, which pins color-scheme and so picks one side.
 */
:root {
    color-scheme: light dark;
    --bg: light-dark(#fffbf2, #000000);          /* app background */
    --panel: light-dark(#faf3e3, #080808);       /* panels */
    --raised: light-dark(#f5ecd8, #141414);      /* inputs, chips, menus */
    --row-hover: light-dark(#f5ecd8, #0e0e0e);
    --hairline: light-dark(#ebdec2, #1e1e1e);    /* around a list */
    --row: light-dark(#f0e6d0, #141414);         /* between rows */
    --strong: light-dark(#d9c9a8, #303030);      /* strong borders */
    --fg: light-dark(#2b2410, #e5e5e5);
    --fg-2: light-dark(#4a4130, #b3b3b3);
    --muted: light-dark(#665b46, #8c8c8c);
    --faint: light-dark(#847860, #666666);
    --accent: light-dark(#835700, #268c7f);
    --accent-text: light-dark(#744d00, #26b2a0);
    --success: light-dark(#19703a, #5ec884);
    --success-text: light-dark(#166132, #5ec884);
    --success-fg: light-dark(#fffbf2, #000000);
    --success-hover: light-dark(#145a2f, #7fd59e);
    --danger: light-dark(#b42330, #f17575);
    --inverse: light-dark(#2b2410, #e5e5e5);
    --inverse-fg: light-dark(#fffbf2, #000000);
    --inverse-hover: light-dark(#4a4130, #ffffff);
    --code-bg: light-dark(#faf3e3, #0e0e0e);
    --selection: light-dark(#f4d98a, #103632);
    --menu-shadow: 0 0 0 .5px light-dark(rgb(60 42 0 / .10), transparent), 0 8px 24px light-dark(rgb(60 42 0 / .12), rgb(0 0 0 / .6));

    --font-sans: var(--gh-font-body, 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    --font-heading: var(--gh-font-heading, 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --col: 720px;
    --gutter: 20px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--selection); color: var(--fg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
a { color: inherit; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--font-heading); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { width: 100%; max-width: calc(var(--col) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.main { flex: 1; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 14px; border: 1px solid transparent; border-radius: 8px;
    font: inherit; font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap;
    text-decoration: none; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s;
}
.btn-inverse { background: var(--inverse); color: var(--inverse-fg); }
.btn-inverse:hover { background: var(--inverse-hover); }
.btn-success { background: var(--success); color: var(--success-fg); }
.btn-success:hover { background: var(--success-hover); }
.btn-success:disabled { opacity: .7; cursor: progress; }
.btn-ghost { border-color: var(--hairline); color: var(--fg-2); }
.btn-ghost:hover { background: var(--raised); color: var(--fg); }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--raised); color: var(--fg); }

/* Top bar */
.top {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--hairline);
}
.top-row { display: flex; align-items: center; gap: 6px; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 9px; margin-right: auto; text-decoration: none; min-width: 0; }
.brand .logo { width: 24px; height: 24px; flex-shrink: 0; color: var(--fg); }
.brand img { height: 26px; width: auto; }
.brand span { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-nav .nav { display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; }
.top-nav .nav a {
    display: inline-flex; align-items: center; height: 34px; padding: 0 10px; border-radius: 8px;
    color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none;
}
.top-nav .nav a:hover { background: var(--raised); color: var(--fg); }
.top-nav .nav-current a { color: var(--fg); }
.top .btn-inverse { margin-left: 4px; }

/* Theme menu: Match system, Honey, OLED Dark */
.theme { position: relative; }
.theme-btn .t-icon { display: none; }
:root:not([data-theme]) .theme-btn .t-system,
:root[data-theme="light"] .theme-btn .t-light,
:root[data-theme="dark"] .theme-btn .t-dark { display: block; }
.theme-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 184px; padding: 4px;
    border: 1px solid var(--hairline); border-radius: 10px; background: var(--raised); box-shadow: var(--menu-shadow);
}
.theme-menu[hidden] { display: none; }
.theme-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 7px;
    background: transparent; color: var(--fg-2); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.theme-menu button:hover, .theme-menu button:focus-visible { background: var(--bg); color: var(--fg); outline: none; }
.theme-menu .swatch { width: 16px; height: 16px; flex-shrink: 0; border-radius: 5px; border: 1px solid var(--strong); }
.theme-menu .sw-system { background: linear-gradient(135deg, #fffbf2 50%, #000 50%); }
.theme-menu .sw-light { background: #fffbf2; }
.theme-menu .sw-dark { background: #000; }
.theme-menu .check { width: 14px; height: 14px; margin-left: auto; color: var(--accent-text); visibility: hidden; }
.theme-menu [aria-checked="true"] { color: var(--fg); }
.theme-menu [aria-checked="true"] .check { visibility: visible; }

/* Page heading, like "Pull requests" */
.page-head { padding: 48px 0 8px; }
.page-head h1 { margin: 0; font-size: clamp(28px, 4.2vw, 34px); line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; }
.page-head .sub { margin: 8px 0 0; max-width: 40em; color: var(--muted); font-size: 16px; }
.page-head p:last-child .btn { margin-top: 24px; }
.back {
    display: inline-flex; align-items: center; min-height: 32px; margin-bottom: 10px;
    color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none;
}
.back:hover { color: var(--fg); }
.author-line { display: flex; align-items: center; gap: 14px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }

/* Segmented control, like "Inbox | All pull requests" */
.seg {
    display: inline-flex; gap: 2px; max-width: 100%; margin-top: 24px; padding: 4px;
    border: 1px solid var(--hairline); border-radius: 10px; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg-item {
    display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 7px;
    color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.seg-item:hover { color: var(--fg); }
.seg-item[aria-current="page"] { background: var(--raised); color: var(--fg); }

/* Section label, like "Returned to you  2" */
.section-label {
    display: flex; align-items: center; justify-content: space-between;
    padding: 28px 4px 10px; color: var(--fg-2); font-size: 14px; font-weight: 500;
}
.section-label .count { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }

/* List card, like "Worker updates" */
.list { border: 1px solid var(--hairline); border-radius: 12px; background: var(--panel); overflow: hidden; }
.empty { margin: 0; padding: 28px 20px; color: var(--muted); }
.row {
    display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 14px;
    padding: 18px 20px; border-top: 1px solid var(--row); color: inherit; text-decoration: none;
    transition: background-color .12s;
}
.row:first-child { border-top: 0; }
.row:hover { background: var(--row-hover); }
.row-mark { width: 22px; height: 22px; margin-top: 1px; color: var(--success); }
.row-title { margin: 0; font-family: var(--font-sans); font-size: 16px; line-height: 1.4; font-weight: 600; letter-spacing: -0.005em; }
.row-meta { margin: 4px 0 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.row-tag { color: var(--success-text); font-weight: 500; }
.row-excerpt {
    margin: 10px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    color: var(--fg-2); font-size: 14.5px; line-height: 1.55;
}
.row-open { display: inline-flex; align-items: center; gap: 2px; align-self: start; height: 22px; color: var(--muted); font-size: 14px; }
.row-open svg { width: 14px; height: 14px; }
.row:hover .row-open { color: var(--fg); }

.chip {
    display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 8px;
    background: var(--raised); color: var(--fg-2); font-size: 13px; font-weight: 500; text-decoration: none;
}
a.chip:hover { color: var(--fg); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.pager-count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

/* Article */
.canvas {
    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--gutter), 1fr)
        [wide-start] minmax(0, 160px)
        [main-start] min(720px, calc(100% - 2 * var(--gutter)))
        [main-end] minmax(0, 160px)
        [wide-end] minmax(var(--gutter), 1fr)
        [full-end];
}
.canvas > * { grid-column: main; }
.canvas > .kg-width-wide { grid-column: wide; }
.canvas > .kg-width-full { grid-column: full; }
.canvas > .kg-width-full img { border-radius: 0; }

.article-head { padding-top: 48px; }
.article-head .back { justify-self: start; }
.article-head h1 { margin: 0; font-size: clamp(30px, 4.6vw, 42px); line-height: 1.12; font-weight: 700; letter-spacing: -0.028em; text-wrap: balance; }
.lede { margin: 14px 0 0; color: var(--fg-2); font-size: 19px; line-height: 1.5; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 20px 0 0; color: var(--muted); font-size: 14px; }
.article-meta .chip { margin-right: 4px; }
.feature { margin: 36px 0 0; }
.feature img { display: block; width: 100%; border: 1px solid var(--hairline); border-radius: 12px; }
.feature figcaption, .gh-content figcaption { margin-top: 10px; color: var(--muted); font-size: 14px; text-align: center; }

.gh-content { margin-top: 36px; font-size: 17px; line-height: 1.7; color: var(--fg); overflow-wrap: break-word; }
.gh-content > * { margin-top: 0; margin-bottom: 0; }
.gh-content > * + * { margin-top: 1.15em; }
.gh-content > :is(h2, h3, h4) + * { margin-top: .6em; }
.gh-content h2 { margin-top: 2em; font-size: 24px; line-height: 1.3; font-weight: 700; letter-spacing: -0.02em; }
.gh-content h3 { margin-top: 1.7em; font-size: 19px; line-height: 1.35; font-weight: 650; letter-spacing: -0.01em; }
.gh-content h4 { margin-top: 1.5em; font-size: 17px; font-weight: 650; }
.gh-content a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.gh-content a:hover { text-decoration-thickness: 2px; }
.gh-content strong { font-weight: 650; }
.gh-content :is(ul, ol) { padding-left: 1.4em; }
.gh-content li + li { margin-top: .4em; }
.gh-content li::marker { color: var(--muted); }
.gh-content blockquote:not([class]) { margin-left: 0; margin-right: 0; padding: .1em 0 .1em 1.1em; border-left: 3px solid var(--accent); color: var(--fg-2); }
.gh-content blockquote.kg-blockquote-alt { margin: 1.6em 0; color: var(--fg); font-size: 22px; line-height: 1.45; font-style: normal; text-align: center; }
.gh-content hr { width: 100%; height: 0; margin-top: 2.4em; margin-bottom: 1.2em; border: 0; border-top: 1px solid var(--hairline); }
.gh-content img { border-radius: 10px; }
.gh-content :not(pre) > code {
    padding: .12em .4em; border: 1px solid var(--hairline); border-radius: 6px;
    background: var(--raised); font-family: var(--font-mono); font-size: .86em;
    font-variant-ligatures: none;
}
.gh-content pre {
    padding: 16px 20px; border: 1px solid var(--hairline); border-radius: 12px;
    background: var(--code-bg); color: var(--fg); overflow-x: auto;
    font-family: var(--font-mono); font-size: 14px; line-height: 1.6; font-variant-ligatures: none;
}
.gh-content pre code { font: inherit; background: none; padding: 0; border: 0; }
.gh-content table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 15px; }
.gh-content :is(th, td) { padding: 8px 12px; border-bottom: 1px solid var(--row); text-align: left; }
.gh-content th { color: var(--fg-2); font-weight: 600; border-bottom-color: var(--hairline); }

/* Koenig cards (Ghost loads their own CSS; these keep them in the theme's colours) */
.gh-content .kg-callout-card { border-radius: 12px; }
.gh-content .kg-callout-card-grey, .gh-content .kg-callout-card-white { background: var(--raised); }
.gh-content .kg-bookmark-card a.kg-bookmark-container,
.gh-content .kg-bookmark-container { border: 1px solid var(--hairline); border-radius: 12px; background: var(--panel); color: var(--fg); text-decoration: none; }
.gh-content .kg-bookmark-description, .gh-content .kg-bookmark-metadata { color: var(--muted); }
.gh-content .kg-toggle-card, .gh-content .kg-product-card-container, .gh-content .kg-file-card-container { border: 1px solid var(--hairline); border-radius: 12px; background: var(--panel); color: var(--fg); }
.gh-content .kg-btn, .gh-content .kg-btn-accent { border-radius: 8px; font-family: var(--font-sans); font-weight: 600; }
.gh-content .kg-btn-accent { background: var(--inverse); color: var(--inverse-fg); }
.gh-content .kg-image-card figcaption, .gh-content .kg-gallery-card figcaption { color: var(--muted); }

.article-tags { margin-top: 40px; }
.article-tags p { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.more { margin-top: 32px; }

/* Waitlist, like "1 pull request is ready to land" */
.ready {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px 24px;
    margin-top: 56px; padding: 20px 20px 20px 24px; border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--success) 38%, transparent);
    background: color-mix(in srgb, var(--success) 7%, var(--bg));
}
.ready-copy p { margin: 0; font-size: 15px; line-height: 1.5; }
.ready-copy b { font-weight: 650; }
.ready-copy span { color: var(--muted); }
.ready-form { display: flex; gap: 8px; }
.ready-form input[type="email"] {
    width: 220px; height: 34px; padding: 0 12px; border: 1px solid var(--strong); border-radius: 8px;
    background: var(--bg); color: var(--fg); font: inherit; font-size: 14px;
}
.ready-form input::placeholder { color: var(--faint); }
.ready-form input[aria-invalid="true"] { border-color: var(--danger); }
.ready-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ready-msg { grid-column: 1 / -1; margin: 0; font-size: 14px; color: var(--fg-2); }
.ready-msg.error { color: var(--danger); }
.ready.done .ready-form { display: none; }

/* Footer */
.foot { margin-top: 56px; border-top: 1px solid var(--hairline); }
.foot-row {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px;
    padding-top: 14px; padding-bottom: 18px; color: var(--muted); font-size: 14px;
}
.foot a { display: inline-flex; align-items: center; min-height: 36px; text-underline-offset: 3px; }
.foot a:hover { color: var(--fg); }
.foot-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; }
.foot-links .nav { display: flex; flex-wrap: wrap; gap: 0 16px; margin: 0; padding: 0; list-style: none; }

@media (max-width: 720px) {
    .top-nav { display: none; }
    .page-head, .article-head { padding-top: 32px; }
    .row { grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding: 16px; }
    .row-mark { width: 20px; height: 20px; }
    .row-open { display: none; }
    .ready { grid-template-columns: 1fr; padding: 18px; }
    .ready-form input[type="email"] { flex: 1; width: auto; min-width: 0; }
    .gh-content { font-size: 16.5px; }
}
@media (max-width: 420px) {
    .top .btn-inverse { padding: 0 10px; }
    .brand span { max-width: 9em; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
