/* ---------- Tokens ---------- */
:root {
    --accent: var(--ghost-accent-color, #4dfa77);
    --on-accent: #15171a;
    --wordmark: #3a44d8;
    --ink: #15171a;
    --ink-soft: #5b616b;
    --line: #e4e6ea;
    --chip: #f0f1f3;
    --bg: #ffffff;
    --font-sans: var(--gh-font-body, "Inter"), system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --font-heading: var(--gh-font-heading, var(--font-sans));
    --heading-weight: 700;
    --wrap: 1240px;
    --wrap-narrow: 720px;
    --gutter: 32px;
    --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-heading); font-weight: var(--heading-weight); line-height: 1.2; letter-spacing: -0.01em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--wordmark); outline-offset: 2px; border-radius: 2px; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

.container { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.container-narrow { max-width: calc(var(--wrap-narrow) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid transparent; }
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: var(--header-h); padding-top: 12px; padding-bottom: 12px; transition: padding .2s ease; }
.site-header.is-scrolled .header-inner { padding-top: 8px; padding-bottom: 8px; }
.site-header.is-scrolled .logo img { height: calc(var(--logo-h) * .45); }
.site-header.is-scrolled .wordmark { font-size: calc(var(--logo-h) * .3); }
.header-left { display: flex; align-items: center; gap: 6px; }
.header-right { display: flex; align-items: center; justify-content: flex-end; gap: 20px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; background: none; border: 0; border-radius: 50%; cursor: pointer; }
.icon-btn:hover { background: var(--chip); }
.link-quiet { font-size: 15px; font-weight: 500; }
.link-quiet:hover { text-decoration: underline; text-underline-offset: 3px; }

.logo { --logo-h: 84px; display: inline-flex; align-items: center; max-width: 100%; }
.logo-s { --logo-h: 56px; } .logo-m { --logo-h: 84px; } .logo-l { --logo-h: 112px; }
.logo img { width: auto; height: var(--logo-h); max-width: 100%; object-fit: contain; transition: height .2s ease; }
.wordmark { font-family: var(--font-sans); font-weight: 800; font-size: calc(var(--logo-h, 48px) * .5); letter-spacing: -0.035em; color: var(--wordmark); line-height: 1; transition: font-size .2s ease; }
.wordmark-sm { font-size: 22px; }

/* ---------- Buttons ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px; border: 0; border-radius: 4px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 16px; cursor: pointer; transition: filter .15s; }
.button:hover { filter: brightness(.94); }
.button-sm { min-height: 38px; padding: 0 18px; font-size: 15px; }

/* ---------- Drawer ---------- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(21, 23, 26, .45); z-index: 59; }
.drawer-overlay[hidden] { display: none; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(340px, 86vw); background: var(--bg); z-index: 60; padding: 18px 28px 32px; transform: translateX(-102%); transition: transform .22s ease; overflow-y: auto; visibility: hidden; }
.drawer-open .drawer { transform: none; visibility: visible; }
.drawer-open { overflow: hidden; }
.drawer-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.drawer-nav ul { list-style: none; margin: 0; padding: 0; }
.drawer-nav a { display: block; padding: 10px 0; font-family: var(--font-heading); font-weight: var(--heading-weight); font-size: 26px; }
.drawer-nav a:hover { color: var(--wordmark); }
.drawer-about { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 15px; }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 36px 24px; }
.card { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.card-image { display: block; width: 100%; aspect-ratio: 3 / 2; border-radius: 3px; overflow: hidden; background: var(--chip); margin-bottom: 16px; }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .card-image img { transform: scale(1.025); }
.card-placeholder { display: block; width: 100%; height: 100%; }
.pill { display: inline-block; padding: 3px 9px; margin-bottom: 12px; background: var(--chip); border-radius: 4px; font-size: 11.5px; font-weight: 700; line-height: 1.5; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pills .pill { margin: 0; }
.pill-light { background: #fff; color: var(--ink); }
a.pill-light:hover { background: #fff; }
.pill:hover { background: var(--line); }
.card-title { font-size: 18px; line-height: 1.3; margin-bottom: 12px; }
.card-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.card-excerpt { margin: -4px 0 14px; font-size: 14.5px; line-height: 1.55; color: var(--ink-soft); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.meta { margin: 0; font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; line-height: 1.7; }
.meta time, .meta-by { display: block; }
.meta a:hover { text-decoration: underline; }

/* ---------- Hero ---------- */
.hero { margin: 8px 0 0; padding-bottom: 40px; border-bottom: 1px solid var(--line); }
.hero-split { display: grid; grid-template-columns: 2fr 1fr; gap: 0; }
.hero-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 36px 24px; }
.hero-lead { padding-right: 32px; }
.hero-lead-link { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 3px; overflow: hidden; background: #23262b; color: #fff; }
.hero-lead-link img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-lead-link::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(10,12,15,.82) 0%, rgba(10,12,15,.35) 55%, rgba(10,12,15,.1) 100%); }
.hero-lead-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 32px; }
.hero-lead h2 { font-size: clamp(26px, 3.2vw, 40px); line-height: 1.15; margin-bottom: 14px; max-width: 24ch; }
.hero-lead-link:hover h2 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.meta-light { color: rgba(255,255,255,.92); }
.hero-list { border-left: 1px solid var(--line); padding-left: 32px; display: flex; flex-direction: column; }
.hero-item { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 20px 0; border-top: 1px solid var(--line); align-items: start; }
.hero-item:first-child { border-top: 0; padding-top: 0; }
.hero-item:last-child { padding-bottom: 0; }
.hero-item:not(:has(.hero-item-image)) { grid-template-columns: 1fr; }
.hero-item-image { display: block; aspect-ratio: 4 / 3; border-radius: 3px; overflow: hidden; background: var(--chip); }
.hero-item-image img { width: 100%; height: 100%; object-fit: cover; }
.hero-item .card-title { font-size: 19px; margin-bottom: 10px; }

