:root {
  --c-navy: #1a3c8f;
  --c-blue: #5fa3e9;
  --c-slate: #7196c8;
  --c-light: #d5e3f5;
  --c-pale: #e8eef9;
  --c-cream: #f6f4f0;
  --c-ink: #0e1a3a;
  --c-accent: #e85a2c;

  --maxw: 1280px;
  --pad: clamp(24px, 4vw, 72px);

  --f-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-body: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --radius-card: 36px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--f-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  color: var(--c-ink);
  background: var(--c-cream);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== TOPBAR ===== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--pad);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(244, 241, 234, 0.55);
  border-bottom: 1px solid rgba(26, 60, 143, 0.08);
  transition: background 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

.brand-logo {
  height: 38px;
  width: auto;
  display: block;
  transition: opacity 0.25s ease;
}
.brand:hover .brand-logo { opacity: 0.75; }

.topbar-meta { display: flex; align-items: center; gap: 20px; }

.socials { display: flex; gap: 4px; }
.social-link {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--c-navy);
  transition: background 0.25s, color 0.25s, transform 0.25s;
}
.social-link:hover {
  background: var(--c-navy);
  color: var(--c-cream);
  transform: translateY(-2px);
}

/* topbar inverted when over dark cards */
body.topbar-dark .topbar {
  background: rgba(14, 26, 58, 0.4);
  border-bottom-color: rgba(244, 241, 234, 0.12);
}
body.topbar-dark .social-link { color: var(--c-cream); }
body.topbar-dark .social-link:hover { background: var(--c-cream); color: var(--c-navy); }

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 120px var(--pad) 60px;
  background: var(--c-cream);
  z-index: 1;
}

