/* Pimlo warm working field guide — storefront. Mobile-first, reduced-motion aware.
   Canonical semantic tokens live ONLY in this :root block (single source; the
   native server serves just 7 legacy filenames, so tokens ride in styles.css
   and studio.css imports this file). Components consume var(). No page overflow. */
:root {
  --bg: #FFF8EC;
  --field: #FFFDF6;
  --ink: #23202B;
  --leaf: #2FA97C;
  --leaf-deep: #1F7A57;
  --leaf-ink: #123F2E;
  --sun: #FFC53D;
  --sun-soft: #FFE9B8;
  --berry: #E4575B;
  --sky: #7FB5F2;
  --card: #FFFFFF;
  --line: #E6E2D3;
  --muted: #5A6285;
  --ok: #1C7A3D;
  --warn: #9A4A00;
  /* Tonal washes derived from tokens (translucency, no new hues) */
  --wash-leaf: rgba(47, 169, 124, 0.12);
  --wash-sun: rgba(255, 197, 61, 0.22);
  --wash-berry: rgba(228, 87, 91, 0.10);
  --wash-sky: rgba(127, 181, 242, 0.18);
  /* Layered physical elevation: ink-tinted offsets, never colored glow */
  --raise-1: 0 1px 0 rgba(35, 32, 43, 0.06), 0 2px 8px rgba(35, 32, 43, 0.07);
  --raise-2: 0 1px 0 rgba(35, 32, 43, 0.08), 0 10px 24px rgba(35, 32, 43, 0.12);
  --raise-3: 0 2px 0 rgba(35, 32, 43, 0.10), 0 24px 48px rgba(35, 32, 43, 0.16);
  /* R6 flare glow: translucent leaf wash for active cards and Pip aura */
  --glow-leaf: 0 4px 20px -2px rgba(47, 169, 124, 0.15);
  --aura-leaf: 0 0 24px 4px rgba(47, 169, 124, 0.22);
  /* 8px rhythm */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 48px;
  --s6: 64px;
  /* Type roles */
  --font-display: "Nunito", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Nunito Sans", sans-serif;
  --font-tech: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  overflow-x: clip;
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; display: block; }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 20;
  background: var(--ink); color: var(--bg); font-weight: 700;
  padding: 10px 16px; border-radius: 10px; min-height: 44px;
  display: inline-flex; align-items: center; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---- top strip ---- */
header.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--ink);
}
nav {
  max-width: 1120px; margin: 0 auto;
  display: flex; gap: var(--s1); align-items: center;
  padding: 12px var(--s2); flex-wrap: wrap;
}
nav a {
  color: var(--ink); text-decoration: none; font-weight: 600;
  padding: 8px 12px; border-radius: 999px;
  min-height: 44px; display: inline-flex; align-items: center;
}
nav a:hover { background: var(--wash-leaf); }
nav a.brand { color: var(--ink); font-weight: 800; font-family: var(--font-display); font-size: 1.2rem; }
nav a.brand img { width: 28px; height: 28px; margin-right: 8px; }
nav a.nav-cta {
  background: var(--leaf); color: var(--leaf-ink); font-weight: 800;
  box-shadow: var(--raise-1);
}
nav a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible,
a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--sky); outline-offset: 2px;
}

main { max-width: 1120px; margin: 0 auto; padding: var(--s2); min-width: 0; }

/* ---- shared editorial bits ---- */
.eyebrow {
  font-family: var(--font-tech); font-size: 12px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--leaf-ink); margin: 0 0 var(--s1);
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.01em; }
h2 { font-size: clamp(28px, 3.4vw, 40px); margin: 0 0 var(--s2); }
section { scroll-margin-top: 88px; }

/* ---- hero: unboxed editorial + working-kit vignette ---- */
.hero { padding: var(--s5) 0 var(--s4); position: relative; border-bottom: 1px solid var(--line); }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(180deg, var(--wash-leaf) 0%, transparent 42%), radial-gradient(560px 260px at 12% 8%, var(--wash-sun) 0%, transparent 70%);
}
.hero-grid {
  display: grid; gap: var(--s4); grid-template-columns: 1fr;
  align-items: center; position: relative; z-index: 1;
}
.hero-copy {
  background: var(--field); border: 1px solid var(--line); border-radius: var(--s3);
  box-shadow: var(--raise-1); padding: var(--s3); min-width: 0;
}
.hero-copy h1 { font-size: clamp(40px, 5.6vw, 56px); font-weight: 800; margin: 0 0 var(--s2); max-width: 14ch; }
.lede { font-size: 20px; line-height: 1.6; max-width: 58ch; margin: 0 0 var(--s3); }
.hero-actions { margin: 0 0 var(--s1); }
.hero-note { font-size: 15px; color: var(--muted); margin: 0 0 var(--s2); }

