/* Pearl Bazaar — shared foundation.
 * Pearl brand family: dark iridescent base #06090f, sticky blurred nav
 * rgba(6,9,15,0.82) + blur 12px. Bazaar identity: rose/crimson #f43f5e
 * family + champagne gold #e8c47a family. No emojis in UI. */

:root {
  --bg: #06090f;
  --bg-alt: #0a0f18;
  --card: #0d1420;
  --card-2: #111a29;
  --card-border: rgba(244, 63, 94, 0.16);
  --text: #eef1f7;
  --muted: #9aa7bd;
  --faint: #8590a4;
  --rose: #f43f5e;
  --rose-deep: #be123c;
  --rose-soft: rgba(244, 63, 94, 0.12);
  --gold: #e8c47a;
  --gold-deep: #b98a2f;
  --gold-soft: rgba(232, 196, 122, 0.12);
  --good: #7dffd4;
  --warn: #fcd34d;
  --bad: #fda4af;
  --gradient: linear-gradient(120deg, #f43f5e 10%, #fb7185 45%, #e8c47a 90%);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(900px 420px at 12% -6%, rgba(244, 63, 94, 0.10), transparent 60%),
    radial-gradient(760px 380px at 88% 4%, rgba(232, 196, 122, 0.08), transparent 60%);
  background-attachment: fixed;
}
.container { max-width: 1180px; margin: 0 auto; padding: 0 1.5rem; }
.container.narrow { max-width: 820px; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.75rem; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 750; }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: 0 0 1rem; }
a { color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); }
.gradient-text {
  background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem;
  color: var(--gold); font-weight: 700; margin: 0 0 0.75rem;
}

/* ---- nav: sticky blurred convention ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(6, 9, 15, 0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(244, 63, 94, 0.14);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 0.8rem 1.5rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.1rem; }
.brand svg { width: 26px; height: 26px; }
.brand .tag {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gold); border: 1px solid rgba(232, 196, 122, 0.4); border-radius: 999px; padding: 0.1rem 0.55rem;
}
.nav-links { display: flex; gap: 1.25rem; margin-left: auto; align-items: center; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 550; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--rose); }
.nav-toggle { display: none; background: none; border: 1px solid var(--card-border); color: var(--text); border-radius: 8px; padding: 0.3rem 0.6rem; font-size: 1.1rem; cursor: pointer; }
.conn { font-size: 0.75rem; color: var(--faint); border: 1px solid var(--card-border); border-radius: 999px; padding: 0.2rem 0.7rem; white-space: nowrap; }
.conn.live { color: var(--good); border-color: rgba(125, 255, 212, 0.35); }
.conn.demo { color: var(--gold); border-color: rgba(232, 196, 122, 0.4); }

/* ---- hero ---- */
.hero { padding: 4rem 0 3rem; position: relative; overflow: hidden; }
.hero-inner { position: relative; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 640px; }
.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---- buttons ---- */
.btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  border-radius: 10px; padding: 0.65rem 1.25rem; font-weight: 650; font-size: 0.95rem;
  border: 1px solid transparent; transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.btn-primary { background: var(--gradient); color: #16060a; border: none; }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(244, 63, 94, 0.35); }
.btn-ghost { background: transparent; color: var(--text); border-color: rgba(244, 63, 94, 0.35); }
.btn-ghost:hover { border-color: var(--rose); }
.btn-gold { background: rgba(232, 196, 122, 0.14); color: var(--gold); border-color: rgba(232, 196, 122, 0.45); }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.82rem; }
.btn-danger { background: transparent; color: var(--bad); border-color: rgba(253, 164, 175, 0.4); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---- cards / grids ---- */
.section { padding: 2.5rem 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.25rem;
}
.card h3 { margin-bottom: 0.4rem; }
.card p { color: var(--muted); font-size: 0.92rem; }
.card .row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.stat { font-family: var(--mono); font-size: 1.05rem; }
.stat-label { font-size: 0.75rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--card-border); border-radius: var(--radius); background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { padding: 0.65rem 0.9rem; text-align: left; border-bottom: 1px solid rgba(244, 63, 94, 0.08); }
table.data th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); font-weight: 650; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: rgba(244, 63, 94, 0.04); }
.num { font-family: var(--mono); text-align: right !important; }
.up { color: var(--good); } .down { color: var(--bad); }

