/* Deep Forest AI. One stylesheet, one section per block of the page.
   Spacing uses only: 4, 8, 12, 16, 24, 32, 48, 64, 96, 128, 160 (px). */

/* ---------- 1. Tokens ---------- */
:root {
  --forest-950: #0E1F17;
  --forest-900: #14291E;
  --forest-800: #1F3D2B;
  --forest-700: #2E5A3F;
  --paper:      #F5F2EA;
  --paper-2:    #ECE7DA;
  --ink:        #18201B;
  --muted:      #56615A;
  --muted-dark: #A8B5AB;
  --rule:       #D9D4C5;
  --rule-dark:  rgba(245, 242, 234, 0.14);
  --moss:       #B9CBAE;
  --amber:      #E8B04B;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-text: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-ui:   cubic-bezier(0.2, 0, 0, 1);

  --gutter: 20px;
  --section-pad: clamp(6rem, 4.5rem + 6vw, 10rem);
  --radius: 14px;
  --card-bg: #FBFAF6;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--forest-950);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: clamp(1.0625rem, 1.04rem + 0.1vw, 1.125rem);
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 0, "WONK" 0;
}

h1 {
  font-weight: 400;
  font-size: clamp(2.5rem, 1.6rem + 3.7vw, 4.5rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  max-width: 16ch;
  margin-left: -0.04em;
  text-wrap: balance;
}

h2 {
  font-weight: 400;
  font-size: clamp(1.75rem, 1.3rem + 1.85vw, 2.5rem);
  line-height: 1.16;
  letter-spacing: -0.015em;
  max-width: 22ch;
  text-wrap: balance;
}

h3 {
  font-weight: 500;
  font-size: clamp(1.5rem, 1.35rem + 0.6vw, 1.75rem);
  line-height: 1.22;
  letter-spacing: -0.01em;
}

p { margin: 0; max-width: 62ch; text-wrap: pretty; }

a { color: inherit; }

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

.label {
  font-size: clamp(0.8125rem, 0.8rem + 0.06vw, 0.875rem);
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lead {
  font-size: clamp(1.1875rem, 1.1rem + 0.4vw, 1.375rem);
  line-height: 1.55;
}

/* Focus: green on light, amber on the dark bands */
:focus-visible {
  outline: 2px solid var(--forest-800);
  outline-offset: 4px;
  border-radius: 4px;
}
.site-header :focus-visible,
.hero :focus-visible,
.section-dark :focus-visible,
.site-footer :focus-visible { outline-color: var(--amber); }

.text-link {
  color: var(--forest-800);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 180ms var(--ease-ui), text-decoration-thickness 180ms var(--ease-ui);
}
.text-link:hover { color: var(--forest-700); text-decoration-thickness: 2px; }

/* ---------- 3. Header ---------- */
.site-header {
  background: var(--forest-950);
  color: var(--paper);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  position: relative;
}
/* Hairline under the header, inset to the container content */
.header-row::after {
  content: "";
  position: absolute;
  left: var(--gutter); right: var(--gutter); bottom: 0;
  height: 1px;
  background: var(--rule-dark);
}

.logo-link { display: block; line-height: 0; color: var(--paper); }

/* Logo SVG (inlined from logo-v3.svg; its colors come from these classes) */
.logo {
  display: block;
  height: 22px;
  width: auto;
  aspect-ratio: 287.53 / 33.28;
  --df-ink: var(--paper);
  --df-depth: var(--moss);
}
/* The logo files use short class names (f, m, b, c, w). Their own <style>
   block is removed because the CSP blocks inline styles, so the rules live here. */
.logo .f, .founder-mark .f { fill: var(--df-ink, currentColor); }
.logo .m, .founder-mark .m { fill: var(--df-depth, currentColor); opacity: 0.6; }
.logo .b, .founder-mark .b { fill: var(--df-depth, currentColor); opacity: 0.36; }
.logo .c, .founder-mark .c { fill: var(--df-depth, currentColor); opacity: 0.2; }
.logo .w, .founder-mark .w {
  fill: none;
  stroke: var(--df-ink, currentColor);
  stroke-width: 3.7;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  stroke-miterlimit: 10;
}

.contact-link {
  position: relative;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--paper);
  text-decoration: none;
}
.contact-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 320ms var(--ease-ui);
}
.contact-link:hover::after,
.contact-link:focus-visible::after { transform: scaleX(1); }

