:root {
    --ink: #172126;
    --muted: #607078;
    --paper: #f4f7f6;
    --panel: #ffffff;
    --accent: #b6422d;
    --accent-dark: #892f20;
    --teal: #185a68;
    --line: #d5dedb;
    --success: #226b4b;
    --danger: #a12b23;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    line-height: 1.65;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--accent-dark);
}

img {
    display: block;
    max-width: 100%;
}

button {
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    font: inherit;
    padding: 0.65rem 1rem;
}

button:hover {
    background: var(--accent-dark);
}

.site-header {
    align-items: center;
    background: var(--ink);
    color: white;
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    padding: 1rem clamp(1rem, 5vw, 4rem);
}

.site-header a {
    color: white;
    text-decoration: none;
}

.site-header nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
}

.site-header form {
    margin: 0;
}

.brand {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 0.65rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.brand-mark {
    align-items: center;
    background: var(--accent);
    border-radius: 6px;
    display: inline-flex;
    font-size: 0.8rem;
    height: 2rem;
    justify-content: center;
    width: 2rem;
}

.nav-button {
    background: transparent;
    padding: 0;
}

.nav-button:hover {
    background: transparent;
    text-decoration: underline;
}

.site-main {
    margin: 0 auto;
    max-width: 1100px;
    min-height: calc(100vh - 10rem);
    padding: clamp(1.5rem, 4vw, 3rem) 1rem;
}

.site-footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    padding: 1.5rem;
    text-align: center;
}

.home-intro {
    align-items: center;
    background: var(--ink);
    border-radius: 8px;
    color: white;
    display: flex;
    gap: 2rem;
    justify-content: space-between;
    margin-bottom: 2rem;
    overflow: hidden;
    padding: clamp(1.5rem, 4vw, 3rem);
    position: relative;
}

.home-intro::after {
    background: var(--teal);
    content: "";
    height: 12rem;
    opacity: 0.35;
    position: absolute;
    right: -4rem;
    top: -5rem;
    transform: rotate(20deg);
    width: 12rem;
}

.home-intro > * {
    position: relative;
    z-index: 1;
}

.home-intro h1,
.page-heading h1 {
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1.1;
    margin: 0.15rem 0 0.75rem;
}

.home-intro p {
    color: #dce7e8;
    margin-bottom: 0;
    max-width: 42rem;
}

.member-badge {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    display: grid;
    min-width: 12rem;
    padding: 1rem;
}

.member-badge span,
.member-badge small {
    color: #cbd9db;
}

.primary-action,
.download-button {
    background: var(--accent);
    border-radius: 8px;
    color: white;
    display: inline-block;
    font-weight: 700;
    padding: 0.65rem 1rem;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}

.primary-action:hover,
.download-button:hover {
    background: var(--accent-dark);
    color: white;
}

.secondary-action,
.danger-button {
    border-radius: 8px;
    display: inline-block;
    font-weight: 700;
    padding: 0.65rem 1rem;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}

.secondary-action {
    background: #e8efed;
    color: var(--teal);
}

.secondary-action:hover {
    background: #d8e5e2;
    color: #123f49;
}

.danger-button {
    background: var(--danger);
    color: white;
}

.danger-button:hover {
    background: #7f211b;
    color: white;
}

.danger-text {
    color: var(--danger);
}

.home-section {
    margin-top: 2.5rem;
}

.section-heading,
.page-heading {
    align-items: end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.heading-actions,
.action-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.heading-actions {
    justify-content: space-between;
}

.action-row form {
    margin: 0;
}

.section-heading h2 {
    font-size: 1.65rem;
    line-height: 1.2;
    margin: 0;
}

.page-heading {
    display: block;
    margin-bottom: 2rem;
}

.page-heading p:last-child {
    color: var(--muted);
    max-width: 48rem;
}

.eyebrow,
.meta {
    color: var(--teal);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0;
    text-transform: uppercase;
}

.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.content-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
    overflow: hidden;
    padding: 1.25rem;
}

.content-card img {
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    margin: -0.35rem 0 1rem;
    object-fit: cover;
    width: 100%;
}

.content-card h2,
.content-card h3 {
    line-height: 1.25;
    margin: 0.45rem 0 0.65rem;
}

.content-card h3 {
    font-size: 1.2rem;
}

