/* site.css — this theme's own components, layered on the untouched Kiln
   default (theme.css). Everything here uses the semantic variables theme.css
   defines per [data-palette] (--bg, --surface, --text, --muted, --border,
   --accent, --on-primary…) plus the brand tokens from brand.css, so it needs
   no light/dark forks of its own.

   Components:
     1. Header navigation tabs        (features: [.navigationTabs])
     2. Back-to-top button            (features: [.backToTop])
     3. Landing layout                (template: landing)
     4. Blog: listing, cards, post, tags, authors, pagination
     5. Garden: OKF entity references
     6. Code-block copy button        (added by site.js)
     7. Code-block filename label + line highlights (added by site.js)
     8. Blog hero image + card thumbnails (image: front matter)
*/

/* ---- 1. Header navigation tabs ---- */
.kiln-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-inline-start: 20px;
    min-width: 0;
    overflow-x: auto;
}
.kiln-tab {
    padding: 6px 12px;
    border-radius: calc(var(--kiln-radius) - 4px);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
}
.kiln-tab:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.kiln-tab-active { color: var(--accent); }
.kiln-tab-active:hover { color: var(--accent); }
@media (max-width: 900px) {
    /* The drawer (hamburger) carries the full nav tree on small screens. */
    .kiln-tabs { display: none; }
}
/* Pages without a content sidebar (home, landing) still render one so the
   hamburger drawer has the nav to show under 900px. Keep it out of the
   desktop layout — the drawer rules in theme.css take over below 900px. */
@media (min-width: 901px) {
    .kiln-sidebar.kiln-drawer-only { display: none; }
}

/* ---- 2. Back-to-top ---- */
.kiln-back-to-top {
    position: fixed;
    inset-inline-end: 24px;
    bottom: 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    z-index: 50;
}
.kiln-back-to-top:hover { background: var(--surface-2); }
/* The [hidden] attribute must beat the display above. */
.kiln-back-to-top[hidden] { display: none; }

/* ---- 3. Landing layout ---- */
.kiln-hero {
    padding: clamp(48px, 10vh, 110px) 0 clamp(32px, 6vh, 64px);
    text-align: center;
    background: var(--brand-hero-bg, transparent);
    border-radius: var(--kiln-radius);
}
.kiln-hero-image {
    display: block;
    margin: 0 auto 24px;
    max-width: min(420px, 90%);
    max-height: 280px;
    border-radius: var(--kiln-radius);
    object-fit: cover;
}
.kiln-hero-eyebrow {
    margin: 0 0 12px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}
.kiln-hero-title {
    margin: 0;
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.kiln-hero-tagline {
    margin: 16px auto 0;
    max-width: 40em;
    font-size: 1.15rem;
    color: var(--muted);
}
.kiln-hero-text { margin: 12px auto 0; max-width: 44em; color: var(--text); }
.kiln-hero-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.kiln-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
}
.kiln-button:hover { background: var(--surface-2); text-decoration: none; }
.kiln-button-primary { background: var(--accent); border-color: var(--accent); color: var(--on-primary); }
.kiln-button-primary:hover { background: var(--accent); filter: brightness(1.1); }
.kiln-button-disabled { opacity: 0.45; pointer-events: none; }

.kiln-landing-body { margin-top: clamp(32px, 6vh, 64px); }
/* A raw-HTML grid landing markdown can use for feature/highlight cards. */
.kiln-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.kiln-feature-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--kiln-radius);
    background: var(--surface);
}
.kiln-feature-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.kiln-feature-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---- 4. Blog ---- */
.kiln-blog { max-width: 880px; margin: 0 auto; }
.kiln-blog-head { padding: 32px 0 8px; }
.kiln-blog-heading { margin: 0; font-size: clamp(1.8rem, 4vw, 2.4rem); letter-spacing: -0.02em; }
.kiln-blog-sub { margin: 10px 0 0; color: var(--muted); font-size: 1.05rem; }
.kiln-blog-meta-links { display: flex; gap: 16px; margin-top: 14px; font-size: 0.9rem; }
.kiln-blog-back { display: inline-block; margin-top: 24px; font-size: 0.9rem; }

.kiln-blog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 24px 0 32px;
}
.kiln-blog-card {
    padding: 22px 24px;
    border: 1px solid var(--border);
    border-radius: var(--kiln-radius);
    background: var(--surface);
}
.kiln-blog-card-title { margin: 0; font-size: 1.25rem; line-height: 1.3; }
.kiln-blog-card-title a { color: var(--text); text-decoration: none; }
.kiln-blog-card-title a:hover { color: var(--accent); }
.kiln-blog-card-meta { margin: 8px 0 0; font-size: 0.85rem; color: var(--muted); }
.kiln-blog-card-meta span { margin: 0 4px; }
.kiln-blog-card-excerpt { margin: 10px 0 0; color: var(--text); font-size: 0.97rem; }

