/* DNTR — Daintree
   Brand tokens, page theme tokens and the styles for all six pages.
   Source of truth: BRAND.md / SPEC.md §3. No colour literal may appear
   outside :root. The page tokens (--page-*, --accent, --watermark) are
   what .theme-dark (Contact) overrides. */

@font-face {
  font-family: "Cabin";
  src: url("assets/fonts/cabin-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Play";
  src: url("assets/fonts/play-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@view-transition {
  navigation: auto;
}

:root {
  /* Brand colour — the thirteen values from the deck, plus --grey-100. */
  --sage-50: #E9F1E0;
  --cream: #FFF6E7;
  --ink: #201E1D;
  --ink-soft: #44463F;
  --grey: #696969;
  --grey-light: #A5A5A5;
  --green: #176F44;
  --green-deep: #1E4D2F;
  --sage-200: #C3D4C5;
  --sage-300: #A9C3AE;
  --apricot-50: #FCE4CE;
  --apricot: #EFAE70;
  --white: #FFFFFF;
  /* Fourteenth token (6 Oct 2026): the greyed-out Stable Compounder. */
  --grey-100: #E7E5E0;

  /* Page theme (light). .theme-dark overrides these. */
  --page-bg: var(--cream);
  --page-fg: var(--ink);
  --page-muted: var(--ink-soft);
  --page-label: var(--grey);
  --hairline: var(--sage-200);
  --accent: var(--green);
  --watermark: var(--sage-50);
  --watermark-opacity: 1;

  --font-sans: "Cabin", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-label: "Play", "Cabin", "Segoe UI", system-ui, sans-serif;

  --fs-title: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  --fs-lead: clamp(1.5rem, 1.3rem + 0.8vw, 2rem);
  --fs-body: clamp(1.0625rem, 1.034rem + 0.121vw, 1.125rem);
  --fs-nav: 0.8125rem;
  --fs-fine: 0.6875rem;

  --content-max: 1200px;
  --page-pad: clamp(20px, 5vw, 56px);
  --bar-h: 88px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

.theme-dark {
  --page-bg: var(--green-deep);
  --page-fg: var(--white);
  --page-muted: var(--sage-50);
  --page-label: var(--sage-300);
  --hairline: var(--green);
  --accent: var(--sage-300);
  --watermark: var(--green);
  /* No darker-green token exists, so the dark watermark is thinned instead. */
  --watermark-opacity: 0.35;
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--page-bg);
}

body {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--page-bg);
  color: var(--page-fg);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration: none;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--page-pad);
  top: 12px;
  z-index: 50;
  padding: 10px 16px;
  background: var(--green);
  color: var(--white);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.nw {
  white-space: nowrap;
}

/* ---------- Watermark (geometric rainforest, from tools/forest.py) ---------- */

.watermark {
  position: fixed;
  z-index: -1;
  inset: 0;
  background: var(--watermark);
  opacity: var(--watermark-opacity);
  -webkit-mask: url("assets/img/forest.svg") center bottom / cover no-repeat;
  mask: url("assets/img/forest.svg") center bottom / cover no-repeat;
  pointer-events: none;
}

@media (max-aspect-ratio: 4 / 5) {
  .watermark {
    -webkit-mask-image: url("assets/img/forest-tall.svg");
    mask-image: url("assets/img/forest-tall.svg");
  }
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--bar-h);
  padding-inline: var(--page-pad);
  transition: background-color 240ms linear, box-shadow 240ms linear;
}

.topbar.is-scrolled {
  background: var(--page-bg);
  box-shadow: 0 1px 0 var(--hairline);
}

.topbar__left {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.topbar__mark img {
  width: 28px;
  height: 28px;
}

.page--home .topbar__mark {
  display: none;
}

.theme-dark .topbar__mark img {
  /* The outline mark reads on green-deep once inverted to white. */
  filter: brightness(0) invert(1);
}

.clock {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  flex-wrap: wrap;
  font-family: var(--font-label);
  font-size: var(--fs-nav);
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--page-fg);
}

.clock__dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
}

.js .clock__dot {
  animation: blink 2s steps(1, end) infinite;
}

.clock__city {
  display: inline-flex;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.clock__code {
  color: var(--page-fg);
}

.clock__time {
  min-width: 8ch;
}

.clock__off {
  color: var(--page-label);
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* Nav */

.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  display: inline-block;
  padding-block: 6px;
  font-size: var(--fs-nav);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--page-fg);
  opacity: 0.78;
  transition: opacity 200ms linear, transform 200ms var(--ease);
}

.nav a:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.nav a[aria-current="page"] {
  opacity: 1;
}

.nav a[aria-current="page"]::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 7px;
  background: var(--accent);
  transform-origin: left;
  animation: scale-in 400ms var(--ease) both;
}

