:root {
    --bg: #faf7f2;
    --surface: #ffffff;
    --text: #2b2a28;
    --muted: #6b665e;
    --border: #e4ded4;
    --accent: #1f3a68;        /* dark blue: the colorectal cancer awareness ribbon */
    --accent-contrast: #ffffff;
    --accent-soft: #e7ecf5;
    --danger: #a3312a;
    --success: #2f6b3a;
    --radius: 10px;
    --serif: Georgia, "Times New Roman", serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}

.theme-private {
    --bg: #15161a;
    --surface: #1f2128;
    --text: #ecebe8;
    --muted: #a3a09a;
    --border: #33363f;
    --accent: #e0a43a;
    --accent-contrast: #15161a;
    --accent-soft: #2c2a22;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3 { font-family: var(--serif); font-weight: normal; line-height: 1.25; }
h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 0.2em 0 0.4em; }
h2 { font-size: 1.6rem; margin-top: 1.8em; }
h3 { font-size: 1.25rem; }

a { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 680px; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-family: var(--serif); font-size: 1.4rem; color: var(--text); text-decoration: none; }
.nav { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0; padding: 0; }
.nav a { color: var(--text); text-decoration: none; }
.nav a:hover { color: var(--accent); }
.nav a.button { color: var(--accent-contrast); }
.account-bar { background: var(--accent-soft); font-size: 0.85rem; }
.account-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding-top: 6px; padding-bottom: 6px; color: var(--muted); }
.nav-small { gap: 4px 14px; }

main { flex: 1; padding-top: 32px; padding-bottom: 56px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 0.9rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-top: 18px; padding-bottom: 18px; }
.ribbon { width: 10px; height: 18px; border-radius: 5px 5px 0 0; background: var(--accent); }
.muted { color: var(--muted); }

/* Buttons and forms */
.button, button.button {
    display: inline-block; background: var(--accent); color: var(--accent-contrast); border: none;
    border-radius: 999px; padding: 10px 22px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button:hover { filter: brightness(1.1); }
.button-small { padding: 6px 14px; font-size: 0.9rem; }
.button-secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.button-danger { background: var(--danger); color: #fff; }
.button-success { background: var(--success); color: #fff; }
.link-button { background: none; border: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.inline-form { display: inline; }

form.stack { display: grid; gap: 18px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
.hint { font-weight: normal; color: var(--muted); font-size: 0.9rem; }
input:not([type]), input[type=text], input[type=email], input[type=password], textarea, select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 220px; resize: vertical; }
textarea.editor { min-height: 480px; font-family: ui-monospace, Consolas, monospace; font-size: 0.95rem; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.checkbox { display: flex; gap: 8px; align-items: flex-start; font-weight: normal; }
.checkbox input { margin-top: 5px; }
.field-error, .validation-summary-errors { color: var(--danger); font-size: 0.9rem; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }

.notice { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 6px; margin-bottom: 24px; }
.warning { background: #fff4e0; border-left: 4px solid #c27c0e; padding: 12px 16px; border-radius: 6px; color: #5a3a06; }

/* Content */
.hero { text-align: center; padding: 24px 0 8px; }
.hero .portrait { width: 220px; height: 220px; object-fit: cover; border-radius: 50%; margin: 0 auto 16px; border: 4px solid var(--surface); box-shadow: 0 2px 12px rgba(0,0,0,0.12); }
.hero .subtitle { color: var(--muted); font-size: 1.1rem; }
.prose { max-width: 720px; margin: 0 auto; }
.prose li { margin-bottom: 4px; }
.cta { text-align: center; margin: 40px 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; }
.post-list { display: grid; gap: 22px; max-width: 720px; margin: 0 auto; }
.post-meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.post h2, .post h3 { margin: 0 0 6px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 14px; }
.photo-grid a, .photo-grid figure { display: block; margin: 0; border-radius: 6px; overflow: hidden; background: var(--border); }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.gallery { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.pager { display: flex; justify-content: space-between; max-width: 720px; margin: 28px auto 0; }

/* Moderation and admin */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.tabs a.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.mod-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.photo-tools { padding: 4px; text-align: center; font-size: 0.8rem; }
.private-info { color: var(--muted); font-size: 0.85rem; }

table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th, table.data td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table-scroll { overflow-x: auto; }
.role-list { display: grid; gap: 4px; }
code.link { word-break: break-all; background: var(--accent-soft); padding: 8px; display: block; border-radius: 6px; }

@media (max-width: 600px) {
    body { font-size: 16px; }
    .card { padding: 18px 16px; }
    .hero .portrait { width: 160px; height: 160px; }
}

/* Captions */
.caption-list { display: grid; gap: 10px; margin-top: 10px; }
.caption-row { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; }
.caption-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.caption-row label { font-weight: normal; margin-bottom: 2px; overflow-wrap: anywhere; }
.photo-grid figure figcaption, .photo-caption { font-size: 0.85rem; color: var(--muted); padding: 6px 6px 8px; line-height: 1.4; background: var(--surface); }
.photo-grid figure { background: var(--surface); border: 1px solid var(--border); }
.caption-form { display: flex; gap: 6px; padding: 6px; background: var(--surface); }
.caption-form input { padding: 6px 8px; font-size: 0.85rem; }
