/* Polis Base Layout — shared structural CSS for all themes.
   Themes provide colors, fonts, and avatar styling via their own CSS file. */

/* Reset & layout */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; padding: 0; }
.content-col { max-width: 640px; margin: 0 auto; padding: 0 24px; }

/* Site header */
.site-header { padding: 32px 0 0; position: relative; }
.site-identity { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.site-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 500;
    overflow: hidden; flex-shrink: 0;
}
.site-avatar .avatar-initial { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%; }
.site-avatar .avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.site-follow { position: absolute; right: -120px; top: 40px; }
@media (max-width: 900px) { .site-follow { position: static; margin-left: auto; } }
.site-avatar-link, .site-identity-text { text-decoration: none; color: inherit; }
.site-name { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
/* Collapse the .site-name row when the render context suppresses
   author_name (page.go / stream.go set it to "" when it equals the
   domain). An empty <div class="site-name"> would otherwise still
   reserve a 22px line-box and leave a visible blank line above the
   handle. */
.site-name:empty { display: none; }
.site-handle { font-size: 13px; }
.site-bio { font-size: 15px; line-height: 1.55; margin-bottom: 20px; padding-left: 62px; }
.site-stats {
    display: flex; gap: 20px; font-size: 12px;
    padding-left: 62px; padding-bottom: 20px;
    border-bottom: 1px solid; margin-bottom: 8px;
}
.site-stats strong { font-weight: 600; }

/* Post list */
.post-list { }
.site-post {
    display: block; padding: 18px 0;
    text-decoration: none;
    transition: background 0.15s;
    border-radius: 8px;
}
.sp-date { font-size: 12px; margin-bottom: 4px; }
.sp-title { font-size: 18px; font-weight: 500; line-height: 1.3; margin-bottom: 4px; }
.sp-excerpt { font-size: 14.5px; line-height: 1.55; }
.sp-comments {
    font-size: 12px; font-weight: 400; opacity: 0.5;
    margin-top: 6px; display: flex; align-items: center; gap: 5px;
    color: inherit;
}
.sp-comments::before {
    content: "";
    display: inline-block; width: 14px; height: 14px; flex-shrink: 0;
    background: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 2C1.9 2 1 2.9 1 4v12c0 1.1.9 2 2 2h12l4 4V4c0-1.1-.9-2-2-2H3zm0 2h14v13.2L15.2 16H3V4z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 2C1.9 2 1 2.9 1 4v12c0 1.1.9 2 2 2h12l4 4V4c0-1.1-.9-2-2-2H3zm0 2h14v13.2L15.2 16H3V4z'/%3E%3C/svg%3E");
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}

/* View all posts link */
.view-all {
    display: block; text-align: center;
    padding: 16px; margin-top: 8px;
    font-size: 13px; text-decoration: none;
}

/* Footer */
.site-footer {
    padding: 40px 24px; text-align: center; font-size: 12px;
}
.footer-logo { text-decoration: none; }
.footer-tagline { display: block; margin-top: 4px; font-size: 11px; }

/* Navigation (post/comment pages) */
.site-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
    max-width: 640px; margin: 0 auto;
}
.nav-home { text-decoration: none; font-size: 14px; }

/* Post content (post/comment pages — inside content-col, no container needed) */
.post-content { padding: 0; }
.post-header { margin-bottom: 24px; }
.post-date { font-size: 13px; margin-bottom: 4px; }
.post-meta { font-size: 12px; }
.content-body { font-size: 16px; line-height: 1.7; }
.content-body h1 { font-size: 28px; font-weight: 600; line-height: 1.2; margin: 32px 0 16px; }
.content-body h2 { font-size: 22px; font-weight: 600; line-height: 1.3; margin: 28px 0 12px; }
.content-body h3 { font-size: 18px; font-weight: 600; line-height: 1.4; margin: 24px 0 8px; }
.content-body p { margin: 0 0 16px; }
.content-body blockquote { margin: 16px 0; padding-left: 16px; border-left: 3px solid; }
.content-body pre { padding: 16px; border-radius: 8px; overflow-x: auto; font-size: 14px; }
.content-body code { font-size: 14px; padding: 2px 6px; border-radius: 4px; }
.content-body img { max-width: 100%; height: auto; border-radius: 8px; }

/* Comments section */
.comments { padding: 24px 0; }
.comments-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.comment { padding: 16px 0; }
.comment-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.comment-author { font-weight: 500; font-size: 14px; text-decoration: none; }
.comment-date { font-size: 12px; }
.comment-body { font-size: 15px; line-height: 1.6; }

