:root {
  --paper: #f4eddf;
  --paper-deep: #e8ddca;
  --ink: #211d18;
  --muted: #6f665b;
  --rule: #b7aa97;
  --red: #7a271a;
  --red-dark: #571b13;
  --blue: #1d4f61;
  --white: #fffaf0;
  --max: 1120px;
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: var(--red-dark); text-underline-offset: .16em; text-decoration-thickness: 1px; }
a:hover { color: var(--red); }
button, input, select, textarea { font: inherit; }
button, .primary-action, .write-link {
  border: 0;
  background: var(--red);
  color: var(--white);
  cursor: pointer;
  font-weight: 700;
}
button:hover, .primary-action:hover, .write-link:hover { background: var(--red-dark); color: var(--white); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #bf7b00;
  outline-offset: 3px;
}

.skip-link { position: absolute; left: -9999px; top: 0; padding: .7rem 1rem; background: var(--ink); color: white; z-index: 100; }
.skip-link:focus { left: 1rem; top: 1rem; }
.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; }

.site-header { border-top: 7px solid var(--red); border-bottom: 1px solid var(--ink); background: var(--paper); }
.header-inner { max-width: var(--max); margin: auto; padding: 1.2rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.wordmark { display: inline-flex; flex-direction: column; color: var(--ink); text-decoration: none; font-family: Georgia, "Times New Roman", serif; font-weight: 800; line-height: .88; letter-spacing: .075em; font-size: 1.18rem; }
.wordmark span:last-child { color: var(--red); }
.site-header nav, footer nav { display: flex; align-items: center; gap: 1.35rem; flex-wrap: wrap; }
.site-header nav a { color: var(--ink); font-weight: 700; text-decoration: none; font-size: .9rem; }
.site-header nav .write-link { color: var(--white); padding: .55rem .82rem; }

main { min-height: 65vh; }
.home-intro, .board-shell, .participation-note, .form-page, .thread-page, .replies, .reply-form, .search-page, .prose-page, .error-page, .admin-login, .admin-page {
  max-width: var(--max); margin-left: auto; margin-right: auto; padding-left: 1.5rem; padding-right: 1.5rem;
}
.home-intro { padding-top: 5.2rem; padding-bottom: 4.8rem; display: grid; grid-template-columns: minmax(0, 760px); }
.kicker, .section-label { margin: 0 0 .8rem; color: var(--red); font-size: .73rem; font-weight: 800; letter-spacing: .16em; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.08; margin-top: 0; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 7vw, 5.7rem); letter-spacing: -.045em; margin-bottom: 1.35rem; }
h2 { font-size: clamp(1.55rem, 3vw, 2.3rem); letter-spacing: -.025em; }
.deck { margin: 0; max-width: 760px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.25rem, 2.5vw, 1.65rem); color: #403931; line-height: 1.45; }
.deck.compact { max-width: 720px; font-size: clamp(1.15rem, 2vw, 1.42rem); }
.intro-actions { margin-top: 2rem; display: flex; gap: 1.3rem; align-items: center; flex-wrap: wrap; }
.primary-action { display: inline-block; padding: .72rem 1rem; text-decoration: none; }

.board-shell { padding-bottom: 2rem; }
.board-heading { border-top: 4px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 1.1rem 0; display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.board-heading h2, .board-heading p { margin-bottom: 0; }
.board-stats { margin: 0; display: flex; gap: 1.5rem; }
.board-stats div { display: flex; flex-direction: column-reverse; align-items: end; }
.board-stats dt { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; }
.board-stats dd { margin: 0; font-family: Georgia, serif; font-size: 1.55rem; font-weight: 800; }
.category-nav { display: flex; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--ink); scrollbar-width: thin; }
.category-nav a { flex: 0 0 auto; padding: .65rem .85rem; color: var(--ink); text-decoration: none; font-size: .82rem; font-weight: 700; border-right: 1px solid var(--rule); }
.category-nav a:first-child { padding-left: 0; }
.category-nav a[aria-current="page"] { color: var(--red); text-decoration: underline; text-underline-offset: .35em; }

