/* ============================================================
   TRENDSLOP.AI — MASTER STYLESHEET
   ============================================================
   One file controls the look of the entire site.
   - Change colors? Edit the :root variables below.
   - Change fonts? Edit --font-* variables.
   - Dark mode is automatic via the [data-theme="dark"] attribute.
   ============================================================ */

/* ---------- LIGHT MODE (default) ---------- */
:root {
  /* Colors — paper and ink, with one hazard accent */
  --bg:           #F5F2EA;   /* warm paper */
  --bg-elevated: #FFFFFF;   /* cards, modals */
  --ink:          #0A0A0A;   /* primary text */
  --ink-muted:    #5A5A5A;   /* secondary text */
  --ink-faint:    #9A9A9A;   /* tertiary text, hints */
  --line:         #1A1A1A;   /* borders (always dark for editorial feel) */
  --line-soft:    #E0DCD0;   /* soft separators */
  --accent:       #D4FF00;   /* hazard yellow-green — the brand color */
  --accent-ink:   #0A0A0A;   /* text on accent */
  --danger:       #FF3B30;
  --success:      #00B050;

  /* Typography */
  --font-display: 'Archivo Black', 'Impact', sans-serif;
  --font-body:    'Inter Tight', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Menlo', monospace;

  /* Spacing scale */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 1rem;
  --s-4: 1.5rem;
  --s-5: 2rem;
  --s-6: 3rem;
  --s-7: 5rem;
  --s-8: 8rem;

  /* Other */
  --radius: 0px;          /* sharp corners — editorial, not Web 2.0 */
  --radius-soft: 6px;     /* for accent buttons only */
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Code blocks — these intentionally stay the same in BOTH light and dark
     mode so that syntax highlighting (accent green, muted gray) always has
     enough contrast against the background. Don't tie these to --ink/--bg. */
  --code-bg:     #0A0A0A;   /* always near-black */
  --code-text:   #F5F2EA;   /* always cream */
  --code-accent: #D4FF00;   /* always hazard green */
  --code-muted:  #8A8A8A;   /* always mid-gray, readable on near-black */

  /* "Inverse" surfaces — always-dark panels (CTAs, stat strips, mock
     terminals). Use these whenever the green accent appears AS TEXT on
     the panel, so it stays readable in both themes. */
  --inverse-bg:    #0A0A0A;   /* always near-black */
  --inverse-text:  #F5F2EA;   /* always cream */
  --inverse-faint: #8A8A8A;   /* always mid-gray */
}

/* ---------- DARK MODE ---------- */
[data-theme="dark"] {
  --bg:           #0A0A0A;
  --bg-elevated:  #141414;
  --ink:          #F5F2EA;
  --ink-muted:    #A8A8A8;
  --ink-faint:    #5A5A5A;
  --line:         #2A2A2A;
  --line-soft:    #1F1F1F;
  --accent:       #D4FF00;   /* same accent — pops in both modes */
  --accent-ink:   #0A0A0A;
}

/* ---------- RESET ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  font-feature-settings: 'ss01', 'cv11';
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img, svg { display: block; max-width: 100%; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ---------- LAYOUT ---------- */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--s-5);
}
@media (max-width: 768px) {
  .container { padding: 0 var(--s-3); }
}

/* ---------- TYPOGRAPHY ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
  letter-spacing: -0.01em;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0.85rem 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}
.btn:hover {
  background: var(--ink);
  color: var(--bg);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--line);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent-ink);
}
[data-theme="dark"] .btn-primary { border-color: var(--accent); }
.btn-primary:hover {
  background: var(--accent-ink);
  color: var(--accent);
  box-shadow: 4px 4px 0 var(--accent);
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
}
.btn-ghost:hover {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

/* ---------- NAVBAR ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 2px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) 0;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.nav-logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border: 2px solid var(--inverse-bg);
  position: relative;
}
.nav-logo-mark::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: var(--inverse-bg);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s-5);
}
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--ink); }
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

/* Dark mode toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--ink); color: var(--bg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ---------- HAMBURGER BUTTON ---------- */
/* Hidden on desktop, shown on mobile */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  cursor: pointer;
}
.mobile-menu-btn:hover { background: var(--ink); color: var(--bg); }
.mobile-menu-btn svg { width: 20px; height: 20px; }

/* ---------- MOBILE MENU (slide-down drawer) ---------- */
.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--bg);
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  padding: var(--s-3) 0;
}
.mobile-menu.is-open {
  display: flex;
}
.mobile-menu a {
  padding: var(--s-3) var(--s-5);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--transition);
}
.mobile-menu a:last-child {
  border-bottom: none;
}
.mobile-menu a:hover {
  background: var(--bg-elevated);
}
.mobile-menu a.mobile-menu-primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border-bottom: 2px solid var(--inverse-bg);
}
.mobile-menu-divider {
  height: 1px;
  background: var(--line);
  margin: var(--s-2) 0;
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: flex; }
  .nav-desktop-only { display: none !important; }
  /* Make the search box on dashboard topbar hide when mobile menu shows */
}

/* ---------- FOOTER ---------- */
.footer {
  border-top: 2px solid var(--line);
  padding: var(--s-6) 0 var(--s-4);
  margin-top: var(--s-8);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--s-5);
  margin-bottom: var(--s-6);
}
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--s-3);
  color: var(--ink-muted);
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: var(--s-2); }
.footer-col a {
  color: var(--ink);
  font-size: 0.9rem;
  transition: color var(--transition);
}
.footer-col a:hover { color: var(--accent-ink); background: var(--accent); padding: 0 4px; }
[data-theme="dark"] .footer-col a:hover { background: var(--accent); color: var(--accent-ink); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  padding-top: var(--s-4);
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; gap: var(--s-2); }
}

/* ---------- UTILITIES ---------- */

/* Auth-state visibility. layout.js adds `signed-in` to <body> once Clerk
   confirms the user is authenticated. Use .hide-when-signed-in on any
   element that should disappear for logged-in visitors (e.g. CTAs urging
   them to sign up). Use .show-when-signed-in for the opposite. */
.signed-in .hide-when-signed-in { display: none !important; }
.show-when-signed-in { display: none; }
.signed-in .show-when-signed-in { display: revert !important; }

.divider {
  height: 2px;
  background: var(--line);
  margin: var(--s-6) 0;
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tag-accent {
  background: var(--accent);
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

/* ---------- ANIMATIONS ---------- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.fade-up {
  animation: slideUp 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ---------- ACCESSIBILITY ---------- */
*:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
