:root {
  --background: #fafafa;
  --foreground: #0a0a0a;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --muted: rgba(10, 10, 10, 0.55);
  --border: rgba(10, 10, 10, 0.08);
  --border-strong: rgba(10, 10, 10, 0.14);
  --primary: #171717;
  --primary-foreground: #fafafa;
  --success: #15803d;
  --danger: #dc2626;
  --radius-lg: 16px;
  --font-geist-sans: "Inter", system-ui, sans-serif;
  --font-space-grotesk: "Space Grotesk", system-ui, sans-serif;
}

.dark {
  --background: #09090b;
  --foreground: #fafafa;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-strong: rgba(255, 255, 255, 0.06);
  --muted: rgba(255, 255, 255, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --primary: #fafafa;
  --primary-foreground: #09090b;
}

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-geist-sans);
  -webkit-font-smoothing: antialiased;
}

.font-display { font-family: var(--font-space-grotesk), system-ui, sans-serif; }

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--background);
}

.dark .ambient-bg {
  background: radial-gradient(120% 80% at 50% -20%, rgba(255, 255, 255, 0.04), transparent 50%), var(--background);
}

.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: opacity 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-secondary { background: var(--surface); color: var(--foreground); border-color: var(--border); }
.btn:hover { opacity: 0.9; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid var(--border);
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  color: var(--success);
}

.input {
  width: 100%;
  border-radius: 0.625rem;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
}

.input:focus {
  outline: 2px solid var(--border-strong);
  outline-offset: 1px;
}

.line-clamp-2, .line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-2 { -webkit-line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; }

.pn-hidden { display: none !important; }

/* Auth nav — applied before JS via html.pn-auth / html.pn-guest */
html.pn-guest #nav-auth-user { display: none !important; }
html.pn-guest #nav-auth-guest { display: flex !important; align-items: center; }
html.pn-auth #nav-auth-guest { display: none !important; }
html.pn-auth #nav-auth-user { display: flex !important; align-items: center; }
html.pn-auth #mobile-nav-guest { display: none !important; }
html.pn-guest #mobile-nav-user { display: none !important; }

.nav-user-menu { position: relative; }
.nav-user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 50;
  min-width: 12rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--background);
  padding: 0.375rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}
.dark .nav-user-dropdown { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45); }
.nav-user-dropdown a,
.nav-user-dropdown button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}
.nav-user-dropdown a:hover,
.nav-user-dropdown button:hover { background: var(--surface); }
.nav-user-dropdown .nav-user-meta {
  padding: 0.5rem 0.75rem 0.625rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}
.nav-user-dropdown .nav-user-meta p:first-child {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
}
.nav-user-dropdown .nav-user-meta p:last-child {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user-dropdown .nav-signout { color: #f87171; }
.nav-user-dropdown .nav-signout:hover { background: rgba(248, 113, 113, 0.08); }

.nav-avatar {
  display: inline-flex;
  height: 2.25rem;
  width: 2.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--foreground);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.nav-avatar:hover,
.nav-avatar[aria-expanded="true"] {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--foreground) 8%, transparent);
}


@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.animate-marquee {
  animation: marquee 40s linear infinite;
}

.animate-marquee:hover {
  animation-play-state: paused;
}

.hero-orb {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.35), transparent 55%),
    radial-gradient(circle at 70% 60%, rgba(168, 85, 247, 0.25), transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.06), transparent 70%);
  border: 1px solid var(--border);
  box-shadow: inset 0 0 80px rgba(255, 255, 255, 0.04);
  animation: orb-float 8s ease-in-out infinite;
}

@keyframes orb-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-12px) scale(1.02); }
}

.about-visual {
  border-radius: 1rem;
  background:
    radial-gradient(circle at 40% 35%, rgba(59, 130, 246, 0.2), transparent 55%),
    radial-gradient(circle at 65% 70%, rgba(16, 185, 129, 0.15), transparent 50%),
    var(--surface-strong);
  border: 1px solid var(--border);
  min-height: 280px;
}