/* explorer: working sample device (values computed by panel-motion.js) */
.kit { margin: 0; min-width: 0; display: grid; gap: var(--s2); align-content: start; }
.explorer {
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--s3);
  box-shadow: var(--raise-3);
  padding: var(--s3); position: relative; overflow: clip; isolation: isolate;
}
.explorer::before {
  content: ""; position: absolute; top: -32px; right: -32px; width: 150px; height: 120px;
  background-image: radial-gradient(var(--leaf) 1.6px, transparent 1.7px);
  background-size: 14px 14px; opacity: 0.3; z-index: 0;
}
.explorer::after {
  content: ""; position: absolute; inset: 0; transform: translate(10px, 10px);
  background: var(--wash-sun); border: 1px solid var(--line); border-radius: var(--s3);
  z-index: -1;
}
.explorer > * { position: relative; z-index: 1; }
.explorer-kicker {
  font-family: var(--font-tech); font-size: 12px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--leaf-deep); margin: 0 0 var(--s1);
}
.case-tabs { display: flex; gap: var(--s1); flex-wrap: wrap; margin: 0 0 var(--s2); }
.case-tabs button {
  border: 2px solid var(--ink); background: var(--field); color: var(--ink);
  border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 15px;
  cursor: pointer; min-height: 44px; box-shadow: var(--raise-1);
  transition: transform 160ms ease-out, box-shadow 160ms ease-out, background 160ms ease-out;
}
.case-tabs button:hover { transform: translateY(-1px); box-shadow: var(--raise-2); }
.case-tabs button[aria-pressed="true"] { background: var(--leaf); color: var(--leaf-ink); box-shadow: var(--raise-2); }
.case-card {
  background: var(--field); border: 1px solid var(--line); border-left: 6px solid var(--leaf);
  border-radius: 12px; padding: var(--s2); margin: 0 0 var(--s1);
}
.case-amount {
  font-family: var(--font-tech); font-variant-numeric: tabular-nums;
  font-size: clamp(28px, 3.4vw, 36px); font-weight: 700; margin: 0 0 4px;
}
.case-why { font-size: 15px; margin: 0; max-width: 52ch; }
.case-losses {
  background: var(--wash-sun); border: 2px solid var(--warn); border-radius: 12px;
  padding: 10px 12px; font-size: 14px; margin: 0 0 var(--s1);
  font-family: var(--font-tech);
}
.case-assume {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin: 0 0 var(--s2); background: var(--card);
}
.case-assume p { font-size: 14px; margin: 8px 0 0; }
.pip-side {
  display: grid; grid-template-columns: auto 1fr; gap: var(--s2); align-items: center;
  background: var(--wash-leaf); border: 1px solid var(--leaf-deep); border-radius: var(--s2);
  padding: 12px var(--s2); box-shadow: var(--raise-1);
}
.mascot-side { width: 72px; max-width: 24vw; }
.pip-side p { font-size: 14px; margin: 0; }

/* truth shelf keeps the full preview disclosure immediately after the hero */
.truth-shelf { border-left: 6px solid var(--sun); }

/* (explorer device styles live with the hero block above) */

/* ---- lower-page rhythm: shelves + workbench ---- */
.shelf {
  background: var(--card);
  border: 1px solid var(--line); border-radius: var(--s3);
  box-shadow: var(--raise-1);
  padding: var(--s4); margin: 0 0 var(--s4); min-width: 0;
  overflow-wrap: anywhere;
}
.shelf.narrow { max-width: 760px; }
/* R4 section rhythm: storefront + demo are the only full-bleed stages;
   library/comparison/details are wide cards; preview-truth/pricing/faq/support
   are narrow shelves (preview-truth keeps its sun truth-bar). */
