/* ============================================================
   Tech-kutak theme
   A reading-first "command-line nook" identity.
   Signature: directory-style (~/) section + tag labels in mono.
   ============================================================ */

:root {
    --bg: #fafaf8;
    --surface: #ffffff;
    --ink: #1a1d23;
    --ink-soft: #41454e;
    --muted: #767b85;
    --line: #e7e4dd;
    --line-strong: #d8d4cb;
    --accent: #0e7c66;        /* overridden inline from theme settings */
    --accent-ink: #ffffff;
    --code-bg: #15181e;
    --code-ink: #e7e8ea;

    --font-display: var(--gh-font-heading, "Space Grotesk"), ui-sans-serif, system-ui, sans-serif;
    --font-body: var(--gh-font-body, "Source Serif 4"), Georgia, Cambria, "Times New Roman", serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    --wrap: 1120px;
    --measure: 46rem;        /* ~70ch reading column */
    --radius: 10px;
    --step: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: none; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 1.25rem; }

/* ---------- mono labels (the signature) ---------- */
.brand__mark,
.hero__eyebrow,
.card__tag,
.post__tag,
.related__title,
.ad__label,
.nav a {
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}

/* ---------- header ---------- */
.site-header {
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.2) blur(8px);
    position: sticky;
    top: 0;
    z-index: 50;
}
.site-header__inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 64px;
}
.brand { display: inline-flex; align-items: baseline; gap: 0.4rem; text-decoration: none; color: var(--ink); }
.brand__logo { max-height: 30px; width: auto; }
.brand__mark { color: var(--accent); font-weight: 500; font-size: 1.05rem; }
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; }
.nav { margin-left: auto; }
.nav ul { list-style: none; display: flex; gap: 1.25rem; margin: 0; padding: 0; }
.nav a { color: var(--ink-soft); text-decoration: none; font-size: 0.85rem; }
.nav a:hover { color: var(--accent); }
.site-header__actions { display: flex; gap: 0.5rem; }
.site-header__tagline { color: var(--muted); font-size: 0.9rem; margin: 0 auto; padding-bottom: 0.75rem; }

@media (max-width: 720px) {
    .nav { display: none; }
    .site-header__tagline { display: none; }
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center;
    font-family: var(--font-mono); font-size: 0.8rem;
    padding: 0.45rem 0.85rem; border-radius: 8px;
    text-decoration: none; border: 1px solid transparent; cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.btn--ghost { color: var(--ink-soft); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn--solid { background: var(--accent); color: var(--accent-ink); }
.btn--solid:hover { filter: brightness(1.08); }

/* ---------- reading progress (single motion element) ---------- */
.reading-progress { position: sticky; top: 64px; height: 2px; background: transparent; z-index: 40; }
.reading-progress__bar { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }
body:not(.post-template) .reading-progress { display: none; }

/* ---------- hero ---------- */
.hero { padding: clamp(2.5rem, 5vw, 4.5rem) 1.25rem clamp(1.5rem, 3vw, 2.5rem); max-width: 56rem; }
.hero__eyebrow { color: var(--accent); font-size: 0.85rem; margin: 0 0 0.75rem; }
.hero__title { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; line-height: 1.08; font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem); margin: 0; }
.hero__sub { color: var(--ink-soft); font-size: 1.15rem; margin: 1rem 0 0; max-width: 40rem; }
.hero__count { font-family: var(--font-mono); color: var(--muted); font-size: 0.8rem; margin-top: 1rem; }

/* ---------- feed grid ---------- */
.feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem 1.75rem;
    padding: 2rem 0 3rem;
    border-top: 1px solid var(--line);
}
.feed--related { border-top: none; padding-top: 1.25rem; }

.card { position: relative; }
.card__link { display: block; color: inherit; text-decoration: none; }
.card__media { margin: 0 0 1rem; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16/9; background: var(--line); }
.card__image { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.card__link:hover .card__image { transform: scale(1.03); }
.card__tag { color: var(--accent); font-size: 0.75rem; }
.card__title { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; font-size: 1.3rem; margin: 0.5rem 0 0.4rem; }
.card__link:hover .card__title { color: var(--accent); }
.card__excerpt { color: var(--ink-soft); font-size: 0.98rem; margin: 0 0 0.75rem; }
.card__meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }

/* ---------- single post ---------- */
.post__header { max-width: var(--measure); padding-top: clamp(2rem, 4vw, 3.5rem); }
.post__tag { color: var(--accent); font-size: 0.8rem; text-decoration: none; }
.post__title { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; line-height: 1.12; font-size: clamp(1.9rem, 1.4rem + 2.5vw, 2.9rem); margin: 0.6rem 0 0; }
.post__excerpt { color: var(--ink-soft); font-size: 1.2rem; line-height: 1.5; margin: 1rem 0 0; }
.post__meta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1.25rem; }
.post__feature { max-width: var(--wrap); margin-top: 2rem; }
.post__feature img { border-radius: var(--radius); width: 100%; }
.post__feature figcaption { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); text-align: center; margin-top: 0.5rem; }

