/* ============================================================
   FQS - design system
   Editorial finance: neutral ink, one restrained accent,
   serif display type, hairline rules. No gradients, no glow.
   ============================================================ */

:root {
  --bg:        #121519;
  --bg-2:      #161a1f;
  --surface:   #1b1f26;
  --surface-2: #222732;
  --surface-3: #2b313d;
  --border:    rgba(255,255,255,0.10);
  --border-2:  rgba(255,255,255,0.18);
  --rule:      rgba(255,255,255,0.08);

  --text:      #eef0f2;
  --text-dim:  #a4a8b2;
  --text-faint:#6f7480;

  --accent:    #58a87d;   /* muted market green - used sparingly */
  --accent-ink:#0c0d0f;
  --bull:      #5aa97e;
  --bear:      #cf5b50;
  --amber:     #c9a25e;

  --paper:     #ece9e2;   /* warm off-white for primary buttons */

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow:    0 18px 50px -24px rgba(0,0,0,0.7);
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.25);
  --maxw:      1160px;

  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --serif:     'Newsreader', Georgia, 'Times New Roman', serif;
  --mono:      'IBM Plex Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; }

body {
  font-family: var(--font);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  /* Solid background color with a soft top-to-bottom tone (no grid). */
  background-color: var(--bg);
  background-image: linear-gradient(180deg, #181c22 0%, var(--bg) 42%);
  background-repeat: no-repeat;
  background-attachment: scroll;
}

a { color: var(--text); text-decoration: none; transition: color .18s, opacity .18s; }
a:hover { color: var(--accent); }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.12; letter-spacing: -0.012em; color: #f4f3f1; }
h1 { font-size: clamp(34px, 5vw, 56px); }
h2 { font-size: clamp(26px, 3.4vw, 38px); }
h3 { font-size: 21px; }
h4 { font-family: var(--font); font-weight: 650; font-size: 15px; letter-spacing: 0.01em; }

p { color: var(--text-dim); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.section { padding: 88px 0; border-top: 1px solid var(--rule); }
.section:first-of-type { border-top: none; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }
.center { text-align: center; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.lead { font-size: 19px; line-height: 1.7; color: var(--text-dim); }
.accent { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px; border-radius: 8px; border: 1px solid transparent;
  font-family: var(--font); font-weight: 560; font-size: 14.5px; cursor: pointer;
  transition: background .18s, border-color .18s, color .18s, transform .18s;
  letter-spacing: 0.005em;
}
.btn-primary { background: var(--paper); color: #15161a; }
.btn-primary:hover { background: #fff; color: #15161a; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-2); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); border-color: var(--text-faint); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #67b78c; color: var(--accent-ink); transform: translateY(-1px); }
.btn-sm { padding: 8px 15px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }
.link-arrow { color: var(--text-dim); font-size: 14px; font-weight: 540; }
.link-arrow:hover { color: var(--accent); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}
.card-tight { padding: 20px; }
.hairline { border: none; border-top: 1px solid var(--rule); margin: 0; }

/* ---------- Chips / labels ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 6px; font-size: 12px; font-weight: 560;
  font-family: var(--mono); letter-spacing: 0.02em;
  background: rgba(255,255,255,0.05); color: var(--text-dim); border: 1px solid var(--border);
}
.chip-accent { color: var(--accent); border-color: rgba(88,168,125,0.3); background: rgba(88,168,125,0.08); }
.chip-amber { color: var(--amber); border-color: rgba(201,162,94,0.3); background: rgba(201,162,94,0.08); }
.pos { color: var(--bull); } .neg { color: var(--bear); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 7px; font-weight: 560; letter-spacing: 0.01em; }
input, select, textarea {
  width: 100%; padding: 11px 13px; background: var(--bg-2);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14.5px; font-family: var(--font); transition: border-color .18s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { resize: vertical; min-height: 92px; }

/* ---------- Floating header (fixed, overlays the hero) ---------- */
.navbar {
  position: fixed; top: 14px; left: 0; right: 0; z-index: 100;
  width: calc(100% - 32px); max-width: var(--maxw);
  margin-left: auto; margin-right: auto;
  background: rgba(22,26,31,0.78);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
/* spacer pushes content below the fixed header on pages without a full-bleed hero */
.nav-spacer { height: 88px; }
.nav-inner { padding: 0 10px 0 18px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.nav-brand { display: flex; align-items: center; gap: 11px; font-family: var(--serif); font-weight: 600; font-size: 18px; color: var(--text); letter-spacing: -0.01em; }
.nav-brand .mark { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border-2); display: grid; place-items: center; }
.nav-brand .mark svg { width: 16px; height: 16px; }
/* Brand logo image (replaces the FQS text mark) */
.brand-logo { height: 55px; width: auto; display: block; }
.brand-logo-lg { height: 58px; }
.brand-logo-footer { height: 64px; }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a { color: var(--text-dim); font-weight: 520; font-size: 14px; padding: 7px 12px; border-radius: 7px; transition: color .18s, background .18s; }
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { content: ''; display: block; height: 1.5px; background: var(--accent); margin-top: 4px; border-radius: 2px; }
.nav-links a.admin-link { color: var(--amber); }
.nav-right { display: flex; align-items: center; gap: 9px; }
.nav-avatar { width: 32px; height: 32px; border-radius: 7px; object-fit: cover; border: 1px solid var(--border-2); cursor: pointer; }
.nav-mobile-actions { display: none; } /* only shown inside the mobile hamburger menu */
.nav-toggle { display: none; background: none; border: 1px solid var(--border-2); border-radius: 7px; color: var(--text); width: 36px; height: 34px; cursor: pointer; }
.nav-toggle svg { width: 17px; height: 17px; vertical-align: middle; }
.icon-btn { background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text-dim); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; position: relative; transition: color .18s, border-color .18s; }
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.icon-btn svg { width: 16px; height: 16px; }

/* notifications */
.notif-wrap { position: relative; }
.notif-dot { position: absolute; top: -5px; right: -5px; background: var(--bear); color: #fff; font-size: 10px; min-width: 15px; height: 15px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; font-family: var(--font); font-weight: 600; }
.notif-panel { position: absolute; right: 0; top: 46px; width: 320px; max-width: calc(100vw - 24px); max-height: 400px; overflow-y: auto; border-radius: 12px; padding: 7px; display: none; background: var(--surface-2); border: 1px solid var(--border-2); box-shadow: var(--shadow); z-index: 300; }
.notif-panel.open { display: block; }
.notif-item { padding: 10px 12px; border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-item.unread { background: rgba(88,168,125,0.06); }

/* ---------- Footer ---------- */
.footer { background: #0b0d10; border-top: 1px solid var(--border); margin-top: 80px; padding: 56px 0 36px; }
.footer-grid { display: grid; grid-template-columns: 2.2fr 1fr 1fr 1fr; gap: 36px; }
.footer h4 { font-size: 12px; margin-bottom: 15px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; }
.footer a { display: block; color: var(--text-dim); font-size: 14px; margin-bottom: 10px; }
.footer a:hover { color: var(--accent); }
.footer-bottom { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: 16px 28px; flex-wrap: wrap; }
.footer-bottom .fb-copy { color: var(--text-faint); font-size: 13px; margin: 0; }
.footer-bottom .fb-legal { display: flex; align-items: center; gap: 22px; }
.footer-bottom .fb-legal a { color: var(--text-dim); font-size: 13px; }
.footer-bottom .fb-legal a:hover { color: var(--accent); }
@media (max-width: 560px) { .footer-bottom { flex-direction: column; align-items: flex-start; gap: 14px; } }

/* ---------- Progress bar ---------- */
.progress { height: 5px; background: rgba(255,255,255,0.07); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .6s ease; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 2000; display: flex; flex-direction: column; gap: 9px; }
.toast { background: var(--surface-2); border: 1px solid var(--border-2); border-left: 2px solid var(--accent); padding: 13px 17px; border-radius: 9px; box-shadow: var(--shadow); font-size: 14px; min-width: 230px; animation: toastIn .25s ease; }
.toast.error { border-left-color: var(--bear); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(6,7,9,0.78); backdrop-filter: blur(3px); z-index: 1500; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 28px; max-width: 480px; width: 100%; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 6px; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 56px 24px; color: var(--text-dim); border: 1px dashed var(--border-2); border-radius: var(--radius); }
.empty-state h3 { margin-bottom: 8px; }

/* ---------- Utility ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8{margin-top:8px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}.mt-32{margin-top:32px}
.mb-8{margin-bottom:8px}.mb-16{margin-bottom:16px}.mb-24{margin-bottom:24px}.mb-32{margin-bottom:32px}
.hidden { display: none !important; }
.spinner { width: 22px; height: 22px; border: 2px solid rgba(255,255,255,0.14); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 28px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; vertical-align: middle; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  /* Pin the notifications panel to the viewport so it never runs off the screen edge. */
  .notif-panel { position: fixed; top: 80px; left: 12px; right: 12px; width: auto; max-width: none; max-height: 72vh; }
  .nav-links { position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 12px; padding: 10px; gap: 2px; display: none; box-shadow: var(--shadow); }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 11px 13px; font-size: 15px; }
  .nav-links a.active::after { display: none; }
  .nav-links a.active { background: rgba(255,255,255,0.05); }
  .nav-toggle { display: grid; place-items: center; }
  /* Move the smushed top-bar buttons (Sign in / Join / Sign out) into the menu instead */
  .nav-right .btn { display: none; }
  .nav-mobile-actions { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
  .nav-mobile-actions a { color: var(--text-dim); font-weight: 540; font-size: 15px; padding: 11px 13px; border-radius: 7px; }
  .nav-mobile-actions a:hover { background: rgba(255,255,255,0.05); color: var(--text); }
  .nav-mobile-actions a.nav-join { color: var(--accent-ink); background: var(--accent); font-weight: 640; text-align: center; }
}
@media (max-width: 620px) {
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .section { padding: 56px 0; }
  .container { padding: 0 20px; }
}

/* ---------- Back-to-top button (global, on every page) ---------- */
.back-to-top { position: fixed; bottom: 24px; right: 24px; width: 42px; height: 42px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text); display: grid; place-items: center; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s, border-color .15s, color .15s; z-index: 90; box-shadow: var(--shadow); cursor: pointer; }
.back-to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.back-to-top:hover { border-color: var(--accent); color: var(--accent); }
.back-to-top svg { width: 18px; height: 18px; }
