/* ==========================================================================
   Understory website
   Plain CSS, no build step. It sticks to features every current browser
   supports: no nesting, no @layer, no container queries, no colour functions.
   ========================================================================== */

/* Fonts (self-hosted, Latin subset, variable weight) ---------------------- */

@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Figtree";
  src: url("../fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

/* Design tokens ------------------------------------------------------------ */

:root {
  --primary: #AA3EC9;
  --primary-hover: #9A32B8;
  --primary-deep: #7D2598;   /* for text and links on white: 8.1:1 */
  --primary-50: #FBF6FD;
  --primary-100: #F5EAFA;
  --primary-200: #EAD3F3;
  --primary-300: #DDB4EC;

  --ink: #1E1424;
  --ink-soft: #3B3142;
  --ink-muted: #5E5367;
  --ink-faint: #6B6074;
  --line: #E9DEEE;

  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(20px, 5vw, 48px);
  --section-y: clamp(72px, 11vw, 136px);
}

/* Base --------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: #fff;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h2 { font-size: clamp(2rem, 1.3rem + 2.8vw, 3.25rem); }
h3 { font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; }

p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: var(--primary-deep); text-underline-offset: 0.18em; }

a:focus { outline: 3px solid var(--primary-deep); outline-offset: 3px; border-radius: 4px; }
a:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--primary-200); color: var(--ink); }

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

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

.icon {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
}
.skip-link:focus { top: 16px; }

/* Buttons and links -------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 28px;
  border: 2px solid transparent;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

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

.btn-outline { border-color: var(--primary); color: var(--primary-deep); }
.btn-outline:hover { background: var(--primary-50); }

.btn-light { min-height: 56px; background: #fff; color: var(--primary-deep); white-space: normal; overflow-wrap: anywhere; }
.btn-light:hover { background: var(--primary-50); }

.btn-small { min-height: 44px; padding: 0 20px; font-size: 0.9375rem; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 600;
  text-decoration: none;
}
.link-arrow:hover { text-decoration: underline; }
.link-arrow .icon { transition: transform 0.2s ease; }
.link-arrow:hover .icon { transform: translateX(4px); }

/* Header ------------------------------------------------------------------- */

.site-header { padding: 18px 0; }

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  color: var(--ink);
  text-decoration: none;
}
.brand img { width: 40px; height: 40px; border-radius: 11px; }
.brand span {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav { display: none; gap: 28px; }
.nav a {
  padding: 10px 2px;
  color: var(--ink-muted);
  font-weight: 500;
  text-decoration: none;
}
.nav a:hover { color: var(--primary-deep); }

@media (min-width: 760px) {
  .nav { display: flex; margin-right: 8px; }
}

/* Very small phones: keep the logo and the button on one line. */
@media (max-width: 400px) {
  .header-row { column-gap: 12px; }
  .brand { gap: 10px; }
  .brand img { width: 36px; height: 36px; }
  .brand span { font-size: 1.25rem; }
  .btn-small { padding: 0 14px; font-size: 0.875rem; }
  .btn-light { padding: 0 18px; font-size: 0.9375rem; gap: 8px; }
}

/* Hero --------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 5vw, 64px) 0 clamp(72px, 10vw, 128px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(48px, 9vw, 72px);
  align-items: center;
}

@media (min-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 14px;
  border-radius: 999px;
  background: var(--primary-100);
  color: var(--primary-deep);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
}
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }

.hero h1 {
  margin: 22px 0 22px;
  font-size: clamp(2.5rem, 1.4rem + 5.2vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
}
.accent { color: var(--primary); }

.lede {
  max-width: 34rem;
  font-size: clamp(1.1875rem, 1.05rem + 0.6vw, 1.375rem);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  margin-top: 34px;
}

.hero-visual {
  --phone-w: clamp(230px, 62vw, 300px);
  position: relative;
  display: flex;
  justify-content: center;
}
@media (min-width: 900px) {
  .hero-visual { --phone-w: clamp(260px, 26vw, 330px); }
}
.hero-visual .phone { position: relative; z-index: 1; width: var(--phone-w); }

/* A soft glow behind the phone. */
.hero-visual::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 0;
  width: calc(var(--phone-w) * 2.2);
  height: calc(var(--phone-w) * 2.2);
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, #F5EAFA 0%, rgba(245, 234, 250, 0) 100%);
}

/* The fiddlehead curls sit behind the phone and are sized from it. */
.fern {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 0;
  width: calc(var(--phone-w) * 2.3333);
  height: auto;
  overflow: visible;
  transform: translate(-50%, calc(var(--phone-w) * -0.2333));
}
.fern path {
  fill: none;
  stroke: var(--primary-300);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 2;
  stroke-dashoffset: 1;
  animation: draw 2.8s cubic-bezier(0.45, 0.05, 0.25, 1) 0.4s both;
}
.fern path:nth-child(2) { animation-delay: 0.7s; }
.fern path:nth-child(3) { animation-delay: 1s; }

/* Phone frame -------------------------------------------------------------- */

.phone {
  padding: 9px;
  border-radius: 44px;
  background: #261A2E;
  box-shadow:
    0 48px 80px -36px rgba(87, 22, 112, 0.55),
    0 18px 36px -18px rgba(87, 22, 112, 0.35),
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.08);
}
.phone img {
  width: 100%;
  border-radius: 35px;
  background: #FBFAFC;
}

/* Sections ----------------------------------------------------------------- */

.section { padding: var(--section-y) 0; }
.section-tint { background: var(--primary-50); }

.section-head { max-width: 46rem; margin-bottom: clamp(36px, 5vw, 60px); }

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--primary-deep);
  font-size: 0.9375rem;
  font-weight: 600;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--primary);
}

