/* =========================================================
   NeedACheat — Global Styles + Design System
   ========================================================= */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; line-height: 1.6; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; overflow-x: hidden; }
img, picture, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; background: none; border: none; outline: none; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
::selection { background: var(--accent); color: #fff; }

/* ---------- Root Tokens (Dark default) ---------- */
:root {
  --bg-primary: #06060f;
  --bg-secondary: #0c0c18;
  --bg-card: rgba(14, 14, 26, 0.85);
  --bg-card-hover: rgba(18, 18, 32, 0.9);
  --border: rgba(255, 255, 255, 0.055);
  --border-hover: rgba(255, 255, 255, 0.11);
  /* matte-glass surfaces + blur + spring (dark defaults) */
  --glass-sm: rgba(255, 255, 255, 0.03);
  --glass: rgba(10, 10, 20, 0.8);
  --glass-strong: rgba(6, 6, 15, 0.92);
  --blur-sm: blur(10px);
  --blur: blur(20px);
  --blur-lg: blur(32px);
  --shadow-card: 0 0 0 0.5px rgba(255,255,255,0.04) inset, 0 24px 64px rgba(0,0,0,0.55);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --text-primary: #f0f0ff;
  --text-secondary: #8888aa;
  --text-muted: #55556a;
  --accent: #7c6dff;
  --accent-hover: #9b8fff;
  --accent-glow: rgba(124,109,255,0.2);
  --accent-2: #ff6b9d;
  --accent-3: #4ecdc4;
  --success: #4ade80;
  --warning: #fbbf24;

  --font-serif: 'Instrument Serif', 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'Courier New', monospace;
  --font-hand:  'Caveat', 'Bradley Hand', cursive;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow: 0 10px 30px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 40px var(--accent-glow);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --container: 1200px;
  --navbar-h: 72px;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg-primary: #fafafa;
  --bg-secondary: #f3f3f8;
  --bg-card: #ffffff;
  --bg-card-hover: #f7f7fc;
  --border: rgba(0,0,0,0.06);
  --border-hover: rgba(0,0,0,0.14);
  /* light-mode glass — keeps frosted surfaces light, not dark */
  --glass-sm: rgba(0, 0, 0, 0.02);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.85);
  --shadow-card: 0 0 0 0.5px rgba(0,0,0,0.04) inset, 0 24px 64px rgba(10,10,26,0.1);
  --text-primary: #0a0a1a;
  --text-secondary: #555570;
  --text-muted: #9999b0;
  --accent: #5b4de0;
  --accent-hover: #4a3dcf;
  --accent-glow: rgba(91,77,224,0.15);
  --accent-2: #e0527a;
  --accent-3: #2ab5ad;
  --shadow: 0 10px 30px rgba(10,10,26,0.08);
  --shadow-lg: 0 20px 60px rgba(10,10,26,0.12);
  color-scheme: light;
}

/* ---------- Body base ---------- */
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}

/* Fine film-grain over the whole UI (premium matte feel) */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.038;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 300px 300px;
}

/* Noise overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/></svg>");
}
[data-theme="light"] body::before { opacity: 0.055; mix-blend-mode: multiply; }

/* Background blobs */
.blob-layer { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.22; will-change: transform; }
.blob--1 { width: 520px; height: 520px; top: -180px; left: -120px; background: var(--accent); animation: blobDrift 22s ease-in-out infinite; }
.blob--2 { width: 460px; height: 460px; top: 30%; right: -160px; background: var(--accent-2); animation: blobDrift 28s ease-in-out infinite reverse; }
.blob--3 { width: 400px; height: 400px; bottom: -150px; left: 30%; background: var(--accent-3); animation: blobDrift 26s ease-in-out infinite; animation-delay: -8s; }
[data-theme="light"] .blob { opacity: 0.18; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 400; letter-spacing: -0.02em; line-height: 1.05; color: var(--text-primary); }
h1 { font-size: clamp(2.6rem, 6vw, 5rem); }
h2 { font-size: clamp(2rem, 4.2vw, 3.4rem); }
h3 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
h4 { font-size: 1.15rem; font-family: var(--font-sans); font-weight: 600; letter-spacing: -0.01em; }
p  { color: var(--text-secondary); font-size: 1rem; }

