:root {
  font-family: system-ui, -apple-system, sans-serif;
  color: #1a1a1b;
  background: #f6f7f8;
  --border: #e5e7eb;
  --muted: #6b7785;
  --accent: #0079d3;
}
* { box-sizing: border-box; }
body { margin: 0; }
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}
h1 { margin: 0 0 0.25rem; font-size: 1.5rem; line-height: 1.2; }
h2 { margin: 0; font-size: 1.15rem; display: inline; }
h2 a { color: inherit; text-decoration: none; }
h2 a:hover { text-decoration: underline; }

.thread {
  margin: 1.5rem 0 0;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}
section.thread-open > h2 { display: block; margin-bottom: 0.25rem; }
section.thread-open > .thread-status { margin: 0 0 0.5rem; }
details.thread > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  padding: 0.25rem 0;
}
details.thread > summary::-webkit-details-marker { display: none; }
details.thread > summary::before {
  content: "▶";
  display: inline-block;
  width: 1.2em;
  font-size: 1.1em;
  color: var(--accent);
  transition: transform 0.15s;
}
details.thread[open] > summary::before { transform: rotate(90deg); }
.thread-status {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}
#generated { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.5rem; }

.entry {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.entry .meta { color: var(--muted); font-size: 0.8rem; margin-bottom: 0.15rem; }
.entry .body { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.entry a { color: var(--accent); text-decoration: none; }
.entry a:hover { text-decoration: underline; }
.empty { color: var(--muted); font-style: italic; }

.intro { margin: 0 0 0.5rem; font-size: 0.95rem; }

.view-toggle {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.view-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}
.view-toggle input { accent-color: var(--accent); }

.donate-wrap { margin: 1rem 0 1.5rem; text-align: center; }
a.donate {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  background: #ffc439;
  color: #003087;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  min-height: 44px;
  line-height: 1.6;
}
a.donate:hover { background: #f0b73a; text-decoration: none; }

/* Inline-media view (only shown when the toggle is on; renderer skips
   adding .media-grid otherwise, so these rules apply to no nodes by
   default). */
.media-grid {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}
.media-grid.multi { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 480px) {
  .media-grid.multi { grid-template-columns: 1fr; }
}
.media {
  display: block;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.media img, .media video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  background: #000;
}
.media.album {
  background: #fff;
  min-height: 60px;
  padding: 0;
}
.album-placeholder {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}
.media.album .imgur-embed-pub,
.media.album .imgur-embed-iframe-pub,
.media.album .imgur-embed-iframe-pub-a,
.media.album > div,
.media.album iframe {
  max-width: 100% !important;
  width: 100% !important;
  min-width: 100% !important;
  margin: 0 !important;
  display: block !important;
}
.media.album iframe { border: 0 !important; }

@media (max-width: 600px) {
  main { padding: 1rem 0.75rem 3rem; }
  h1 { font-size: 1.25rem; }
  h2 { font-size: 1.05rem; margin-top: 1.5rem; }
  .entry { font-size: 0.95rem; }
  .entry .meta { font-size: 0.78rem; }
}

.duke-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0 1.5rem;
}
.duke-gallery img {
  max-width: 240px;
  max-height: 180px;
  border: 2px solid #d97706;
  border-radius: 4px;
  image-rendering: pixelated;
}
