/* SmartPropFact shell — the chrome every screen shares (Arc 1 Task 1, spec §2).
   Tokens only (tokens.css): no hex, no Tailwind. Loads BEFORE the Tailwind Play
   CDN, whose preflight (element selectors) therefore sits later in the cascade —
   every rule here is class-qualified so it wins by specificity, and the resets
   below cover the preflight declarations that would otherwise reach the bar
   (button background/border, svg display, box-sizing). Dark mode comes from the
   tokens' :root[data-theme="dark"] block; [data-theme] selectors appear here
   ONLY where DESIGN.md says a shadow/hairline differs. */

/* ---------- ground ---------- */
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* the rendered surface clears the floating bar (16px float + 64px bar + breathing room) */
#root {
  min-height: 80vh;
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

/* ---------- header: brand only ---------- */
.spf-header {
  background: var(--surface);
  box-shadow: 0 1px 0 var(--hairline);
}
.spf-header-inner {
  max-width: 48rem;
  margin: 0 auto;
  padding: var(--sp-3) var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.spf-brand {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* ---------- floating pill tab bar: 5 slots, raised camera in the middle ---------- */
.spf-tabbar * {
  box-sizing: border-box;
}
.spf-tabbar {
  box-sizing: border-box;
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  max-width: 440px;
  margin: 0 auto;
  height: 64px;
  padding: 6px;
  border-radius: var(--r-tabbar);
  background: var(--tabbar-bg);
  color: var(--tabbar-icon);
  display: flex;
  align-items: center;
  z-index: 40;
  box-shadow:
    0 16px 36px color-mix(in srgb, var(--text) 30%, transparent),
    0 2px 6px color-mix(in srgb, var(--text) 18%, transparent);
}
:root[data-theme="dark"] .spf-tabbar {
  box-shadow:
    0 16px 36px color-mix(in srgb, var(--bg) 50%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--tabbar-icon) 8%, transparent);
}
/* the shell's own hidden state (app.js toggles .hidden until sign-in) — must
   not depend on Tailwind's .hidden surviving the CDN's removal */
.spf-tabbar.hidden,
.spf-tabbar[hidden] {
  display: none;
}
.spf-tabbar .spf-tab-group {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.spf-tabbar .spf-tab-mid {
  flex: none;
  width: 60px;
}
.spf-tabbar .spf-tab {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  background-image: none;
  font: inherit;
  font-family: var(--font-sans);
  cursor: pointer;
  height: 52px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 26px;
  color: var(--tabbar-icon);
  opacity: 0.72;
  white-space: nowrap;
  transition: opacity 200ms ease-out, background-color 200ms ease-out;
}
.spf-tabbar .spf-tab svg,
.spf-tabbar .spf-capture svg {
  display: block;
  width: 22px;
  height: 22px;
  flex: none;
  pointer-events: none;
}
.spf-tabbar .spf-tab-label {
  display: none;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: -0.005em;
  word-break: keep-all;
}
/* the active item = white pill with icon + label (DESIGN.md §Layout) */
.spf-tabbar .spf-tab[data-selected] {
  background: var(--tabbar-active-bg);
  color: var(--tabbar-active-text);
  opacity: 1;
  padding: 0 12px 0 10px;
}
.spf-tabbar .spf-tab[data-selected] .spf-tab-label {
  display: inline;
}
.spf-tabbar .spf-tab:focus-visible,
.spf-tabbar .spf-capture:focus-visible {
  outline: 2px solid var(--tabbar-active-bg);
  outline-offset: 2px;
}
/* raised capture button: 52px --tint circle overhanging the pill by ~10px */
.spf-tabbar .spf-capture {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--on-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 4px var(--bg),
    0 10px 24px color-mix(in srgb, var(--text) 30%, transparent);
}
:root[data-theme="dark"] .spf-tabbar .spf-capture {
  box-shadow:
    0 0 0 4px var(--bg),
    0 10px 24px color-mix(in srgb, var(--bg) 55%, transparent);
}
.spf-tabbar .spf-capture svg {
  width: 24px;
  height: 24px;
}
@media (prefers-reduced-motion: reduce) {
  .spf-tabbar .spf-tab { transition: none; }
}