.mono { font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.02em; }
.eyebrow { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--text-muted); }

.gradient-text {
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 45%, var(--accent-3) 90%);
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: gradientShift 7s ease-in-out infinite;
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; position: relative; z-index: 2; }
.section { padding: clamp(3.5rem, 8vw, 7rem) 0; position: relative; z-index: 2; }
.section-header { text-align: center; max-width: 720px; margin: 0 auto clamp(2rem, 5vw, 4rem); }
.section-header .eyebrow { display: inline-block; margin-bottom: 0.75rem; }
.section-header p { margin-top: 1rem; font-size: 1.05rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 1.4rem;
  border-radius: 12px;
  font-weight: 500; font-size: 0.95rem;
  font-family: var(--font-sans);
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  position: relative; overflow: hidden;
  white-space: nowrap;
  border: 1px solid transparent;
  user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  border: none;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 24px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.18); }
.btn-primary:active { transform: translateY(0); }
.btn-primary::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(120deg, transparent 40%, rgba(255,255,255,0.35) 50%, transparent 60%);
  transform: translateX(-120%); transition: transform 0.8s var(--ease);
}
.btn-primary:hover::before { transform: translateX(120%); }

.btn-ghost {
  background: var(--glass-sm);
  color: var(--text-primary);
  border: 0.5px solid var(--border-hover);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  letter-spacing: -0.01em;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn-ghost:hover { background: var(--bg-card); border-color: var(--accent); }

.btn-lg { padding: 1.05rem 1.75rem; font-size: 1rem; border-radius: 14px; }
.btn-sm { padding: 0.55rem 0.9rem; font-size: 0.85rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform 0.35s var(--ease-out), border-color 0.35s var(--ease), background-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
  position: relative;
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
}
/* top-edge light reflection */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  box-shadow: 0 20px 50px rgba(0,0,0,0.3), 0 0 0 1px var(--accent-glow);
}