/* Reply context (comment pages) */
.reply-context { padding: 16px 0; }
.context-box { padding: 16px; border-radius: 8px; }
.context-label { font-size: 12px; font-weight: 500; margin-bottom: 8px; display: block; }
.context-link { font-size: 15px; font-weight: 500; text-decoration: none; }
.context-domain { font-size: 12px; display: block; margin-top: 2px; }
.context-excerpt { font-size: 14px; margin-top: 8px; line-height: 1.5; }
.context-readmore { font-size: 13px; text-decoration: none; display: inline-block; margin-top: 8px; color: inherit; }
.context-readmore:hover { text-decoration: underline; }

/* Also reading */
.also-reading-item { text-decoration: none; font-size: 14px; }
.also-reading-item + .also-reading-item::before { content: " · "; }

/* Hero (comment pages) */
.hero { padding: 24px 24px; text-align: center; max-width: 640px; margin: 0 auto; }
.hero-title { font-size: 24px; font-weight: 500; margin: 0; }
.hero-subtitle { font-size: 14px; margin: 8px 0 0; }

/* =====================================================================
   Extracted from per-theme CSS (step-02/2.a.2b) — byte-identical across
   all 7 extraction-pool themes (especial, especial-light, sols, studio13,
   turbo, vice, zane). These rules live here so the per-theme files stay
   focused on palette + palette-keyed overrides. Per-theme CSS still loads
   AFTER this file, so any per-theme-specific palette overrides continue
   to cascade correctly.

   Note: some selectors below may also appear earlier in this file as
   legacy _shared declarations — deduplication is a separate follow-up
   hygiene pass (kept out of scope here to minimize behavior-change risk
   during extraction).
   ===================================================================== */

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

body {
    margin: 0;
    font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', monospace);
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--color-text-soft);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Global container centering */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    padding: 2rem 1.5rem;
    text-align: center;
    border-top: 1px solid var(--color-border);
    margin-top: 1rem;
}

.footer-logo {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-family: var(--font-content, 'Newsreader', Georgia, serif);
    font-style: italic;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-logo:hover {
    color: var(--color-text-soft);
}

.footer-tagline {
    font-family: var(--font-content, 'Newsreader', Georgia, serif);
    font-style: italic;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--color-text-muted);
    margin-top: 0.3rem;
}

.theme-switcher {
    margin: 0 0 1.5rem;
    padding: 0;
    text-align: left;
    font-size: 0.75rem;
}

.theme-sep {
    color: var(--color-text-muted);
    margin: 0 0.25rem;
}

.theme-link {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

/* ============================================
   NAVIGATION - Post page breadcrumb
   ============================================ */

.site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Post header with date and signature */
.post-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 1.5rem 0 0;
    margin-bottom: 0.25rem;
}

