:root {
  --forum-ink: #17211b;
  --forum-muted: #6d776f;
  --forum-green: #0d6336;
  --forum-green-dark: #084829;
  --forum-green-soft: #edf5ef;
  --forum-cream: #f5f1e8;
  --forum-line: #dfe4df;
  --forum-red: #ae2f28;
}

body { background: #f3f4f6; color: var(--forum-ink); }
.forum-page { width: 100%; padding: 58px 0 48px; }
.forum-shell { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.forum-hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--forum-line); }
.forum-kicker { color: var(--forum-red); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.forum-hero h1 { margin: 3px 0 8px; font: 800 34px/1.15 Georgia, "Noto Serif SC", serif; }
.forum-hero p { max-width: 720px; margin: 0; color: var(--forum-muted); font-size: 14px; line-height: 1.65; }
.forum-hero__home { flex: 0 0 auto; color: var(--forum-green); text-decoration: none; font-size: 13px; }
.forum-hero__home:hover { color: var(--forum-green-dark); }

.forum-category-nav { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; padding: 14px 16px; background: var(--forum-cream); border: 1px solid #e3ddd0; }
.forum-category-nav__label { flex: 0 0 auto; color: var(--forum-green-dark); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.forum-category-nav__scroll { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center; gap: 7px; min-width: 0; overflow: visible; }
.forum-category-nav__scroll::-webkit-scrollbar, .forum-subnav::-webkit-scrollbar { display: none; }
.forum-category-chip { flex: 0 0 auto; padding: 7px 11px; border: 1px solid #d8d2c6; border-radius: 999px; color: #536057; background: rgba(255,255,255,.72); text-decoration: none; white-space: nowrap; font-size: 12px; transition: background .15s, color .15s, border-color .15s; }
.forum-category-chip:hover { color: var(--forum-green); border-color: var(--forum-green); }
.forum-category-chip.is-active { color: #fff; border-color: var(--forum-green); background: var(--forum-green); }

.forum-dynamic-content { transition: opacity .2s; }
.forum-dynamic-content.htmx-request, .htmx-request .forum-dynamic-content { opacity: .55; }
.forum-toolbar { display: flex; align-items: stretch; justify-content: space-between; min-height: 54px; background: #fff; border: 1px solid var(--forum-line); border-bottom: 2px solid var(--forum-green); }
.forum-subnav { display: flex; align-items: stretch; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.forum-subnav__link, .forum-subnav__title { display: inline-flex; flex: 0 0 auto; align-items: center; padding: 0 17px; color: var(--forum-muted); text-decoration: none; font-size: 13px; }
.forum-subnav__link { border-bottom: 3px solid transparent; margin-bottom: -2px; }
.forum-subnav__link:hover { color: var(--forum-green); background: #f6f8f5; }
.forum-subnav__link.is-active { color: var(--forum-green); border-bottom-color: var(--forum-green); font-weight: 800; }
.forum-subnav__title { color: var(--forum-ink); font: 800 18px/1.2 Georgia, "Noto Serif SC", serif; }
.forum-toolbar__actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 8px 10px; border-left: 1px solid var(--forum-line); }
.forum-search-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; color: var(--forum-muted); text-decoration: none; font-size: 12px; }
.forum-search-link:hover { color: var(--forum-green); }
.forum-publish-button { padding: 8px 15px; border-radius: 3px; color: #fff; background: var(--forum-green); text-decoration: none; font-size: 13px; font-weight: 700; }
.forum-publish-button:hover { background: var(--forum-green-dark); }
.forum-description { display: flex; gap: 12px; padding: 11px 16px; color: var(--forum-muted); background: #fafbf9; border: 1px solid var(--forum-line); border-top: 0; font-size: 12px; line-height: 1.6; }
.forum-description strong { flex: 0 0 auto; color: var(--forum-green-dark); }

.forum-list-card { min-height: 420px; overflow: hidden; background: #fff; border: 1px solid var(--forum-line); box-shadow: 0 12px 32px rgba(33,51,40,.06); }
.forum-topic-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.forum-topic-row { position: relative; display: grid; grid-template-columns: 28px minmax(0,1fr) 60px; align-items: center; gap: 10px; min-width: 0; padding: 11px 15px; border-bottom: 1px solid #e9ede9; transition: background .15s; }
.forum-topic-row:nth-child(odd) { border-right: 1px solid #e9ede9; }
.forum-topic-row:hover { background: #f4f8f4; }
.forum-topic-row::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--forum-green); transform: scaleY(0); transition: transform .15s; }
.forum-topic-row:hover::before { transform: scaleY(1); }
.forum-topic-row__index,
.forum-topic-row:nth-child(-n+3) .forum-topic-row__index { color: #2b8d2b; font: 700 14px/1.5 Georgia, serif; }
.forum-topic-row__body { min-width: 0; }
.forum-topic-row__headline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.forum-topic-row__labels { display: flex; flex: 0 1 auto; align-items: center; gap: 5px; min-width: 0; overflow: hidden; }
.forum-topic-row__category { display: block; overflow: hidden; max-width: 92px; color: var(--forum-green); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.forum-topic-row__category:hover { text-decoration: underline; }
.forum-topic-row__title { flex: 1 1 auto; min-width: 0; margin: 0; overflow: hidden; font: 700 15px/1.4 Georgia, "Noto Serif SC", serif; }
.forum-topic-row__title a { display: block; overflow: hidden; color: var(--forum-ink); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.forum-topic-row__title a:visited { color: #664b49; }
.forum-topic-row__title a:hover { color: var(--forum-green); }
.forum-topic-row__title.is-promoted { font-weight: 800; }
.forum-topic-row__title.color-red a { color: #b42318; }
.forum-topic-row__title.color-gold a { color: #9a6700; }
.forum-topic-row__title.color-blue a { color: #175cd3; }
.forum-topic-row__meta { display: flex; gap: 12px; margin-top: 6px; color: #8b948d; font-size: 11px; }
.forum-topic-row__meta span + span::before { content: "·"; margin-right: 12px; color: #c4cac5; }
.forum-topic-row__stats { display: flex; align-items: baseline; justify-content: flex-end; flex-wrap: wrap; column-gap: 3px; padding-top: 0; white-space: nowrap; }
.forum-topic-row__stats strong { color: var(--forum-green); font: 800 18px/1 Georgia, serif; }
.forum-topic-row__stats span { color: var(--forum-muted); font-size: 10px; }
.forum-topic-row__stats small { flex-basis: 100%; margin-top: 6px; color: #a0a8a2; text-align: right; font-size: 10px; }
.forum-badge { flex: 0 0 auto; padding: 2px 5px; border-radius: 2px; font-size: 9px; font-weight: 800; letter-spacing: .03em; }
.forum-badge--red { color: #9d2823; background: #fbe9e7; }
.forum-badge--green { color: #075a31; background: #e5f2e9; }
.forum-badge--gold { color: #785600; background: #f8ebbd; }
.forum-badge--amber { color: #91410d; background: #fff0dd; }
.forum-empty { grid-column: 1 / -1; padding: 70px 20px; color: var(--forum-muted); text-align: center; }

.forum-pager { display: flex; justify-content: center; }
.forum-pager--top { display: none; }
.forum-pager ul.paginator { display: flex !important; justify-content: center; gap: 6px; margin: 22px 0 0; padding: 0; list-style: none; }
.forum-pager .paginator__button a, .forum-pager .paginator__button span { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--forum-line); border-radius: 3px; color: #4c584f; background: #fff; text-decoration: none; font-size: 12px; }
.forum-pager .paginator__button a:hover { color: var(--forum-green); border-color: var(--forum-green); background: var(--forum-green-soft); }
.forum-pager .paginator__button span { color: #fff; border-color: var(--forum-green); background: var(--forum-green); font-weight: 800; }

@media (min-width: 760px) {
  .forum-pager--top { display: flex; min-height: 22px; }
  .forum-pager--top ul.paginator { margin: 0 0 12px; }
}

@media (max-width: 760px) {
  .forum-page { padding: 48px 0 34px; }
  .forum-shell { width: min(100% - 20px, 1180px); }
  .forum-hero { align-items: start; flex-direction: column; margin-bottom: 16px; padding-bottom: 15px; }
  .forum-hero h1 { font-size: 27px; }
  .forum-hero__home { display: none; }
  .forum-category-nav { align-items: start; flex-direction: column; gap: 8px; margin-bottom: 11px; padding: 11px 12px; }
  .forum-category-nav__scroll { width: 100%; }
  .forum-toolbar { min-height: 48px; }
  .forum-subnav__link, .forum-subnav__title { padding-inline: 12px; }
  .forum-toolbar__actions { padding: 6px; }
  .forum-search-link span { display: none; }
  .forum-publish-button { padding: 7px 10px; font-size: 12px; }
  .forum-description { display: block; padding: 9px 12px; }
  .forum-description strong { display: block; margin-bottom: 2px; }
  .forum-topic-list { grid-template-columns: 1fr; }
  .forum-topic-row { grid-template-columns: 23px minmax(0,1fr) 50px; gap: 7px; padding: 10px 9px; }
  .forum-topic-row:nth-child(odd) { border-right: 0; }
  .forum-topic-row__headline { gap: 6px; }
  .forum-topic-row__category { max-width: 64px; }
  .forum-topic-row__title { font-size: 14px; }
  .forum-topic-row__stats { padding-top: 0; }
}

/* Forum landing page */
.forum-landing { width: 100%; background: #f3f4f6; }
.forum-landing > .forum-shell { padding-block: 32px 56px; }
.forum-landing-hero { padding: 26px 30px 28px; color: #fff; background: linear-gradient(115deg, var(--forum-green-dark), #174f32); }
.forum-landing-hero nav { display: flex; gap: 7px; margin-bottom: 24px; color: rgba(255,255,255,.62); font-size: 11px; }
.forum-landing-hero nav a { color: inherit; text-decoration: none; }
.forum-landing-hero .forum-kicker { color: #e9c86f; }
.forum-landing-hero h1 { margin: 4px 0 8px; font: 800 34px/1.15 Georgia, "Noto Serif SC", serif; }
.forum-landing-hero p { max-width: 790px; margin: 0; color: rgba(255,255,255,.76); font-size: 14px; line-height: 1.75; }
.forum-filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 14px 18px; border: 1px solid #e3ddd0; background: var(--forum-cream); }
.forum-filter-bar strong { margin-right: 5px; color: var(--forum-green-dark); font-size: 12px; }
.forum-filter-bar a { padding: 6px 10px; border: 1px solid #d8d2c6; border-radius: 999px; color: #59635c; background: rgba(255,255,255,.7); text-decoration: none; font-size: 11px; }
.forum-filter-bar a:hover, .forum-filter-bar a.is-active { color: #fff; border-color: var(--forum-green); background: var(--forum-green); }
.forum-overview { margin-top: 34px; }
.forum-section-title { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.forum-section-title h2 { margin: 3px 0 0; font: 800 27px/1.2 Georgia, "Noto Serif SC", serif; }
.forum-section-title > a { color: var(--forum-green); text-decoration: none; font-size: 12px; }
.forum-board-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border: 1px solid var(--forum-line); background: #fff; }
.forum-board-card { min-width: 0; padding: 16px 18px; border-right: 1px solid var(--forum-line); border-bottom: 1px solid var(--forum-line); }
.forum-board-card:nth-child(4n) { border-right: 0; }
.forum-board-card:nth-last-child(-n+4) { border-bottom: 0; }
.forum-board-card h3 { margin: 0; font: 800 18px/1.3 Georgia, "Noto Serif SC", serif; }
.forum-board-card h3 a { color: var(--forum-ink); text-decoration: none; }
.forum-board-card h3 a:hover { color: var(--forum-green); }
.forum-board-card__heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.forum-board-card__heading h3 { flex: 0 1 auto; min-width: 0; }
.forum-board-card__counts { display: flex; flex: 0 0 auto; gap: 9px; font-size: 10px; white-space: nowrap; }
.forum-board-card__counts strong { color: var(--forum-red); }
.forum-board-card__counts span { color: var(--forum-muted); }
.forum-board-card p { margin: 10px 0 0; overflow: hidden; color: #778078; font-size: 11px; line-height: 1.7; text-overflow: ellipsis; white-space: nowrap; }
.forum-board-card p a { color: inherit; text-decoration: none; }
.forum-landing-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 26px; margin-top: 34px; align-items: start; }
.forum-section-feed, .forum-side-card { background: #fff; border: 1px solid var(--forum-line); }
.forum-panel-title, .forum-side-card__title { padding: 17px 20px 13px; border-bottom: 2px solid var(--forum-green); }
.forum-panel-title h2, .forum-side-card__title h2 { margin: 0; font: 800 19px/1.3 Georgia, "Noto Serif SC", serif; }
.forum-section-group { padding: 19px 21px 16px; border-bottom: 1px solid var(--forum-line); }
.forum-section-group:last-child { border-bottom: 0; }
.forum-section-group__heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 8px; }
.forum-section-group__heading h3 { margin: 0; color: var(--forum-green-dark); font: 800 15px/1.3 Georgia, "Noto Serif SC", serif; }
.forum-section-group__heading > a { color: var(--forum-green); text-decoration: none; font-size: 11px; }
.forum-section-group ul, .forum-side-card ul, .forum-side-card ol, .forum-activity ul { margin: 0; padding: 0; list-style: none; }
.forum-section-group li { padding: 7px 0; }
.forum-section-group li > a { display: block; overflow: hidden; color: var(--forum-ink); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.forum-section-group li > a:hover { color: var(--forum-green); }
.forum-section-group li small { display: block; margin-top: 3px; color: #929a94; font-size: 10px; }
.forum-landing-sidebar { display: grid; gap: 18px; }
.forum-side-card { padding-bottom: 12px; }
.forum-side-card li { display: flex; gap: 7px; padding: 9px 17px; border-bottom: 1px solid #edf0ed; min-width: 0; }
.forum-side-card li:last-child { border-bottom: 0; }
.forum-side-card li > span { color: var(--forum-red); font: 700 12px Georgia, serif; }
.forum-side-card li a { flex: 1; overflow: hidden; color: #455149; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.forum-side-card li a:hover { color: var(--forum-green); }
.forum-side-card li small { flex: 0 0 auto; color: #9aa19c; font-size: 9px; }
.forum-landing-tags { display: flex; flex-wrap: wrap; gap: 7px; padding: 14px 16px 3px; }
.forum-landing-tags a { padding: 6px 9px; color: #566159; background: #f1f4f1; text-decoration: none; font-size: 11px; }
.forum-landing-tags a:hover { color: #fff; background: var(--forum-green); }
.forum-activity { margin-top: 36px; }
.forum-activity-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border: 1px solid var(--forum-line); background: #fff; }
.forum-activity-grid article { min-width: 0; padding-bottom: 14px; border-right: 1px solid var(--forum-line); }
.forum-activity-grid article:last-child { border-right: 0; }
.forum-activity-grid h3 { margin: 0 0 8px; padding: 15px 18px 12px; border-bottom: 2px solid var(--forum-green); font: 800 16px/1.3 Georgia, "Noto Serif SC", serif; }
.forum-activity-grid li { padding: 7px 18px; min-width: 0; }
.forum-activity-grid a { display: block; overflow: hidden; color: #465149; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.forum-activity-grid a:hover { color: var(--forum-green); }
.forum-activity-grid a span { color: var(--forum-green); }

@media (max-width: 900px) {
  .forum-board-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .forum-board-card, .forum-board-card:nth-child(4n) { border-right: 1px solid var(--forum-line); border-bottom: 1px solid var(--forum-line); }
  .forum-board-card:nth-child(even) { border-right: 0; }
  .forum-board-card:nth-last-child(-n+2) { border-bottom: 0; }
  .forum-landing-layout { grid-template-columns: 1fr; }
  .forum-landing-sidebar { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 600px) {
  .forum-landing > .forum-shell { padding-block: 12px 38px; }
  .forum-landing-hero { padding: 22px 19px 24px; }
  .forum-landing-hero h1 { font-size: 28px; }
  .forum-filter-bar { flex-wrap: nowrap; overflow-x: auto; }
  .forum-filter-bar > * { flex: 0 0 auto; }
  .forum-board-grid, .forum-activity-grid { grid-template-columns: 1fr; }
  .forum-board-card, .forum-board-card:nth-child(even), .forum-board-card:nth-child(4n), .forum-board-card:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--forum-line); }
  .forum-board-card:last-child { border-bottom: 0; }
  .forum-landing-sidebar { grid-template-columns: 1fr; }
  .forum-activity-grid article { border-right: 0; border-bottom: 1px solid var(--forum-line); }
  .forum-activity-grid article:last-child { border-bottom: 0; }
}

/* Category detail */
.forum-category-page { width: 100%; padding: 30px 0 48px; background: #f3f4f6; }
.forum-category-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 18px; color: #fff; background: var(--forum-green-dark); }
.forum-category-heading__identity { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.forum-category-heading nav { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.forum-category-heading nav a { color: rgba(255,255,255,.72); text-decoration: none; }
.forum-category-heading__identity > span { color: rgba(255,255,255,.66); font-size: 11px; }
.forum-category-heading > a { flex: 0 0 auto; color: #e9c86f; text-decoration: none; font-size: 11px; }
.forum-category-subnav { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 13px 16px; border: 1px solid #e3ddd0; border-top: 0; background: var(--forum-cream); }
.forum-category-subnav strong, .forum-category-tools nav strong, .forum-topic-type strong { margin-right: 4px; color: var(--forum-green-dark); font-size: 11px; }
.forum-category-subnav a, .forum-category-tools nav a, .forum-topic-type span { padding: 6px 10px; border: 1px solid #d8d2c6; border-radius: 999px; color: #111; background: #fff; text-decoration: none; font-size: 12px; }
.forum-category-subnav a:hover, .forum-category-subnav a.is-active, .forum-category-tools nav a:hover, .forum-category-tools nav a.is-active, .forum-topic-type span.is-active { color: #fff; border-color: var(--forum-green); background: var(--forum-green); }
.forum-category-topics { margin-top: 20px; }
.forum-category-tools { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 55px; padding: 8px 10px 8px 16px; border: 1px solid var(--forum-line); border-bottom: 2px solid var(--forum-green); background: #fff; }
.forum-category-tools nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.forum-category-tools__actions { display: flex; align-items: center; flex: 0 0 auto; gap: 5px; }
.forum-topic-type { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 10px 16px; border: 1px solid var(--forum-line); border-top: 0; background: #fafbf9; }
.forum-topic-type small { color: #929a94; font-size: 10px; }
.forum-category-topics .forum-list-card { border-top: 0; }

@media (max-width: 700px) {
  .forum-category-page { padding: 14px 0 36px; }
  .forum-category-heading { align-items: flex-start; padding: 13px 14px; }
  .forum-category-heading__identity { gap: 7px 12px; }
  .forum-category-heading > a { display: none; }
  .forum-category-subnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .forum-category-subnav > * { flex: 0 0 auto; }
  .forum-category-tools { align-items: stretch; flex-direction: column; padding: 10px; }
  .forum-category-tools nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .forum-category-tools nav > * { flex: 0 0 auto; }
  .forum-category-tools__actions { justify-content: flex-end; }
}
