/*
 * Editorial system for the blog index and long-form posts.
 * Scoped to .editorial-page so the shared site stylesheet remains untouched.
 */

.editorial-page {
    --editorial-ink: #081827;
    --editorial-navy: #0d2638;
    --editorial-panel: #112d40;
    --editorial-cyan: #73d2d6;
    --editorial-cyan-soft: #b8e6e5;
    --editorial-copper: #c88452;
    --editorial-paper: #f3f0e8;
    --editorial-paper-bright: #faf8f2;
    --editorial-text: #162b38;
    --editorial-muted: #60717a;
    --editorial-line: rgba(32, 76, 91, 0.18);
    color: var(--editorial-text);
    background:
        linear-gradient(rgba(22, 64, 78, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 64, 78, 0.035) 1px, transparent 1px),
        var(--editorial-paper) !important;
    background-size: 32px 32px;
}

.editorial-page header {
    background: rgba(8, 24, 39, 0.96);
    border-bottom: 1px solid rgba(115, 210, 214, 0.24);
    box-shadow: 0 10px 35px rgba(2, 12, 20, 0.22);
}

.editorial-page .nav-container {
    max-width: 1160px;
}

.editorial-page .logo {
    color: var(--editorial-paper-bright);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-shadow: none;
}

.editorial-page .logo::after {
    content: " / OBSERVATORY";
    color: var(--editorial-cyan);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
}

.editorial-page nav a,
.editorial-page .theme-toggle {
    color: rgba(250, 248, 242, 0.78);
}

.editorial-page nav a:hover,
.editorial-page nav a.active,
.editorial-page .theme-toggle:hover {
    color: var(--editorial-cyan);
    background: rgba(115, 210, 214, 0.09);
}

.editorial-page nav a::after {
    background: var(--editorial-copper);
}

.editorial-page .menu-toggle {
    color: var(--editorial-paper-bright);
}

.editorial-page main {
    padding-top: 4.5rem;
}

.editorial-page .blog-hero {
    padding: clamp(5rem, 10vw, 8.5rem) 2rem clamp(3.5rem, 7vw, 5.5rem);
    text-align: left;
    border-bottom: 1px solid rgba(115, 210, 214, 0.18);
    background:
        radial-gradient(circle at 82% 18%, rgba(115, 210, 214, 0.14), transparent 24rem),
        linear-gradient(115deg, #081827 0%, #0c2738 62%, #15394b 100%);
}

.editorial-page .blog-hero::before {
    inset: 0;
    background:
        linear-gradient(rgba(115, 210, 214, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(115, 210, 214, 0.055) 1px, transparent 1px) !important;
    background-size: 40px 40px !important;
    -webkit-mask-image: linear-gradient(to right, black, transparent 82%);
    mask-image: linear-gradient(to right, black, transparent 82%);
}

.editorial-page .blog-hero-content {
    max-width: 1080px;
}

.editorial-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.2rem;
    color: var(--editorial-copper);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.16em;
}

.editorial-kicker::before {
    content: "";
    width: 2.5rem;
    height: 1px;
    background: currentColor;
}

.editorial-page .blog-hero h1 {
    max-width: 760px;
    margin-bottom: 1.25rem;
    color: var(--editorial-paper-bright);
    background: none;
    -webkit-text-fill-color: currentColor;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(2.8rem, 7vw, 5.2rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.045em;
}

.editorial-page .blog-hero p {
    max-width: 650px;
    color: rgba(232, 240, 237, 0.72);
    font-size: clamp(1rem, 2vw, 1.18rem);
    line-height: 1.8;
}

.editorial-page .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    max-width: 1080px;
    margin: clamp(3rem, 7vw, 6rem) auto;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--editorial-line);
    background: var(--editorial-line);
    box-shadow: 0 24px 60px rgba(8, 24, 39, 0.11);
}

.editorial-page .blog-card {
    min-height: 280px;
    padding: clamp(1.5rem, 4vw, 2.4rem);
    color: var(--editorial-text);
    background: rgba(250, 248, 242, 0.94);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    transition: background-color 180ms ease, color 180ms ease;
}

.editorial-page .blog-card:hover {
    transform: none;
    color: var(--editorial-paper-bright);
    background: var(--editorial-navy);
    border-color: transparent;
    box-shadow: none;
}

.editorial-page .blog-card-date {
    color: var(--editorial-muted);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
}

.editorial-page .blog-card-title {
    color: inherit;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(1.45rem, 3vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -0.025em;
}

.editorial-page .blog-card-summary {
    color: var(--editorial-muted);
    line-height: 1.85;
}

.editorial-page .blog-card:hover .blog-card-summary,
.editorial-page .blog-card:hover .blog-card-date {
    color: rgba(250, 248, 242, 0.65);
}

.editorial-page .blog-tag,
.editorial-page .keyword {
    padding: 0.28rem 0.68rem;
    color: #28606a;
    background: rgba(115, 210, 214, 0.13);
    border: 1px solid rgba(41, 107, 113, 0.18);
    border-radius: 2px;
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 0.7rem;
}

.editorial-page .blog-card:hover .blog-tag {
    color: var(--editorial-cyan-soft);
    border-color: rgba(115, 210, 214, 0.32);
    background: rgba(115, 210, 214, 0.08);
}

.editorial-page .blog-read-more {
    color: var(--editorial-copper);
    font-size: 0.86rem;
}

.editorial-page .blog-card:hover .blog-read-more {
    gap: 0.5rem;
}

.editorial-page > footer,
.editorial-page .site-footer {
    color: rgba(250, 248, 242, 0.72);
    background: var(--editorial-ink);
    border-top: 1px solid rgba(115, 210, 214, 0.18);
}

.editorial-page > footer a,
.editorial-page .site-footer a {
    color: var(--editorial-cyan-soft);
}

/* Long-form article: warm paper, restrained measure, strong hierarchy. */
.editorial-post .post-article {
    padding: clamp(3rem, 7vw, 6rem) 0;
}

.editorial-post .post-article .container {
    max-width: 820px;
}

.editorial-post .post-article .post-header {
    position: static;
    margin-bottom: 2.5rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--editorial-line);
}

