/* Meeting Cost Meter — "The Burn". Reactive heat + ember field + odometer.
 * Friendly One Page Toys system, self-contained, theme-aware (light/dark). */

@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap");

:root{
  --font-display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ink: #211f1d;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f4f2ed;
  --muted: #756f68;
  --line: #ece7df;
  --line-strong: #d9d2c6;
  --accent: #941e1e;
  --accent-hover: #7a1818;
  --accent-soft: rgba(148, 30, 30, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow: 0 2px 8px rgba(33, 31, 29, 0.06);
  --shadow-md: 0 8px 22px rgba(33, 31, 29, 0.09);
  --shadow-lg: 0 16px 40px rgba(33, 31, 29, 0.12);

  /* odometer heat gradient (red → white-hot, no orange) */
  --hot-1: #ffd2d2;
  --hot-2: #e03b3b;
  --hot-3: #9c1717;
  --heat: 0;
  --glass: rgba(255, 255, 255, 0.72);
}

/* Cool blue-charcoal + warm cream — inspired by synergyprod.com. */
:root[data-theme="dark"]{
  --ink: #e8e2d9;
  --bg: #14171f;
  --surface: #1b1f29;
  --surface-2: #232839;
  --muted: #9a9183;
  --line: #282d39;
  --line-strong: #3a4150;
  --accent: #d13535;
  --accent-hover: #e06363;
  --accent-soft: rgba(209, 53, 53, 0.16);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 30px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 48px -10px rgba(0, 0, 0, 0.6);
  --hot-1: #ffe0e0;
  --hot-2: #ff5a5a;
  --hot-3: #c22a2a;
  --glass: rgba(27, 31, 41, 0.62);
}

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

html, body{ height: 100%; }

body{
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Reactive background ---------- */
.embers{
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.heat{
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 48% at 50% 34%, rgba(209, 53, 53, calc(0.08 + var(--heat) * 0.32)), transparent 70%),
    radial-gradient(90% 60% at 50% 118%, rgba(150, 20, 20, calc(0.10 + var(--heat) * 0.40)), transparent 72%);
  transition: background 500ms linear;
}

/* ---------- Top bar ---------- */
.topbar{
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 30px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.86rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.brand__mark{
  width: 1.1em;
  height: 1.1em;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: linear-gradient(90deg, var(--ink) 0 50%, var(--surface) 50% 100%);
}

.topbar__right{ display: inline-flex; align-items: center; gap: 14px; }

.topbar__tag{
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.iconbtn{
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  font-size: 1rem;
  line-height: 1;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.iconbtn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ink); }
.iconbtn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent-soft); }
.theme-toggle__sun, .theme-toggle__moon, .theme-toggle__auto{ display: none; }
:root[data-theme-mode="system"] .theme-toggle__auto{ display: inline; }
:root[data-theme-mode="light"] .theme-toggle__sun{ display: inline; }
:root[data-theme-mode="dark"] .theme-toggle__moon{ display: inline; }

/* ---------- Stage ---------- */
.stage{
  position: relative;
  z-index: 2;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: clamp(24px, 5vw, 56px) 20px clamp(56px, 7vw, 84px);
}

.meter{ width: 100%; max-width: 660px; text-align: center; }

.meter__title{
  display: block;
  width: 100%;
  margin: 0 auto 26px;
  border: 0;
  border-bottom: 2px dashed transparent;
  background: transparent;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-align: center;
  outline: none;
  transition: border-color 140ms ease;
}
.meter__title:hover{ border-bottom-color: var(--line-strong); }
.meter__title:focus{ border-bottom-color: var(--accent); }

.meter__eyebrow{
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Odometer ---------- */
.odo{
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3.4rem, 16vw, 8rem);
  line-height: 1;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  filter: drop-shadow(0 6px 26px rgba(209, 53, 53, calc(0.22 + var(--heat) * 0.5)));
  transition: filter 400ms linear;
  user-select: none;
}

/* Red → white-hot gradient applied per glyph (clip-to-text needs to live on the
 * element that directly contains the text, not the flex container). */
.odo__digit,
.odo__sym{
  background: linear-gradient(176deg, var(--hot-1) 0%, var(--hot-2) 48%, var(--hot-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.odo__reel{
  display: inline-block;
  height: 1em;
  overflow: hidden;
  vertical-align: bottom;
}

.odo__strip{
  display: flex;
  flex-direction: column;
  transition: transform 240ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

.odo__digit{
  height: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.odo__sym{ display: inline-block; line-height: 1; }

.meter__compare{
  margin: 14px 0 0;
  min-height: 1.4em;
  font-size: 0.98rem;
  color: var(--muted);
}
.meter__compare strong{ color: var(--ink); font-weight: 700; }

/* ---------- Console (glassy control panel) ---------- */
.console{
  margin-top: 30px;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: var(--shadow-lg);
}

.controls{
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-bottom: 14px;
}

.field{ flex: 1 1 200px; max-width: 280px; text-align: left; }

.field__label{
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.field__box{
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  overflow: hidden;
}
.field__box:focus-within{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.step{
  flex: 0 0 auto;
  width: 44px;
  border: 0;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.step:hover{ background: var(--accent); color: #fff; }

.field__input{
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 12px 8px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
  outline: none;
  font-variant-numeric: tabular-nums;
}
.field__input::-webkit-outer-spin-button,
.field__input::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }
.field__input[type="number"]{ -moz-appearance: textfield; }

.presets{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 22px;
}

.preset{
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.preset:hover{ background: var(--surface-2); }
.preset[aria-pressed="true"]{ background: var(--accent); border-color: var(--accent); color: #fff; }

.actions{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.btn{
  appearance: none;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}
.btn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active{ transform: translateY(0); box-shadow: var(--shadow); }
.btn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent-soft), var(--shadow); }

.btn--primary{
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  padding: 16px 34px;
  box-shadow: 0 8px 26px -6px var(--accent);
}
.btn--primary:hover{ background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--running{ background: var(--ink); border-color: var(--ink); color: var(--bg); box-shadow: var(--shadow-md); }

.btn--ghost{ border-color: var(--line-strong); color: var(--muted); box-shadow: none; }
.btn--ghost:hover{ color: var(--ink); border-color: var(--ink); box-shadow: var(--shadow); }

.stats{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.stat{ display: flex; flex-direction: column; gap: 4px; min-width: 96px; }
.stat__label{
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat__value{
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.meter__status{
  margin: 18px 0 0;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.backlink{
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 140ms ease, border-color 140ms ease;
}
.backlink:hover{ color: var(--ink); border-bottom-color: var(--accent); }

@media (prefers-reduced-motion: reduce){
  .odo__strip{ transition: none; }
  .iconbtn, .btn, .step{ transition: none; }
}
