/* WillowAnk Solution. One family for all text.
   Every animation lives in the prefers-reduced-motion: no-preference block at
   the end, so "reduce motion" needs no overrides that specificity could defeat. */

:root {
  --sage: #E7ECE3;
  --pale-leaf: #F6F8F4;
  --bark: #2F332B;
  --moss: #4C5446;
  --willow: #5E7A4C;
  --on-bark: #D3DACD;
  --line: #C9D3C1;

  --font: "Bricolage Grotesque", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --gutter: clamp(16px, 5vw, 48px);
  --block: clamp(56px, 9vw, 112px);
}

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

body {
  margin: 0;
  background: var(--sage);
  color: var(--moss);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

h1, h2 {
  color: var(--bark);
  font-weight: 700;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(44px, 8vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  max-width: 11ch;
}

h2 {
  font-size: clamp(26px, 3.2vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.012em;
  margin-bottom: 0.5em;
}

/* Vietnamese stacks marks above and below letters (ổ, ậ, ị); tight English
   leading makes them touch the next line. */
:lang(vi) h1 { line-height: 1.16; }
:lang(vi) h2 { line-height: 1.25; }

p { margin: 0 0 1em; max-width: 62ch; }

/* A willow underline under section headings; it draws on scroll where supported. */
h2.drawn {
  position: relative;
  display: inline-block;
  padding-bottom: 8px;
  view-timeline: --heading block;
}

h2.drawn::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--willow);
  transform-origin: left;
}

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

:focus-visible {
  outline: 3px solid var(--willow);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.wrap {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Header */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 20px;
}

.brand {
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.nav-links a { color: var(--moss); text-decoration: none; }
.nav-links a:hover { color: var(--bark); text-decoration: underline; }

.lang { display: flex; gap: 8px; font-size: 0.95rem; }
.lang [aria-current] { color: var(--bark); font-weight: 700; }
.lang a { color: var(--moss); }
.lang-sep { color: var(--line); }

@media (min-width: 720px) {
  .site-header nav:first-of-type { margin-left: auto; }
}

/* Hero */

.hero { position: relative; overflow: hidden; }

.hero-inner {
  position: relative;
  min-height: clamp(380px, 60vh, 580px);
  display: flex;
  align-items: center;
  padding-block: clamp(32px, 6vw, 72px);
}

.hero h1 { margin-bottom: 0.32em; }

@media (max-width: 719px) {
  .hero-inner { min-height: 0; padding-block: 40px 16px; }
}

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

/* Falling leaves; shown only when motion is allowed (see the end). */
.drift {
  display: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  container-type: size;
}

.drift span {
  position: absolute;
  top: -32px;
  left: var(--x);
  width: 9px;
  height: 24px;
  border-radius: 0 100% 0 100%;
  background: var(--willow);
  opacity: 0.4;
}

.drift span:nth-child(1) { --x: 58%; --t: 13s; --d: -1s; }
.drift span:nth-child(2) { --x: 71%; --t: 16s; --d: -6s; }
.drift span:nth-child(3) { --x: 83%; --t: 12s; --d: -9s; }
.drift span:nth-child(4) { --x: 64%; --t: 17s; --d: -12s; }
.drift span:nth-child(5) { --x: 91%; --t: 14s; --d: -3s; }
.drift span:nth-child(6) { --x: 46%; --t: 18s; --d: -15s; }
.drift span:nth-child(7) { --x: 77%; --t: 15s; --d: -4.5s; }

@media (max-width: 719px) {
  .drift span:nth-child(n+5) { display: none; }
}

.lead { font-size: clamp(1.125rem, 1.6vw, 1.3rem); max-width: 40ch; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1.5px solid var(--bark);
  background: var(--bark);
  color: var(--sage);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
}

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

.btn-ghost { background: transparent; color: var(--bark); }
.btn-ghost:hover { background: var(--bark); color: var(--sage); border-color: var(--bark); }

.branch {
  position: absolute;
  top: 0;
  right: var(--gutter);
  height: 100%;
  width: auto;
  fill: none;
  stroke: var(--willow);
  stroke-width: 1.4;
  stroke-linecap: round;
}

/* Dash lengths are user units, longer than any path they draw:
   stems are under 540 long, leaves under 80. */
.branch .stem { --len: 540; }
.branch .leaf { --len: 80; }
.branch path { stroke-dasharray: var(--len); stroke-dashoffset: 0; }

@media (max-width: 719px) {
  /* Short and tucked into the top-right corner, clear of the body text. */
  .branch { right: -12px; height: 170px; opacity: 0.6; }
}

/* Blocks */

.block { padding-block: var(--block); }

.two { display: grid; gap: 40px; }

@media (min-width: 720px) {
  .two { grid-template-columns: 1fr 1fr; gap: 56px; }
}

.band { background: var(--pale-leaf); }

/* DocToolkit */

.product { display: grid; gap: 48px; }

@media (min-width: 960px) {
  .product { grid-template-columns: minmax(0, 1fr) minmax(0, 24rem); align-items: center; }
}

.product-main { min-width: 0; }

.table-wrap {
  view-timeline: --matrix block; /* on the wrapper: it is the table's own scroll box */
  position: relative; /* containing block for the .sr-only cell labels, or they escape the scroll box and widen the page */
  overflow-x: auto;
  margin-block: 32px;
  max-width: 40rem;
}

.matrix {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
  text-align: center;
}

.matrix caption {
  caption-side: bottom;
  text-align: left;
  font-size: 0.875rem;
  padding-top: 10px;
}

.matrix th, .matrix td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  font-weight: 400;
}

.matrix thead th, .matrix tbody th { color: var(--bark); font-weight: 600; }
.matrix tbody th { text-align: left; }

.matrix .on { background: var(--willow); color: #fff; font-weight: 700; }
.matrix .self { color: var(--line); }

@media (max-width: 519px) {
  .matrix { font-size: 0.8rem; }
  .matrix th, .matrix td { padding: 7px 5px; }
}

.facts { margin: 0 0 28px; padding-left: 1.2em; max-width: 62ch; }
.facts li { margin-bottom: 0.4em; }

.install {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  margin: 0;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--bark);
  color: var(--sage);
  font-family: var(--mono);
  font-size: 0.9rem;
}

/* Product demo: an illustration, not a live conversion. */

.demo { margin: 0; }

.demo-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 20px;
  border-radius: 16px;
  background: var(--sage);
}

.demo-src {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--bark);
  color: var(--sage);
  font-family: var(--mono);
  font-size: 0.75rem;
  white-space: nowrap;
}

