body.content-page {
    background: radial-gradient(circle at 10% 0%, #f3f9ff 0%, var(--bg) 52%);
}

.page-content {
    padding: clamp(24px, 4vw, 44px) 0 clamp(54px, 7vw, 82px);
}

.content-shell {
    max-width: 920px;
    color: var(--ink);
    line-height: 1.72;
}

/* Default layout pages (manual and manual chapters) render markdown directly,
   so the shell itself becomes the reading surface. */
.layout-default .content-shell {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: clamp(18px, 3.1vw, 36px);
}

/* Manual/default markdown pages can have long SEO-focused H1 titles.
   Keep them prominent without overpowering surrounding body copy. */
.layout-default .content-shell > h1 {
    font-size: clamp(2rem, 3.7vw, 3.1rem);
    line-height: 1.14;
    margin-bottom: 0.95rem;
}

/* Page/post layouts already wrap content in .home/.post cards. */
.layout-page .content-shell,
.layout-post .content-shell {
    max-width: 980px;
}

.post,
.home {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: clamp(18px, 3.1vw, 36px);
}

.post-header {
    margin-bottom: 14px;
}

.post-title {
    margin-bottom: 8px;
}

.post-meta {
    color: var(--ink-soft);
    font-size: 0.94rem;
}

.post-content,
.home {
    color: inherit;
    line-height: inherit;
}

.content-shell p,
.post-content p,
.home p {
    margin: 0 0 1rem;
}

.content-shell h2,
.post-content h2,
.home h2 {
    font-size: clamp(1.5rem, 2.8vw, 2.2rem);
    margin-top: 1.7rem;
    margin-bottom: 0.65rem;
}

.content-shell h3,
.post-content h3,
.home h3 {
    margin-top: 1.25rem;
}

.content-shell ul,
.content-shell ol,
.post-content ul,
.post-content ol,
.home ul,
.home ol {
    padding-left: 1.35rem;
}

.content-shell li,
.post-content li,
.home li {
    margin: 0.32rem 0;
}

.content-shell blockquote,
.post-content blockquote,
.home blockquote {
    margin: 1.2rem 0;
    padding: 0.8rem 1rem;
    border-left: 4px solid var(--accent);
    background: var(--surface-alt);
    border-radius: 0 10px 10px 0;
}

.content-shell hr,
.post-content hr,
.home hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1.4rem 0;
}

.content-shell code,
.post-content code,
.home code {
    background: rgba(10, 78, 163, 0.08);
    border: 1px solid rgba(10, 78, 163, 0.14);
    border-radius: 6px;
    padding: 0.08rem 0.35rem;
    font-size: 0.92em;
}

.content-shell pre,
.post-content pre,
.home pre {
    background: #111725;
    color: #ecf2ff;
    border-radius: 10px;
    padding: 12px;
    overflow: auto;
}

.content-shell pre code,
.post-content pre code,
.home pre code {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
}

.content-shell table,
.post-content table,
.home table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.content-shell img,
.post-content img,
.home img {
    max-width: 100%;
    height: auto;
}

/* Inline toolbar icons in manual text should track text size, not full image dimensions. */
.content-shell img.manual-inline-icon,
.post-content img.manual-inline-icon,
.home img.manual-inline-icon {
    height: 1.15em;
    width: auto;
    max-height: 1.15em;
    display: inline-block;
    vertical-align: -0.2em;
    margin: 0 0.12em;
}

.responsive-video {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: 12px;
    overflow: hidden;
    margin: 1rem 0;
}

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

.videoContainer {
    margin: 1rem 0;
}

.videoContainer video {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    background: #000;
}

.content-shell th,
.content-shell td,
.post-content th,
.post-content td,
.home th,
.home td {
    border: 1px solid var(--line);
    padding: 0.5rem 0.6rem;
    text-align: left;
    vertical-align: top;
}

.post-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: grid;
    gap: 16px;
}

.post-list li {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--surface-alt);
}

.post-link {
    color: var(--brand-strong);
}

.rss-subscribe {
    margin-top: 18px;
    color: var(--ink-soft);
}

