:root {
  --commons-bg: #f6f7f5;
  --commons-panel: rgba(255, 255, 255, 0.72);
  --commons-text: #151918;
  --commons-muted: #66706d;
  --commons-line: rgba(21, 25, 24, 0.12);
  --commons-accent: #178b83;
  --commons-accent-soft: rgba(23, 139, 131, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --commons-bg: #080b0e;
    --commons-panel: rgba(255, 255, 255, 0.035);
    --commons-text: #edf2f0;
    --commons-muted: #99a5a1;
    --commons-line: rgba(255, 255, 255, 0.11);
    --commons-accent: #64d1c5;
    --commons-accent-soft: rgba(100, 209, 197, 0.1);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--commons-text);
  background:
    radial-gradient(circle at 50% 0, var(--commons-accent-soft), transparent 34rem),
    var(--commons-bg);
}

main {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(68px, 11vw, 120px) 0 96px;
}

.commons-intro { max-width: 650px; }
.commons-intro .eyebrow {
  margin: 0 0 16px;
  color: var(--commons-accent);
  font: 600 0.76rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.commons-intro h1 {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.commons-intro > p:last-child {
  max-width: 580px;
  margin: 24px 0 0;
  color: var(--commons-muted);
  font-size: clamp(1.04rem, 2.4vw, 1.27rem);
  line-height: 1.55;
}

.commons-tools {
  display: flex;
  gap: 12px;
  margin: 56px 0 0;
}

.commons-tools form {
  display: flex;
  flex: 1;
  min-width: 0;
  border: 1px solid var(--commons-line);
  border-radius: 14px;
  background: var(--commons-panel);
  overflow: hidden;
}

.commons-tools input {
  min-width: 0;
  flex: 1;
  border: 0;
  padding: 14px 16px;
  color: inherit;
  background: transparent;
  font: inherit;
  outline: none;
}

.commons-tools form:focus-within { border-color: var(--commons-accent); }

.commons-tools button,
.section-head button {
  border: 0;
  color: var(--commons-accent);
  background: transparent;
  font: 600 0.88rem/1 inherit;
  cursor: pointer;
}

.commons-tools form button { padding: 0 16px; }
.commons-tools .watch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  border: 1px solid var(--commons-line);
  border-radius: 14px;
  padding: 0 16px;
  color: var(--commons-text);
  background: var(--commons-panel);
}

.watch[aria-pressed="true"] {
  border-color: var(--commons-accent);
  color: var(--commons-accent);
}

.watch[aria-pressed="true"] > span:first-child {
  animation: watch-pulse 1.8s ease-in-out infinite;
}

@keyframes watch-pulse { 50% { opacity: 0.3; } }

.watch-status {
  min-height: 1.4em;
  margin: 10px 2px 36px;
  color: var(--commons-muted);
  font-size: 0.82rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--commons-line);
}

.section-head h2 {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.thread { padding: 26px 0 28px; border-bottom: 1px solid var(--commons-line); }
.thread-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--commons-muted);
  font-size: 0.78rem;
}

.thread-meta .board { color: var(--commons-accent); }
.thread h3 { margin: 0; font-size: clamp(1.2rem, 3vw, 1.5rem); letter-spacing: -0.02em; }
.thread h3 button {
  border: 0;
  padding: 0;
  color: inherit;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.thread .content {
  margin: 12px 0 0;
  color: var(--commons-muted);
  line-height: 1.62;
  white-space: pre-wrap;
}
.thread .author { margin: 14px 0 0; font-size: 0.79rem; color: var(--commons-muted); }
.reply { margin-left: clamp(18px, 5vw, 46px); }
.reply h3 { font-size: 0.78rem; color: var(--commons-accent); letter-spacing: 0.06em; text-transform: uppercase; }
.loading, .empty { padding: 36px 0; color: var(--commons-muted); }

.contribute {
  margin-top: 72px;
  padding-top: 28px;
  border-top: 1px solid var(--commons-line);
  color: var(--commons-muted);
  line-height: 1.5;
}
.contribute p { margin: 0 0 8px; }
.contribute strong { color: var(--commons-text); }
.contribute a { color: var(--commons-accent); }

.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;
}

@media (max-width: 560px) {
  main { width: min(100% - 28px, 760px); padding-top: 54px; }
  .commons-tools { align-items: stretch; flex-direction: column; }
  .commons-tools .watch { min-height: 48px; justify-content: center; }
  .watch-status { margin-bottom: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .watch[aria-pressed="true"] > span:first-child { animation: none; }
}
