/* ==========================================================================
   Thakali Garden — styles
   1. Tokens  2. Base  3. Primitives  4. Header  5. Scene  6. Sections
   7. Footer  8. 404  9. Motion
   ========================================================================== */

/* 1. Tokens --------------------------------------------------------------- */
:root {
  --forest: #183d2b;
  --green: #2f6b45;
  --sage: #dde8d8;
  --cream: #f7f5ed;
  --charcoal: #202821;
  --white: #ffffff;

  --ink: var(--charcoal);
  --ink-soft: #465148;
  --rule: rgba(24, 61, 43, 0.16);
  --rule-light: rgba(221, 232, 216, 0.22);
  --dusk: #12301f;

  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Fraunces", "Iowan Old Style", Georgia, serif;

  --step--1: 0.8125rem;
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
  --step-2: clamp(1.5rem, 1.3rem + 1vw, 2.125rem);
  --step-3: clamp(2rem, 1.5rem + 2.4vw, 3.5rem);
  --step-4: clamp(2.6rem, 1.6rem + 5vw, 6.25rem);

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --section: clamp(5rem, 11vw, 10rem);
  --max: 82rem;
  --header-h: 4.5rem;
  --radius: 3px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

svg {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 2px;
}

::selection {
  background: var(--green);
  color: var(--white);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--forest);
  color: var(--white);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 0.75rem;
}

/* 3. Primitives ----------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green);
}

.eyebrow::before {
  content: "";
  flex: none;
  width: 1.75rem;
  height: 1px;
  background: currentColor;
}

.display {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--step-4);
  line-height: 0.98;
  letter-spacing: -0.025em;
  color: var(--forest);
  text-wrap: balance;
}

.display em,
.title em {
  font-style: italic;
  font-weight: 300;
}

.title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--forest);
  text-wrap: balance;
}

.lead {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink-soft);
}

.prose > * + * {
  margin-top: 1.25em;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3rem;
  padding: 0.7rem 1.35rem;
  border: 1px solid var(--forest);
  border-radius: 999px;
  background: var(--forest);
  color: var(--cream);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.btn:hover {
  background: var(--green);
  border-color: var(--green);
}

.btn svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.25s var(--ease);
}

.btn:hover svg {
  transform: translateX(3px);
}

.btn--ghost {
  background: var(--cream);
  color: var(--forest);
}

.btn--ghost:hover {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--cream);
}

.btn--light {
  background: var(--cream);
  border-color: var(--cream);
  color: var(--forest);
}

.btn--light:hover {
  background: var(--sage);
  border-color: var(--sage);
}

.link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: text-decoration-color 0.2s;
}

.link:hover {
  text-decoration-color: transparent;
}

/* 4. Header --------------------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.site-header.is-scrolled,
.site-header.is-open {
  background: var(--cream);
  border-bottom-color: var(--rule);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 100%;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--forest);
  font-family: var(--font-serif);
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.logo svg {
  width: 1.6rem;
  height: 1.6rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 2.4vw, 2.25rem);
}

.nav__list {
  display: flex;
  gap: clamp(1.1rem, 2.2vw, 2rem);
}

.nav__list a {
  position: relative;
  padding-block: 0.4rem;
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--forest);
  text-decoration: none;
}

.nav__list a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.nav__list a:hover::after,
.nav__list a[aria-current="true"]::after {
  transform: scaleX(1);
}

.nav .btn {
  min-height: 2.6rem;
  padding: 0.5rem 1.1rem;
}

.nav-toggle {
  display: none;
  width: 2.75rem;
  height: 2.75rem;
  margin-right: -0.5rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--forest);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 1.4rem;
  height: 1.5px;
  margin: 0.36rem auto;
  background: currentColor;
  transition: transform 0.3s var(--ease);
}

.nav-toggle[aria-expanded="true"] span:first-child {
  transform: translateY(0.21rem) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-0.21rem) rotate(-45deg);
}

@media (max-width: 900px) {
  .nav-toggle {
    display: block;
  }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 2rem;
    padding: 2rem var(--gutter) 3rem;
    background: var(--cream);
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s var(--ease), visibility 0.25s;
  }

  .site-header.is-open .nav {
    visibility: visible;
    opacity: 1;
  }

  .nav__list {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .nav__list a {
    display: block;
    padding-block: 0.9rem;
    border-bottom: 1px solid var(--rule);
    font-family: var(--font-serif);
    font-size: 1.75rem;
  }

  .nav__list a::after {
    display: none;
  }
}

/* 5. Scene (fixed WebGL backdrop) ----------------------------------------- */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  height: 100lvh;
  background: var(--cream);
  pointer-events: none;
}

.scene[data-mode="dusk"] {
  background: var(--dusk);
}

.scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}

.scene.is-ready canvas {
  opacity: 1;
}

