/* ============================================================
   Verdiqts — Core Design Tokens & Foundation
   ============================================================ */
:root {
  /* Backgrounds */
  --bg-base:        #0C0C0E;
  --bg-surface:     #141416;
  --bg-raised:      #1C1C1F;
  --bg-overlay:     #242428;

  /* Borders */
  --border-subtle:  #27272A;
  --border-default: #3F3F46;
  --border-strong:  #52525B;

  /* Text */
  --text-primary:   #FAFAFA;
  --text-secondary: #A1A1AA;
  --text-muted:     #71717A;
  --text-disabled:  #52525B;

  /* Brand — Amber */
  --brand:          #F59E0B;
  --brand-hover:    #FBBF24;
  --brand-subtle:   #1C1500;
  --brand-text:     #FDE68A;

  /* Agree — Green */
  --agree:          #22C55E;
  --agree-hover:    #4ADE80;
  --agree-bg:       #052E16;
  --agree-text:     #BBF7D0;

  /* Disagree — Red */
  --disagree:       #EF4444;
  --disagree-hover: #F87171;
  --disagree-bg:    #2D0707;
  --disagree-text:  #FECACA;

  --neutral:        #71717A;

  --font-body:      'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:      'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --radius-full:    9999px;

  --shadow-card:    0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-pop:     0 12px 32px rgba(0,0,0,0.5);
  --transition:     150ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-base:        #F4F4F5;
  --bg-surface:     #FFFFFF;
  --bg-raised:      #F9F9FA;
  --bg-overlay:     #FFFFFF;
  --border-subtle:  #E4E4E7;
  --border-default: #D4D4D8;
  --border-strong:  #A1A1AA;
  --text-primary:   #09090B;
  --text-secondary: #52525B;
  --text-muted:     #71717A;
  --text-disabled:  #A1A1AA;
  --brand-subtle:   #FFFBEB;
  --brand-text:     #92400E;
  --agree-bg:       #F0FDF4;
  --agree-text:     #166534;
  --disagree-bg:    #FFF1F2;
  --disagree-text:  #9F1239;
  --shadow-card:    0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.08);
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-hover); }

img, svg { display: block; max-width: 100%; }

button { font-family: inherit; cursor: pointer; }

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::selection { background: var(--brand); color: var(--bg-base); }

h1, h2, h3, h4, h5, h6 { margin: 0 0 0.5em 0; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em 0; }

/* ============================================================
   Layout
   ============================================================ */
.main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 80px 20px;
}

.container { max-width: 720px; margin: 0 auto; }

.layout-feed {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}

@media (max-width: 960px) {
  .layout-feed { grid-template-columns: 1fr; }
  .layout-feed .sidebar { display: none; }
}

/* ============================================================
   Top Navigation
   ============================================================ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 12, 14, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] .topnav {
  background: rgba(255, 255, 255, 0.85);
}

.topnav__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
}

.topnav__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.topnav__brand:hover { color: var(--text-primary); }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #0C0C0E;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.topnav__search {
  flex: 1;
  max-width: 480px;
}

.topnav__search input {
  width: 100%;
  padding: 9px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}
.topnav__search input:focus { border-color: var(--brand); background: var(--bg-raised); }
.topnav__search input::placeholder { color: var(--text-muted); }

.topnav__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.topnav__bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.topnav__bell:hover { background: var(--bg-raised); color: var(--text-primary); }
.topnav__bell-count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--brand);
  color: #0C0C0E;
  font-size: 10px;
  font-weight: 800;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
}

.topnav__user { position: relative; }
.topnav__avatar {
  background: none;
  border: 0;
  padding: 0;
  border-radius: var(--radius-full);
  overflow: hidden;
  width: 36px;
  height: 36px;
}
.topnav__avatar img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  display: none;
  z-index: 60;
}
.dropdown[data-open="true"] { display: block; }
.dropdown a, .dropdown__signout {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-weight: 500;
}
.dropdown a:hover, .dropdown__signout:hover { background: var(--bg-raised); }
.dropdown__header { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 4px; }
.dropdown__name { font-weight: 700; color: var(--text-primary); }
.dropdown__handle { color: var(--text-muted); font-size: 13px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn--primary {
  background: var(--brand);
  color: #0C0C0E;
}
.btn--primary:hover { background: var(--brand-hover); color: #0C0C0E; transform: translateY(-1px); }
.btn--secondary {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn--secondary:hover { background: var(--bg-overlay); }
.btn--ghost {
  background: transparent;
  color: var(--text-primary);
}
.btn--ghost:hover { background: var(--bg-raised); }
.btn--sm { padding: 7px 14px; font-size: 13px; }
.btn--lg { padding: 14px 24px; font-size: 16px; }
.btn--block { width: 100%; }
.btn--danger {
  background: var(--disagree);
  color: #fff;
}

/* ============================================================
   Cards & Forms
   ============================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.card--sm { padding: 16px; }
.card--lg { padding: 32px; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--brand);
}
.field textarea { resize: vertical; min-height: 120px; font-family: inherit; }
.field__hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.field__hint--error { color: var(--disagree); }
.field__row { display: flex; gap: 12px; }
.field__row > * { flex: 1; }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--text-secondary);
}
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ============================================================
   Auth Pages
   ============================================================ */
