/* CoreTend 2.0 — the living greenhouse, in CSS only (no script). Colours come from
   design-tokens.css, generated from the app's palette; per-item timing of the greenhouse comes
   from living.css, generated by Scripts/build_site.py (the CSP forbids style attributes).
   Every animation is decorative: the final state is the default, content is readable without
   motion, and prefers-reduced-motion stops all of it. */

*, *::before, *::after { box-sizing: border-box; }
:root {
  --wrap: 1200px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --leaf-sm: 14px 5px 14px 5px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 5.5rem; }
body {
  margin: 0;
  min-width: 0;
  background: var(--ct-canvas);
  color: var(--ct-ink);
  font: 17px/1.6 "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  overflow-x: clip;
}
h1, h2, h3 { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 700; line-height: 1.1; margin: 0 0 .45em; text-wrap: balance; }
h1 { font-size: clamp(2.3rem, 5.2vw, 4.3rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.6rem); letter-spacing: -.01em; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; color: var(--ct-secondary-ink); text-wrap: pretty; }
a { color: var(--ct-accent); }
code { font: .88em/1.5 ui-monospace, "SF Mono", Menlo, monospace; background: var(--ct-deep); border: 1px solid var(--ct-separator); border-radius: 8px; padding: .2em .5em; display: inline-block; max-width: 100%; overflow-wrap: anywhere; color: var(--ct-ink); }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid var(--ct-focus); outline-offset: 3px; border-radius: 6px; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ct-accent); color: var(--ct-on-accent); padding: .6em 1em; border-radius: 10px; z-index: 20; }
.skip-link:focus { left: 12px; }

/* ---------------------------------------------------------------- header, brand, nav */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--ct-canvas) 84%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid color-mix(in srgb, var(--ct-separator) 70%, transparent);
}
.header-inner { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: .7rem var(--gutter); display: flex; align-items: center; gap: 1.2rem; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ct-ink); text-decoration: none; font-family: "Iowan Old Style", Georgia, serif; font-weight: 700; font-size: 1.25rem; line-height: 1.1; flex-shrink: 0; }
.brand small { display: block; font: 500 .7rem "Avenir Next", system-ui, sans-serif; color: var(--ct-tertiary-ink); letter-spacing: .02em; }
.mark { width: 2.1rem; height: 2.3rem; overflow: visible; flex-shrink: 0; }
.mark-stem { fill: none; stroke: var(--ct-accent); stroke-width: 46; stroke-linecap: round; stroke-dasharray: 1; animation: draw 1.1s .15s var(--ease-out) backwards; }
.mark-leaf { fill: var(--ct-accent); transform-box: fill-box; animation: unfold .7s var(--ease-spring) backwards; }
.mark-leaf-1 { transform-origin: 100% 100%; animation-delay: .9s; }
.mark-leaf-2 { transform-origin: 0% 100%; animation-delay: 1.1s; }
.mark-soil { fill: none; stroke: var(--ct-strong-separator); stroke-width: 40; stroke-linecap: round; }
.brand:hover .mark { animation: shiver .6s ease; transform-origin: 50% 100%; }

.primary-nav { display: flex; gap: .2rem; margin-left: auto; min-width: 0; }
.primary-nav a, .lang { color: var(--ct-secondary-ink); text-decoration: none; padding: .42rem .8rem; border-radius: var(--leaf-sm); white-space: nowrap; font-size: .95rem; transition: background .16s, color .16s; }
.primary-nav a:hover, .lang:hover { background: color-mix(in srgb, var(--ct-accent) 12%, transparent); color: var(--ct-ink); }
.primary-nav a[aria-current="page"] { background: color-mix(in srgb, var(--ct-accent) 18%, transparent); color: var(--ct-ink); font-weight: 600; }
.lang { border: 1px solid var(--ct-separator); flex-shrink: 0; }

/* ---------------------------------------------------------------- buttons */
.button { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; padding: .75rem 1.3rem; border-radius: 18px 6px 18px 6px; font-weight: 600; text-decoration: none; text-align: center; transition: transform .09s, filter .16s, border-color .16s, background .16s; }
.button:active { transform: scale(.97); }
.button-primary { background: var(--ct-accent); color: var(--ct-on-accent); box-shadow: 0 12px 32px -14px color-mix(in srgb, var(--ct-accent) 75%, transparent); }
.button-primary:hover { filter: brightness(1.08); }
.button-secondary { color: var(--ct-ink); border: 1px solid var(--ct-strong-separator); }
.button-secondary:hover { border-color: var(--ct-accent); background: color-mix(in srgb, var(--ct-accent) 8%, transparent); }
.button-large { font-size: 1.05rem; padding: .95rem 1.6rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 1.6rem 0 1rem; }
.unpublished { border: 1px dashed var(--ct-strong-separator); border-radius: var(--leaf-sm); padding: .8rem 1.1rem; color: var(--ct-ink); max-width: 36rem; margin: 0; }
.requirements { font-size: .88rem; color: var(--ct-tertiary-ink); margin: 0; }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--ct-accent); animation: breathe 2.8s ease-in-out infinite; }
.lead { font-size: clamp(1.08rem, 1.6vw, 1.25rem); color: var(--ct-ink); opacity: .88; max-width: 40rem; }

