/* WhipScribe components — built only from design/tokens.css.
   Every class is prefixed ws- so linking this file changes nothing until a
   page uses a class. Adopt by swapping a page's own button/card/input rules
   for these; do not restyle these per page. */

/* ---------- base ---------- */
.ws-app, .ws-page {
  font-family: var(--ws-sans);
  font-size: var(--ws-fs-14);
  line-height: var(--ws-lh-ui);
  color: var(--ws-text);
  background: var(--ws-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
.ws-page { font-size: var(--ws-fs-16); line-height: var(--ws-lh-body); background: var(--ws-ground); }

.ws-app :focus-visible, .ws-page :focus-visible {
  outline: 2px solid var(--ws-focus);
  outline-offset: 2px;
  border-radius: var(--ws-r-sm);
}
.ws-app ::selection, .ws-page ::selection { background: var(--ws-selection); }

/* ---------- text ---------- */
.ws-h1, .ws-h2, .ws-h3, .ws-h4 {
  margin: 0;
  color: var(--ws-text);
  font-weight: var(--ws-fw-semibold);
  line-height: var(--ws-lh-tight);
  letter-spacing: var(--ws-tracking-heading);
  text-wrap: balance;
}
.ws-h1 { font-size: var(--ws-fs-38); font-weight: var(--ws-fw-bold); }
.ws-h2 { font-size: var(--ws-fs-24); }
.ws-h3 { font-size: var(--ws-fs-20); }
.ws-h4 { font-size: var(--ws-fs-18); }
.ws-h1 em, .ws-h2 em { font-style: normal; color: var(--ws-green-text); }

.ws-eyebrow {
  font-size: var(--ws-fs-11);
  font-weight: var(--ws-fw-semibold);
  letter-spacing: var(--ws-tracking-eyebrow);
  text-transform: uppercase;
  color: var(--ws-muted);
}
.ws-muted { color: var(--ws-muted); }
.ws-mono  { font-family: var(--ws-mono); font-size: 0.92em; }
.ws-prose { max-width: var(--ws-reading); line-height: var(--ws-lh-body); color: var(--ws-text-2); text-wrap: pretty; }
.ws-reading { font-size: var(--ws-fs-15); line-height: var(--ws-lh-reading); max-width: var(--ws-reading); }
.ws-tabular { font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.ws-btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--ws-s-2);
  min-height: var(--ws-control);
  padding: 0 var(--ws-s-4);
  border: 1px solid transparent;
  border-radius: var(--ws-r-pill);
  font: inherit; font-size: var(--ws-fs-14); font-weight: var(--ws-fw-semibold); line-height: 1;
  color: var(--ws-text);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--ws-dur) var(--ws-ease), border-color var(--ws-dur) var(--ws-ease), transform var(--ws-dur) var(--ws-ease);
}
.ws-btn:disabled, .ws-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.ws-btn:active:not(:disabled) { transform: translateY(1px); }

.ws-btn--primary { background: var(--ws-brand); color: var(--ws-ink-900); }
.ws-btn--primary:hover:not(:disabled) { background: var(--ws-brand-2); }

.ws-btn--secondary { background: var(--ws-surface); border-color: var(--ws-line); }
.ws-btn--secondary:hover:not(:disabled) { border-color: var(--ws-ink-300); background: var(--ws-surface-2); }

.ws-btn--quiet { color: var(--ws-text-2); border-radius: var(--ws-r-sm); padding: 0 var(--ws-s-3); }
.ws-btn--quiet:hover:not(:disabled) { background: var(--ws-lime-50); color: var(--ws-green-text); }
.ws-btn--quiet[aria-pressed="true"] { background: var(--ws-lime-100); color: var(--ws-green-text); }

.ws-btn--danger { color: var(--ws-danger); border-radius: var(--ws-r-sm); }
.ws-btn--danger:hover:not(:disabled) { background: var(--ws-danger-bg); }

