/* ---------- Theme ---------- */
:root {
    --bg: #fbfaf7;
    --surface: #ffffff;
    --text: #1f2328;
    --muted: #6a6f76;
    --rule: #e4e1da;
    --accent: #b4532a;        /* warm copper */
    --accent-soft: #f4e6dd;
    --code-bg: #f3f1ec;
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
    --measure: 42rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #16181b;
        --surface: #1d2024;
        --text: #e6e3dd;
        --muted: #9a9ea5;
        --rule: #2e3237;
        --accent: #e08a5f;
        --accent-soft: #3a2a22;
        --code-bg: #23272c;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--serif);
    font-size: 1.125rem;
    line-height: 1.7;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.muted { color: var(--muted); }

/* ---------- Layout ---------- */
.site {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    padding: 2.5rem 0 1.25rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 2rem;
}

.site-title {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    color: var(--text);
    text-decoration: none;
}

.site-tagline {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-style: italic;
}

.site-nav {
    margin-top: 1rem;
    display: flex;
    gap: 1.25rem;
    font-family: var(--sans);
    font-size: 0.9rem;
}

.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a.active { color: var(--text); font-weight: 600; }

.site-main { flex: 1; }

.site-footer {
    border-top: 1px solid var(--rule);
    margin-top: 3rem;
    padding: 1.5rem 0 2.5rem;
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
}

/* ---------- Post list ---------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { padding-bottom: 1.75rem; margin-bottom: 1.75rem; border-bottom: 1px solid var(--rule); }
.post-list li:last-child { border-bottom: none; }
.post-list h2 { margin: 0; font-size: 1.5rem; line-height: 1.3; }
.post-list h2 a { color: var(--text); text-decoration: none; }
.post-list h2 a:hover { color: var(--accent); }
.post-summary { margin: 0.5rem 0 0; }

.page-heading { font-size: 1.6rem; margin-top: 0; }
.tag-name { color: var(--accent); }

/* ---------- Search ---------- */
.search { margin-bottom: 2rem; }

.search input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-family: var(--sans);
    font-size: 1rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 6px;
}

.search input::placeholder { color: var(--muted); }

.search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-status {
    margin: 0.5rem 0 0;
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
}

/* ---------- Meta / tags ---------- */
.post-meta {
    margin: 0.35rem 0 0;
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    align-items: center;
}

.tag { text-decoration: none; }

.draft-badge {
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    padding: 0 0.6rem;
    font-weight: 600;
    font-size: 0.75rem;
}

/* ---------- Post ---------- */
.post h1 { font-size: 2.1rem; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.post header { margin-bottom: 2rem; }

.post-body h2 { font-size: 1.45rem; margin: 2.25rem 0 0.5rem; line-height: 1.3; }
.post-body h3 { font-size: 1.2rem; margin: 1.75rem 0 0.5rem; }

.post-body img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1.5rem auto;
}

.post-body blockquote {
    margin: 1.5rem 0;
    padding: 0.25rem 1.25rem;
    border-left: 3px solid var(--accent);
    color: var(--muted);
}

.post-body code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: var(--code-bg);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

.post-body pre {
    background: var(--code-bg);
    padding: 1rem 1.25rem;
    border-radius: 6px;
    overflow-x: auto;
    line-height: 1.5;
}

.post-body pre code { background: none; padding: 0; font-size: 0.85rem; }

.post-body table {
    border-collapse: collapse;
    width: 100%;
    font-family: var(--sans);
    font-size: 0.95rem;
    margin: 1.5rem 0;
}

.post-body th, .post-body td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--rule); text-align: left; }
.post-body th { font-weight: 600; }

.back-link { margin-top: 2.5rem; font-family: var(--sans); font-size: 0.9rem; }

/* ---------- Audio clips ---------- */
.audio-clip {
    margin: 1.5rem 0;
    padding: 0.9rem 1rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-left: 4px solid var(--accent);
    border-radius: 6px;
}

.audio-clip figcaption {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.audio-clip audio { width: 100%; display: block; }

.audio-download {
    display: inline-block;
    margin-top: 0.35rem;
    font-family: var(--sans);
    font-size: 0.8rem;
    color: var(--muted);
}

/* ---------- Video embeds ---------- */
.video { margin: 1.75rem 0; }

.video-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.video figcaption {
    margin-top: 0.5rem;
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
}

/* ---------- Blazor plumbing (from the template) ---------- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #1f2328;
    font-family: var(--sans);
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after { content: "An error has occurred."; }

.loading-progress {
    position: absolute;
    display: block;
    width: 6rem;
    height: 6rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--rule);
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
    inset: calc(20vh + 2.4rem) 0 auto 0.2rem;
}

.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Loading"); }
