/* ============================================================
   Fold'em partner web — shared styles
   Tokens: Docs/design/wireframe-v0.1.html §01 (authoritative).
   Mobile-first. No framework, no build step, no webfonts —
   system stacks only (serif stack reserved for D1's commitment
   headline, per the wireframe's serif rule).
   ============================================================ */

:root {
  /* ---- §01 design tokens ---- */
  --felt:        #0B3D2C;   /* brand primary — "reclaimed felt" */
  --felt-deep:   #082C20;   /* pressed / emphasis */
  --felt-tint:   #E3EDE7;   /* selected chips, soft fills */
  --paper:       #FAF6EE;   /* canvas */
  --card:        #FFFFFF;   /* raised surface */
  --recess:      #F1EBDD;   /* recessed wells, inactive tracks, inputs */
  --ink:         #152019;   /* primary text */
  --ink-2:       #5C6B62;   /* secondary text */
  --ink-3:       #93A096;   /* tertiary / placeholders */
  --hairline:    #E6DFCE;
  --saved:       #1E7A4F;   /* money-kept numerals ONLY */
  --amber:       #B7791F;   /* pending / informational warning */
  --ember:       #C2461E;   /* risk only — budget ≤1 element per screen */
  --ember-tint:  #FBEAE2;

  /* ---- radius (§01: btn 14 · card 20 · sheet 28 · pill ∞) ---- */
  --r-btn:   14px;
  --r-card:  20px;
  --r-sheet: 28px;

  /* ---- spacing (4pt grid) ---- */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;

  /* ---- motion ---- */
  --t-fast: 0.15s;
  --t-base: 0.25s;

  /* ---- type stacks ---- */
  --sans:  -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
           Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "New York", ui-serif, Georgia, "Times New Roman", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--s5) var(--s5) var(--s6);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

/* ---- brand mark (folded-corner square, wireframe .logo-fold) ---- */
.logo-fold {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--felt);
  position: relative;
  overflow: hidden;
  flex: none;
}
.logo-fold::after {
  content: "";
  position: absolute; top: 0; right: 0;
  border-style: solid;
  border-width: 0 14px 14px 0;
  border-color: transparent var(--paper) transparent transparent;
}

/* ---- type ---- */
.serif-headline {           /* D1 commitment headline ONLY */
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.page-title { font-size: 28px; font-weight: 800; line-height: 1.15; }
.h17 { font-size: 17px; font-weight: 600; }
.b15 { font-size: 15px; color: var(--ink-2); line-height: 1.45; }
.f13 { font-size: 13px; color: var(--ink-3); }
.b15 b, .b15 strong { color: var(--ink); font-weight: 600; }

/* ---- surfaces ---- */
.card {
  background: var(--card);
  border-radius: var(--r-card);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(21, 32, 25, 0.06);
}
.well {
  background: var(--recess);
  border-radius: 16px;
  padding: var(--s4);
}
.well.ember-tint { background: var(--ember-tint); }

.row { display: flex; align-items: center; gap: var(--s3); }
.sp { flex: 1; }
.divider { height: 1px; background: var(--hairline); margin: var(--s3) 0; }

.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--felt-tint);
  color: var(--felt);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}

/* ---- pills ---- */
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pill.locked  { background: var(--felt); color: #EFEDE0; }
.pill.pending { background: #F6EBD7; color: var(--amber); }
.pill.alert   { background: var(--ember-tint); color: var(--ember); }

/* ---- buttons ----
   One felt-filled CTA per screen, max. Inverted friction partner-side:
   deny/cancel easy and big, approve small and last. */
button { font: inherit; color: inherit; }

.cta {
  display: block;
  width: 100%;
  background: var(--felt);
  color: #F4F1E4;
  border: none;
  border-radius: var(--r-btn);
  padding: 16px;
  text-align: center;
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--t-fast) ease, background var(--t-fast) ease;
}
.cta:active { transform: scale(0.97); background: var(--felt-deep); }

.cta.ghost {
  background: transparent;
  border: 1.5px solid rgba(21, 32, 25, 0.28);
  color: var(--ink);
}
.cta.ghost:active { transform: scale(0.97); background: rgba(21, 32, 25, 0.05); }

.cta.quiet { background: var(--felt-tint); color: var(--felt); }
.cta.quiet:active { transform: scale(0.97); background: #D5E3DB; }

.cta:disabled {
  background: var(--recess);
  color: var(--ink-3);
  cursor: default;
  transform: none;
}

/* The smallest-text, last-position approve affordance (D3). */
.link-quiet {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--ember);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: var(--s2);
  display: inline-block;
}

/* Boost pills (D2) — tappable feltTint chips. */
.boost-pill {
  border: none;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  background: var(--felt-tint);
  color: var(--felt);
  cursor: pointer;
  transition: transform var(--t-fast) ease, background var(--t-fast) ease;
}
.boost-pill:active { transform: scale(0.97); background: #D5E3DB; }
.boost-pill:disabled { background: var(--recess); color: var(--ink-3); cursor: default; }

/* ---- focus (accessibility) ---- */
:focus-visible {
  outline: 3px solid var(--felt);
  outline-offset: 2px;
  border-radius: 4px;
}
.cta:focus-visible, .boost-pill:focus-visible { outline-offset: 3px; }

/* ---- forms ---- */
.field { display: flex; flex-direction: column; gap: var(--s1); }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field textarea {
  font: inherit;
  color: var(--ink);
  background: var(--recess);
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--felt);
  background: var(--card);
}
.field .hint { font-size: 12px; color: var(--ink-3); }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }

/* ---- stat cards (D2) ---- */
.stat-row { display: flex; gap: var(--s3); }
.stat {
  flex: 1;
  text-align: center;
  background: var(--card);
  border-radius: var(--r-card);
  padding: 18px 12px;
  box-shadow: 0 1px 2px rgba(21, 32, 25, 0.06);
}
.stat .num { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .num.saved { color: var(--saved); }   /* money only — never felt */

/* ---- status / outcome panels ---- */
.panel-neutral {
  background: var(--card);
  border-radius: var(--r-card);
  padding: var(--s5);
  text-align: center;
  box-shadow: 0 1px 2px rgba(21, 32, 25, 0.06);
}
.panel-neutral .big { font-size: 21px; font-weight: 700; margin-bottom: var(--s2); }

.error-line { font-size: 14px; color: var(--ember); }

/* ---- confirm dialog (D3 approve — documented wireframe deviation) ---- */
dialog.confirm {
  border: none;
  border-radius: var(--r-sheet);
  padding: var(--s5);
  max-width: 360px;
  width: calc(100vw - 48px);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}
dialog.confirm::backdrop { background: rgba(8, 16, 12, 0.45); }
dialog.confirm .dialog-actions {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  margin-top: var(--s4);
}

/* ---- reveal motion (decorative — gated below) ---- */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: reveal var(--t-base) ease forwards;
}
.reveal.d1 { animation-delay: 0.05s; }
.reveal.d2 { animation-delay: 0.12s; }
.reveal.d3 { animation-delay: 0.19s; }
@keyframes reveal { to { opacity: 1; transform: none; } }

/* ---- reduced motion: kill all decorative motion ---- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
  .cta:active, .cta.ghost:active, .cta.quiet:active, .boost-pill:active { transform: none; }
}

/* ---- utility ---- */
.hidden { display: none !important; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.checklist { list-style: none; }
.checklist li { padding: 3px 0; font-size: 15px; color: var(--ink-2); line-height: 1.45; }

@media (min-width: 520px) {
  .page { padding-top: var(--s6); }
}