/* reading column */
.post__content { max-width: var(--measure); margin-top: 2.5rem; font-size: 1.12rem; }
.gh-content > * { margin-block: 1.5rem; }
.gh-content h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; font-size: 1.6rem; margin-top: 2.75rem; line-height: 1.25; }
.gh-content h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.25rem; margin-top: 2rem; }
.gh-content a { color: var(--accent); }
.gh-content blockquote { border-left: 3px solid var(--accent); margin-inline: 0; padding-left: 1.25rem; color: var(--ink-soft); font-style: italic; }
.gh-content ul, .gh-content ol { padding-left: 1.4rem; }
.gh-content li { margin-block: 0.4rem; }
.gh-content img { border-radius: var(--radius); }
.gh-content hr { border: none; border-top: 1px solid var(--line-strong); }

/* Koenig editor card widths */
.gh-content :where(.kg-width-wide) {
    position: relative;
    width: calc(100% + 12vw);
    max-width: 65rem;
    margin-inline: calc(-6vw);
}
.gh-content :where(.kg-width-full) {
    position: relative;
    width: 100vw;
    max-width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}
.gh-content :where(.kg-width-full) img { width: 100%; border-radius: 0; }
@media (max-width: 50rem) {
    .gh-content :where(.kg-width-wide) { width: 100%; margin-inline: 0; }
}

/* code */
.gh-content :not(pre) > code {
    font-family: var(--font-mono); font-size: 0.86em;
    background: color-mix(in srgb, var(--accent) 9%, transparent);
    color: var(--ink); padding: 0.12em 0.38em; border-radius: 5px;
}
.gh-content pre {
    background: var(--code-bg); color: var(--code-ink);
    font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.6;
    padding: 1.1rem 1.25rem; border-radius: var(--radius); overflow-x: auto;
}
.gh-content pre code { background: none; color: inherit; padding: 0; }

/* post footer */
.post__footer { max-width: var(--measure); padding-block: 2rem; }
.post__tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-soft); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.25rem 0.7rem; text-decoration: none; }
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* related */
.related { max-width: var(--wrap); border-top: 1px solid var(--line); padding-top: 2rem; margin-top: 1rem; }
.related__title { color: var(--accent); font-size: 0.85rem; margin: 0; }

/* ---------- ads ---------- */
.ad {
    max-width: var(--measure);
    margin: 2.5rem auto;
    text-align: center;
}
.ad--in-content { margin-block: 2.75rem; }
.ad__label {
    display: block; font-family: var(--font-mono);
    font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 0.4rem;
}
.ad ins { min-height: 90px; }

/* ---------- pagination ---------- */
.pagination { display: flex; justify-content: space-between; align-items: center; padding-block: 2rem 3rem; font-family: var(--font-mono); font-size: 0.85rem; border-top: 1px solid var(--line); }
.pagination a { color: var(--accent); text-decoration: none; }
.pagination .page-number { color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding-block: 2.5rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; justify-content: space-between; }
.site-footer__brand { font-family: var(--font-display); font-weight: 700; display: inline-flex; gap: 0.4rem; align-items: baseline; }
.nav--footer ul { list-style: none; display: flex; gap: 1.25rem; margin: 0; padding: 0; }
.site-footer__legal { color: var(--muted); font-size: 0.82rem; width: 100%; margin: 0; }

/* ---------- focus ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ============================================================
   Armor layer — defends the theme against conflicting CSS that
   may be present in Ghost Settings → Code Injection (e.g. a stray
   `@media (prefers-color-scheme: dark)` block that whitened the
   titles). Loaded last + scoped to the theme's own classes so it
   reliably wins. Remove if you later add real dark-mode support.
   ============================================================ */
html, body { background: var(--bg) !important; color: var(--ink) !important; }

.hero__title,
.card__title,
.post__title,
.gh-content h1,
.gh-content h2,
.gh-content h3 { color: var(--ink); }

.hero__sub,
.card__excerpt,
.post__excerpt { color: var(--ink-soft); }

/* Neutralize an injected dark-mode override on this light-only theme */
@media (prefers-color-scheme: dark) {
    html, body { background: var(--bg); color: var(--ink); }
    .hero__title,
    .card__title,
    .post__title,
    .site-header,
    .gh-content h1,
    .gh-content h2,
    .gh-content h3,
    .gh-content h4 { color: var(--ink); }
}