.tag {
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--primary-100);
  font-size: 0.8125rem;
}

.section-intro {
  max-width: 40rem;
  margin-top: 20px;
  color: var(--ink-muted);
  font-size: 1.25rem;
  line-height: 1.6;
  text-wrap: balance;
}

/* Why ---------------------------------------------------------------------- */

.prose-pair {
  display: grid;
  gap: 1.25rem 4rem;
  max-width: 64rem;
  font-size: 1.1875rem;
}
@media (min-width: 860px) {
  .prose-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: clamp(40px, 6vw, 64px);
  border-top: 1px solid var(--line);
}
.stat { padding: 30px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 760px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { padding: 36px 32px 8px 0; border-bottom: 0; }
  .stat + .stat { padding-left: 32px; border-left: 1px solid var(--line); }
}

.stat-figure {
  color: var(--primary);
  font-family: var(--font-serif);
  font-size: clamp(3.5rem, 2.2rem + 4.4vw, 5.25rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}
.stat-text { max-width: 17rem; margin-top: 14px; color: var(--ink-muted); }

.stats-note { margin-top: 22px; color: var(--ink-faint); font-size: 0.9375rem; }

.closing {
  max-width: 40rem;
  margin-top: clamp(48px, 7vw, 80px);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.125rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.cite { margin-left: 1px; font-size: 0.72em; line-height: 0; }
/* Vertical padding enlarges the tap area without changing the line height. */
.cite a { padding: 6px 2px; font-weight: 600; text-decoration: none; }
.cite a:hover { text-decoration: underline; }

/* App ---------------------------------------------------------------------- */

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(40px, 7vw, 56px);
  align-items: center;
}
@media (min-width: 900px) {
  .app-grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 88px; }
}

.app-visual { display: flex; justify-content: center; }
.app-visual .phone { width: min(100%, 310px); }

.features { counter-reset: feature; }
.feature {
  position: relative;
  padding: 28px 0 28px 64px;
  border-top: 1px solid var(--primary-200);
  counter-increment: feature;
}
.feature:first-child { padding-top: 0; border-top: 0; }
.feature:last-child { padding-bottom: 0; }
.feature::before {
  content: counter(feature, decimal-leading-zero);
  position: absolute;
  top: 29px;
  left: 0;
  color: var(--primary);
  font-family: var(--font-serif);
  font-size: 1.5rem;
  line-height: 1.2;
}
.feature:first-child::before { top: 1px; }
.feature h3 { margin-bottom: 8px; font-size: 1.375rem; }

/* Building ----------------------------------------------------------------- */

.pillars {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px;
}
@media (min-width: 860px) {
  .pillars { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px; }
}
.pillar { padding-top: 22px; border-top: 2px solid var(--primary); }
.pillar h3 { margin-bottom: 12px; }

.never {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(44px, 6vw, 64px);
}
.never li {
  padding: 10px 20px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 600;
}

/* Privacy ------------------------------------------------------------------ */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 88px; align-items: start; }
}

.facts { border-bottom: 1px solid var(--primary-200); }
.fact {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 22px 0;
  border-top: 1px solid var(--primary-200);
}
.fact-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  color: var(--primary-deep);
}
.fact p { padding-top: 8px; color: var(--ink-soft); font-size: 1.125rem; line-height: 1.55; }

/* Team --------------------------------------------------------------------- */

.people {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}
@media (min-width: 800px) {
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
}

.person { padding: clamp(24px, 4vw, 40px); border: 1px solid var(--line); border-radius: 28px; }
.person h3 { font-size: 1.875rem; }
.person-role { margin: 6px 0 18px; color: var(--primary-deep); font-weight: 600; }

/* Contact ------------------------------------------------------------------ */

.contact {
  padding: clamp(72px, 10vw, 120px) 0;
  background: var(--primary);
  color: #fff;
  text-align: center;
}
.contact h2 { color: #fff; font-size: clamp(2.25rem, 1.4rem + 3.4vw, 4rem); }
.contact p { max-width: 32rem; margin: 18px auto 34px; font-size: 1.25rem; text-wrap: balance; }
.contact a:focus { outline-color: #fff; }

/* Footer ------------------------------------------------------------------- */

.site-footer { padding: 56px 0 48px; color: var(--ink-muted); font-size: 0.9375rem; }

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 28px;
}
.brand-small img { width: 32px; height: 32px; border-radius: 9px; }
.brand-small span { font-size: 1.25rem; }

.disclaimer { max-width: 44rem; margin-top: 8px; }

.sources-title {
  margin: 40px 0 12px;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0;
}
.sources {
  max-width: 56rem;
  padding-left: 1.4em;
  color: var(--ink-faint);
  font-size: 0.8125rem;
  line-height: 1.55;
  list-style: decimal;
}
.sources li { margin-bottom: 6px; padding-left: 4px; overflow-wrap: anywhere; }
.sources a { color: var(--primary-deep); }

/* One-time animations ------------------------------------------------------ */
/* Nothing here loops. Each animation runs once and stays in its final state. */

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

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

.rise { animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.rise-2 { animation-delay: 0.1s; }
.rise-3 { animation-delay: 0.2s; }
.rise-4 { animation-delay: 0.3s; }

/* Sections fade up once as they scroll into view. Without JavaScript they simply show. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.js [data-reveal="2"] { transition-delay: 0.1s; }
.js [data-reveal="3"] { transition-delay: 0.2s; }
.js [data-reveal].is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; }
  .fern path { animation: none; stroke-dashoffset: 0; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .btn, .link-arrow .icon { transition: none; }
}
