/* ==========================================================================
   SOLARIS — application shell
   The shell fills the viewport. Only .view scrolls, and only vertically.
   ========================================================================== */

.app-shell {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* Ambient lighting: slow drifting botanical glows behind the glass */
.ambient {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: drift 26s ease-in-out infinite alternate;
}

.ambient span:nth-child(1) {
  width: 52vmax;
  height: 52vmax;
  top: -18vmax;
  left: -16vmax;
  background: var(--lime);
}

.ambient span:nth-child(2) {
  width: 44vmax;
  height: 44vmax;
  right: -18vmax;
  bottom: -10vmax;
  background: rgba(217, 169, 78, 0.55);
  animation-delay: -9s;
}

.ambient span:nth-child(3) {
  width: 30vmax;
  height: 30vmax;
  left: 35%;
  top: 40%;
  background: rgba(40, 124, 80, 0.22);
  animation-delay: -16s;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(3vmax, -2vmax, 0) scale(1.08); }
}

/* ---------- Header ---------- */

.app-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: calc(var(--safe-top) + 12px) var(--gutter) 0;
  min-height: 64px;
  padding: 8px 10px 8px 18px;
  border-radius: var(--pill);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  color: var(--forest);
  text-decoration: none;
  border-radius: var(--pill);
}

.brand img {
  width: 36px;
  height: 36px;
  flex: none;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.14em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--pill);
  color: var(--forest);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background-color 0.25s var(--ease);
}

.main-nav a:hover {
  background: rgba(184, 219, 131, 0.4);
}

.main-nav a[aria-current="page"] {
  background: var(--forest);
  color: var(--cream);
}

.btn-cta {
  min-height: 44px;
  padding: 10px 20px;
}

/* Hamburger (mobile) */
.menu-toggle {
  display: none;
  position: relative;
  flex: none;
  width: 48px;
  height: 48px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: var(--forest);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.menu-toggle span {
  position: absolute;
  left: 15px;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--cream);
  transition: transform 0.35s var(--ease), opacity 0.2s;
}

.menu-toggle span:nth-child(1) { top: 17px; }
.menu-toggle span:nth-child(2) { top: 23px; }
.menu-toggle span:nth-child(3) { top: 29px; }

.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Drawer (mobile navigation) ---------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(12, 42, 31, 0.28);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.drawer-backdrop[hidden] {
  display: none;
}

.drawer {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(88vw, 340px);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: calc(var(--safe-top) + 88px) 22px calc(var(--safe-bottom) + 24px);
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  background: var(--surface-strong);
  transform: translateX(105%);
  visibility: hidden;
  transition:
    transform 0.45s var(--ease),
    visibility 0.45s;
  overflow-y: auto;
}

.drawer.is-open {
  transform: none;
  visibility: visible;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-link {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 18px;
  border-radius: var(--pill);
  color: var(--forest);
  font-family: var(--font-display);
  font-size: 1.4rem;
  text-decoration: none;
  transition: background-color 0.25s var(--ease);
}

.drawer-link[aria-current="page"] {
  background: var(--lime);
}

.drawer-cta {
  width: 100%;
  margin-top: auto;
}

/* ---------- Content view (the only scrolling region) ---------- */

.view {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 8px var(--gutter) calc(var(--safe-bottom) + 32px);
  outline: none;
}

.view > #module-root {
  max-width: 1180px;
  margin: 0 auto;
}

/* ---------- Footer ---------- */

.app-footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 6px var(--gutter) calc(var(--safe-bottom) + 8px);
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.api-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.api-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #A7A58A;
}

.api-status[data-state="online"]::before   { background: var(--botanical); box-shadow: 0 0 0 4px rgba(40, 124, 80, 0.18); }
.api-status[data-state="degraded"]::before { background: var(--gold); }
.api-status[data-state="offline"]::before  { background: #B5523B; }

/* ---------- Responsive shell ---------- */

@media (max-width: 959px) {
  .main-nav,
  .btn-cta {
    display: none;
  }

  .menu-toggle {
    display: inline-block;
  }
}

@media (max-width: 380px) {
  .brand-name {
    letter-spacing: 0.1em;
    font-size: 1.1rem;
  }
}

@media (min-width: 960px) {
  .app-header {
    padding-right: 10px;
  }
}
