/* Nectary: botanical bento system on a 12-column grid.
   Six colors, all declared on :root. Hue is about 138 degrees throughout. */

:root {
  --paper: #EAF4ED;
  --tile: #D3E8D9;
  --ink: #0F2A17;
  --moss: #3A6146;
  --leaf: #1B6B33;
  --sprout: #8CD9A4;

  --font: -apple-system, "Helvetica Neue", Arial, sans-serif;
  --gutter: 16px;
  --max: 1200px;
  --rule: 2px;
  --gap: clamp(12px, 2vw, 20px);
  --pad: clamp(18px, 2.4vw, 32px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0 0 0.5em;
  font-family: var(--font);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(2.25rem, 1.4rem + 3.8vw, 4.5rem);
}

h2 {
  font-size: clamp(1.5rem, 1.15rem + 1.5vw, 2.25rem);
}

h3 {
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  letter-spacing: -0.01em;
}

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

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--leaf);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--ink);
}

ul,
ol {
  margin: 0;
  padding-left: 1.25em;
}

li + li {
  margin-top: 0.5em;
}

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

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

/* Skip link: hidden until it receives keyboard focus */
.skip-link {
  position: absolute;
  top: 0;
  left: var(--gutter);
  z-index: 100;
  padding: 12px 16px;
  background-color: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(12px);
}

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

@media (min-width: 900px) {
  .wrap {
    padding-inline: 32px;
  }
}

/* Header and navigation */

.site-header {
  border-bottom: var(--rule) solid var(--ink);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
}

