html.posts-page,
body.posts-page {
    height: auto;
    min-height: 100%;
    overflow: auto;
    overscroll-behavior: auto;
}

html.post-dialog-open,
body.post-dialog-open {
    overflow: hidden;
}

:root[data-section="posts"] .nav-links a[href="posts.html"] {
    color: var(--nav-active);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.28em;
}

.posts-main {
    position: relative;
    z-index: 10;
    display: grid;
    gap: 20px;
    width: min(100%, 860px);
    margin: 0 auto;
    padding: 24px var(--page-pad) 96px;
}

.posts-card {
    padding: clamp(24px, 4vw, 40px);
}

.posts-heading {
    margin: 0 0 10px;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    line-height: 1.3;
}

.posts-intro {
    margin: 0 0 24px;
    color: var(--text-soft);
}

.post-form {
    display: grid;
    gap: 18px;
}

.post-field {
    display: grid;
    gap: 8px;
    color: var(--text-soft);
    font-size: 0.95rem;
}

.post-field input,
.post-field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    line-height: 1.6;
}

.post-field textarea {
    min-height: 140px;
    resize: vertical;
}

.post-field input::placeholder,
.post-field textarea::placeholder {
    color: var(--muted);
}

.post-field input:focus-visible,
.post-field textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.post-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.post-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.post-submit {
    padding: 10px 22px;
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    cursor: pointer;
}

.post-submit:disabled {
    opacity: 0.6;
    cursor: wait;
}

.post-status {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.posts-list {
    display: grid;
    gap: 14px;
}

.post-item {
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.post-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.85rem;
}

.post-name {
    color: var(--text);
    font-weight: 700;
}

.post-content {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.7;
}

.posts-empty {
    margin: 0;
    color: var(--muted);
}

.cf-turnstile {
    min-height: 65px;
}

.post-fab {
    position: fixed;
    right: clamp(16px, 3vw, 32px);
    bottom: clamp(16px, 3vw, 32px);
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    font-size: 0.95rem;
    box-shadow: var(--nav-shadow);
    cursor: pointer;
}

.post-fab svg {
    width: 16px;
    height: 16px;
}

.post-dialog {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px var(--page-pad);
}

.post-dialog[hidden] {
    display: none;
}

.post-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 8, 13, 0.62);
    backdrop-filter: blur(6px);
}

.post-dialog-panel {
    position: relative;
    width: min(100%, 560px);
    max-height: min(90vh, 760px);
    overflow-y: auto;
    padding: clamp(20px, 4vw, 32px);
}

.post-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.post-dialog-head .posts-heading {
    margin-bottom: 0;
}

.post-dialog-close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.post-dialog .posts-intro {
    margin-bottom: 20px;
}

@media (max-width: 520px) {
    .posts-card {
        padding: 20px;
    }

    .posts-main {
        padding-bottom: 64px;
    }
}
