/* DalitChan — blue 4chan (Yotsuba-inspired) theme */
:root {
  --bg: #dce3f5;
  --panel: #eef2ff;
  --post-bg: #f7f9ff;
  --op-bg: #e6ecff;
  --border: #aab4d4;
  --border-strong: #8a96c4;
  --fg: #11131a;
  --muted: #5b6478;
  --link: #1d4ed8;
  --accent: #2563eb;
  --accent-dark: #1e40af;
  --header-bg: #1e3a8a;
  --header-fg: #f8fafc;
  --locked: #b91c1c;
  --quote: #0b6b3a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  font-size: 14px;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1000px; margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { background: var(--header-bg); color: var(--header-fg); padding: 0.6rem 0; border-bottom: 2px solid var(--accent-dark); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.site-header h1 a { color: var(--header-fg); text-decoration: none; font-size: 1.4rem; font-weight: 800; letter-spacing: 0.5px; }
.site-header h1 a:hover { text-decoration: none; }
.site-header .nav a { color: var(--header-fg); text-decoration: none; margin-left: 1rem; font-weight: 600; }
.site-header .nav a:hover { text-decoration: underline; }

/* Main layout */
main { padding: 1.25rem 0 2rem; }

/* Generic page bits */
.page-title { font-size: 1.5rem; margin-bottom: 0.25rem; }
.lead { color: var(--muted); margin-bottom: 1rem; }
.empty-state { color: var(--muted); padding: 1.5rem; text-align: center; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; }

/* Board header + creation form */
.board-header { margin-bottom: 1rem; }
.board-header h2 { font-size: 1.3rem; }
.board-description { color: var(--muted); margin-top: 0.25rem; }

.thread-creation, .reply-form-container {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.85rem;
  margin-bottom: 1.25rem;
}
.thread-creation form, .reply-form-container form { display: flex; flex-direction: column; gap: 0.5rem; }

input, textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
  color: var(--fg);
}
textarea { min-height: 80px; resize: vertical; }
input[type="file"].file-input { margin: 0.35rem 0; padding: 0.4rem; background: #fff; }

button { padding: 0.35rem 0.85rem; border: none; border-radius: 4px; cursor: pointer; font-size: 0.9rem; font-family: inherit; }
button.btn-primary { background: var(--accent); color: #fff; font-weight: 600; align-self: flex-start; }
button.btn-primary:hover { background: var(--accent-dark); }
button.btn-secondary { background: var(--border-strong); color: #fff; }
button.btn-small { padding: 0.15rem 0.5rem; font-size: 0.72rem; background: var(--border); color: var(--fg); }
button.btn-small:hover { background: var(--border-strong); }

/* Board list table */
.board-list { width: 100%; border-collapse: collapse; margin-top: 0.5rem; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.board-list th, .board-list td { padding: 0.55rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); }
.board-list th { background: var(--header-bg); color: var(--header-fg); font-weight: 600; }
.board-list tr:last-child td { border-bottom: none; }
.board-link { font-weight: 700; }
.board-desc { color: var(--muted); }

.create-thread { margin-top: 1.5rem; padding: 1rem; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; }
.create-thread h3 { margin-bottom: 0.25rem; }

/* ---- Thread blocks on board page (collapsible) ---- */
.thread-list { display: flex; flex-direction: column; gap: 1.25rem; }

.thread-block {
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
}

.thread-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: linear-gradient(180deg, #dfe6fb, #cfd9f6);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
}
.thread-summary::-webkit-details-marker { display: none; }
.thread-summary:hover { background: linear-gradient(180deg, #d6def8, #c6d2f2); }
.thread-toggle, .post-toggle { font-size: 0; }
.thread-toggle::before, .post-toggle::before { font-size: 0.8rem; font-weight: 700; content: "[+]"; color: var(--accent-dark); }
.thread-block[open] > .thread-summary .thread-toggle::before,
details.post[open] > summary .post-toggle::before { content: "[−]"; }

.thread-subject { font-weight: 700; font-size: 1.05rem; color: var(--accent-dark); }
.thread-meta { color: var(--muted); font-size: 0.82rem; }
.thread-link { margin-left: auto; font-weight: 600; font-size: 0.82rem; }

.badge-locked { background: var(--locked); color: #fff; padding: 0.05rem 0.45rem; border-radius: 3px; font-size: 0.72rem; font-weight: 700; }

.thread-content { padding: 0.85rem; display: flex; flex-direction: column; gap: 0.75rem; }

/* ---- Posts (OP + replies) ---- */
.post {
  background: var(--post-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.post-op { background: var(--op-bg); border-color: var(--border-strong); }

.post > summary, .post-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem;
  background: linear-gradient(180deg, #e3e9fb, #d6dff7);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  list-style: none;
  font-size: 0.82rem;
}
.post > summary::-webkit-details-marker { display: none; }
.post > summary:hover { background: linear-gradient(180deg, #dbe3f8, #cdd8f1); }

.post-id { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-weight: 700; color: var(--accent-dark); }
.post-subject { font-weight: 700; color: var(--accent-dark); }
.post-author { font-weight: 600; color: #0b6b3a; }
.post-time { color: var(--muted); font-size: 0.78rem; }
.post-reply-to { color: var(--quote); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.78rem; }

.post-body-wrap { padding: 0.6rem 0.7rem; }
.post-body { white-space: pre-wrap; word-break: break-word; }

.post-media { margin-bottom: 0.5rem; }
.post-image { max-width: 100%; max-height: 320px; border: 1px solid var(--border); border-radius: 4px; display: block; }
.post-actions { margin-top: 0.4rem; }

/* ---- Thread view header ---- */
.thread-header { margin-bottom: 1rem; }
.thread-meta-bar { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; margin-bottom: 0.25rem; }
.thread-meta-bar a { font-weight: 600; }
.thread-header .thread-subject { font-size: 1.4rem; margin: 0.15rem 0; }
.thread-header .thread-meta { color: var(--muted); font-size: 0.85rem; display: flex; gap: 0.75rem; }

#posts { display: flex; flex-direction: column; gap: 0.75rem; }

.locked-notice { color: var(--locked); font-weight: 600; }

/* Pagination */
.pagination { display: flex; justify-content: center; margin: 1rem 0; }

/* Footer */
.site-footer { margin-top: 2rem; padding: 1rem 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.8rem; text-align: center; }
#report-dialog-content:empty { display: none; }

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 0 0.5rem; }
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .site-header .nav { margin-top: 0.4rem; }
  .thread-summary { gap: 0.35rem; }
  .thread-link { margin-left: 0; width: 100%; }
}