.post-header .post-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.post-header .post-meta {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.post-meta .meta-label {
    color: var(--color-text-muted);
}

.post-meta .meta-sep {
    margin: 0 0.5rem;
    color: var(--color-text-muted);
}

/* ============================================
   HERO - Tight, clean
   ============================================ */

.hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 2.5rem 0 1.5rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.hero-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* ============================================
   ABOUT
   ============================================ */

.about {
    padding: 0 1.5rem 1.5rem;
}

.about .container {
    max-width: var(--max-width);
}

.site-bio a:hover {
    text-decoration: underline;
}

/* ============================================
   RECENT POSTS
   ============================================ */

.recent-posts {
    padding: 1.5rem;
}

.recent-posts .container {
    max-width: var(--max-width);
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.post-item {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.5rem 0;
    text-decoration: none;
    border-bottom: 1px solid var(--color-border);
    transition: border-color 0.15s;
}

.post-item:last-child {
    border-bottom: none;
}

.post-title {
    font-size: 0.95rem;
    color: var(--color-text-soft);
    transition: color 0.15s;
}

.post-comments {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: normal;
}

/* ============================================
   RECENT COMMENTS
   ============================================ */

.recent-comments {
    padding: 0 1.5rem 1.5rem;
}

.recent-comments .container {
    max-width: var(--max-width);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comment-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0;
    text-decoration: none;
    border-bottom: 1px solid var(--color-border);
    transition: border-color 0.15s;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-meta {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.comment-item .comment-date {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.comment-preview {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comment-item:hover .comment-preview {
    color: var(--color-text-soft);
}

/* Also Reading */
.also-reading {
    margin-top: 2.5rem;
}

.also-reading-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

.also-reading-item {
    color: var(--color-teal);
    text-decoration: none;
    font-size: 0.95rem;
}

.also-reading-item:hover {
    color: var(--color-teal-soft);
    text-decoration: underline;
}

/* ============================================
   LINKS
   ============================================ */

.links {
    padding: 0.5rem 1.5rem 2rem;
}

.links .container {
    max-width: var(--max-width);
}

.link-item {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    text-decoration: none;
    transition: background 0.15s ease;
}

.link-item:hover {
    background: var(--color-panel);
}

.link-icon {
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: color 0.15s;
}

.link-label {
    font-size: 0.85rem;
    color: var(--color-text-soft);
    transition: color 0.15s;
    position: relative;
    top: 2px;
}

.link-sep {
    color: var(--color-text-muted);
    font-size: 1.25rem;
    font-weight: 300;
    opacity: 0.5;
    user-select: none;
}

/* ============================================
   COMMENTS
   ============================================ */

.comments {
    padding: 1.5rem 0 1rem;
}

.comments-header {
    margin-bottom: 1rem;
}

.comments-title {
    display: inline;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 1rem 0 0;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.comment-author:hover {
    text-decoration: underline;
}

.comment-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.comment-body {
    font-size: 0.9rem;
    color: var(--color-text-soft);
    line-height: 1.6;
}

.comment-body a:hover {
    text-decoration: underline;
}

/* ============================================
   POST CONTENT
   ============================================ */

.post-content {
    padding: 0 0 1.5rem;
}

.content-body {
    padding: 0;
    font-family: var(--font-content, 'Newsreader', Georgia, serif);
    color: var(--color-text-soft);
}

.content-body p {
    margin: 0 0 1rem 0;
}

.content-body p:last-child {
    margin-bottom: 0;
}

.content-body h1:first-child,
.content-body h2:first-child,
.content-body h3:first-child {
    margin-top: 0;
}

.content-body a:hover {
    text-decoration: underline;
}

.content-body code {
    background: var(--color-panel);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-size: 0.9em;
}

.content-body pre {
    background: var(--color-panel);
    padding: 1rem;
    overflow-x: auto;
    border-radius: 4px;
}

.content-body pre code {
    background: none;
    padding: 0;
}

.content-body ul,
.content-body ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.content-body li {
    margin-bottom: 0.5rem;
}

/* ============================================
   COMMENT CTA (inline in comments header)
   ============================================ */

.cta-inline {
    display: inline;
}

.cta-inline summary.cta-link::-webkit-details-marker {
    display: none;
}

.cta-inline summary.cta-link:hover {
    text-decoration: underline;
}

.cta-inline[open] .cta-content {
    display: block;
    margin-top: 1rem;
    padding: 0;
}

.cta-text {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.cta-code {
    margin-bottom: 0.75rem;
}

.cta-code code {
    color: var(--color-text-soft);
}

.cta-code .code-comment {
    color: var(--color-text-muted);
}

.cta-link:hover {
    text-decoration: underline;
}

/* Post Footer Navigation */
.post-footer-nav:not(:has(.post-item)) {
    display: none;
}

.post-footer-nav {
    padding: 2.5rem 0 1.5rem;
    border-top: 1px solid var(--color-border);
}

.post-footer-nav .post-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ============================================
   REPLY CONTEXT
   ============================================ */

.reply-context {
    padding: 0 0 1rem;
}

.context-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.context-label {
    display: block;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.context-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.context-domain {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.context-excerpt {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0.2rem 0 0;
}

.context-excerpt:empty {
    display: none;
}

/* ============================================
   POST META (Footer)
   ============================================ */

.post-meta {
    margin-bottom: 1.5rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.meta-label {
    color: var(--color-text-muted);
}

.meta-value {
    color: var(--color-text-soft);
}

.meta-sep {
    margin: 0 0.5rem;
    opacity: 0.5;
}

/* ============================================
   VIEW ALL LINK
   ============================================ */

.view-all {
    display: block;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
    body {
        font-size: 0.93rem;
    }

    .hero-title {
        font-size: 1.35rem;
    }

    .section-title {
        font-size: 0.8rem;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .hero-title {
        font-size: 1.25rem;
    }

    .links-box {
        flex-direction: column;
    }

    .link-sep {
        display: none;
    }

    .link-item:not(:last-child) {
        border-bottom: 1px solid var(--color-border);
    }

    .footer-logo {
        font-size: 1.4rem;
    }

    .footer-tagline {
        font-size: 0.7rem;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .hero,
    .about,
    .recent-posts,
    .recent-comments,
    .links,
    .comments,
    .post-content,
    .reply-context {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .site-nav {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}