#library, #comparison, #details { max-width: 1120px; }
#preview-truth, #pricing, #faq, #support { max-width: 760px; }
.product-rows { list-style: none; margin: 0 0 var(--s2); padding: 0; display: grid; gap: var(--s1); }
.product-rows li {
  background: var(--field); border: 1px solid var(--line); border-left: 6px solid var(--leaf);
  border-radius: 12px; padding: 12px var(--s2);
}
.compare .table-scroll { border-width: 2px; }

/* workbench: inset instrument panel */
.workbench {
  background: var(--leaf-ink); color: var(--bg);
  border: 2px solid var(--ink); border-radius: var(--s3);
  box-shadow: var(--raise-3);
  padding: var(--s4); margin: 0 0 var(--s4); min-width: 0;
}
.workbench .eyebrow { color: var(--sun); }
.workbench h2 { color: var(--bg); }
.bench-head { display: flex; gap: var(--s2); align-items: center; justify-content: space-between; }
.mascot-mini {
  width: 96px; max-width: 30vw; flex: none;
  background: var(--bg); border: 2px solid var(--ink); border-radius: var(--s2);
  box-shadow: var(--raise-2); padding: 4px;
}
.bench-grid { display: grid; gap: var(--s3); grid-template-columns: 1fr; margin-top: var(--s2); }
.bench-inputs {
  background: var(--field); color: var(--ink);
  border: 2px dashed var(--leaf-deep); border-radius: var(--s2);
  padding: var(--s2); margin: 0; max-width: 100%;
}
.bench-inputs legend { font-weight: 800; font-family: var(--font-display); padding: 0 8px; }
.field { margin-bottom: 4px; }
.bench-results { display: grid; gap: var(--s2); align-content: start; min-width: 0; }
.bench-actions { display: flex; gap: var(--s1); flex-wrap: wrap; }

/* ---- components ---- */
.badge {
  display: inline-block; font-size: 13px; font-weight: 700;
  background: var(--wash-leaf); color: var(--leaf-ink);
  border: 1px solid var(--leaf-deep);
  border-radius: 999px; padding: 4px 12px; margin: 3px 4px 3px 0;
}
.badge.dev { background: var(--wash-sun); border-color: var(--warn); color: var(--warn); }
.table-scroll {
  overflow-x: auto; max-width: 100%;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card);
}
.workbench .table-scroll { border-color: var(--leaf-deep); background: var(--card); }
.workbench table { color: var(--ink); }
.workbench thead th { color: var(--leaf-ink); }
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 34rem; }
th, td { border: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
thead th {
  background: var(--wash-leaf); font-family: var(--font-display);
}
td, .mono, #cell-positive, #cell-downside, #cell-breakeven {
  font-variant-numeric: tabular-nums; font-family: var(--font-tech); font-size: 14px;
}
td:first-child { font-family: var(--font-ui); font-size: 15px; }
code.pill {
  background: var(--ink); color: var(--bg);
  padding: 5px 12px; border-radius: 8px; letter-spacing: 0.08em;
  overflow-wrap: anywhere; font-family: var(--font-tech);
}
.referral {
  border: 2px dashed var(--leaf-deep); border-radius: var(--s2);
  padding: var(--s2); background: var(--wash-leaf);
}
.disclosure { font-size: 15px; color: var(--muted); max-width: 72ch; }
.workbench .disclosure { color: var(--bg); opacity: 0.85; }
a { color: var(--leaf-deep); }
/* WCAG 2.2 2.5.8: inline content links also offer a 44x44px target.
   Vertical padding reaches 44px; negative margin preserves paragraph rhythm. */
.shelf p a:not(.btn), .referral p a:not(.btn), footer p a:not(.btn) {
  display: inline-block; min-height: 44px; min-width: 44px;
  padding: 10px 2px; margin: -10px 0; line-height: 1.55;
}
.workbench a { color: var(--sun); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); background: var(--leaf); color: var(--leaf-ink);
  border-radius: 12px; padding: 10px 20px; font-weight: 800; font-size: 16px;
  cursor: pointer; text-decoration: none;
  min-height: 44px; min-width: 44px;
  box-shadow: var(--raise-2);
  transition: transform 160ms ease-out, box-shadow 160ms ease-out;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--raise-3); }