.thread-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 150px; gap: 1.25rem; padding: 1.3rem 0; border-bottom: 1px solid var(--rule); }
.thread-mark { align-self: start; width: max-content; border: 1px solid var(--red); color: var(--red); font-family: "Courier New", monospace; font-size: .68rem; font-weight: 800; letter-spacing: .09em; padding: .16rem .32rem; }
.thread-mark.large { margin-bottom: 1.4rem; font-size: .78rem; }
.thread-copy h2 { margin: 0 0 .35rem; font-size: clamp(1.18rem, 2vw, 1.48rem); }
.thread-copy h2 a { color: var(--ink); text-decoration: none; }
.thread-copy h2 a:hover { color: var(--red); text-decoration: underline; }
.thread-excerpt { margin: 0 0 .5rem; color: #413b34; line-height: 1.45; }
.thread-meta, .byline { margin: 0; color: var(--muted); font-size: .78rem; }
.staff-badge { display: inline-block; margin-left: .28rem; padding: .02rem .28rem; border: 1px solid var(--blue); color: var(--blue); font-family: "Courier New", monospace; font-size: .58rem; font-weight: 800; letter-spacing: .08em; line-height: 1.45; vertical-align: .1em; }
.thread-numbers { display: flex; flex-direction: column; align-items: end; color: var(--muted); font-size: .72rem; line-height: 1.65; }
.thread-numbers strong { color: var(--ink); }
.empty-state { padding: 3rem 0; border-bottom: 1px solid var(--rule); }
.empty-state h2, .empty-state h3 { margin-bottom: .45rem; }
.empty-state p { color: var(--muted); }
.participation-note { margin-top: 1rem; margin-bottom: 5rem; padding-top: 1.2rem; padding-bottom: 1.2rem; border-top: 1px solid var(--red); border-bottom: 1px solid var(--red); display: grid; grid-template-columns: 230px 1fr; gap: 1.5rem; color: #403931; }

.form-page, .search-page, .prose-page, .error-page, .admin-login, .admin-page { padding-top: 4.5rem; padding-bottom: 5rem; max-width: 860px; }
.form-page h1, .search-page h1, .prose-page h1, .error-page h1, .admin-page h1 { font-size: clamp(2.5rem, 6vw, 4.8rem); }
.paper-form { margin-top: 2.5rem; border-top: 3px solid var(--ink); padding-top: 1.2rem; }
.paper-form label { display: block; margin-bottom: 1.2rem; font-weight: 700; }
.paper-form input, .paper-form textarea, .paper-form select, .search-form input, .report-control input, .report-control textarea, .report-control select {
  width: 100%; margin-top: .35rem; padding: .72rem .78rem; background: var(--white); border: 1px solid #8c8172; color: var(--ink); border-radius: 0;
}
.paper-form textarea, .report-control textarea { resize: vertical; line-height: 1.5; }
.paper-form small, .optional { color: var(--muted); font-weight: 400; font-size: .75rem; }
.honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.turnstile-wrap { margin: 1.2rem 0; min-height: 65px; }
.form-foot { border-top: 1px solid var(--rule); padding-top: 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.form-foot button, .paper-form > button { padding: .72rem 1rem; }
.identity, .form-policy { color: var(--muted); font-size: .78rem; }
.form-policy { margin-top: 1.2rem; }
.form-error, .notice { margin: 1.2rem 0; border-left: 4px solid var(--red); background: #f2d8cf; padding: .8rem 1rem; }
.notice { border-color: var(--blue); background: #dce8e9; }
.confirmation > p { max-width: 720px; }

.thread-page { max-width: 860px; padding-top: 3.5rem; padding-bottom: 1.5rem; }
.crumbs { display: flex; gap: .55rem; margin-bottom: 3rem; font-size: .78rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.thread-header { border-bottom: 1px solid var(--ink); padding-bottom: 1.5rem; }
.thread-header h1 { font-size: clamp(2.4rem, 6vw, 4.8rem); }
.post-body { font-family: Georgia, "Times New Roman", serif; font-size: 1.12rem; line-height: 1.72; }
.post-body p { margin: 0 0 1.15rem; }
.lead-post { padding: 2rem 0 .8rem; }
.source-link { display: flex; gap: 1rem; align-items: baseline; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: .7rem 0; }
.source-link span { font-family: "Courier New", monospace; font-size: .68rem; font-weight: 800; letter-spacing: .08em; color: var(--red); }
.post-tools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding-top: .9rem; }
.thread-tools { padding-bottom: 1.5rem; }
.inline-form { margin: 0; }
.reaction, .secondary-button { padding: .42rem .62rem; background: transparent; border: 1px solid var(--rule); color: var(--ink); font-size: .76rem; font-weight: 700; }
.reaction:hover, .secondary-button:hover { background: var(--paper-deep); color: var(--ink); }
.report-control { margin-left: auto; position: relative; font-size: .76rem; }
.report-control summary { cursor: pointer; color: var(--muted); }
.report-control form { position: absolute; z-index: 2; right: 0; width: min(340px, 85vw); background: var(--white); border: 1px solid var(--ink); padding: 1rem; box-shadow: 4px 4px 0 var(--ink); }
.report-control label { display: block; font-weight: 700; margin-bottom: .7rem; }
.report-control button { padding: .5rem .65rem; }

.replies, .reply-form { max-width: 860px; }
.reply-heading { border-top: 4px solid var(--ink); border-bottom: 1px solid var(--ink); padding: .85rem 0; display: flex; justify-content: space-between; align-items: baseline; }
.reply-heading h2 { margin: 0; }
.reply { padding: 1.5rem 0; border-bottom: 1px solid var(--rule); }
.reply > header { display: flex; gap: .7rem; align-items: baseline; margin-bottom: .85rem; }
.reply > header span:not(.staff-badge) { color: var(--muted); font-size: .75rem; }
.reply .post-body { font-size: 1rem; }
.empty-replies { padding: 2rem 0; color: var(--muted); border-bottom: 1px solid var(--rule); }
.reply-form { padding-top: 3rem; padding-bottom: 5rem; }
.reply-form h2 { border-top: 4px solid var(--ink); padding-top: .75rem; }
.compact-form { margin-top: 1rem; }

.search-form { display: flex; gap: 0; margin-top: 2rem; }
.search-form input { margin: 0; border-right: 0; }
.search-form button { padding: .65rem 1rem; }
.search-count { color: var(--muted); margin: 2rem 0 .5rem; }
.search-help { margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: 1.5rem; }
.prose-page { max-width: 780px; }
.prose-page h2 { margin-top: 2.5rem; border-top: 1px solid var(--rule); padding-top: .8rem; }
.prose-page > p, .prose-page li { font-family: Georgia, serif; font-size: 1.08rem; line-height: 1.75; }
.rule-list { list-style: none; padding: 0; counter-reset: rules; }
.rule-list li { counter-increment: rules; display: grid; grid-template-columns: 44px 1fr; gap: .7rem; border-top: 1px solid var(--rule); padding: 1.1rem 0; }
.rule-list li::before { content: counter(rules, decimal-leading-zero); color: var(--red); font-family: "Courier New", monospace; font-weight: 800; }
.rule-list strong, .rule-list span { grid-column: 2; }
.rule-list span { color: #494138; }

.admin-title { display: flex; justify-content: space-between; align-items: start; gap: 2rem; }
.admin-item { border-top: 3px solid var(--ink); padding: 1rem 0 2rem; margin-top: 1.5rem; }
.admin-item > header { display: flex; gap: 1rem; color: var(--muted); font-size: .75rem; flex-wrap: wrap; }
.admin-item h2 { margin: .8rem 0; }
.admin-actions { display: flex; justify-content: space-between; align-items: center; }
.admin-actions form { display: flex; gap: .5rem; }
.admin-actions button { padding: .45rem .65rem; }
.admin-actions .danger { background: #2d2924; }

footer { max-width: var(--max); margin: 0 auto; padding: 0 1.5rem 2.5rem; }
.footer-rule { height: 5px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin-bottom: 1.5rem; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 2rem; align-items: start; font-size: .8rem; }
.footer-grid p { margin: 0; }
.fine-print { color: var(--muted); }

@media (max-width: 760px) {
  :root { font-size: 16px; }
  .header-inner { align-items: flex-start; }
  .site-header nav { justify-content: flex-end; gap: .75rem; }
  .site-header nav a:not(.write-link) { display: none; }
  .home-intro { padding-top: 3.5rem; padding-bottom: 3rem; }
  .thread-row { grid-template-columns: 58px minmax(0, 1fr); gap: .75rem; }
  .thread-numbers { grid-column: 2; flex-direction: row; align-items: center; gap: .7rem; }
  .board-heading { align-items: start; flex-direction: column; gap: 1rem; }
  .board-stats { width: 100%; justify-content: space-between; }
  .board-stats div { align-items: start; }
  .participation-note { grid-template-columns: 1fr; }
  .form-foot { align-items: stretch; flex-direction: column; }
  .form-foot button { width: 100%; }
  .report-control { margin-left: 0; }
  .report-control form { left: 0; right: auto; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .header-inner, .home-intro, .board-shell, .participation-note, .form-page, .thread-page, .replies, .reply-form, .search-page, .prose-page, .error-page, .admin-login, .admin-page, footer { padding-left: 1rem; padding-right: 1rem; }
  h1 { font-size: 2.55rem; }
  .thread-row { grid-template-columns: 1fr; }
  .thread-mark, .thread-copy, .thread-numbers { grid-column: 1; }
  .thread-numbers { justify-content: flex-start; flex-wrap: wrap; }
  .search-form { flex-direction: column; gap: .5rem; }
  .search-form input { border-right: 1px solid #8c8172; }
  .search-form button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
