@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=DM+Sans:wght@700;800;900&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────────────────── */
:root {
  --bg:            #D7E8F8;
  --blue-dark:     #0F2340;
  --blue-mid:      #1A3D6E;
  --blue-accent:   #2A6CC4;
  --blue-light:    #5B9BD5;
  --blue-pale:     #DBE9F8;
  --text:          #0F2340;
  --muted:         #4A6080;
  --border:        rgba(42, 108, 196, 0.12);
  --white:         #FFFFFF;
  --nav-h:         68px;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  --t-sm:   clamp(0.85rem, 1.4vw, 1rem);
  --t-base: clamp(1rem,    1.7vw, 1.15rem);
  --t-md:   clamp(1.2rem,  2.2vw, 1.6rem);
  --t-lg:   clamp(1.8rem,  3.5vw, 3rem);
  --t-xl:   clamp(2.2rem,  4.5vw, 3.6rem);
  --t-2xl:  clamp(2.6rem,  5.5vw, 4.4rem);
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  /* Soft powder-blue background with the SVG graphic fixed behind all content.
     background-attachment: fixed gives a natural parallax: bg stays still while
     page content scrolls over it. On mobile Safari it renders fixed (no scroll),
     which is still a pleasing effect. */
  background-color: #0F2340;
  /* Photo sits beneath a translucent blue-white veil so content stays readable.
     Both layers are fixed so the image parallaxes as you scroll. */
  background-image:
    linear-gradient(rgba(235, 243, 255, 0.62), rgba(235, 243, 255, 0.62)),
    url('../images/backdrops/martin-web.jpg');
  background-attachment: fixed, fixed;
  background-size: auto, cover;
  background-position: center center, center 40%;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a     { color: inherit; text-decoration: none; }
img, svg, canvas { display: block; }

/* ── Nav ────────────────────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  transition: background 0.45s, box-shadow 0.45s;
}
.navbar.scrolled {
  background: rgba(240, 245, 251, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(15, 35, 64, 0.07);
}

/* Nav logo (small compass + wordmark) */
#nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: pointer-events 0s;
}
#nav-logo.visible { pointer-events: auto; }

/* Both lines fixed to the same pixel width — equal visual span */
.nav-wordmark-name,
.nav-wordmark-sub {
  display: block;
  width: 78px;
  text-transform: uppercase;
  line-height: 1.2;
}
.nav-wordmark-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 5px;   /* KOMPAS: 6 chars × ~8px + 6×5px ≈ 78px */
  color: var(--blue-dark);
}
.nav-wordmark-sub {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 2px;   /* FOUNDATION: 10 chars × ~5.8px + 10×2px ≈ 78px */
  color: var(--muted);
  margin-top: 2px;
}

/* Nav links */
#nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  opacity: 0;
}
#nav-links a {
  font-size: 13px;
  font-weight: 500;
  color: var(--blue-dark);
  letter-spacing: 0.02em;
  opacity: 0.7;
  transition: opacity 0.2s;
}
#nav-links a:hover { opacity: 1; }
#nav-links .nav-cta {
  opacity: 1;
  padding: 8px 22px;
  background: var(--blue-accent);
  color: var(--white);
  border-radius: 24px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.03em;
  transition: background 0.2s, transform 0.2s;
}
#nav-links .nav-cta:hover { background: var(--blue-mid); transform: translateY(-1px); }

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  height: 100vh;
  min-height: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 55% 50% at 50% 46%, rgba(42, 108, 196, 0.07) 0%, transparent 65%);
  pointer-events: none;
}

/* Smooth fade to white at the bottom of the hero */
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 22%;
  background: linear-gradient(to bottom,
    transparent 0%,
    rgba(255,255,255,0.4) 55%,
    rgba(255,255,255,0.88) 80%,
    white 100%
  );
  pointer-events: none;
  z-index: 4;
}

/* Single centred column — stacks compass → wordmark → tagline naturally */
.hero-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative; /* stacking context for the z-index below */
}

/* The canvas is in normal flow; JS transition moves it via transform */
#hero-logo {
  will-change: transform;
  cursor: pointer;
  position: relative;
  z-index: 3;
}

/* Scale canvas with viewport height — 280px in fullscreen, proportionally
   smaller in windowed mode so layout feels balanced at any window size */
