/* ─────────────────────────────────────────────────────
   Oloxa Context Intake — design system (light)
   White canvas · Blue accent (#0099ff, brand web color)
   Satoshi headlines + Inter body · mobile-first
   Brand source: claude-code-os/12-media/BRAND_GUIDELINES.md
   ───────────────────────────────────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surfaces */
  --bg:           #ffffff;
  --bg-1:         #fafafa;
  --bg-2:         #f4f4f5;
  --bg-3:         #ececef;

  /* Borders */
  --line:         rgba(13,13,13,0.08);
  --line-strong:  rgba(13,13,13,0.16);
  --line-accent:  rgba(0,153,255,0.4);

  /* Text — near-black per brand */
  --text:         #0d0d0d;
  --text-2:       rgba(13,13,13,0.68);
  --text-3:       rgba(13,13,13,0.48);
  --text-disabled:rgba(13,13,13,0.28);

  /* Accent — Oloxa brand BLUE (web color) */
  --blue:         #0099ff;
  --blue-2:       #33adff;
  --blue-deep:    #0077cc;
  --blue-glow:    rgba(0,153,255,0.32);
  --blue-bg:      rgba(0,153,255,0.08);

  /* Status — colorblind-safe (only paired with icon + text) */
  --emerald:      #10b981;
  --rose:         #f43f5e;
  --rose-bg:      rgba(244,63,94,0.08);
  --rose-line:    rgba(244,63,94,0.3);

  /* Geometry */
  --radius:       14px;
  --radius-sm:    10px;
  --radius-pill:  999px;

  /* Type — per BRAND_GUIDELINES.md */
  --font-display: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-body);
  font-feature-settings: 'cv11','ss01';
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Ambient blue wash + dot grid (decorative) */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 30%, var(--blue-glow) 0%, transparent 60%),
    radial-gradient(circle, rgba(13,13,13,0.04) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px;
  background-position: center, 0 0;
  opacity: 0.18;
  transition: opacity 0.6s ease;
}

body.is-recording .ambient {
  opacity: 0.35;
  animation: ambient-breathe 3s ease-in-out infinite;
}

@keyframes ambient-breathe {
  0%, 100% { opacity: 0.28; }
  50%      { opacity: 0.42; }
}

::selection { background: var(--blue); color: #fff; }

/* ─────────────────────────────────────────────────────
   Layout
   ───────────────────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 28px 28px 40px;
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────────────────
   Header (logo + progress bar)
   ───────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 0 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 36px;
}

.logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.logo-img {
  height: 32px;
  width: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.progress-bar {
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-deep), var(--blue) 50%, var(--blue-2));
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
  box-shadow: 0 0 10px var(--blue-glow);
}

.progress-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: right;
}

/* ─────────────────────────────────────────────────────
   Screens (transitions)
   ───────────────────────────────────────────────────── */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  animation: screen-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active { display: flex; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────────────
   Welcome screen
   ───────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 18px;
}

.screen-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 14px;
  color: var(--text);
}

.screen-title-secondary {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.screen-subtitle {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 36px;
  max-width: 44ch;
  font-weight: 400;
}

.client-name {
  color: var(--blue);
  font-weight: 500;
}

/* Fields */
.fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 28px;
}

.field { width: 100%; }

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
  appearance: none;
}

.field input:hover { border-color: var(--line-strong); }

.field input:focus {
  outline: none;
  border-color: var(--line-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,153,255,0.10);
}

.field input::placeholder { color: var(--text-disabled); }

/* ─────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 16px 22px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: background 0.18s, color 0.18s, opacity 0.15s, transform 0.1s, box-shadow 0.2s, border-color 0.18s;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.985); }

.btn-primary {
  background: var(--blue);
  color: #fff;
  width: 100%;
  margin-top: auto;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 8px 22px -8px var(--blue-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--blue-2);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 12px 32px -8px var(--blue-glow);
}

.btn-primary:disabled {
  background: var(--bg-2);
  color: var(--text-disabled);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary:disabled svg { opacity: 0.4; }

.btn-secondary {
  background: transparent;
  color: var(--text-2);
  width: 100%;
  border: 1px solid var(--line-strong);
  margin-top: 10px;
}

.btn-secondary:hover {
  background: var(--bg-1);
  color: var(--text);
  border-color: var(--text-3);
}

.btn-next { margin-top: 22px; }

/* ─────────────────────────────────────────────────────
   Question screen
   ───────────────────────────────────────────────────── */
