:root {
  --bg: #08090A;
  --text-1: rgba(255, 255, 255, 0.95);
  --text-2: rgba(255, 255, 255, 0.62);
  --text-3: rgba(255, 255, 255, 0.38);
  --line-1: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.10);
  --surface-1: rgba(255, 255, 255, 0.02);
  --accent: #2DD4BF;
  --warn: #FB923C;
  --warn-text: rgb(253, 186, 116);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Typography system */
.display { letter-spacing: -0.04em; font-weight: 600; }
.heading { letter-spacing: -0.02em; font-weight: 600; }
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.eyebrow-accent { color: var(--accent); }
.eyebrow-warn { color: rgba(251, 146, 60, 0.75); }
.eyebrow-dim { color: rgba(255, 255, 255, 0.32); }

.text-secondary { color: var(--text-2); }
.text-tertiary { color: var(--text-3); }
.text-warn { color: var(--warn-text); }
.tabular { font-variant-numeric: tabular-nums; }

/* Surfaces & borders */
.border-subtle { border-color: var(--line-1); }
.border-mid { border-color: var(--line-2); }
.surface { background: var(--surface-1); border: 1px solid var(--line-1); }
.surface-hover { transition: background .2s ease, border-color .2s ease; }
.surface-hover:hover { background: rgba(255, 255, 255, 0.035); border-color: var(--line-2); }

.surface-faint { background: rgba(255, 255, 255, 0.015); }
.surface-fainter { background: rgba(255, 255, 255, 0.012); }

/* Hero gradient orb */
.orb {
  position: absolute;
  width: 720px;
  height: 720px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(45, 212, 191, 0.18) 0%, rgba(45, 212, 191, 0.05) 32%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

/* Status pills */
.pill-risk {
  background: rgba(251, 146, 60, 0.10);
  color: var(--warn-text);
  border: 1px solid rgba(251, 146, 60, 0.25);
}

/* Pulsing dot — the at-risk live indicator */
.dot { display: inline-block; border-radius: 9999px; }
.dot-warn { background: var(--warn); }
.dot-on { background: rgba(255, 255, 255, 0.35); }
.dot-off { background: rgba(255, 255, 255, 0.10); }
.dot-pulse { animation: pulse 2.4s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Scroll fade-in */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* Sticky nav background */
.nav-bg {
  background: rgba(8, 9, 10, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Buttons */
.btn-primary {
  background: white;
  color: var(--bg);
  font-weight: 500;
  transition: opacity .15s ease;
}
.btn-primary:hover { opacity: 0.88; }

.btn-ghost {
  color: var(--text-2);
  transition: color .15s ease;
}
.btn-ghost:hover { color: var(--text-1); }

/* Keyboard hints */
kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-2);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Timeline rail */
.tl-rail {
  background: linear-gradient(to bottom, rgba(255,255,255,0.18), rgba(255,255,255,0.02));
}

/* Inputs */
.input {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-2);
  color: var(--text-1);
  transition: border-color .15s ease, background-color .15s ease;
}
.input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.30);
  background-color: rgba(255, 255, 255, 0.06);
}
.input::placeholder { color: var(--text-3); }

/* Hairline grid divider used by 2-up and 3-up panels */
.grid-divider { background: var(--line-1); }

/* Product mock shadow */
.mock-shadow { box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.5); }

/* Lucide sizing helpers — lucide injects width/height attrs at 24px,
   we use CSS to override consistently across icons */
.icon-3 { width: 12px; height: 12px; }
.icon-4 { width: 16px; height: 16px; }
.icon-5 { width: 20px; height: 20px; }

