/**
 * RoccOS Boot Sequence Styles
 * CRT power-on, POST terminal, scanlines, vignette
 */

/* ── Pre-boot element hiding ──
   Elements are CSS-hidden until boot completes.
   No GSAP race condition — browser hides elements on first paint. */
body:not(.os-booted) .menu-bar,
body:not(.os-booted) .dock,
body:not(.os-booted) #desktop-icons,
body:not(.os-booted) #gio {
  opacity: 0;
  pointer-events: none;
}

/* ── Boot Screen Base ── */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: var(--z-boot, 1000);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--os-desktop-bg, #1484EC);
  color: #fff;
  font-family: var(--font-system);
  overflow: hidden;
}

/* Pitch-black starting state */
.boot-screen--off {
  background: #000;
}

/* CRT vignette overlay */
.boot-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.6) 100%);
}

/* CRT scanlines overlay */
.boot-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 11;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  animation: crtFlicker 4s ease-in-out infinite;
}

/* ── Power Button ── */
.boot-power-btn {
  position: relative;
  z-index: 5;
  background: none;
  border: none;
  color: var(--os-text-inverse, #E8D5B7);
  cursor: pointer;
  padding: 16px;
  border-radius: 50%;
  animation: powerPulse 2s ease-in-out infinite;
  transition: color 0.2s ease, transform 0.15s ease;
}

.boot-power-btn:hover {
  color: #fff;
  transform: scale(1.08);
}

.boot-power-btn:active {
  transform: scale(0.95);
}

.boot-power-btn svg {
  display: block;
  image-rendering: pixelated;
}

/* ── Power Hint ── */
.boot-power-hint {
  position: relative;
  z-index: 5;
  margin-top: 16px;
  font-size: 13px;
  color: var(--os-text-inverse, #E8D5B7);
  letter-spacing: 0.5px;
  opacity: 0;
  animation: fadeIn 0.6s ease-out 1.5s forwards;
}

/* ── CRT Power-On Line ── */
.boot-crt-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: #fff;
  box-shadow: 0 0 20px 4px rgba(255,255,255,0.6),
              0 0 60px 8px rgba(255,255,255,0.3);
  transform: translateY(-50%) scaleY(0);
  z-index: 20;
  pointer-events: none;
}

.boot-crt-line--expanding {
  animation: crtExpand 300ms ease-out forwards;
}

/* ── Static Flash Overlay ── */
.boot-static-flash {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  background: #fff;
  opacity: 0;
}

.boot-static-flash--active {
  animation: staticFlash 150ms ease-out forwards;
}

/* ── Skip Hint ── */
.boot-skip {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 15;
  font-size: 12px;
  color: rgba(232, 213, 183, 0.5);
  letter-spacing: 0.5px;
  font-family: 'Courier New', Courier, monospace;
  cursor: pointer;
  padding: 8px 12px;
  -webkit-tap-highlight-color: transparent;
}

/* ── Desktop Assembly Helpers ── */
/* Boot sets these classes, GSAP animates them off */
.boot-assembled .menu-bar {
  opacity: 1;
}

.boot-assembled .dock {
  opacity: 1;
}

/* ── Boot Collage ── */
.collage-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: var(--os-desktop-bg, #1484EC);
  overflow: hidden;
}

.collage-window {
  animation: none;
  position: absolute;
  min-width: 0;
  min-height: 0;
  will-change: transform, opacity;
}

.collage-window-content {
  flex: 1;
  background-color: var(--os-surface);
  background-repeat: no-repeat;
}

.collage-window-ascii {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.collage-window-ascii pre {
  margin: 0;
  font-family: var(--font-mono, 'Courier New', monospace);
  font-size: 14px;
  line-height: 1.4;
  color: var(--os-accent, #F0A030);
  white-space: pre;
  text-shadow: 0 0 8px rgba(240, 160, 48, 0.4);
}

/* ── Mobile adjustments ── */
@media (max-width: 640px) {
  .boot-power-btn svg {
    width: 40px;
    height: 40px;
  }

  .boot-skip {
    bottom: 16px;
    right: 16px;
    font-size: 11px;
  }

  .collage-window-ascii pre {
    font-size: 11px;
  }
}

