/* =========================================================================
   Per-template layout containers.

   Pages.css holds the named replacements for the inline grid/padding
   declarations that live on <section> / <div> wrappers in the static
   reference. Component-level classes (cards, pills, sidebars, TOC, nav,
   breadcrumb, footer, etc.) live in components.css; element defaults
   live in base.css; long-form typography in prose.css.

   Every value references a token from tokens.css. No hardcoded hex,
   no Google Fonts. Sticky offsets use var(--nav-height).
   ========================================================================= */

/* -------------------------------------------------------------------------
   Generic vertical-rhythm section
   ------------------------------------------------------------------------- */

.section {
    padding: var(--s-9) 0;
    border-top: 1px solid var(--border);
}
.section--no-border { border-top: 0; }
.section--tight { padding: 72px 0; }

.section__inner {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.section__inner--narrow {
    max-width: 720px;
}
.section__inner--article {
    max-width: 880px;
}

/* Heading block above section content */
.section-head {
    margin-bottom: 48px;
}
.section-head--split {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 40px;
}
.section-head__title {
    font-size: clamp(28px, 3.4vw, 44px);
    line-height: 1.1;
    letter-spacing: -0.015em;
    margin: 0;
}
.section-head__link {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
}
.section-head__link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* -------------------------------------------------------------------------
   Hero dot-grid decoration (absolute background layer)
   ------------------------------------------------------------------------- */

.hero-dotgrid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, var(--dot-grid) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(ellipse 75% 60% at 30% 50%, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 75% 60% at 30% 50%, black 30%, transparent 80%);
}
.hero-dotgrid--cat {
    mask-image: radial-gradient(ellipse 65% 55% at 25% 50%, black 25%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 65% 55% at 25% 50%, black 25%, transparent 80%);
}
.hero-dotgrid--single {
    mask-image: radial-gradient(ellipse 70% 60% at 30% 30%, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 30% 30%, black 30%, transparent 80%);
}

/* -------------------------------------------------------------------------
   Front page (blog index)
   ------------------------------------------------------------------------- */

.front-hero {
    position: relative;
    padding: clamp(72px, 10vh, 120px) 0 80px;
    overflow: hidden;
}
.front-hero__inner {
    position: relative;
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.front-hero__title {
    font-size: clamp(40px, 6vw, 72px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0 0 24px;
}
.front-hero__sub {
    font-family: var(--font-sans);
    font-size: clamp(16px, 1.4vw, 19px);
    line-height: 1.55;
    color: var(--fg-muted);
    margin: 0;
    max-width: 540px;
}

.blog-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(32px, 5vw, 72px);
    align-items: end;
}
.blog-hero__intro {
    /* Left column wrapper — owns the kicker, h1, sub, stat row */
}

/* Stat row under hero (zveřejněných textů, kategorií, …) */
.front-stats {
    display: flex;
    gap: 32px;
    margin-top: 40px;
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 13px;
}
.front-stat__value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 22px;
    color: var(--fg);
    letter-spacing: -0.01em;
    line-height: 1;
}
.front-stat__label {
    font-size: 12px;
    color: var(--fg-subtle);
    margin-top: 6px;
}

/* Categories grid (homepage). Hairline separators via 1px gap on a
   var(--border) background — the gap shows through. */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}

/* Latest posts grid (homepage) */
.latest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* -------------------------------------------------------------------------
   Category page
   ------------------------------------------------------------------------- */

.cat-hero {
    position: relative;
    padding: clamp(64px, 9vh, 96px) 0 64px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}
.cat-hero__inner {
    position: relative;
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.cat-hero__title {
    font-size: clamp(40px, 5.5vw, 64px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0 0 20px;
}
.cat-hero__short {
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--accent);
    margin-bottom: 20px;
}
.cat-hero__long {
    font-family: var(--font-sans);
    font-size: clamp(15px, 1.3vw, 18px);
    line-height: 1.6;
    color: var(--fg-muted);
    margin: 0;
    max-width: 600px;
}
.cat-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: clamp(32px, 5vw, 72px);
    align-items: end;
}

/* Meta-box on the category hero (right column) */
.meta-box {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 22px;
}
.meta-box__head {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--fg-subtle);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.meta-box__row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-family: var(--font-mono);
    font-size: 13px;
}
.meta-box__row:last-child {
    border-bottom: 0;
}
.meta-box__label {
    color: var(--fg-subtle);
}
.meta-box__value {
    color: var(--fg);
}
.meta-box__value a {
    color: var(--accent);
    text-decoration: none;
}
.meta-box__value a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Category list section: list of articles + sidebar */
.cat-list-section {
    padding: 64px 0;
}
.cat-list-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: clamp(32px, 5vw, 72px);
    align-items: start;
}

/* -------------------------------------------------------------------------
   Single article (post)
   ------------------------------------------------------------------------- */