.tab-active {
  background: var(--foreground) !important;
  color: var(--background) !important;
}

.faq-cat-active {
  background: var(--foreground) !important;
  color: var(--background) !important;
}

.faq-item {
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
}

.faq-item:hover {
  border-color: var(--border-strong);
}

.faq-open {
  border-color: var(--border-strong) !important;
  background: var(--surface-strong) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.faq-open .faq-chevron {
  transform: rotate(180deg);
}

.faq-item button {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  width: 100%;
}

.prose-legal h1, .prose-legal h2, .prose-legal h3, .prose-legal h4 {
  font-family: var(--font-space-grotesk), system-ui, sans-serif;
  color: var(--foreground);
}

.prose-legal h1 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.prose-legal h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.375rem;
  font-weight: 600;
  scroll-margin-top: 5rem;
}

.prose-legal h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

.prose-legal h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.prose-legal p, .prose-legal li {
  color: var(--muted);
  line-height: 1.75;
  font-size: 0.9375rem;
}

.prose-legal p {
  margin-bottom: 1rem;
}

.prose-legal ul, .prose-legal ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.prose-legal ul { list-style-type: disc; }
.prose-legal ol { list-style-type: decimal; }

.prose-legal li {
  margin-bottom: 0.375rem;
}

.prose-legal a {
  color: #3b82f6;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose-legal a:hover {
  color: #60a5fa;
}

.prose-legal strong {
  color: var(--foreground);
  font-weight: 600;
}

.prose-legal code {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background: var(--surface-strong);
  color: var(--foreground);
}

.prose-legal .legal-meta {
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.prose-legal .legal-toc {
  margin: 1.5rem 0 2rem;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.prose-legal .legal-toc p {
  margin-bottom: 0.5rem;
  color: var(--foreground);
}

.prose-legal .legal-toc ol {
  margin-bottom: 0;
  columns: 1;
}

@media (min-width: 640px) {
  .prose-legal .legal-toc ol {
    columns: 2;
    column-gap: 2rem;
  }
}

.prose-legal .legal-toc a {
  font-weight: 400;
  font-size: 0.875rem;
}

@media (prefers-reduced-motion: reduce) {
  .animate-marquee, .hero-orb { animation: none !important; }
}

/* Admin console */
.admin-nav-link {
  color: var(--muted);
  transition: color 0.2s, background-color 0.2s;
}

.admin-nav-link:hover {
  color: var(--foreground);
  background: var(--surface);
}

.admin-nav-active {
  color: var(--foreground) !important;
  background: var(--surface) !important;
  ring: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px var(--border);
}

.admin-table {
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 0.625rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.admin-modal-box {
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.admin-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 60;
  max-width: 24rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--foreground);
  font-size: 0.875rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.admin-toast-error {
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Navbar notifications */
.nav-notifications-btn {
  position: relative;
  display: inline-flex;
  height: 2.25rem;
  width: 2.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  transition: color 0.2s, background-color 0.2s;
}

.nav-notifications-btn:hover {
  color: var(--foreground);
  background: var(--surface-strong);
}

.nav-notifications-badge {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  border-radius: 9999px;
  background: #3b82f6;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.125rem;
  text-align: center;
}

.nav-notifications-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 50;
  width: min(22rem, calc(100vw - 2rem));
  max-height: 24rem;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--background);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.nav-notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.nav-notifications-list {
  max-height: 18rem;
  overflow-y: auto;
}

.nav-notifications-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

.nav-notification-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.15s;
}

.nav-notification-item:hover {
  background: var(--surface);
}

.nav-notification-unread {
  background: color-mix(in srgb, #3b82f6 8%, var(--surface));
}

.nav-notification-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.nav-notification-type {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-notification-time {
  font-size: 0.6875rem;
  color: var(--muted);
}

.nav-notification-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
}

.nav-notification-message {
  margin-top: 0.125rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nav-notification-mark-read {
  margin-top: 0.375rem;
  color: #3b82f6;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.nav-notification-mark-read:hover {
  text-decoration: underline;
}