/* ---- forms ---- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.82rem; font-weight: 650; color: var(--muted); margin-bottom: 0.35rem; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg-alt); border: 1px solid var(--card-border);
  color: var(--text); border-radius: 10px; padding: 0.65rem 0.85rem; font-size: 0.95rem; font-family: var(--font);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.18); }
.field .hint { font-size: 0.78rem; color: var(--faint); margin-top: 0.3rem; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ---- banners / notices ---- */
.banner {
  border-radius: var(--radius); padding: 0.9rem 1.25rem; margin-bottom: 1.5rem;
  font-size: 0.92rem; border: 1px solid;
}
.banner.demo { background: rgba(232, 196, 122, 0.1); border-color: var(--gold-deep); color: var(--gold); font-weight: 650; }
.banner.local { background: rgba(244, 63, 94, 0.07); border-color: rgba(244, 63, 94, 0.35); color: #fda4af; }
.banner.info { background: rgba(148, 197, 255, 0.07); border-color: rgba(148, 197, 255, 0.3); color: #bcd6ff; }
.banner.warn { background: rgba(252, 211, 77, 0.08); border-color: rgba(252, 211, 77, 0.4); color: var(--warn); }

/* ---- footer ---- */
footer { border-top: 1px solid rgba(244, 63, 94, 0.14); margin-top: 3rem; padding: 2.5rem 0 2rem; background: rgba(6, 9, 15, 0.6); }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.address-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
code.address { font-family: var(--mono); font-size: 0.78rem; background: var(--bg-alt); border: 1px solid var(--card-border); border-radius: 8px; padding: 0.5rem 0.7rem; word-break: break-all; }
.footer-bottom { border-top: 1px solid rgba(244, 63, 94, 0.1); padding-top: 1.25rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---- misc ---- */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--card-2); border: 1px solid var(--gold-deep); color: var(--text);
  padding: 0.7rem 1.2rem; border-radius: 10px; z-index: 200; font-size: 0.9rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); max-width: 90vw;
}
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1.25rem; font-size: 0.92rem; }
.kv dt { color: var(--faint); } .kv dd { margin: 0; font-family: var(--mono); word-break: break-all; }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 700; border-radius: 999px; padding: 0.12rem 0.6rem; letter-spacing: 0.04em; }
.pill.demo { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-deep); }
.pill.live { background: rgba(125, 255, 212, 0.1); color: var(--good); border: 1px solid rgba(125, 255, 212, 0.35); }
.pill.local { background: var(--rose-soft); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.4); }
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs button { background: var(--card); border: 1px solid var(--card-border); color: var(--muted); border-radius: 999px; padding: 0.45rem 1.1rem; cursor: pointer; font-weight: 600; }
.tabs button.active { background: var(--rose-soft); color: var(--rose); border-color: var(--rose); }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid rgba(244, 63, 94, 0.12); margin: 1.5rem 0; }

@media (max-width: 760px) {
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: rgba(6, 9, 15, 0.97); flex-direction: column; padding: 1rem 1.5rem 1.5rem; gap: 0.9rem; border-bottom: 1px solid rgba(244, 63, 94, 0.2); }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; margin-left: auto; }
  .nav-inner { position: relative; }
  .footer-grid { grid-template-columns: 1fr; }
  .input-row { grid-template-columns: 1fr; }
}

/* Keyboard focus: a visible ring in this app's accent on every interactive element (fleet focus-visible pass). */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Skip link: the first Tab stop on the page — parked off-screen until keyboard focus reveals it (fleet skip-link pass). */
.skip-link { position: absolute; left: 12px; top: -64px; z-index: 1000; padding: 10px 16px; border: 2px solid var(--gold); border-radius: 8px; background: #0b0e14; color: var(--gold); font-weight: 700; text-decoration: none; transition: top .15s ease; }
.skip-link:focus-visible { top: 12px; }
main:focus { outline: none; }

/* Reduced motion: when the OS asks for reduced motion, animations and transitions finish near-instantly and scrolling is not smoothed (fleet reduced-motion pass). Near-zero durations — not animation: none — so fade-ins still land on their end state and no content can be stranded invisible. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