/* ── Light theme ─────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #F8F9FA;
  --text-1: rgba(8, 9, 10, 0.92);
  --text-2: rgba(8, 9, 10, 0.65);
  --text-3: rgba(8, 9, 10, 0.46);
  --line-1: rgba(8, 9, 10, 0.07);
  --line-2: rgba(8, 9, 10, 0.12);
  --surface-1: rgba(8, 9, 10, 0.025);
  --accent: #0D9488;
  --warn: #EA580C;
  --warn-text: #C2410C;
}

[data-theme="light"] .nav-bg {
  background: rgba(248, 249, 250, 0.88);
}

[data-theme="light"] .bg-ink-950 {
  background-color: #FFFFFF !important;
}

[data-theme="light"] .btn-primary {
  background: #08090A;
  color: #FFFFFF;
}

[data-theme="light"] .orb {
  background: radial-gradient(circle at center, rgba(13, 148, 136, 0.10) 0%, rgba(13, 148, 136, 0.03) 32%, transparent 70%);
}

[data-theme="light"] .surface-faint  { background: rgba(8, 9, 10, 0.02); }
[data-theme="light"] .surface-fainter { background: rgba(8, 9, 10, 0.015); }
[data-theme="light"] .surface-hover:hover { background: rgba(8, 9, 10, 0.02); }

[data-theme="light"] .tl-rail {
  background: linear-gradient(to bottom, rgba(8, 9, 10, 0.18), rgba(8, 9, 10, 0.02));
}

[data-theme="light"] .dot-on  { background: rgba(8, 9, 10, 0.32); }
[data-theme="light"] .dot-off { background: rgba(8, 9, 10, 0.10); }

[data-theme="light"] .pill-risk {
  background: rgba(234, 88, 12, 0.08);
  color: #C2410C;
  border-color: rgba(234, 88, 12, 0.22);
}

[data-theme="light"] .eyebrow-dim  { color: rgba(8, 9, 10, 0.42); }
[data-theme="light"] .eyebrow-warn { color: rgba(194, 65, 12, 0.85); }

[data-theme="light"] .mock-shadow {
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] kbd {
  background: rgba(8, 9, 10, 0.05);
  border-color: var(--line-2);
  color: var(--text-2);
}

[data-theme="light"] .input {
  background-color: rgba(8, 9, 10, 0.04);
  border-color: var(--line-2);
}
[data-theme="light"] .input:focus {
  border-color: rgba(8, 9, 10, 0.30);
  background-color: rgba(8, 9, 10, 0.06);
}

/* Native <select> normalization — strip OS chevron, add a themed one inline.
   The dropdown OPTION list is still OS-native (browsers don't allow restyling
   that without third-party libs); colors below cover the most common cases. */
select.input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.6)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 0.875rem;
  padding-right: 2.5rem;
}
[data-theme="light"] select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(8,9,10,0.6)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
select.input option {
  background: #08090A;
  color: rgba(255, 255, 255, 0.95);
}
[data-theme="light"] select.input option {
  background: #FFFFFF;
  color: rgba(8, 9, 10, 0.92);
}

/* ── Hero phone mockup ──────────────────────────────────────────────────── */
.phone-frame {
  width: 280px;
  max-width: 78vw;
  aspect-ratio: 9 / 19;
  margin-inline: auto;
  padding: 10px;
  border-radius: 38px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.5),
              inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  position: relative;
}
[data-theme="light"] .phone-frame {
  background: rgba(8, 9, 10, 0.04);
  box-shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.18),
              inset 0 0 0 1px rgba(8, 9, 10, 0.04);
}
.phone-frame::after {
  content: "";
  position: absolute;
  bottom: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
}
[data-theme="light"] .phone-frame::after {
  background: rgba(8, 9, 10, 0.22);
}
.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 28px;
  background: #0B0C0D;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
[data-theme="light"] .phone-screen { background: #FFFFFF; }

/* Sliding content area — three panels cycle in lockstep with the bottom-tab
   indicator below. Same timing keyframes for both. ≈5.5s view + ≈0.6s slide. */
.phone-stack {
  display: flex;
  width: 300%;
  flex: 1 1 auto;
  min-height: 0;
  animation: phone-slide 18s infinite cubic-bezier(0.85, 0, 0.15, 1);
}
.phone-panel {
  width: 33.3333%;
  flex-shrink: 0;
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--text-2);
  overflow: hidden;
}
@keyframes phone-slide {
  0%, 30%       { transform: translateX(0); }
  33.33%, 63.33% { transform: translateX(-33.3333%); }
  66.66%, 96.66% { transform: translateX(-66.6666%); }
  100%          { transform: translateX(0); }
}

/* Per-screen title at the top of each panel */
.phone-screen-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 2px;
}

