/* ===================================================================
   bostedor.com — public theme.
   Dark, content-first, minimal chrome. Tuned for code-heavy posts.
   =================================================================== */

:root {
    --bg:           #0d1117;
    --bg-elev:      #161b22;
    --bg-elev-2:    #1c2129;
    --border:       #2a313a;
    --text:         #e6edf3;
    --text-muted:   #97a2af;
    --accent:       #6ea8ff;
    --accent-hover: #94c0ff;
    --code-bg:      #0a0f15;
    --code-text:    #d4dce5;
    --tag-bg:       #1a2231;
    --tag-text:     #9bbcff;
    --shadow:       0 1px 0 rgba(255,255,255,0.04), 0 8px 24px rgba(0,0,0,0.32);
    --max-width:    760px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}
/* Home page widens the container to fit the right-rail without squeezing
   the post body. Other pages keep --max-width for comfortable reading. */
.site-main-wide { max-width: calc(var(--max-width) + 240px + 56px); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Header ─────────────────────────────────────────────────────── */
.site-header {
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #11161d 0%, #0d1117 100%);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    line-height: 1.15;
    text-decoration: none;
}
.brand-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--bg-elev);
    flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; }
.brand-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.brand-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}
.brand:hover { text-decoration: none; }
.primary-nav a {
    margin-left: 18px;
    font-size: 14px;
    color: var(--text-muted);
}
.primary-nav a:hover { color: var(--text); text-decoration: none; }

/* ── Main ───────────────────────────────────────────────────────── */
.site-main { padding: 48px 24px 96px; }

.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.dot { color: var(--text-muted); margin: 0 6px; }

/* ── Post list ──────────────────────────────────────────────────── */
.post-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 40px; }
.post-card { display: flex; flex-direction: column; gap: 14px; }
.post-card.compact { gap: 8px; }
.post-card.compact h2 { font-size: 20px; margin: 0; }

/* ── Home feed (full posts) ─────────────────────────────────────── */
/* Home page widens beyond the global max-width to make room for the
   right-rail tag cloud. Single-column pages keep the comfortable
   reading width set by --max-width. */
.home-grid {
    display: grid;
    grid-template-columns: minmax(0, var(--max-width)) 240px;
    gap: 56px;
    max-width: calc(var(--max-width) + 240px + 56px);
    margin: 0 auto;
}
.post-feed {
    display: flex;
    flex-direction: column;
    gap: 56px;
    min-width: 0;
}
.post-feed-item {
    border-bottom: 1px solid var(--border);
    padding-bottom: 56px;
}
.post-feed-item:last-child { border-bottom: 0; padding-bottom: 0; }
.post-feed-item .post-header h1 {
    font-size: 32px;
    line-height: 1.2;
    letter-spacing: -0.018em;
    margin: 0 0 8px 0;
}
.post-feed-item .post-header h1 a { color: var(--text); }
.post-feed-item .post-header h1 a:hover { color: var(--accent); text-decoration: none; }
.post-feed-item .post-hero-large { display: block; margin-bottom: 24px; }
.post-feed-item .post-footer {
    margin-top: 32px;
    font-size: 14px;
}
.post-feed-item .post-permalink { color: var(--accent); }
.pager-row {
    display: flex;
    justify-content: space-between;
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 14px;
}

