/* drytexter — designed around the artifact the product actually eats: the raw
   WhatsApp _chat.txt export. Warm newsprint paper, one bottle-green CTA, and
   monospace for every timestamp, number and label, because the source is mono. */

@font-face {
  font-family: 'Bricolage';
  src: url('fonts/bricolage.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/inter.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JB Mono';
  src: url('fonts/mono.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --bg: #F3F0E9;
  --surface: #FBF9F4;
  --ink: #16150F;
  --muted: #6C6759;
  --line: #DDD8CB;
  --accent: #0E5138;
  --accent-ink: #F6FBF7;
  /* Read-receipt blue. Appears on ✓✓ and nowhere else — that restraint is the point. */
  --tick: #2C9FD8;
  --radius: 12px;
  --display: 'Bricolage', 'Inter', system-ui, sans-serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JB Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
:root[data-theme="dark"] {
  --bg: #100F0C;
  --surface: #191813;
  --ink: #F1EEE4;
  --muted: #918C7C;
  --line: #2B2924;
  --accent: #3FBF88;
  --accent-ink: #08120C;
  --tick: #58BDEA;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 0.9375rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; }
h1 { font-size: clamp(2.5rem, 5.6vw, 4.4rem); line-height: .96; letter-spacing: -0.045em;
     text-wrap: balance; }
h2 { font-size: clamp(1.75rem, 4.4vw, 2.9rem); line-height: 1.02; letter-spacing: -0.035em; }
h3 { font-size: 1.0625rem; font-family: var(--sans); font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 1em; max-width: 68ch; }
h1 + p, h2 + p { margin-top: 16px; }
h3 + p { margin-top: 8px; }
p + h3 { margin-top: 30px; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px;
    text-decoration-color: var(--line); text-decoration-thickness: 1px; }
a:hover { text-decoration-color: currentColor; }
small, .meta { color: var(--muted); font-size: 0.8125rem; }

/* Mono is the utility voice: labels, timestamps, every number. */
.label {
  font-family: var(--mono); font-size: 0.6875rem; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--muted);
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
/* Mono's fixed advance widths make a decimal point float at display sizes.
   Big headline figures get the display face instead. */
.num.big { font-family: var(--display); font-weight: 600; letter-spacing: -0.04em; }
.muted { color: var(--muted); }
.center { text-align: center; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* --- layout --------------------------------------------------------------- */

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 22px; }
.narrow { max-width: 740px; }
section { padding: clamp(52px, 9vw, 112px) 0; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

header.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-in { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand {
  font-family: var(--display); font-size: 1.35rem; color: var(--ink);
  letter-spacing: -0.045em; margin-right: auto; text-decoration: none;
}
.nav a.link {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: .06em;
  color: var(--muted); text-decoration: none;
}
.nav a.link:hover, .nav a.link[aria-current] { color: var(--ink); }
.icon-btn {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  width: 32px; height: 32px; cursor: pointer; color: var(--muted);
  display: grid; place-items: center; font-size: 13px; padding: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink); }

footer.foot {
  border-top: 1px solid var(--line); padding: 40px 0; color: var(--muted);
  font-family: var(--mono); font-size: 0.75rem;
}
.foot-in { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* --- components ----------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: 600 0.9375rem/1 var(--sans); padding: 15px 26px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  cursor: pointer; text-decoration: none; transition: transform .18s ease, opacity .18s;
}
.btn:hover { transform: translateY(-1px); opacity: .93; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ghost { background: none; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.wide { width: 100%; }
.btn .arrow { transition: transform .18s ease; }
.btn:hover .arrow { transform: translateX(3px); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px;
}
.grid { display: grid; gap: 14px; }
/* Two up, never three — the g2 sections all hold pairs or 2x2 sets. */
.g2 { grid-template-columns: 1fr; }
@media (min-width: 720px) { .g2 { grid-template-columns: 1fr 1fr; } }
.g3 { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

input, select, textarea {
  width: 100%; font: 400 0.9375rem var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 15px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 7px; }

.pill {
  display: inline-block; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; font-family: var(--mono); font-size: 0.6875rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.err { color: #A8321F; font-size: 0.875rem; margin-top: 10px; }
:root[data-theme="dark"] .err { color: #F0876C; }
.ok { color: var(--accent); font-size: 0.875rem; margin-top: 10px; }
.hide { display: none !important; }

/* chat-type chooser */
.types { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
.type {
  display: block; width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 16px 15px 15px; cursor: pointer; text-align: left; color: var(--ink);
  font: 600 0.9375rem var(--sans); transition: border-color .15s, transform .15s;
}
.type .face { display: block; font-size: 1.35rem; line-height: 1.2; }
.type .name { display: block; margin-top: 9px; }
.type .hint {
  display: block; margin-top: 3px; font: 400 0.75rem/1.4 var(--sans); color: var(--muted);
}
.type:hover { border-color: var(--ink); transform: translateY(-2px); }
.type:hover .face { transform: rotate(-6deg) scale(1.12); }
.type .face { transition: transform .18s cubic-bezier(.3,1.4,.5,1); }
.type[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* drop zone */
.drop {
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 46px 24px; text-align: center; cursor: pointer;
}
.drop.over, .drop:hover { border-color: var(--accent); }

/* live progress ticker */
.ticker {
  height: 260px; overflow: hidden; position: relative;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
  -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
}
/* Same bubbles as the hero — this is the user's own chat replaying while we read it. */
.ticker ul {
  list-style: none; margin: 0; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 9px;
}

.bar { height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .5s ease; }

/* --- the signature: a raw export decoding itself -------------------------- */

.hero { display: grid; gap: clamp(36px, 5vw, 56px); align-items: center; grid-template-columns: 1fr; }
@media (min-width: 940px) { .hero { grid-template-columns: 1.15fr .85fr; } }

.file {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  overflow: hidden; font-family: var(--mono); font-size: 0.75rem;
}
.file-bar {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.6875rem;
  letter-spacing: .06em;
}
.file-bar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.file-bar .grow { margin-left: auto; }
/* Centred, so the panel never opens as a mostly-empty box while the lines type in. */
.file-body {
  padding: 14px; min-height: 320px;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
}

/* stage 1 — the file as WhatsApp writes it */
.raw {
  color: var(--muted); line-height: 1.75; white-space: pre-wrap; word-break: break-word;
  opacity: 0; animation: fadein .18s ease forwards;
}
.raw .stamp { opacity: .55; }
.raw .who { color: var(--ink); }
@keyframes fadein { to { opacity: 1; } }

/* stage 2 — the same lines, read */
.read { display: flex; flex-direction: column; gap: 9px; }
.msg {
  display: flex; gap: 10px; align-items: baseline; font-family: var(--sans);
  font-size: 0.8125rem; opacity: 0; transform: translateY(6px);
  animation: rise .4s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes rise { to { opacity: 1; transform: none; } }
.msg .body {
  border: 1px solid var(--line); background: var(--bg); border-radius: 12px;
  padding: 7px 11px; max-width: 74%;
}
.msg.mine { flex-direction: row-reverse; }
.msg.mine .body { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.msg .note {
  font-family: var(--mono); font-size: 0.625rem; color: var(--muted);
  letter-spacing: .04em; white-space: nowrap;
}
.msg .note.late { color: var(--ink); }
.ticks { color: var(--tick); letter-spacing: -2px; }

.verdict {
  margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--line);
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: .06em; color: var(--muted);
  opacity: 0; animation: fadein .5s ease .2s forwards;
}
.verdict b { color: var(--ink); font-weight: 400; }

/* --- admin ---------------------------------------------------------------- */

.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 14px; margin-bottom: -1px; cursor: pointer; color: var(--muted);
  font: 500 0.75rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; }
.tile {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 14px 16px;
}
.tile .num { font-size: 1.5rem; display: block; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
table.data th {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
  font: 500 0.6875rem/1.4 var(--mono); text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data .mono { font-family: var(--mono); font-size: 0.75rem; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
  font: 500 0.6875rem/1.6 var(--mono); color: var(--muted); white-space: nowrap;
}
.pill.on { border-color: var(--accent); color: var(--accent); }
.pill.warn { border-color: var(--ink); color: var(--ink); }

.btn.sm { padding: 6px 12px; font-size: 0.75rem; }
.row-in {
  width: 56px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink); font: 400 0.75rem var(--mono);
}

/* The generated QR is one SVG unit per module, so it lands ~45px wide unless we
   scale it. crispEdges keeps the modules hard-edged and scannable when it grows. */
[data-upi-qr] svg {
  width: 100%; height: auto; display: block;
  border-radius: 8px; background: #fff; shape-rendering: crispEdges;
}

/* --- report preview ------------------------------------------------------- */

.preview { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); }
.dial { display: flex; align-items: center; gap: 18px; }
.dial svg { width: 88px; height: 88px; flex: none; transform: rotate(-90deg); }
.dial .track { fill: none; stroke: var(--line); stroke-width: 7; }
.dial .arc {
  fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round;
  stroke-dasharray: 251; stroke-dashoffset: 251; transition: stroke-dashoffset 1.4s ease;
}
.revealed .dial .arc { stroke-dashoffset: var(--arc, 60); }

.rows { display: grid; gap: 13px; }
.row-lbl { display: flex; justify-content: space-between; font-size: 0.8125rem; margin-bottom: 6px; }
.row-lbl span:last-child { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.rows .bar > i { transition: width 1.1s cubic-bezier(.2, .8, .2, 1); }
.revealed .rows .bar > i { width: var(--w); }

.spark { display: flex; align-items: flex-end; gap: 4px; height: 84px; }
.spark i {
  flex: 1; background: var(--line); border-radius: 3px 3px 0 0; height: 0;
  transition: height .9s cubic-bezier(.2, .8, .2, 1);
}
.spark i.hot { background: var(--accent); }
.revealed .spark i { height: var(--h); }

/* --- scroll reveal -------------------------------------------------------- */

.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.revealed { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal, .raw, .msg, .verdict { opacity: 1; transform: none; }
}
