/*
 * fs-design.css — functionSPACE Design System
 * Single source of truth for all growth.functionspace.dev pages.
 * Link this file, then add only page-specific styles inline.
 *
 * Contents:
 *   1. Tokens
 *   2. Theme (light override)
 *   3. Base
 *   4. Keyframes
 *   5. Nav
 *   6. Layout
 *   7. Corner bracket system
 *   8. Section block (canonical framed section)
 *   9. Hero
 *  10. Category bar
 *  11. Section typography
 *  12. Partner grid & cards
 *  13. Buttons
 *  14. Footer
 *  15. Responsive
 */


/* ─────────────────────────────────────────
   1. TOKENS
───────────────────────────────────────── */
:root {
  /* Colour */
  --color-bg:           #0d0e12;
  --color-surface:      #131519;
  --color-surface-alt:  #181b20;
  --color-border:       #1e2128;
  --color-text:         #F0F1F3;
  --color-text-2:       #c0c5ce;
  --color-text-3:       #8B919A;
  --color-text-muted:   #5a6170;
  --color-accent:       #3B82F6;
  --color-accent-sub:   rgba(59,130,246,0.08);
  --color-accent-bdr:   rgba(59,130,246,0.25);
  --color-strong:       #F0F1F3;
  --color-wireframe:    #454c5a;
  --code-pill-bg:       #0c1220;

  /* Typography */
  --font-heading: 'Hedvig Letters Serif', Georgia, serif;
  --font-sans:    'Inter', -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Spacing */
  --ease: cubic-bezier(0.4,0,0.2,1);
  --content-w: 1200px;

  /*
   * Section rhythm — every corner-bracketed section uses these.
   * Adjust only here; breakpoints scale proportionally.
   */
  --section-gap-top:    40px;
  --section-gap-bottom: 28px;
  --section-gap-x:      16px;   /* horizontal breathing room from viewport on mobile */
  --section-pad-v:      72px;   /* top/bottom internal padding */
  --section-pad-h:      40px;   /* left/right internal padding */
}


/* ─────────────────────────────────────────
   2. THEME — light mode
───────────────────────────────────────── */
[data-theme="light"] {
  --color-bg:           #F9F9F9;
  --color-surface:      #FFFFFF;
  --color-surface-alt:  #F0F0F2;
  --color-border:       #D8DCE2;
  --color-text:         #202124;
  --color-text-2:       #434954;
  --color-text-3:       #525966;
  --color-text-muted:   #676F7F;
  --color-strong:       #202124;
  --color-wireframe:    #B5BCC9;
  --code-pill-bg:       #EEF2FF;
}


/* ─────────────────────────────────────────
   3. BASE
───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body { display: flex; flex-direction: column; min-height: 100vh; }
a { color: inherit; text-decoration: none; }


/* ─────────────────────────────────────────
   4. KEYFRAMES
───────────────────────────────────────── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}


/* ─────────────────────────────────────────
   5. NAV
───────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--color-border);
  background: rgba(13,14,18,0.92);
  backdrop-filter: blur(12px);
}
[data-theme="light"] .nav { background: rgba(249,249,249,0.92); }

.nav-frame {
  position: relative;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 40px;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 28px;
}

/* Nav corner brackets (smaller than section corners) */
.nc { position: absolute; width: 14px; height: 14px; }
.nc--tl { top: 0; left: 0; border-top: 1px solid var(--color-wireframe); border-left: 1px solid var(--color-wireframe); }
.nc--tr { top: 0; right: 0; border-top: 1px solid var(--color-wireframe); border-right: 1px solid var(--color-wireframe); }
.nc--bl { bottom: 0; left: 0; border-bottom: 1px solid var(--color-wireframe); border-left: 1px solid var(--color-wireframe); }
.nc--br { bottom: 0; right: 0; border-bottom: 1px solid var(--color-wireframe); border-right: 1px solid var(--color-wireframe); }

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-mark { display: block; color: rgba(255,255,255,0.92); }
[data-theme="light"] .nav-logo-mark { color: rgba(0,0,0,0.6); }

.wordmark-img { display: block; opacity: 0.92; }
[data-theme="light"] .wordmark-img { filter: invert(1); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  flex: 1;
}

.nav-links a {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255,255,255,0.9);
  transition: color 0.15s;
}
.nav-links a:hover { color: #fff; }
[data-theme="light"] .nav-links a { color: rgba(0,0,0,0.65); }
[data-theme="light"] .nav-links a:hover { color: rgba(0,0,0,0.9); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.9);
  transition: color 0.15s;
  flex-shrink: 0;
}
.nav-icon:hover { color: #fff; }
[data-theme="light"] .nav-icon { color: rgba(0,0,0,0.55); }
[data-theme="light"] .nav-icon:hover { color: rgba(0,0,0,0.9); }

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  padding: 7px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s;
}
.nav-pill:hover { border-color: var(--color-wireframe); }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-bg);
  background: var(--color-strong);
  padding: 7px 16px;
  border-radius: var(--radius-md);
  transition: opacity 0.15s;
  white-space: nowrap;
}
.nav-cta:hover { opacity: 0.85; }

