/* ========================================
   App Shell Layout
   Intimate reading width. Quiet chrome.
   ======================================== */

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background-color: var(--color-canvas);
}

/* === Top Bar — minimal, recedes === */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--top-bar-height);
  padding-inline: var(--space-4);
  background-color: var(--color-canvas);
  border-block-end: 1px solid var(--color-border-subtle);
  z-index: var(--z-top-bar);
  flex-shrink: 0;
}

#nav-trigger {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
  direction: ltr;
  text-align: left;
}

#nav-trigger:hover {
  background-color: var(--color-canvas-raised);
}

.top-bar-title {
  font-family: var(--font-display);
  font-size: var(--font-lg);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  line-height: var(--line-height-tight);
}

.top-bar-subtitle {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--color-text-faint);
  line-height: 1;
}

.session-timer {
  font-size: 10px;
  color: var(--color-text-faint);
  opacity: 0.5;
  font-family: var(--font-body);
  direction: ltr;
  padding-inline-start: var(--space-3);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.top-bar-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  color: var(--color-text-faint);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.top-bar-actions button:hover {
  background-color: var(--color-canvas-raised);
  color: var(--color-text-muted);
}

.icon {
  width: 18px;
  height: 18px;
}

/* === Main Content Area === */
#main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.page-container {
  max-width: var(--content-max-width);
  margin-inline: auto;
  padding-inline: var(--mushaf-padding);
}

/* === Bottom Navigation — quiet, functional === */
#bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  height: var(--bottom-nav-height);
  background-color: var(--color-canvas);
  border-block-start: 1px solid var(--color-border-subtle);
  z-index: var(--z-nav);
  flex-shrink: 0;
  padding-block-end: env(safe-area-inset-bottom, 0px);
  direction: ltr;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  color: var(--color-text-faint);
  transition: color var(--transition-fast);
  position: relative;
}

.nav-tab:hover {
  color: var(--color-text-muted);
}

.nav-tab.active {
  color: var(--color-gold);
}

/* Reading indicator dot on Mushaf tab */
.nav-tab .read-today-dot {
  position: absolute;
  bottom: 10px;
  inset-inline-end: calc(50% - 14px);
  width: 5px;
  height: 5px;
  background-color: var(--color-gold);
  border-radius: var(--radius-full);
  box-shadow: 0 0 10px var(--color-gold-glow), 0 0 20px var(--color-gold-glow);
}

/* Library dot — warm brass presence indicator */
.nav-tab .library-dot {
  position: absolute;
  bottom: 10px;
  inset-inline-end: calc(50% - 14px);
  width: 5px;
  height: 5px;
  background-color: var(--color-brass);
  border-radius: var(--radius-full);
  opacity: 0.6;
}

.nav-tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 30%;
  height: 2px;
  background-color: var(--color-gold);
  border-radius: 0 0 var(--radius-full) var(--radius-full);
}

.nav-icon {
  width: 20px;
  height: 20px;
}

/* Labels removed — icon-only tabs */

/* === Distraction-Free (Immersive) Reading Mode === */
[data-immersive] #top-bar,
[data-immersive] #bottom-nav,
[data-immersive] .audio-bar,
[data-immersive] .ayah-quick-actions,
[data-immersive] .ayah-margin-num,
[data-immersive] .threshold-nav,
[data-immersive] .threshold-panel,
[data-immersive] .continue-bar {
  display: none !important;
}

[data-immersive] #main-content {
  padding-block: var(--space-8);
}

[data-immersive] .ayah::before {
  display: none;
}

/* Immersive chrome overlay — shows on tap, auto-hides */
.immersive-exit {
  position: fixed;
  top: var(--space-4);
  inset-inline-end: var(--space-4);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background-color: var(--color-canvas-overlay);
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  color: var(--color-text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.immersive-exit.visible {
  opacity: 1;
  pointer-events: auto;
}

/* === Responsive === */

/* Tablet (640px+) */
@media (min-width: 640px) {
  :root {
    --mushaf-padding: var(--space-8);
  }

}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  :root {
    --mushaf-padding: var(--space-16);
    --content-max-width: 100%;
  }

  #bottom-nav {
    max-width: 100%;
  }
}
