/*
 * Hearth — Presence Over Pixels
 *
 * Design Tokens:
 *   Colors: --bg-primary #000, --bg-surface #111, --accent #ff8c00
 *   Text: --text-primary #fff, --text-secondary #b0b0b0 (7:1 AAA)
 *   Touch targets: 56px min (phone), 64px min (glasses)
 *   Font sizes: heading 1.75rem, body 1.25rem, label 1rem
 *   Spacing: 0.5rem, 1rem, 1.5rem, 2rem, 3rem
 */

:root {
  --bg-primary: #000000;
  --bg-surface: #111111;
  --bg-elevated: #1a1a1a;
  --accent: #ff8c00;
  --accent-hover: #ffaa33;
  --danger: #e74c3c;
  --danger-hover: #c0392b;
  --success: #27ae60;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #888888;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --touch-min: 3.5rem; /* 56px at 16px root */
}

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

html {
  font-size: 16px; /* rem base — respects system font size */
}

body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-primary);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ============================================ */
/* VIEWS                                        */
/* ============================================ */

.view {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.view.active {
  display: flex;
}

.view--dark {
  background: var(--bg-primary);
  align-items: center;
  justify-content: center;
}

/* ============================================ */
/* WIZARD CONTAINER                             */
/* ============================================ */

.wizard-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  width: 100%;
  max-width: 28rem;
  gap: 1.5rem;
}

#wizard-home {
  background: var(--bg-surface);
  align-items: center;
  justify-content: center;
}

#wizard-scene,
#wizard-scene-selfview {
  background: var(--bg-surface);
  align-items: center;
  justify-content: center;
}

/* ============================================ */
/* LOGO & TAGLINE                               */
/* ============================================ */

.logo {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.1rem;
  color: var(--text-primary);
}

.tagline {
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 1rem;
}

/* ============================================ */
/* BUTTONS                                      */
/* ============================================ */

.btn-primary {
  width: 100%;
  min-height: var(--touch-min);
  padding: 1.25rem 2rem;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover,
.btn-primary:active {
  background: var(--accent-hover);
}

.btn-primary--warm {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-primary--warm:hover,
.btn-primary--warm:active {
  background: rgba(255, 140, 0, 0.15);
}

.btn-secondary {
  width: 100%;
  min-height: var(--touch-min);
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid #333;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-secondary:hover,
.btn-secondary:active {
  color: var(--text-primary);
  border-color: #555;
}

.btn-back {
  min-height: var(--touch-min);
  padding: 0.75rem 2rem;
  font-size: 1.125rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid #333;
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 1rem;
  -webkit-tap-highlight-color: transparent;
}

.btn-back:hover {
  color: var(--text-primary);
  border-color: #555;
}

/* Floating Action Buttons */

.btn-fab {
  position: absolute;
  width: var(--touch-min);
  height: var(--touch-min);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 10;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.btn-fab--top {
  top: 1rem;
  left: 1rem;
  bottom: auto;
  right: auto;
}

.btn-fab--bottom-left {
  bottom: 1.5rem;
  left: 1.5rem;
  right: auto;
}

.btn-fab--record {
  color: var(--danger);
  font-size: 1.5rem;
}

.btn-fab--stop {
  color: var(--text-primary);
  background: var(--danger);
}

/* ============================================ */
/* FRIEND SUGGESTIONS                           */
/* ============================================ */

#wizard-meet {
  background: var(--bg-surface);
  align-items: center;
  justify-content: center;
}

.friend-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.friend-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 2px solid #333;
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.friend-card:hover,
.friend-card:active {
  border-color: var(--accent);
  background: #2a1f10;
}

.friend-card__avatar {
  font-size: 2.5rem;
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 140, 0, 0.15);
  border-radius: 50%;
}

.friend-card__info {
  flex: 1;
}

.friend-card__name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.friend-card__detail {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.friend-card__meet {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.5rem;
}

/* ============================================ */
/* MODE SELECTION (2D vs 3D)                    */
/* ============================================ */

#wizard-mode {
  background: var(--bg-surface);
  align-items: center;
  justify-content: center;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 2px solid #333;
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.mode-btn:hover,
.mode-btn:active {
  border-color: var(--accent);
  background: #2a1f10;
}

.mode-btn__icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.mode-btn__title {
  font-size: 1.5rem;
  font-weight: 700;
}

.mode-btn__desc {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* ============================================ */
/* 3D COMFORT WARNING                           */
/* ============================================ */

#wizard-3d-warning {
  background: var(--bg-surface);
  align-items: center;
  justify-content: center;
}

.warning-card {
  background: var(--bg-elevated);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.warning-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
  text-align: center;
}

.warning-text {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.warning-text:last-child {
  margin-bottom: 0;
}

.warning-text--soft {
  color: var(--text-secondary);
  font-style: italic;
}

/* ============================================ */
/* SCENE PICKER                                 */
/* ============================================ */

.wizard-heading {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.scene-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.scene-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--touch-min);
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 2px solid #333;
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.scene-btn:hover,
.scene-btn:active {
  border-color: var(--accent);
  background: #2a1f10;
}

.scene-btn__name {
  font-size: 1.25rem;
  font-weight: 600;
}

.scene-btn__desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ============================================ */
/* SELFVIEW                                     */
/* ============================================ */

#selfview {
  position: relative;
}

#selfview-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================ */
/* CALL VIEW                                    */
/* ============================================ */

#call-view {
  position: relative;
}

.call-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.call-remote-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg-primary);
  z-index: 1;
}