/* ---------- Signup band ---------- */
.signup { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; margin: 48px 0 0; padding: 32px 36px; background: var(--chip); border-radius: 6px; }
.signup h2 { font-size: 28px; margin-bottom: 8px; }
.signup p { margin: 0; color: var(--ink-soft); max-width: 46ch; }
.subscribe-form { position: relative; display: flex; flex-wrap: wrap; gap: 10px; }
.subscribe-input { flex: 1 1 220px; min-height: 46px; padding: 0 14px; border: 1px solid #cfd2d8; border-radius: 4px; background: #fff; font: inherit; }
.subscribe-input:focus { outline: 2px solid var(--wordmark); outline-offset: 0; border-color: transparent; }
.label-loading, .msg { display: none; }
.subscribe-form.loading .label-default { display: none; }
.subscribe-form.loading .label-loading { display: inline; }
.msg { flex-basis: 100%; margin: 4px 0 0; font-size: 14px; font-weight: 500; }
.subscribe-form.success .msg-success, .subscribe-form.error .msg-error { display: block; }
.msg-error { color: #c4291c; }

/* ---------- Sections ---------- */
.section { margin-top: 56px; }
.section-ruled { padding-top: 48px; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.section-head h2 { font-size: 28px; }
.view-all { font-size: 15px; font-weight: 600; }
.view-all:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Article ---------- */
.article { padding-top: 28px; }
.article-image { margin: 0 auto; }
.article-image img { width: 100%; border-radius: 3px; }
.article-image figcaption { margin-top: 10px; font-size: 13px; color: var(--ink); }
.article-image figcaption a { text-decoration: underline; text-underline-offset: 2px; }
.article-header { margin-top: 36px; }
.article-title { font-size: clamp(30px, 4.4vw, 42px); line-height: 1.12; letter-spacing: -0.025em; }
.article-excerpt { margin: 18px 0 0; font-size: 19px; line-height: 1.6; font-weight: 500; color: #7b8089; }
.article-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.share { display: flex; gap: 10px; }
.share-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: var(--ink); color: #fff; cursor: pointer; transition: transform .15s, background .15s; }
.share-btn:hover { transform: translateY(-1px); background: var(--wordmark); }
.share-btn.is-copied { background: var(--wordmark); }

.gh-content { margin-top: 32px; font-family: var(--gh-font-body, var(--font-sans)); font-size: 17px; line-height: 1.8; }
.gh-content > * + * { margin-top: 1.3em; }
.gh-content h2 { font-size: 28px; margin-top: 1.7em; }
.gh-content h3 { font-size: 22px; margin-top: 1.5em; }
.gh-content a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--wordmark); }
.gh-content a:hover { color: var(--wordmark); }
.gh-content blockquote { margin-left: 0; padding-left: 22px; border-left: 3px solid var(--accent); font-style: normal; font-weight: 500; }
.gh-content hr { border: 0; border-top: 1px solid var(--line); margin: 3em 0; }
.gh-content img { border-radius: 3px; }
.gh-content figcaption { margin-top: 10px; font-size: 14px; color: var(--ink-soft); text-align: center; }
.gh-content pre { overflow-x: auto; padding: 18px; background: #14161a; color: #eceff3; border-radius: 4px; font-size: 15px; line-height: 1.55; }
.gh-content code { font-size: .88em; }
.gh-content :not(pre) > code { padding: 2px 6px; background: var(--chip); border-radius: 3px; }
.kg-width-wide { width: min(1040px, calc(100vw - var(--gutter) * 2)); margin-left: 50%; transform: translateX(-50%); }
.kg-width-full { width: 100vw; margin-left: 50%; transform: translateX(-50%); }
.kg-width-full img { border-radius: 0; }
.article-comments { margin-top: 64px; }

/* ---------- Archive / error ---------- */
.archive-header { padding: 56px 0 40px; max-width: 760px; }
.archive-header h1 { font-size: clamp(34px, 5vw, 52px); }
.archive-header p { margin: 14px 0 0; font-family: var(--font-serif); font-size: 20px; color: var(--ink-soft); }
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 16px; }
.error-page { text-align: center; padding: 96px var(--gutter); }
.error-code { margin: 0 0 12px; font-weight: 700; color: var(--wordmark); font-size: 18px; }
.error-page .button { margin-top: 32px; }

.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 48px; font-weight: 600; font-size: 15px; }
.pagination-next { text-align: right; }
.pagination-count { color: var(--ink-soft); font-weight: 500; }
.pagination a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Footer ---------- */
.site-footer .logo img { height: calc(var(--logo-h) * .6); }
.site-footer .wordmark { font-size: calc(var(--logo-h) * .4); }
.site-footer { margin-top: 80px; padding: 56px 0 28px; border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
.footer-desc { margin: 18px 0 0; max-width: 36ch; font-size: 15px; color: var(--ink-soft); }
.social { display: flex; gap: 16px; margin-top: 22px; }
.social a:hover { color: var(--wordmark); }
.footer-col h4 { font-family: var(--font-sans); font-size: 15px; font-weight: 700; letter-spacing: 0; margin-bottom: 14px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li + li { margin-top: 10px; }
.footer-col a { font-size: 15px; }
.footer-col a:hover, .footer-bottom a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom { margin-top: 56px; font-size: 14px; color: var(--ink-soft); }
.footer-bottom a { text-decoration: underline; text-underline-offset: 3px; }


/* ---------- Navigation + social bar ---------- */
.navbar { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.navbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 50px; }
.navbar-links { overflow-x: auto; scrollbar-width: none; min-width: 0; }
.navbar-links::-webkit-scrollbar { display: none; }
.navbar-links ul { display: flex; gap: 26px; margin: 0; padding: 0; list-style: none; white-space: nowrap; }
.navbar-links a { display: block; padding: 14px 0; font-size: 14px; font-weight: 600; }
.navbar-links a:hover, .navbar-links .nav-current a { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.navbar .social { margin: 0; flex-shrink: 0; }

/* ---------- Editorial hero ---------- */
.hero-editorial { display: flex; align-items: stretch; margin-top: 24px; }
.hero-editorial .hero-left { flex: 0 0 24%; padding-right: 28px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 28px; }
.hero-editorial .hero-center { flex: 1; min-width: 0; padding: 0 28px; display: flex; }
.hero-editorial .hero-right { flex: 0 0 24%; padding-left: 28px; border-left: 1px solid var(--line); }
.hero-editorial:not(:has(.hero-left)) .hero-center { padding-left: 0; }
.hero-editorial:not(:has(.hero-right)) .hero-center { padding-right: 0; }
.hero-side .card-image { margin-bottom: 18px; }
.hero-side .card-title { font-size: 17px; margin-bottom: 10px; }
.lead { flex: 1; display: flex; min-width: 0; }
.lead-link { position: relative; display: block; flex: 1; min-height: 520px; border-radius: 3px; overflow: hidden; background: #23262b; color: #fff; }
.lead-link img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lead-link::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(10,12,15,.85) 0%, rgba(10,12,15,.4) 45%, rgba(10,12,15,0) 75%); }
.lead-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 28px; }
.lead-text h2 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 14px; }
.lead-link:hover h2 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.lead-text .pills { margin-bottom: 14px; }
.hero-text { padding: 20px 0; border-top: 1px solid var(--line); }
.hero-text:first-child { padding-top: 0; border-top: 0; }
.hero-text .card-title { font-size: 17px; margin-bottom: 10px; }
.hero-text .card-title a:hover, .hero-side .card-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 1000px) {
    .hero-editorial { flex-direction: column; }
    .hero-editorial .hero-center { order: 1; padding: 0; }
    .hero-editorial .hero-left { order: 2; flex: none; padding: 28px 0 0; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
    .hero-editorial .hero-right { order: 3; flex: none; padding: 28px 0 0; border: 0; }
    .lead-link { min-height: 420px; }
}
@media (max-width: 640px) {
    .hero-editorial .hero-left { grid-template-columns: 1fr; }
    .lead-link { min-height: 380px; }
    .lead-text { padding: 20px; }
    .navbar .social { display: none; }
    .article-meta { align-items: flex-start; flex-direction: column; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .logo-s { --logo-h: 40px; } .logo-m { --logo-h: 60px; } .logo-l { --logo-h: 80px; }
    .grid, .hero-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-split { grid-template-columns: 1fr; }
    .hero-lead { padding-right: 0; }
    .hero-list { border-left: 0; padding-left: 0; margin-top: 28px; border-top: 1px solid var(--line); padding-top: 24px; }
    .signup { grid-template-columns: 1fr; padding: 28px; }
}
@media (max-width: 640px) {
    :root { --gutter: 20px; --header-h: 58px; }
    .logo-s { --logo-h: 30px; } .logo-m { --logo-h: 42px; } .logo-l { --logo-h: 54px; }
    .grid, .hero-grid { grid-template-columns: 1fr; }
    .link-quiet { display: none; }
    .hero-lead-link { aspect-ratio: 4 / 5; }
    .hero-lead-text { padding: 20px; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
    .gh-content { font-size: 18px; }
    .section-head h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