.btn:active { transform: translateY(0) scale(0.99); box-shadow: var(--raise-1); }
.btn.ghost { background: var(--card); color: var(--leaf-ink); box-shadow: var(--raise-1); }
.workbench .btn.ghost { background: transparent; color: var(--bg); border-color: var(--bg); }
button { min-height: 44px; min-width: 44px; font-size: 16px; font-family: inherit; }
label { display: block; margin: 10px 0 4px; font-weight: 600; }
input, select {
  width: 100%; max-width: 22rem; padding: 10px;
  border: 2px solid var(--line); border-radius: 10px; font-size: 16px;
  min-height: 44px; background: var(--card); color: var(--ink); font-family: inherit;
}
input:focus, select:focus { border-color: var(--leaf-deep); }
fieldset { border: 1px solid var(--line); border-radius: 12px; max-width: 100%; }
legend { font-weight: 700; padding: 0 8px; }
#demo-output {
  border-left: 6px solid var(--leaf); background: var(--field); color: var(--ink);
  border-radius: 8px; padding: 12px; margin: 0;
  font-size: 15px; box-shadow: var(--raise-1);
}
#cell-downside { color: var(--berry); font-weight: 700; }
.stale-banner {
  background: var(--wash-sun); border: 2px solid var(--warn); color: var(--ink);
  border-radius: 12px; padding: 12px; margin: 12px 0;
}
#storage-error {
  background: var(--wash-berry); border: 2px solid var(--berry); color: var(--ink);
  border-radius: 12px; padding: 12px; margin: 12px 0;
}
#scenario-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#scenario-list li {
  background: var(--field); color: var(--ink);
  border: 1px solid var(--leaf-deep); border-radius: 10px; padding: 8px 12px;
}
#scenario-list button {
  border: 1.5px solid var(--leaf-deep); background: var(--card); color: var(--leaf-ink);
  border-radius: 8px; padding: 6px 10px; margin: 2px 4px 2px 0; cursor: pointer;
  font-weight: 600; min-height: 44px;
}
#scenario-list button:hover {
  background: var(--wash-leaf); color: var(--leaf-ink); border-color: var(--leaf-ink);
}
details {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px var(--s2); margin: 0 0 var(--s1); background: var(--field);
}
summary { font-weight: 700; font-family: var(--font-display); cursor: pointer; min-height: 44px; }
.demo-grid { display: grid; gap: 12px; grid-template-columns: auto 1fr; align-items: start; }
.grid { display: grid; gap: var(--s2); grid-template-columns: 1fr; }
footer { max-width: 1120px; margin: 0 auto; padding: var(--s4) var(--s2); color: var(--muted); font-size: 15px; }
footer nav { padding: 0 0 12px; gap: 4px; }
footer nav a { color: var(--leaf-deep); font-size: 15px; }

/* ---- staged-entry defaults (JS enhances; no-JS shows everything) ---- */
[data-reveal] { opacity: 1; }
.js-reveal [data-reveal] { opacity: 0; }
.js-reveal [data-reveal].revealed { opacity: 1; }

/* ---- responsive ---- */
@media (min-width: 960px) {
  .hero-grid { grid-template-columns: 1.05fr 0.95fr; align-items: stretch; }
  .hero-copy, .kit { min-width: 0; }
  .bench-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}
