:root {
    color-scheme: light;
    --accent: #b83b24;
    --accent-dark: #8f2b19;
    --border: #ddd6cd;
    --ink: #211f1c;
    --muted: #6d675f;
    --paper: #fffdf8;
    --wash: #f5f1e9;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--wash);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

a {
    color: var(--accent-dark);
    text-underline-offset: 0.18em;
}

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

button,
input,
textarea {
    font: inherit;
}

.shell {
    width: min(920px, calc(100% - 2rem));
    margin-inline: auto;
}

.site-header {
    border-bottom: 1px solid var(--border);
    background: rgba(255, 253, 248, 0.92);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4.5rem;
    gap: 1rem;
}

.brand {
    color: var(--ink);
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-decoration: none;
}

.nav-links,
.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links {
    font-size: 0.94rem;
}

.nav-links a {
    white-space: nowrap;
}

.nav-user {
    color: var(--muted);
}

.link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent-dark);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

main.shell {
    padding-block: 3rem;
}

h1,
h2,
p {
    margin-top: 0;
}

h1,
h2 {
    line-height: 1.2;
}

h1 {
    margin-bottom: 0.8rem;
    font-size: clamp(2rem, 6vw, 3.3rem);
    letter-spacing: -0.045em;
}

h2 {
    font-size: 1.22rem;
}

.eyebrow {
    margin-bottom: 0.45rem;
    color: var(--accent);
    font-size: 0.77rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lede {
    max-width: 42rem;
    color: var(--muted);
    font-size: 1.08rem;
}

.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.button {
    display: inline-block;
    padding: 0.68rem 1rem;
    border: 1px solid var(--accent);
    border-radius: 0.45rem;
    background: var(--accent);
    color: white;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    border-color: var(--accent-dark);
    background: var(--accent-dark);
    color: white;
}

.button-small {
    padding: 0.42rem 0.7rem;
}

.discussion-list,
.posts {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: var(--paper);
}

.discussion-card {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.35rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.discussion-card:last-child {
    border-bottom: 0;
}

.discussion-card h2 {
    margin-bottom: 0.35rem;
}

.discussion-card h2 a {
    color: var(--ink);
    text-decoration: none;
}

.discussion-card h2 a:hover {
    text-decoration: underline;
}

.excerpt {
    margin-bottom: 0.45rem;
    color: var(--muted);
}

.meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.reply-count {
    display: flex;
    min-width: 3.5rem;
    flex-direction: column;
    align-items: center;
    color: var(--muted);
}

.reply-count strong {
    color: var(--ink);
    font-size: 1.25rem;
}

.reply-count span {
    font-size: 0.72rem;
    text-transform: uppercase;
}

.form-panel,
.auth-panel,
.reply-panel {
    padding: clamp(1.4rem, 4vw, 2.2rem);
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: var(--paper);
}

.auth-panel {
    max-width: 34rem;
    margin-inline: auto;
}

.stack-form {
    display: grid;
    gap: 1.15rem;
}

.stack-form label:not(.checkbox-row) {
    display: grid;
    gap: 0.35rem;
    font-weight: 650;
}

input[type="text"],
input[type="email"],
input[type="password"],
input:not([type]),
textarea {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid #bdb5aa;
    border-radius: 0.4rem;
    background: white;
    color: var(--ink);
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    outline: 3px solid rgb(184 59 36 / 14%);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.field-help,
.field-error,
.form-footer {
    font-size: 0.84rem;
    font-weight: 400;
}

.field-help {
    color: var(--muted);
}

.field-error {
    color: #a21e16;
}

.form-footer {
    margin: 1.5rem 0 0;
    color: var(--muted);
}

.notice {
    margin-bottom: 1.5rem;
    padding: 0.8rem 1rem;
    border: 1px solid #93ad7a;
    border-radius: 0.45rem;
    background: #edf5e6;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
}

.discussion-header {
    margin-bottom: 2rem;
}

.post {
    padding: clamp(1.25rem, 4vw, 1.8rem);
    border-bottom: 1px solid var(--border);
}

.post:last-child {
    border-bottom: 0;
}

.post-header {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid #eee9e1;
}

.post-header time {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.84rem;
}

.post-number {
    color: var(--muted);
    font-size: 0.85rem;
}

.post-body {
    overflow-wrap: anywhere;
}

.reply-panel {
    margin-top: 1.5rem;
}

.reply-panel h2 {
    margin-bottom: 1rem;
}

.pagination {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pagination-disabled,
.site-footer {
    color: var(--muted);
}

.site-footer {
    padding-bottom: 2rem;
    text-align: center;
}

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .shell {
        width: min(100% - 1.25rem, 920px);
    }

    .nav {
        align-items: flex-start;
        padding-block: 0.9rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.6rem 0.9rem;
    }

    .nav-user {
        display: none;
    }

    main.shell {
        padding-block: 2rem;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
        gap: 1rem;
    }

    .discussion-card {
        padding: 1.1rem;
    }

    .reply-count {
        min-width: 2.5rem;
    }

    .post-header {
        flex-wrap: wrap;
    }

    .post-header time {
        width: 100%;
        margin-left: 0;
    }
}
