/* Kit base: reset, type, the shared controls (k-) and the motion vocabulary. Blocks add their own prefixed classes on top. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
::selection { background: var(--brand); color: var(--on-brand); }
input, button, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--muted); opacity: 1; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
a { color: var(--brand); text-underline-offset: 3px; }
img, video, svg { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
h1 { font-size: var(--t-h1); line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--t-h2); line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: var(--t-h3); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
.k-display { font-size: var(--t-display); line-height: 1.02; font-weight: 700; letter-spacing: -0.03em; }
.k-lead { font-size: var(--t-lead); color: var(--muted); max-width: var(--w-prose); }
.k-muted { color: var(--muted); }
.k-small { font-size: 14px; font-weight: 500; line-height: 1.4; }
.k-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.k-mono { font: 500 13px/1.4 var(--font-mono); }
.k-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* layout */
.k-wrap { max-width: var(--w-content); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.k-narrow { max-width: var(--w-narrow); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.k-section { padding-top: var(--section); padding-bottom: var(--section); }
.k-section-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 32px; max-width: var(--w-prose); }

/* buttons */
.k-btn { min-height: 56px; padding: 0 24px; border: 0; border-radius: var(--radius); background: var(--brand); color: var(--on-brand); font-weight: 600; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-align: center; line-height: 1.2; text-decoration: none; transition: transform .16s var(--ease), box-shadow var(--d) var(--ease), opacity var(--d) ease, background-color var(--d) ease; }
.k-btn.dark { background: var(--ink); color: var(--surface); }
.k-btn.ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--field); }
.k-btn.sm { min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm); font-size: 15px; }
.k-btn:active:not(:disabled) { transform: scale(.98); }
.k-btn:disabled { opacity: .55; cursor: not-allowed; }
.k-btn[aria-busy="true"] { opacity: .85; cursor: progress; }
.k-link { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.k-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: k-rot .7s linear infinite; }

/* chips, stepper, pills */
.k-chip { min-height: 44px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--field); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; transition: background-color var(--d) var(--ease), color var(--d) var(--ease), border-color var(--d) var(--ease); }
.k-chip[aria-pressed="true"], .k-chip[aria-current="true"], .k-chip:has(> input:checked) { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.k-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.k-step { display: inline-flex; align-items: center; gap: 2px; background: var(--ground); border: 1px solid var(--field); border-radius: 999px; padding: 3px; }
.k-step button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; transition: background-color var(--d-fast) ease, transform .12s var(--ease); }
.k-step button:active:not(:disabled) { transform: scale(.92); }
.k-step button:disabled { opacity: .35; cursor: not-allowed; }
.k-step output { min-width: 32px; text-align: center; font-size: 18px; font-weight: 700; }
.k-pill { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 5px 12px; border-radius: 999px; }
.k-pill[data-low] { color: var(--danger); background: var(--danger-soft); }

/* fields */
.k-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.k-field label { font-size: 14px; font-weight: 500; color: var(--muted); }
.k-field input, .k-field select, .k-field textarea { min-height: 48px; min-width: 0; border: 1px solid var(--field); border-radius: var(--radius-sm); padding: 0 14px; font-size: 16px; background: var(--surface); caret-color: var(--brand); transition: border-color var(--d-fast), box-shadow var(--d-fast); }
.k-field textarea { padding: 12px 14px; min-height: 120px; resize: vertical; }
.k-field :is(input, select, textarea):focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.k-field [aria-invalid="true"] { border-color: var(--danger); }
.k-err { font-size: 13px; color: var(--danger); margin: 0; }
.k-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.k-alert { margin: 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 15px; font-weight: 500; }
.k-alert.ok { background: var(--brand-soft); color: var(--brand); }

/* surfaces */
html:has(dialog[open]) { overflow: hidden; scrollbar-gutter: stable; } /* lightboxes and sheets lock the page */
.k-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.k-card.flat { box-shadow: none; border: 1px solid var(--line); }
.k-ph { display: grid; place-items: center; background: var(--placeholder); color: var(--muted); font-weight: 500; font-size: 15px; }
.k-photo { width: 100%; height: 100%; object-fit: cover; background: var(--placeholder); }
.k-mark { position: relative; margin: 10px; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); box-shadow: 0 0 0 10px var(--brand-soft); animation: k-pop .6s var(--ease) backwards; }
.k-mark path { stroke-dasharray: 24; stroke-dashoffset: 0; animation: k-draw .5s .25s var(--ease) backwards; }
.k-mark.warn { background: var(--surface); color: var(--danger); box-shadow: 0 0 0 10px var(--line); }
.k-mark.wait { background: var(--surface); color: var(--brand); box-shadow: 0 0 0 10px var(--line); }
.k-mark.celebrate { animation: k-spring .7s var(--spring) backwards; }
.k-mark.celebrate::before, .k-mark.celebrate::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--brand); opacity: 0; animation: k-ripple 1.2s .25s var(--ease) both; pointer-events: none; }
.k-mark.celebrate::after { animation-delay: .5s; }