#hero-logo canvas {
  width:  min(280px, 34vh) !important;
  height: min(280px, 34vh) !important;
}

/* Hero title: bold statement above the compass */
#hero-title {
  margin-bottom: 20px;
  text-align: center;
  width: min(560px, 88vw);
}
.hero-title-line {
  font-family: 'DM Sans', var(--font);
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 800;
  color: white;
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 24px rgba(10,20,50,0.30);
}

/* Wordmark: large soft white glow behind the element, fades to transparent
   on all sides — no visible box, just a haze that lifts the text */
#hero-wordmark {
  margin-top: 20px;
  text-align: center;
  will-change: opacity;
  pointer-events: none;
  position: relative;
}
#hero-wordmark::before {
  content: '';
  position: absolute;
  inset: -60px -100px;
  background: radial-gradient(ellipse at center,
    rgba(255,255,255,0.50) 0%,
    transparent 65%
  );
  filter: blur(18px);
  pointer-events: none;
  z-index: -1;
}
.hero-rule         { width: 220px; height: 0.5px; background: rgba(15,35,64,0.20); margin: 0 auto; }
.hero-name         { font-size: 24px; font-weight: 500; letter-spacing: 10px; color: var(--blue-dark); margin-top: 14px; }
.hero-sub          { font-size: 13px; font-weight: 400; letter-spacing: 7px; color: var(--muted); margin-top: 6px; }
.hero-rule-bottom  { width: 220px; height: 0.5px; background: rgba(15,35,64,0.20); margin: 14px auto 0; }

/* Scroll hint */
#scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  animation: hint-float 2.4s ease-in-out 3.5s infinite;
  opacity: 0;
  pointer-events: none;
}
.hint-arrow {
  width: 1px;
  height: 28px;
  background: linear-gradient(to bottom, rgba(42,108,196,0.5), transparent);
}
@keyframes hint-float {
  0%   { opacity: 0;   transform: translateX(-50%) translateY(-5px); }
  30%  { opacity: 0.45; }
  60%  { opacity: 0.45; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0;   transform: translateX(-50%) translateY(5px); }
}

/* Compact on windowed/short screens */
@media (max-height: 700px) {
  #hero-logo canvas { width: 200px !important; height: 200px !important; }
  .hero-title-line { font-size: 22px !important; }
  #hero-title    { margin-bottom: 14px; }
  .hero-name     { font-size: 19px; letter-spacing: 5px; }
  .hero-sub      { font-size: 10px; }
  #hero-wordmark { margin-top: 14px; }
}

/* Mobile portrait — lighthouse fix + title higher */
@media (max-width: 640px) {
  /* On portrait the landscape photo is cropped horizontally.
     Shift X left (25%) so the lighthouse — which sits left of centre
     in the image — stays in the viewport instead of dropping off the edge.
     Y stays at 40% (original desktop value). */
  body {
    background-position: center center, 40% 40%;
  }

  #hero-wordmark {
    position: relative;
    z-index: 5;
  }
  /* Title floats near the very top — nav is transparent at scroll 0
     so text reads through it without conflict. */
  #hero-title {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: min(320px, 88vw);
    margin-bottom: 0;
    text-align: center;
    z-index: 2;
  }
  /* Compass+wordmark stack stays centred on its own */
  .hero-stack {
    padding-top: 18vh;
  }
}

/* ── Content sections ────────────────────────────────────────────────────────── */
.section-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 3rem);
}

/* Mission — white zone, generous breathing room after the hero */
.mission {
  padding: 110px 0 100px;
  background: white;
}
.mission .section-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}
@media (max-width: 760px) {
  .mission .section-inner { grid-template-columns: 1fr; gap: 40px; }
}

/* Pillars — soft powder blue zone */
.pillars-section { padding: 80px 0 100px; background: #E6F1FA; }
.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 760px) { .pillars { grid-template-columns: 1fr; } }

.pillar {
  background: white;
  border-radius: 20px;
  padding: 40px 32px 36px;
  border: 1px solid rgba(42,108,196,0.08);
  box-shadow: 0 8px 40px rgba(15, 35, 64, 0.08);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.55s ease, transform 0.55s ease, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}
