/* Layout guidance from unslop by Damir Sokolovsky (@heydamir), CC BY 4.0. */
:root {
  color-scheme: light;
  --paper: #fff;
  --background: #f8f8f7;
  --ink: #1d2022;
  --secondary: #4f5458;
  --muted: #676c70;
  --line: #e7e7e6;
  --accent: #245a4b;
  --accent-hover: #1c453a;
  --error: #9b352d;
  --inset: 24px;
  font: 100%/1.6 system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.forum {
  width: min(100%, 720px);
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  background: var(--paper);
  border-inline: 1px solid var(--line);
}

.bar {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 60px;
  padding-inline: var(--inset);
  border-bottom: 1px solid var(--line);
}

.home-bar { justify-content: space-between; }
.thread-bar .publish { margin-inline-start: auto; }

h1 { margin: 0; font-size: 1.25rem; font-weight: 600; line-height: 1.4; }
.thread-bar h1:focus:not(:focus-visible) { outline: none; }
.composer { padding: 16px var(--inset) 12px; border-bottom: 1px solid var(--line); }

.composer textarea {
  display: block;
  width: 100%;
  min-height: 80px;
  max-height: 280px;
  margin: 0;
  padding: 4px 0;
  resize: vertical;
  border: 0;
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.125rem;
  line-height: 1.55;
}

.composer textarea::placeholder { color: var(--muted); opacity: 1; }
.composer textarea:focus { outline: none; }
.composer textarea:focus-visible { box-shadow: inset 0 -1px var(--accent); }
.composer-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.count, .feedback { font-size: .875rem; color: var(--muted); }
.count { font-variant-numeric: tabular-nums; }
.feedback { flex: 1; margin: 0; overflow-wrap: anywhere; }
.is-error { color: var(--error); }

.publish {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 80px;
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: .9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.publish:hover:not(:disabled) { background: var(--accent-hover); }
.entry { padding: 16px var(--inset); border-bottom: 1px solid var(--line); }
.entry-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; color: var(--muted); font-size: .875rem; }
.entry-name { color: var(--secondary); font-weight: 600; }
.entry time { font-variant-numeric: tabular-nums; }
.entry-body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.thread-link, .back, .more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--secondary);
  font-size: .875rem;
  text-decoration: none;
}

.thread-link { margin: 0 0 -8px; }
.thread-link:hover, .back:hover, .more:hover { color: var(--accent); text-decoration: underline; }
.more { margin: 8px var(--inset); padding: 0; background: none; border: 0; }
.list-status { margin: 0; padding: 20px var(--inset); color: var(--muted); font-size: .875rem; }
.list-status:empty { display: none; }
.list-status.is-error { color: var(--error); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 720px) {
  :root { --inset: 16px; }
  .forum { border-inline: 0; }
  .bar { min-height: 56px; }
}

@media (prefers-reduced-motion: no-preference) {
  .publish, .thread-link, .back, .more { transition: background-color 140ms ease, color 140ms ease; }
}
