:root {
  --bg: #f8fbff;
  --surface: #ffffff;
  --surface-soft: #edf5ff;
  --line: rgba(11, 61, 140, 0.16);
  --line-strong: rgba(11, 61, 140, 0.28);
  --text: #082a5e;
  --muted: #4d6489;
  --accent: #0b3d8c;
  --accent-strong: #072654;
  --gold: #f2b705;
  --footer: #082a5e;
  --container: 1100px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(237, 245, 255, 0.86) 0%, rgba(248, 251, 255, 1) 200px, #ffffff 520px),
    linear-gradient(90deg, rgba(11, 61, 140, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(11, 61, 140, 0.03) 1px, transparent 1px);
  background-size: auto, 26px 26px, 26px 26px;
  background-position: 0 0, center top, center top;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.container {
  width: min(calc(100% - 32px), var(--container));
  margin: 0 auto;
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 84px;
  padding: 14px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: inline-flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand-copy {
  display: grid;
  gap: 4px;
}

.brand-kicker,
.eyebrow,
.footer-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.brand-kicker,
.eyebrow {
  color: var(--accent);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  font-size: 0.95rem;
  color: var(--muted);
}

.main-nav a:hover,
.topic-link:hover,
.back-link:hover,
.site-footer a:hover {
  color: var(--accent);
}

.header-link {
  padding: 10px 14px;
  border: 1px solid var(--line);
  color: var(--accent);
  background: #fff;
}

main {
  padding: 28px 0 0;
}

.welcome-section,
.topics-section,
.topic-form-section,
.topic-detail-section {
  padding: 0 0 36px;
}

.welcome-block,
.topic-item,
.form-shell,
.topic-detail,
.comment,
.empty-state {
  border: 1px solid var(--line);
  background: var(--surface);
}

.welcome-block {
  padding: 22px 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(237, 245, 255, 0.92));
}

.welcome-block h1,
.section-heading h2,
.form-copy h2,
.topic-detail h1,
.site-footer h2 {
  margin: 12px 0 0;
  line-height: 1.15;
}

.welcome-block h1 {
  max-width: 19ch;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.welcome-copy,
.section-copy,
.topic-summary,
.topic-content,
.topic-detail p,
.comment p,
.site-footer p,
.empty-state p {
  color: var(--muted);
  line-height: 1.72;
}

.section-heading {
  margin-bottom: 14px;
}

.topics-list,
.comments-list {
  display: grid;
  gap: 0;
}

.topic-item {
  padding: 18px 0;
  border-width: 0 0 1px;
}

.topic-item-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.topic-item h3 {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.2;
}

.topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta-divider {
  width: 14px;
  height: 2px;
  margin-top: 0.45rem;
  background: var(--gold);
}

.topic-summary {
  margin: 10px 0 0;
  max-width: 78ch;
}

.topic-item-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-top: 12px;
  padding-top: 0;
  border-top: 0;
}

.reply-count {
  font-size: 0.95rem;
  color: var(--muted);
}

.topic-link,
.back-link {
  font-weight: 700;
  color: var(--accent);
}

.form-shell {
  display: grid;
  gap: 18px;
  padding: 22px 24px;
}

.simple-form {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.simple-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.simple-form input,
.simple-form textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  outline: none;
}

.simple-form input:focus,
.simple-form textarea:focus {
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
}

.button-primary {
  background: var(--accent);
  color: #fff;
}

.button-primary:hover {
  background: var(--accent-strong);
}

.button-subtle {
  padding: 0;
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--accent);
}

.button-subtle:hover {
  color: var(--accent-strong);
}

.form-status {
  margin: 0;
  min-height: 24px;
  color: var(--muted);
}

.topic-page .container {
  display: grid;
  gap: 18px;
}

.back-link {
  display: inline-flex;
  width: fit-content;
}

.topic-detail,
.empty-state {
  padding: 28px;
}

.topic-detail h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.topic-content {
  margin-top: 22px;
  white-space: pre-wrap;
}

.comment {
  padding: 18px 20px;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.empty-state h2 {
  margin: 0 0 10px;
}

.site-footer {
  margin-top: 12px;
  padding: 42px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--footer);
  color: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 220px 240px;
  gap: 24px;
}

.site-footer p,
.site-footer a {
  color: rgba(255, 255, 255, 0.84);
}

.site-footer a {
  display: block;
  margin-top: 10px;
}

.accent-gold {
  color: var(--gold);
}

@media (max-width: 860px) {
  .header-inner,
  .topic-item-header,
  .footer-grid {
    flex-direction: column;
    align-items: start;
  }

  .footer-grid,
  .form-row {
    grid-template-columns: 1fr;
  }

  .topic-item-footer,
  .comment-header,
  .form-actions {
    flex-direction: column;
    align-items: start;
  }
}

@media (max-width: 640px) {
  .welcome-block,
  .form-shell,
  .topic-detail,
  .comment,
  .empty-state {
    padding: 22px;
  }

  .topic-item {
    padding: 16px 0;
  }

  .button,
  .header-link {
    width: 100%;
  }

  .main-nav {
    gap: 12px;
  }
}
