@import 'watermarks.css';

:root {
  --bg: #050608;
  --bg-soft: #0e1116;
  --fg: #e9edf1;
  --fg-muted: #94a3b8;
  
  /* Brand Colors from LOGO */
  --primary: #4ad3a6;       /* Brand Teal */
  --primary-glow: rgba(74, 211, 166, 0.5);
  --primary-dim: rgba(74, 211, 166, 0.1);
  --accent: #34d399;        /* Lighter Teal */
  --secondary: #0ea5e9;     /* Tech Blue */
  
  --border: #1e293b;
  --border-hover: #4ad3a6;
  
  --glass: rgba(14, 17, 22, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  
  --shadow: 0 0 0 1px rgba(0,0,0,0.05), 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-glow: 0 0 20px var(--primary-dim);
  
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 50% 0%, var(--primary-dim) 0%, transparent 40%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  background-position: top center, center, center;
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}

.logo { 
  height: 36px; 
  width: auto; 
  filter: drop-shadow(0 0 8px var(--primary-dim));
}

/* Light mode override for logo */
[data-theme="light"] .logo {
  filter: none;
}

.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }

.nav {
  display: flex;
  gap: 4px;
  flex: 1 1 640px;
  flex-wrap: wrap;
  justify-content: center;
  min-width: 0;
}
.nav a {
  color: var(--fg-muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav a.active,
.nav a[aria-current="page"] {
  color: #03120d;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: 1px solid rgba(74, 211, 166, 0.35);
  box-shadow: 0 0 18px rgba(74, 211, 166, 0.22);
}

.actions {
  display: flex;
  gap: 12px;
  flex: 0 0 auto;
  align-items: center;
  margin-left: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--fg);
}

.btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--fg-muted);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--primary);
  color: #000;
  border: 1px solid var(--primary);
  box-shadow: 0 0 15px var(--primary-dim);
}

.btn.primary:hover {
  background: var(--accent);
  box-shadow: 0 0 25px var(--primary-glow);
}

.mobile { display: none; }

/* Hero */
.hero {
  padding: 120px 24px 80px;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  /* Ensure hero stacking context */
  z-index: 2; 
}

.hero h1 {
  font-size: 56px;
  line-height: 1.1;
  margin-bottom: 24px;
  background: linear-gradient(to right, #fff, var(--fg-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  z-index: 3;
}

.hero h1 .highlight {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px var(--primary-dim);
}

.lead {
  font-size: 20px;
  color: var(--fg-muted);
  margin-bottom: 32px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 3;
}

.cta { 
  display: flex; 
  gap: 16px; 
  justify-content: center; 
  flex-wrap: wrap;
  margin-top: 32px; 
  position: relative;
  z-index: 3;
}
.cta .btn {
  flex: 0 1 auto;
}

/* Badges */
.badges { 
  display: flex; 
  gap: 10px; 
  justify-content: center; 
  margin-top: 40px; 
  flex-wrap: wrap; 
  position: relative;
  z-index: 3;
}
.badge {
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  color: var(--primary);
  font-size: 13px;
  font-family: var(--font-mono);
  background: rgba(74, 211, 166, 0.05);
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(4px);
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--primary);
}

/* Features Grid */
.features, .links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 40px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.features article, .card {
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(20, 24, 30, 0.6), rgba(20, 24, 30, 0.3));
  backdrop-filter: blur(12px);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.features article:hover, .card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5), 0 0 20px -10px var(--primary-dim);
}

.features h2, .card h3 {
  font-size: 20px;
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--primary);
}

.features p, .card p {
  color: var(--fg-muted);
  font-size: 15px;
  margin-bottom: 20px;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.stat {
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  background: rgba(14, 17, 22, 0.4);
}

.stat b {
  display: block;
  font-size: 32px;
  font-family: var(--font-mono);
  color: #fff;
  margin-bottom: 4px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 14px;
  margin-top: 80px;
  position: relative; /* Ensure stacking context for watermark */
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  margin-top: 12px;
  padding: 8px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s ease;
}

.social-link:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--primary-dim);
}

/* Responsive */
@media (max-width: 900px) {
  .features, .links, .stats { grid-template-columns: 1fr; }
  .hero h1 { font-size: 40px; }
  .site-header {
    padding: 14px 16px;
  }
  .nav {
    justify-content: flex-start;
    flex-basis: 100%;
  }
  .actions {
    gap: 8px;
  }
}

