/* kit.css — vetted primitives. Uses tokens.css only; contains no colours of its own.
   Do not edit this file. Put app-specific and direction-specific styling in styles.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font: var(--text-md)/var(--leading) var(--font-body);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: var(--weight-display);
  letter-spacing: var(--tracking-display); line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: var(--text-2xl); } h2 { font-size: var(--text-xl); } h3 { font-size: var(--text-lg); }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 0.2em; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--accent-contrast); }
[hidden] { display: none !important; }

/* layout */
.container { width: min(100% - 2 * var(--space-4), var(--container)); margin-inline: auto; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-s { gap: var(--space-2); } .stack-l { gap: var(--space-6); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row-between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--text-muted); }
.label { font-size: var(--text-xs); color: var(--text-muted); text-transform: var(--case-label);
  letter-spacing: var(--tracking-label); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-4);
  border: var(--border-w) solid var(--border); border-radius: var(--radius-m);
  background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none;
  cursor: pointer; user-select: none; touch-action: manipulation;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast), box-shadow var(--dur-fast), opacity var(--dur-fast);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); box-shadow: var(--shadow-press); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); border-color: transparent; }
.btn-primary:hover { background: color-mix(in oklab, var(--accent) 88%, var(--text)); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-l { min-height: 56px; font-size: var(--text-lg); padding: 0 var(--space-5); }

/* forms */
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: var(--space-2) var(--space-3);
  background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-m);
  font-size: max(16px, var(--text-md)); /* 16px+ stops iOS zoom */
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); opacity: 1; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--focus) 30%, transparent); }
.field-error { color: var(--danger); font-size: var(--text-sm); }
.check { width: 24px; height: 24px; accent-color: var(--accent); }

/* surfaces */
.card { background: var(--surface); border: var(--border-w) solid var(--border);
  border-radius: var(--radius-l); padding: var(--space-4); box-shadow: var(--shadow); }
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: var(--space-3); min-height: 52px;
  padding: var(--space-2) 0; border-bottom: var(--border-w) solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2);
  border-radius: var(--radius-s); background: var(--surface-2); font-size: var(--text-xs); font-weight: 600; }
.badge-accent { background: var(--accent); color: var(--accent-contrast); }
.divider { border: 0; border-top: var(--border-w) solid var(--border); margin: 0; }

/* segmented control: <div class="segmented" role="tablist"><button aria-selected="true">…</button>…</div> */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--radius-m); }
.segmented > button { min-height: 38px; padding: 0 var(--space-3); border: 0; background: transparent;
  border-radius: calc(var(--radius-m) - 3px); font-weight: 600; color: var(--text-muted); cursor: pointer; }
.segmented > button[aria-selected="true"] { background: var(--surface); color: var(--text);
  box-shadow: inset 0 0 0 var(--border-w) var(--border); }

/* states */
.empty { display: grid; justify-items: center; gap: var(--space-3); text-align: center;
  padding: var(--space-7) var(--space-4); color: var(--text-muted); }
.empty > :first-child { color: var(--text); }
.skeleton { border-radius: var(--radius-s); background: var(--surface-2); min-height: 1em;
  animation: kit-pulse 1.2s ease-in-out infinite; }
@keyframes kit-pulse { 50% { opacity: .5; } }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border);
  border-top-color: var(--accent); animation: kit-spin .7s linear infinite; }
@keyframes kit-spin { to { transform: rotate(360deg); } }

/* bottom sheet / dialog: <dialog class="sheet">…</dialog>, open with kit.sheet(el) */
dialog.sheet { width: min(100%, var(--container)); max-height: 85dvh; margin: auto auto 0; padding: var(--space-5);
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  border: var(--border-w) solid var(--border); border-bottom: 0;
  border-radius: var(--radius-l) var(--radius-l) 0 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog.sheet::backdrop { background: color-mix(in oklab, var(--text) 40%, transparent); }
dialog.sheet[open] { animation: kit-sheet var(--dur) var(--ease); }
@keyframes kit-sheet { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 720px) { dialog.sheet { margin: auto; border-bottom: var(--border-w) solid var(--border); border-radius: var(--radius-l); } }

/* toasts (created by kit.toast) */
.toast-region { position: fixed; inset: auto 0 calc(var(--space-4) + env(safe-area-inset-bottom)) 0; z-index: 50;
  display: grid; justify-items: center; gap: var(--space-2); pointer-events: none; padding: 0 var(--space-4); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--space-3); max-width: 100%;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-m);
  background: var(--text); color: var(--bg); font-size: var(--text-sm); box-shadow: var(--shadow);
  animation: kit-toast var(--dur) var(--ease); }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 32px; }
@keyframes kit-toast { from { transform: translateY(12px); opacity: 0; } }

/* page transitions + reduced motion */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
