/* PitchPhysics — style.css
   Monochrome glass. Editorial precision.
   Cormorant Garamond + DM Mono.
   Gold appears only on physics insight moments.
*/

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=DM+Mono:wght@300;400;500&display=swap');

/* ==========================================================
   TOKENS
   ========================================================== */
:root {
  --bg:           #080808;
  --bg-deep:      #040404;
  --glass:        rgba(255,255,255,0.04);
  --glass-hover:  rgba(255,255,255,0.07);
  --glass-active: rgba(255,255,255,0.10);
  --border:       rgba(255,255,255,0.06);
  --border-light: rgba(255,255,255,0.12);
  --white:        #f0f0f0;
  --muted:        rgba(240,240,240,0.4);
  --faint:        rgba(240,240,240,0.15);
  --gold:         #c8a96e;
  --gold-glow:    rgba(200,169,110,0.15);
  --red:          rgba(255,80,80,0.8);
  --green:        rgba(80,200,120,0.8);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;
  --blur:         blur(20px);
  --blur-heavy:   blur(40px);
  --radius:       12px;
  --radius-sm:    8px;
  --transition:   0.2s ease;
}

/* ==========================================================
   RESET + BASE
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 0.875rem;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient background grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(255,255,255,0.015) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(200,169,110,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================
   TYPOGRAPHY
   ========================================================== */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }
h4 { font-size: 1rem; font-weight: 400; }

.label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.gold { color: var(--gold); }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }

/* ==========================================================
   LAYOUT
   ========================================================== */
.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 0 80px 0; /* bottom nav space */
}

.page {
  padding: 24px 20px;
  display: none;
  animation: fadeIn 0.3s ease;
}
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================
   GLASS CARD
   ========================================================== */
.card {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  transition: background var(--transition), border-color var(--transition);
}

.card:hover {
  background: var(--glass-hover);
  border-color: var(--border-light);
}

.card.gold-border {
  border-color: rgba(200,169,110,0.3);
  background: linear-gradient(135deg, var(--glass), rgba(200,169,110,0.04));
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* ==========================================================
   INPUTS + FORMS
   ========================================================== */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  -webkit-appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--border-light);
  background: rgba(255,255,255,0.05);
}

input::placeholder,
textarea::placeholder { color: var(--faint); }

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

select option { background: #1a1a1a; }

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition);
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--white);
  color: var(--bg);
  font-weight: 500;
}
.btn-primary:hover { background: rgba(240,240,240,0.85); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  background: var(--glass);
  color: var(--white);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--glass-hover);
  border-color: var(--border-light);
}

.btn-gold {
  background: linear-gradient(135deg, #c8a96e, #a88040);
  color: #080808;
  font-weight: 500;
}
.btn-gold:hover { opacity: 0.9; }

.btn-danger {
  background: rgba(255,80,80,0.12);
  color: var(--red);
  border: 1px solid rgba(255,80,80,0.2);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.75rem;
  width: auto;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ==========================================================
   VOICE RECORDING BUTTON
   ========================================================== */
.record-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  margin: 0 auto;
  -webkit-tap-highlight-color: transparent;
}

.record-btn .dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  transition: all var(--transition);
}

.record-btn.recording {
  border-color: rgba(255,80,80,0.4);
  background: rgba(255,80,80,0.08);
  animation: pulse-ring 1.5s ease infinite;
}

.record-btn.recording .dot {
  background: var(--red);
  border-radius: 4px;
  width: 14px;
  height: 14px;
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(255,80,80,0.2); }
  70%  { box-shadow: 0 0 0 16px rgba(255,80,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,80,80,0); }
}

/* ==========================================================
   PROGRESS + INDICATORS
   ========================================================== */
.progress-bar {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  background: var(--white);
  border-radius: 1px;
  transition: width 0.4s ease;
}

.progress-fill.gold { background: var(--gold); }

/* Step indicator */
.step-indicator {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}

.step-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--faint);
  transition: all var(--transition);
}
.step-dot.active { background: var(--white); width: 16px; border-radius: 2px; }
.step-dot.done   { background: var(--gold); }