.hero-inner {
  position: relative;
  width: 100%;
  max-width: 980px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-logo {
  width: min(86vw, clamp(300px, 56vw, 620px));
  height: auto;
  display: block;
  margin: 0 auto;
  opacity: 0;
  animation: logoFade 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s forwards;
}

@keyframes logoFade { to { opacity: 1; } }

.tagline {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(22px, 2.8vw, 40px);
  color: var(--c-ink);
  margin-top: 8px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.tagline-line {
  display: block;
}

.tagline .tw {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  animation: wordUp 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.tagline-line .tw + .tw { margin-left: 0.28em; }

.tagline .tw:nth-child(1) { animation-delay: 1.80s; }
.tagline .tw:nth-child(2) { animation-delay: 1.90s; }
.tagline .tw:nth-child(3) { animation-delay: 2.00s; }
.tagline .tw:nth-child(4) { animation-delay: 2.10s; }
.tagline-line:nth-child(2) .tw:nth-child(1) { animation-delay: 2.30s; }
.tagline-line:nth-child(2) .tw:nth-child(2) { animation-delay: 2.40s; }

@keyframes wordUp { to { opacity: 1; transform: translateY(0); } }

/* ===== CARD STACK ===== */
.card-stack {
  position: relative;
  z-index: 2;
  background: var(--c-cream);
}

.card {
  position: sticky;
  top: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  padding: 0;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  overflow: hidden;
  transform-origin: 50% 0%;
  will-change: transform, opacity, border-radius;
  transition: box-shadow 0.6s ease;
  box-shadow: 0 -24px 60px -20px rgba(14, 26, 58, 0.18);
}

.card-inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(96px, 14vh, 160px) var(--pad) clamp(60px, 10vh, 100px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 32px;
}

.card-inner-center {
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
}

.card-inner-footer {
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Card color schemes */
.card-navy  { background: var(--c-navy);  color: var(--c-cream); }
.card-light { background: var(--c-light); color: var(--c-navy); }
.card-pale  { background: var(--c-cream); color: var(--c-navy); }

/* Section type styles */
.section-heading {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  max-width: 22ch;
}

/* ---- Manifesto ---- */
.manifesto-body {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(36px, 5.5vw, 80px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 18ch;
  margin-top: 20px;
}

.typewriter {
  min-height: 1.05em;
}
.typewriter::after {
  content: "";
  display: inline-block;
  width: 0.06em;
  height: 0.95em;
  background: currentColor;
  margin-left: 0.08em;
  vertical-align: -0.08em;
  animation: caretBlink 0.85s steps(2, end) infinite;
}
.typewriter.is-done::after {
  animation-duration: 1.2s;
}
@keyframes caretBlink {
  50% { opacity: 0; }
}

/* ---- Card 4: Signup ---- */
.signup-view,
.signup-success {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.signup-view[hidden],
.signup-success[hidden] {
  display: none;
}

.signup-success {
  animation: successFade 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes successFade {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.signup-incentive,
.signup-success-copy {
  font-size: clamp(16px, 1.4vw, 20px);
  opacity: 0.78;
  max-width: 52ch;
  line-height: 1.55;
}

.signup-form {
  margin-top: auto;
  padding-top: 48px;
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 640px;
  border-bottom: 1px solid rgba(26, 60, 143, 0.35);
  position: relative;
  transition: border-color 0.3s;
}
.signup-form:focus-within { border-color: var(--c-navy); }

.signup-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: clamp(16px, 1.4vw, 20px);
  color: var(--c-navy);
  padding: 18px 0;
}
.signup-form input::placeholder { color: rgba(26, 60, 143, 0.45); }

.signup-form button {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 18px 0 18px 20px;
  color: var(--c-navy);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.signup-form button:hover { color: var(--c-accent); }
.btn-arrow { transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1); }
.signup-form button:hover .btn-arrow { transform: translateX(6px); }

.signup-confirm {
  position: absolute;
  top: calc(100% + 14px); left: 0;
  font-size: 14px;
  color: var(--c-navy);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s, transform 0.3s;
}
.signup-confirm.is-show { opacity: 1; transform: translateY(0); }
.signup-confirm.is-error { color: #c2331e; }

/* ---- Card 5: Footer ---- */
.footer-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  align-items: end;
  margin-bottom: 60px;
}
.footer-logo {
  width: clamp(160px, 18vw, 240px);
  height: auto;
  display: block;
}
.footer-tag {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(20px, 2.2vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 22ch;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 64px;
  padding: 40px 0;
  border-top: 1px solid rgba(26, 60, 143, 0.18);
  border-bottom: 1px solid rgba(26, 60, 143, 0.18);
}
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-label {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 6px;
  font-weight: 600;
}
.footer-col a {
  font-size: 16px;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--c-accent); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  opacity: 0.55;
  letter-spacing: 0.06em;
  padding-top: 24px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .topbar { padding: 14px var(--pad); }
  .topbar-meta { gap: 12px; }
  .brand-logo { height: 32px; }
  .footer-hero { grid-template-columns: 1fr; gap: 20px; align-items: start; }
  .footer-grid { grid-template-columns: max-content max-content; gap: 40px; }
  .footer-bottom { flex-direction: column; gap: 8px; }
}

@media (max-width: 560px) {
  .topbar { padding: 12px 20px; }
  .brand-logo { height: 28px; }
  .social-link { width: 30px; height: 30px; }

  .hero { padding: 92px 20px 40px; }
  .hero-logo { width: 86vw; }
  .tagline { font-size: clamp(20px, 5.5vw, 28px); margin-top: 4px; }

  .card-inner { padding: 80px 20px 48px; gap: 20px; }
  .section-heading { font-size: clamp(36px, 10vw, 56px); }
  .manifesto-body { font-size: clamp(32px, 10vw, 56px); margin-top: 0; }

  .signup-form { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 32px; }
  .signup-form input { padding: 14px 0; font-size: 16px; }
  .signup-form button { padding: 14px 0; justify-content: center; }

  .footer-logo { width: 180px; }
  .footer-tag { font-size: clamp(18px, 5vw, 22px); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-col a { font-size: 15px; }
  .footer-bottom { font-size: 11px; padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-logo, .tagline .tw, .hero-bottom { opacity: 1; transform: none; }
  .card { transform: none !important; }
}