.section-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: 22px;
  padding: 6px 12px 6px 11px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  width: max-content;
  text-transform: uppercase;
}

.section-badge::first-letter { color: var(--blue); font-size: 14px; }

.question-text {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
  color: var(--text);
}

.question-hint {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-3);
  line-height: 1.55;
  margin-bottom: 28px;
}

/* ─────────────────────────────────────────────────────
   Record button (the hero)
   ───────────────────────────────────────────────────── */
.record-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 28px 0 24px;
  position: relative;
}

.record-btn {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 36px;
  line-height: 1;
  font-weight: 400;
  background:
    radial-gradient(circle at 50% 30%, #ffffff 0%, var(--bg-1) 80%);
  color: var(--blue);
  position: relative;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.2s,
    background 0.2s,
    color 0.2s,
    box-shadow 0.25s;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.6),
    0 6px 18px -6px rgba(13,13,13,0.16);
}

/* Outer ring (idle state) */
.record-btn::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid var(--blue);
  opacity: 0.22;
  transition: inset 0.3s ease, opacity 0.3s ease, border-color 0.2s;
  pointer-events: none;
}

.record-btn::after {
  content: '';
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  border: 1px solid var(--blue);
  opacity: 0;
  transition: inset 0.4s ease, opacity 0.4s ease;
  pointer-events: none;
}

.record-btn:hover {
  transform: translateY(-2px);
  border-color: var(--line-accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.7),
    0 16px 36px -8px rgba(13,13,13,0.2),
    0 0 32px -8px var(--blue-glow);
}
.record-btn:hover::before { opacity: 0.4; inset: -12px; }
.record-btn:hover::after  { opacity: 0.15; inset: -24px; }

/* Recording state */
.record-btn.recording {
  background: linear-gradient(160deg, var(--blue-2), var(--blue-deep));
  color: #fff;
  font-size: 26px;
  border-color: var(--blue);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 8px 32px -4px var(--blue-glow);
  animation: record-pulse 1.7s ease-in-out infinite;
}

.record-btn.recording::before {
  border-color: var(--blue);
  opacity: 0.5;
  animation: record-halo-1 1.7s ease-out infinite;
}

.record-btn.recording::after {
  border-color: var(--blue);
  opacity: 0.3;
  animation: record-halo-2 1.7s ease-out infinite;
}

@keyframes record-pulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 0 0 0 var(--blue-glow), 0 8px 32px -4px var(--blue-glow); }
  50%      { box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 0 0 12px transparent, 0 12px 48px -2px var(--blue-glow); }
}

@keyframes record-halo-1 {
  0%   { inset: -10px; opacity: 0.5; }
  100% { inset: -28px; opacity: 0; }
}

@keyframes record-halo-2 {
  0%   { inset: -16px; opacity: 0.3; }
  100% { inset: -40px; opacity: 0; }
}

.record-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: center;
  min-height: 18px;
  text-transform: uppercase;
}

.record-status.recording {
  color: var(--blue);
}

/* Waveform (CSS-driven) */
.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.waveform.active { opacity: 1; }

.waveform-bar {
  width: 3px;
  background: var(--blue);
  border-radius: 2px;
  animation: wave 0.95s ease-in-out infinite;
  min-height: 4px;
  box-shadow: 0 0 6px var(--blue-glow);
}

.waveform-bar:nth-child(1) { animation-delay: 0s;    }
.waveform-bar:nth-child(2) { animation-delay: 0.10s; }
.waveform-bar:nth-child(3) { animation-delay: 0.20s; }
.waveform-bar:nth-child(4) { animation-delay: 0.30s; }
.waveform-bar:nth-child(5) { animation-delay: 0.40s; }
.waveform-bar:nth-child(6) { animation-delay: 0.30s; }
.waveform-bar:nth-child(7) { animation-delay: 0.20s; }
.waveform-bar:nth-child(8) { animation-delay: 0.10s; }