/* ---------------------------------------------------------------- hero, stage */
/* The first screen is one composition: copy and icon centred, the greenhouse growing along its
   bottom edge across the full width, its soil line meeting the fold. */
.hero {
  --ground: clamp(96px, min(15.4vw, 22vh), 260px);
  position: relative;
  min-height: min(calc(100vh - 4.3rem), 62rem);
  min-height: min(calc(100svh - 4.3rem), 62rem);
  display: flex; flex-direction: column; justify-content: center;
  padding-bottom: var(--ground);
  overflow: hidden;
}
.hero::before { content: ""; position: absolute; inset: auto 0 0 0; height: calc(var(--ground) * 1.6); background: linear-gradient(to top, color-mix(in srgb, var(--ct-accent) 9%, transparent), transparent); pointer-events: none; }
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 6px; background: color-mix(in srgb, var(--ct-strong-separator) 45%, var(--ct-deep)); z-index: 1; }
.hero-inner {
  width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto;
  padding: clamp(1.5rem, 5vh, 4.5rem) var(--gutter) clamp(1rem, 3vh, 2.5rem);
  display: grid; gap: 2.5rem; align-items: center; position: relative; z-index: 1;
}
.hero .greenhouse-hero { position: absolute; inset: auto 0 6px 0; height: var(--ground); }
.hero-copy { animation: rise .8s var(--ease-out) backwards; min-width: 0; }
.hero-icon { justify-self: center; position: relative; width: clamp(150px, min(24vw, 34vh), 300px); }
.hero h1 { font-size: clamp(2.3rem, min(5.2vw, 8vh), 4.3rem); }
.hero-icon::before { content: ""; position: absolute; inset: 8%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--ct-accent) 45%, transparent), transparent 70%); filter: blur(30px); z-index: -1; animation: breathe 6s ease-in-out infinite; }
.hero-icon img { width: 100%; animation: float 7s ease-in-out infinite, pop .9s var(--ease-spring) backwards; }
@media (min-width: 900px) {
  .hero-inner { grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); }
}