main,
.site-footer {
  position: relative;
  z-index: 1;
}

/* 6. Sections ------------------------------------------------------------- */

/* Hero */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding-top: calc(var(--header-h) + clamp(2rem, 7vh, 5.5rem));
  padding-bottom: 2rem;
  /* keeps copy legible where it overlaps the field */
  background: linear-gradient(
    to bottom,
    var(--cream) 0%,
    rgba(247, 245, 237, 0.88) 40%,
    rgba(247, 245, 237, 0) 66%
  );
}

.hero .display {
  max-width: 13ch;
  margin-top: 1.5rem;
}

.hero .lead {
  max-width: 36rem;
  margin-top: 1.75rem;
  color: var(--ink);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.25rem;
}

.hero__meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding-top: 14rem;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest);
}

.hero__meta span:last-child {
  text-align: right;
}

/* Purpose */
.purpose {
  background: var(--cream);
  border-top: 1px solid var(--rule);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}

.split .title {
  margin-top: 1.5rem;
}

.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3.5rem);
  margin-top: clamp(3.5rem, 8vw, 6.5rem);
  counter-reset: principle;
}

.principles li {
  counter-increment: principle;
  padding-top: 1.5rem;
  border-top: 1px solid var(--forest);
}

.principles li::before {
  content: counter(principle, decimal-leading-zero);
  display: block;
  margin-bottom: 2.5rem;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--green);
}

.principles h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--step-2);
  line-height: 1.15;
  color: var(--forest);
}

.principles p {
  margin-top: 0.9rem;
  color: var(--ink-soft);
}

/* What we're building */
.building {
  background: var(--white);
}

.section-head {
  max-width: 46rem;
}

.section-head .title {
  margin-top: 1.5rem;
}

.section-head .lead {
  margin-top: 1.5rem;
}

.note {
  display: inline-block;
  margin-top: 1.75rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--green);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.features {
  display: grid;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  margin-top: clamp(3rem, 7vw, 5.5rem);
}

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-radius: var(--radius);
  overflow: hidden;
}

.feature__body {
  display: flex;
  flex-direction: column;
  padding: clamp(1.75rem, 4.5vw, 4rem);
}

.feature__index {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.feature h3 {
  margin-top: clamp(2rem, 5vw, 4rem);
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.feature__desc {
  max-width: 34rem;
  margin-top: 1.25rem;
}

.feature__label {
  margin-top: 2.25rem;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.feature__list {
  margin-top: 0.75rem;
}

.feature__list li {
  position: relative;
  padding: 0.8rem 0 0.8rem 1.5rem;
  border-top: 1px solid var(--feature-rule);
}

.feature__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.45em;
  width: 0.5rem;
  height: 1px;
  background: currentColor;
}

.feature__art {
  display: grid;
  place-items: center;
  min-height: 18rem;
  padding: clamp(1.5rem, 4vw, 3.5rem);
}

.feature__art svg {
  width: min(100%, 26rem);
  height: auto;
}

.feature--agri {
  --feature-rule: var(--rule-light);
  background: var(--forest);
  color: var(--sage);
}

.feature--agri h3 {
  color: var(--cream);
}

.feature--agri .feature__art {
  background: #143424;
}

.feature--ai {
  --feature-rule: var(--rule);
  background: var(--sage);
  color: var(--charcoal);
}

.feature--ai h3,
.feature--soft h3 {
  color: var(--forest);
}

.feature--ai .feature__art {
  order: -1;
  background: #d2e0cc;
}

.feature--soft {
  --feature-rule: var(--rule);
  background: var(--cream);
  color: var(--charcoal);
  box-shadow: inset 0 0 0 1px var(--rule);
}

.feature--soft .feature__art {
  border-left: 1px solid var(--rule);
}

/* Approach */
.approach {
  background: var(--forest);
  color: var(--sage);
}

.approach .eyebrow {
  color: var(--sage);
}

.approach .title {
  max-width: 18ch;
  margin-top: 1.5rem;
  color: var(--cream);
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(3.5rem, 8vw, 6.5rem);
  border-top: 1px solid var(--rule-light);
}

.steps li {
  position: relative;
  padding: 2rem clamp(1rem, 2vw, 2rem) 0 0;
}

.steps li + li {
  padding-left: clamp(1rem, 2vw, 2rem);
  border-left: 1px solid var(--rule-light);
}

.steps li::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
}

.steps li + li::before {
  left: -4px;
}

.steps__num {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(2.75rem, 5vw, 4.5rem);
  line-height: 1;
  color: var(--cream);
}

.steps h3 {
  margin-top: 2rem;
  font-size: var(--step-1);
  font-weight: 700;
  color: var(--cream);
}

.steps p {
  margin-top: 0.6rem;
  font-size: 0.975rem;
}

.approach__close {
  max-width: 40rem;
  margin-top: clamp(3rem, 6vw, 5rem);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 300;
  font-size: var(--step-2);
  line-height: 1.3;
  color: var(--cream);
}

/* Technology */
.tech {
  background: var(--cream);
}

.tech__list {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--forest);
  counter-reset: tech;
}