@keyframes scale-in {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.menu-btn {
  display: none;
}

@media (max-width: 1080px) {
  .clock .clock__off {
    display: none;
  }

  .js .menu-btn {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 14px 10px;
    border: 0;
    background: none;
    color: var(--page-fg);
    cursor: pointer;
  }

  .menu-btn__line {
    display: block;
    height: 1.5px;
    background: currentColor;
    transition: transform 240ms var(--ease);
  }

  .menu-btn[aria-expanded="true"] .menu-btn__line:first-child {
    transform: translateY(3.75px) rotate(45deg);
  }

  .menu-btn[aria-expanded="true"] .menu-btn__line:nth-child(2) {
    transform: translateY(-3.75px) rotate(-45deg);
  }

  /* With JS, the nav becomes a full-screen sheet. */
  .js .nav {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    background: var(--page-bg);
    visibility: hidden;
    opacity: 0;
    transition: opacity 240ms linear, visibility 0s linear 240ms;
  }

  .js .nav.is-open {
    visibility: visible;
    opacity: 1;
    transition: opacity 240ms linear;
  }

  .js .nav ul {
    flex-direction: column;
    align-items: center;
    gap: 28px;
  }

  .js .nav a {
    font-size: 1.125rem;
  }

  /* Without JS, the nav wraps under the clock. */
  html:not(.js) .topbar {
    flex-wrap: wrap;
    padding-block: 20px;
  }
}

@media (max-width: 560px) {
  .clock__city--sgp .clock__time,
  .clock__city--ldn .clock__time {
    min-width: 5ch;
  }

  .clock__sec {
    display: none;
  }
}

/* ---------- Main ---------- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--page-pad));
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

/* ---------- Home ---------- */

.home {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px var(--page-pad) 48px;
  text-align: center;
}

.lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 2.4vw, 32px);
}

.lockup__mark {
  width: clamp(72px, 9vw, 116px);
  height: auto;
}

.lockup__word {
  font-size: clamp(3.25rem, 1.8rem + 6.2vw, 6.75rem);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--green);
}

.home__sub {
  margin: clamp(14px, 1.6vw, 22px) auto 0;
  font-size: clamp(1.1875rem, 1rem + 0.8vw, 1.625rem);
  line-height: 1.4;
  color: var(--ink-soft);
  text-wrap: balance;
}