/* ============================================ */
/* GLASSES STATUS OVERLAY                       */
/* ============================================ */

.glasses-status {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 1.5rem rgba(0,0,0,0.8);
  z-index: 20;
  text-align: center;
  pointer-events: none;
}

/* ============================================ */
/* SAFETY INDICATOR                             */
/* ============================================ */

.safety-indicator {
  position: absolute;
  bottom: 5rem;
  right: 2rem;
  z-index: 25;
  animation: pulse 1s ease-in-out infinite;
}

.safety-icon {
  font-size: 4rem;
  filter: drop-shadow(0 0 0.5rem rgba(255,140,0,0.6));
}

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

/* ============================================ */
/* POSITION CALIBRATION CONTROLS                */
/* ============================================ */

.calibration-controls {
  position: absolute;
  bottom: 5rem;
  left: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  z-index: 20;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.calibration-controls:hover,
.calibration-controls:focus-within {
  opacity: 1;
}

.calibration-controls.cal-hidden .cal-btn {
  display: none;
}

.calibration-controls.cal-hidden .cal-row {
  display: none;
}

.cal-row {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.cal-btn {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-primary);
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.cal-btn:active {
  background: rgba(255, 140, 0, 0.4);
}

.cal-btn--small {
  font-size: 1.5rem;
  font-weight: 700;
}

.cal-toggle {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.6);
  color: var(--accent);
  font-size: 1.25rem;
  cursor: pointer;
  margin-top: 0.5rem;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================ */
/* RECORDING CONTROLS                           */
/* ============================================ */

.recording-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 15;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--danger);
  font-size: 1.125rem;
  font-weight: 600;
}

.recording-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ============================================ */
/* END CALL                                     */
/* ============================================ */

.btn-end-call {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  min-height: var(--touch-min);
  padding: 1rem 3rem;
  font-size: 1.25rem;
  font-weight: 600;
  background: var(--danger);
  color: var(--text-primary);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  z-index: 15;
  -webkit-tap-highlight-color: transparent;
}

.btn-end-call:hover {
  background: var(--danger-hover);
}

/* ============================================ */
/* GOODBYE SCREEN                               */
/* ============================================ */

.goodbye-container {
  text-align: center;
  padding: 3rem;
}

.goodbye-text {
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.4;
}

/* ============================================ */
/* ERROR STATES                                 */
/* ============================================ */

.hearth-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  padding: 2rem;
  max-width: 24rem;
  z-index: 30;
}

.hearth-error__message {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.hearth-error__retry {
  min-height: var(--touch-min);
  padding: 1rem 2rem;
  font-size: 1.25rem;
  font-weight: 600;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

/* ============================================ */
/* UTILITIES                                    */
/* ============================================ */

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ============================================ */
/* RESPONSIVE                                   */
/* ============================================ */

@media (max-width: 400px) {
  .wizard-container {
    padding: 1.5rem;
  }

  .logo {
    font-size: 2.5rem;
  }

  .btn-primary {
    font-size: 1.25rem;
  }
}

/* Landscape (glasses display via USB-C) */
@media (orientation: landscape) and (min-width: 800px) {
  .glasses-status {
    font-size: 2.5rem;
  }

  .safety-icon {
    font-size: 5rem;
  }

  .goodbye-text {
    font-size: 3rem;
  }
}