/* Mature Home header (mirrors ScreenHeader.tsx + the across-workspaces eyebrow row) */
.phone-ws-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 9px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.06em;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.025);
}
[data-theme="light"] .phone-ws-pill { background: rgba(8, 9, 10, 0.025); }
.phone-ws-pill-caret { color: var(--text-3); font-size: 9px; }
.phone-display-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-1);
  line-height: 1.05;
  margin-top: 2px;
}
.phone-subtitle {
  font-size: 10px;
  color: var(--text-2);
  line-height: 1.35;
  margin-bottom: 4px;
}
.phone-eyebrow-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 0.1em;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text-3);
  margin-top: 2px;
  margin-bottom: 2px;
}

/* Timeline filter chip row (mirrors timeline.tsx horizontal pill scroller) */
.phone-filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 2px 0 4px;
}
.phone-filter-row::-webkit-scrollbar { display: none; }
.phone-filter-chip {
  flex-shrink: 0;
  padding: 4px 9px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 9px;
  color: var(--text-2);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.04em;
}
.phone-filter-chip-active {
  border-color: rgba(20, 184, 166, 0.55);
  background: rgba(20, 184, 166, 0.10);
  color: rgb(20, 184, 166);
}
[data-theme="light"] .phone-filter-chip-active {
  border-color: rgba(13, 148, 136, 0.55);
  background: rgba(13, 148, 136, 0.10);
  color: #0D9488;
}

/* Settings panel — section eyebrows + grouped rows + faux toggles */
.phone-section-eyebrow {
  font-size: 9px;
  letter-spacing: 0.12em;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text-3);
  margin-top: 4px;
  margin-bottom: 4px;
}
.phone-section-eyebrow:first-of-type { margin-top: 0; }
.phone-settings-group {
  border: 1px solid var(--line-2);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 4px;
}
[data-theme="light"] .phone-settings-group { background: rgba(8, 9, 10, 0.02); }
.phone-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  font-size: 11px;
  color: var(--text-1);
  border-bottom: 1px solid var(--line-1);
}
.phone-settings-row:last-child { border-bottom: none; }
.phone-settings-trail {
  font-size: 10px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.phone-settings-link { color: rgb(20, 184, 166); }
[data-theme="light"] .phone-settings-link { color: #0D9488; }
.phone-settings-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.phone-settings-sub {
  font-size: 10px;
  color: var(--text-3);
}

/* Sign out button (mirrors settings.tsx — centered, outlined, danger color) */
.phone-signout {
  margin-top: 6px;
  padding: 9px 0;
  text-align: center;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: rgb(248, 113, 113);
}
[data-theme="light"] .phone-signout { color: #DC2626; }
.phone-toggle {
  display: inline-block;
  width: 26px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  flex-shrink: 0;
}
[data-theme="light"] .phone-toggle { background: rgba(8, 9, 10, 0.14); }
.phone-toggle::after {
  content: "";
  position: absolute;
  top: 1.5px;
  left: 1.5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #FFFFFF;
  transition: transform .2s;
}
.phone-toggle-on { background: rgb(20, 184, 166); }
[data-theme="light"] .phone-toggle-on { background: #0D9488; }
.phone-toggle-on::after { transform: translateX(12px); }

/* Workspace switcher cards (mirrors WorkspaceSummaryCard.tsx) */
.phone-ws-card {
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: rgba(255, 255, 255, 0.02);
}
[data-theme="light"] .phone-ws-card { background: rgba(8, 9, 10, 0.02); }
.phone-ws-card-active { border-color: rgba(20, 184, 166, 0.55); }
[data-theme="light"] .phone-ws-card-active { border-color: rgba(13, 148, 136, 0.55); }
.phone-ws-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.phone-ws-name { font-size: 12px; font-weight: 600; color: var(--text-1); }
.phone-ws-role { font-size: 10px; color: var(--text-2); margin-top: 1px; }
.phone-ws-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-size: 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text-2);
  gap: 0;
}
.phone-ws-stats b { color: var(--text-1); font-weight: 600; }
.phone-stat-warn { color: rgb(234, 88, 12); }
[data-theme="light"] .phone-stat-warn { color: #C2410C; }
.phone-dot { color: var(--text-3); margin: 0 6px; }

/* People list rows (mirrors mobile/app/(tabs)/people.tsx) */
.phone-person-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line-1);
}
.phone-person-row:last-child { border-bottom: none; }
.phone-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(20, 184, 166, 0.12);
  color: rgb(20, 184, 166);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  flex-shrink: 0;
}
[data-theme="light"] .phone-avatar { background: rgba(13, 148, 136, 0.12); color: #0D9488; }
.phone-person-body { flex: 1 1 auto; min-width: 0; }
.phone-person-name { font-size: 12px; color: var(--text-1); font-weight: 500; }
.phone-person-title { font-size: 10px; color: var(--text-2); margin-top: 1px; }
.phone-person-count {
  font-size: 11px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text-2);
}

