/* Shared paper treatment. Header, scene controls and article layout stay untouched. */
.paper-page,
.article-page {
    background: #f8f3e9;
    isolation: isolate;
}

.paper-page::before,
.article-page::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    background: url("../assets/scene/home-atmosphere-v1.0.webp") center / 100% 100% no-repeat;
    opacity: .32;
}

.article-page .article-edge-field { display: none; }

.paper-controls :is(input:not([type="hidden"]), textarea, select),
.article-page :is(.comment-form, .article-group-editor) :is(input:not([type="hidden"]), textarea, select) {
    width: 100%;
    min-width: 0;
    border: 1px solid #bdb3a5;
    border-radius: 4px;
    padding: 12px 15px;
    background: rgb(255 253 249 / 78%);
    color: var(--charcoal);
    box-shadow: inset 0 1px 3px rgb(69 54 39 / 4%);
    font: 400 16px/1.65 var(--serif);
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.paper-controls textarea { resize: vertical; }

.paper-controls :is(input, textarea, select):focus,
.article-page :is(.comment-form, .article-group-editor) :is(input, textarea, select):focus {
    border-color: #a95b36;
    outline: 2px solid rgb(169 91 54 / 16%);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgb(169 91 54 / 5%);
}

.paper-controls button,
.article-page :is(.comment-form, .comment-moderation, .article-group-editor) button {
    min-height: 44px;
    border: 1px solid #985333;
    border-radius: 4px;
    padding: 11px 22px;
    background: linear-gradient(rgb(255 255 255 / 5%), rgb(76 32 12 / 7%)), #aa603d;
    color: #fff8ed;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 18%), 0 2px 3px rgb(72 43 25 / 12%);
    font: 500 15px/1.5 var(--serif);
    letter-spacing: .06em;
    cursor: pointer;
    transition: background-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.paper-controls button:hover,
.article-page :is(.comment-form, .comment-moderation, .article-group-editor) button:hover {
    background-color: #924c2e;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 12%), 0 3px 6px rgb(72 43 25 / 16%);
}

.paper-controls button:active,
.article-page :is(.comment-form, .comment-moderation, .article-group-editor) button:active {
    transform: translateY(1px);
    box-shadow: inset 0 1px 3px rgb(72 43 25 / 16%);
}

.paper-secondary {
    display: block;
    border: 1px solid #aa9e8e;
    border-radius: 4px;
    padding: 11px 22px;
    background: rgb(255 253 249 / 35%);
    color: var(--charcoal);
    text-align: center;
    text-decoration: none;
    font: 400 15px/1.5 var(--serif);
}
.paper-secondary:hover { background: rgb(255 253 249 / 85%); border-color: #a95b36; }

.paper-heading p,
.paper-controls label {
    color: #766e63;
    font: 400 12px/1.5 var(--mono);
    letter-spacing: .08em;
    text-transform: uppercase;
}
.paper-heading p { margin: 0 0 12px; }
.paper-heading h1 { margin: 0; font: 400 clamp(28px, 3vw, 38px)/1.4 var(--serif); }
.paper-heading::after { display: block; width: 32px; height: 2px; margin-top: 18px; background: #aa603d; content: ""; }
.paper-error { color: #963f30; border-left: 2px solid currentColor; padding-left: 12px; line-height: 1.6; }

.login-shell { width: min(490px, calc(100% - 40px)); margin: 64px auto 72px; }
.login-card { display: grid; gap: 12px; border: 1px solid #ded6ca; border-radius: 5px; padding: 44px 48px; background: rgb(255 253 249 / 65%); box-shadow: 0 3px 12px rgb(69 54 39 / 3%); }
.login-card .paper-heading { margin-bottom: 18px; }
.login-card label:not(:first-of-type) { margin-top: 12px; }
.login-card button { margin-top: 14px; }

.editor-shell { width: min(1300px, calc(100% - 80px)); margin: 48px auto 64px; }
.editor-shell > .paper-heading { margin-bottom: 28px; }
.editor-form { display: grid; grid-template-columns: minmax(0, 2.5fr) minmax(260px, 1fr); align-items: start; gap: 32px; }
.manuscript { display: flex; flex-direction: column; min-width: 0; border: 1px solid #ded6ca; border-radius: 5px; padding: 42px; background: rgb(255 253 249 / 72%); box-shadow: 0 2px 8px rgb(69 54 39 / 2%); }
.paper-controls .manuscript #title { margin: 8px 0 34px; border: 0; border-bottom: 1px solid #b9ac99; border-radius: 0; padding: 8px 0 14px; background: transparent; box-shadow: none; font: 400 clamp(24px, 2.5vw, 34px)/1.5 var(--serif); }
.paper-controls .manuscript #content { flex: 1; min-height: 460px; margin-top: 16px; border-color: transparent; padding: 8px 0; background: transparent; box-shadow: none; font: 400 18px/1.95 var(--serif); }
.paper-controls .manuscript :is(#title, #content):focus { border-color: #a95b36; }
.editor-settings { display: grid; min-width: 0; gap: 12px; }
.editor-settings h2 { margin: 0 0 14px; border-bottom: 1px solid #cec2b2; padding: 0 0 18px; font: 400 26px/1.4 var(--serif); }
.editor-settings #summary { min-height: 132px; margin-bottom: 20px; }
.editor-actions { display: grid; gap: 12px; margin-top: 22px; border-top: 1px solid #cec2b2; padding-top: 24px; }
.article-page .comment-form > button { justify-self: start; }

/* A single reader-note section, with accessible labels retained off-screen. */
.article-page .comments-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.article-page .comments-heading h2 { font: 400 26px/1.5 var(--serif); letter-spacing: .04em; }
.article-page .comments-heading p { margin: 0; font: 400 11px/1.5 var(--mono); letter-spacing: .16em; }
.article-page .comments-empty { margin-top: 18px; color: #766e63; font: 400 15px/1.8 var(--serif); }
.article-page .comment-form { margin-top: 24px; border: 0; padding: 0; gap: 14px; }
.article-page .comment-form textarea { min-height: 180px; padding: 18px 20px; }
.article-page .comment-form :is(input, textarea)::placeholder { color: #81776b; opacity: 1; }
.comment-form-bottom { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: stretch; }
.article-page .comment-form-bottom button { min-width: 132px; text-transform: none; }
.article-page .comment-form #comment-form-note { margin: -4px 0 0; text-align: right; color: #766e63; font: 400 12px/1.6 var(--serif); }
.article-page .comment-screen-reader { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.comment-thanks {
    position: fixed;
    z-index: 100;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: max-content;
    max-width: calc(100vw - 40px);
    padding: 24px 36px;
    border: 1px solid #c5b49f;
    border-radius: 5px;
    background: #fcf8ef;
    color: #8f482c;
    box-shadow: 0 8px 32px rgb(69 54 39 / 16%);
    font: 400 20px/1.6 var(--serif);
    pointer-events: none;
    animation: comment-thanks-dismiss 450ms ease 1s forwards;
}
@keyframes comment-thanks-dismiss {
    from { opacity: 1; visibility: visible; }
    to { opacity: 0; visibility: hidden; }
}
@media (max-width: 480px) {
    .comment-form-bottom { gap: 10px; }
    .article-page .comment-form-bottom button { min-width: 108px; padding-inline: 14px; }
    .article-page .comments-heading p { font-size: 10px; letter-spacing: .08em; }
}

@media (max-width: 900px) {
    .editor-shell { width: calc(100% - 40px); margin-top: 32px; }
    .editor-form { grid-template-columns: minmax(0, 1fr); }
    .manuscript { padding: 28px; }
    .editor-settings { width: 100%; }
}
@media (max-width: 480px) {
    .login-shell { margin-top: 32px; }
    .login-card { padding: 30px 24px; }
    .manuscript { padding: 24px 18px; }
    .paper-controls .manuscript #content { min-height: 360px; font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
    .comment-thanks { animation-duration: 1ms; }
    .paper-controls *, .article-page :is(.comment-form, .comment-moderation, .article-group-editor) * { transition: none; }
}