/* Mobile hamburger toggle — hidden on desktop, shown ≤900px (injected by fs-nav.js) */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}
.nav-toggle:hover { border-color: var(--color-wireframe); }
.nav-toggle-icon {
  position: relative;
  width: 16px;
  height: 12px;
  display: block;
}
.nav-toggle-icon::before,
.nav-toggle-icon::after,
.nav-toggle-icon span {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s var(--ease), opacity 0.15s var(--ease), top 0.2s var(--ease);
}
.nav-toggle-icon::before { top: 0; }
.nav-toggle-icon span    { top: 50%; transform: translateY(-50%); }
.nav-toggle-icon::after  { top: 100%; transform: translateY(-100%); }

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-icon span { opacity: 0; }

/* Mobile drawer panel (injected by fs-nav.js) */
.nav-drawer {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  background: rgba(13,14,18,0.98);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  z-index: 99;
  transform: translateY(-8px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease), visibility 0.2s var(--ease);
  padding: 16px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
[data-theme="light"] .nav-drawer { background: rgba(249,249,249,0.98); }
.nav-drawer[data-open="true"] {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}
.nav-drawer a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}
.nav-drawer a:last-child { border-bottom: none; }
.nav-drawer-cta {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-bg) !important;
  background: var(--color-strong);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border-bottom: none !important;
}
body.nav-drawer-open { overflow: hidden; }


/* ─────────────────────────────────────────
   6. LAYOUT
───────────────────────────────────────── */
.center-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}


/* ─────────────────────────────────────────
   7. CORNER BRACKET SYSTEM
   Rule: every element using corners must be
   position:relative with enough margin/padding
   that corners read as a closed frame.
   Minimum gap between adjacent corners: 80px.
   Minimum gap from corners to footer border: 56px.
───────────────────────────────────────── */
.corner { position: absolute; width: 18px; height: 18px; }
.corner--tl { top: -1px; left: -1px; border-top: 1px solid var(--color-wireframe); border-left: 1px solid var(--color-wireframe); }
.corner--tr { top: -1px; right: -1px; border-top: 1px solid var(--color-wireframe); border-right: 1px solid var(--color-wireframe); }
.corner--bl { bottom: -1px; left: -1px; border-bottom: 1px solid var(--color-wireframe); border-left: 1px solid var(--color-wireframe); }
.corner--br { bottom: -1px; right: -1px; border-bottom: 1px solid var(--color-wireframe); border-right: 1px solid var(--color-wireframe); }


/* ─────────────────────────────────────────
   8. SECTION BLOCK
   The canonical framed section. Always use
   this wrapper for any corner-bracketed unit.

   Usage:
     <div class="section-block">
       <span class="corner corner--tl"></span>
       <span class="corner corner--tr"></span>
       <span class="corner corner--bl"></span>
       <span class="corner corner--br"></span>
       ... content ...
     </div>
───────────────────────────────────────── */
.section-block {
  width: 100%;
  max-width: var(--content-w);
  margin: var(--section-gap-top) auto var(--section-gap-bottom);
  padding: var(--section-pad-v) var(--section-pad-h);
  position: relative;
}

/* Alias — existing pages use .researchers-wrap */
.researchers-wrap { composes: section-block; }


/* ─────────────────────────────────────────
   9. HERO
───────────────────────────────────────── */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 40px 80px;
  width: 100%;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 40%, black 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 80% at 50% 40%, black 10%, transparent 75%);
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  width: min(500px, 100vw);
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(59,130,246,0.09) 0%, transparent 70%);
  pointer-events: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
}

.hero-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 720px;
  width: 100%;
  z-index: 1;
}

.launch-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-accent);
  background: var(--color-accent-sub);
  border: 1px solid var(--color-accent-bdr);
  border-radius: 20px;
  padding: 6px 16px;
  letter-spacing: 0.04em;
  margin-bottom: 36px;
}

.launch-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
  animation: blink 2s ease-in-out infinite;
}

h1 {
  font-family: var(--font-heading);
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text);
  max-width: 640px;
  margin-bottom: 28px;
}

.subtitle {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--color-text-3);
  max-width: 480px;
  margin-bottom: 40px;
}

.hero-ctas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}


/* ─────────────────────────────────────────
   10. CATEGORY BAR
   Full-width, no corner brackets.
   Sits directly under hero with no gap.
───────────────────────────────────────── */
.category-bar {
  width: 100%;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.category-bar-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: stretch;
}

.cat-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 18px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-text-3);
}

.cat-item + .cat-item { border-left: 1px solid var(--color-border); }

.sq {
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 2px;
  flex-shrink: 0;
}


/* ─────────────────────────────────────────
   11. SECTION TYPOGRAPHY
───────────────────────────────────────── */
.section-icon {
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  color: var(--color-text-3);
}

.section-headline {
  font-family: var(--font-heading);
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--color-text);
  text-align: center;
  max-width: 520px;
  margin: 0 auto 12px;
}

