:root {
    --bg: #0d1117;
    --bg-top: #172033;
    --panel: rgba(22, 27, 34, 0.92);
    --panel-soft: rgba(31, 39, 50, 0.88);
    --text: #e6edf3;
    --muted: #94a3b8;
    --accent: #7dd3fc;
    --accent-strong: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.12);
    --border: rgba(148, 163, 184, 0.18);
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
    --success: #22c55e;
    --danger: #f87171;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: radial-gradient(circle at top, var(--bg-top) 0%, var(--bg) 55%);
    font-family: Inter, "Segoe UI", sans-serif;
}

a {
    color: var(--accent);
    text-decoration: none;
}

img,
iframe,
video {
    max-width: 100%;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 20px 0 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    padding: 10px 0 18px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(14px);
    background: linear-gradient(180deg, rgba(13, 17, 23, 0.96), rgba(13, 17, 23, 0.74));
}

.brand-link {
    color: var(--text);
    font-weight: 800;
    letter-spacing: 0.08em;
}

.topbar-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel-soft);
    color: var(--text);
    padding: 10px;
}

.topbar-menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    margin: 5px 0;
    background: currentColor;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.main-nav a {
    color: var(--text);
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.main-nav a.is-active {
    color: var(--accent);
}

.hero-card,
.panel-card,
.post-card,
.author-card,
.empty-state,
.flash,
.micro-banner {
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.hero-card,
.panel-card,
.empty-state,
.flash,
.micro-banner {
    padding: 24px;
}

.micro-banner {
    margin-bottom: 18px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(13, 17, 23, 0.86));
}

.hero-blog {
    overflow: hidden;
    margin-bottom: 28px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 24px;
    align-items: center;
}

.hero-meta,
.stats-grid,
.post-grid,
.author-grid,
.pill-grid,
.detail-grid {
    display: grid;
    gap: 16px;
}

.hero-meta {
    grid-template-columns: 1fr;
}

.stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 24px;
}

.stat-chip {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(125, 211, 252, 0.12);
    background: rgba(12, 19, 31, 0.72);
}

.stat-chip strong,
.stats-grid strong {
    display: block;
    font-size: 2rem;
    margin-bottom: 4px;
}

.section-block {
    margin-bottom: 28px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.post-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.post-card {
    overflow: hidden;
}

.card-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(15, 23, 42, 0.9));
}

.card-cover-fallback {
    border-bottom: 1px solid var(--border);
}

.post-card-body {
    padding: 18px;
}

.post-card-meta,
.post-card-footer,
.article-meta,
.hero-actions,
.insert-toolbar,
.footer-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.post-card-meta,
.article-meta,
.support-copy,
.post-origin,
.credential-copy {
    color: var(--muted);
    font-size: 0.92rem;
}

.post-card h3,
.author-card h3,
.article-header h1,
.hero-card h1,
.panel-card h1,
.panel-card h2 {
    margin-top: 0;
}

.author-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.author-card {
    padding: 18px;
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 14px;
}

.author-card img,
.author-avatar-lg,
.author-inline img {
    object-fit: cover;
    border-radius: 18px;
}

.author-card img {
    width: 84px;
    height: 84px;
}

.author-avatar-lg {
    width: 160px;
    height: 160px;
}

.author-hero {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 24px;
    align-items: center;
    margin-bottom: 24px;
}

.pill-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pill-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    color: var(--text);
}

.pill-link span {
    color: var(--accent);
}

.auth-shell {
    width: min(520px, 100%);
    margin: 0 auto;
}

.eyebrow {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    margin-bottom: 12px;
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
}

.btn,
.form-control,
.form-select {
    border-radius: 14px;
    border: 1px solid var(--border);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    font-weight: 700;
    background: rgba(31, 39, 50, 0.7);
    color: var(--text);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-strong), #22d3ee);
    color: #041521;
    border-color: transparent;
}

.btn-secondary {
    background: rgba(56, 189, 248, 0.08);
}

.btn-ghost {
    background: transparent;
}

.btn-danger {
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
}

.stacked-form {
    display: grid;
    gap: 14px;
}

.stacked-form label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

.form-control,
.form-select {
    width: 100%;
    padding: 12px 14px;
    color: var(--text);
    background: rgba(13, 17, 23, 0.9);
}

.form-control::placeholder {
    color: #64748b;
}

.code-area {
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.5;
}

.detail-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid.three-col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.search-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.flash {
    margin-bottom: 18px;
}

.flash-success {
    border-color: rgba(34, 197, 94, 0.26);
}

.flash-error {
    border-color: rgba(248, 113, 113, 0.3);
}

.table-shell {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.table-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.article-shell {
    display: grid;
    gap: 20px;
}

.article-header,
.article-footer {
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 22px;
    padding: 24px;
}

.article-subtitle {
    font-size: 1.12rem;
    color: var(--muted);
}

.article-cover {
    width: 100%;
    border-radius: 20px;
    margin-top: 16px;
}

.article-body {
    border: 1px solid var(--border);
    background: rgba(8, 12, 19, 0.72);
    border-radius: 22px;
    padding: clamp(20px, 4vw, 44px);
}

.prose {
    line-height: 1.72;
    font-size: 1.03rem;
}

.prose h2,
.prose h3 {
    margin-top: 1.8em;
}

.prose blockquote {
    margin: 1.4em 0;
    padding: 12px 18px;
    border-left: 4px solid var(--accent);
    background: rgba(56, 189, 248, 0.08);
}

.prose figure {
    margin: 1.6em 0;
}

.prose figcaption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.92rem;
}

.prose code {
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.92);
}

.video-embed {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
}

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

.author-inline {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 14px;
    align-items: center;
}

.author-inline img {
    width: 72px;
    height: 72px;
}

.footer-block {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

@media (max-width: 980px) {
    .hero-grid,
    .author-hero,
    .post-grid,
    .author-grid,
    .pill-grid,
    .detail-grid.two-col,
    .detail-grid.three-col,
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .shell {
        width: min(100% - 24px, 100%);
    }

    .topbar {
        align-items: flex-start;
    }

    .topbar-menu-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
    }

    .main-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        padding-top: 12px;
    }

    .main-nav.is-open {
        display: flex;
    }

    .search-form {
        grid-template-columns: 1fr;
    }
}
