/* css/layout.css
 *
 * The app shell's structural layout: where the card outlet sits, how
 * panels stack and cross-fade between tabs, and orientation-aware spacing
 * so the same markup works in portrait (~1600x2560) and landscape
 * (~2560x1600, the primary passenger orientation).
 */

#app {
  display: flex;
  flex-direction: column;
}

.sleep-btn {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 70;
  width: 3.25rem;
  height: 3.25rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--color-hairline-faint);
  box-shadow: var(--shadow-tight);
}

.sleep-btn svg {
  width: 1.4rem;
  height: 1.4rem;
}

.theme-toggle-btn {
  top: calc(var(--space-md) + 3.25rem + var(--space-xs));
}

.driver-info-toggle-btn {
  top: calc(var(--space-md) + 2 * (3.25rem + var(--space-xs)));
}

#card-outlet {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
}

.panel {
  position: absolute;
  inset: var(--space-xl) var(--space-lg) calc(6.5rem + var(--space-lg)) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
  overflow-y: auto;
  transition: opacity var(--duration-tab) var(--ease-standard),
    transform var(--duration-tab) var(--ease-standard);
}

.panel.is-active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  z-index: 2;
}

/* Portrait: give the top a little more breathing room below the sleep
 * button; landscape (the primary passenger view) keeps tighter margins
 * so cards have maximum width to work with. */
@media (orientation: portrait) {
  .panel {
    inset-block-start: 5.5rem;
  }
}

@media (orientation: landscape) {
  .panel {
    inset-inline: var(--space-xl);
  }
}
