/* Kitsuvo Plus: the homepage section (after landing.css) and the theme preview on /pricing (after pricing.css).
   BRAND.md applies: system fonts, flat paper tones, line art, no gradients and no glass.
   The theme colours below are copied from src/ui/personal.css and tests/site-landing-plus.test.cjs
   compares them, so the preview never shows a colour the app does not ship.
   Verdict colours appear only on the two illustrated score badges. */

/* ---------- Theme values (src/ui/personal.css, :root[data-theme=...]) ---------- */
.kp-theme-washi { --kp-frame: #ECE5D8; --kp-surface: #F6F1E7; --kp-brand: #D23F1A; --kp-brand-text: #B8331A; --kp-brand-soft: rgb(210 63 26 / .12); }
.kp-theme-autumn { --kp-frame: #EBDDCA; --kp-surface: #FAF0E1; --kp-brand: #A8441D; --kp-brand-text: #963A17; --kp-brand-soft: rgb(168 68 29 / .12); }
.kp-theme-moss { --kp-frame: #DDE3D7; --kp-surface: #F1F5EC; --kp-brand: #38613E; --kp-brand-text: #315638; --kp-brand-soft: rgb(56 97 62 / .12); }
.kp-theme-sakura { --kp-frame: #ECDDE3; --kp-surface: #FCF0F4; --kp-brand: #8C3B61; --kp-brand-text: #7E3457; --kp-brand-soft: rgb(140 59 97 / .12); }

/* ---------- Theme preview: radio inputs re-ink a drawn Kitsuvo window ---------- */
/* The inputs come first in the markup, so the choice reaches the picker and the window through sibling
   selectors. It needs no script, and the keyboard gets native radio behaviour. */
.kp-try { position: relative; display: grid; gap: 14px; min-width: 0; container-type: inline-size; }
.kp-try-label { color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.kp-pick { position: absolute; top: 28px; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.kp-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 4px; border-radius: 14px; background: rgba(28, 26, 23, 0.05); }
.kp-chips label { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; padding: 6px 10px; border-radius: 10px; color: var(--muted); font-size: 0.8125rem; font-weight: 600; line-height: 1.25; cursor: pointer; transition: background-color 0.15s ease, color 0.15s ease; }
.kp-chips small { display: block; font-size: 0.6875rem; font-weight: 500; }
/* The app's swatch: the frame colour with a slanted corner of the brand colour, drawn here as two flat shapes. */
.kp-swatch { position: relative; flex: none; width: 22px; height: 22px; border-radius: 7px; background: var(--kp-frame); box-shadow: inset 0 0 0 1px rgba(28, 26, 23, 0.16); overflow: hidden; }
.kp-swatch i { position: absolute; inset: 0 -6px 0 64%; background: var(--kp-brand); transform: skewX(-18deg); }
#kp-pick-washi:checked ~ .kp-chips label[for="kp-pick-washi"],
#kp-pick-autumn:checked ~ .kp-chips label[for="kp-pick-autumn"],
#kp-pick-moss:checked ~ .kp-chips label[for="kp-pick-moss"],
#kp-pick-sakura:checked ~ .kp-chips label[for="kp-pick-sakura"] { background: var(--card); color: var(--sumi); box-shadow: 0 1px 2px rgba(28, 26, 23, 0.1), 0 4px 12px rgba(28, 26, 23, 0.06); }
#kp-pick-washi:focus-visible ~ .kp-chips label[for="kp-pick-washi"],
#kp-pick-autumn:focus-visible ~ .kp-chips label[for="kp-pick-autumn"],
#kp-pick-moss:focus-visible ~ .kp-chips label[for="kp-pick-moss"],
#kp-pick-sakura:focus-visible ~ .kp-chips label[for="kp-pick-sakura"] { outline: 2px solid var(--vermilion); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .kp-chips label:hover { color: var(--sumi); } }

/* The window is drawn once and laid down four times, one layer per theme. Only opacity changes. */
.kp-stage { border-radius: 2.2% / 3.5%; box-shadow: 0 18px 36px -22px rgba(28, 26, 23, 0.5); }
.kp-window { display: block; width: 100%; height: auto; overflow: visible; }
.kp-layer { opacity: 0; transition: opacity 0.3s var(--ease) 0.1s; }
#kp-pick-washi:checked ~ .kp-stage .kp-layer.kp-theme-washi,
#kp-pick-autumn:checked ~ .kp-stage .kp-layer.kp-theme-autumn,
#kp-pick-moss:checked ~ .kp-stage .kp-layer.kp-theme-moss,
#kp-pick-sakura:checked ~ .kp-stage .kp-layer.kp-theme-sakura { opacity: 1; transition-delay: 0s; }
.kp-w-frame { fill: var(--kp-frame); stroke: rgba(28, 26, 23, 0.18); }
.kp-w-surface { fill: var(--kp-surface); stroke: rgba(28, 26, 23, 0.1); }
.kp-w-brand { fill: var(--kp-brand); }
.kp-w-brand-text { fill: var(--kp-brand-text); }
.kp-w-soft { fill: var(--kp-brand-soft); }
.kp-w-brand-line { fill: none; stroke: var(--kp-brand-text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kp-w-slit { fill: none; stroke: var(--kp-surface); stroke-width: 4.2; stroke-linecap: round; }
.kp-w-on { fill: var(--kp-brand-text); font: 700 8px/1 var(--font); letter-spacing: 0.04em; text-anchor: middle; }
.kp-w-mask-fill { fill: var(--sumi); }
.kp-w-mask-edge { fill: none; stroke: var(--sumi); stroke-width: 3; stroke-linejoin: round; }
.kp-w-chip-mark { fill: var(--muted); }
.kp-w-card, .kp-w-tab { fill: var(--card); stroke: rgba(28, 26, 23, 0.12); }
.kp-w-tab-on { stroke: var(--sumi); stroke-width: 1.5; }
.kp-w-field { fill: var(--card); stroke: rgba(28, 26, 23, 0.32); }
.kp-w-kbd { fill: none; stroke: rgba(28, 26, 23, 0.16); }
.kp-w-cut { fill: var(--card); }
.kp-w-wash { fill: rgba(28, 26, 23, 0.07); }
.kp-w-bar { fill: rgba(28, 26, 23, 0.2); }
.kp-w-bar-ink { fill: var(--sumi); }
.kp-w-rule { fill: none; stroke: rgba(28, 26, 23, 0.1); }
.kp-w-dots { fill: none; stroke: rgba(28, 26, 23, 0.3); stroke-width: 1.5; }
.kp-w-icon { fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kp-w-icon .kp-w-knob { fill: var(--kp-frame); }
.kp-w-text { fill: var(--muted); font: 400 12.5px/1 var(--font); }
.kp-w-ai { fill: var(--ai); }
.kp-w-human { fill: var(--human); }
.kp-w-num { fill: #fff; font: 700 9px/1 var(--font); font-variant-numeric: tabular-nums; text-anchor: middle; }
.kp-try-note { color: var(--muted); font-size: 0.8125rem; line-height: 1.6; text-wrap: pretty; }
.kp-tip-replay { display: inline; min-height: 0; padding: 0; border: 0; background: none; color: var(--sumi); font: inherit; font-weight: 600; text-decoration: underline; text-decoration-color: rgba(28, 26, 23, 0.3); text-underline-offset: 4px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .kp-tip-replay:hover { color: var(--vermilion-ink); text-decoration-color: currentColor; } }
/* A text link in a sentence; on touch screens it becomes a row of its own so it is easy to press. */
@media (pointer: coarse), (max-width: 760px) { .kp-tip-replay { display: flex; align-items: center; min-height: 44px; } }

/* ---------- The one-step tip that introduces the preview (plus-showcase.js) ---------- */
/* It takes its place in the flow under the preview's caption, so it never covers the picker or the drawing
   and the link that reopens it stays where it was pressed. */
.kp-tip { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; padding: 14px 16px; border-radius: 12px; background: var(--card); color: var(--sumi); box-shadow: 0 0 0 1px var(--lp-rule), 0 14px 30px -20px rgba(28, 26, 23, 0.45); text-align: left; opacity: 0; transition: opacity 0.2s var(--ease); }
.kp-tip.is-shown { opacity: 1; }
.kp-tip[hidden] { display: none; } /* display:grid above would otherwise keep the dismissed tip clickable and in the reading order */
.kp-tip:focus { outline: none; }
.kp-tip:focus-visible { box-shadow: 0 0 0 2px var(--vermilion); }
@media (forced-colors: active) { .kp-tip:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; } }
.kp-tip-text { color: var(--muted); font-size: 0.875rem; line-height: 1.55; text-wrap: pretty; }
.kp-tip-text :is(h2, h3), .kp-tip-text p { display: inline; margin: 0; font-family: var(--font); font-size: inherit; line-height: inherit; letter-spacing: 0; }
.kp-tip-text :is(h2, h3) { color: var(--sumi); font-weight: 600; }
.kp-tip-close { min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--sumi); color: var(--card); font: 600 0.8125rem/1 var(--font); white-space: nowrap; cursor: pointer; transition: background-color 0.2s ease, transform 0.12s var(--ease); }
.kp-tip-close:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .kp-tip-close:hover { background: var(--vermilion); } }
/* In a narrow preview the four themes sit two by two and the tip's button drops under its text. */
@container (max-width: 560px) { .kp-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 400px) {
  .kp-tip { grid-template-columns: minmax(0, 1fr); }
  .kp-tip-close { justify-self: start; }
}
.kp-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Free and Plus, as a ledger ---------- */
.kp-ledger { width: 100%; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.4; }
.kp-ledger caption { padding-bottom: 12px; color: var(--muted); font-size: 0.8125rem; text-align: left; }
.kp-ledger th, .kp-ledger td { padding: 12px 0; border-top: 1px solid var(--lp-rule); text-align: left; vertical-align: baseline; }
.kp-ledger thead th { padding: 0 0 8px; border-top: 0; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.kp-ledger th[scope="row"] { padding-right: 12px; font-weight: 400; }
.kp-ledger td { width: 27%; padding-left: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kp-ledger thead th + th { padding-left: 12px; }
.kp-ledger td:last-child { color: var(--sumi); }
.kp-ledger td b { display: block; color: var(--sumi); font: 600 1.5rem/1.1 var(--font-display); letter-spacing: -0.02em; }
.kp-ledger td:first-of-type b { color: var(--muted); }

/* ---------- Homepage section ---------- */
.kp-show { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); margin-top: clamp(40px, 6vw, 72px); border-radius: 14px; box-shadow: 0 0 0 1px var(--lp-rule); overflow: hidden; }
.kp-show-try { padding: clamp(18px, 2.6vw, 28px); background: var(--washi); }
.kp-show-facts { display: flex; flex-direction: column; padding: clamp(22px, 3vw, 32px); border-left: 1px solid var(--lp-rule); }
.kp-price { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--lp-rule); color: var(--muted); font-size: 0.9375rem; line-height: 1.5; text-wrap: pretty; }
.kp-price b { color: var(--sumi); font: 600 1.5rem/1.1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kp-avail { margin-top: 8px; color: var(--muted); font-size: 0.8125rem; line-height: 1.6; text-wrap: pretty; }
.kp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; margin-top: auto; padding-top: 20px; }
/* Compare plans opens the pricing dialog, which needs main.js; without script the link beside it does the job. */
.kp-open { display: none; padding: 0; border: 0; background: none; font-family: inherit; cursor: pointer; }
.js .kp-open { display: inline-flex; }
@media (max-width: 900px) {
  .kp-show { grid-template-columns: minmax(0, 1fr); }
  .kp-show-facts { border-left: 0; border-top: 1px solid var(--lp-rule); }
}
@media (max-width: 520px) {
  .kp-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kp-show-try { padding: 14px; }
  .kp-show-facts { padding: 20px 16px; }
}

/* ---------- /pricing: the same preview, inside the pricing page's own layout (site/pricing.css) ---------- */
/* The pricing page does not load landing.css, so the rule colour and the reduced-motion reset are restated here. */
.pricing-try { --lp-rule: rgba(28, 26, 23, 0.1); }
/* As wide as the column allows, but never so tall that the picker and the window cannot share a short screen. */
.pricing-try .kp-try { width: min(760px, 100%, max(420px, (100vh - 320px) * 1.6)); margin-top: 28px; }
@media (prefers-reduced-motion: reduce) { .pricing-try .kp-try * { transition-duration: 0s !important; transition-delay: 0s !important; } }
@media (max-width: 760px) {
  .kp-ledger { font-size: 0.875rem; }
  .kp-ledger td { width: 30%; }
}
@media print { .kp-tip, .kp-tip-replay { display: none !important; } }