.demo-flow {
  position: relative;
  flex: none;
  width: 28px;
  height: 2px;
  background: var(--willow);
}

.demo-flow::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--willow);
}

.demo-page {
  flex: none;
  width: 96px;
  aspect-ratio: 1 / 1.414;
  padding: 12px 10px;
  background: #fff;
  box-shadow: 3px 4px 0 var(--line);
}

.demo-page > * { display: block; margin-bottom: 7px; transform-origin: left; }
.demo-page i { height: 8px; width: 72%; background: var(--bark); }
.demo-page b { height: 4px; background: var(--moss); }
.demo-page s { height: 4px; background: var(--line); }
.demo-page b:nth-of-type(2), .demo-page s:nth-of-type(3) { width: 64%; }

.demo figcaption { margin-top: 12px; font-size: 0.875rem; }

@media (max-width: 519px) {
  .demo-stage { gap: 10px; padding: 24px 12px; }
  .demo-src { font-size: 0.66rem; padding: 12px; }
  .demo-flow { width: 18px; }
  .demo-flow::after { left: 8px; }
  .demo-page { width: 72px; padding: 9px 8px; }
}

/* Founder */

.founder { display: flex; align-items: center; gap: 22px; }
.founder h2 { margin-bottom: 0.1em; }
.founder p { margin: 0; }

.initials {
  flex: none;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1.5px solid var(--willow);
  color: var(--willow);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}

/* Contact */

.contact { background: var(--bark); color: var(--on-bark); }
.contact h2 { color: var(--sage); }

.topics {
  display: grid;
  gap: 10px;
  max-width: 36rem;
  margin: 12px 0 32px;
  padding: 0;
  list-style: none;
}

.topics a {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
  padding: 16px 20px;
  border: 1.5px solid #76806E; /* 3.1:1 on bark: the button edge stays visible */
  border-radius: 14px;
  color: var(--sage);
  text-decoration: none;
}

