/* IdeaBoard: self-contained styles, no build step or CDN. Light and dark themes follow the OS setting. */

:root {
  color-scheme: light;

  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --border: #e5e2d9;
  --border-strong: #d2cec2;
  --text: #1c1a17;
  --text-2: #5c584f;
  --text-3: #8a8579;

  --accent: #5a43e0;
  --accent-hover: #4a34cc;
  --accent-soft: #eeebfe;
  --accent-soft-text: #4a34cc;
  --on-accent: #ffffff;

  --pending-bg: #fcf1d6;
  --pending-fg: #865800;
  --open-bg: #e6eefe;
  --open-fg: #2550b8;
  --declined-bg: #f8e4e1;
  --declined-fg: #a13a2d;
  --completed-bg: #dff2e4;
  --completed-fg: #1c7339;

  --success-bg: #e3f4e8;
  --success-border: #b9e2c5;
  --danger: #c2412f;
  --danger-bg: #fbe7e4;
  --danger-border: #f1c3bc;

  --shadow-sm: 0 1px 2px rgb(28 26 23 / 0.05);
  --shadow: 0 1px 2px rgb(28 26 23 / 0.04), 0 4px 16px rgb(28 26 23 / 0.06);
  --shadow-lg: 0 2px 4px rgb(28 26 23 / 0.06), 0 12px 32px rgb(28 26 23 / 0.12);
  --ring: 0 0 0 3px rgb(90 67 224 / 0.3);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --page: 46rem;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #121110;
    --surface: #1b1a18;
    --surface-2: #252321;
    --border: #2e2c29;
    --border-strong: #403d38;
    --text: #eeebe4;
    --text-2: #aaa59a;
    --text-3: #7b766c;

    --accent: #8f80ff;
    --accent-hover: #a597ff;
    --accent-soft: #262147;
    --accent-soft-text: #b8adff;
    --on-accent: #120f29;

    --pending-bg: #382b0e;
    --pending-fg: #f0c55c;
    --open-bg: #172540;
    --open-fg: #8fb2ff;
    --declined-bg: #3a1b17;
    --declined-fg: #f09488;
    --completed-bg: #14301d;
    --completed-fg: #7fd69a;

    --success-bg: #14301d;
    --success-border: #1f4a2d;
    --danger: #f09488;
    --danger-bg: #3a1b17;
    --danger-border: #5a2a23;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / 0.35), 0 12px 32px rgb(0 0 0 / 0.45);
    --ring: 0 0 0 3px rgb(143 128 255 / 0.4);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.container { width: 100%; max-width: var(--page); margin: 0 auto; padding: 0 16px; }

main.container { flex: 1; padding-top: 32px; padding-bottom: 64px; }

.icon { width: 1em; height: 1em; flex: none; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .container { display: flex; align-items: center; gap: 24px; height: 60px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.02em; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 18px;
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.15);
}

.nav-links { display: flex; gap: 4px; }

.nav-links a {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.9375rem;
  font-weight: 500;
}

.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--text); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

