/* forum — page-specific styles on top of /assets/home.css */

.site-header { padding-bottom: 28px; }

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.forum-hero { padding-bottom: 28px; }

.forum-hero h1 { margin-bottom: 12px; }

.forum-hero p { max-width: 62ch; }

/* ---------- account in the header ---------- */

.forum-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 6px;
  border-left: 1px solid var(--line);
}

.account-name {
  font-size: 0.8125rem;
  font-weight: 600;
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-form { margin: 0; }

.link-button {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-button:hover { color: var(--fg); }

/* ---------- buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.button:hover { background: var(--card-hover); border-color: color-mix(in srgb, var(--fg) 22%, var(--line)); }
.button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.button-primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, var(--bg));
  border-color: transparent;
}

.button-quiet { padding: 6px 12px; font-size: 0.8125rem; }

/* ---------- notices ---------- */

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 0.9375rem;
  color: var(--fg);
}

.notice p, .notice ul { margin: 0; }
.notice ul { padding-left: 18px; }
.notice li { margin: 2px 0; }

.notice-bad { border-color: #d9b3ab; background: #fdf4f2; color: #8a2f1d; }
.notice-ok { border-color: #bcd6c2; background: #f2f9f3; color: #22573a; }
.notice-dev { border-color: #d8c8a6; background: #fdf8ec; color: #6b5320; }
.notice-quiet { color: var(--muted); }

@media (prefers-color-scheme: dark) {
  .notice-bad { border-color: #5b2f26; background: #241512; color: #f0b1a2; }
  .notice-ok { border-color: #2a4433; background: #12201a; color: #a6d9b8; }
  .notice-dev { border-color: #4a3f22; background: #1f1b10; color: #e3cc95; }
}

.notice code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
}

/* ---------- forms ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 640px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field > span {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.field textarea { resize: vertical; min-height: 96px; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--fg);
  outline-offset: 1px;
  border-color: transparent;
}

.field-code input {
  max-width: 190px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.25rem;
  letter-spacing: 0.4em;
  text-align: center;
  padding-left: 0.4em;
}

.form .button { align-self: flex-start; }

/* ---------- new topic composer ---------- */

.composer {
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}

.composer > summary {
  padding: 14px 18px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.composer > summary::-webkit-details-marker { display: none; }

.composer > summary::before {
  content: "+";
  display: inline-block;
  width: 1.1em;
  color: var(--muted);
}

.composer[open] > summary::before { content: "–"; }
.composer[open] > summary { border-bottom: 1px solid var(--line); }

.composer .form { padding: 18px; }

.composer > summary:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; }

/* ---------- topic list ---------- */

.topic-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.topic-row { border-bottom: 1px solid var(--line); }

.topic-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 4px;
  color: inherit;
  text-decoration: none;
  transition: background-color .18s ease;
}

.topic-link:hover { background: color-mix(in srgb, var(--badge-bg) 60%, transparent); }
.topic-link:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; }

.topic-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.topic-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.topic-meta {
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  flex: none;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-fg);
}

.chip-bug { background: #f6e3dc; color: #8a3a22; }
.chip-idea { background: var(--badge-bg); color: var(--badge-fg); }

@media (prefers-color-scheme: dark) {
  .chip-bug { background: #3a211a; color: #e7a58f; }
}

.empty {
  color: var(--muted);
  font-size: 0.9375rem;
  padding: 18px 0;
}

.crumb { margin: 0 0 16px; font-size: 0.8125rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--fg); }

/* ---------- topic page ---------- */

.post { margin: 0 0 32px; }

.post-head h1 {
  margin: 8px 0 8px;
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.post-meta {
  margin: 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--muted);
}

.post-body {
  margin-top: 14px;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--fg);
  overflow-wrap: anywhere;
}

.replies h2 {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.reply-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  border-top: 1px solid var(--line);
}

.reply {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.reply:target { background: color-mix(in srgb, var(--badge-bg) 55%, transparent); }

.form-reply {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* ---------- login ---------- */

.auth {
  max-width: 460px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.auth h1 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  letter-spacing: -0.03em;
}

.auth-lead {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.auth-sent {
  margin: 0 0 18px;
  font-size: 0.9375rem;
  color: var(--fg);
  line-height: 1.55;
}

.auth-alt {
  margin: 18px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.55;
}

.auth-alt a { color: var(--fg); text-underline-offset: 3px; }

@media (max-width: 560px) {
  .site-header { padding-bottom: 20px; }
  .forum-account { border-left: 0; padding-left: 0; }
  .account-name { display: none; }
  .auth { padding: 20px; }
  .composer .form { padding: 16px; }
}

/* ---------- shell: sidebar + content ---------- */

body.forum .page { max-width: 1080px; }

.forum-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.forum-main { min-width: 0; }

.forum-sidebar {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
}

.side-cta { width: 100%; margin-bottom: 14px; }

.side-nav { display: flex; flex-direction: column; gap: 1px; }

.side-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
  transition: background-color .15s ease, color .15s ease;
}

.side-link:hover { background: var(--badge-bg); color: var(--fg); }
.side-link:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }
.side-link[aria-current="page"] { background: var(--badge-bg); color: var(--fg); font-weight: 600; }

.side-count {
  flex: none;
  min-width: 20px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.6875rem;
  text-align: center;
}

.side-label {
  margin: 16px 0 4px;
  padding: 0 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.side-admin { margin-top: 2px; color: var(--fg); font-size: 0.8125rem; }

.side-foot {
  margin: 20px 0 0;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

/* ---------- index heading ---------- */

.forum-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 4px 0 22px;
  border-bottom: 1px solid var(--line);
}

.forum-head h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.forum-head p { margin: 0; max-width: 62ch; color: var(--muted); font-size: 0.9375rem; }
.forum-head .eyebrow { margin-bottom: 10px; }

/* The sidebar already carries the call to action on wide screens; the head
   button takes over once the sidebar moves below the content. */
.forum-head-cta { display: none; flex: none; }

.forum-login { margin-top: 26px; }

/* ---------- panels, steps, choices ---------- */

.panel {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.panel h1 {
  margin: 0 0 10px;
  font-size: clamp(1.4rem, 3.4vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.panel-text { margin: 0 0 20px; max-width: 60ch; color: var(--muted); font-size: 0.9375rem; }
.panel-compose { padding: 24px; }

.steps {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.steps li { display: flex; align-items: center; gap: 8px; }

.steps li span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  font-size: 0.6875rem;
  font-weight: 600;
}

.steps li.is-current { color: var(--fg); font-weight: 600; }
.steps li.is-current span { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.steps li.is-done span { background: var(--badge-bg); color: var(--fg); }

.field-choices { border: 0; padding: 0; margin: 0; display: block; }

.field-choices legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.choices {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 4px;
}

.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}

.choice:hover { border-color: color-mix(in srgb, var(--fg) 20%, var(--line)); }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--fg); outline-offset: 4px; border-radius: 4px; }
.choice-body { display: flex; flex-direction: column; gap: 2px; }
.choice-title { font-size: 0.875rem; font-weight: 600; }
.choice-desc { font-size: 0.8125rem; color: var(--muted); line-height: 1.45; }
.choice input:checked + .choice-body .choice-title::after { content: " ✓"; }
.choice:has(input:checked) { border-color: var(--fg); background: color-mix(in srgb, var(--badge-bg) 70%, var(--card)); }

.compose-tool {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--muted);
}

.compose-tool strong { color: var(--fg); }
.compose-tool a { color: var(--fg); font-size: 0.8125rem; text-underline-offset: 3px; }

.form-wide, .form-reply { max-width: none; }

/* ---------- post editor ---------- */

.editor {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
}

.editor-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--badge-bg) 60%, var(--card));
}

.editor-bar button,
.editor-upload > span {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.6;
  padding: 4px 9px;
  border-radius: 7px;
  cursor: pointer;
}

.editor-bar button:hover,
.editor-upload > span:hover { background: var(--card); color: var(--fg); }

.editor-bar button:focus-visible,
.editor-upload > span:focus-within { outline: 2px solid var(--fg); outline-offset: 1px; }

.editor-bar code { font-size: 0.75rem; }
.editor-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line); }
.editor-upload { display: inline-flex; }
.editor-upload input { display: none; }
.editor-status { margin-left: auto; color: var(--muted); font-size: 0.75rem; }

