/**
 * RoccOS Launcher — Accordion Layout
 * Flat list left with orb backdrop + detail view right.
 * Click a row to expand its app content inline (accordion).
 */

/* ── Hide chrome when launcher is active ── */
.desktop--launcher-active #taskbar,
.desktop--launcher-active #start-menu,
.desktop--launcher-active .start-btn,
.desktop--launcher-active .launcher-trigger,
.desktop--launcher-active #desktop-icons,
.desktop--launcher-active .greta,
.desktop--launcher-active .gio-bubble {
  display: none !important;
}

.desktop--launcher-active .window-container {
  bottom: 0 !important;
}

/* Break out of the 16/10 diorama and fill viewport */
.desktop--launcher-active {
  aspect-ratio: unset !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: none !important;
  border-radius: 0 !important;
}

/* ═══════════════════════════════════════════
   COLOR WIPE — elastic SVG curtain
   ═══════════════════════════════════════════ */

.launcher-color-wipe {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Launcher Shell ── */
.launcher {
  position: absolute;
  inset: 0;
  z-index: var(--z-desktop-icons);
  pointer-events: auto;
  overflow-y: auto;
  overflow-x: hidden;
}

.launcher-home {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: var(--sp-8) clamp(var(--sp-6), 12vw, 20vw);
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════
   POLKADOTS — retro 70s color pops
   ═══════════════════════════════════════════ */

.polkadot-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.polkadot {
  position: absolute;
  transform: translate(-50%, -50%) rotate(var(--dot-rotation, 0deg));
  pointer-events: none;
  z-index: 0;
  opacity: 1;
}

.polkadot--circle {
  border-radius: 50%;
}

.polkadot--sticker {
  border-radius: 6px;
}

.polkadot--sticker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Pop-in animation for click-spawned dots */
.polkadot--pop {
  animation: polkadot-pop 300ms ease-out both;
}

@keyframes polkadot-pop {
  0% {
    transform: translate(-50%, -50%) rotate(var(--dot-rotation, 0deg)) scale(0);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -50%) rotate(var(--dot-rotation, 0deg)) scale(1.15);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) rotate(var(--dot-rotation, 0deg)) scale(1);
    opacity: 1;
  }
}

/* ═══════════════════════════════════════════
   APP LIST
   ═══════════════════════════════════════════ */

.launcher-app-list {
  display: flex;
  flex-direction: column;
  z-index: 1;
}

/* Infinite scroll: canonical + 2 clones */
.launcher-canonical,
.launcher-clone {
  display: flex;
  flex-direction: column;
}

/* ── Rows ── */
.launcher-row {
  display: grid;
  grid-template-columns: minmax(200px, 35%) 1fr;
  background: none;
  border: none;
  border-bottom: 1px solid var(--os-border-subtle);
  transition: border-bottom-color 1s ease-out;
  text-align: left;
  width: 100%;
  font-family: inherit;
  position: relative;
}

/* Collapsed: header spans full width, panel hidden */
.launcher-row:not(.launcher-row--expanded) {
  grid-template-columns: 1fr;
}

.launcher-canonical > .launcher-row:first-child,
.launcher-clone > .launcher-row:first-child {
  border-top: none;
}

/* The clickable header strip */
.launcher-row-header {
  display: grid;
  grid-template-columns: 40px 1fr 24px;
  align-items: center;
  padding: var(--sp-4) var(--sp-2);
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s ease-out;
}

.launcher-row:hover .launcher-row-header {
  opacity: 1;
}

.launcher-row--expanded .launcher-row-header {
  opacity: 1;
  align-self: start;
  padding-top: var(--sp-6);
}

.launcher-row-header:focus-visible {
  outline: 1px solid var(--os-text-muted);
  outline-offset: -1px;
}

.launcher-cell--index {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--os-text-muted);
  transition: color 1s ease-out;
}

.launcher-cell--name {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  color: var(--os-text);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  transition: transform 0.08s ease-out, color 1s ease-out;
  display: inline-block;
  transform-origin: left 45%;
  will-change: transform;
}

/* ── Adaptive text for dark wipe backgrounds ── */
.launcher[data-wipe-tone="dark"] .launcher-cell--name {
  color: #F0EEED;
}

.launcher[data-wipe-tone="dark"] .launcher-cell--index {
  color: rgba(240, 238, 237, 0.6);
}

.launcher[data-wipe-tone="dark"] .launcher-row {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.launcher-hint {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.55em;
  opacity: 0.7;
  white-space: nowrap;
  margin-left: 1rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.launcher-cell--status {
  display: flex;
  justify-content: center;
}

.launcher-dot {
  display: none; /* dots hidden in editorial layout — kept for future use */
}

/* ═══════════════════════════════════════════
   ACCORDION PANEL — expands below the header
   Two-column: title left, app content right
   ═══════════════════════════════════════════ */

.launcher-panel {
  overflow: hidden;
  height: 0;
  opacity: 0;
  /* Collapsed: remove from flow */
  grid-column: 1 / -1;
}

.launcher-row--expanded .launcher-panel {
  /* Expanded: sit in the right column */
  grid-column: 2;
  grid-row: 1;
}

.launcher-panel-content {
  padding: var(--sp-4) 0;
}

/* ═══════════════════════════════════════════
   MOBILE — single responsive accordion
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Touch UX (migrated from mobile.css) */
  *, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
  }

  /* Hide characters on phones (migrated from mobile.css) */
  .gio, .greta, .greta-menu {
    display: none !important;
  }

  .launcher-home {
    padding: var(--sp-3);
  }

  /* Finite list — hide infinite scroll clones */
  .launcher-clone {
    display: none;
  }

  /* Block layout — override grid so header + panel stack vertically */
  .launcher-row--expanded {
    display: block;
  }

  .launcher-row--expanded .launcher-row-header {
    position: static;
  }

  /* Panel fills below header, no max-height to avoid nested scrolling */
  .launcher-row--expanded .launcher-panel {
    grid-column: unset;
    grid-row: unset;
  }

  .launcher-panel-content {
    padding: var(--sp-4) var(--sp-3);
    max-height: none;
  }

  /* Touch-friendly hit targets (WCAG 2.5.5: 44px minimum) */
  .launcher-row-header {
    min-height: 48px;
    padding-block: var(--sp-3);
    opacity: 1;
  }

  /* Disable magnification scaling on mobile */
  .launcher-cell--name {
    transition: color 1s ease-out;
    will-change: auto;
    transform: none !important;
  }

  .launcher-hint {
    display: none;
  }
}