/* ---------- 4. Hero ---------- */
.hero {
  position: relative;
  background: var(--forest-950);
  color: var(--paper);
  padding-block: 64px 360px;
  min-height: 92vh;
  overflow: hidden;
}

/* Dark ground strip under the treeline so the trees stand on earth, not on the next band */
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 24px;
  background: var(--forest-950);
}

.hero-text { position: relative; z-index: 1; }

.hero .label { color: var(--muted-dark); margin-bottom: 16px; }
.hero .lead { color: var(--muted-dark); margin-top: 24px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-top: 40px;
}

.button {
  display: inline-block;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--forest-950);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color 200ms var(--ease-ui), transform 200ms var(--ease-ui);
}
.button:hover { background: #FFFFFF; }

/* Text link with an amber underline that grows from the left */
.grow-link {
  position: relative;
  display: inline-block;
  font-weight: 500;
  color: var(--paper);
  text-decoration: none;
}
.grow-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 320ms var(--ease-ui);
}
.grow-link:hover::after,
.grow-link:focus-visible::after { transform: scaleX(1); }
.actions .grow-link { font-size: 15px; }

.hero-facts {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 48px 0 0;
  padding: 0;
  list-style: none;
}
.hero-facts li {
  width: fit-content;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--muted-dark);
}
.hero-facts li::before {
  content: "";
  display: block;
  width: 20px;
  height: 1px;
  margin-bottom: 8px;
  background: var(--amber);
}

/* Treeline: full-bleed forest along the bottom of the hero */
.treeline {
  position: absolute;
  left: 0;
  bottom: 24px;
  width: 100%;
  height: 300px;
  display: block;
  overflow: visible;
  pointer-events: none;
}
.treeline .tree { stroke: var(--forest-950); stroke-width: 2.2; stroke-linejoin: round; paint-order: stroke; }

/* ---------- 5. Sections (shared) ---------- */
.section { padding-block: var(--section-pad); }

#products { scroll-margin-top: calc(96px - var(--section-pad)); }

.section-head { margin-bottom: 32px; }
.section-head .label { margin-bottom: 16px; }

.band { background: var(--paper-2); }

/* Client work follows products directly, so it needs no top padding */
.section-client { padding-top: 0; padding-bottom: 96px; }

/* Dark band (founder) */
.section-dark { background: var(--forest-900); color: var(--paper); }
.section-dark .label { color: var(--muted-dark); }

/* ---------- 6. Products and client work (cards) ---------- */
.card-grid { display: grid; gap: 16px; }

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  color: var(--ink);
  text-decoration: none;
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color 280ms var(--ease-ui), transform 280ms var(--ease-ui), box-shadow 280ms var(--ease-ui);
}
.card:focus-visible { border-radius: var(--radius); }

.card p { font-size: 1rem; }
.card h3 { font-size: clamp(1.5rem, 1.2rem + 0.9vw, 2rem); }

.card-index {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.4;
  color: var(--muted);
  margin-bottom: 4px;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  font-weight: 500;
  color: var(--forest-800);
}
.card-link .chev { transition: transform 280ms var(--ease-ui); }

.card:hover { border-color: var(--forest-700); }

.panel { gap: 24px; }

/* ---------- 7. Founder ---------- */
.founder-body p { max-width: 56ch; font-size: clamp(1.1875rem, 1.1rem + 0.4vw, 1.375rem); line-height: 1.55; }
.founder-link { margin-top: 24px; }
.founder-mark-wrap { display: none; }
.founder-mark {
  display: block;
  width: 64px;
  height: 64px;
  color: var(--paper);
  --df-ink: var(--paper);
  --df-depth: var(--moss);
}

/* ---------- 8. Company facts ---------- */
.facts { margin: 0; max-width: 760px; }

.fact {
  display: grid;
  gap: 4px;
  padding-block: 20px;
  border-top: 1px solid var(--rule);
}
.fact:last-child { border-bottom: 1px solid var(--rule); }

.facts dt {
  font-size: clamp(0.8125rem, 0.8rem + 0.06vw, 0.875rem);
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 4px;
}
.facts dd { margin: 0; max-width: 62ch; }

