/* Tweaks on top of water.css. Mobile-first. */

body { max-width: 48rem; padding-inline: 1rem; }

header nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  min-width: 0;
}
header nav .brand { text-decoration: none; flex-shrink: 0; }
header nav .spacer { flex: 1; min-width: 0; }
header nav .me {
  opacity: 0.85;
  font-size: 0.9em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
header nav button {
  margin: 0;
  padding: 0.2rem 0.6rem;
  font-size: 0.9em;
  line-height: 1.4;
  flex-shrink: 0;
}
header nav form.inline { flex-shrink: 0; }

form.inline { display: inline; margin: 0; }
form.inline button { margin: 0; }

.list-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}
.list-header h1 { margin: 0; }
.list-header .cta { white-space: nowrap; }
.list-header .title-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  min-width: 0;
}
.list-header nav.sort { font-size: 0.9em; border-bottom: 0; }
.list-header nav.sort a,
.list-header nav.sort a:hover,
.list-header nav.sort a:focus,
.list-header nav.sort a:active,
.list-header nav.sort a:visited { text-decoration: none; }
.list-header nav.sort a { opacity: 0.55; }
.list-header nav.sort a.on { opacity: 1; font-weight: 600; }

.empty { opacity: 0.7; font-style: italic; }

.error {
  color: white;
  background: #c0392b;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
}

ul.topics { list-style: none; padding: 0; margin: 0; }
ul.topics li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
ul.topics li a { display: block; color: inherit; }
ul.topics li a:hover { text-decoration: none; }
ul.topics li .title { color: var(--links); font-weight: 600; }
.meta {
  display: block;
  font-size: 0.85em;
  opacity: 0.7;
  margin-top: 0.15rem;
}

ul.topics li.unread .title::before {
  content: "•";
  margin-right: 0.4rem;
  color: var(--links);
}

.post {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.post-meta {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  font-size: 0.9em;
  margin-bottom: 0.4rem;
}
.post-meta > *:not(strong) { opacity: 0.65; }
.post-meta > *:not(strong):hover { opacity: 1; }
.post-body > :first-child { margin-top: 0; }
.post-body > :last-child { margin-bottom: 0; }
.post-body code { background: var(--background-alt); padding: 0.05em 0.3em; border-radius: 3px; }
.post-body pre { padding: 0.75rem; overflow-x: auto; }

.post-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.9em;
}
.post-actions details { margin: 0; }
.post-actions summary {
  cursor: pointer;
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border: 1px solid currentColor;
  border-radius: 4px;
  font: inherit;
  line-height: 1;
  list-style: none;
  color: inherit;
  background: transparent;
}
.post-actions summary::-webkit-details-marker { display: none; }
.post-actions summary:hover { background: var(--background-alt); }
.post-actions details[open] summary { margin-bottom: 0.5rem; }
.post-actions form { margin: 0; }
.post-actions textarea { margin-block: 0.5rem; min-height: 4rem; }
.post-actions button {
  margin: 0;
  padding: 0.2rem 0.6rem;
  font: inherit;
  line-height: 1;
}
button.danger {
  background: transparent;
  color: #c0392b;
  border: 1px solid currentColor;
}
button.danger:hover { background: #c0392b; color: white; }

.thread-actions {
  display: flex;
  gap: 0.5rem;
  margin-block: 1.5rem 1rem;
}
.thread-actions button { margin: 0; }

.post-meta .post-share,
.post-meta .post-reply {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--links);
  cursor: pointer;
  font: inherit;
  line-height: inherit;
}
.post-meta .post-share:hover,
.post-meta .post-reply:hover { text-decoration: underline; }

button.link-button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--links);
  cursor: pointer;
  font: inherit;
}
button.link-button:hover { text-decoration: underline; }

/* water.css styles only <button>/<input>, not [role=button]; mirror its
   button look (own vars → tracks light/dark) for the invite CTA link. */
a[role="button"] {
  display: inline-block;
  padding: 10px 30px;
  border-radius: 6px;
  color: var(--form-text);
  background: var(--button-base);
  text-decoration: none;
}
a[role="button"]:hover { background: var(--button-hover); }

article:has(#reply:not([hidden])) > .thread-actions { display: none; }

#reply { margin-top: 1.5rem; }

.reply-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.reply-actions button {
  margin: 0;
  padding: 0.2rem 0.6rem;
  font: inherit;
  line-height: 1;
}

.tombstoned .deleted { opacity: 0.6; }

.invite-url {
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--background-alt);
  padding: 0.75rem;
  border-radius: 4px;
}

textarea { min-height: 6rem; resize: vertical; }

footer {
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.8em;
  opacity: 0.55;
  text-align: center;
}

@media (max-width: 32rem) {
  header nav { font-size: 0.95rem; gap: 0.4rem; }
}
