/* EmergiCall™ — corporate-clean consent theatre over a deteriorating emergency.
   Deliberately NOT the house dark theme: the joke needs the modals to look like
   real cookie banners, i.e. bland, white, and faintly pleased with themselves. */

:root {
  --ink: #12151c;
  --muted: #5b6472;
  --line: #e2e6ec;
  --bg: #f4f6f9;
  --paper: #ffffff;
  --brand: #d92b2b;
  --brand-dark: #a81f1f;
  --ok: #1f9d55;
  --shadow: 0 24px 60px rgba(12, 18, 30, .28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }

/* The page fades as consent drags on. --decay is set from JS, 0 → 1. */
#page {
  filter: saturate(calc(1 - var(--decay, 0) * .85)) brightness(calc(1 - var(--decay, 0) * .12));
  transition: filter 1.2s linear;
}

/* ── chrome ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 22px;
  background: var(--paper); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.brand em { font-style: normal; color: var(--brand); }
.brand sup { font-size: .55em; }
.logo {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand); color: #fff; font-weight: 800;
}
.topnav { display: flex; align-items: center; gap: 18px; font-size: 14px; color: var(--muted); }
.topnav a { text-decoration: none; }
.topnav a:hover { color: var(--ink); }
.topnav .cta {
  background: var(--ink); color: #fff; padding: 7px 13px; border-radius: 999px; font-weight: 600;
}
@media (max-width: 720px) { .topnav a:not(.cta) { display: none; } }

.wrap { max-width: 940px; margin: 0 auto; padding: 40px 22px 10px; }

/* ── hero ───────────────────────────────────────────────────────────────── */
.kicker { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 14px; }
.status { color: var(--brand); font-weight: 700; }
h1 {
  font-size: clamp(34px, 6.4vw, 60px); line-height: 1.03; letter-spacing: -.03em;
  margin: 0 0 18px;
}
.lede { font-size: 18px; max-width: 60ch; color: #2b3342; margin: 0 0 6px; }
.footnote { font-size: 12.5px; color: var(--muted); margin: 0 0 30px; }

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 34px;
}
.stat {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
}
.stat-n { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-l { font-size: 12px; color: var(--muted); line-height: 1.35; }

.ghost-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 12px 20px;
  margin-bottom: 30px;
}

/* ── log + trust ────────────────────────────────────────────────────────── */
.feed h2, .trust h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 0 0 12px; }
#log {
  list-style: none; margin: 0 0 40px; padding: 16px 18px; font-size: 14.5px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  max-height: 230px; overflow: auto;
}
#log li { padding: 5px 0; border-bottom: 1px dashed var(--line); }
#log li:last-child { border-bottom: 0; }
#log .t { display: inline-block; min-width: 52px; color: var(--muted); font-variant-numeric: tabular-nums; }
#log li.bad { color: var(--brand-dark); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 44px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card p { margin: 0; font-size: 14px; color: var(--muted); }

.foot {
  border-top: 1px solid var(--line); background: var(--paper);
  padding: 24px 22px 60px; font-size: 12.5px; color: var(--muted); text-align: center;
}
.foot p { margin: 4px 0; max-width: 70ch; margin-inline: auto; }

/* ── overlay + the pile of dead dialogs behind the live one ─────────────── */
#overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 14, 22, .55);
  backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 18px;
  overflow: auto;
}
#overlay[hidden] { display: none; }  /* [hidden] alone loses to display:grid */
#modal-host { width: min(560px, 100%); }
#stack { position: absolute; inset: 0; pointer-events: none; }
#stack .ghost {
  position: absolute; left: 50%; top: 50%;
  width: min(560px, 88vw); height: 260px;
  background: #fff; border-radius: 14px; opacity: .18;
}

.modal {
  position: relative; z-index: 1;
  width: min(560px, 100%); max-height: 88vh; overflow: auto;
  background: var(--paper); border-radius: 14px; box-shadow: var(--shadow);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: 0; } }
.modal.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

.m-head { padding: 20px 22px 0; }
.m-eyebrow { padding-right: 30px; }
.m-eyebrow {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 8px; display: flex; justify-content: space-between; gap: 10px;
}
.m-eyebrow b { color: var(--brand); font-weight: 700; }
.m-title { font-size: 20px; letter-spacing: -.02em; margin: 0 0 10px; line-height: 1.25; }
.m-body { padding: 0 22px; font-size: 14.5px; color: #333b49; }
.m-body p { margin: 0 0 12px; }
.m-body .legal { font-size: 11px; line-height: 1.45; color: #98a1ae; max-height: 88px; overflow: auto; }
.m-body em.tiny { font-size: 11px; color: var(--muted); font-style: normal; }

.field { display: block; margin: 0 0 10px; font-size: 14px; }
.field > span { display: block; margin-bottom: 5px; font-weight: 600; }
.field select, .field input[type="text"], .field input[type="number"] {
  font: inherit; width: 100%; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fbfcfe;
}
.field input[type="range"] { width: 100%; }

.toggles { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.toggles .row {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px;
  border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.toggles .row:last-child { border-bottom: 0; }
.toggles .row input { margin-top: 3px; flex: none; }
.toggles .row .sub { display: block; color: var(--muted); font-size: 11.5px; }
.toggles .row.locked { background: #f7f9fb; color: var(--muted); }

.vendors { max-height: 190px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.vendors .row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.vendors .row:last-child { border-bottom: 0; }
.vendors .row span.v-purpose { color: var(--muted); font-size: 11.5px; }

.progress { height: 5px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 4px 22px 0; }
.progress i { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.progress-note { font-size: 11px; color: var(--muted); padding: 5px 22px 0; }

.m-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 22px 20px; margin-top: 14px; border-top: 1px solid var(--line);
}
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 9px;
  padding: 12px 20px; background: var(--ok); color: #fff; flex: 1 1 auto;
}
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: #eef1f5; color: #444d5c; flex: 0 0 auto; }
/* The classic: a reject "link" styled to be almost invisible. */
.reject-link {
  font-size: 10.5px; color: #c9ced6; text-decoration: underline; cursor: pointer;
  background: none; border: 0; padding: 2px 0; flex: 0 0 auto;
}
.reject-link:hover { color: #aeb5bf; }
.m-foot .spacer { flex: 1 1 auto; }
.countdown { font-size: 11.5px; color: var(--muted); width: 100%; }
.countdown b { color: var(--brand); font-variant-numeric: tabular-nums; }

/* The X that runs away. */
.m-close {
  position: absolute; top: 12px; right: 12px; width: 26px; height: 26px;
  border-radius: 6px; border: 1px solid var(--line); background: #fff;
  color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1;
  transition: transform .12s ease-out;
}

/* ── toasts ─────────────────────────────────────────────────────────────── */
#toast-host {
  position: fixed; right: 14px; bottom: 14px; z-index: 80;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  background: #12151c; color: #fff; font-size: 13px; padding: 10px 14px;
  border-radius: 9px; max-width: 320px; box-shadow: var(--shadow);
  animation: pop .2s ease-out;
}
.toast.good { background: #14532d; }

/* ── the ending ─────────────────────────────────────────────────────────── */
.finale { text-align: center; padding: 34px 26px 30px; }
.finale .tick { font-size: 44px; }
.finale h2 { font-size: 24px; margin: 10px 0 12px; letter-spacing: -.02em; }
.finale p { color: var(--muted); font-size: 14.5px; margin: 0 0 12px; }
.finale .receipt {
  text-align: left; font-size: 12.5px; background: #f7f9fb; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin: 16px 0;
}
.finale .receipt div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