.tech__label {
  margin-top: clamp(3.5rem, 8vw, 6rem);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}

.tech__label + .tech__list {
  margin-top: 1.25rem;
}

.tech__list li {
  counter-increment: tech;
  display: grid;
  grid-template-columns: 4rem 1fr;
  align-items: baseline;
  padding-block: clamp(1rem, 2vw, 1.5rem);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-serif);
  font-size: var(--step-2);
  line-height: 1.2;
  color: var(--forest);
}

.tech__list li::before {
  content: counter(tech, decimal-leading-zero);
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--green);
}

/* Dusk zone: vision + collaboration sit over the 3D field */
.dusk {
  position: relative;
  color: var(--sage);
  background: linear-gradient(
    to bottom,
    rgba(18, 48, 31, 0.78),
    rgba(18, 48, 31, 0.3) 45%,
    rgba(18, 48, 31, 0.62)
  );
}

.dusk .eyebrow {
  color: var(--sage);
}

.dusk .title,
.dusk .display {
  color: var(--cream);
}

.vision {
  display: flex;
  align-items: center;
  min-height: 100svh;
}

.vision .title {
  max-width: 17ch;
  margin-top: 1.5rem;
  font-size: var(--step-4);
  line-height: 1;
}

.vision .prose {
  max-width: 38rem;
  margin-top: 2.5rem;
  margin-left: auto;
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--cream);
}

.collab {
  padding-top: clamp(6rem, 22vh, 14rem);
  border-top: 1px solid var(--rule-light);
}

.collab__grid {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: end;
}

.collab .prose {
  color: var(--cream);
}

.collab__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 2.25rem;
}

.collab__actions .link {
  color: var(--cream);
  overflow-wrap: anywhere;
}

/* 7. Footer --------------------------------------------------------------- */
.site-footer {
  padding-block: clamp(3.5rem, 7vw, 6rem) 2rem;
  background: var(--charcoal);
  color: rgba(221, 232, 216, 0.82);
  font-size: 0.95rem;
}

.site-footer .logo {
  color: var(--cream);
  font-size: 1.6rem;
}

.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 2fr) minmax(0, 3fr);
  gap: clamp(2rem, 5vw, 5rem);
}

.footer__tagline {
  margin-top: 1.5rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--step-1);
  color: var(--cream);
}

.footer__desc {
  max-width: 26rem;
  margin-top: 0.75rem;
}

.footer__heading {
  margin-bottom: 1rem;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sage);
}

.footer__list li + li {
  margin-top: 0.5rem;
}

.footer__list a {
  text-decoration: none;
  overflow-wrap: anywhere;
}

.footer__list a:hover {
  color: var(--white);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.footer__legal {
  margin-top: clamp(3rem, 6vw, 5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-light);
  font-size: var(--step--1);
}

/* 8. 404 ------------------------------------------------------------------ */
.notfound {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: calc(var(--header-h) + 2rem) var(--gutter) 4rem;
  background: var(--cream);
}

.notfound__inner {
  max-width: 40rem;
}

.notfound .display {
  margin-top: 1.5rem;
}

.notfound .lead {
  margin-top: 1.5rem;
}

.notfound .btn {
  margin-top: 2.25rem;
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 900px) {
  .split,
  .collab__grid,
  .feature {
    grid-template-columns: minmax(0, 1fr);
  }

  .feature__art,
  .feature--ai .feature__art {
    order: -1;
    min-height: 13rem;
  }

  .feature--soft .feature__art {
    border-left: 0;
    border-bottom: 1px solid var(--rule);
  }

  .principles {
    grid-template-columns: minmax(0, 1fr);
  }

  .principles li::before {
    margin-bottom: 1.25rem;
  }

  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 3rem;
  }

  .steps li:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .steps li:nth-child(3)::before {
    display: none;
  }

  .footer__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .footer__brand {
    grid-column: 1 / -1;
  }

  .hero__meta {
    padding-top: 11rem;
  }
}

@media (max-width: 560px) {
  .steps {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0;
    border-top: 0;
  }

  .steps li,
  .steps li + li {
    padding: 1.75rem 0;
    border-left: 0;
    border-top: 1px solid var(--rule-light);
  }

  .steps li::before {
    display: none;
  }

  .steps h3 {
    margin-top: 1rem;
  }

  .tech__list li {
    grid-template-columns: 2.75rem 1fr;
  }

  .footer__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero__meta span:last-child {
    display: none;
  }
}

/* 9. Motion --------------------------------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--delay, 0s);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}
