/* ==========================================================================
   OST Compartments — focus-mode overlay system
   Hides every top-level section except the one the user is focused on, and
   adds a floating command dock to switch between them. Works as a pure layer
   on top of the existing markup — does not move or rewrite any sections.
   ========================================================================== */

/* ------------------------------------------------------------------ Dock */
.ost-dock {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  z-index: 9500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
  background: linear-gradient(180deg, rgba(7, 11, 22, 0.92), rgba(5, 8, 16, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px) saturate(180%);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  scrollbar-width: none;
}
.ost-dock::-webkit-scrollbar { display: none; }

@media (min-width: 821px) {
  body:not(.ost-focus-mode) .ost-breadcrumb {
    display: none;
  }

  body:not(.ost-focus-mode) .ost-dock {
    opacity: 0.88;
  }

  body:not(.ost-focus-mode) .ost-dock:hover,
  body:not(.ost-focus-mode) .ost-dock:focus-within {
    opacity: 1;
  }
}

.ost-dock-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(15, 19, 30, 0.7);
  color: #e2e8f0;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  outline: none;
}
.ost-dock-btn:hover,
.ost-dock-btn:focus-visible {
  transform: translateX(-3px) scale(1.05);
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: 0 6px 18px rgba(52, 211, 153, 0.25);
}
.ost-dock-btn[aria-current="true"] {
  background: linear-gradient(140deg, #34d399, #6d9fff);
  color: #061018;
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(52, 211, 153, 0.45);
}

/* Tooltip (label) flying out to the LEFT of each dock button */
.ost-dock-btn::after {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: rgba(7, 11, 22, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 9px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.ost-dock-btn:hover::after,
.ost-dock-btn:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.ost-dock-btn .ost-dock-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #061018;
  animation: ostBadgePulse 2.4s ease-in-out infinite;
}
@keyframes ostBadgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.ost-dock-divider {
  height: 1px;
  margin: 4px 6px;
  background: rgba(255, 255, 255, 0.08);
}

/* ------------------------------------------------------------------ Focus mode */
body.ost-focus-mode .ost-section-hidden {
  display: none !important;
}
body.ost-focus-mode .ost-section-active {
  animation: ostSectionIn 0.42s cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes ostSectionIn {
  from { opacity: 0; transform: translateY(18px); filter: blur(6px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0); }
}

/* Active section spotlight ring while focus mode is on */
body.ost-focus-mode .ost-section-active::before {
  content: "";
  position: fixed;
  inset: 64px 80px 0 0;
  pointer-events: none;
  background: radial-gradient(circle at 30% 0%, rgba(52, 211, 153, 0.05), transparent 60%);
  z-index: -1;
}

/* ------------------------------------------------------------------ Breadcrumb pill (top center) */
.ost-breadcrumb {
  position: fixed;
  top: max(72px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9400;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 8px;
  background: rgba(7, 11, 22, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #e2e8f0;
  font-size: 0.82rem;
  font-weight: 600;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
body.ost-focus-mode .ost-breadcrumb {
  opacity: 1;
  pointer-events: auto;
}
.ost-breadcrumb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(140deg, #34d399, #6d9fff);
  color: #061018;
  border-radius: 50%;
  font-size: 0.95rem;
}
.ost-breadcrumb-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.ost-breadcrumb-toggle:hover { background: rgba(255, 255, 255, 0.12); }

/* ------------------------------------------------------------------ Section transitions when navigating */
.ost-section-leaving {
  animation: ostSectionOut 0.22s ease forwards;
}
@keyframes ostSectionOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); }
}

/* ------------------------------------------------------------------ First-visit guide */
.ost-guide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 12, 0.78);
  backdrop-filter: blur(8px);
  z-index: 9700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  animation: ostFadeIn 0.4s ease forwards;
}
@keyframes ostFadeIn { to { opacity: 1; } }

.ost-guide-card {
  max-width: 520px;
  width: 100%;
  background: linear-gradient(160deg, #0d1320, #060912);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 28px 28px 22px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: ostGuideIn 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes ostGuideIn {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.ost-guide-card h3 {
  margin: 14px 0 6px;
  font-size: 1.35rem;
  background: linear-gradient(90deg, #34d399, #6d9fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ost-guide-card p { color: #cbd5e1; font-size: 0.92rem; line-height: 1.55; margin: 0 0 18px; }
.ost-guide-emoji { font-size: 2.4rem; }
.ost-guide-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.ost-guide-actions .btn { min-width: 130px; }
.ost-guide-dots { display: flex; justify-content: center; gap: 6px; margin: 18px 0 0; }
.ost-guide-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  transition: background 0.2s ease, transform 0.2s ease;
}
.ost-guide-dot.is-active { background: #34d399; transform: scale(1.3); }

/* ------------------------------------------------------------------ Section header chip injected at top of each section */
.ost-section-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  margin: 0 0 14px;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #34d399;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
}
.ost-section-chip-icon {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(52, 211, 153, 0.25);
  border-radius: 50%;
  font-size: 0.85rem;
}

/* ------------------------------------------------------------------ Mobile / small screens — dock becomes a bottom bar */
@media (max-width: 780px) {
  .ost-dock {
    right: 8px;
    left: 8px;
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    transform: none;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    border-radius: 18px;
    padding: 8px 10px;
    justify-content: flex-start;
  }
  .ost-dock-divider {
    width: 1px; height: 28px; margin: 0 4px;
  }
  .ost-dock-btn::after {
    right: auto; bottom: calc(100% + 10px);
    top: auto; left: 50%;
    transform: translateX(-50%) translateY(6px);
  }
  .ost-dock-btn:hover::after,
  .ost-dock-btn:focus-visible::after {
    transform: translateX(-50%) translateY(0);
  }
  .ost-breadcrumb {
    top: max(60px, env(safe-area-inset-top));
    font-size: 0.74rem;
  }
}

/* ------------------------------------------------------------------ Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  body.ost-focus-mode .ost-section-active,
  .ost-section-leaving,
  .ost-guide-overlay,
  .ost-guide-card { animation: none; }
}
