/**
 * Sightline WebAR - V3 Styles (Reduction and Deference Redesign)
 */

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

/* ===== VIEWPORT VARIABLES ===== */
:root {
  --vh: 1vh;
  /* Z-Index Layering */
  --z-video: 0;
  --z-ar: 1;
  --z-start: 100;
  --z-hud: 200;
  --z-fab: 300;
  --z-debug: 400;
  --z-modal: 500;
  
  /* Colors */
  --text-main: #fff;
  --text-sec: #e6f2ff;
  --color-blue: #007AFF; /* System Blue */
  --color-neon-cyan: #00f2ff;
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.2);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  touch-action: none;
  overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  color: var(--text-main);
}

/* ===== LAYERING ===== */
.ar-stage {
  position: fixed;
  inset: 0;
  z-index: var(--z-video);
  background: transparent; /* Changed from #000 to transparent so it doesn't block video */
}

/* A-Frame canvas and video should fill this stage */
a-scene {
  display: block;
  width: 100%;
  height: 100%;
}

/* Ensure video and canvas are forced to cover screen */
.ar-stage canvas,
.ar-stage video,
.a-canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  max-width: 100% !important;
  max-height: 100% !important;
  position: absolute;
  top: 0;
  left: 0;
}

/* ===== START PANEL (REDUCTION DESIGN) ===== */
.start-panel {
  position: fixed;
  inset: 0;
  z-index: var(--z-start);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between; /* Header top, Card bottom */
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(env(safe-area-inset-bottom) + 32px) 20px;
  
  /* Background Image */
  background-image:
    linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 20%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.6) 100%),
    url('/assets/img/start-hero.png'),
    url('/assets/img/start-hero.jpg'); /* Fallback */
  background-color: #0a0a0f;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  
  transition: opacity 0.6s ease, visibility 0.6s;
}

.start-panel.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Header Typography */
.header-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  margin-top: 10px;
}

.brand-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.4px;
  opacity: 0.95;
}

.brand-subtitle {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.3px;
  max-width: 300px;
}

/* Permission Card (Glass Material) */
.permission-card {
  width: 100%;
  max-width: 360px;
  background: rgba(22, 22, 28, 0.75); /* Dark glass */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 6px; /* Padding for the container */
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  margin-bottom: 20px;
  
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s;
}

/* Permission Items List */
.perm-items {
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
  margin-bottom: 4px;
}

.perm-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.6; /* Default dim */
  transition: opacity 0.3s, transform 0.3s;
}

.perm-item.active {
  opacity: 1;
  color: var(--color-blue);
  transform: scale(1.05);
}

.perm-icon {
  font-size: 24px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.perm-text {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* CTA Button */
.cta-button {
  width: 100%;
  padding: 16px;
  border-radius: 18px;
  border: none;
  background: var(--color-blue);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  /* iOS button feel */
  -webkit-tap-highlight-color: transparent;
}

.cta-button:active {
  transform: scale(0.98);
  filter: brightness(0.9);
}

.cta-button.success {
  background: #fff;
  color: #000;
}

.cta-button.hidden {
  display: none;
}

/* ===== HUD & DEBUG ===== */
.hud {
  position: fixed;
  inset: 0;
  z-index: var(--z-hud);
  pointer-events: none;
}

.hud.hidden {
  display: none;
}

.debug-panel {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 60px);
  left: 12px;
  max-width: 320px;
  max-height: 40vh;
  z-index: var(--z-debug);
  background: rgba(0, 0, 0, 0.8);
  color: #0f0;
  padding: 12px;
  border-radius: 12px;
  display: none;
  font-family: monospace;
  font-size: 11px;
  overflow-y: auto;
  border: 1px solid rgba(0, 255, 0, 0.3);
}

.debug-panel.show {
  display: block;
}

.dev-log-content {
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ===== CRYSTAL CARD (New Luminous Reality Style) ===== */
.crystal-card {
  position: absolute;
  /* Frosted Glass Effect */
  background: rgba(20, 25, 35, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  
  /* Border: 1px White at 20% opacity */
  border: 1px solid rgba(255, 255, 255, 0.2);
  
  /* Corner Radius */
  border-radius: 24px;
  
  /* Elevation: 3D Drop Shadow */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 242, 255, 0.05); /* Subtle neon glow */
  
  /* Typography */
  color: #fff;
  padding: 20px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  
  /* Transition */
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  
  /* Default Dimensions (can be overridden) */
  width: 300px;
  min-height: 150px;
  
  /* Ensure visibility */
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crystal-card h2 {
  font-size: 1.25rem; /* ~20px */
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.5px;
  color: var(--color-neon-cyan);
}

.crystal-card p {
  font-size: 1rem; /* ~16px */
  line-height: 1.5;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
}

.crystal-card .icon {
  font-size: 24px;
  margin-bottom: 5px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 360px) {
  .brand-subtitle {
    font-size: 24px;
  }
  .perm-items {
    padding: 12px 16px;
  }
}

@media (max-height: 700px) {
  .start-panel {
    justify-content: flex-end; /* Push content down on short screens */
    gap: 40px;
  }
  .header-container {
    margin-top: 0;
    margin-bottom: auto; /* Push to top */
  }
}