.kiln-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}
.kiln-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.8rem;
    text-decoration: none;
}
.kiln-tag:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.kiln-tag-active { color: var(--on-primary); background: var(--accent); border-color: var(--accent); }
.kiln-tag-active:hover { color: var(--on-primary); }
.kiln-tag-count { opacity: 0.7; font-size: 0.75rem; }
.kiln-tag-rail { margin: 20px 0 4px; }

.kiln-blog-post { max-width: 760px; margin: 0 auto; }
.kiln-blog-post-header { padding: 32px 0 4px; }
.kiln-blog-post-title { margin: 8px 0 0; font-size: clamp(1.9rem, 4.5vw, 2.6rem); line-height: 1.15; letter-spacing: -0.02em; }
.kiln-blog-post-byline { margin: 12px 0 0; color: var(--muted); font-size: 0.95rem; }
.kiln-blog-post-header + .kiln-article { margin-top: 24px; }
.kiln-blog-post-footer {
    display: flex;
    justify-content: space-between;
    margin: 40px 0 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

.kiln-author-header { text-align: center; padding: 24px 0 8px; }
.kiln-author-header .kiln-tag-list { justify-content: center; }
.kiln-author-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
}
.kiln-author-card { text-align: center; }
.kiln-author-card .kiln-tag-list { justify-content: center; }
.kiln-author-card .kiln-author-avatar { width: 64px; height: 64px; }
.kiln-author-handle { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.kiln-author-bio { margin: 12px auto 0; max-width: 40em; color: var(--text); }

.kiln-blog-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 40px;
}
.kiln-page-numbers {
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.92rem;
}
.kiln-page-numbers li { display: inline-flex; }
.kiln-page-numbers a, .kiln-page-current, .kiln-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    border-radius: calc(var(--kiln-radius) - 4px);
    text-decoration: none;
}
.kiln-page-numbers a:hover { background: var(--surface-2); }
.kiln-page-current { background: var(--accent); color: var(--on-primary); font-weight: 600; }
.kiln-page-ellipsis { color: var(--muted); }

/* ---- 5. Garden: OKF entity references ---- */
/* A [[taxon.id]] wikilink names an entity's identity, not a page — on the
   web it renders as this inert span (see GardenImport.rewriteLinks). */
.okf-entity-ref {
    font-family: var(--kiln-mono, ui-monospace, monospace);
    font-size: 0.88em;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px dashed var(--border);
    color: var(--muted);
    white-space: nowrap;
}

/* ---- 6. Code-block copy button ---- */
/* site.js appends button.kiln-copy to every pre that holds a code block.
   Subtle until the block is hovered or the button is focused, but never
   fully hidden — touch devices have no hover. */
pre:has(> code) { position: relative; }
.kiln-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 10px;
    font: inherit;
    font-size: 0.75rem;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--kiln-radius) - 4px);
    cursor: pointer;
    opacity: 0.65;
    transition: opacity 120ms ease;
}
pre:hover .kiln-copy,
.kiln-copy:focus-visible,
.kiln-copy.kiln-copy-done { opacity: 1; }
.kiln-copy:hover { color: var(--text); background: var(--surface-2); }
.kiln-copy.kiln-copy-done { color: var(--accent); border-color: var(--accent); }

/* ---- 7. Code-block filename label + line highlights ---- */
/* site.js inserts div.kiln-code-title before a pre whose fence carried
   title="…", and overlay stripes for hl=N,N-M ranges. */
.kiln-code-title {
    margin: 1em 0 0;
    padding: 7px 18px;
    font-family: var(--kiln-font-code, ui-monospace, monospace);
    font-size: 0.78rem;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--kiln-radius) var(--kiln-radius) 0 0;
}
.kiln-code-title + pre {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.kiln-hl-line {
    position: absolute;
    left: 0;
    right: 0;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    pointer-events: none;
}

/* ---- 8. Blog hero image + card thumbnails ---- */
/* Both come from a post's `image:` front matter (which also feeds the
   OpenGraph/link-preview image). */
.kiln-blog-post-hero {
    display: block;
    width: 100%;
    max-height: 340px;
    object-fit: cover;
    border-radius: var(--kiln-radius);
    margin: 24px 0 0;
}
/* The hero sits between header and article, so restore the top margin the
   header+article adjacency rule above would otherwise have provided. */
.kiln-blog-post-hero + .kiln-article { margin-top: 24px; }
.kiln-blog-card-thumb {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: calc(var(--kiln-radius) - 4px);
    margin-bottom: 14px;
}