.stage { position: relative; max-width: calc(1280px + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.stage { padding-top: clamp(2.5rem, 6vw, 4.5rem); }

/* ---------------------------------------------------------------- greenhouse */
.greenhouse { position: relative; height: clamp(150px, 24vw, 280px); overflow: hidden; pointer-events: none; }
.greenhouse svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.glass { fill: none; stroke: var(--ct-strong-separator); stroke-width: 1.5; opacity: .5; }
.mullion { stroke: var(--ct-strong-separator); stroke-width: 1; opacity: .28; }
.soil { fill: var(--ct-strong-separator); opacity: .35; }
.shoot-sway { transform-origin: 50% 100%; transform-box: fill-box; animation: sway 3s ease-in-out 1s infinite alternate; }
.shoot-stem { fill: none; stroke: var(--ct-accent); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 1; animation: draw 1s .3s var(--ease-out) backwards; }
.shoot-leaf { fill: var(--ct-accent); transform-box: fill-box; transform-origin: 50% 100%; animation: leaf .6s .9s var(--ease-spring) backwards; }
.shoot-wilted .shoot-stem { stroke: var(--ct-danger); }
.shoot-wilted .shoot-leaf { fill: var(--ct-danger); }
.shoot-wilted .shoot-sway { animation: none; transform: rotate(14deg); }
.pollen span { position: absolute; left: 50%; bottom: 6%; width: 4px; height: 4px; border-radius: 50%; background: var(--ct-accent); opacity: 0; animation: drift 9s linear infinite; }

/* ---------------------------------------------------------------- captures */
.capture { margin: 0; min-width: 0; }
.capture img { width: 100%; border-radius: 16px; border: 1px solid var(--ct-separator); box-shadow: 0 30px 70px -35px rgba(0, 0, 0, .55); background: var(--ct-surface); }
.capture figcaption { text-align: center; font-size: .88rem; color: var(--ct-tertiary-ink); margin-top: .8rem; }
.capture-hero { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; animation: rise 1s .2s var(--ease-out) backwards; }

/* ---------------------------------------------------------------- proof strip */
.proof { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(3rem, 7vw, 5rem) var(--gutter) 0; display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.proof-item { border-left: 3px solid var(--ct-accent); padding: .3rem 0 .3rem 1.1rem; display: grid; gap: .3rem; }
.proof-item strong { font-family: "Iowan Old Style", Georgia, serif; font-size: clamp(2rem, 3.6vw, 2.8rem); line-height: 1; color: var(--ct-ink); }
.proof-item span { color: var(--ct-secondary-ink); font-size: .95rem; }

/* ---------------------------------------------------------------- bands, heads, cards */
.band { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(3.5rem, 8vw, 6.5rem) var(--gutter) 0; }
.band-tight { padding-top: clamp(2rem, 5vw, 3.5rem); }
.section-head { max-width: 44rem; margin-bottom: 2rem; }
.section-head p { font-size: 1.05rem; }
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.cards-two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.cards-three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.cards-four { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.card { min-width: 0; background: var(--ct-surface); border: 1px solid var(--ct-separator); border-radius: 22px 8px 22px 8px; padding: 1.5rem 1.5rem 1.1rem; transition: transform .28s var(--ease-out), border-color .2s; }
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--ct-accent) 60%, var(--ct-separator)); }
.card h3 { margin-top: .2rem; }
.card p:last-child { margin-bottom: 0; }
.card code { display: block; margin: .5rem 0 .3rem; }
.leaf-icon { width: 26px; height: 26px; display: block; margin-bottom: .7rem; transform-origin: 20% 80%; }
.leaf-icon path { fill: color-mix(in srgb, var(--ct-accent) 85%, transparent); }
.leaf-icon .leaf-vein { fill: none; stroke: var(--ct-surface); stroke-width: 1.6; stroke-linecap: round; }
.card:hover .leaf-icon { animation: shiver .6s ease; }
.card-never .leaf-icon path { fill: none; stroke: var(--ct-accent); stroke-width: 1.6; }
.card-never .leaf-icon .leaf-vein { stroke: var(--ct-accent); }

.tools { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.tool { min-width: 0; display: flex; flex-direction: column; gap: .35rem; text-decoration: none; background: var(--ct-surface); border: 1px solid var(--ct-separator); border-radius: 22px 8px 22px 8px; padding: 1.3rem 1.3rem 1.2rem; transition: transform .28s var(--ease-out), border-color .2s, background .2s; }
.tool:hover { transform: translateY(-4px); border-color: var(--ct-accent); background: var(--ct-raised-surface); }
.tool-name { font-size: .76rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ct-accent); }
.tool strong { font-family: "Iowan Old Style", Georgia, serif; font-size: 1.25rem; line-height: 1.2; color: var(--ct-ink); }
.tool-body { color: var(--ct-secondary-ink); font-size: .93rem; line-height: 1.55; }
.more { margin: 1.5rem 0 0; }
.more a { font-weight: 600; text-decoration: none; }
.more a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- split sections (copy + capture) */
.split { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(3.5rem, 8vw, 6.5rem) var(--gutter) 0; display: grid; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.split-copy { min-width: 0; max-width: 34rem; }
.split-copy p { font-size: 1.05rem; }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .split-flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .split-flip .split-copy { order: 2; }
}
.feature { scroll-margin-top: 5.5rem; }

.intro { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(3rem, 8vw, 6rem) var(--gutter) 0; animation: rise .8s var(--ease-out) backwards; }
.chips { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 1rem auto 0; padding: 0 var(--gutter); display: flex; flex-wrap: wrap; gap: .5rem; }
.chips a { text-decoration: none; color: var(--ct-ink); border: 1px solid var(--ct-separator); background: var(--ct-surface); border-radius: var(--leaf-sm); padding: .4rem .85rem; font-size: .92rem; transition: border-color .16s, background .16s; }
.chips a:hover { border-color: var(--ct-accent); background: var(--ct-raised-surface); }
.prose { max-width: 46rem; }
.prose p { font-size: 1.05rem; }

/* ---------------------------------------------------------------- download */
.download-panel { display: grid; gap: 2rem; background: var(--ct-surface); border: 1px solid var(--ct-separator); border-radius: 30px 10px 30px 10px; padding: clamp(1.5rem, 4vw, 2.75rem); }
@media (min-width: 900px) { .download-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; } }
.panel-main { display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; min-width: 0; }
.panel-main > div { min-width: 0; flex: 1 1 16rem; }
.panel-main h2 { margin-bottom: .2rem; }
.panel-main .actions { margin: 1.1rem 0 0; }
.panel-icon { width: 104px; height: 104px; flex-shrink: 0; }
.panel-meta { font-size: .92rem; color: var(--ct-tertiary-ink); margin: 0; }
.panel-facts { min-width: 0; border-top: 1px solid var(--ct-separator); padding-top: 1.5rem; }
@media (min-width: 900px) { .panel-facts { border-top: 0; border-left: 1px solid var(--ct-separator); padding: 0 0 0 2rem; } }
.panel-facts h3 { font-size: 1.05rem; font-family: "Avenir Next", system-ui, sans-serif; color: var(--ct-secondary-ink); }
.facts { display: grid; gap: .9rem; margin: 0; }
.facts div { display: grid; gap: .2rem; min-width: 0; }
.facts dt { color: var(--ct-tertiary-ink); font-size: .82rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.facts dd { margin: 0; color: var(--ct-ink); min-width: 0; }
.facts code { font-size: .74rem; letter-spacing: -.01em; }

/* ---------------------------------------------------------------- final call */
.final { text-align: center; padding: clamp(4.5rem, 10vw, 8rem) var(--gutter) 1rem; max-width: 820px; margin: 0 auto; }
.final .actions { justify-content: center; }
.final-mark .mark { width: 4.5rem; height: 5rem; margin: 0 auto 1rem; }

/* ---------------------------------------------------------------- vine and footer */
.vine { width: 100%; max-width: 100%; height: 36px; display: block; margin: 1.4rem 0 0; }
.vine path { fill: none; stroke: var(--ct-accent); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1; opacity: .65; animation: draw 1.6s .4s var(--ease-out) backwards; }
.site-footer { margin-top: clamp(6rem, 12vw, 9rem); border-top: 1px solid var(--ct-separator); background: linear-gradient(to bottom, color-mix(in srgb, var(--ct-deep) 60%, transparent), var(--ct-deep)); }
.greenhouse-footer { height: clamp(70px, 10vw, 120px); margin-top: calc(-1 * clamp(70px, 10vw, 120px)); }
.footer-inner { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 2.5rem var(--gutter); display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .footer-inner { grid-template-columns: minmax(0, 1fr) auto; } }
.footer-brand p { margin: .8rem 0 0; max-width: 28rem; }
.site-footer nav { display: grid; grid-template-columns: repeat(2, auto); gap: .35rem 2rem; align-content: start; }
.site-footer nav a { color: var(--ct-secondary-ink); text-decoration: none; }
.site-footer nav a:hover { color: var(--ct-accent); }
.footer-meta { grid-column: 1 / -1; font-size: .85rem; color: var(--ct-tertiary-ink); margin: 0; }

/* ---------------------------------------------------------------- language chooser */
.language { position: relative; min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 3rem var(--gutter) clamp(9rem, 26vh, 16rem); overflow: hidden; }
.language-card { position: relative; z-index: 2; text-align: center; max-width: 40rem; animation: rise .8s var(--ease-out) backwards; }
.language-icon { width: 140px; margin: 0 auto 1rem; animation: float 7s ease-in-out infinite, pop .9s var(--ease-spring) backwards; }
.language-name { font-family: "Iowan Old Style", Georgia, serif; font-weight: 700; color: var(--ct-secondary-ink); font-size: 1.1rem; margin: 0 0 .6rem; }
.language-card h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
.language-card h1 span { display: block; font-size: .55em; color: var(--ct-secondary-ink); margin-top: .5em; font-weight: 600; }
.language-card .actions { justify-content: center; }
.greenhouse-ground { position: absolute; inset: auto 0 0 0; height: clamp(140px, 26vh, 260px); }

/* ---------------------------------------------------------------- scroll reveal */
.reveal { animation: rise .7s var(--ease-out) backwards; }
@supports (animation-timeline: view()) {
  /* Fully shown as soon as the element has entered: never left half-faded near the page end. */
  .reveal { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
}

/* ---------------------------------------------------------------- keyframes (from = start; the final state is the default) */
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes unfold { from { transform: scale(0); } }
@keyframes leaf { from { opacity: 0; transform: scale(.1) rotate(-20deg); } }
@keyframes sway { from { transform: rotate(-3.5deg); } to { transform: rotate(3.5deg); } }
@keyframes shiver { 0% { transform: rotate(0); } 25% { transform: rotate(9deg); } 50% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } 100% { transform: rotate(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .55; } }
@keyframes drift { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: .7; } 100% { transform: translate(24px, -220px); opacity: 0; } }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; row-gap: .5rem; padding-top: .6rem; padding-bottom: .5rem; }
  .lang { margin-left: auto; }
  .primary-nav { order: 3; flex: 1 0 100%; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) .1rem; overflow-x: auto; scrollbar-width: none; }
  .primary-nav::-webkit-scrollbar { display: none; }
  .actions .button { flex: 1 1 auto; }
  .capture img { border-radius: 10px; }
}

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .01ms !important;
  }
  .pollen { display: none; }
  .reveal { animation: none !important; opacity: 1 !important; transform: none !important; }
}
.channels a { font-weight: 600; }