.single-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(56px, 8vh, 88px) 0 56px;
    border-bottom: 1px solid var(--border);
}
.single-hero__inner {
    position: relative;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.single-hero__cat-row {
    margin-bottom: 24px;
}
.single-hero__title {
    font-size: clamp(34px, 5.2vw, 56px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 24px;
}
.single-hero__lede {
    font-family: var(--font-sans);
    font-size: clamp(17px, 1.5vw, 21px);
    line-height: 1.55;
    color: var(--fg-muted);
    margin: 0 0 40px;
    max-width: 720px;
}
.single-body {
    padding: 64px 0;
}
.article-grid {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: clamp(40px, 6vw, 96px);
    align-items: start;
}

/* Anchor offset for in-article jump targets so headings clear the sticky nav */
.prose :is(h2, h3, h4)[id] {
    scroll-margin-top: calc(var(--nav-height) + 16px);
}

/* -------------------------------------------------------------------------
   Related-posts section (single article bottom)
   ------------------------------------------------------------------------- */

.related-section {
    padding: var(--s-9) 0;
    border-top: 1px solid var(--border);
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

/* -------------------------------------------------------------------------
   Rychlovka (short-note CPT)
   No static reference exists; defaults follow the design language: short,
   denser hero, vertical stream of dated cards with hairline separators.
   ------------------------------------------------------------------------- */

.rychlovka-hero {
    position: relative;
    padding: clamp(56px, 7vh, 88px) 0 48px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}
.rychlovka-hero__inner {
    position: relative;
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.rychlovka-hero__title {
    font-size: clamp(34px, 4.8vw, 56px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0 0 20px;
}
.rychlovka-hero__sub {
    font-family: var(--font-sans);
    font-size: clamp(15px, 1.3vw, 18px);
    line-height: 1.6;
    color: var(--fg-muted);
    margin: 0;
    max-width: 600px;
}

/* Vertical stream of dated cards */
.rychlovka-stream {
    display: flex;
    flex-direction: column;
}
.rychlovka-stream > * + * {
    border-top: 1px solid var(--border);
}

.stream-card {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: clamp(20px, 3vw, 36px);
    padding: 24px 0;
    text-decoration: none;
    color: inherit;
    transition: background var(--dur-fast) var(--ease);
}
.stream-card:hover {
    text-decoration: none;
}
.stream-card__date {
    font-family: var(--font-mono);
    color: var(--fg-subtle);
    line-height: 1;
    text-align: right;
}
.stream-card__day {
    font-size: 28px;
    font-weight: 700;
    color: var(--fg);
    letter-spacing: -0.01em;
    display: block;
}
.stream-card__month {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 6px;
    display: block;
}
.stream-card__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}
.stream-card__title {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(18px, 1.6vw, 22px);
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--fg);
    transition: color var(--dur-fast) var(--ease);
}
.stream-card:hover .stream-card__title { color: var(--accent); }
.stream-card__excerpt {
    font-family: var(--font-sans);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--fg-muted);
    margin: 0;
    max-width: 640px;
}
.stream-card__tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* Single rychlovka — narrow column with minimal chrome */
.rychlovka-single__hero {
    position: relative;
    padding: clamp(48px, 7vh, 80px) 0 40px;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.rychlovka-single__title {
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 16px;
}
.rychlovka-single__meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--fg-subtle);
}
.rychlovka-single__body {
    padding: 48px 0 24px;
}
.rychlovka-single__tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 24px 0 56px;
}

/* -------------------------------------------------------------------------
   404 page
   No static reference exists; defaults follow the design language: short
   centered hero with mono kicker, accent-coloured "404" mark, recent posts
   grid, and a CTA back to the blog index.
   ------------------------------------------------------------------------- */

.nf-hero {
    position: relative;
    padding: clamp(80px, 12vh, 140px) 0 80px;
    overflow: hidden;
    text-align: center;
}
.nf-hero__inner {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.nf-hero__title {
    font-size: clamp(48px, 8vw, 96px);
    line-height: 1;
    letter-spacing: -0.02em;
    margin: 0 0 24px;
    color: var(--fg);
}
.nf-hero__title .accent { color: var(--accent); }
.nf-hero__sub {
    font-family: var(--font-sans);
    font-size: clamp(16px, 1.4vw, 19px);
    line-height: 1.6;
    color: var(--fg-muted);
    margin: 0 auto 32px;
    max-width: 540px;
}
.nf-recent {
    padding: 64px 0;
    border-top: 1px solid var(--border);
}
.nf-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    color: var(--accent-fg);
    background: var(--accent);
    padding: 12px 22px;
    border-radius: var(--r-md);
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease);
}
.nf-cta:hover {
    background: var(--accent-hover);
    text-decoration: none;
}

/* -------------------------------------------------------------------------
   Responsive collapses (mandatory)
   ------------------------------------------------------------------------- */

@media (max-width: 900px) {
    .blog-hero-grid,
    .cat-hero-grid { grid-template-columns: 1fr; }
    .cat-list-grid,
    .article-grid  { grid-template-columns: minmax(0, 1fr); }
    /* On mobile we render <details class="toc-mobile"> inside <article>
       and an inline share-article row after the body — the desktop aside
       is hidden entirely. */
    .toc-aside { display: none; }
}

@media (max-width: 620px) {
    .stream-card { grid-template-columns: 64px minmax(0, 1fr); }
    .stream-card__day { font-size: 22px; }
}

@media (max-width: 720px) {
    .single-body { padding: 40px 0; }
    .single-hero { padding-bottom: 32px; }
    .single-hero__title { letter-spacing: -0.01em; }
}
