/* Shared ideas site — dark, plain, fast. One accent colour. No external fonts. */
:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1c2330;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --danger: #f85149;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}

.topbar h1 { margin: 0; font-size: 1.4rem; }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 0 0 10px; }

a { color: var(--accent); }

.muted { color: var(--muted); font-size: 0.9rem; }
.hidden { display: none !important; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}

.error {
  color: var(--danger);
  background: rgba(248, 81, 73, 0.08);
  border: 1px solid rgba(248, 81, 73, 0.4);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 12px 0;
}

.signed-in { color: var(--muted); font-size: 0.9rem; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
}
.section-head h2 { margin: 0; }

/* Forms */
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input, textarea, select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem;
}
input:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
textarea { resize: vertical; }

.btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 16px;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 12px;
}
.btn:hover:not(:disabled) { background: var(--surface-hover); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-small { padding: 5px 10px; font-size: 0.85rem; margin-top: 0; }

/* Idea list */
.idea-list { list-style: none; margin: 0; padding: 0; }
.idea-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
}
.idea-item:hover { background: var(--surface-hover); border-color: var(--accent); }
.idea-item h3 { margin: 0 0 4px; }
.idea-item h3 a { color: var(--text); text-decoration: none; }
.idea-item h3 a:hover { color: var(--accent); }
.idea-meta { color: var(--muted); font-size: 0.88rem; margin: 0; }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  vertical-align: middle;
  margin-left: 6px;
}
.badge-done { border-color: #3fb950; color: #3fb950; }
.badge-building { border-color: #d29922; color: #d29922; }
.badge-exploring { border-color: #bc8cff; color: #bc8cff; }
.badge-imported { border-color: var(--muted); color: var(--muted); text-transform: none; }

#idea-filter {
  width: 100%;
  margin: 10px 0 4px;
}

/* Idea detail */
.idea-body { white-space: pre-wrap; word-wrap: break-word; margin: 14px 0 0; }
.idea-body.md, .comment-body.md { white-space: normal; }

/* Rendered Markdown (safe subset) */
.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; font-size: 1.05rem; }
.md h1 { font-size: 1.2rem; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin-bottom: 2px; }
.md blockquote { margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.md code { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 0.9em; }
.md a { color: var(--accent); }
.status-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.status-row .btn { margin-top: 0; }
.status-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d1117;
  font-weight: 600;
}

/* Tasks */
.task-list { list-style: none; margin: 0 0 12px; padding: 0; }
.task-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.task-list li:last-child { border-bottom: none; }
.task-list input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.task-list .task-done { color: var(--muted); text-decoration: line-through; }
#add-task-form { display: flex; gap: 8px; }
#add-task-form input { flex: 1; }
#add-task-form .btn { margin-top: 0; flex-shrink: 0; }

/* Comments */
.comment { padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment-head { font-size: 0.88rem; color: var(--muted); margin-bottom: 2px; }
.comment-head strong { color: var(--text); }
.comment-body { white-space: pre-wrap; word-wrap: break-word; margin: 0 0 4px; }
.comment-replies { margin-left: 20px; border-left: 2px solid var(--border); padding-left: 14px; }
.reply-btn { background: none; border: none; color: var(--accent); font: inherit; font-size: 0.85rem; padding: 0; cursor: pointer; }
.reply-btn:hover { text-decoration: underline; }
#comment-form .btn { margin-right: 8px; }

/* Art */
.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.art-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: var(--text);
  font: inherit;
}
.art-card:hover { border-color: var(--accent); }
.art-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  background: var(--bg);
}
.art-card figcaption { padding: 10px 12px; }
.art-card figcaption strong { display: block; font-size: 0.95rem; }
.art-card .muted { font-size: 0.85rem; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.lightbox figure { margin: 0; max-width: 900px; width: 100%; text-align: center; }
.lightbox img { max-width: 100%; max-height: 75vh; object-fit: contain; border-radius: var(--radius); }
.lightbox figcaption { margin-top: 12px; text-align: left; }
.lightbox figcaption strong { display: block; font-size: 1.1rem; }
.lightbox figcaption span { display: block; margin-top: 2px; }
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.6rem;
  line-height: 1;
  padding: 6px 12px;
}

@media (max-width: 560px) {
  .art-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .art-card img { height: 140px; }
  #add-task-form { flex-wrap: wrap; }
}
