:root {
    --color-bg: #a9cbee;
    --color-header-bg: #94bce7;
    --color-header-border: #7ba8dc;
    --color-surface: rgba(255, 255, 255, 0.78);
    --color-surface-hover: rgba(255, 255, 255, 0.9);
    --color-text: #16233a;
    --color-heading: #132a55;
    --color-text-muted: #2d4a72;
    --color-text-meta: #4d6690;
    --color-border: rgba(28, 78, 216, 0.18);
    --color-accent: #1c4ed8;
    --color-accent-dark: #123a9e;
    --color-accent-soft: rgba(28, 78, 216, 0.1);
    --color-accent-soft-border: rgba(28, 78, 216, 0.3);

    --font-heading: "Instrument Serif", ui-serif, Georgia, serif;
    --font-body: "Karla", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

    --content-width: 46rem;
    --page-width: 64rem;
    /* The blog post column itself (excluding the 280px sidebar and the gap
       between them) works out to 44rem at the current --page-width of
       64rem (64 - 17.5 sidebar - 2.5 gap). 33% wider than that is 58.5rem,
       so this is set to 58.5 + 17.5 + 2.5 = 78.5rem - a dedicated value so
       only the blog post + sidebar row widens, not the header/hero/editor
       areas that also read --page-width. */
    --blog-layout-width: 78.5rem;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.65;
}

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

a:hover {
    color: var(--color-accent-dark);
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 400;
    line-height: 1.15;
    margin: 0 0 0.5em;
    color: var(--color-heading);
}

h1 { font-size: 2.75rem; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.4rem; }

p { margin: 0 0 1.2em; }

img { max-width: 100%; height: auto; border-radius: var(--radius); }

.container {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.site-header {
    padding: 2.5rem 0 1.75rem;
    background: var(--color-header-bg);
    border-bottom: 1px solid var(--color-header-border);
}

.site-header__inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem 2rem;
}

.site-brand {
    text-decoration: none;
    color: var(--color-text);
}

.site-brand__name {
    display: block;
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 2.5rem;
    letter-spacing: -0.01em;
    color: var(--color-text);
}

.site-brand__tagline {
    display: block;
    color: var(--color-text-muted);
    font-size: 1.0625rem;
    margin-top: 0.35rem;
}

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 1.1rem 0 0;
    padding: 0;
}

.site-nav a {
    text-decoration: none;
    font-weight: 500;
    font-size: 1.0625rem;
    color: var(--color-text-muted);
    padding-bottom: 3px;
    border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a.current {
    color: var(--color-text);
    font-weight: 700;
    border-bottom-color: var(--color-accent);
}

.site-search {
    display: flex;
    align-items: center;
    margin-top: 1.1rem;
}

#SearchForm_SearchForm {
    display: flex;
    gap: 0.5rem;
}

#SearchForm_SearchForm .field {
    margin: 0;
}

#SearchForm_SearchForm label {
    display: none;
}

#SearchForm_SearchForm input[type="text"] {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    width: 11rem;
}

#SearchForm_SearchForm input[type="submit"] {
    padding: 0.45rem 1.1rem;
    border: 1px solid var(--color-accent);
    background: var(--color-accent);
    color: #f2f6ff;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
}

#SearchForm_SearchForm input[type="submit"]:hover {
    filter: brightness(1.08);
}