/* ---------- Inputs ---------- */
.input, .textarea, .select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.textarea { min-height: 160px; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.select { appearance: none; padding-right: 2.5rem; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%238888aa' stroke-width='1.5' d='M1 1.5l5 5 5-5'/></svg>"); background-repeat: no-repeat; background-position: right 1rem center; }

label.field { display: block; }
label.field > span { display: block; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; }

/* ---------- Navbar ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--navbar-h);
  display: flex; align-items: center;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s var(--ease);
  background: var(--glass-strong);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border-bottom: 0.5px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03);
}
.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg-primary) 70%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.nav__brand { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; }
.nav__brand .star { color: var(--accent); font-size: 1rem; animation: spinStar 12s linear infinite; display: inline-block; }
.nav__links { display: none; gap: 2rem; align-items: center; }
.nav__links a { color: var(--text-secondary); font-size: 0.92rem; transition: color 0.2s var(--ease); position: relative; }
.nav__links a:hover { color: var(--text-primary); }
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -4px; height: 1px; background: var(--accent);
  transition: right 0.3s var(--ease);
}
.nav__links a:hover::after { right: 0; }
.nav__actions { display: flex; align-items: center; gap: 0.6rem; }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background-color 0.25s var(--ease), transform 0.35s var(--ease-out);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(-18deg); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { width: 18px; height: 18px; }
[data-theme="dark"] .theme-toggle .icon-sun, :root:not([data-theme]) .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.nav__burger {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 4px;
}
.nav__burger span { display: block; width: 16px; height: 1.5px; background: var(--text-primary); transition: transform 0.3s var(--ease), opacity 0.3s var(--ease); }
.nav.is-open .nav__burger span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav.is-open .nav__burger span:nth-child(2) { opacity: 0; }
.nav.is-open .nav__burger span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.nav__mobile {
  position: fixed; top: var(--navbar-h); left: 0; right: 0;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  transform: translateY(-120%); opacity: 0; pointer-events: none;
  transition: transform 0.35s var(--ease-out), opacity 0.25s var(--ease);
  z-index: 99;
}
.nav.is-open .nav__mobile { transform: translateY(0); opacity: 1; pointer-events: auto; }
.nav__mobile a { display: block; padding: 0.75rem 0; color: var(--text-primary); border-bottom: 1px solid var(--border); font-size: 1rem; }
.nav__mobile a:last-child { border-bottom: none; }

@media (min-width: 900px) {
  .nav__links { display: flex; }
  .nav__burger, .nav__mobile { display: none; }
}

/* ---------- Footer ---------- */
.footer {
  padding: 4rem 0 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  position: relative; z-index: 2;
}
.footer__grid {
  display: grid; gap: 2.5rem;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
}
@media (max-width: 760px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
.footer__brand { display: flex; flex-direction: column; gap: 0.75rem; max-width: 320px; }
.footer__brand h4 { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 400; }
.footer__brand p { font-size: 0.9rem; }
.footer__col h5 { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 1rem; font-weight: 500; }
.footer__col ul { display: flex; flex-direction: column; gap: 0.7rem; }
.footer__col a { color: var(--text-secondary); font-size: 0.92rem; transition: color 0.2s var(--ease); }
.footer__col a:hover { color: var(--accent); }
.footer__bottom { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(124, 109, 255, 0.1);
  border: 0.5px solid rgba(124, 109, 255, 0.28);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}
[data-theme="dark"] .badge { color: rgba(180, 170, 255, 0.9); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px #7c6dff; animation: pulse 2.4s ease-in-out infinite; }

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed; right: 1rem; bottom: 1rem;
  display: flex; flex-direction: column; gap: 0.65rem;
  z-index: 200; pointer-events: none;
}
.toast {
  min-width: 260px; max-width: 360px;
  padding: 0.9rem 1.1rem;
  background: var(--bg-card); border: 1px solid var(--border-hover);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.92rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  display: flex; align-items: center; gap: 0.75rem;
  transform: translateX(120%); opacity: 0;
  transition: transform 0.5s var(--ease-out), opacity 0.3s var(--ease);
  pointer-events: auto;
  border-left: 3px solid var(--accent);
}
.toast.is-in { transform: translateX(0); opacity: 1; }
.toast.is-out { transform: translateX(120%); opacity: 0; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 10px; border: 2px solid var(--bg-primary); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Focus ring ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Utility ---------- */
.grid { display: grid; gap: 1.5rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }

.tag { font-family: var(--font-mono); font-size: 0.7rem; padding: 0.25rem 0.55rem; border-radius: 6px; background: var(--accent-glow); color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; }

.divider { height: 1px; background: var(--border); margin: 2rem 0; }

/* main page wrapper */
main { position: relative; z-index: 2; padding-top: var(--navbar-h); }

/* ---------- Nav auth avatar button ---------- */
.nav-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent, #7c6aff);
  color: #fff; font-weight: 700; font-size: 15px;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Mobile nav (FIX 1) ─────────────────────────────────── */
@media (max-width: 768px) {
  .nav__actions { gap: 6px; }
  .nav__actions .btn-primary { display: none; }
  #langSwitcher, .lang-switcher { display: none; }
  #navAuthBtn { font-size: 13px !important; padding: 6px 12px !important; }
  .nav__brand { font-size: clamp(14px, 4vw, 18px); }
}

/* ─── General mobile polish (FIX 7) ─────────────────────── */
@media (max-width: 480px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .section { padding-top: 48px; padding-bottom: 48px; }
  h2 { font-size: clamp(1.6rem, 7vw, 2.5rem); }
  .btn { font-size: 14px; padding: 10px 18px; }
}

/* Hide cookie banner before page renders if already accepted */
html.nac-cookies-ok #cookieBanner {
  display: none !important;
}