.ws-btn--sm { min-height: 30px; font-size: var(--ws-fs-13); padding: 0 var(--ws-s-3); }
.ws-btn--lg { min-height: 48px; font-size: var(--ws-fs-16); padding: 0 var(--ws-s-6); }
.ws-btn--icon { width: var(--ws-control); padding: 0; border-radius: var(--ws-r-sm); }
.ws-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- inputs ---------- */
.ws-input, .ws-select, .ws-textarea {
  appearance: none;
  width: 100%;
  min-height: var(--ws-control);
  padding: var(--ws-s-2) var(--ws-s-3);
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-r-sm);
  background: var(--ws-surface);
  color: var(--ws-text);
  font: inherit; font-size: var(--ws-fs-14);
  transition: border-color var(--ws-dur) var(--ws-ease), box-shadow var(--ws-dur) var(--ws-ease);
}
.ws-input::placeholder, .ws-textarea::placeholder { color: var(--ws-ink-400); }
.ws-input:hover, .ws-select:hover, .ws-textarea:hover { border-color: var(--ws-ink-300); }
.ws-input:focus, .ws-select:focus, .ws-textarea:focus {
  outline: none;
  border-color: var(--ws-green-700);
  box-shadow: 0 0 0 3px var(--ws-lime-100);
}
.ws-input[aria-invalid="true"], .ws-textarea[aria-invalid="true"] { border-color: var(--ws-danger); }
.ws-textarea { min-height: 96px; resize: vertical; line-height: var(--ws-lh-body); }
.ws-label { display: block; font-size: var(--ws-fs-13); font-weight: var(--ws-fw-medium); color: var(--ws-text-2); margin-bottom: var(--ws-s-1); }
.ws-help  { font-size: var(--ws-fs-12); color: var(--ws-muted); margin-top: var(--ws-s-1); }
.ws-error { font-size: var(--ws-fs-12); color: var(--ws-danger); margin-top: var(--ws-s-1); }

/* ---------- surfaces ---------- */
.ws-card {
  background: var(--ws-surface);
  border: 1px solid var(--ws-line-soft);
  border-radius: var(--ws-r-md);
  box-shadow: var(--ws-shadow-1);
  padding: var(--ws-s-5);
  display: flex; flex-direction: column; gap: var(--ws-s-3);
}
.ws-card--lg { border-radius: var(--ws-r-lg); padding: var(--ws-s-8); }
.ws-card--flat { box-shadow: none; border-color: var(--ws-line); }
.ws-card--panel { background: var(--ws-panel); border-color: transparent; box-shadow: none; }
.ws-card > .ws-card-body { flex: 1 1 auto; }
.ws-card > .ws-card-meta { margin-top: auto; font-size: var(--ws-fs-12); color: var(--ws-muted); }
a.ws-card { color: inherit; text-decoration: none; transition: transform var(--ws-dur) var(--ws-ease), box-shadow var(--ws-dur) var(--ws-ease), border-color var(--ws-dur) var(--ws-ease); }
a.ws-card:hover { transform: translateY(-2px); box-shadow: var(--ws-shadow-2); border-color: var(--ws-ink-200); }

.ws-rule { border: 0; border-top: 1px solid var(--ws-line); margin: var(--ws-s-4) 0; }

/* ---------- chips ---------- */
.ws-chip {
  display: inline-flex; align-items: center; gap: var(--ws-s-1);
  min-height: 24px; padding: 0 var(--ws-s-2);
  border-radius: var(--ws-r-pill);
  font-size: var(--ws-fs-12); font-weight: var(--ws-fw-medium); line-height: 1;
  background: var(--ws-ink-100); color: var(--ws-text-2);
}
.ws-chip--brand  { background: var(--ws-lime-100);  color: var(--ws-green-text); }
.ws-chip--ok     { background: var(--ws-ok-bg);     color: var(--ws-ok); }
.ws-chip--warn   { background: var(--ws-warn-bg);   color: var(--ws-warn); }
.ws-chip--danger { background: var(--ws-danger-bg); color: var(--ws-danger); }
.ws-kbd {
  font-family: var(--ws-mono); font-size: var(--ws-fs-11);
  border: 1px solid var(--ws-line); border-radius: var(--ws-r-sm); padding: 0 var(--ws-s-1); color: var(--ws-muted);
}

/* ---------- tabs ---------- */
.ws-tabs { display: flex; gap: var(--ws-s-6); border-bottom: 1px solid var(--ws-line); overflow-x: auto; scrollbar-width: none; }
.ws-tabs::-webkit-scrollbar { display: none; }
.ws-tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  height: 46px; padding: 0 2px;
  font: inherit; font-size: var(--ws-fs-13); color: var(--ws-muted);
  white-space: nowrap;
  box-shadow: inset 0 -2px transparent;
  transition: color var(--ws-dur) var(--ws-ease), box-shadow var(--ws-dur) var(--ws-ease);
}
.ws-tab:hover { color: var(--ws-text); }
.ws-tab[aria-selected="true"] { color: var(--ws-green-text); font-weight: var(--ws-fw-semibold); box-shadow: inset 0 -2px var(--ws-green-700); }