.search-results__query {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.search-results__list .post-summary {
    margin-bottom: 1.5rem;
}

.search-results__pagination {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.search-results__pagination a {
    color: var(--color-accent-dark);
    font-weight: 600;
    text-decoration: none;
}

/* Main content */
main {
    padding: 3.5rem 0 4rem;
}

.breadcrumbs {
    max-width: var(--content-width);
    margin: 0 auto 1.5rem;
    padding: 0 1.5rem;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}
.breadcrumbs a { color: inherit; }

.page-content {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page-content .content { margin-top: 1rem; }

/* Homepage hero */
.hero {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

.hero .content {
    font-size: 1.25rem;
    color: var(--color-text-muted);
    max-width: 36rem;
}

/* Blog listing */
.blog-layout {
    display: flex;
    align-items: flex-start;
    gap: 2.5rem;
    max-width: var(--blog-layout-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.blog-layout .blog-entry {
    flex: 1;
    min-width: 0;
    max-width: none;
    padding: 0;
    margin: 0;
}

.blog-entry {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Archive sidebar */
.archive-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--color-surface);
    backdrop-filter: blur(6px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem 1.5rem 1.75rem;
    box-shadow: 0 8px 24px rgba(28, 78, 216, 0.1);
    position: sticky;
    top: 2rem;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-action-btn {
    display: block;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.sidebar-action-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent-dark);
}

.sidebar-action-btn--primary {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #f2f6ff;
}

.sidebar-action-btn--primary:hover {
    color: #f2f6ff;
    filter: brightness(1.08);
}

.archive-sidebar__title {
    font-size: 1.375rem;
    margin-bottom: 0.75rem;
}

.archive-year > summary,
.archive-month > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-weight: 600;
    color: var(--color-text);
}

.archive-year > summary::-webkit-details-marker,
.archive-month > summary::-webkit-details-marker {
    display: none;
}

.archive-year > summary::before,
.archive-month > summary::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 5px solid var(--color-accent);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.archive-year[open] > summary::before,
.archive-month[open] > summary::before {
    transform: rotate(90deg);
}

.archive-year {
    border-bottom: 1px solid var(--color-border);
}

.archive-year:last-child {
    border-bottom: none;
}

.archive-month {
    margin-left: 1rem;
}

.archive-month > summary {
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    padding: 0.35rem 0;
}

.archive-posts {
    list-style: none;
    margin: 0 0 0.5rem 1.25rem;
    padding: 0;
}

.archive-posts li {
    margin-bottom: 0.35rem;
}

.archive-posts a {
    font-size: 0.9375rem;
    text-decoration: none;
    color: var(--color-text-muted);
}

.archive-posts a:hover {
    color: var(--color-accent-dark);
    text-decoration: underline;
}

.archive-year.is-current > summary,
.archive-month.is-current > summary {
    color: var(--color-accent-dark);
}

.archive-posts li.is-current > a {
    color: var(--color-accent-dark);
    font-weight: 700;
    text-decoration: none;
}

.post-summary {
    background: var(--color-surface);
    backdrop-filter: blur(6px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.75rem 1.9rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 8px 24px rgba(28, 78, 216, 0.1);
}

.post-summary:hover {
    background: var(--color-surface-hover);
    border-color: rgba(28, 78, 216, 0.35);
}

.post-summary h2 {
    font-size: 1.875rem;
    margin-bottom: 0.5rem;
}

.post-summary h2 a {
    text-decoration: none;
    color: var(--color-text);
}

.post-summary h2 a:hover {
    color: var(--color-accent-dark);
}

.post-summary p {
    font-size: 1.0625rem;
    color: var(--color-text-muted);
}

.post-image img {
    margin: 0.75rem 0;
}

.blog-post-meta {
    font-size: 0.9375rem;
    color: var(--color-text-meta);
    margin-top: 0.5rem;
}

.blog-post-meta a {
    color: var(--color-text-meta);
    text-decoration: underline;
}

/* Single post */
.blog-entry article > h1 {
    margin-bottom: 0.4rem;
}

.post-date {
    font-size: 0.9375rem;
    color: var(--color-text-meta);
    margin-top: 0;
    margin-bottom: 1.25rem;
}

.blog-entry article .content {
    font-size: 1.125rem;
}

.post-image img,
.post-content img {
    cursor: zoom-in;
}

.post-share {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.post-share__label {
    font-size: 0.9375rem;
    color: var(--color-text-meta);
    font-weight: 600;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.share-btn:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-accent);
    color: var(--color-accent-dark);
}

.related-posts {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.related-posts__title {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
}

.related-posts__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 1.25rem;
}

.related-post-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
}

.related-post-card__image img {
    display: block;
    width: 100%;
    height: 7rem;
    object-fit: cover;
}

.related-post-card h3 {
    font-size: 1.0625rem;
    font-style: italic;
    margin: 0.85rem 1rem;
}

.related-post-card h3 a {
    color: var(--color-heading);
    text-decoration: none;
}

.related-post-card h3 a:hover {
    color: var(--color-accent-dark);
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 35, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.lightbox-overlay[hidden] {
    display: none;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    font-size: 2.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav[hidden] {
    display: none;
}

.lightbox-prev {
    left: 1.5rem;
}

.lightbox-next {
    right: 1.5rem;
}

/* Delete-post confirmation modal (reuses .lightbox-overlay for the backdrop) */
.delete-modal {
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 28rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.delete-modal h2 {
    margin-bottom: 0.75rem;
}

.delete-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.sidebar-action-btn--danger {
    background: none;
    border-color: #c0392b;
    color: #c0392b;
    font: inherit;
    cursor: pointer;
}

.sidebar-action-btn--danger:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

.delete-modal__actions .sidebar-action-btn--danger {
    background: #c0392b;
    color: #fff;
}

.delete-modal__actions .sidebar-action-btn--danger:hover {
    filter: brightness(1.1);
}

.sidebar-action-btn--warning {
    background: none;
    border-color: #b8790a;
    color: #b8790a;
    font: inherit;
    width: 100%;
    cursor: pointer;
}

.sidebar-action-btn--warning:hover {
    background: #b8790a;
    border-color: #b8790a;
    color: #fff;
}

.unpublished-banner {
    display: inline-block;
    background: #fbe9d0;
    border: 1px solid #b8790a;
    color: #7a4f06;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    margin-bottom: 1rem;
}

body.lightbox-open {
    overflow: hidden;
}

/* Section heading for archive/tag/category/latest-posts labels */
.section-label {
    display: inline-block;
    background: var(--color-accent-soft);
    border: 1px solid var(--color-accent-soft-border);
    color: var(--color-accent-dark);
    border-radius: 999px;
    padding: 0.4rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
    padding: 0;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
    font-size: 1.0625rem;
}

.pagination a:hover {
    background: var(--color-accent-soft);
}

.pagination span {
    background: var(--color-accent);
    color: #fff;
}

/* Standalone blog editor (/write) */
.editor-page-header {
    max-width: var(--page-width);
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
}

.editor-shell {
    flex: 1;
    min-width: 0;
    padding: 0 0 4rem;
}

.drafts-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.drafts-list__item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.drafts-list__title {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.375rem;
    color: var(--color-heading);
}

.drafts-list__meta {
    color: var(--color-text-meta);
    font-size: 0.875rem;
    margin-top: 0.3rem;
    margin-bottom: 0.85rem;
}

.drafts-list__actions {
    display: flex;
    gap: 0.75rem;
}

form#Form_PostForm .field {
    margin-bottom: 1.5rem;
}

form#Form_PostForm label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

form#Form_PostForm input[type="text"]:not(.tox *),
form#Form_PostForm textarea:not(.tox *) {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
}

form#Form_PostForm .btn:not(.tox *),
form#Form_PostForm button:not(.tox *) {
    background: var(--color-accent);
    color: #f2f6ff;
    font-weight: 700;
    padding: 0.75rem 1.75rem;
    border-radius: 999px;
    font-size: 1rem;
    border: none;
    cursor: pointer;
}

form#Form_PostForm .Actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

form#Form_PostForm [name="action_doSaveDraft"]:not(.tox *) {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

form#Form_PostForm [name="action_doSaveDraft"]:not(.tox *):hover {
    border-color: var(--color-accent);
    color: var(--color-accent-dark);
}

.tox-tinymce {
    min-height: 640px !important;
}

.tox-edit-area,
.tox-edit-area iframe {
    min-height: 540px !important;
}

form#Form_PostForm .message.good {
    background: var(--color-accent-soft);
    border: 1px solid var(--color-accent-soft-border);
    color: var(--color-accent-dark);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-header-border);
    padding: 2rem 0;
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

.site-footer__inner {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.site-footer nav ul {
    list-style: none;
    display: flex;
    gap: 1.25rem;
    margin: 0;
    padding: 0;
}

.site-footer a { color: var(--color-text-muted); }

@media (max-width: 48rem) {
    .blog-layout { flex-direction: column; }
    .archive-sidebar { width: 100%; position: static; }
}

@media (max-width: 40rem) {
    .site-header__inner { flex-direction: column; align-items: flex-start; }
    h1 { font-size: 2rem; }
    .post-summary { padding: 1.25rem 1.5rem; }
}

/* Social login buttons (Security/login "Social sign-on" tab) */
.oauth-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 0.7rem 1.25rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
}

.oauth-login-btn:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-accent);
    color: var(--color-accent-dark);
}

.oauth-login-btn__icon {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

/* Comments (silverstripe/comments), gated behind social login + COMMENT_POST */
.comments-holder-container {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.comments-holder-container h4 {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.5rem;
    color: var(--color-heading);
    margin-bottom: 1rem;
}

.comments-holder-container form textarea,
.comments-holder-container form input[type="text"] {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.comments-holder-container form .Actions button {
    padding: 0.6rem 1.5rem;
    border-radius: 999px;
    border: 1px solid var(--color-accent);
    background: var(--color-accent);
    color: #f2f6ff;
    font-weight: 600;
    cursor: pointer;
}

.comments-holder-container form .Actions button:hover {
    filter: brightness(1.08);
}

#moderated.message.good {
    background: var(--color-accent-soft);
    border: 1px solid var(--color-accent-soft-border);
    color: var(--color-accent-dark);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.comments-holder-container > p a {
    color: var(--color-accent-dark);
    font-weight: 600;
}

.comments-list.root-level {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comments-list li.comment {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.comments-list .info {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-meta);
}

.comments-list .info .author {
    font-weight: 700;
    color: var(--color-heading);
}

.comments-list .comment-text p {
    margin: 0;
    line-height: 1.65;
}

.comments-list .comment-action-links {
    margin-top: 0.75rem;
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
}

.comments-list .comment-action-links a,
.comments-list .comment-reply-link {
    color: var(--color-text-muted);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.comments-list .comment-action-links a:hover,
.comments-list .comment-reply-link:hover {
    color: var(--color-accent-dark);
}

.no-comments-yet,
.commenting-rss-feed {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}