.section-sub {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text-3);
  text-align: center;
  max-width: 440px;
  margin: 0 auto 40px;
}

/* Aliases for existing pages */
.researchers-headline { font-family: var(--font-heading); font-size: clamp(20px, 2.2vw, 28px); font-weight: 400; line-height: 1.2; letter-spacing: -0.015em; color: var(--color-text); text-align: center; max-width: 520px; margin: 0 auto 12px; }
.researchers-sub { font-size: 14px; font-weight: 400; line-height: 1.6; color: var(--color-text-3); text-align: center; max-width: 440px; margin: 0 auto 40px; }


/* ─────────────────────────────────────────
   12. PARTNER GRID & CARDS
───────────────────────────────────────── */
.partner-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.partner-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s;
}
.partner-card:hover { border-color: var(--color-accent-bdr); }

.partner-preview {
  height: 72px;
  background: var(--color-surface-alt);
  position: relative;
  overflow: hidden;
}

.partner-footer {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.partner-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-2);
}

.partner-card--placeholder {
  border-style: dashed;
  opacity: 0.35;
}
.partner-card--placeholder:hover { border-color: var(--color-border); opacity: 0.45; }

.placeholder-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-text-muted);
}


/* ─────────────────────────────────────────
   13. BUTTONS
───────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-bg);
  background: var(--color-strong);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-3);
  background: transparent;
  padding: 9px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, color 0.15s;
}
.btn-secondary:hover { border-color: var(--color-wireframe); color: var(--color-text-2); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-2);
  padding: 7px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--color-text); border-color: var(--color-wireframe); }


/* ─────────────────────────────────────────
   14. FOOTER
───────────────────────────────────────── */
footer {
  border-top: 1px solid var(--color-border);
  padding: 48px 40px;
}

.footer-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.footer-logo-svg { color: rgba(255,255,255,0.9); }
[data-theme="light"] .footer-logo-svg { color: rgba(0,0,0,0.5); }

.footer-copy {
  font-size: 13px;
  color: var(--color-text-muted);
}

.footer-socials { display: flex; gap: 8px; }

.social-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-3);
  transition: border-color 0.15s, color 0.15s;
}
.social-btn:hover { border-color: var(--color-wireframe); color: var(--color-text-2); }

.theme-switcher {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-3);
  transition: color 0.15s, background 0.15s;
}
.theme-btn.active { background: var(--color-surface); color: var(--color-text); }
.theme-btn:hover:not(.active) { color: var(--color-text-2); }


/* ─────────────────────────────────────────
   15. RESPONSIVE
   Breakpoints: 900 · 768 · 480 · 390
───────────────────────────────────────── */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .partner-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .cat-item:nth-child(n+4) { display: none; }
}

@media (max-width: 768px) {
  .nav-frame { padding: 0 24px; gap: 20px; }
  .nav-right .nav-pill,
  .nav-right .nav-cta { display: none; }
  .hero { padding: 80px 24px 60px !important; }
  .category-bar-inner { padding: 0 24px; flex-wrap: wrap; }
  .cat-item { flex: 0 0 50%; border-left: none; border-top: 1px solid var(--color-border); }
  .cat-item:nth-child(odd) { border-right: 1px solid var(--color-border); }
  .cat-item:nth-child(-n+2) { border-top: none; }
  footer { padding: 36px 24px; }
  .partner-grid { grid-template-columns: repeat(3, 1fr) !important; }

  /*
   * Corner-bracketed sections: pull in from viewport edges.
   * calc(100% - 32px) gives 16px breathing room on each side.
   * Flex centering on .center-zone handles horizontal alignment.
   */
  .section-block,
  .researchers-wrap {
    width: calc(100% - 32px);
    margin-top: 28px;
    margin-bottom: 20px;
    padding: 56px 24px 48px;
  }
}

@media (max-width: 480px) {
  .nav-frame { padding: 0 16px; height: 60px; }
  .nav-drawer { top: 60px; max-height: calc(100vh - 60px); padding: 12px 16px 20px; }
  .nav-pill { display: none; }
  .nav-cta { display: none; }
  .nav-right { gap: 10px; }
  .hero { padding: 60px 16px 48px !important; }
  .hero-ctas { flex-direction: column; align-items: stretch; }
  .hero-ctas .btn-primary,
  .hero-ctas .btn-secondary { justify-content: center; }
  .category-bar-inner { padding: 0 16px; }
  .cat-item { flex: 0 0 100%; border-right: none !important; border-left: none !important; }
  .cat-item + .cat-item { border-top: 1px solid var(--color-border); }
  footer { padding: 28px 16px; }
  .footer-inner { flex-direction: column; gap: 24px; }
  .partner-grid { grid-template-columns: repeat(2, 1fr) !important; }

  .section-block,
  .researchers-wrap {
    width: calc(100% - 24px);
    margin-top: 20px;
    margin-bottom: 16px;
    padding: 40px 16px 36px;
  }
}

@media (max-width: 390px) {
  .partner-grid { grid-template-columns: 1fr !important; }
  .section-block,
  .researchers-wrap { width: calc(100% - 16px); }
}
