/* The Membrane landing — intentional, fail-closed aesthetic */

:root {
  --ink: #0b1a22;
  --ink-soft: #1a2f3a;
  --muted: #5a6f7a;
  --paper: #eef3f6;
  --paper-deep: #d7e2e9;
  --line: #b6c5cf;
  --navy: #0f2f3f;
  --teal: #0c6b62;
  --teal-deep: #084f49;
  --allow: #1a7a4c;
  --block: #a32020;
  --focus: #1c6b8a;
  --font-display: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 72rem;
}

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

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.55;
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- HERO ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #e8f0f4;
  background:
    radial-gradient(ellipse 90% 70% at 70% 40%, rgba(12, 107, 98, 0.28) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 15% 80%, rgba(28, 107, 138, 0.22) 0%, transparent 50%),
    linear-gradient(165deg, #061018 0%, #0b1a22 42%, #123040 100%);
}

.gate-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.85;
}

.hero-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 55%, rgba(6, 16, 24, 0.55) 100%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(12, 107, 98, 0.15), transparent 70%);
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem clamp(1.25rem, 4vw, 2.5rem);
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
}

.wordmark-sm {
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 0.95rem;
  opacity: 0.85;
}

.topbar-link {
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  opacity: 0.75;
  border-bottom: 1px solid transparent;
  transition: opacity 0.25s var(--ease), border-color 0.25s var(--ease);
}
.topbar-link:hover,
.topbar-link:focus-visible {
  opacity: 1;
  border-color: rgba(232, 240, 244, 0.45);
  outline: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 4vw, 2.5rem) 4rem;
}

.brand {
  margin: 0 0 1.25rem;
  font-size: clamp(3.4rem, 11vw, 7.5rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.92;
  color: #f2f7f9;
  animation: rise-in 0.9s var(--ease) both;
}

.headline {
  margin: 0 0 1rem;
  max-width: 22ch;
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #d5e4eb;
  animation: rise-in 0.9s var(--ease) 0.12s both;
}

.subhead {
  margin: 0 0 2rem;
  max-width: 38rem;
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  font-weight: 400;
  color: rgba(196, 214, 222, 0.88);
  animation: rise-in 0.9s var(--ease) 0.22s both;
}

.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: rise-in 0.9s var(--ease) 0.32s both;
}

.hero-trust-note {
  margin: 1rem 0 0;
  max-width: 32rem;
  font-size: 0.9rem;
  color: rgba(196, 214, 222, 0.72);
  animation: rise-in 0.9s var(--ease) 0.4s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.35rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: #e8f0f4;
  color: var(--ink);
  border-color: #e8f0f4;
}
.btn-primary:hover { background: #fff; border-color: #fff; }

.btn-ghost {
  background: transparent;
  color: #e8f0f4;
  border-color: rgba(232, 240, 244, 0.4);
}
.btn-ghost:hover {
  border-color: #e8f0f4;
  background: rgba(232, 240, 244, 0.06);
}

/* Light-section button variants */
.section .btn-primary,
.footer .btn-primary {
  background: var(--navy);
  color: #f2f7f9;
  border-color: var(--navy);
}
.section .btn-primary:hover,
.footer .btn-primary:hover {
  background: var(--ink);
  border-color: var(--ink);
}
.section .btn-ghost,
.footer .btn-ghost {
  color: var(--navy);
  border-color: var(--line);
}
.section .btn-ghost:hover,
.footer .btn-ghost:hover {
  border-color: var(--navy);
  background: rgba(15, 47, 63, 0.04);
}

.scroll-cue {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(196, 214, 222, 0.55);
  animation: cue-pulse 2.4s var(--ease) infinite;
}
.scroll-cue span {
  display: block;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(196, 214, 222, 0.35);
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cue-pulse {
  0%, 100% { opacity: 0.45; transform: translateX(-50%) translateY(0); }
  50% { opacity: 0.85; transform: translateX(-50%) translateY(4px); }
}

/* ---------- SECTIONS ---------- */

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(4rem, 10vw, 7rem) clamp(1.25rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
}

.section-title {
  margin: 0 0 1.25rem;
  max-width: 18ch;
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--navy);
}

.lede {
  margin: 0;
  max-width: 40rem;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  color: var(--ink-soft);
  line-height: 1.65;
}

/* Soft atmospheric washes between sections — not flat */
.section-problem {
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(163, 32, 32, 0.06), transparent 55%),
    linear-gradient(180deg, #e8eef2 0%, var(--paper) 100%);
}
.section-solution {
  background:
    radial-gradient(ellipse 70% 50% at 0% 50%, rgba(12, 107, 98, 0.08), transparent 60%),
    var(--paper);
}
.section-diff {
  background:
    linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 100%);
}
.section-demo {
  background:
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(28, 107, 138, 0.07), transparent 55%),
    var(--paper);
}
.section-run {
  background:
    linear-gradient(165deg, #e4ecef 0%, #dce8e4 100%);
}
.section-scope {
  background:
    linear-gradient(180deg, var(--paper) 0%, #e2e9ee 100%);
}

/* ---------- DIFFERENTIATORS ---------- */

.diff-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 2.5rem);
  margin-top: 2.5rem;
}

.diff-item {
  padding-top: 1.25rem;
  border-top: 2px solid var(--navy);
}

.diff-num {
  display: block;
  margin-bottom: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--teal);
}

.diff-item h3 {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--navy);
}

