/* ==========================================================================
   jurgielzyla — Ghost theme
   Sections: Tokens · Base · Site header · Navigation
   Indicative colors/typography (inspired by Journal), to be refined.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */
:root {
    --paper:      #EBEEF2;
    --surface:    #FFFFFF;
    --surface-2:  #F5F7FA;
    --ink:        #1B1E26;
    --muted:      #5C6472;
    --faint:      #8A92A0;
    --accent:     #2E5C7A;
    --accent-soft:#E2ECF2;
    --line:       #D8DDE5;

    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

    --cards-min-h: 66vh;               /* requirement 3: ~2/3 of viewport height */
    --maxw: 1120px;
    color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
    :root {
        --paper:#0F1217; --surface:#181C23; --surface-2:#1E232B; --ink:#E9ECF1;
        --muted:#98A1B0; --faint:#6B7482; --accent:#74A9C9; --accent-soft:#1D3444;
        --line:#2A313B;
    }
}

/* --- Base ----------------------------------------------------------------- */
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
.site-wrapper { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* --- Site header (requirement 1) ------------------------------------------ */
.site-header { text-align: center; padding: 56px 0 34px; }
.site-header__title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(1.6rem, 1rem + 2vw, 2.4rem);
    letter-spacing: -.01em;
    margin: 0 0 10px;
}
.site-header__title a { text-decoration: none; }
.site-header__desc {
    color: var(--muted);
    font-size: 1.02rem;
    max-width: 56ch;
    margin: 0 auto 20px;
}

/* --- Navigation ----------------------------------------------------------- */
.nav {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-wrap: wrap; justify-content: center; gap: 22px;
}
.nav__link {
    text-decoration: none;
    font-size: .82rem; letter-spacing: .04em; text-transform: uppercase;
    padding-bottom: 3px; border-bottom: 2px solid transparent;
}
.nav__link:hover, .nav__item--active .nav__link { color: var(--accent); border-color: var(--accent); }

/* --- Koenig editor width classes (required styled by GScan) -------------- */
.kg-width-wide { max-width: 1100px; margin-left: auto; margin-right: auto; }
.kg-width-full { max-width: 100%; }

/* --- Cards: two business cards (requirements 1–2–3–5) --------------------- */
.cards {
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    min-height: var(--cards-min-h);          /* 2/3 as MINIMUM — grows with content */
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    margin-top: 8px;
}
.cards--h60 { --cards-min-h: 60vh; }
.cards--h75 { --cards-min-h: 75vh; }
.cards__divider { background: var(--line); }
.card { padding: 40px; display: flex; flex-direction: column; }
.card__content { margin: auto 0; min-width: 0; overflow-wrap: break-word; }          /* vertical centering when content is short */
.card__content :first-child { margin-top: 0; }
.card__content :last-child { margin-bottom: 0; }
.card__content img { border-radius: 10px; margin: 0 auto 18px; }
.card__content h1, .card__content h2, .card__content h3 { font-family: var(--serif); }
.card__content a { color: var(--accent); }
.card__content pre { overflow-x: auto; }
.card__content table { display: block; overflow-x: auto; }
.card__empty {
    margin: auto; max-width: 34ch; text-align: center;
    color: var(--muted); font-size: .92rem;
}

/* Mobile: columns stack one below the other; the 2/3 rule no longer applies */
@media (max-width: 900px) {
    .cards { grid-template-columns: 1fr; min-height: 0; }
    .cards__divider { height: 1px; width: 100%; }
}

/* --- Posts feed (requirement 4) ------------------------------------------ */
.feed { padding: 48px 0 64px; }
.feed__head { margin-bottom: 24px; }
.feed__title { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; margin: 0; }
.feed__empty { color: var(--muted); }

/* Grid variant */
.feed__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.post-card__link { text-decoration: none; display: flex; flex-direction: column; height: 100%; }
.post-card__thumb { aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; margin-bottom: 12px; background: var(--surface-2); }
.post-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card__kicker { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.post-card__title { font-family: var(--serif); font-weight: 600; font-size: 1.08rem; line-height: 1.25; margin: 6px 0 7px; }
.post-card__excerpt { color: var(--muted); font-size: .88rem; margin: 0 0 10px; }
.post-card__meta { margin-top: auto; color: var(--faint); font-size: .78rem; }

/* List variant */
.feed__list { display: flex; flex-direction: column; gap: 4px; }
.post-row__link { text-decoration: none; display: flex; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.post-row__thumb { flex: none; width: 120px; aspect-ratio: 3 / 2; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.post-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
/* flex: fill remaining width; min-width:0 lets long tokens wrap instead of overflowing */
.post-row__body { flex: 1 1 auto; min-width: 0; }
.post-row__title { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; margin: 0 0 6px; }
.post-row__excerpt { color: var(--muted); font-size: .9rem; margin: 0 0 8px; }
.post-row__meta { color: var(--faint); font-size: .78rem; }

@media (max-width: 900px) {
    .feed__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .feed__grid { grid-template-columns: 1fr; }
    .post-row__thumb { width: 88px; }
}

/* --- Single post / page --------------------------------------------------- */
.single { max-width: 720px; margin: 0 auto; padding: 40px 0 72px; }
.post__kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.post__title, .page__title { font-family: var(--serif); font-weight: 600; font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.6rem); line-height: 1.1; letter-spacing: -.01em; text-wrap: balance; margin: 8px 0 12px; }
.post__meta { color: var(--faint); font-size: .84rem; margin: 0 0 28px; }
.post__figure, .page__figure { margin: 0 0 28px; }
.post__figure img, .page__figure img { border-radius: 12px; }
.post__content, .page__content { font-size: 1.05rem; }
.post__content p, .page__content p { margin: 0 0 1.2em; }
.post__content a, .page__content a { color: var(--accent); }
.post__content img, .page__content img { border-radius: 10px; margin: 1.4em 0; }
.post__content h2, .post__content h3, .page__content h2, .page__content h3 { font-family: var(--serif); margin: 1.6em 0 .5em; }

/* Wide content (code blocks, tables) must not stretch the page horizontally */
.post__content pre, .page__content pre { overflow-x: auto; }
.post__content table, .page__content table { display: block; overflow-x: auto; }

/* --- Pagination ----------------------------------------------------------- */
.pagination { display: flex; justify-content: center; gap: 18px; padding: 8px 0 8px; color: var(--muted); }
.pagination a { color: var(--accent); text-decoration: none; }

/* --- Reduced motion / focus ---------------------------------------------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* --- Slim bar for single post/page views (home link + navigation) -------- */
.site-bar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 20px;
    padding: 20px 0; margin-bottom: 8px;
    border-bottom: 1px solid var(--line);
}
.site-bar__home { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; text-decoration: none; }
.site-bar .nav { justify-content: flex-end; gap: 18px; }