@media (max-width: 720px) {
  /* Mobile Navigation Overlay */
  .nav {
    display: none;
    position: fixed;
    top: 60px; /* Header height approx */
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
    z-index: 90;
    height: calc(100vh - 60px);
    overflow-y: auto;
  }
  
  .nav.active {
    display: flex;
    animation: slideDown 0.3s ease-out;
  }
  
  .nav a {
    font-size: 18px;
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    width: 100%;
    text-align: center;
  }

  .mobile { display: inline-flex; }
  .hero { padding: 60px 16px; }
  .stats { grid-template-columns: 1fr; }
  .cta { flex-direction: column; }
  .cta .btn {
    width: 100%;
  }
  .actions {
    width: auto;
    margin-left: 0;
  }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

#particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Section Title Fix */
.section-title-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  margin-top: 60px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title {
  font-size: 24px;
  color: #fff;
  margin: 0;
  position: relative;
  display: inline-block;
}

.section-title-tight {
  padding: 0;
  margin-top: 20px;
  margin-bottom: 12px;
}

/* Hexagon Decoration */
.hex-deco {
  width: 12px;
  height: 12px;
  background: var(--primary);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  box-shadow: 0 0 10px var(--primary);
}


.portal-strip, .capability-grid, .doc-portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  padding: 8px 24px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.portal-card {
  border: 1px solid rgba(74, 211, 166, 0.2);
  border-radius: 18px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(14, 17, 22, 0.92), rgba(14, 17, 22, 0.68));
  box-shadow: 0 18px 48px -20px rgba(0, 0, 0, 0.7), 0 0 30px -18px rgba(74, 211, 166, 0.45);
}

.portal-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #ffffff;
}

.portal-card p, .portal-card li {
  color: var(--fg-muted);
  font-size: 15px;
}

.portal-card ul {
  margin: 0 0 18px 20px;
  padding: 0;
}

.portal-card .btn {
  margin-right: 10px;
  margin-bottom: 10px;
}

.homepage-focus-grid,
.homepage-resource-grid {
  padding-top: 8px;
}

.section-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-intro {
  color: var(--fg-muted);
  max-width: 880px;
  margin: 0 0 18px 0;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  color: var(--primary);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.kicker::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
}

.social-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.formula-shell {
  padding-bottom: 24px;
}

.formula-grid,
.formula-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.formula-grid {
  margin-top: 20px;
}

.formula-note-grid {
  margin-top: 24px;
}

.formula-card,
.formula-note-card {
  border: 1px solid rgba(74, 211, 166, 0.18);
  border-radius: 18px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(20, 24, 30, 0.82), rgba(9, 12, 18, 0.78));
  box-shadow: 0 18px 48px -24px rgba(0, 0, 0, 0.7), 0 0 24px -18px rgba(74, 211, 166, 0.5);
}

.formula-label {
  margin: 0 0 14px;
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.formula-display {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  margin: 0 0 16px;
  padding: 20px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at 50% 0%, rgba(74, 211, 166, 0.08), transparent 45%), rgba(5, 8, 12, 0.82);
  color: #f8fbff;
  font-family: "Times New Roman", Georgia, serif;
  font-size: clamp(1.45rem, 2.4vw, 2.3rem);
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 24px -20px rgba(74, 211, 166, 0.6);
}

.formula-display-compact {
  font-size: clamp(1.18rem, 2vw, 1.8rem);
}

.formula-display-inline {
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  padding-top: 16px;
  padding-bottom: 16px;
}

.formula-display::-webkit-scrollbar {
  height: 8px;
}

.formula-display::-webkit-scrollbar-thumb {
  background: rgba(74, 211, 166, 0.28);
  border-radius: 999px;
}

.formula-ident {
  font-style: italic;
  letter-spacing: 0.01em;
}

.formula-display sub,
.formula-display sup,
.formula-note-card sub,
.formula-note-card sup {
  font-size: 0.62em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

.formula-display sub,
.formula-note-card sub {
  bottom: -0.25em;
}

.formula-display sup,
.formula-note-card sup {
  top: -0.55em;
}

.formula-op {
  display: inline-block;
  margin: 0 0.28em;
}

.fraction {
  display: inline-grid;
  grid-template-rows: auto auto;
  justify-items: center;
  align-items: center;
  position: relative;
  min-width: 4.4em;
  margin: 0 0.12em;
  padding: 0.12em 0.18em;
  vertical-align: middle;
}

.fraction::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1.6px solid rgba(255, 255, 255, 0.95);
  transform: translateY(-50%);
}

.fraction-top,
.fraction-bottom {
  display: block;
  padding: 0.04em 0.12em;
}

.fraction-top {
  padding-bottom: 0.2em;
}

.fraction-bottom {
  padding-top: 0.2em;
}

.formula-desc,
.formula-note-card p,
.formula-note-card li {
  color: var(--fg-muted);
  margin: 0;
  font-size: 15px;
}

.formula-note-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #fff;
}

.formula-note-list {
  margin: 0;
  padding-left: 18px;
}

.formula-note-list li + li {
  margin-top: 10px;
}

@media (max-width: 720px) {
  .portal-strip, .capability-grid, .doc-portal-grid {
    grid-template-columns: 1fr;
  }

  .formula-grid,
  .formula-note-grid {
    grid-template-columns: 1fr;
  }

  .formula-card,
  .formula-note-card {
    padding: 20px;
  }

  .formula-display {
    padding: 18px 14px;
    text-align: left;
  }
}