/* Bottom tab bar — matches mobile/app/(tabs)/_layout.tsx (Home ◐ Timeline ≡
   People ◍ Settings ✦) with a sliding indicator above the active tab. The
   indicator visits the first three tabs; Settings stays unhighlighted since
   the demo cycle doesn't visit it. */
.phone-bottom-tabs {
  position: relative;
  display: flex;
  border-top: 1px solid var(--line-2);
  flex-shrink: 0;
  padding: 8px 0 12px;
}
.phone-bottom-tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.phone-bottom-glyph { font-size: 16px; line-height: 1; }
.phone-bottom-label { font-size: 9px; }
.phone-bottom-tab-1 { animation: phone-tab-active-1 18s infinite; }
.phone-bottom-tab-2 { animation: phone-tab-active-2 18s infinite; }
.phone-bottom-tab-3 { animation: phone-tab-active-3 18s infinite; }
@keyframes phone-tab-active-1 {
  0%, 30%       { color: rgb(20, 184, 166); }
  33.34%, 100% { color: var(--text-3); }
}
@keyframes phone-tab-active-2 {
  0%, 30%       { color: var(--text-3); }
  33.33%, 63.33% { color: rgb(20, 184, 166); }
  63.34%, 100% { color: var(--text-3); }
}
@keyframes phone-tab-active-3 {
  0%, 63.33%       { color: var(--text-3); }
  66.66%, 96.66% { color: rgb(20, 184, 166); }
  96.67%, 100% { color: var(--text-3); }
}
.phone-bottom-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 25%;
  height: 2px;
  background: rgb(20, 184, 166);
  border-radius: 2px;
  animation: phone-bottom-slide 18s infinite cubic-bezier(0.85, 0, 0.15, 1);
}
[data-theme="light"] .phone-bottom-indicator { background: #0D9488; }
@keyframes phone-bottom-slide {
  0%, 30%       { transform: translateX(0); }       /* Home (1st of 4) */
  33.33%, 63.33% { transform: translateX(100%); }   /* Timeline (2nd) */
  66.66%, 96.66% { transform: translateX(300%); }   /* Settings (4th) — skips People */
  100%          { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .phone-stack,
  .phone-bottom-indicator,
  .phone-bottom-tab-1,
  .phone-bottom-tab-2,
  .phone-bottom-tab-3 { animation: none; }
}

/* Mock content classes used inside .phone-panel */
.phone-eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.phone-card {
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
[data-theme="light"] .phone-card { background: rgba(8, 9, 10, 0.02); }
.phone-card-title {
  color: var(--text-1);
  font-size: 11px;
  line-height: 1.35;
}
.phone-card-meta {
  color: var(--text-3);
  font-size: 9px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.phone-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.phone-pill-ok   { color: rgb(20, 184, 166); border-color: rgba(20, 184, 166, 0.35); }
.phone-pill-warn { color: rgb(234, 88, 12);  border-color: rgba(234, 88, 12, 0.35); }
[data-theme="light"] .phone-pill-ok   { color: #0D9488; border-color: rgba(13, 148, 136, 0.35); }
[data-theme="light"] .phone-pill-warn { color: #C2410C; border-color: rgba(234, 88, 12, 0.35); }

/* Hide the mock on the very narrowest phones — keeps the hero readable */
@media (max-width: 360px) {
  .phone-frame { display: none; }
}

/* Theme toggle button visibility */
.theme-icon-dark  { display: inline-flex; }
.theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark  { display: none; }
[data-theme="light"] .theme-icon-light { display: inline-flex; }