/* One line wherever it fits; phones wrap it. */
@media (min-width: 640px) {
  .home__sub {
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  .lockup {
    flex-direction: column;
  }
}

/* ---------- Inner page head ---------- */

.page-head {
  padding-top: clamp(24px, 5vw, 64px);
}

.page-title {
  font-size: var(--fs-title);
  line-height: 1.05;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.page-title::after {
  content: "";
  display: block;
  width: 64px;
  height: 1px;
  margin-top: 22px;
  background: var(--accent);
}

.page-body {
  padding-block: clamp(40px, 5vw, 72px) clamp(56px, 7vw, 96px);
}

.lead {
  max-width: 22ch;
  font-size: var(--fs-lead);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.prose p {
  max-width: 62ch;
}

.prose p + p {
  margin-top: 1.1em;
}

.label {
  font-family: var(--font-label);
  font-size: 0.8125rem;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--page-label);
}

/* Columns with vertical hairlines between them (the reference site's
   contact layout). Stacks with horizontal hairlines below 860px. */
.ruled {
  display: grid;
  grid-template-columns: 5fr 7fr;
  align-items: start;
}

.ruled--even {
  grid-template-columns: 1fr 1fr;
}

.ruled--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ruled > * {
  padding-block: 4px;
}

.ruled > :not(:last-child) {
  padding-right: clamp(24px, 4vw, 56px);
}

.ruled > * + * {
  padding-left: clamp(24px, 4vw, 56px);
  border-left: 1px solid var(--hairline);
}

@media (max-width: 860px) {
  .ruled,
  .ruled--even,
  .ruled--three {
    grid-template-columns: minmax(0, 1fr);
  }

  .ruled > :not(:last-child) {
    padding-right: 0;
    padding-bottom: 32px;
  }

  .ruled > * + * {
    padding-top: 32px;
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--hairline);
  }
}

/* About: the closing statement. */
.statement {
  margin-top: clamp(48px, 6vw, 80px);
  padding: clamp(28px, 3.5vw, 44px) clamp(24px, 3.5vw, 48px);
  background: var(--green);
  color: var(--white);
  font-size: clamp(1.1875rem, 1.045rem + 0.606vw, 1.5rem);
  line-height: 1.4;
  font-weight: 700;
}

/* Approach */
.figure {
  margin-top: clamp(56px, 7vw, 88px);
}

.cols-title {
  font-size: 1.25rem;
  line-height: 1.25;
  font-weight: 600;
  color: var(--green);
}

.cols-title + p {
  margin-top: 10px;
  max-width: 44ch;
}

/* Stable Compounders: on the curve, but not where we invest. */
.col--muted .cols-title {
  color: var(--grey);
}

.col--muted p {
  color: var(--grey);
}

.approach-cols {
  margin-top: clamp(48px, 6vw, 72px);
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
}

/* Leadership */
.portrait {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  background: var(--green);
  color: var(--white);
  border-radius: 2px;
}

.portrait__monogram {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Headshot: 4:5, 320px wide, sage-200 hairline. */
.portrait--photo {
  position: relative;
  width: min(320px, 100%);
  height: auto;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--sage-200);
  overflow: hidden;
}

.portrait--photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Only a broken image renders ::after, so a missing headshot shows the
   monogram tile instead of the browser's broken-image icon. */
.portrait--photo img::after {
  content: attr(data-initials);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: var(--white);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.person__name {
  margin-top: 28px;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 600;
}

.person__role {
  margin-top: 10px;
}

.person__bio {
  margin-top: 20px;
  max-width: 50ch;
  color: var(--page-muted);
}

/* Contact */
.contact__intro {
  max-width: 24ch;
  font-size: var(--fs-lead);
  line-height: 1.25;
  font-weight: 400;
  text-wrap: balance;
}

.contact__line {
  margin-top: 40px;
}

.contact__email {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 1.25rem;
  font-weight: 500;
}

.contact__email svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.contact__email:hover span {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

.city + .city {
  margin-top: 44px;
}

.city__name {
  margin-bottom: 14px;
}

.city__time {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  color: var(--page-muted);
}

/* Disclaimer */
.disclaimer {
  max-width: 72ch;
  color: var(--page-muted);
}

/* ---------- Fine print ---------- */

.fine {
  padding: 20px var(--page-pad) 24px;
  text-align: center;
  color: var(--page-label);
}

.fine p {
  max-width: 150ch;
  margin-inline: auto;
  font-size: var(--fs-fine);
  line-height: 1.6;
}

.fine__rights {
  margin-top: 10px;
  font-family: var(--font-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- S-curve diagram (SPEC §6; SVG from tools/scurve.py) ---------- */

/* The chart fills the content width, capped so it never runs taller than
   the screen below the top bar (the wide viewBox is 840 x 500). */
.s-curve {
  width: 100%;
  height: auto;
  margin-inline: auto;
  overflow: visible;
}

.s-curve--wide {
  max-width: calc((100vh - var(--bar-h) - 48px) * 1.68);
}

.s-curve--narrow {
  display: none;
  max-width: 500px;
}

@media (max-width: 899px) {
  .s-curve--wide {
    display: none;
  }

  .s-curve--narrow {
    display: block;
  }
}

.sc-axis,
.sc-arrow {
  fill: none;
  stroke: var(--grey-light);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sc-frame,
.sc-divider {
  fill: none;
  stroke: var(--sage-200);
  stroke-width: 1;
}

.sc-divider {
  stroke-dasharray: 2 4;
}

.sc-axis-label {
  font-family: var(--font-label);
  fill: var(--grey);
  letter-spacing: 0.04em;
}

.sc-head,
.sc-stage text {
  font-family: var(--font-sans);
  font-weight: 600;
  fill: var(--ink);
}

.sc-c1 {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sc-stage rect {
  stroke-width: 1;
}

.sc-stage--rising rect {
  fill: var(--apricot-50);
  stroke: var(--apricot);
}

.sc-stage--stable rect {
  fill: var(--grey-100);
  stroke: var(--grey-light);
}

.sc-stage--stable text {
  fill: var(--grey);
}

.sc-stage--mature rect {
  fill: var(--green);
  stroke: var(--green);
}

.sc-stage--mature text {
  fill: var(--white);
}

/* ---------- Entrance motion (fade + slide-up stagger) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .fade-in {
    animation: fade-in 1.2s ease-out both;
  }

  .slide-up {
    animation: slide-up 0.8s var(--ease) both;
  }

  /* No "to" frame, so the watermark settles at its own opacity. */
  .watermark.fade-in {
    animation-name: wm-in;
  }

  .s1 { animation-delay: 0.1s; }
  .s2 { animation-delay: 0.25s; }
  .s3 { animation-delay: 0.4s; }
  .s4 { animation-delay: 0.55s; }
  .s5 { animation-delay: 0.7s; }

  .js .sc-c1 {
    stroke-dasharray: 1 1;
    stroke-dashoffset: 1;
  }

  .js .sc-stage {
    opacity: 0;
  }

  .js .is-drawn .sc-c1 {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 900ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  .js .is-drawn .sc-stage {
    opacity: 1;
    transition: opacity 200ms linear 800ms;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes wm-in {
  from { opacity: 0; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

@media print {
  .sc-stage {
    opacity: 1 !important;
  }

  .sc-c1 {
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
  }

  .topbar {
    position: static;
  }

  .watermark {
    display: none;
  }
}
