/* Alibi web styles. Only tokens from tokens.css: no raw colours here or in components. Mobile first.
   Parchment comes from the warm neutrals, surfaces and hairlines: no textures, gradients, glow or shadows. */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--mallow); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: var(--text-title-1); font-weight: 300; letter-spacing: -.02em; }
h1 b { font-weight: 800; }
h2 { font-size: var(--text-subheading); font-weight: 600; line-height: 1.3; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--mallow); outline-offset: 2px; }

.eyebrow { font-family: var(--font-data); font-size: var(--text-eyebrow); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.num { font-family: var(--font-data); font-weight: 500; font-variant-numeric: tabular-nums; }
.loading { padding: var(--space-6) var(--space-4); color: var(--muted); }
.stack { display: grid; gap: var(--space-5); }
.stack-s { display: grid; gap: var(--space-2); }
[hidden] { display: none !important; }
.back { justify-self: start; padding-left: 0; }
.lead-text { font-size: var(--text-subheading); line-height: 1.5; }
.note { font-size: var(--text-small); color: var(--muted); }
.warn { color: var(--amber); font-size: var(--text-small); }
.err { font-size: var(--text-small); color: var(--danger); }
.label, .field label { font-size: var(--text-small); font-weight: 500; color: var(--muted); }

/* Shell */
.shell { min-height: 100dvh; display: grid; grid-template-rows: 1fr auto; }
.content { width: 100%; max-width: 640px; margin: 0 auto; padding: var(--space-5) var(--space-4) calc(var(--space-7) + var(--tap)); }
.tabbar { position: fixed; inset: auto 0 0 0; display: flex; justify-content: space-around; padding: var(--space-2) var(--space-2) max(var(--space-3), env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); z-index: 5; }
.tab { display: grid; justify-items: center; gap: 2px; font-size: var(--text-eyebrow); color: var(--muted); min-width: 72px; min-height: var(--tap); align-content: center; text-decoration: none; }
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--mallow); }
.brand { display: none; }
.mark { width: 32px; height: 32px; border-radius: var(--radius-control); }

@media (min-width: 900px) {
  .shell { grid-template-columns: var(--sidebar) 1fr; grid-template-rows: none; }
  .tabbar { position: sticky; top: 0; height: 100dvh; flex-direction: column; justify-content: flex-start; gap: var(--space-1); padding: var(--space-5) var(--space-3); border-top: 0; border-right: 1px solid var(--line); grid-row: 1; }
  .tab { grid-template-columns: 24px 1fr; justify-items: start; gap: var(--space-3); font-size: var(--text-body); padding: 0 var(--space-3); border-radius: var(--radius-control); }
  .tab.active { background: var(--mallow-soft); }
  .brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 800; font-size: var(--text-heading); padding: 0 var(--space-3) var(--space-5); }
  .content { padding: var(--space-7) var(--space-5); }
}

/* Buttons and fields */
.btn { font: inherit; font-weight: 600; font-size: var(--text-body); min-height: var(--button-md); padding: 0 var(--space-4); border-radius: var(--radius-control); border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); text-decoration: none; transition: transform var(--dur-press) ease-out; }
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--leaf); color: var(--on-leaf); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-ghost { background: none; color: var(--muted); }
.btn-lg { min-height: var(--button-lg); }
.btn-block { width: 100%; }
.btn-icon { width: var(--tap); min-height: var(--tap); padding: 0; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn[disabled]:active { transform: none; }

.field { display: grid; gap: 6px; }
.field input { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-control); min-height: var(--tap); padding: 0 var(--space-3); width: 100%; }
.field input:focus { outline: 2px solid var(--mallow); outline-offset: 0; border-color: transparent; }

.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip { font: inherit; font-size: var(--text-small); min-height: var(--tap); padding: 0 var(--space-4); border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; }
.chip[aria-pressed="true"] { background: var(--mallow-soft); border-color: var(--mallow); color: var(--mallow); }

.actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: var(--space-4); min-height: var(--tap); }
.stepper .num { min-width: 2ch; text-align: center; font-size: var(--text-heading); }
.steps { margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-2); }
.steps li::marker { font-family: var(--font-data); color: var(--muted); }

/* Cards and rows */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.card-pad { padding: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); min-height: 64px; color: inherit; text-decoration: none; }
.row + .row { border-top: 1px solid var(--line); }
button.row { width: 100%; font: inherit; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; border-top-color: var(--line); cursor: pointer; }
button.row:first-child { border-top: 0; }
button.row:hover { background: var(--surface-2); }
.row .txt { flex: 1; min-width: 0; display: grid; }
.row .txt b { font-weight: 600; }
.row .txt span { font-size: var(--text-small); color: var(--muted); }
.row.pick[aria-checked="true"] { background: var(--mallow-soft); }
.row.pick[aria-checked="true"] .avatar { border-color: var(--mallow); color: var(--mallow); }
.tile { width: var(--icon-tile); height: var(--icon-tile); border-radius: var(--radius-control); background: var(--surface-2); display: grid; place-items: center; flex: none; color: var(--text); }
.tile svg { width: 22px; height: 22px; }
.tile.seen { color: var(--leaf); background: var(--leaf-soft); }
.status { font-size: var(--text-small); color: var(--muted); display: inline-flex; align-items: center; gap: var(--space-1); white-space: nowrap; }
.status svg { width: 16px; height: 16px; }
.status.seen { color: var(--leaf); }
.avatar { width: var(--icon-tile); height: var(--icon-tile); border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; flex: none; font-weight: 600; }
.chev { width: 20px; height: 20px; color: var(--muted); flex: none; }

.case-card { display: grid; gap: var(--space-2); padding: var(--space-5) var(--space-4); color: inherit; text-decoration: none; }
.case-card:hover { background: var(--surface-2); }
.case-title { font-size: var(--text-title-2); font-weight: 300; letter-spacing: -.02em; line-height: 1.15; }
.case-open { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--leaf); font-weight: 600; min-height: var(--tap); }
.case-open .chev { color: var(--leaf); }

/* Evidence: read on a parchment surface at body size or larger, never small or faint. */
.paper { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-card); padding: var(--space-4); display: grid; gap: var(--space-3); margin: 0; }
.paper p { font-size: var(--text-body); line-height: 1.6; }
.paper.enlarged p { font-size: var(--text-heading); line-height: 1.5; }
.paper.detail { gap: var(--space-2); }
.paper blockquote { margin: 0; }
.paper mark { background: var(--mallow-soft); color: var(--text); border-radius: var(--radius-tag); padding: 2px var(--space-1); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.statement { font-weight: 600; }

.empty { display: grid; justify-items: center; text-align: center; gap: var(--space-2); padding: var(--space-6) var(--space-4); border: 1px dashed var(--line); border-radius: var(--radius-card); }
.empty p { font-size: var(--text-small); color: var(--muted); }

/* Evidence sheet: bottom on a phone, centred on wider screens. */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 10; }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 11; margin: 0 auto; width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  padding: var(--space-5) var(--space-4) max(var(--space-5), env(safe-area-inset-bottom)); }
.sheet h2 { font-size: var(--text-heading); }
@media (min-width: 900px) {
  .sheet { inset: 50% auto auto 50%; transform: translate(-50%, -50%); max-width: 560px; border-bottom: 1px solid var(--line); border-radius: var(--radius-sheet); }
}

/* Welcome */
.welcome { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-6) var(--space-4); }
.welcome-inner { width: 100%; max-width: 420px; display: grid; gap: var(--space-5); }
.welcome .mark { width: 72px; height: 72px; border-radius: var(--radius-sheet); }
.welcome .lead { color: var(--muted); font-size: var(--text-subheading); line-height: 1.4; }

@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:active { transform: none; } }