@keyframes wave {
  0%, 100% { height: 4px; }
  50%      { height: 24px; }
}

/* ─────────────────────────────────────────────────────
   Playback panel (after recording)
   ───────────────────────────────────────────────────── */
.playback-area {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.playback-area.visible { display: flex; }

.playback-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.playback-btn:hover { background: var(--blue-2); }
.playback-btn:active { transform: scale(0.94); }

.playback-label {
  font-size: 13px;
  color: var(--text-2);
  flex: 1;
}

.playback-redo {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.playback-redo:hover {
  color: var(--blue);
  background: var(--blue-bg);
}

/* Uploading state */
.uploading-msg {
  display: none;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-2);
  padding: 16px 0 4px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.uploading-msg.visible { display: flex; }

.spinner {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--line-strong);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* ─────────────────────────────────────────────────────
   Stage screens (core-complete · done · error)
   ───────────────────────────────────────────────────── */
.screen-stage {
  text-align: center;
  align-items: center;
  justify-content: center;
  padding-top: 20px;
}

.screen-stage .screen-subtitle {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 28px;
}

.stage-icon {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 12px auto 28px;
  border: 1px solid var(--line-accent);
  border-radius: 50%;
  background: var(--blue-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.5),
    0 0 36px -10px var(--blue-glow);
}

.stage-icon::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px solid var(--blue);
  opacity: 0.22;
}

.stage-icon-error {
  border-color: var(--rose-line);
  background: var(--rose-bg);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.5),
    0 0 36px -10px rgba(244,63,94,0.4);
}

.stage-icon-error::before { border-color: var(--rose); opacity: 0.22; }

/* Custom icons (replace emoji) */
.checkmark, .done-icon, .error-icon { display: inline-block; position: relative; }

.checkmark {
  width: 22px; height: 12px;
  transform: translateY(-3px) rotate(-45deg);
  border-left: 2.5px solid var(--blue);
  border-bottom: 2.5px solid var(--blue);
  border-radius: 1px;
}

.done-icon {
  width: 22px; height: 12px;
  transform: translateY(-3px) rotate(-45deg);
  border-left: 2.5px solid var(--blue);
  border-bottom: 2.5px solid var(--blue);
  border-radius: 1px;
}

.error-icon {
  width: 3px;
  height: 22px;
  background: var(--rose);
  border-radius: 2px;
  transform: translateY(-1px);
}

.error-icon::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  background: var(--rose);
  border-radius: 50%;
}

/* Stage-screen actions stack */
.stage-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  margin-top: auto;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 32px 0 28px;
  width: 100%;
}

/* ─────────────────────────────────────────────────────
   Footer wordmark
   ───────────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-disabled);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────
   Toast
   ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  box-shadow: 0 16px 40px -8px rgba(13,13,13,0.4);
}

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

/* ─────────────────────────────────────────────────────
   Mobile (< 480px)
   ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .container {
    padding: 18px 20px 32px;
  }

  .header {
    padding: 8px 0 18px;
    margin-bottom: 28px;
    gap: 14px;
  }

  .logo-img { height: 28px; }

  .screen-title { font-size: 28px; }
  .screen-title-secondary { font-size: 18px; }
  .screen-subtitle { font-size: 14.5px; margin-bottom: 28px; }
  .question-text { font-size: 23px; }

  .record-btn {
    width: 92px;
    height: 92px;
    font-size: 32px;
  }
  .record-btn.recording { font-size: 24px; }

  .record-area { padding: 22px 0 18px; }
}

/* ─────────────────────────────────────────────────────
   Reduced motion
   ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .record-btn.recording,
  .record-btn.recording::before,
  .record-btn.recording::after,
  .waveform-bar,
  .ambient,
  body.is-recording .ambient {
    animation: none;
  }

  .screen,
  .progress-fill,
  .toast {
    transition: none;
  }
}
