/* ==========================================================================
   RoOne — App Shell & Responsive Layout
   Breakpoints: Mobile PWA 390px, Tablet 768-1024px, Desktop 1440px+
   ========================================================================== */

#ro-app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Top Bar (Desktop / Tablet) ---------- */
.ro-topbar {
  height: var(--ro-topbar-h);
  min-height: var(--ro-topbar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  background: var(--ro-panel);
  border-bottom: 1px solid var(--ro-border-soft);
  z-index: 40;
}

.ro-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  cursor: pointer;
}

.ro-topbar__logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--ro-glow-orange);
}

.ro-topbar__wordmark {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.ro-topbar__crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ro-text-dim);
  font-size: 13px;
  min-width: 0;
}
.ro-topbar__crumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ro-topbar__crumb .ro-crumb-link { cursor: pointer; }
.ro-topbar__crumb .ro-crumb-link:hover { color: var(--ro-text); }
.ro-topbar__crumb .ro-crumb-current { color: var(--ro-text); font-weight: 600; }

.ro-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 auto;
  background: var(--ro-panel-sunken);
  padding: 4px;
  border-radius: var(--ro-radius-md);
  border: 1px solid var(--ro-border-soft);
}

.ro-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ro-text-dim);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--ro-radius-sm);
  cursor: pointer;
  transition: color var(--ro-fast) var(--ro-ease), background var(--ro-fast) var(--ro-ease);
  white-space: nowrap;
}
.ro-tab:hover { color: var(--ro-text); }
.ro-tab.is-active {
  color: var(--ro-text);
  background: var(--ro-panel-raised);
  box-shadow: inset 0 0 0 1px var(--ro-border), 0 0 0 1px rgba(243,122,32,0.15);
}
.ro-tab.is-active::after { content: ""; }

.ro-topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ---------- Body / scroll region below topbar ---------- */
.ro-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.ro-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

/* ---------- Project Picker ---------- */
.ro-picker {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 40px clamp(20px, 5vw, 64px) 64px;
}

.ro-picker__hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 36px;
}

.ro-picker__hero img { width: 56px; height: 56px; border-radius: 50%; box-shadow: var(--ro-glow-orange); }

.ro-picker__section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 32px 0 14px;
}

.ro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ---------- Master Project Hub ---------- */
.ro-hub-subnav {
  display: flex;
  gap: 8px;
  padding: 14px 20px 0;
  border-bottom: 1px solid var(--ro-border-soft);
  background: var(--ro-panel);
}

/* ---------- Workspace: Director & Cut layout ---------- */
.ro-director-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ro-director-top {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 2fr minmax(280px, 1fr);
  gap: 1px;
  background: var(--ro-border-soft);
  overflow: hidden;
}

.ro-preview-pane {
  background: var(--ro-bg);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: auto;
}

.ro-timeline-dock {
  height: var(--ro-timeline-h);
  min-height: var(--ro-timeline-h);
  background: var(--ro-panel);
  border-top: 1px solid var(--ro-border-soft);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---------- Generic tab content padding ---------- */
.ro-tabpane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px clamp(16px, 3vw, 32px);
}

.ro-subnav {
  display: flex;
  gap: 6px;
  padding: 10px clamp(16px, 3vw, 32px) 0;
  background: var(--ro-panel);
  border-bottom: 1px solid var(--ro-border-soft);
  flex-wrap: wrap;
}

/* ---------- Mobile bottom dock ---------- */
.ro-mobile-dock {
  display: none;
  height: var(--ro-mobile-dock-h);
  min-height: var(--ro-mobile-dock-h);
  background: var(--ro-panel);
  border-top: 1px solid var(--ro-border-soft);
  align-items: stretch;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 50;
}

.ro-dock-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--ro-text-faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.ro-dock-btn svg { width: 20px; height: 20px; }
.ro-dock-btn.is-active { color: var(--ro-orange); }

.ro-mobile-generate-wrap {
  display: none;
  padding: 10px 14px;
  background: var(--ro-panel);
  border-top: 1px solid var(--ro-border-soft);
}

/* On mobile this sticks to the bottom of the scrolling tab content, just above
   the (non-scrolling) bottom dock, per the spec's "anchored above dock" button. */
@media (max-width: 600px) {
  .ro-mobile-generate-wrap { position: sticky; bottom: 0; z-index: 10; }
  .ro-drawer-generate-only { display: none; }
}

/* ==========================================================================
   Tablet: 768px - 1024px
   ========================================================================== */
@media (max-width: 1024px) {
  :root { --ro-timeline-h: var(--ro-timeline-h-tablet); }

  .ro-director-top {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0,1fr) auto;
  }

  .ro-director-drawer {
    max-height: 40vh;
  }

  .ro-topbar__crumb { display: none; }
}

/* ==========================================================================
   Mobile: <= 600px (covers 390px PWA target)
   ========================================================================== */
@media (max-width: 600px) {
  .ro-topbar .ro-tabs { display: none; }
  .ro-topbar__crumb { display: flex; }

  .ro-mobile-dock { display: flex; }
  .ro-mobile-generate-wrap { display: block; }

  /* The Director & Cut tab switches from a fixed-height, internally-scrolling
     3-pane layout (desktop) to one continuously scrolling page: every flex/grid
     child needs to size to its own content instead of shrinking to fill the
     viewport, or the fixed-height ancestors clip everything below the fold. */
  .ro-director-layout { flex: none; }
  .ro-director-top {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    flex: none;
    overflow: visible;
  }

  .ro-preview-pane { overflow: visible; }
  .ro-director-drawer { max-height: none; border-top: none; }

  .ro-timeline-dock {
    flex: none;
    height: 220px;
    min-height: 220px;
  }

  .ro-tabpane { padding: 16px; }
  .ro-subnav { padding: 8px 16px 0; }

  .ro-picker { padding: 24px 16px 40px; }
  .ro-grid { grid-template-columns: 1fr; }

  /* Touch devices have no hover state, so hero-card edit/delete would
     otherwise be unreachable — keep them visible at this breakpoint. */
  .ro-hero-card__actions { opacity: 1; }
}