.content-card p:last-child {
    margin-bottom: 0;
}

.resource-list {
    display: grid;
    gap: 0.75rem;
}

.resource-card {
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.resource-card h2,
.resource-card h3 {
    line-height: 1.25;
    margin: 0 0 0.35rem;
}

.resource-card p:last-child {
    margin-bottom: 0;
}

.topic-card {
    align-items: flex-start;
}

.status-pill {
    background: #e8efed;
    border-radius: 999px;
    color: var(--teal);
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.1rem 0.55rem;
}

.status-pill.danger {
    background: #f7e5e3;
    color: var(--danger);
}

.empty-state {
    background: var(--panel);
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    grid-column: 1 / -1;
    margin: 0;
    padding: 1.5rem;
}

.status-cancelled {
    color: var(--accent-dark);
    font-weight: 700;
}

.narrow-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0 auto;
    max-width: 520px;
    padding: 1.5rem;
}

.form-panel .page-heading {
    margin-bottom: 1rem;
}

.stack-form {
    display: grid;
    gap: 1rem;
}

.stack-form input,
.stack-form textarea,
.stack-form select {
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    padding: 0.65rem;
    width: 100%;
}

.stack-form input:focus,
.stack-form textarea:focus,
.stack-form select:focus,
.download-button:focus-visible,
.primary-action:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 3px solid #87c1cc;
    outline-offset: 2px;
}

.article-page {
    margin: 0 auto;
    max-width: 780px;
}

.cover-image {
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    object-fit: cover;
    width: 100%;
}

.prose {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow-wrap: anywhere;
    padding: clamp(1.25rem, 4vw, 2.5rem);
}

.prose h2,
.prose h3,
.prose h4 {
    line-height: 1.25;
    margin-top: 1.6em;
}

.prose img {
    border-radius: 6px;
}

.prose pre {
    background: #e9efed;
    border-radius: 6px;
    overflow-x: auto;
    padding: 1rem;
}

.prose table {
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
    width: 100%;
}

.prose th,
.prose td {
    border: 1px solid var(--line);
    padding: 0.5rem 0.65rem;
    text-align: left;
}

.event-facts {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 0.2rem 1rem;
    grid-template-columns: minmax(7rem, auto) 1fr;
    margin: 0 0 1.5rem;
    padding: 1.25rem;
}

.event-facts dt {
    color: var(--muted);
    font-weight: 700;
}

.event-facts dd {
    margin: 0;
}

.avatar-small,
.avatar-preview,
.avatar-fallback {
    align-items: center;
    background: var(--teal);
    border-radius: 50%;
    color: white;
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 700;
    justify-content: center;
    overflow: hidden;
}

.avatar-small {
    font-size: 0.9rem;
    height: 2.5rem;
    width: 2.5rem;
}

.avatar-small img,
.avatar-preview img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.avatar-preview,
.avatar-fallback {
    font-size: 1.5rem;
    height: 5rem;
    margin: 1rem 0;
    width: 5rem;
}

.avatar-status {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0;
}

.avatar-status.is-ok {
    color: var(--success);
}

.avatar-status.is-error {
    color: var(--danger);
}

.community-replies {
    display: grid;
    gap: 0.75rem;
    margin-top: 2rem;
}

.reply-card {
    align-items: flex-start;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 0.9rem;
    padding: 1rem;
}

.reply-card > div:last-child {
    min-width: 0;
    width: 100%;
}

.reply-body {
    overflow-wrap: anywhere;
}

.reply-panel {
    margin-top: 1.5rem;
}

.review-banner {
    background: #fff4cf;
    border: 1px solid #d8bd6c;
    border-radius: 8px;
    margin-bottom: 1.2rem;
    padding: 0.85rem 1rem;
}

.review-banner p {
    margin: 0.25rem 0 0;
}

.messages {
    background: #fff4cf;
    border-bottom: 1px solid #d8bd6c;
    padding: 0.75rem 1rem;
}

@media (max-width: 800px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-header nav {
        width: 100%;
    }

    .home-intro {
        align-items: flex-start;
        flex-direction: column;
    }

    .member-badge,
    .primary-action {
        width: 100%;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .resource-card,
    .section-heading,
    .heading-actions,
    .reply-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .download-button,
    .primary-action,
    .secondary-action,
    .danger-button {
        width: 100%;
    }
}