.topics strong { font-size: 1.1rem; font-weight: 600; }
.topics span { color: var(--on-bark); font-size: 0.95rem; }
.topics a:hover { background: #3A3F35; border-color: var(--willow); }

.mail-label { margin: 0 0 4px; }

.mail { margin: 0; font-size: clamp(1.25rem, 4vw, 1.9rem); font-weight: 600; overflow-wrap: anywhere; }
.mail a { color: var(--sage); }
.contact :focus-visible { outline-color: var(--sage); }

/* Footer */

.site-footer { padding-block: 22px; font-size: 0.875rem; }

/* 404 */

.notfound { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; }

/* Motion. Nothing outside this block animates, and every element's resting
   style above is its finished state, so "reduce motion" shows a complete page. */

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

  /* The branch draws itself once on load. */
  .branch .stem { animation: draw 0.9s ease-out both; }
  .branch .leaf { animation: draw 0.7s ease-out 0.7s both; }

  /* Leaves drift down behind the hero text. */
  .drift { display: block; }
  .drift span { animation: fall var(--t) linear var(--d) infinite; }

  /* The product demo loops: HTML lines light up, the page fills in. */
  .demo-src span { animation: read 6s infinite; }
  .demo-src span:nth-child(2) { animation-delay: 0.8s; }
  .demo-src span:nth-child(3) { animation-delay: 1.6s; }
  .demo-flow::after { animation: travel 2s ease-in-out infinite; }
  .demo-page > * { animation: fill 6s infinite; }
  .demo-page i { animation-delay: 0.9s; }
  .demo-page b { animation-delay: 1.7s; }
  .demo-page b + b { animation-delay: 1.9s; }
  .demo-page s { animation-delay: 2.5s; }
  .demo-page s + s { animation-delay: 2.7s; }
  .demo-page s + s + s { animation-delay: 2.9s; }
  .topics a { transition: background-color 0.2s, border-color 0.2s; }

  /* Scroll-driven: browsers without support keep the finished state. */
  @supports (animation-timeline: view()) {
    h2.drawn::after {
      animation: grow linear both;
      animation-timeline: --heading;
      animation-range: entry 60% cover 40%;
    }

    .matrix td.on { animation: pop linear both; animation-timeline: --matrix; }
    .matrix tbody tr:nth-child(1) td.on { animation-range: entry 40% cover 30%; }
    .matrix tbody tr:nth-child(2) td.on { animation-range: entry 55% cover 34%; }
    .matrix tbody tr:nth-child(3) td.on { animation-range: entry 70% cover 38%; }
    .matrix tbody tr:nth-child(4) td.on { animation-range: entry 85% cover 42%; }
    .matrix tbody tr:nth-child(5) td.on { animation-range: entry 100% cover 46%; }
    .matrix tbody tr:nth-child(6) td.on { animation-range: cover 30% cover 50%; }

    .install { view-timeline: --install block; }
    .install code {
      display: inline-block;
      overflow: hidden;
      vertical-align: bottom;
      white-space: nowrap;
      animation: type steps(33, end) both;
      animation-timeline: --install;
      animation-range: entry 0% entry 100%; /* complete once fully on screen: never left half-typed */
    }
  }
}

@keyframes draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }

@keyframes fall {
  0%   { transform: translate(0, 0) rotate(10deg); }
  25%  { transform: translate(-18px, 28cqh) rotate(-25deg); }
  50%  { transform: translate(8px, 55cqh) rotate(30deg); }
  75%  { transform: translate(-14px, 82cqh) rotate(-15deg); }
  100% { transform: translate(4px, calc(100cqh + 48px)) rotate(20deg); }
}

@keyframes read {
  0%, 8%, 70%, 100% { color: var(--moss); }
  14%, 60% { color: var(--sage); }
}

@keyframes travel {
  0% { left: 0; opacity: 0; }
  20% { opacity: 1; }
  100% { left: calc(100% - 10px); opacity: 0; }
}

@keyframes fill {
  0%, 5% { transform: scaleX(0); }
  14%, 82% { transform: scaleX(1); }
  94%, 100% { transform: scaleX(0); }
}

@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@keyframes pop {
  from { background: transparent; color: transparent; transform: scale(0.6); }
  to { background: var(--willow); color: #fff; transform: none; }
}

@keyframes type { from { width: 0; } to { width: 33ch; } }