/* ==========================================================
   PHYSICS METRIC DISPLAY
   ========================================================== */
.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.metric-row:last-child { border-bottom: none; }

.metric-label { color: var(--muted); font-size: 0.75rem; }

.metric-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--white);
}

.metric-value.gold { color: var(--gold); }

/* Entropy timeline bar */
.entropy-bar {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 40px;
  margin: 12px 0;
}

.entropy-segment {
  flex: 1;
  border-radius: 2px 2px 0 0;
  background: var(--faint);
  transition: all 0.4s ease;
  min-height: 4px;
}

.entropy-segment.stable  { background: rgba(240,240,240,0.3); }
.entropy-segment.shift   { background: var(--gold); }
.entropy-segment.recover { background: rgba(240,240,240,0.5); }

/* ==========================================================
   QUESTION DISPLAY (interview mode)
   ========================================================== */
.question-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 20px;
}

.question-number {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.question-text {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 300;
  line-height: 1.4;
  color: var(--white);
  font-style: italic;
}

/* ==========================================================
   ALERT / TOAST
   ========================================================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-bottom: 12px;
  border: 1px solid;
}

.alert-error {
  background: rgba(255,80,80,0.08);
  border-color: rgba(255,80,80,0.2);
  color: #ff7070;
}

.alert-success {
  background: rgba(80,200,120,0.08);
  border-color: rgba(80,200,120,0.2);
  color: #60c87a;
}

.alert-info {
  background: var(--glass);
  border-color: var(--border-light);
  color: var(--muted);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20,20,20,0.95);
  border: 1px solid var(--border-light);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.8rem;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  z-index: 1000;
  backdrop-filter: var(--blur);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================
   BOTTOM NAV
   ========================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(8,8,8,0.9);
  backdrop-filter: var(--blur-heavy);
  -webkit-backdrop-filter: var(--blur-heavy);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition);
  color: rgba(240,240,240,0.5);
  text-decoration: none;
}

.nav-item.active { color: var(--white); }
.nav-item.active .nav-icon { opacity: 1; }

.nav-icon {
  width: 22px;
  height: 22px;
  opacity: 0.75;
  transition: opacity var(--transition);
}

.nav-label {
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ==========================================================
   TOP HEADER
   ========================================================== */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
  margin-bottom: 4px;
}

.app-wordmark {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--white);
}

.app-wordmark span { color: var(--gold); }

/* ==========================================================
   STATUS PILL
   ========================================================== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--muted);
}

.pill::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
}

.pill.active { color: var(--green); border-color: rgba(80,200,120,0.2); }
.pill.active::before { background: var(--green); }
.pill.gold   { color: var(--gold);  border-color: rgba(200,169,110,0.25); }
.pill.gold::before   { background: var(--gold); }

/* ==========================================================
   DIVIDER
   ========================================================== */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--faint);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

/* ==========================================================
   LOADING
   ========================================================== */
.spinner {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--faint);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,8,0.7);
  backdrop-filter: var(--blur);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 500;
  display: none;
}

.loading-overlay.show { display: flex; }

.loading-text {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

/* ==========================================================
   PHYSICS REPORT SPECIFIC
   ========================================================== */
.report-section {
  margin-bottom: 24px;
}

.report-section-title {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(200,169,110,0.15);
}

.report-body {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.7;
  color: rgba(240,240,240,0.85);
}

/* Entropy flip highlight */
.entropy-flip-moment {
  background: var(--gold-glow);
  border-left: 2px solid var(--gold);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 12px 0;
}

/* ==========================================================
   ONBOARDING SPECIFIC
   ========================================================== */
.onboard-hero {
  text-align: center;
  padding: 48px 24px 32px;
}

.onboard-hero h1 {
  margin-bottom: 12px;
}

.onboard-hero .subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 320px;
  margin: 0 auto;
}

/* ==========================================================
   SCROLLBAR
   ========================================================== */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* ==========================================================
   SAFE AREA + MOBILE
   ========================================================== */
@supports (padding: max(0px)) {
  .bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* Larger screens — center the app */
@media (min-width: 520px) {
  body { display: flex; justify-content: center; }
  .bottom-nav { border-radius: 0; }
}