/* ---------- top bar ---------- */
.ws-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--ws-s-4);
  height: var(--ws-topbar); padding: 0 var(--ws-s-6);
  background: var(--ws-surface);
  border-bottom: 1px solid var(--ws-line);
}
.ws-topbar .ws-space { flex: 1; }
.ws-logo {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: var(--ws-r-md);
  background: var(--ws-brand); color: var(--ws-ink-900);
  font-weight: var(--ws-fw-bold); font-size: var(--ws-fs-18);
}

/* ---------- sheet / dialog ---------- */
.ws-sheet {
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-r-lg);
  padding: var(--ws-s-6);
  width: 440px; max-width: calc(100vw - 28px); max-height: 80dvh; overflow: auto;
  background: var(--ws-surface); color: var(--ws-text);
  box-shadow: var(--ws-shadow-3);
}
.ws-sheet::backdrop { background: rgba(15, 23, 42, 0.32); backdrop-filter: blur(3px); }
.ws-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ws-s-3); margin-bottom: var(--ws-s-4); }
.ws-sheet-head .ws-h3 { font-size: var(--ws-fs-18); }

/* ---------- menu rows (⋯ sheets, switchers) ---------- */
.ws-row {
  display: flex; align-items: center; gap: var(--ws-s-3);
  width: 100%; min-height: var(--ws-tap); padding: var(--ws-s-3) var(--ws-s-1);
  border: 0; border-bottom: 1px solid var(--ws-line); background: none;
  font: inherit; font-size: var(--ws-fs-14); color: var(--ws-text); text-align: left; cursor: pointer;
}
.ws-row:last-child { border-bottom: 0; }
.ws-row:hover { background: var(--ws-surface-2); }
.ws-row small { display: block; font-size: var(--ws-fs-12); color: var(--ws-muted); }
.ws-row--danger { color: var(--ws-danger); }

/* ---------- toast ---------- */
.ws-toast {
  position: fixed; left: 50%; bottom: calc(var(--ws-s-6) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(90vw, 480px);
  padding: var(--ws-s-3) var(--ws-s-4);
  border-radius: var(--ws-r-md);
  background: var(--ws-ink-800); color: var(--ws-white);
  font-size: var(--ws-fs-13); line-height: var(--ws-lh-ui);
  box-shadow: var(--ws-shadow-2);
  z-index: 40;
}

/* ---------- empty / blocked states: name the reason, offer the exit ---------- */
.ws-empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--ws-s-3);
  padding: var(--ws-s-8);
  border: 1px dashed var(--ws-ink-300); border-radius: var(--ws-r-md);
  color: var(--ws-text-2);
}
.ws-empty .ws-h4 { color: var(--ws-text); }

/* ---------- code on visitor surfaces wraps, never scrolls sideways ---------- */
.ws-page pre, .ws-page code {
  font-family: var(--ws-mono);
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
}
.ws-page pre { padding: var(--ws-s-4); border-radius: var(--ws-r-md); background: var(--ws-ink-900); color: var(--ws-ink-100); font-size: var(--ws-fs-13); line-height: 1.6; }

/* ---------- the three breakpoints (the only media queries components use) ---------- */
@media (max-width: 600px), (pointer: coarse) and (max-height: 520px) {
  .ws-btn { min-height: var(--ws-tap); }
  .ws-btn--sm { min-height: 36px; }
  .ws-btn--icon { width: var(--ws-tap); }
  .ws-input, .ws-select, .ws-textarea { min-height: 48px; font-size: var(--ws-fs-16); }   /* 16px stops iOS zoom */
  .ws-row { min-height: 48px; }
  .ws-topbar { padding: 0 var(--ws-s-3); gap: var(--ws-s-2); }
  .ws-card { padding: var(--ws-s-4); }
  .ws-card--lg { padding: var(--ws-s-5); }
  .ws-sheet {
    position: fixed; inset: auto 0 0; margin: 0;
    width: 100%; max-width: none; max-height: 85dvh;
    border-radius: var(--ws-r-lg) var(--ws-r-lg) 0 0; border-bottom: 0;
    padding: var(--ws-s-5) var(--ws-s-4) calc(var(--ws-s-5) + env(safe-area-inset-bottom));
  }
  .ws-h1 { font-size: var(--ws-fs-30); }
  .ws-h2 { font-size: var(--ws-fs-20); }
}

@media (pointer: coarse) {
  .ws-btn, .ws-tab, .ws-row { min-height: var(--ws-tap); }
}
