/* ============================================================
   Ethelium — shared interactive-demo styles
   Drop-in for every app page. Self-contained: does NOT rely on
   any per-app .phone rules. Each page sets its own accent:

     .demo { --accent:#EC9C84; --accent-2:#EF8E70; --screen:#101014; }

   Reusable screen primitives are prefixed .dm-*.
   ============================================================ */

.demo {
  --accent: #B89E84;
  --accent-2: #B89E84;
  --screen: #101014;
  --dm-surface: #17171C;
  --dm-surface-2: #202027;
  --dm-line: rgba(255, 255, 255, 0.09);
  --dm-text: #F4F4F6;
  --dm-text-2: #9A9AA2;
  --dm-text-3: #6E6E76;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 76px 0 84px;
  position: relative;
  z-index: 2;
}
.demo .demo-head { text-align: center; max-width: 640px; margin: 0 auto 46px; }
.demo .demo-head h2 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin: 0 0 14px;
}
.demo .demo-lede { color: var(--dm-text-2); font-size: 1.05rem; margin: 0; }

/* ---------- layout: phone + tabs ---------- */
.demo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 34px;
}
@media (min-width: 860px) {
  .demo-wrap {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 56px;
    max-width: 920px;
    margin: 0 auto;
  }
}

/* ---------- phone frame ---------- */
.demo-phone {
  position: relative;
  flex: none;
  width: min(300px, 80vw);
  aspect-ratio: 74 / 154;
  background: #1A1A1F;
  border-radius: 42px;
  padding: 10px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 30px 70px rgba(0, 0, 0, 0.6);
}
.demo-phone .phone-notch {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 38%; height: 22px;
  background: #1A1A1F;
  border-radius: 0 0 14px 14px;
  z-index: 5;
}
.phone-viewport {
  position: relative;
  height: 100%;
  border-radius: 33px;
  overflow: hidden;
  background: var(--screen);
}

/* ---------- crossfading screens ---------- */
.demo-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 15px 14px;
  color: var(--dm-text);
  font-size: 13px;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.02);
  transition: opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s;
  pointer-events: none;
}
.demo-screen.is-on {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: auto;
}
.demo-screen.screen-fill { padding: 0; }

/* ---------- status bar ---------- */
.dm-status {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 600;
  color: currentColor;
  opacity: 0.92;
  margin-bottom: 12px;
  flex: none;
}
.dm-status .r { display: inline-flex; gap: 5px; align-items: center; letter-spacing: 0.02em; }

/* ---------- generic bits ---------- */
.dm-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 6px;
}
.dm-title { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; margin: 0 0 3px; }
.dm-sub { color: var(--dm-text-2); font-size: 11px; margin: 0 0 12px; }
.dm-h { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; margin: 0; }

.dm-pill {
  align-self: center;
  background: var(--accent);
  color: #12100f;
  font-weight: 800; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 6px 16px; border-radius: 999px;
}
.dm-pill.ghost { background: rgba(255,255,255,0.14); color: #fff; }

.dm-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--dm-surface-2);
  border: 1px solid var(--dm-line);
  color: var(--dm-text); font-weight: 600; font-size: 11px;
  padding: 6px 11px; border-radius: 999px;
}
.dm-chip.on { background: var(--accent); color: #12100f; border-color: transparent; }

.dm-btn {
  margin-top: auto;
  background: var(--accent);
  color: #12100f;
  font-weight: 800; font-size: 13px;
  text-align: center;
  padding: 12px; border-radius: 12px;
  flex: none;
}
.dm-btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

/* rows / list */
.dm-list { display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.dm-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--dm-surface);
  border: 1px solid var(--dm-line);
  border-radius: 12px;
  padding: 10px 11px;
}
.dm-row.flat { background: transparent; border: 0; border-bottom: 1px solid var(--dm-line); border-radius: 0; padding: 9px 2px; }
.dm-row .lead {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--dm-surface-2); color: var(--accent);
  font-weight: 800; font-size: 12px;
}
.dm-row .lead.accent { background: var(--accent); color: #12100f; }
.dm-row .body { min-width: 0; flex: 1; }
.dm-row .body .t { font-weight: 700; font-size: 12.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-row .body .m { color: var(--dm-text-2); font-size: 10.5px; margin-top: 2px; }
.dm-row .val { font-weight: 800; font-size: 12.5px; color: var(--accent); flex: none; font-variant-numeric: tabular-nums; }
.dm-row.me { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--dm-surface)); }

/* progress bar */
.dm-prog { height: 7px; border-radius: 4px; background: rgba(255,255,255,0.12); overflow: hidden; }
.dm-prog > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* ring (progress circle) */
.dm-ring { position: relative; display: grid; place-items: center; margin: 6px auto; }
.dm-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.dm-ring .track { fill: none; stroke: rgba(255,255,255,0.16); }
.dm-ring .arc { fill: none; stroke: var(--accent); stroke-linecap: round; }
.dm-ring .lbl {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: 26px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}

/* vertical bars / equalizer */
.dm-bars { display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.dm-bars span { width: 6px; border-radius: 3px; background: var(--accent); opacity: 0.55; }
.dm-bars span.on { opacity: 1; }

/* dots row */
.dm-dots { display: flex; gap: 5px; justify-content: center; }
.dm-dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.28); }
.dm-dots span.on { background: var(--accent); width: 9px; height: 9px; }

/* bottom tab bar */
.dm-tabbar {
  margin-top: auto;
  display: flex; justify-content: space-around; align-items: center;
  border-top: 1px solid var(--dm-line);
  padding: 9px 2px 2px;
  flex: none;
}
.dm-tabbar i {
  width: 18px; height: 18px; border-radius: 5px;
  background: currentColor; opacity: 0.32;
  display: block;
}
.dm-tabbar i.on { opacity: 1; color: var(--accent); }

/* mini stat tiles */
.dm-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dm-tile { background: var(--dm-surface); border: 1px solid var(--dm-line); border-radius: 12px; padding: 10px; }
.dm-tile .k { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dm-text-3); }
.dm-tile .v { font-weight: 800; font-size: 18px; margin-top: 3px; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ============================================================
   TABS (the selector beside the phone)
   ============================================================ */
.demo-tabs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, 92vw);
}
.demo-tab {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--dm-surface, #17171C);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 13px 15px;
  color: #F4F4F6;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.demo-tab:hover { border-color: rgba(255, 255, 255, 0.2); transform: translateX(2px); }
.demo-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.demo-tab.is-on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--dm-surface, #17171C));
}
.demo-tab .demo-tab-i {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--dm-text-2, #9A9AA2);
  transition: background 0.2s ease, color 0.2s ease;
}
.demo-tab.is-on .demo-tab-i { background: var(--accent); color: #12100f; }
.demo-tab .demo-tab-i svg { width: 18px; height: 18px; }
.demo-tab .demo-tab-l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.demo-tab .demo-tab-l strong { font-weight: 700; font-size: 0.92rem; letter-spacing: -0.01em; }
.demo-tab .demo-tab-l em {
  font-style: normal;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.66rem; letter-spacing: 0.04em;
  color: var(--dm-text-3, #6E6E76);
}
.demo-tab.is-on .demo-tab-l em { color: var(--dm-text-2, #9A9AA2); }

/* Counter under the phone on mobile-tabs-below layouts (unused by default) */
@media (prefers-reduced-motion: reduce) {
  .demo-screen { transition: none; }
}
