/* ==============================================
   IF Website — Component Styles
   Tokens come from brand.css (loaded before this).
   ============================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}
body {
  background: var(--bg);
  font-family: var(--sans);
  color: var(--text);
  overflow-x: hidden;
}

/* ── NAV ── floating, scroll-triggered backdrop */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 48px;
  transition:
    background 0.3s,
    backdrop-filter 0.3s,
    border-color 0.3s,
    padding 0.3s;
  border-bottom: 1px solid transparent;
}
nav.scrolled {
  background: rgba(var(--bg-rgb), 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(var(--p1-rgb), 0.12);
  padding: 14px 48px;
}
.nav-logo {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.nav-logo span {
  color: var(--p1);
}
.nav-links {
  display: flex;
  gap: 32px;
}
.nav-links a {
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-links a:hover {
  color: var(--acc);
}
.nav-cta {
  font-family: var(--mono);
  font-weight: 550;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--p1);
  border: 1px solid var(--p1);
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
}
.nav-cta:hover {
  background: var(--p1);
  opacity: 0.75;
  color: var(--bg);
}
.nav-menu-wrapper {
  position: relative;
  display: inline-block;
}

.nav-menu-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  text-transform: uppercase;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 6px;
}

.nav-menu-arrow {
  display: inline-block;
  transition: transform 0.25s ease;
  font-size: 0.8em;
}

.nav-menu-btn[aria-expanded='true'] .nav-menu-arrow {
  transform: rotate(180deg);
}

.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 160px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(var(--p1-rgb), 0.25);
  overflow: hidden;
  z-index: 1000;
}

.nav-dropdown.open {
  display: block;
  animation: dropdownOpen 0.2s ease;
}

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

.nav-dropdown-item {
  display: block;
  padding: 12px 20px;
  color: var(--p1);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    background 0.15s,
    color 0.15s;
}

.nav-dropdown-item:hover {
  background: rgba(var(--p1-rgb), 0.2);
  color: #fff;
}

/* ── HERO ── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 120px 48px 80px;
  position: relative;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 100% 0%,   rgba(var(--hab-rgb), 0.13) 0%, transparent 50%),
    radial-gradient(ellipse at 55%  40%,  rgba(var(--p1-rgb),  0.11) 0%, transparent 50%),
    radial-gradient(ellipse at 0%   100%, rgba(var(--p3-rgb),  0.45) 0%, transparent 55%);
}

/* canvas grid sits between bg and content */
#heroCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.hero-eyebrow {
  position: relative;
  z-index: 2;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--hab);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-eyebrow::before {
  content: '';
  display: block;
  width: 32px;
  height: 1px;
  background: var(--hab);
}
.hero-h1 {
  position: relative;
  z-index: 2;
  font-family: var(--display);
  font-size: clamp(52px, 7vw, 96px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2px;
  max-width: 820px;
  margin-bottom: 28px;
}
.hero-h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--acc) 0%, var(--p1) 60%, var(--p2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  position: relative;
  z-index: 2;
  font-size: 17px;
  line-height: 1.7;
  color: var(--muted);
  max-width: 580px;
  margin-bottom: 44px;
}
.hero-actions {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 16px;
  align-items: center;
}

.btn-primary {
  font-family: var(--mono);
  font-weight: 550;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--p1);
  padding: 14px 24px;
  border-radius: 4px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
}
.btn-primary:hover {
  background: var(--acc);
  transform: translateY(-1px);
}

.btn-ghost {
  font-family: var(--mono);
  font-weight: 550;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  padding: 14px 20px;
  border: 1px solid rgba(var(--hab-rgb), 0.35);
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.btn-ghost:hover {
  border-color: var(--hab);
  color: var(--hab);
}

/* ── SECTIONS ── */
section {
  padding: 40px 48px;
  position: relative;
}

.section-eyebrow {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--hab);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-eyebrow::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--hab);
}
.section-h2 {
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 16px;
  max-width: 700px;
}
.section-h2 em {
  font-style: normal;
  color: var(--p1);
}
.section-sub {
  font-size: 16px;
  line-height: 1.75;
  color: var(--muted);
  max-width: 580px;
  margin-bottom: 40px;
}

/* ── PILLARS ── */
.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: rgba(var(--p1-rgb), 0.12);
  border: 1px solid rgba(var(--p1-rgb), 0.12);
  border-radius: 8px;
  overflow: hidden;
}
.pillar {
  background: var(--bg1);
  padding: 48px 36px 40px;
  transition: background 0.15s;
  position: relative;
  border-top: 2px solid transparent;
}
.pillar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, var(--hab) 0%, transparent 100%);
}
.pillar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, var(--hab) 0%, transparent 75%);
}
.pillar:hover {
  background: var(--bg2);
}
.pillar-icon {
  position: absolute;
  bottom: 20px;
  right: 24px;
  opacity: 0.5;
  color: var(--hab);
}
.pillar-title {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--acc3);
}
.pillar-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

/* ── DIAGRAM ── */
#diagram-section {
  background: var(--bg1);
  border: 1px solid rgba(var(--p1-rgb), 0.12);
  border-radius: 8px;
  padding: 30px 30px;
  margin: 0 48px;
}
#diagram-wrap {
  width: 100%;
  height: 520px;
  overflow: visible;
}
#diagram {
  display: block;
}

@media (max-width: 768px) {
  #diagram-wrap {
    height: 940px;
  }
}

.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 260px;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.12s;
  font-size: 14px;
  line-height: 1.5;
}
.tooltip.show {
  opacity: 0.95;
}
.tt-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.tt-body {
  color: var(--text);
  font-size: 13px;
}

/* ── EDGE ── */
.edge-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 38px;
  align-items: center;
}
.edge-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.edge-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 24px;
  position: relative;
  transition:
    border-left-color 0.15s,
    background 0.15s;
  overflow: hidden;
}
.edge-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--hab) 0%, transparent 50%);
  transition: opacity 0.2s;
}
.edge-card:hover {
  border-left-color: var(--hab);
  background: var(--bg3);
}
.edge-card-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  color: var(--acc3);
  margin-bottom: 6px;
}
.edge-card-body {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

/* ── CONTACT ── */
#contact {
  background: var(--bg1);
  border-top: 1px solid rgba(var(--p1-rgb), 0.12);
  text-align: center;
}
.contact-inner {
  max-width: 560px;
  margin: 0 auto;
}
.contact-email {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  color: var(--hab);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--hab-rgb), 0.3);
  padding-bottom: 2px;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.contact-email:hover {
  color: var(--hab-light);
  border-color: var(--hab);
}

/* ── FOOTER ── */
footer {
  padding: 24px 48px;
  border-top: 1px solid rgba(var(--p1-rgb), 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-logo {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  color: var(--dim);
}
.footer-copy {
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--dim);
}

/* ── ANIMATIONS ── */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fade-up {
  animation: fade-up 0.7s ease both;
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.35s; }

@keyframes pulse-ring {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.15; }
}
@keyframes dash-chase {
  to { stroke-dashoffset: 20; }
}
.cognitive-edge {
  stroke-dasharray: 6 4;
  animation: dash-chase 0.6s linear infinite;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  nav               { padding: 16px 24px; }
  nav.scrolled      { padding: 12px 24px; }
  .nav-links        { display: none; }
  .hero             { padding: 100px 24px 60px; }
  section           { padding: 48px 24px; }
  .edge-grid        { grid-template-columns: 0.8fr 1.2fr; gap: 28px; }
  footer            { padding: 20px 24px; flex-direction: column; gap: 8px; }
  #diagram-section  { margin: 0 24px; }
}