@media (max-width: 560px) {
  .site-header .container { gap: 12px; }
  .nav-links { display: none; }
  .brand-name { display: none; }
  .hide-sm { display: none; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 120ms, border-color 120ms, color 120ms, box-shadow 120ms;
}

.btn-sm { height: 34px; padding: 0 12px; font-size: 0.875rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-dark { background: #1f2328; color: #fff; }
.btn-dark:hover { background: #33393f; }
@media (prefers-color-scheme: dark) {
  .btn-dark { background: #f0f1f2; color: #1f2328; }
  .btn-dark:hover { background: #fff; }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  font-size: 16px;
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ---------- Avatar & menus ---------- */

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size, 32px);
  height: var(--size, 32px);
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: calc(var(--size, 32px) * 0.42);
  font-weight: 700;
  text-transform: uppercase;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.menu { position: relative; }

.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }

.menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 10px 0 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
}

.menu-trigger:hover { border-color: var(--border-strong); color: var(--text); }

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 30;
}

.menu-panel.align-left { left: 0; right: auto; }

.menu-label { padding: 8px 10px 6px; font-size: 0.8125rem; color: var(--text-3); }
.menu-label strong { display: block; color: var(--text); font-size: 0.9375rem; }

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 0.9375rem;
  text-align: left;
  color: var(--text);
}

.menu-item:hover { background: var(--surface-2); }
.menu-item[aria-current="true"] { font-weight: 600; }
.menu-item .check { color: var(--accent); visibility: hidden; }
.menu-item[aria-current="true"] .check { visibility: visible; }
.menu-divider { height: 1px; margin: 6px 0; background: var(--border); }

/* ---------- Page head ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 1.875rem; font-weight: 750; }
.page-head p { margin-top: 6px; color: var(--text-2); }

.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 20px; color: var(--text-2); font-size: 0.9375rem; font-weight: 500; }
.back-link:hover { color: var(--text); }

/* ---------- Toolbar (status tabs, category chips, sort) ---------- */

.toolbar { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }

.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs a {
  padding: 6px 14px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
}

.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }

.tab-count { margin-left: 6px; color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 120ms, background-color 120ms, color 120ms;
}

.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.sort-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.sort-trigger:hover { background: var(--surface-2); color: var(--text); }
.sort-trigger strong { color: var(--text); font-weight: 600; }

/* ---------- Idea cards ---------- */

.idea-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.idea {
  display: flex;
  gap: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 150ms, box-shadow 150ms, opacity 200ms, transform 200ms;
}

.idea:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.idea.is-removing { opacity: 0; transform: scale(0.98); }

.idea-full { padding: 28px; gap: 20px; }

.vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: none;
  width: 54px;
  height: 64px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  transition: background-color 120ms, border-color 120ms, color 120ms, transform 80ms;
}

.vote:hover { border-color: var(--accent); color: var(--accent); }
.vote:active { transform: scale(0.95); }
.vote:disabled { cursor: progress; opacity: 0.7; }
.vote .icon { font-size: 18px; transition: transform 160ms; }
.vote:hover .icon { transform: translateY(-2px); }

.vote-count { font-size: 1.0625rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }

.vote[data-voted="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.vote[data-voted="true"] .vote-count { color: var(--on-accent); }
.vote[data-voted="true"]:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.vote.bump .vote-count { animation: bump 260ms ease-out; }
@keyframes bump { 40% { transform: scale(1.35); } }

.idea-full .vote { width: 64px; height: 76px; }

.idea-body { flex: 1; min-width: 0; }

.idea-head { display: flex; align-items: flex-start; gap: 8px; }

.idea-title { flex: 1; min-width: 0; font-size: 1.0625rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.idea-title a:hover { color: var(--accent); }
.idea-full .idea-title { font-size: 1.625rem; font-weight: 750; }

.idea-actions { display: flex; gap: 2px; margin: -6px -6px 0 0; }

.idea-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 8px;
  color: var(--text-3);
  font-size: 0.8125rem;
}

.byline { display: inline-flex; align-items: center; gap: 6px; }
.byline strong { color: var(--text-2); font-weight: 600; }
.byline .avatar { --size: 20px; }
.meta-sep::before { content: "·"; }

.idea-desc { position: relative; margin-top: 12px; color: var(--text-2); }
.idea-desc.is-clamped { max-height: 9.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.idea-full .idea-desc { margin-top: 20px; color: var(--text); font-size: 1.0625rem; }

.read-more { display: none; margin-top: 4px; color: var(--accent); font-size: 0.875rem; font-weight: 600; }
.read-more:hover { text-decoration: underline; }
.is-clamped + .read-more { display: inline-block; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-plain::before { display: none; }

.status-pending { background: var(--pending-bg); color: var(--pending-fg); }
.status-open { background: var(--open-bg); color: var(--open-fg); }
.status-declined { background: var(--declined-bg); color: var(--declined-fg); }
.status-completed { background: var(--completed-bg); color: var(--completed-fg); }

.tag { background: var(--surface-2); color: var(--text-2); }
.tag::before { display: none; }

/* ---------- Cards, forms, notices ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

@media (max-width: 560px) {
  .card, .idea-full { padding: 20px; }
  .idea { padding: 14px; gap: 12px; }
  .idea-full .idea-title { font-size: 1.375rem; }
}

.form { display: flex; flex-direction: column; gap: 22px; }

.field { display: flex; flex-direction: column; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }

.field-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 0.9375rem; font-weight: 600; }
.field-label .optional { color: var(--text-3); font-weight: 400; font-size: 0.8125rem; }

.field-hint { color: var(--text-3); font-size: 0.8125rem; }
.field-hint code { font-family: var(--mono); font-size: 0.9em; }

.field-validation-error { color: var(--danger); font-size: 0.8125rem; font-weight: 500; }
.text-link { color: var(--accent); font-weight: 600; }
.text-link:hover { text-decoration: underline; }

.input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: border-color 120ms, box-shadow 120ms;
}

.input:hover { border-color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input::placeholder { color: var(--text-3); }
.input.input-validation-error { border-color: var(--danger); }

textarea.input { min-height: 13rem; resize: vertical; line-height: 1.55; }

.choice-group { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-group label { position: relative; }
.choice-group input { position: absolute; opacity: 0; pointer-events: none; }
.choice-group input:focus-visible + .chip { box-shadow: var(--ring); }
.choice-group input:checked + .chip { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-soft-text); font-weight: 600; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 20px; }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border: 1px solid var(--success-border);
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  font-size: 0.9375rem;
}

.notice .icon { margin-top: 3px; color: var(--completed-fg); }

.validation-summary-errors {
  padding: 12px 14px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.9375rem;
}

.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9375rem; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------- Empty state ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 24px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 6px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: 22px;
}

.empty h2 { font-size: 1.125rem; font-weight: 650; }
.empty p { max-width: 26rem; color: var(--text-2); }
.empty .btn { margin-top: 10px; }

/* ---------- Auth ---------- */

.auth { max-width: 26rem; margin: 24px auto 0; }
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 24px; text-align: center; }
.auth-head .brand-mark { width: 44px; height: 44px; border-radius: 13px; font-size: 26px; }
.auth-head h1 { font-size: 1.5rem; font-weight: 750; }
.auth-head p { color: var(--text-2); }

.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--text-3); font-size: 0.8125rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Profile ---------- */

.profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 28px; }
.profile-head .avatar { --size: 72px; }
.profile-head h1 { display: flex; align-items: center; gap: 10px; font-size: 1.75rem; font-weight: 750; }
.profile-stats { display: flex; gap: 18px; margin-top: 6px; color: var(--text-2); font-size: 0.9375rem; }
.profile-stats strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- About ---------- */

.steps { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.steps li { padding: 18px; background: var(--surface-2); border-radius: var(--radius); }
.steps .step-icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 12px; border-radius: 10px; background: var(--surface); color: var(--accent); font-size: 18px; box-shadow: var(--shadow-sm); }
.steps h3 { font-size: 1rem; font-weight: 650; margin-bottom: 4px; }
.steps p { color: var(--text-2); font-size: 0.9375rem; }

/* ---------- Markdown ---------- */

.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose pre, .prose blockquote, .prose table { margin: 0 0 0.85em; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 1.3em 0 0.5em; color: var(--text); font-size: 1.1em; font-weight: 650; }
.prose h1 { font-size: 1.3em; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.prose strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.25em; }
.prose code { padding: 0.15em 0.35em; border-radius: 5px; background: var(--surface-2); font-family: var(--mono); font-size: 0.875em; }
.prose pre { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); overflow-x: auto; }
.prose pre code { padding: 0; background: none; }
.prose blockquote { padding-left: 14px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 6px 10px; border: 1px solid var(--border); }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--text-3); font-size: 0.8125rem; }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
.site-footer a:hover { color: var(--text); }
.site-footer nav { display: flex; gap: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