.pillar::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--blue-accent), transparent);
  border-radius: 20px 0 0 20px;
}
.pillar:hover { box-shadow: 0 16px 56px rgba(15, 35, 64, 0.13); transform: translateY(-4px) !important; }
.pillar.in-view { opacity: 1; transform: translateY(0); }
.pillar:nth-child(1) { transition-delay: 0s; }
.pillar:nth-child(2) { transition-delay: 0.10s; }
.pillar:nth-child(3) { transition-delay: 0.20s; }

/* Icon as large background watermark — no box, no container */
.pillar-icon {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 120px;
  height: 120px;
  opacity: 0.055;
  pointer-events: none;
  transition: opacity 0.3s;
}
.pillar:hover .pillar-icon { opacity: 0.09; }
.pillar-icon svg {
  width: 100%;
  height: 100%;
  stroke: var(--blue-accent);
  stroke-width: 1;
}
.pillar h3 { font-size: 17px; font-weight: 700; color: var(--blue-dark); margin-bottom: 12px; letter-spacing: -0.01em; }
.pillar p  { font-size: 14px; line-height: 1.75; color: var(--muted); }

/* Stats */
.stats-section {
  background: var(--blue-dark);
  padding: 100px 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px;
  margin-top: 60px;
}
@media (max-width: 760px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } }
.stat-num   { font-size: clamp(2.4rem, 4.5vw, 3.6rem); font-weight: 800; color: var(--white); line-height: 1; margin-bottom: 8px; font-variant-numeric: tabular-nums; min-width: 4ch; }
.stat-label { font-size: 14px; line-height: 1.5; color: rgba(255,255,255,0.5); }

/* Story / CTA — road photo with overlay, white text */
.story-section {
  padding: 130px 0;
  text-align: center;
  position: relative;
  background-color: var(--blue-dark);
  background-image:
    linear-gradient(rgba(230, 240, 255, 0.68), rgba(230, 240, 255, 0.68)),
    url('../images/backdrops/road.jpg');
  background-attachment: fixed, fixed;
  background-size: cover, cover;
  background-position: center center, center 55%;
}
.story-section .kicker       { color: var(--blue-accent); }
.story-section .display      { color: var(--blue-dark); }
.story-section .display em   { color: var(--blue-accent); }
.story-section .body-lg      { color: var(--muted); }
.story-section .btn-primary  { background: var(--blue-accent); box-shadow: 0 8px 28px rgba(42,108,196,0.3); }
.story-section .btn-outline  { border-color: rgba(42,108,196,0.35); color: var(--blue-dark); }
.story-section .btn-outline:hover { border-color: var(--blue-accent); color: var(--blue-accent); }

/* Footer */
.site-footer {
  background: var(--blue-dark);
  color: rgba(255,255,255,0.4);
  padding: 52px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  font-size: 13px;
}
.footer-brand-name { font-size: 12px; font-weight: 700; letter-spacing: 4px; color: rgba(255,255,255,0.65); text-transform: uppercase; }
.footer-brand-sub  { font-size: 8.5px; letter-spacing: 3px; color: rgba(255,255,255,0.28); text-transform: uppercase; margin-top: 3px; }
.footer-links      { display: flex; gap: 24px; }
.footer-links a    { color: rgba(255,255,255,0.4); transition: color 0.2s; }
.footer-links a:hover { color: rgba(255,255,255,0.75); }

/* ── Typography helpers ──────────────────────────────────────────────────────── */
.kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--blue-accent);
  margin-bottom: 16px;
}
.kicker-light { color: rgba(91, 155, 213, 0.85); }

.display {
  font-size: var(--t-xl);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--blue-dark);
}
.display em     { font-style: normal; color: var(--blue-accent); }
.display-light  { color: var(--white); }

.body-lg {
  font-size: var(--t-base);
  line-height: 1.75;
  color: var(--muted);
}
.body-light { color: rgba(255,255,255,0.55); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 32px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--blue-accent);
  color: var(--white);
  box-shadow: 0 8px 28px rgba(42, 108, 196, 0.28);
}
.btn-primary:hover { box-shadow: 0 12px 36px rgba(42, 108, 196, 0.4); }
.btn-outline {
  background: transparent;
  color: var(--blue-dark);
  border: 1.5px solid rgba(42, 108, 196, 0.3);
}
.btn-outline:hover { border-color: var(--blue-accent); color: var(--blue-accent); }