/* ── Home right-rail ────────────────────────────────────────────── */
.home-rail {
    align-self: start;
    position: sticky;
    top: 24px;
}
.rail-section + .rail-section { margin-top: 32px; }
.rail-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.tag-cloud {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tag-cloud li { margin: 0; }
.tag-large {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 13px;
    border-radius: 999px;
    background: var(--tag-bg);
    color: var(--tag-text);
    text-decoration: none;
    line-height: 1.4;
}
.tag-large:hover { background: #243049; text-decoration: none; }
.tag-large .tag-count {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 11px;
    padding: 0 6px;
    border-radius: 999px;
    line-height: 1.6;
}

.post-hero {
    display: block;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.post-hero img { width: 100%; height: auto; display: block; }

.post-summary h2 {
    font-size: 28px;
    line-height: 1.25;
    margin: 0;
    letter-spacing: -0.015em;
}
.post-summary h2 a { color: var(--text); }
.post-summary h2 a:hover { color: var(--accent); text-decoration: none; }

.post-meta {
    color: var(--text-muted);
    font-size: 13px;
    margin: 6px 0 0 0;
}
.post-meta time { font-variant-numeric: tabular-nums; }

.post-excerpt { margin: 8px 0 0 0; color: var(--text-muted); }
.read-more { display: inline-block; margin-top: 8px; font-size: 14px; }

.tag {
    display: inline-block;
    padding: 1px 8px;
    margin: 0 4px 0 0;
    font-size: 12px;
    background: var(--tag-bg);
    color: var(--tag-text);
    border-radius: 999px;
    text-decoration: none;
}
.tag:hover { background: #243049; text-decoration: none; }

.pager { margin-top: 56px; font-size: 14px; }
.pager a { color: var(--accent); }

/* ── Single post ────────────────────────────────────────────────── */
.post-hero-large {
    margin: 0 0 32px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.post-hero-large img { width: 100%; height: auto; display: block; }

.post-header h1 {
    font-size: 38px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0 0 8px 0;
}
.post-header .post-meta { font-size: 14px; }
.post-audio {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 0 0;
    padding: 8px 12px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 480px;
}
.post-audio-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.post-audio audio {
    flex: 1;
    height: 32px;
}
.post-audio audio::-webkit-media-controls-panel {
    background-color: var(--bg-elev-2);
}

.post-body { font-size: 17.5px; line-height: 1.75; margin-top: 32px; }
.post-body h2 { font-size: 24px; margin-top: 40px; letter-spacing: -0.01em; }
.post-body h3 { font-size: 19px; margin-top: 32px; letter-spacing: -0.005em; }
.post-body p { margin: 18px 0; }
.post-body ul, .post-body ol { padding-left: 1.4em; }
.post-body li { margin: 6px 0; }
.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin: 12px 0;
}
.post-body figure { margin: 24px 0; }
.post-body figcaption { font-size: 13px; color: var(--text-muted); margin-top: 6px; text-align: center; }
.post-body blockquote {
    border-left: 3px solid var(--accent);
    margin: 18px 0;
    padding: 6px 18px;
    color: var(--text-muted);
    background: var(--bg-elev);
    border-radius: 0 6px 6px 0;
}
.post-body code {
    font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
    font-size: 14.5px;
    background: var(--code-bg);
    color: var(--code-text);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.post-body pre {
    background: var(--code-bg);
    color: var(--code-text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 18px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.55;
}
.post-body pre code {
    background: transparent;
    border: 0;
    padding: 0;
    font-size: inherit;
}
.post-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    margin: 18px 0;
}
.post-body th, .post-body td {
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
}
.post-body th { color: var(--text-muted); font-weight: 600; }
.post-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

/* ── Share bar ─────────────────────────────────────────────────── */
.share-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 40px 0 8px 0;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.share-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-right: 6px;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.share-btn:hover {
    background: var(--bg-elev-2);
    border-color: var(--accent);
    color: var(--accent-hover);
    text-decoration: none;
}
.share-btn svg { flex-shrink: 0; opacity: 0.85; }
.share-btn:hover svg { opacity: 1; }
/* Subtle brand tinting on hover, dark-mode friendly. */
.share-x:hover      { color: #e7e9ea; }
.share-fb:hover     { color: #4f8aff; }
.share-li:hover     { color: #4ea4ff; }
.share-email:hover  { color: var(--accent-hover); }
.share-copy.copied {
    color: #b6f0c8;
    border-color: #2d6a40;
    background: #1d3a26;
}

/* ── Comments ───────────────────────────────────────────────────── */
.comments {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}
.comments h2 { font-size: 22px; margin: 0 0 16px 0; }
.comment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 20px; }
.comment {
    border: 1px solid var(--border);
    background: var(--bg-elev);
    border-radius: 8px;
    padding: 14px 16px;
}
.comment-meta { margin: 0 0 8px 0; font-size: 13px; color: var(--text-muted); display: flex; gap: 10px; align-items: baseline; }
.comment-meta strong { color: var(--text); }
.comment-body p:first-child { margin-top: 0; }
.comment-body p:last-child { margin-bottom: 0; }

.comment-form {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
}
.comment-form label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: var(--text-muted);
    gap: 6px;
}
.comment-form input,
.comment-form textarea {
    background: var(--bg-elev-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 15px;
    resize: vertical;
}
.comment-form input:focus,
.comment-form textarea:focus {
    border-color: var(--accent);
    outline: none;
}
.comment-form button {
    align-self: flex-start;
    background: var(--accent);
    color: #0d1117;
    border: 0;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.comment-form button:hover { background: var(--accent-hover); }
.honeypot {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important; height: 1px !important; overflow: hidden;
}
.comment-thanks {
    margin: 12px 0;
    padding: 10px 14px;
    background: #1d3a26;
    border: 1px solid #2d6a40;
    border-radius: 6px;
    color: #c4f0d3;
}

/* ── Tag and archive ────────────────────────────────────────────── */
.tag-name { color: var(--accent); }
.archive-year { margin-bottom: 36px; }
.archive-year h2 { font-size: 22px; color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.archive-list { list-style: none; padding: 0; margin: 12px 0 0 0; }
.archive-list li { display: flex; gap: 14px; padding: 6px 0; }
.archive-list time { color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 56px; }

/* ── Footer ─────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--text-muted); font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; }

/* ── Admin chrome (light overrides only — admin uses its own tree) ── */
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }

/* Tablet/phone: stack the home rail under the feed. The container's
   max-width still keeps the post body comfortably narrow. */
@media (max-width: 960px) {
    .home-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 40px;
        max-width: var(--max-width);
    }
    .home-rail { position: static; }
    .site-main-wide { max-width: var(--max-width); }
    /* On stacked mobile layout, present the tag cloud as a horizontal
       scrollable strip under the feed instead of a tall column. */
    .home-rail .rail-section { margin-top: 16px; }
}

/* Phones (~iPhone 12/13/14): tighten paddings, drop heading sizes a touch,
   reflow the header so brand and nav stack cleanly. */
@media (max-width: 600px) {
    :root { --max-width: 100%; }
    .container { padding: 0 16px; }
    .site-main { padding: 28px 16px 64px; }

    .header-inner {
        padding: 14px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .primary-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
    .primary-nav a { margin-left: 0; }

    .brand-avatar { width: 40px; height: 40px; }
    .brand-title { font-size: 19px; }
    .brand-subtitle { font-size: 12px; }

    .post-header h1 { font-size: 26px; line-height: 1.2; }
    .post-feed-item .post-header h1 { font-size: 24px; }
    .post-summary h2 { font-size: 22px; }
    .post-body { font-size: 16.5px; line-height: 1.65; }
    .post-body h2 { font-size: 21px; margin-top: 32px; }
    .post-body h3 { font-size: 18px; margin-top: 26px; }
    .post-body pre { font-size: 13px; padding: 12px 14px; border-radius: 6px; }
    .post-body table { display: block; overflow-x: auto; }

    /* Pad-style separator between feed items uses less vertical space. */
    .post-feed { gap: 40px; }
    .post-feed-item { padding-bottom: 40px; }

    /* Audio player + share bar both wrap nicely on a phone. */
    .post-audio { padding: 6px 10px; gap: 8px; }
    .post-audio audio { height: 30px; }
    .share-bar { padding: 12px 0; gap: 6px; }
    .share-btn { padding: 5px 10px; font-size: 12.5px; }
    .share-btn span { display: none; }
    .share-btn svg { margin: 0; }
    /* Keep the Copy-link label visible since its icon alone is unclear. */
    .share-copy span.share-copy-label { display: inline; }
    .share-label { display: none; }

    /* Comments form gets a touch friendlier. */
    .comment-form { padding: 14px; }
    .comment-form button { width: 100%; }

    /* Pager links readable as full-width tap targets. */
    .pager-row { gap: 12px; flex-wrap: wrap; }
    .pager-row a { flex: 1; text-align: center; padding: 10px 12px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; }
    .pager-row a:hover { text-decoration: none; background: var(--bg-elev-2); }
}
