/* Metric-matched fallback font-faces so the page renders at the exact
   dimensions it'll have once Source Serif 4 / Inter actually load. This
   eliminates the scroll-height jump during font swap — without them, every
   paragraph's line-height shifts when the web font arrives, and the doc
   height can change by hundreds of pixels. */
@font-face {
  font-family: 'Source Serif 4 Fallback';
  src: local('Georgia');
  size-adjust: 99%;
  ascent-override: 82%;
  descent-override: 22%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Inter Fallback';
  src: local('Arial');
  size-adjust: 107.4%;
  ascent-override: 90%;
  descent-override: 22.4%;
  line-gap-override: 0%;
}

:root {
  --bg: #f7f4ee;
  --bg-soft: #efeade;
  --ink: #1c1a17;
  --ink-soft: #4a4541;
  --ink-mute: #6a635b;
  --rule: #d9d2c3;
  --accent: #6b2018;
  --accent-soft: #8a3528;
  --accent-tint: rgba(107, 32, 24, 0.08);
  --max: 1100px;
  --max-narrow: 640px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mx: 0px;
  --my: 0px;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: "Inter", "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  background-color: var(--bg);
}

/* Background decoration lives on its own fixed compositing layer so it
   doesn't force a full-viewport repaint on every scroll tick. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 900px 600px at 90% -10%, rgba(107, 32, 24, 0.09), transparent 60%),
    radial-gradient(ellipse 700px 500px at -10% 40%, rgba(107, 32, 24, 0.05), transparent 65%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64'><circle cx='2' cy='2' r='0.7' fill='%236b2018' fill-opacity='0.09'/></svg>");
  background-repeat: no-repeat, no-repeat, repeat;
  background-size: auto, auto, 64px 64px;
  will-change: transform;
  transform: translateZ(0);
}

/* ---------- Overlay effects ---------- */

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.9'/></svg>");
}

/* Large decorative tree-rings fixed in the background — fills empty space
   with a soft, branded anchor rather than a plain field of color. */
.bg-rings {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0;
  animation: bg-rings-in 2400ms var(--ease) 300ms forwards;
  will-change: transform;
  transform: translateZ(0);
}
.bg-rings svg {
  width: 100%;
  height: 100%;
  display: block;
  animation: bg-rings-drift 40s ease-in-out infinite alternate;
}
@keyframes bg-rings-in { to { opacity: 1; } }
@keyframes bg-rings-drift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-24px, 10px, 0); }
}

/* ---------- Motion primitives ---------- */

/* Reveal effect: content is always visible by default (so it shows even if
   JS is slow or fails). JS marks below-the-fold elements as .reveal-pending
   on load, and the IntersectionObserver removes that class as they scroll
   into view. */
[data-reveal] {
  transition: opacity 900ms var(--ease), transform 900ms var(--ease);
}
[data-reveal].reveal-pending {
  opacity: 0;
  transform: translateY(16px);
}

.rule {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 0;
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
  transform-origin: left;
  transition: transform 1200ms var(--ease);
}
.rule.reveal-pending { transform: scaleX(0); }

.hero-heading .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5em);
  transition: opacity 800ms var(--ease), transform 800ms var(--ease);
  will-change: opacity, transform;
}
.hero-heading.is-split .word {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Typography + links ---------- */

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 200ms ease;
}
a:hover { color: var(--accent-soft); }

.link-underline {
  position: relative;
  padding-bottom: 3px;
}
.link-underline::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 420ms var(--ease);
}
.link-underline:hover::after { transform: scaleX(1); }

/* ---------- Header + wordmark ---------- */

.site-header {
  position: relative;
  z-index: 2;
  padding: 2.25rem 2rem 0;
  max-width: var(--max);
  margin: 0 auto;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  font-family: "Source Serif 4", "Source Serif 4 Fallback", Georgia, serif;
  font-weight: 500;
  font-size: 1.55rem;
  letter-spacing: 0;
  color: var(--ink);
}

.mark {
  display: inline-flex;
  width: 36px;
  height: 36px;
  color: var(--accent);
}
.mark svg { width: 100%; height: 100%; display: block; }

/* Wordmark mark animates in on load */
.mark circle,
.mark path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: draw 1400ms var(--ease) forwards;
}
.mark circle { animation-delay: 100ms; }
.mark .mark-trunk { animation-delay: 400ms; stroke-dasharray: 30; stroke-dashoffset: 30; }
.mark .mark-b1 { animation-delay: 620ms; stroke-dasharray: 25; stroke-dashoffset: 25; }
.mark .mark-b2 { animation-delay: 720ms; stroke-dasharray: 25; stroke-dashoffset: 25; }
.mark .mark-b3 { animation-delay: 820ms; stroke-dasharray: 25; stroke-dashoffset: 25; }
@keyframes draw { to { stroke-dashoffset: 0; } }

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