/* ── Reveal animations ────────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

/* ── Divider ──────────────────────────────────────────────────────────────────── */
.section-divider {
  width: calc(100% - 80px);
  max-width: 1100px;
  margin: 0 auto;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(42, 108, 196, 0.12), transparent);
}

/* ── Sub-pages (non-hero pages) ──────────────────────────────────────────────── */
/* Navbar is always fully visible — no scroll trigger needed */
body.subpage .navbar {
  background: rgba(240, 245, 251, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(15, 35, 64, 0.07);
}
body.subpage #nav-logo  { opacity: 1; pointer-events: auto; }
body.subpage #nav-links { opacity: 1; }

/* Page header — photo backdrop with dark overlay, matches home page story section */
.page-header {
  padding: 160px 0 90px;
  background-color: var(--blue-dark);
  background-image:
    linear-gradient(rgba(15,35,64,0.68), rgba(15,35,64,0.68)),
    url('assets/images/backdrops/road.jpg');
  background-size: cover;
  background-position: center 55%;
  background-attachment: fixed;
  text-align: center;
  position: relative;
}
.page-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 18%;
  background: linear-gradient(to bottom, transparent 0%, white 100%);
  pointer-events: none;
}
.page-header-large {
  padding: 260px 0 140px;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.page-header-plain { background-image: none !important; }
.page-header-plain::after { display: none; }

.page-header-large::after {
  height: 70%;
  background: linear-gradient(to bottom,
    rgba(255,255,255,0)    0%,
    rgba(255,255,255,0.01) 12%,
    rgba(255,255,255,0.04) 22%,
    rgba(255,255,255,0.10) 33%,
    rgba(255,255,255,0.22) 44%,
    rgba(255,255,255,0.40) 55%,
    rgba(255,255,255,0.62) 68%,
    rgba(255,255,255,0.82) 82%,
    white                  100%
  );
}
.page-header .kicker { color: rgba(91,155,213,0.9); margin-bottom: 14px; }
.page-header h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  color: white;
  letter-spacing: -0.02em;
  line-height: 1.1;
  max-width: 640px;
  margin: 0 auto;
}
.page-header .page-header-sub {
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  color: rgba(255,255,255,0.65);
  max-width: 520px;
  margin: 1.25rem auto 0;
  line-height: 1.7;
}

/* Programs listing */
.programs-section { padding: 72px 0 120px; background: #E6F1FA; }

.program-card {
  display: block;
  max-width: 680px;
  margin: 0 auto;
  background: white;
  border: 1px solid rgba(42,108,196,0.12);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 4px 32px rgba(15,35,64,0.07);
  text-decoration: none;
  transition: box-shadow 0.25s, transform 0.25s;
}
.program-card:hover {
  box-shadow: 0 8px 48px rgba(15,35,64,0.12);
  transform: translateY(-2px);
}
.program-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.program-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--blue-dark);
}
.status-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--blue-accent);
  background: var(--blue-pale);
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.program-desc {
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
  margin-bottom: 24px;
}
.program-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.program-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--blue-mid);
  background: var(--blue-pale);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ── Mobile ───────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* background-attachment: fixed breaks scrolling on iOS Safari */
  body, .story-section, .page-header, .stats-section {
    background-attachment: scroll !important;
  }
  /* On mobile give the hero its own background instead of relying on the body */
  body {
    background-image: none;
    background-color: #0F2340;
  }
  .hero {
    background-image:
      linear-gradient(rgba(235, 243, 255, 0.62), rgba(235, 243, 255, 0.62)),
      url('../images/backdrops/martin-web.jpg');
    background-size: cover;
    background-position: 40% 40%;
    background-attachment: scroll;
  }
}
@media (max-width: 600px) {
  .navbar { padding: 0 20px; }
  .site-footer { padding: 40px 20px; flex-direction: column; align-items: flex-start; }
  /* Compact nav links so About + Programs + Support Us fits on small screens */
  #nav-links { gap: 12px; }
  #nav-links a:not(.nav-cta) { font-size: 12px; }
  #nav-links .nav-cta { padding: 6px 14px; font-size: 12px; }
  /* Sub-page program card */
  .program-card { padding: 28px 20px; }
  .program-name { font-size: 18px; }
}