.editor-body {
  display: block;
  width: 100%;
  min-height: 150px;
  padding: 12px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.editor-body:focus { outline: 2px solid var(--fg); outline-offset: -2px; }

.editor-body:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

/* what the composer shows while you type */

.editor-body p { margin: 0 0 0.8em; }
.editor-body p:last-child { margin-bottom: 0; }
.editor-body strong, .editor-body b { font-weight: 650; }
.editor-body a { color: inherit; text-underline-offset: 3px; }

.editor-body ul,
.editor-body ol { margin: 0 0 0.8em; padding-left: 1.4em; }
.editor-body li { margin: 0 0 0.2em; }

.editor-body blockquote {
  margin: 0 0 0.8em;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.editor-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--badge-bg);
}

.editor-body pre {
  margin: 0 0 0.8em;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--badge-bg);
  overflow-x: auto;
}

.editor-body pre code { padding: 0; background: none; font-size: 0.8125rem; }

.editor-body h1,
.editor-body h2,
.editor-body h3 { margin: 1em 0 0.45em; line-height: 1.3; letter-spacing: -0.02em; }
.editor-body h1 { font-size: 1.3rem; }
.editor-body h2 { font-size: 1.15rem; }
.editor-body h3 { font-size: 1rem; }

.editor-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--badge-bg);
}