/* marquee strip: masked, drifting, paused on hover, static under reduced motion */
.k-marks { overflow: hidden; -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); }
.k-marks-track { display: flex; width: max-content; animation: k-marquee 32s linear infinite; }
.k-marks-set { display: flex; align-items: center; gap: 36px; margin: 0; padding: 4px 18px; list-style: none; color: color-mix(in srgb, var(--ink) 52%, transparent); }

/* entrances: add .k-in, kit.js sets data-in when the element scrolls into view; --i staggers siblings */
.k-in { --i: 0; --k-step: 70ms; opacity: 0; transform: translateY(10px); }
.k-in[data-in] { animation: k-in var(--d-enter) calc(var(--i) * var(--k-step)) var(--ease) both; }
.k-stagger > * { --i: 0; }
.k-stagger > :nth-child(2) { --i: 1; } .k-stagger > :nth-child(3) { --i: 2; } .k-stagger > :nth-child(4) { --i: 3; } .k-stagger > :nth-child(n+5) { --i: 4; }
.tick { animation: k-tick var(--d-tick) var(--ease); }
@media (scripting: none) { .k-in { opacity: 1; transform: none; } } /* no JS: nothing waits for the observer */

@media (hover: hover) and (pointer: fine) {
  .k-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 30%, transparent); }
  .k-btn.ghost:hover:not(:disabled), .k-btn.dark:hover:not(:disabled) { box-shadow: 0 10px 24px color-mix(in srgb, var(--ink) 18%, transparent); }
  .k-chip:hover { border-color: var(--brand); }
  .k-step button:hover:not(:disabled) { background: var(--line); }
  .k-marks:hover .k-marks-track { animation-play-state: paused; }
}

@keyframes k-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes k-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes k-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes k-pop { from { transform: scale(.6); opacity: 0; box-shadow: 0 0 0 0 var(--brand-soft); } }
@keyframes k-draw { from { stroke-dashoffset: 24; } }
@keyframes k-rot { to { transform: rotate(360deg); } }
@keyframes k-spring { from { transform: scale(.4); opacity: 0; } 60% { opacity: 1; } }
@keyframes k-ripple { from { transform: scale(1); opacity: .55; } to { transform: scale(2.6); opacity: 0; } }
@keyframes k-tick { 40% { transform: scale(1.06); } }
@keyframes k-nudge { 40% { transform: scale(1.035); } 70% { transform: scale(.995); } }
@keyframes k-nope { 20% { transform: translateX(-7px) rotate(-4deg); } 40% { transform: translateX(6px) rotate(3deg); } 60% { transform: translateX(-4px) rotate(-2deg); } 80% { transform: translateX(2px); } }
@keyframes k-focus { from { opacity: 0; transform: translateY(8px) scale(.98); filter: blur(8px); } }
@keyframes k-print { from { clip-path: inset(0 0 100% 0 round var(--radius)); transform: translateY(-6px); } to { clip-path: inset(0 0 0 0 round var(--radius)); } }
@keyframes k-drop { from { transform: translateY(-28px) scale(.9); opacity: 0; } }
@keyframes k-marquee { to { transform: translateX(-50%); } }

@media (max-width: 720px) { .k-pair { grid-template-columns: 1fr; } }

/* reduced motion: fades only, spinners stay, no transforms on press */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .k-in { opacity: 1; transform: none; }
  .k-in[data-in] { animation: k-fade .3s ease both; }
  .k-mark, .k-mark.celebrate { animation: k-fade .3s ease both; }
  .k-mark::before, .k-mark::after, .k-mark path, .tick { animation: none !important; }
  .k-marks-track { animation: none; width: auto; }
  .k-marks-set { flex-wrap: wrap; justify-content: center; row-gap: 4px; }
  .k-marks-set[aria-hidden] { display: none; }
  .k-marks { -webkit-mask-image: none; mask-image: none; }
  .k-btn, .k-chip, .k-step button { transition-property: opacity, background-color, border-color, color; }
  .k-btn:active:not(:disabled), .k-step button:active:not(:disabled) { transform: none; }
}
