/* TWP Landingpages — Base: reset, typography scale, container, hairlines, focus.
   Komponenten in components.css. Tokens in tokens.css. */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

body {
  font-family: var(--font-sans);
  font-size: var(--size-body);
  line-height: 1.65;
  color: var(--fg);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, canvas, video { display: block; max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--navy); color: var(--paper); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--navy); /* sky fails 3:1 on paper */
  outline-offset: 3px;
  border-radius: 2px;
}
.section--navy :focus-visible { outline-color: var(--sky); }

/* ---------- Layout ---------- */

.container {
  width: min(var(--container-max), calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}

.section { padding-block: var(--section-pad); }

/* Navy world: flips the semantic layer, components follow automatically */
.section--navy {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  --bg: var(--navy);
  --fg: #fff;
  --fg-soft: rgba(255, 255, 255, 0.72);
  --rule: var(--line-on-navy);
  --sky-text: #8FC2FF; /* AA for small text on navy */
  color: var(--fg);
}

/* ---------- Typography ---------- */

.display-1,
.display-2 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.04;
  text-wrap: balance;
  color: var(--fg);
}
.display-1 { font-size: var(--size-h1); }
.display-2 { font-size: var(--size-h2); font-weight: 700; line-height: 1.12; }

/* Serif-italic accent — 1–2 words per headline, never full sentences (§3) */
.italic {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0;
}

.lead {
  font-size: var(--size-lead);
  line-height: 1.6;
  color: var(--fg-soft);
  max-width: 38rem;
  text-wrap: pretty;
}

.body-max { max-width: 38rem; }

.mono-label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--size-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-soft);
}

.section-marker {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--size-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-soft);
}
/* the scroll thread ticks markers off as it passes them */
.section-marker::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.65em;
  border-radius: 50%;
  border: 1px solid var(--rule);
  vertical-align: 9%;
  transition: background-color 0.35s var(--ease-out), border-color 0.35s var(--ease-out);
}
.section-marker.is-passed::before {
  background: var(--sky);
  border-color: var(--sky);
}

/* Scroll thread: fixed 1px progress line, desktop only (injected by motion.js) */
.thread {
  position: fixed;
  left: clamp(14px, 2.2vw, 26px);
  top: 10vh;
  bottom: 10vh;
  width: 1px;
  background: var(--line);
  z-index: 5;
  pointer-events: none;
}
.thread__fill {
  width: 100%;
  height: 100%;
  background: var(--sky);
  transform: scaleY(0);
  transform-origin: top center;
}

.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Hairlines (§4: the ordering system) ---------- */

.rule {
  border: 0;
  height: 1px;
  background: var(--rule);
}

/* ---------- Buttons & links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 1.02rem 1.9rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), background-color 0.35s var(--ease-out);
  will-change: transform;
}
.btn:hover {
  background: var(--navy-deep);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(30, 58, 138, 0.25);
}
.btn:active { transform: translateY(0); }

.btn .arrow { transition: transform 0.35s var(--ease-out); }
.btn:hover .arrow { transform: translateX(3px); }

.btn--light {
  background: #fff;
  color: var(--navy);
}
.btn--light:hover {
  background: var(--paper);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

/* Text link with self-drawing underline (§5.5) */
.link-draw {
  color: inherit;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 0% 1px;
  background-position: 0 100%;
  padding-bottom: 2px;
  transition: background-size 0.45s var(--ease-out);
}
.link-draw:hover { background-size: 100% 1px; }

/* ---------- Motion gating ----------
   Inline head script adds html.motion only when JS runs AND no reduced-motion.
   motion.js adds .motion-ready once GSAP is confirmed; if GSAP is missing it
   removes .motion. Failsafe: if motion.js never runs, everything appears at 3s. */

html.motion [data-load],
html.motion [data-reveal],
html.motion [data-reveal-group] > * {
  opacity: 0;
}
html.motion [data-hairline] {
  transform: scaleX(0);
  transform-origin: left center;
}
html.motion:not(.motion-ready) [data-load],
html.motion:not(.motion-ready) [data-reveal],
html.motion:not(.motion-ready) [data-reveal-group] > *,
html.motion:not(.motion-ready) [data-hairline] {
  /* 1.5s: on slow connections content must not wait for the motion layer */
  animation: motion-failsafe 0.45s ease-out 1.5s forwards;
}
@keyframes motion-failsafe {
  to { opacity: 1; transform: none; }
}

/* Lenis recommendation */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

/* ---------- Reduced motion: content first, no choreography ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .btn .arrow, .link-draw { transition: none; }
}

/* ---------- Small helpers ---------- */

/* author display rules must never beat the hidden attribute */
[hidden] { display: none !important; }

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