@media (max-width: 959px) {
  .hero-copy { padding: var(--s2); border-radius: var(--s2); }
}
@media (min-width: 760px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 390px) {
  main { padding: 10px; }
  table { font-size: 14px; }
  .hero { padding: var(--s3) 0; }
  .shelf, .workbench { padding: var(--s2); border-radius: var(--s2); }
  .kit { grid-template-columns: 1fr; }
  .bench-head { align-items: start; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js-reveal [data-reveal] { opacity: 1; }
}

/* Contrast preservation (lead at-rest axe: .nav-cta + hero CTA were SERIOUS).
   Ink text on leaf-filled primaries holds >=4.5:1; ghost/outline buttons keep
   their own more-specific rules below/above and are untouched. */
nav a.nav-cta, .btn, .case-tabs button[aria-pressed="true"] { color: var(--ink); }

/* R5: section-header balance, card elevation, comparison scannability, trust emphasis, Pip accents */
.shelf h2 { max-width: 24ch; text-wrap: balance; }
.product-rows li { box-shadow: var(--raise-1); }
.product-rows li strong { font-family: var(--font-display); }
.compare .table-scroll { border: 2px solid var(--ink); box-shadow: var(--raise-2); }
.compare thead th { white-space: nowrap; }
.compare td:first-child { font-weight: 700; }
.compare tbody tr:nth-child(even) td { background: var(--field); }
.compare td:last-child { font-family: var(--font-ui); font-weight: 700; background: var(--wash-sun); }
.compare td:first-child, .compare th:first-child { position: sticky; left: 0; }
.compare tbody td:first-child { background: var(--card); }
.compare tbody tr:nth-child(even) td:first-child { background: var(--field); }
.compare thead th:first-child { background: var(--wash-leaf); }
.compare .disclosure { border-left: 6px solid var(--sun); background: var(--field); color: var(--ink); border-radius: 8px; padding: 12px; }
.referral .disclosure { color: var(--ink); }
#referral-disclosure { border-left: 6px solid var(--sun); padding-left: 12px; }
.stale-banner { border-left: 6px solid var(--warn); }
.pip-tag { width: 32px; height: auto; flex: none; border: 2px solid var(--ink); border-radius: 50%; background: var(--field); box-shadow: var(--raise-1); }
.pip-line { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--leaf-ink); background: var(--wash-leaf); border: 1px solid var(--leaf-deep); border-radius: 999px; padding: 6px 12px 6px 6px; max-width: max-content; margin: 0 0 var(--s2); }

/* R6 flare: animated Pip companion, plug-and-play presets, positive-first KPIs */
@keyframes pip-float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0); }
}
@keyframes pip-glow {
  0% { box-shadow: var(--raise-1); }
  50% { box-shadow: var(--aura-leaf); }
  100% { box-shadow: var(--raise-1); }
}
.mascot-side, .mascot-mini, img[src*="mascot"] {
  animation: pip-float 5s ease-in-out infinite, pip-glow 5s ease-in-out infinite;
  transform-origin: center bottom;
}
.mascot-side:hover, .mascot-mini:hover, img[src*="mascot"]:hover {
  animation-play-state: paused;
  transform: translateY(-4px) scale(1.03);
  box-shadow: var(--aura-leaf);
}
.mascot-side:active, .mascot-mini:active, img[src*="mascot"]:active {
  transform: translateY(0) scale(0.98);
}
.demo-presets {
  display: flex; gap: var(--s1); flex-wrap: wrap; align-items: center;
  grid-column: 1 / -1; margin: 0;
}
.presets-label { width: 100%; margin: 0; font-weight: 700; color: var(--sun); }
.btn.preset {
  border-radius: 999px;
  transition: transform 160ms ease-out, box-shadow 160ms ease-out, background 160ms ease-out;
}
.btn.preset:hover { transform: translateY(-2px); box-shadow: var(--raise-2); }
.btn.preset.is-active {
  background: var(--leaf); color: var(--ink);
  box-shadow: var(--glow-leaf), var(--raise-2);
  border-color: var(--ink);
}
.kpi-row {
  display: grid; gap: var(--s1); grid-template-columns: 1fr;
  margin: 0;
}
.kpi-card {
  background: var(--field); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px var(--s2); box-shadow: var(--raise-1);
  transition: transform 160ms ease-out, box-shadow 160ms ease-out;
}
.kpi-card:hover { transform: translateY(-1px); box-shadow: var(--raise-2); }
.kpi-card.kpi-hero {
  border: 2px solid var(--leaf-deep);
  box-shadow: var(--glow-leaf), var(--raise-2);
}
.kpi-label { font-size: 13px; font-weight: 700; margin: 0 0 4px; color: var(--leaf-ink); }
.kpi-value {
  font-family: var(--font-tech); font-variant-numeric: tabular-nums;
  font-size: clamp(20px, 2.6vw, 26px); font-weight: 800; margin: 0;
}
.kpi-hero .kpi-value { color: var(--ok); }
#scenario-list li { transition: transform 160ms ease-out, box-shadow 160ms ease-out; }
#scenario-list li:hover { transform: translateY(-1px); box-shadow: var(--raise-2); }
#demo-table tbody tr { transition: background 160ms ease-out; }
@media (min-width: 760px) {
  .kpi-row { grid-template-columns: 1.2fr 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .mascot-side, .mascot-mini, img[src*="mascot"] { animation: none; }
}
