/* naturae.wiki — landing
   Two themes (night / day) driven by html[data-theme]. All colors live in the tokens below. */

:root,
[data-theme="night"] {
  --bg: #0a1626;
  --bg-fade: rgba(10, 22, 38, 0);
  --text: #e9eef6;
  --text-strong: #f3f6fb;
  --text-soft: #aebdd3;
  --text-muted: #9fb0c8;
  --text-faint: #8fa3c2;
  --accent: #F2B66D;
  --em: #c8d6ec;

  --hero-sky: linear-gradient(180deg, #071a38 0%, #0c2a55 38%, #14477a 72%, #1d5f93 100%);
  --hero-text: #eef3fb;
  --scene-img: url("../img/night-scene.jpg");
  --fig-img: url("../img/night-figures.jpg");
  --scene-filter: saturate(.95) contrast(.92);
  --veil:
    radial-gradient(ellipse 55% 40% at 50% 46%, rgba(8, 22, 48, .45), transparent 75%),
    linear-gradient(180deg, rgba(8, 22, 48, .15) 0%, rgba(8, 22, 48, .15) 28%, rgba(10, 28, 58, .35) 62%, rgba(10, 28, 58, 0) 78%, rgba(8, 26, 51, .55) 100%);
  --grain-opacity: .18;

  --pill-bg: rgba(10, 30, 62, .5);
  --pill-border: rgba(255, 255, 255, .12);
  --pill-link: #d4deee;
  --pill-active: rgba(255, 255, 255, .09);
  --brand-muted: #93a7c6;

  --eyebrow: #a9bcd9;
  --lede: #b6c5dc;
  --search-bg: rgba(10, 30, 62, .55);
  --search-border: rgba(255, 255, 255, .16);
  --ring: #d4deee;
  --placeholder: #a9b9d2;
  --btn-bg: #f8f4ec;
  --btn-text: #2b2724;
  --strip: rgba(226, 232, 240, .78);

  --rule: rgba(233, 238, 246, .18);
  --card-bg: rgba(255, 255, 255, .04);
  --card-border: rgba(255, 255, 255, .09);
  --feature-bg: rgba(255, 255, 255, .035);
  --feature-visual-bg: #071225;
  --feature-stars: radial-gradient(1.2px 1.2px at 23px 41px, #fff, transparent), radial-gradient(1px 1px at 141px 97px, #dfe9ff, transparent), radial-gradient(1.5px 1.5px at 77px 183px, #fff, transparent), radial-gradient(1px 1px at 203px 29px, #cfdcff, transparent), radial-gradient(1px 1px at 181px 211px, #fff, transparent), radial-gradient(1px 1px at 59px 131px, #bcd0ff, transparent);

  --cta-fade: linear-gradient(180deg, #0a1626 0%, rgba(10, 22, 38, .2) 35%, rgba(10, 22, 38, .2) 70%, #0a1626 100%);
  --footer-border: rgba(255, 255, 255, .08);

  color-scheme: dark;
}

[data-theme="day"] {
  --bg: #f8f4ec;
  --bg-fade: rgba(248, 244, 236, 0);
  --text: #2b2724;
  --text-strong: #2b2724;
  --text-soft: #5d564f;
  --text-muted: #6f675e;
  --text-faint: #6f675e;
  --accent: #8C3B2E;
  --em: #8C3B2E;

  --hero-sky: linear-gradient(180deg, #e4ecf2 0%, #dbe6ee 45%, #cfdfe8 70%, #c3d8e2 100%);
  --hero-text: #2b2724;
  --scene-img: url("../img/day-scene.jpg");
  --fig-img: url("../img/day-figures.jpg");
  --scene-filter: saturate(.85);
  --veil: linear-gradient(180deg, rgba(240, 244, 246, .45) 0%, rgba(240, 244, 246, .45) 30%, rgba(240, 244, 246, .15) 60%, rgba(240, 244, 246, 0) 72%, rgba(240, 244, 246, 0) 100%);
  --grain-opacity: .12;

  --pill-bg: rgba(255, 255, 255, .6);
  --pill-border: rgba(43, 39, 36, .12);
  --pill-link: #4a443e;
  --pill-active: rgba(43, 39, 36, .07);
  --brand-muted: #6f675e;

  --eyebrow: #5d564f;
  --lede: #4f4942;
  --search-bg: rgba(255, 255, 255, .7);
  --search-border: rgba(43, 39, 36, .12);
  --ring: #2b2724;
  --placeholder: #7d776f;
  --btn-bg: #2b2724;
  --btn-text: #f8f4ec;
  --strip: #5d564f;

  --rule: rgba(43, 39, 36, .22);
  --card-bg: rgba(255, 255, 255, .6);
  --card-border: rgba(43, 39, 36, .10);
  --feature-bg: rgba(255, 255, 255, .55);
  --feature-visual-bg: #e6eef1;
  --feature-stars: linear-gradient(180deg, #dbe7ef, #eef2f0);

  --cta-fade: linear-gradient(180deg, #f8f4ec 0%, rgba(248, 244, 236, .1) 30%, rgba(248, 244, 236, .1) 70%, #f8f4ec 100%);
  --footer-border: rgba(43, 39, 36, .12);

  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s ease, color .4s ease;
}
a { color: inherit; text-decoration: none; }
a:hover { opacity: .85; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.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; }
.mono, .label, .eyebrow, .strip, .kicker { font-family: 'JetBrains Mono', monospace; }
.serif, h1, h2, h3 { font-family: 'Newsreader', serif; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: block; flex: none; }
.muted { color: var(--brand-muted); }

/* ---------- hero ---------- */
/* The hero fills the window. The scene is sized from the window (as tall as the window,
   or wider when the window is wide) and anchored to the bottom, so the figures are always
   in view without scrolling; the copy reserves room for them at the bottom. */
.hero {
  --scene-h: max(66.667vw, 100vh);
  --scene-h: max(66.667vw, 100svh);
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--hero-sky);
  color: var(--hero-text);
}
.scene {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: calc(var(--scene-h) * 1.5);
  aspect-ratio: 3 / 2;
  transform: translate(-50%, 10%); /* trims a strip of grass under the figures' feet */
  filter: var(--scene-filter);
  /* fade the top edge into the hero's sky, in case the hero is taller than the scene */
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 18%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 18%);
}
.scene-bg, .fig {
  position: absolute;
  inset: 0;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.scene-bg { background-image: var(--scene-img); }

/* The figures (ape → astronomer) walk in one at a time: each slice of the figures image
   is revealed through its own horizontal mask. */
.fig {
  background-image: var(--fig-img);
  /* Horizontal mask picks this figure's slice; the vertical one fades the band in and out
     softly so the figures image's sky never shows a hard edge against the scene's sky. */
  -webkit-mask-image:
    linear-gradient(90deg, transparent var(--a), #000 var(--b), #000 var(--c), transparent var(--d)),
    linear-gradient(180deg, transparent 44%, #000 55%, #000 86%, transparent 92%);
  -webkit-mask-composite: source-in;
          mask-image:
    linear-gradient(90deg, transparent var(--a), #000 var(--b), #000 var(--c), transparent var(--d)),
    linear-gradient(180deg, transparent 44%, #000 55%, #000 86%, transparent 92%);
          mask-composite: intersect;
  animation: fig .7s cubic-bezier(.2, .7, .2, 1) both;
  animation-delay: var(--delay);
}
.fig-1 { --a: 14%;   --b: 15.5%; --c: 23.3%; --d: 24.7%; --delay: .20s; }
.fig-2 { --a: 23.3%; --b: 24.7%; --c: 31%;   --d: 32.4%; --delay: .45s; }
.fig-3 { --a: 31%;   --b: 32.4%; --c: 39.5%; --d: 40.9%; --delay: .70s; }
.fig-4 { --a: 39.5%; --b: 40.9%; --c: 47.3%; --d: 48.7%; --delay: .95s; }
.fig-5 { --a: 47.3%; --b: 48.7%; --c: 57%;   --d: 58.4%; --delay: 1.20s; }
.fig-6 { --a: 57%;   --b: 58.4%; --c: 66.3%; --d: 67.7%; --delay: 1.45s; }
.fig-7 { --a: 66.3%; --b: 67.7%; --c: 83%;   --d: 85%;   --delay: 1.70s; }

.veil { position: absolute; inset: 0; background: var(--veil); }
/* Film grain: random noise, not a dot grid (a regular grid turns into a visible screen on retina). */
.grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  pointer-events: none;
}

@keyframes fig { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .8s ease-out 2.1s both; }
@media (prefers-reduced-motion: reduce) {
  .fig, .rise { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- nav ---------- */
.nav {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 34px 24px 0;
}
.pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 26px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  color: var(--hero-text);
  font-size: 15px;
  font-family: inherit;
}
.brand {
  font-family: 'Newsreader', serif;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.01em;
  line-height: 1;
}
.links { gap: 2px; padding: 6px; }
.links a { padding: 11px 22px; border-radius: 999px; color: var(--pill-link); }
.links a.active { background: var(--pill-active); color: var(--hero-text); }
.nav-end { display: flex; gap: 14px; }
.theme-toggle {
  padding: 0;
  width: 50px;
  height: 50px;
  justify-content: center;
  cursor: pointer;
}
[data-theme="night"] .icon-moon,
[data-theme="day"] .icon-sun { display: none; }

/* ---------- hero copy ---------- */
.hero-copy {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* bottom padding = the part of the scene the figures stand in */
  padding: clamp(20px, 5vh, 56px) 24px calc(var(--scene-h) * .3);
  gap: 22px;
}
.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--eyebrow); }
h1 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(38px, min(6.6vw, 8.5vh), 96px);
  line-height: 1;
  letter-spacing: -.025em;
  color: var(--text-strong);
  text-wrap: balance;
}
h1 em, .cta h2 em { color: var(--em); }
.lede { margin: 0; max-width: 600px; font-size: 19px; line-height: 1.55; color: var(--lede); text-wrap: pretty; }

.search {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(640px, 100%);
  margin-top: 10px;
  padding: 8px 8px 8px 26px;
  border-radius: 999px;
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}
.ring { width: 14px; height: 14px; border: 1.5px solid var(--ring); border-radius: 50%; flex: none; display: block; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: 'Newsreader', serif;
  font-size: 21px;
  color: var(--text-strong);
}
.search input::placeholder { color: var(--placeholder); }
.search input::-webkit-search-cancel-button { display: none; }

.btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  cursor: pointer;
  padding: 15px 26px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-family: 'Hanken Grotesk', sans-serif;
  font-weight: 600;
  font-size: 16px;
}

.strip {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 30px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 36px;
  padding: 0 24px;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--strip);
}
.hero-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 200px;
  background: linear-gradient(180deg, var(--bg-fade), var(--bg));
}

/* ---------- main ---------- */
.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(56px, 7vw, 96px) clamp(20px, 5vw, 48px) clamp(72px, 9vw, 120px);
  display: flex;
  flex-direction: column;
  gap: clamp(72px, 9vw, 120px);
}
.block { display: flex; flex-direction: column; gap: 28px; scroll-margin-top: 24px; }
.block-head, .block-rule { padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.label { font-weight: 400; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin: 0; color: var(--text-muted); }
.accent-link { font-size: 15px; color: var(--accent); }
.block-head .accent-link { font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 28px;
  border-radius: 22px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  transition: transform .2s ease, border-color .2s ease;
}
.card:hover { opacity: 1; transform: translateY(-2px); border-color: var(--accent); }
.card svg { color: var(--accent); flex: none; }
.card-title { font-family: 'Newsreader', serif; font-size: 28px; letter-spacing: -.01em; }
.card-desc { font-size: 14px; color: var(--text-muted); margin-top: 6px; }

.feature {
  display: flex;
  flex-wrap: wrap;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: var(--feature-bg);
}
.feature-visual {
  flex: 1 1 420px;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background-color: var(--feature-visual-bg);
  background-image: var(--feature-stars);
  background-size: 240px 240px;
  font-family: 'Newsreader', serif;
  font-size: clamp(30px, 3.6vw, 46px);
  color: var(--text-strong);
  text-align: center;
}
[data-theme="day"] .feature-visual { background-size: 100% 100%; }
.feature-body {
  flex: 1 1 380px;
  padding: clamp(32px, 4vw, 52px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: center;
}
.kicker { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.feature h3 { font-weight: 400; font-size: clamp(34px, 3.4vw, 44px); letter-spacing: -.015em; margin: 0; color: var(--text-strong); }
.feature p { font-size: 17px; line-height: 1.6; color: var(--text-soft); margin: 0; max-width: 44ch; }
.feature .accent-link { margin-top: 6px; }

.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 40px; }
.pillars > div { display: flex; flex-direction: column; gap: 10px; }
.pillar-title { font-family: 'Newsreader', serif; font-size: 28px; color: var(--text-strong); }
.pillars p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--text-soft); }

/* ---------- closing CTA ---------- */
.cta {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 96px 24px;
}
.cta-bg {
  position: absolute;
  inset: 0;
  background-image: var(--scene-img);
  background-size: cover;
  background-position: 50% 0%;
}
.cta-fade { position: absolute; inset: 0; background: var(--cta-fade); }
.cta-copy { position: relative; display: flex; flex-direction: column; align-items: center; gap: 26px; }
.cta h2 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 1.04;
  letter-spacing: -.02em;
  color: var(--text-strong);
}
.cta .btn { padding: 16px 30px; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--footer-border); }
.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px clamp(20px, 5vw, 48px) 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 40px;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-faint);
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-family: 'Newsreader', serif; font-size: 22px; color: var(--text); }
.footer-brand .dot { width: 9px; height: 9px; }
.footer-brand .muted { color: var(--text-faint); }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.footer-links a { padding: 6px 0; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .links a { padding: 10px 14px; }
  .search { padding-left: 18px; }
  .search input { font-size: 18px; }
  .btn { padding: 13px 18px; }
}

/* ---------- short windows (laptops, browser with many toolbars) ---------- */
@media (max-height: 760px) {
  .nav { padding-top: 18px; gap: 10px; }
  .pill { padding: 10px 20px; }
  .brand { font-size: 21px; }
  .links { padding: 4px; }
  .links a { padding: 8px 18px; }
  .theme-toggle { width: 42px; height: 42px; padding: 0; }
  .hero-copy { gap: 14px; }
  .eyebrow { display: none; }
  .lede { font-size: 16px; }
  .search { margin-top: 4px; padding: 6px 6px 6px 22px; }
  .search input { font-size: 18px; }
  .search .btn { padding: 11px 20px; }
  .strip { bottom: 16px; }
}