.post-footer {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.content-hero {
    margin-bottom: 1.4rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.content-hero h1 {
    margin: 0;
    font-size: clamp(2.2rem, 4.8vw, 4rem);
}

.content-hero p {
    margin: 0.5rem 0 0;
    color: var(--ink-soft);
}

.page-nav {
    margin: 0 0 1.05rem;
    font-size: 0.96rem;
    color: var(--ink-soft);
    line-height: 1.45;
}

.page-nav-bottom {
    margin: 2rem 0 0;
    padding-top: 0.95rem;
    border-top: 1px solid var(--line);
}

.page-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.6rem;
    align-items: center;
}

.page-nav-links a {
    color: var(--brand);
    font-weight: 500;
}

.page-nav-links a:hover {
    color: var(--brand-strong);
}

.page-nav-links a + a::before {
    content: "|";
    color: var(--ink-soft);
    margin-right: 0.6rem;
}

.post-list-flat {
    gap: 0;
}

.post-list-flat li {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 1rem 0.4rem 1.05rem;
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.post-list-flat li:first-child {
    padding-top: 0.8rem;
}

.post-list-flat li:last-child {
    border-bottom: 0;
    padding-bottom: 0.25rem;
}

.post-list-flat li:hover,
.post-list-flat li:focus-within {
    background: rgba(10, 78, 163, 0.045);
    border-bottom-color: transparent;
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px var(--line);
}

.post-list-flat .post-meta {
    display: inline-block;
    margin-bottom: 0.1rem;
    font-size: 0.96rem;
}

.post-list-flat h2 {
    margin: 0.3rem 0 0.5rem;
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    line-height: 1.18;
}

.post-list-flat .post-excerpt {
    margin: 0;
}

.read-more-link {
    display: inline-flex;
    align-items: baseline;
    gap: 0.16rem;
    margin-left: 0.15rem;
    font-weight: 700;
    white-space: nowrap;
}

.read-more-link::after {
    content: "\203A";
}

.notfound {
    padding: clamp(16px, 3vw, 24px) 0 clamp(16px, 3vw, 30px);
}

.notfound-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: clamp(18px, 3.4vw, 32px);
    align-items: center;
    padding: clamp(8px, 1.5vw, 14px);
}

.notfound-icon {
    width: clamp(118px, 18vw, 180px);
    height: auto;
    border-radius: 26%;
    box-shadow: 0 12px 26px rgba(10, 78, 163, 0.18);
}

.notfound-code {
    margin: 0 0 0.2rem;
    color: var(--brand);
    font-weight: 800;
    letter-spacing: 0.06em;
    font-size: 0.95rem;
    text-transform: uppercase;
}

.notfound-copy h1 {
    margin: 0 0 0.6rem;
    font-size: clamp(2rem, 3.7vw, 3rem);
}

.notfound-copy p {
    margin: 0 0 0.55rem;
    color: var(--ink-soft);
    max-width: 52ch;
}

.notfound-sub {
    font-weight: 600;
}

.notfound .hero-cta {
    margin-top: 14px;
}

@media (max-width: 760px) {
    .notfound-card {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .notfound-icon {
        justify-self: center;
    }

    .notfound-copy p {
        margin-left: auto;
        margin-right: auto;
    }

    .notfound .hero-cta {
        justify-content: center;
    }
}

@media (max-width: 720px) {
    .content-shell,
    .layout-page .content-shell,
    .layout-post .content-shell {
        max-width: none;
    }
}

@media (max-width: 620px) {
    .page-content {
        padding-top: 22px;
    }

    .content-shell table,
    .post-content table,
    .home table {
        display: block;
        overflow-x: auto;
    }
}

@media (prefers-color-scheme: dark) {
    body.content-page {
        background: radial-gradient(circle at 10% 0%, #18233a 0%, var(--bg) 56%);
    }

    .layout-default .content-shell,
    .post,
    .home,
    .post-list li {
        background: var(--surface);
        border-color: var(--line);
    }

    .content-shell blockquote,
    .post-content blockquote,
    .home blockquote {
        background: #101a2b;
    }

    .content-shell code,
    .post-content code,
    .home code {
        background: rgba(106, 167, 255, 0.14);
        border-color: rgba(106, 167, 255, 0.26);
    }

    .content-shell pre,
    .post-content pre,
    .home pre {
        background: #0b101a;
    }

    .post-list-flat li:hover,
    .post-list-flat li:focus-within {
        background: rgba(106, 167, 255, 0.1);
    }
}