/* ---------- 9. Footer ---------- */
.site-footer {
  background: var(--forest-950);
  color: var(--muted-dark);
  padding-block: 64px 48px;
  font-size: 14px;
}
.site-footer p { max-width: none; }
.footer-cols { display: grid; gap: 32px; }
.footer-col { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.footer-wordmark {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper);
}
.footer-label {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-dark);
}
.site-footer a { color: var(--paper); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 0.18em; }
.footer-base {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--rule-dark);
  font-size: 13px;
}

/* ---------- 10. Tablet and desktop ---------- */
@media (min-width: 768px) {
  :root { --gutter: 40px; }

  .section-head { margin-bottom: 48px; }
  .fact { grid-template-columns: 160px 1fr; gap: 32px; }

  .hero-facts { flex-direction: row; gap: 32px; }
  .footer-base { flex-direction: row; justify-content: space-between; gap: 32px; }
}

@media (min-width: 960px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
  .card { padding: 32px; min-height: 260px; }

  .panel {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    min-height: 0;
  }
  .panel .card-link { margin-top: 0; padding-top: 0; }

  .founder-grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
  .founder-grid .section-head { grid-column: 1 / span 4; margin-bottom: 0; }
  .founder-body { grid-column: 5 / span 6; }


  .footer-cols { grid-template-columns: 2fr 1fr 1fr; gap: 48px; }
}

@media (min-width: 1200px) {
  :root { --gutter: 64px; }
  .header-row { height: 88px; }
  .logo { height: 26px; }

  .hero { padding-block: 96px 160px; min-height: min(86vh, 820px); }
  .treeline { height: 46%; bottom: 32px; }
  .hero::after { height: 32px; }
  .hero-text { max-width: 1200px; }
  .hero h1 { max-width: 16ch; }
}

/* ---------- 11. Motion (only when site.js adds .motion) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .button:hover { transform: translateY(-1px); }
  .card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -24px rgba(14, 31, 23, 0.35); }
  .card:hover .chev { transform: translateX(4px); }
}

/* Hero entrance: the forest assembles, back to front */
@keyframes rise-layer {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
@keyframes glow-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes glow-breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.85; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

.motion .treeline .layer { animation: rise-layer 1400ms var(--ease-out) both; }
.motion .treeline .layer-4 { animation-delay: 0ms; }
.motion .treeline .layer-3 { animation-delay: 160ms; }
.motion .treeline .layer-2 { animation-delay: 320ms; }
.motion .treeline .layer-1 { animation-delay: 480ms; }

/* The light fades in, then breathes very slowly (the only loop on the page) */
.motion .treeline .forest-glow {
  animation: glow-in 2400ms var(--ease-soft) 900ms both,
             glow-breathe 9s ease-in-out 3300ms infinite;
}

.motion .hero-in { animation: fade-up 900ms var(--ease-soft) both; }
.motion .hero-in[data-d="1"] { animation-delay: 100ms; }
.motion .hero-in[data-d="2"] { animation-delay: 200ms; }
.motion .hero-in[data-d="3"] { animation-delay: 320ms; }
.motion .hero-in[data-d="4"] { animation-delay: 440ms; }
.motion .hero-in[data-d="5"] { animation-delay: 560ms; }

/* Scroll reveals */
.motion [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
}
.motion [data-reveal].is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 800ms var(--ease-soft), transform 800ms var(--ease-soft),
              border-color 280ms var(--ease-ui), box-shadow 280ms var(--ease-ui);
}
.motion [data-reveal][data-delay="1"].is-visible { transition-delay: 90ms, 90ms, 0s, 0s; }
.motion [data-reveal][data-delay="2"].is-visible { transition-delay: 180ms, 180ms, 0s, 0s; }
.motion [data-reveal].is-instant.is-visible { transition-delay: 0s; }

/* Hover lift must still work after the reveal finishes */
@media (prefers-reduced-motion: no-preference) {
  .motion .card[data-reveal].is-visible:hover {
    transform: translateY(-3px);
    transition: border-color 280ms var(--ease-ui), transform 280ms var(--ease-ui), box-shadow 280ms var(--ease-ui);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