.auth-page {
  min-height: calc(100vh - 200px);
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-card);
}
.auth-card__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  text-align: center;
}
.auth-card__brand .brand-mark {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  font-size: 32px;
}
.auth-card h1 {
  font-size: 24px;
  margin: 0;
  letter-spacing: -0.02em;
}
.auth-card__sub {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}
.auth-card__footer {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
}
.auth-card__footer a { font-weight: 600; }
.auth-card__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
  margin: 18px 0;
}
.auth-card__divider::before,
.auth-card__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.founding-banner {
  background: linear-gradient(135deg, var(--brand-subtle), var(--bg-overlay));
  border: 1px solid var(--brand);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--brand-text);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================
   Flash Messages
   ============================================================ */
.flash-stack {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(440px, calc(100vw - 40px));
}
.flash {
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  animation: flashIn 200ms ease;
}
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.flash__close {
  background: none;
  border: 0;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.flash--success { border-color: var(--agree); background: var(--agree-bg); color: var(--agree-text); }
.flash--error   { border-color: var(--disagree); background: var(--disagree-bg); color: var(--disagree-text); }
.flash--info    { border-color: var(--brand); background: var(--brand-subtle); color: var(--brand-text); }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border-subtle);
  padding: 32px 20px;
  margin-top: 60px;
  background: var(--bg-surface);
}
.site-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}
.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text-primary);
}
.site-footer__links {
  display: flex;
  gap: 24px;
}
.site-footer__links a {
  color: var(--text-secondary);
  font-size: 14px;
}
.site-footer__links a:hover { color: var(--brand); }
.site-footer__copy {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
}
.site-footer__copy span { display: inline-block; margin-left: 6px; opacity: 0.6; }

@media (max-width: 700px) {
  .site-footer__inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .site-footer__copy { margin-left: 0; }
}

/* ============================================================
   Mobile Navigation
   ============================================================ */
.mobilenav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
  justify-content: space-around;
}
.mobilenav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
}
.mobilenav a:hover, .mobilenav a:active { color: var(--brand); }
.mobilenav__post {
  background: var(--brand) !important;
  color: #0C0C0E !important;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  margin-top: -16px;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}
.mobilenav__post svg { stroke: #0C0C0E !important; }
.mobilenav__post span { display: none; }

@media (max-width: 700px) {
  .mobilenav { display: flex; }
  .main { padding-bottom: 100px; }
  .topnav__search { display: none; }
}

/* ============================================================
   Utility
   ============================================================ */
.u-text-muted { color: var(--text-muted); }
.u-text-secondary { color: var(--text-secondary); }
.u-text-center { text-align: center; }
.u-mt-0 { margin-top: 0; }
.u-mt-1 { margin-top: 8px; }
.u-mt-2 { margin-top: 16px; }
.u-mt-3 { margin-top: 24px; }
.u-mt-4 { margin-top: 32px; }
.u-mb-0 { margin-bottom: 0; }
.u-mb-1 { margin-bottom: 8px; }
.u-mb-2 { margin-bottom: 16px; }
.u-mb-3 { margin-bottom: 24px; }
.u-mb-4 { margin-bottom: 32px; }
.u-flex { display: flex; }
.u-gap-1 { gap: 8px; }
.u-gap-2 { gap: 16px; }
.u-gap-3 { gap: 24px; }
.u-items-center { align-items: center; }
.u-justify-between { justify-content: space-between; }
.u-w-full { width: 100%; }
.u-hidden { display: none !important; }

/* ============================================================
   Empty States
   ============================================================ */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty__icon {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--bg-raised);
  margin-bottom: 16px;
  color: var(--text-secondary);
}
.empty h2 { color: var(--text-primary); margin-bottom: 8px; }
.empty p { max-width: 360px; margin: 0 auto; }

/* ============================================================
   Error pages
   ============================================================ */
.error-page {
  min-height: calc(100vh - 250px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 60px 20px;
}
.error-page__code {
  font-size: 96px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
  letter-spacing: -0.04em;
}
.error-page h1 { margin: 16px 0 8px 0; font-size: 28px; }
.error-page p { color: var(--text-secondary); margin-bottom: 24px; max-width: 440px; }

/* ============================================================
   Modals
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-backdrop[data-open="true"] { display: flex; }
.modal {
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-pop);
  animation: modalIn 200ms ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal h2 { margin-top: 0; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
