/* Ideastream.
 *
 * One column, sized for a phone, capped for a desktop window. The capture box
 * is the largest thing on the first screen because it is the thing the app is
 * for; everything else is deliberately quiet.
 *
 * Colours follow the system light/dark preference through custom properties, so
 * there is one place per colour rather than a second stylesheet.
 */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --ink: #1c1c1a;
  --ink-soft: #6a6a64;
  --line: #e2e2dc;
  --accent: #3f6f4f;
  --accent-ink: #ffffff;
  --warn: #9a5b1f;
  --danger: #a33a2e;
  --chip: #ecece6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --surface: #1f2126;
    --ink: #e9e9e4;
    --ink-soft: #9a9a92;
    --line: #32343a;
    --accent: #6fae84;
    --accent-ink: #10120f;
    --warn: #d3a05c;
    --danger: #e08076;
    --chip: #2b2e34;
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ---- Chrome ---------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 0.5rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.sync {
  font-size: 0.75rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.sync.warn {
  color: var(--warn);
}

.sync.ok {
  color: var(--ink-soft);
}

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

.tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  margin-bottom: -1px;
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.subhead {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 1rem;
  min-height: 2rem;
}

.subhead h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.back {
  appearance: none;
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  cursor: pointer;
}

/* ---- Capture and edit ------------------------------------------------ */

.body-input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  resize: vertical;
  box-shadow: var(--shadow);
}

.body-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

button.primary,
button.danger {
  appearance: none;
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  border: 1px solid transparent;
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  width: 100%;
}

button.danger {
  background: none;
  border-color: var(--line);
  color: var(--danger);
}

.edit-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.edit-actions .primary {
  flex: 1;
}

.flash {
  margin: 0.6rem 0 0;
  min-height: 1.2rem;
  font-size: 0.85rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 120ms ease-in;
}

.flash.on {
  opacity: 1;
}

.when {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ---- Topic picker ---------------------------------------------------- */

.picker {
  margin: 0.75rem 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chips:not(:empty) {
  margin-bottom: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--chip);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.chip-x {
  appearance: none;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0 0 0.1rem;
  cursor: pointer;
}

.picker-input-wrap {
  position: relative;
}

.topic-input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
}

.topic-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.suggestions {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0.25rem;
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  max-height: 15rem;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.suggestion-btn {
  appearance: none;
  background: none;
  border: none;
  font: inherit;
  color: var(--ink);
  text-align: left;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.suggestion.on .suggestion-btn {
  background: var(--chip);
}

.new-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  flex: none;
}

.suggestion-name {
  overflow-wrap: anywhere;
}

/* ---- Lists ----------------------------------------------------------- */

.ideas,
.topics {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.idea-open,
.topic-open {
  appearance: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem;
  cursor: pointer;
}

.idea.pending .idea-open {
  border-left: 3px solid var(--warn);
}

.idea-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.idea-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.topic-open {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.topic-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.topic-meta {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  flex: none;
}

.count {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.empty {
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 1rem;
}

[hidden] {
  display: none !important;
}