.editor-body del { opacity: .7; }

.editor-hint {
  margin: 0;
  padding: 0 14px 10px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

/* ---------- chips, follow button ---------- */

.chip-announcement { background: #f6ecd8; color: #7a5512; }
.chip-general { background: var(--badge-bg); color: var(--badge-fg); }
.chip-feature { background: #e4ebf8; color: #244a83; }

.chip-tool {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-weight: 550;
  text-decoration: none;
}

a.chip-tool:hover { color: var(--fg); border-color: var(--muted); }
.chip-admin { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--fg); }

@media (prefers-color-scheme: dark) {
  .chip-announcement { background: #3a2f16; color: #e8cd91; }
  .chip-feature { background: #1b2738; color: #a9c6ee; }
}

.post-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }

.follow-form { margin: 0 0 28px; }
.button-small { padding: 6px 12px; font-size: 0.8125rem; }

.button.is-on {
  background: var(--badge-bg);
  border-color: color-mix(in srgb, var(--fg) 25%, var(--line));
  color: var(--fg);
}

/* ---------- formatted post content ---------- */

.post-body p { margin: 0 0 0.85em; }
.post-body p:last-child { margin-bottom: 0; }
.post-body strong { font-weight: 650; }
.post-body a { color: inherit; text-underline-offset: 3px; }
.post-body ul,
.post-body ol { margin: 0 0 0.85em; padding-left: 1.4em; }
.post-body li { margin: 0 0 0.25em; }

.post-body blockquote {
  margin: 0 0 0.85em;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--badge-bg);
}

.post-body pre {
  margin: 0 0 0.85em;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--badge-bg);
  overflow-x: auto;
}

.post-body pre code { padding: 0; background: none; font-size: 0.8125rem; }

.post-body h1,
.post-body h2,
.post-body h3 { margin: 1.1em 0 0.5em; line-height: 1.3; letter-spacing: -0.02em; }
.post-body h1 { font-size: 1.3rem; }
.post-body h2 { font-size: 1.15rem; }
.post-body h3 { font-size: 1rem; }

.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--badge-bg);
}

.post-body del { opacity: .7; }
.reply .post-body { margin-top: 8px; }

@media (max-width: 900px) {
  .forum-shell { grid-template-columns: 1fr; gap: 26px; }
  .forum-main { order: 1; }
  .forum-head-cta { display: inline-flex; }
  .forum-sidebar {
    order: 2;
    position: static;
    padding-top: 20px;
    border-top: 1px solid var(--line);
  }
  .side-cta { display: none; }
  .forum-sidebar .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-label { margin-top: 10px; }
  .side-foot { display: none; }
}

@media (max-width: 560px) {
  .forum-head-cta { width: 100%; }
  .panel, .panel-compose { padding: 18px; }
  .steps { gap: 14px; }
  .choices { grid-template-columns: 1fr; }
  .editor-status { width: 100%; margin: 4px 0 0; }
}
