/* ═══════════════════════════════════════════════════════════════════════════════
   P31 LABS — phosphorus31.org
   Universal Design System v2.0 — Org Appearance (Light Mode)
   Based on p31-universal-canon.json /1.2.0
   
   Professional, corporate-grade design rivaling top-tier SaaS companies.
   Light, warm, accessible, trustworthy.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  /* Brand Palette (Universal across rings) */
  --p31-coral: #cc6247;
  --p31-teal: #25897d;
  --p31-cyan: #4db8a8;
  --p31-butter: #cda852;
  --p31-lavender: #8b7cc9;
  --p31-phosphorus: #3ba372;
  --p31-phosphor: #00FF88;
  
  /* Org Appearance (Light Mode) — phosphorus31.org */
  --void: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #ebeae4;
  --surface-3: #e5e5e0;
  --cloud: #1e293b;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  
  /* Semantic */
  --border-subtle: rgba(15, 23, 42, 0.09);
  --border: rgba(15, 23, 42, 0.14);
  --glass-border: rgba(15, 23, 42, 0.07);
  --glass-surface: rgba(255, 255, 255, 0.82);
  
  /* Typography — Atkinson Hyperlegible for accessibility */
  --font-body: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  
  /* Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.0625rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  
  /* Layout */
  --max-w-sm: 640px;
  --max-w-md: 768px;
  --max-w-lg: 1024px;
  --max-w-xl: 1280px;
  --max-w-2xl: 1536px;
  
  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* Shadows — soft, corporate */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.10);
  --shadow-glow-teal: 0 0 24px rgba(37, 137, 125, 0.15);
  
  /* Motion — Material 3 grammar */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --duration-instant: 100ms;
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
  
  /* Z-index */
  --z-base: 0;
  --z-dropdown: 50;
  --z-sticky: 100;
  --z-overlay: 200;
  --z-modal: 300;
}

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  background: var(--void);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "liga" 1, "calt" 1;
}

::selection {
  background: var(--p31-teal);
  color: white;
}

/* ── TYPOGRAPHY ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  margin-bottom: var(--space-4);
  color: var(--ink-secondary);
}

a {
  color: var(--p31-teal);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}

a:hover {
  color: var(--p31-coral);
}

/* ── LAYOUT ── */
.container {
  width: 100%;
  max-width: var(--max-w-xl);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-sm { max-width: var(--max-w-md); }
.container-lg { max-width: var(--max-w-2xl); }

/* ── HEADER / NAV ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(245, 244, 240, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
}

.logo {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.logo sup {
  font-size: 0.6em;
  color: var(--p31-phosphorus);
}

.nav-links {
  display: flex;
  gap: var(--space-6);
  list-style: none;
}

.nav-links a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-secondary);
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
  transition: all var(--duration-fast) var(--ease-standard);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--p31-teal);
  border-bottom-color: var(--p31-teal);
}

/* ── HERO ── */
.hero {
  padding: var(--space-20) 0 var(--space-16);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: var(--space-6);
}

.hero-badge .dot {
  width: 8px;
  height: 8px;
  background: var(--p31-phosphorus);
  border-radius: var(--radius-full);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  max-width: 900px;
  margin: 0 auto var(--space-6);
  background: linear-gradient(135deg, var(--ink) 0%, var(--p31-teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: var(--text-xl);
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto var(--space-8);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
}

.btn-primary {
  background: var(--p31-teal);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: #1e6b5e;
  box-shadow: var(--shadow-lg), var(--shadow-glow-teal);
  color: white;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--p31-teal);
}

.btn-ghost {
  background: transparent;
  color: var(--p31-teal);
  padding: var(--space-2) 0;
}

.btn-ghost:hover {
  color: var(--p31-coral);
  background: transparent;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--duration-normal) var(--ease-standard);
}

.card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
}

/* ── GRID ── */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── SECTIONS ── */
.section {
  padding: var(--space-20) 0;
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--space-12);
}

.section-header h2 {
  margin-bottom: var(--space-4);
}

.section-header p {
  font-size: var(--text-lg);
  color: var(--muted);
}

.section-alt {
  background: var(--surface-2);
}

/* ── TAGS ── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tag-teal {
  background: rgba(37, 137, 125, 0.1);
  color: var(--p31-teal);
}

.tag-coral {
  background: rgba(204, 98, 71, 0.1);
  color: var(--p31-coral);
}

.tag-butter {
  background: rgba(205, 168, 82, 0.1);
  color: #9a7e2f;
}

/* ── FOOTER ── */
.site-footer {
  background: var(--surface-2);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-16) 0 var(--space-8);
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-12);
  margin-bottom: var(--space-12);
}

.footer-brand p {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--space-4);
  max-width: 300px;
}

.footer-links h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-4);
}

.footer-links ul {
  list-style: none;
}

.footer-links li {
  margin-bottom: var(--space-2);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--p31-teal);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-subtle);
}

.footer-legal {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

.footer-formula {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--border);
  text-align: center;
  margin-top: var(--space-4);
}

/* ── UTILITIES ── */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-ink { color: var(--ink); }
.text-muted { color: var(--muted); }
.text-teal { color: var(--p31-teal); }
.text-coral { color: var(--p31-coral); }
.text-phosphorus { color: var(--p31-phosphorus); }

.bg-surface { background: var(--surface); }
.bg-surface-2 { background: var(--surface-2); }

.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }

/* ── MOBILE NAV ── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }
  
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-4);
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .nav-links.active {
    display: flex;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }
}

/* ── ACCESSIBILITY ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* Focus visible styles */
:focus-visible {
  outline: 2px solid var(--p31-teal);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  z-index: 9999;
  font-weight: 600;
}

.skip-link:focus {
  top: var(--space-4);
}