.brand-mark .petal {
  fill: var(--sprout);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.brand-mark .core {
  fill: var(--leaf);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  padding: 0;
  list-style: none;
}

.nav li {
  margin: 0;
}

.nav li + li {
  margin-top: 0;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.nav a:hover,
.nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

/* Bento grid */

main {
  padding-block: clamp(28px, 4vw, 56px) clamp(56px, 7vw, 104px);
}

.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
  align-items: stretch;
}

.bento > * {
  min-width: 0;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

@media (max-width: 960px) {
  .bento .span-4,
  .bento .span-5,
  .bento .span-7,
  .bento .span-8 {
    grid-column: span 12;
  }
}

@media (max-width: 680px) {
  .bento > [class*="span-"] {
    grid-column: 1 / -1;
  }
}

/* Tiles: flat fills, hairline ink borders, no shadows or gradients */

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: var(--pad);
  background-color: var(--tile);
  border: var(--rule) solid var(--ink);
}

.tile-ink {
  background-color: var(--ink);
  color: var(--paper);
}

.tile-ink h2,
.tile-ink h3 {
  color: var(--paper);
}

.tile-ink a {
  color: var(--sprout);
}

.tile-ink a:hover {
  color: var(--paper);
}

.tile-ink .eyebrow {
  color: var(--sprout);
}

.tile-ink :focus-visible {
  outline-color: var(--sprout);
}

.tile-ink .steps li::before {
  color: var(--sprout);
}

.tile-ink .btn {
  background-color: var(--sprout);
  border-color: var(--sprout);
  color: var(--ink);
}

.tile-ink .btn:hover {
  background-color: var(--paper);
  border-color: var(--paper);
  color: var(--ink);
}

.tile-foot {
  margin-top: auto;
}

.eyebrow {
  margin: 0;
  color: var(--moss);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lede {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.375rem);
  font-weight: 500;
}

.formula {
  margin: 0;
  max-width: none;
  padding: 14px 16px;
  border: var(--rule) solid var(--ink);
  background-color: var(--paper);
  font-size: 1.125rem;
  font-weight: 800;
}

.status {
  margin: auto 0 0;
  max-width: none;
  padding: 14px 16px;
  border: var(--rule) solid var(--ink);
  background-color: var(--paper);
  font-weight: 600;
}

/* Buttons and links */

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border: var(--rule) solid var(--ink);
  background-color: var(--leaf);
  color: var(--paper);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

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

.btn-outline {
  background-color: var(--paper);
  color: var(--ink);
}

.btn-outline:hover {
  background-color: var(--ink);
  color: var(--paper);
}

/* Figures and inline SVG art */

.figure {
  margin: 0;
  display: grid;
  gap: 10px;
}

.figure figcaption {
  color: var(--moss);
  font-size: 0.9375rem;
}

.tile-ink .figure figcaption {
  color: var(--paper);
}

.sprout-art {
  width: 100%;
  max-width: 340px;
  margin-inline: auto;
}

.sprout-art .ground {
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: round;
}

.sprout-art .stem {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linecap: round;
}

.sprout-art .leaf {
  fill: var(--sprout);
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linejoin: round;
}

.sprout-art .bud {
  fill: var(--leaf);
  stroke: var(--ink);
  stroke-width: 3;
}

.seed-art {
  width: 100%;
  max-width: 260px;
  margin-inline: auto;
}

.seed-art .seed {
  fill: var(--leaf);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.seed-art .flower-core {
  fill: var(--sprout);
  stroke: var(--ink);
  stroke-width: 2;
}

.bars {
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
}

.bars .bar {
  fill: var(--leaf);
  stroke: var(--ink);
  stroke-width: 2;
}

.bars .bar-last {
  fill: var(--sprout);
}

.bars .base {
  stroke: var(--ink);
  stroke-width: 3;
}

.bars .label {
  fill: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
}

/* Lists */

.steps {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
  counter-increment: step;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  color: var(--leaf);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
}

.toc {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc li {
  margin: 0;
  border-bottom: 1px solid var(--ink);
}

.toc a {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.tile-ink .toc li,
.tile-ink .toc a {
  color: var(--paper);
}

.terms {
  display: grid;
  gap: 16px;
  margin: 0;
}

.terms > div {
  padding-top: 12px;
  border-top: 1px solid var(--ink);
}

.terms dt {
  font-weight: 800;
}

.terms dd {
  margin: 4px 0 0;
}

@media (min-width: 680px) {
  .terms {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 32px;
  }
}

/* Calculator controls */

.calc-form {
  display: grid;
  gap: 24px;
  margin: 0;
}

.field {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.field-label {
  font-size: 1.0625rem;
  font-weight: 800;
}

.pair {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr);
  gap: 12px;
  align-items: center;
}

.num {
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: var(--rule) solid var(--ink);
  border-radius: 0;
  background-color: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.slider {
  width: 100%;
  min-height: 44px;
  margin: 0;
  accent-color: var(--leaf);
}

.field-help {
  margin: 0;
  max-width: none;
  color: var(--moss);
  font-size: 0.9375rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.note {
  margin: 0;
  max-width: none;
  padding: 12px 14px;
  border-left: 4px solid var(--ink);
  background-color: var(--paper);
}

.results {
  display: grid;
  gap: 14px;
  margin: 0;
}

.results > div {
  padding-top: 12px;
  border-top: var(--rule) solid var(--ink);
}

.results dt {
  color: var(--moss);
  font-size: 0.875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.results dd {
  margin: 4px 0 0;
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Chart: drawn in a 600 x 320 viewBox so labels scale on small screens */

.chart-figure {
  margin: 0;
  display: grid;
  gap: 12px;
}

.chart {
  width: 100%;
  max-width: 600px;
  margin-inline: auto;
  border: var(--rule) solid var(--ink);
  background-color: var(--paper);
}

.chart .grid-line {
  stroke: var(--moss);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.chart .axis {
  stroke: var(--ink);
  stroke-width: 2.5;
}

.chart .tick {
  fill: var(--ink);
  font-family: var(--font);
  font-size: 20px;
  font-weight: 600;
}

.chart .area {
  fill: var(--sprout);
}

.chart .line-value {
  fill: none;
  stroke: var(--leaf);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart .line-contrib {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 10 8;
}

.chart .dot {
  fill: var(--leaf);
  stroke: var(--ink);
  stroke-width: 3;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 600;
}

.legend li + li {
  margin-top: 0;
}

.swatch {
  display: inline-block;
  width: 32px;
  border-top: 5px solid var(--leaf);
}

.swatch-contrib {
  border-top: 3px dashed var(--ink);
}

/* Data table */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.data-table caption {
  caption-side: top;
  padding-bottom: 12px;
  text-align: left;
  color: var(--moss);
}

.data-table th,
.data-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--ink);
  text-align: right;
}

.data-table thead th {
  border-bottom: var(--rule) solid var(--ink);
  font-weight: 800;
}

.data-table th[scope="row"] {
  text-align: left;
  font-weight: 700;
}

/* Footer */

.site-footer {
  border-top: var(--rule) solid var(--ink);
  padding-block: 24px 40px;
}

.footer-inner {
  display: grid;
  gap: 8px;
  font-size: 0.9375rem;
}

.footer-inner p {
  margin: 0;
  max-width: none;
}

/* Motion: the only animation is the sprout growing in. It runs only when
   the visitor has not asked for reduced motion; otherwise the drawing is static. */

@media (prefers-reduced-motion: no-preference) {
  .sprout-art .stem {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: grow-stem 1.6s ease-out forwards;
  }

  .sprout-art .leaf {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: unfurl 1.1s ease-out 1.2s both;
  }

  .sprout-art .leaf-b {
    animation-delay: 1.7s;
  }

  .sprout-art .bud {
    transform-box: fill-box;
    transform-origin: 50% 50%;
    animation: unfurl 0.8s ease-out 2.4s both;
  }
}

@keyframes grow-stem {
  from {
    stroke-dashoffset: 100;
  }

  to {
    stroke-dashoffset: 0;
  }
}

@keyframes unfurl {
  from {
    transform: scale(0);
  }

  to {
    transform: scale(1);
  }
}

/* Reduced motion: the sprout is drawn in its final, static state and nothing animates. */
@media (prefers-reduced-motion: reduce) {
  .sprout-art .stem {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
    animation: none;
  }

  .sprout-art .leaf,
  .sprout-art .leaf-b,
  .sprout-art .bud {
    animation: none;
  }
}