main {
  position: relative;
  z-index: 2;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ---------- Hero: 2-column with tree art ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 3rem;
  align-items: center;
  padding: 5rem 0 6rem;
}

.hero-copy { min-width: 0; }

.hero-heading {
  font-family: "Source Serif 4", "Source Serif 4 Fallback", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.5rem, 5.6vw, 4.25rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 1.75rem;
  color: var(--ink);
}

.lede {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 32rem;
  margin: 0;
}

.hero-art {
  position: relative;
  aspect-ratio: 320 / 420;
  max-height: 520px;
  transform: perspective(1200px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform 600ms var(--ease);
  transform-style: preserve-3d;
}
.hero-art .tree {
  width: 100%;
  height: 100%;
  display: block;
}

/* Tree growth animation — trunk draws from the ground up, branches unfurl
   in order as the trunk reaches them, like a sapling emerging. */
.tree-trunk {
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: draw 2200ms cubic-bezier(0.32, 0.72, 0.2, 1) 400ms forwards;
}
.tree-branch {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: draw 600ms var(--ease) forwards;
  opacity: 0;
  animation-name: draw, fade-in;
}
.tree-branch:nth-of-type(2) { animation-delay: 1150ms; }
.tree-branch:nth-of-type(3) { animation-delay: 1450ms; }
.tree-branch:nth-of-type(4) { animation-delay: 1750ms; }
.tree-branch:nth-of-type(5) { animation-delay: 2050ms; }
.tree-branch:nth-of-type(6) { animation-delay: 2350ms; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Subtle continuous breathing on the tree */
.tree-figure {
  transform-origin: 160px 400px;
  animation: breathe 8s ease-in-out infinite 2600ms;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.012); }
}

/* ---------- About ---------- */

.about {
  max-width: var(--max-narrow);
  margin: 0 auto;
  padding: 4rem 0;
}
.about p {
  font-family: "Source Serif 4", "Source Serif 4 Fallback", Georgia, serif;
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0;
}

/* ---------- Pillars ---------- */

.pillars {
  padding: 5rem 0;
}

.pillars-heading {
  font-family: "Source Serif 4", "Source Serif 4 Fallback", Georgia, serif;
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-mute);
  margin: 0 0 2.5rem;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.pillar {
  position: relative;
  padding: 2.25rem 1.75rem 2rem;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 10px;
  transition: transform 480ms var(--ease), background 480ms var(--ease), border-color 480ms var(--ease), box-shadow 480ms var(--ease);
}
.pillar:hover {
  transform: translateY(-4px);
  background: #fffbf3;
  border-color: rgba(107, 32, 24, 0.35);
  box-shadow: 0 10px 40px -20px rgba(107, 32, 24, 0.28);
}

.pillar-mark {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: 50%;
  font-family: "Source Serif 4", "Source Serif 4 Fallback", Georgia, serif;
  font-weight: 500;
  font-size: 1.35rem;
  margin: 0 0 1.25rem;
  transition: background 480ms var(--ease), transform 480ms var(--ease);
}
.pillar:hover .pillar-mark {
  background: var(--accent);
  color: var(--bg);
  transform: rotate(-8deg);
}

.pillar h3 {
  font-family: "Source Serif 4", "Source Serif 4 Fallback", Georgia, serif;
  font-weight: 500;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
  color: var(--ink);
}

.pillar p {
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}

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

.contact {
  padding: 4rem 0 5rem;
  max-width: var(--max-narrow);
  margin: 0 auto;
}

.contact h2 {
  font-family: "Source Serif 4", "Source Serif 4 Fallback", Georgia, serif;
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-mute);
  margin: 0 0 0.75rem;
}

.contact p {
  margin: 0;
  font-size: 1.25rem;
}

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

.site-footer {
  position: relative;
  z-index: 2;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 2rem 3rem;
  font-size: 0.85rem;
  color: var(--ink-mute);
  border-top: 1px solid var(--rule);
}

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 3rem 0 4rem;
  }
  .hero-art {
    max-height: 360px;
    aspect-ratio: auto;
    height: 340px;
    order: -1;
    width: 240px;
    margin: 0 auto;
  }
  .pillars-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .about p { font-size: 1.2rem; }
}

@media (max-width: 520px) {
  main { padding: 0 1.25rem; }
  .site-header { padding: 1.75rem 1.25rem 0; }
  .site-footer { padding: 2rem 1.25rem 2.5rem; }
  .hero { padding: 2.5rem 0 3rem; }
  .pillars { padding: 3.5rem 0; }
  .about { padding: 3rem 0; }
  .contact { padding: 3rem 0 4rem; }
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-reveal].reveal-pending,
  .hero-heading, .hero-heading .word,
  .rule, .rule.reveal-pending,
  .link-underline::after,
  .tree-trunk, .tree-branch, .tree-figure,
  .mark circle, .mark path,
  .pillar, .pillar:hover, .pillar-mark, .pillar:hover .pillar-mark,
  .bg-rings, .bg-rings svg {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
  }
}