.diff-item p {
  margin: 0;
  font-size: 0.98rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

@media (max-width: 820px) {
  .diff-grid { grid-template-columns: 1fr; gap: 2rem; }
}

/* ---------- DEMO CHAIN ---------- */

.demo-chain {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0;
  position: relative;
}

.demo-chain::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 2px;
  background: linear-gradient(
    180deg,
    var(--allow) 0%,
    var(--allow) 30%,
    var(--block) 30%,
    var(--block) 55%,
    var(--navy) 55%,
    var(--navy) 100%
  );
  opacity: 0.55;
}

.step {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 1.1rem;
  padding: 1.15rem 0 1.15rem 0;
  position: relative;
}

.step-state {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  border: 2px solid var(--navy);
  background: var(--paper);
  position: relative;
  z-index: 1;
}

.step-allow .step-state {
  border-color: var(--allow);
  background: var(--allow);
}
.step-block .step-state {
  border-color: var(--block);
  background: var(--block);
}
.step-neutral .step-state {
  border-color: var(--navy);
  background: transparent;
}

.step-body h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--navy);
}

.step-body p {
  margin: 0;
  max-width: 40rem;
  font-size: 0.98rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.demo-note {
  margin: 2rem 0 0;
  max-width: 38rem;
  font-size: 0.95rem;
  color: var(--muted);
}

/* ---------- RUN PANEL ---------- */

.run-panel {
  margin: 2rem 0 1.75rem;
  border: 1px solid var(--line);
  background: var(--ink);
  color: #d5e4eb;
  overflow: hidden;
}

.code {
  margin: 0;
  padding: 1.35rem 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}

.c-dim { color: rgba(196, 214, 222, 0.45); }

.run-open {
  margin: 0;
  padding: 0.9rem 1.4rem;
  border-top: 1px solid rgba(182, 197, 207, 0.25);
  font-size: 0.95rem;
  color: rgba(213, 228, 235, 0.9);
}

.run-open a {
  color: #9ed4c8;
  text-decoration: none;
  border-bottom: 1px solid rgba(158, 212, 200, 0.4);
}
.run-open a:hover { border-bottom-color: #9ed4c8; }

/* ---------- FOOTER ---------- */

.footer {
  background:
    radial-gradient(ellipse 70% 60% at 30% 0%, rgba(12, 107, 98, 0.2), transparent 55%),
    linear-gradient(165deg, #061018 0%, #0b1a22 100%);
  color: #d5e4eb;
  padding: clamp(3.5rem, 8vw, 5.5rem) clamp(1.25rem, 4vw, 2.5rem);
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.footer-brand {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #f2f7f9;
}

.footer-tag {
  margin: 0 0 1.75rem;
  max-width: 28rem;
  font-size: 1.05rem;
  color: rgba(196, 214, 222, 0.85);
}

.footer-meta {
  margin: 2.5rem 0 0;
  font-size: 0.8rem;
  color: rgba(196, 214, 222, 0.5);
  max-width: 36rem;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 1rem;
  font-size: 0.82rem;
  color: rgba(213, 228, 235, 0.72);
}

.footer-legal a {
  text-underline-offset: 0.2em;
  text-decoration-color: rgba(213, 228, 235, 0.35);
}

.footer-legal a:hover,
.footer-legal a:focus-visible {
  color: #f2f7f9;
  text-decoration-color: currentColor;
}

/* ---------- LEGAL PAGES ---------- */

.legal-page {
  min-height: 100svh;
  background:
    radial-gradient(ellipse 70% 35% at 80% 0%, rgba(12, 107, 98, 0.1), transparent 60%),
    var(--paper);
}

.legal-header {
  color: #e8f0f4;
  background:
    radial-gradient(ellipse 70% 100% at 75% 20%, rgba(12, 107, 98, 0.25), transparent 58%),
    linear-gradient(165deg, #061018 0%, #0b1a22 60%, #123040 100%);
}

.legal-header .topbar {
  min-height: 4.5rem;
}

.wordmark-link {
  color: inherit;
  text-decoration: none;
}

.legal-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 3vw, 1.5rem);
}

.legal-hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 6.5rem) clamp(1.25rem, 4vw, 2.5rem);
}

.legal-hero h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(2.5rem, 7vw, 4.75rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  color: #f2f7f9;
}

.legal-effective {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(196, 214, 222, 0.72);
}

.legal-main {
  width: min(100%, 52rem);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5rem) clamp(1.25rem, 4vw, 2.5rem);
}

.legal-intro {
  margin: 0 0 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.08rem, 2vw, 1.25rem);
  line-height: 1.7;
  color: var(--ink-soft);
}

.legal-section {
  margin-top: 2.75rem;
}

.legal-section h2 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--navy);
}

.legal-section p,
.legal-section li {
  color: var(--ink-soft);
}

.legal-section p {
  margin: 0.75rem 0 0;
}

.legal-section ul {
  margin: 0.8rem 0 0;
  padding-left: 1.25rem;
}

.legal-section li + li {
  margin-top: 0.55rem;
}

.legal-section a,
.legal-crosslink a {
  color: var(--teal-deep);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

.legal-crosslink {
  margin: 3.5rem 0 0;
  padding: 1.25rem 1.4rem;
  border-left: 3px solid var(--teal);
  background: rgba(12, 107, 98, 0.06);
  color: var(--ink-soft);
}

.legal-footer {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.legal-footer .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.legal-footer .footer-brand {
  margin: 0;
  font-size: 1.15rem;
}

.legal-footer .footer-legal {
  margin: 0;
}

@media (max-width: 620px) {
  .legal-header .topbar {
    align-items: flex-start;
  }

  .legal-nav {
    align-items: flex-end;
    flex-direction: column;
    gap: 0.35rem;
  }

  .legal-footer .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ---------- REVEAL ON SCROLL ---------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .brand, .headline, .subhead, .cta-group { animation: none; }
  .scroll-cue { animation: none; }
}
