/* Fernis Labs — one stylesheet for the whole site. */

@font-face { font-family: Figtree; src: url(/fonts/figtree-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Figtree; src: url(/fonts/figtree-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Figtree; src: url(/fonts/figtree-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --paper: #F1F4EF;
  --surface: #FFFFFF;
  --ink: #15231B;
  --muted: #55635B;
  --line: #D3DBD3;
  --fern: #2D6A4C;
  --fern-soft: #DFEAE2;
  --warn: #8A5A0B;
  --warn-soft: #F6EBD3;
  --dew: #5E9FC4;

  --font: Figtree, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: clamp(2rem, 5vw, 2.6rem);
  --step-4: clamp(2.5rem, 7.5vw, 4.4rem);

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --wide: 72rem;
  --measure: 42rem;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E1712;
    --surface: #15211A;
    --ink: #E5EDE7;
    --muted: #9BAAA1;
    --line: #26352C;
    --fern: #86C7A2;
    --fern-soft: #1A2B21;
    --warn: #E9C27A;
    --warn-soft: #33281A;
    --dew: #8CC6E6;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.15; font-weight: 700; letter-spacing: -0.015em; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; }
a { color: var(--fern); text-underline-offset: 3px; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--fern); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; display: block; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; top: 1rem; }

.lead { font-size: var(--step-1); line-height: 1.55; color: var(--muted); max-width: 36rem; }

.button {
  display: inline-block; padding: .75rem 1.25rem; border-radius: 999px;
  background: var(--fern); color: var(--paper); font-weight: 600; text-decoration: none;
}
.button:hover { filter: brightness(1.08); }

/* ---------- The fern mark ---------- */
.mark { color: var(--fern); flex: none; }
.mark path { fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.mark--draw path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.6s cubic-bezier(.6, 0, .2, 1) forwards; }
.mark--draw .mark__leaf { animation-duration: .7s; }
.mark--draw .mark__leaf:nth-of-type(2) { animation-delay: 1.0s; }
.mark--draw .mark__leaf:nth-of-type(3) { animation-delay: 1.1s; }
.mark--draw .mark__leaf:nth-of-type(4) { animation-delay: 1.25s; }
.mark--draw .mark__leaf:nth-of-type(5) { animation-delay: 1.35s; }
.mark--draw .mark__leaf:nth-of-type(6) { animation-delay: 1.5s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .mark--draw path { animation: none; stroke-dashoffset: 0; }
}

/* ---------- Header and footer ---------- */
.site-header {
  max-width: var(--wide); margin: 0 auto; padding: 1.25rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.wordmark { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-weight: 700; font-size: var(--step-1); letter-spacing: -0.01em; }
.site-nav { display: flex; gap: 1.25rem; font-size: var(--step--1); font-weight: 600; }
.site-nav a { color: var(--ink); text-decoration: none; }
.site-nav a:hover { color: var(--fern); }
.site-nav .lang { color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); margin-top: 5rem; font-size: var(--step--1); color: var(--muted); }
.site-footer__inner {
  max-width: var(--wide); margin: 0 auto; padding: 2.5rem var(--gutter) 1rem;
  display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}
.site-footer__studio p { margin-top: .75rem; }
.site-footer__col { display: flex; flex-direction: column; gap: .4rem; }
.site-footer__col h2 { font-size: var(--step--1); color: var(--ink); margin-bottom: .2rem; }
.site-footer__col a { color: var(--muted); text-decoration: none; }
.site-footer__col a:hover, .site-footer__studio a:hover { color: var(--fern); text-decoration: underline; }
.site-footer__studio p a { color: var(--muted); }
.site-footer__legal { max-width: var(--wide); margin: 0 auto; padding: 1rem var(--gutter) 2.5rem; }

/* ---------- Page containers ---------- */
.page, .section, .hero { max-width: var(--wide); margin-inline: auto; padding-inline: var(--gutter); }
.section { margin-top: 4.5rem; }
.page .section { padding-inline: 0; }
.section > h2 { font-size: var(--step-2); margin-bottom: 1.5rem; }

/* ---------- Home ---------- */
.hero {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: clamp(1.5rem, 5vw, 4rem);
  padding-block: clamp(2.5rem, 8vw, 6rem) 1rem;
}
.hero__mark { width: 100%; height: auto; }
.hero h1 { font-size: var(--step-4); letter-spacing: -0.035em; line-height: 1.02; margin-bottom: 1.25rem; }
.hero__line { display: block; }
.hero .lead { margin-bottom: 1.5rem; }
@media (prefers-reduced-motion: no-preference) {
  .hero__line, .hero .lead, .promises { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
  .hero__line + .hero__line { animation-delay: .12s; }
  .hero .lead { animation-delay: .24s; }
  .promises { animation-delay: .36s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.promises { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.promises li {
  display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .85rem .4rem .7rem;
  border-radius: 999px; background: var(--fern-soft); color: var(--ink); font-size: var(--step--1); font-weight: 600;
}
.promises li::before {
  content: ''; width: .6rem; height: .33rem; margin-top: -.15rem;
  border-left: 2px solid var(--fern); border-bottom: 2px solid var(--fern); transform: rotate(-45deg);
}
@media (max-width: 40rem) {
  .hero { grid-template-columns: 1fr; padding-top: 1.5rem; }
  .hero__text { order: -1; }
  .garden { justify-self: center; }
}

.app-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }

.app-tile {
  background: var(--app-bg); color: var(--app-text);
  border-radius: 22px; padding: 1.75rem;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-text) 10%, transparent);
  display: flex; flex-direction: column; gap: 1.1rem;
}
.app-tile p { color: var(--app-muted); margin: 0; }
.app-tile__head { display: flex; align-items: center; gap: 1rem; color: inherit; text-decoration: none; }
.app-tile__head h3 { font-size: var(--step-2); }
.app-tile__head:hover h3 { text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--app-accent); }
.app-tile__tagline { color: var(--app-accent); font-weight: 600; }
.app-tile .doc-links { margin-top: auto; padding-top: 1rem; border-top: 1px solid color-mix(in srgb, var(--app-text) 14%, transparent); }
.app-tile .doc-links a { color: var(--app-text); }

.app-tile--next {
  background: transparent; color: var(--muted);
  border: 1.5px dashed var(--line); align-items: center; justify-content: center; text-align: center; min-height: 14rem;
}
.app-tile--next p { color: var(--muted); }
.app-tile--next .mark { color: var(--line); }

.app-icon { border-radius: 22.5%; box-shadow: 0 0 0 1px color-mix(in srgb, var(--app-text, #fff) 12%, transparent); }

.stores { display: flex; flex-wrap: wrap; gap: .6rem; }
.store {
  display: inline-flex; flex-direction: column; line-height: 1.15; padding: .5rem 1rem; border-radius: 10px;
  background: var(--app-text); color: var(--app-bg); text-decoration: none; min-width: 9rem;
}
.store small { font-size: .72rem; opacity: .75; }
.store span { font-weight: 700; }
.store--soon { background: transparent; color: var(--app-text); border: 1px solid color-mix(in srgb, var(--app-text) 30%, transparent); }

.doc-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: var(--step--1); font-weight: 600; }

.contact p { max-width: var(--measure); }
.contact__email { font-size: var(--step-2); font-weight: 700; letter-spacing: -0.01em; }
.contact__where { color: var(--muted); }

/* ---------- App page ---------- */
.app-hero { background: var(--app-bg); color: var(--app-text); padding-block: 2rem clamp(3rem, 8vw, 5rem); }
.app-hero__inner { max-width: var(--wide); margin: 0 auto; padding-inline: var(--gutter); }
.app-hero .crumbs a, .app-hero .crumbs li { color: var(--app-muted); }
.app-hero__id { display: flex; align-items: center; gap: clamp(1rem, 3vw, 1.75rem); margin: 2rem 0 1.5rem; }
.app-hero__id .app-icon { width: clamp(80px, 14vw, 112px); height: auto; }
.app-hero h1 { font-size: var(--step-4); letter-spacing: -0.035em; }
.app-hero__tagline { color: var(--app-accent); font-size: var(--step-1); font-weight: 600; margin: .3rem 0 0; }
.app-hero .lead { color: var(--app-muted); margin-bottom: 1.75rem; }

.features, .plans { margin: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.features, .plans { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 48rem) { .features, .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.features > div, .plans > div { background: var(--surface); padding: 1.4rem 1.5rem; }
.features dt, .plans dt { font-weight: 700; font-size: var(--step-1); margin-bottom: .4rem; }
.features dd, .plans dd { margin: 0; color: var(--muted); }

.checks { list-style: none; padding: 0; margin: 0 0 1.25rem; max-width: var(--measure); }
.checks li { position: relative; padding-left: 1.9rem; margin: .55rem 0; }
.checks li::before {
  content: ''; position: absolute; left: .2rem; top: .45em; width: .9rem; height: .5rem;
  border-left: 2.5px solid var(--fern); border-bottom: 2.5px solid var(--fern); transform: rotate(-45deg);
}

.notice { margin-top: 3rem; max-width: var(--measure); padding: 1rem 1.25rem; border-left: 3px solid var(--fern); background: var(--fern-soft); border-radius: 0 10px 10px 0; color: var(--ink); }

/* ---------- Breadcrumbs ---------- */
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .35rem; font-size: var(--step--1); color: var(--muted); }
.crumbs li + li::before { content: '/'; margin-right: .35rem; opacity: .6; }
.crumbs a { color: inherit; }

/* ---------- Documents (legal, support) ---------- */
.doc { padding-top: 1.5rem; }
.doc h1 { font-size: var(--step-3); letter-spacing: -0.025em; margin: 1.5rem 0 .5rem; max-width: 24ch; }
.doc__updated { color: var(--muted); font-size: var(--step--1); margin-bottom: 2.5rem; }
.doc__grid { display: grid; grid-template-columns: minmax(0, var(--measure)) minmax(12rem, 16rem); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.doc__aside { position: sticky; top: 1.5rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.doc__aside .doc-links { flex-direction: column; gap: .6rem; }
.doc__aside a[aria-current] { color: var(--ink); text-decoration: none; }
.doc__aside a[aria-current]::before { content: ''; display: inline-block; width: .45rem; height: .45rem; border-radius: 50%; background: var(--fern); margin-right: .5rem; vertical-align: middle; }
@media (max-width: 56rem) {
  .doc__grid { grid-template-columns: minmax(0, 1fr); }
  .doc__aside { position: static; }
}

.prose { min-width: 0; }
.prose h2 { font-size: var(--step-1); margin: 2.75rem 0 .8rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.prose h3 { font-size: var(--step-0); margin: 1.75rem 0 .5rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1em; }
.prose li { margin: .35rem 0; }
.prose .note { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--fern); border-radius: 10px; padding: 1rem 1.25rem; margin: 1.5rem 0; }
.prose .note ul { margin-bottom: 0; }
.prose .tc { background: var(--warn-soft); color: var(--warn); border: 1px dashed var(--warn); border-radius: 4px; padding: 0 .3em; font-weight: 600; }
.prose nav.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.4rem; margin: 1.75rem 0; }
.prose nav.toc h2 { margin: 0 0 .5rem; padding: 0; border: 0; font-size: var(--step-0); }
.prose nav.toc ol { margin: 0; columns: 2 16rem; column-gap: 2rem; }
.prose nav.toc li { break-inside: avoid; margin: .2rem 0; }
.prose .table { overflow-x: auto; margin: 1.25rem 0; border: 1px solid var(--line); border-radius: 10px; }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--step--1); min-width: 32rem; background: var(--surface); }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: .6rem .75rem; text-align: left; vertical-align: top; }
.prose th { background: var(--fern-soft); }
.prose tr:last-child td { border-bottom: 0; }
.prose pre { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; font-size: var(--step--1); }

/* Support */
.contact-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 2.5rem; }
.contact-card__email { color: var(--muted); font-size: var(--step--1); margin: 0; }
.doc h2 { font-size: var(--step-1); margin-bottom: 1rem; }
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 1.1rem 2rem 1.1rem 0; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: .25rem; top: .85rem; font-size: 1.4rem; font-weight: 400; color: var(--fern); transition: transform .2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); padding-bottom: 1rem; margin: 0; }
@media (prefers-reduced-motion: reduce) { .faq summary::after { transition: none; } }

/* 404 */
.not-found { text-align: center; padding-block: 5rem 2rem; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.not-found h1 { font-size: var(--step-3); margin-top: 1rem; }
.not-found p { color: var(--muted); }

/* ---------- Garden: the home page's catch-the-dew game ---------- */
.garden { position: relative; width: clamp(180px, 26vw, 300px); user-select: none; -webkit-user-select: none; }
@media (max-width: 40rem) { .garden { width: min(240px, 70vw); } }
.garden__plant { border-radius: 24px; touch-action: manipulation; outline: none; }
.garden__plant:focus-visible { outline: 2px solid var(--fern); outline-offset: 4px; }
.garden, .garden__plant, .dew, .garden__replant { -webkit-tap-highlight-color: transparent; }
.garden--ready .garden__plant { cursor: pointer; }
.garden .mark__stem { stroke-width: 4.2; }
.garden .mark__leaf { stroke-width: 3.4; }
.garden__hint { visibility: hidden; margin: .25rem 0 0; font-size: var(--step--1); color: var(--muted); text-align: center; min-height: 3.2em; }
.garden--ready .garden__hint { visibility: visible; }
.garden__count { font-weight: 600; color: var(--fern); margin-left: .35rem; font-variant-numeric: tabular-nums; }
.garden--done .garden__text { color: var(--ink); font-weight: 600; }
.garden--done .garden__count { display: none; }
.garden__replant {
  display: block; margin: .6rem auto 0; padding: .45rem 1rem; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--fern); background: transparent; color: var(--fern); font: 600 var(--step--1) var(--font);
}
.garden__replant:hover { background: var(--fern-soft); }
.garden--ready .garden__replant[hidden] { display: block; visibility: hidden; }
.garden__replant[hidden] { display: none; }

.dew {
  position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0;
  border: 0; background: transparent; cursor: pointer; touch-action: manipulation;
  animation: dew-in .35s cubic-bezier(.3, 1.6, .5, 1) both, dew-bob 2.4s ease-in-out .35s infinite;
}
.dew::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50% 0 50% 50%; transform: rotate(-45deg);
  background: radial-gradient(circle at 38% 62%, rgb(255 255 255 / .85) 0 16%, var(--dew) 48%);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--dew) 40%, transparent);
}
.dew--fading { transition: opacity .4s ease; opacity: 0; }
.dew--caught { animation: dew-pop .3s ease-out forwards; pointer-events: none; }
@keyframes dew-in { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes dew-bob { 50% { transform: translateY(-4px); } }
@keyframes dew-pop { to { transform: scale(1.8); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .dew { animation: none; }
  .dew--caught { animation: none; opacity: 0; }
}