.editorial-post .post-article .post-header h1 {
    color: var(--editorial-ink);
    font-family: "Noto Serif SC", serif;
    font-size: clamp(2.3rem, 6vw, 4.2rem);
    font-weight: 700;
    line-height: 1.22;
    letter-spacing: -0.04em;
}

.editorial-post .post-meta {
    color: var(--editorial-muted);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 0.78rem;
}

.editorial-post .post-body {
    padding: clamp(1.5rem, 5vw, 3.4rem);
    color: var(--editorial-text);
    background: rgba(250, 248, 242, 0.94);
    border: 1px solid var(--editorial-line);
    border-radius: 2px;
    box-shadow: 0 24px 60px rgba(8, 24, 39, 0.09);
}

.editorial-post .post-content {
    font-family: "Noto Serif SC", "LXGW WenKai", serif;
    font-size: clamp(1.02rem, 2vw, 1.1rem);
    line-height: 1.95;
    overflow-wrap: anywhere;
}

.editorial-post .post-content h2,
.editorial-post .post-content h3 {
    color: var(--editorial-ink);
    font-family: "Noto Serif SC", serif;
    line-height: 1.4;
}

.editorial-post .post-content h2 {
    margin-top: 3.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--editorial-line);
}

.editorial-post .post-content a {
    color: #1f6871;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

.editorial-post .post-content blockquote {
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    color: #354f59;
    background: rgba(115, 210, 214, 0.09);
    border-left: 3px solid var(--editorial-copper);
    font-style: normal;
}

.editorial-post .post-content pre {
    color: #e8f0ed;
    background: var(--editorial-ink);
    border: 1px solid rgba(115, 210, 214, 0.22);
    border-radius: 2px;
}

.editorial-post .post-content code {
    background: rgba(27, 71, 82, 0.1);
    border-radius: 2px;
}

.editorial-post .post-content pre code {
    color: inherit;
    background: transparent;
}

.editorial-post .table-of-contents {
    background: rgba(115, 210, 214, 0.08);
    border: 1px solid var(--editorial-line);
    border-radius: 2px;
}

.editorial-post .post-article .post-footer {
    border-top-color: var(--editorial-line);
}

.editorial-post .share-btn {
    color: var(--editorial-navy);
    background: transparent;
    border: 1px solid var(--editorial-line);
    border-radius: 2px;
}

.editorial-post .share-btn:hover {
    color: var(--editorial-paper-bright);
    background: var(--editorial-navy);
    transform: none;
}

.editorial-page :is(a, button):focus-visible {
    outline: 3px solid var(--editorial-copper);
    outline-offset: 4px;
}

.editorial-page ::selection {
    color: var(--editorial-ink);
    background: var(--editorial-cyan-soft);
}

html.dark .editorial-page {
    --editorial-text: #dce7e5;
    --editorial-muted: #9dafb2;
    --editorial-line: rgba(115, 210, 214, 0.18);
    background:
        linear-gradient(rgba(115, 210, 214, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(115, 210, 214, 0.035) 1px, transparent 1px),
        #071520 !important;
    background-size: 32px 32px;
}

html.dark .editorial-page .blog-card,
html.dark .editorial-post .post-body {
    background: rgba(13, 38, 56, 0.96);
}

html.dark .editorial-post .post-article .post-header h1,
html.dark .editorial-post .post-content h2,
html.dark .editorial-post .post-content h3 {
    color: var(--editorial-paper-bright);
}

@media (max-width: 768px) {
    .editorial-page nav {
        background: rgba(8, 24, 39, 0.99);
        border-bottom-color: rgba(115, 210, 214, 0.2);
    }

    .editorial-page .blog-grid {
        grid-template-columns: 1fr;
        margin: 2.5rem 1rem 4rem;
    }

    .editorial-page .blog-card {
        min-height: 0;
    }

    .editorial-post .post-article {
        padding: 2.5rem 0 4rem;
    }
}

@media (max-width: 420px) {
    .editorial-page .nav-container,
    .editorial-post .container {
        padding-inline: 1rem;
    }

    .editorial-page .logo {
        font-size: 1rem;
    }

    .editorial-page .logo::after {
        display: none;
    }

    .editorial-page .blog-hero {
        padding-inline: 1.1rem;
    }

    .editorial-page .blog-card-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 1rem;
    }

    .editorial-post .post-body {
        padding-inline: 1.15rem;
    }

    .editorial-post .post-article .post-header h1 {
        font-size: 2.1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .editorial-page *,
    .editorial-page *::before,
    .editorial-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
