/* ═══════════ APP SHELL ═══════════ */
.app {
  display: grid;
  grid-template-rows: 56px 1fr 72px;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* Landing + welcome should use the full viewport with no reserved topbar
   row, so there is no faint "ghost" header band above the content. */
.app.is-onboarding {
  grid-template-rows: 1fr;
}

/* ═══════════ TOP BAR ═══════════ */
.topbar {
  display: flex;
  align-items: center;
  padding: 0 max(var(--space-lg), calc((100% - 1080px) / 2 + var(--space-lg)));
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  gap: var(--space-md);
  z-index: 100;
  transition: opacity 800ms ease;
}

/* Onboarding: keep the 56px slot so the welcome card stays centered,
   but hide chrome that's irrelevant before data loads (logo duplicates
   the welcome card; data button has nothing to manage; help link belongs
   on a future landing page, not mid-flow). Fades back in when the
   `is-onboarding` class drops on dashboard load. */
.app.is-onboarding .topbar {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .topbar { transition: none; }
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--accent);
  border: none;
  background: none;
  font-family: var(--font-mono);
  cursor: pointer;
  padding: 0;
}

.topbar-spacer { flex: 1; }

/* Breadcrumb-style context label. Hidden by default; flipped on via
   `.is-active` to signal which surface the user is on — applied for
   Risks / Plan / Trends and for the "How it works" overlay. Overview is
   "home" and stays unadorned. */
.topbar-context {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
  transition: opacity 280ms ease, transform 280ms ease;
}
.topbar-context-sep {
  color: var(--border);
  font-weight: 400;
}
.topbar-context.is-active {
  opacity: 1;
  transform: none;
}
body.framework-locked .topbar {
  background: var(--bg-surface);
}
/* The framework overlay carries its own grounding "HOW IT WORKS"
   title in the chrome band's section block (left of the sub-nav),
   so the topbar breadcrumb would just duplicate the label within
   ~50px. Hide it while the overlay is open; Risks / Plan / Trends
   still rely on the breadcrumb as their only surface label. */
body.framework-locked .topbar-context {
  opacity: 0;
  pointer-events: none;
}
/* Other topbar chrome (TRENDS, data) still works as an escape hatch
   out of the overlay but is visually demoted while the user is
   "inside" the overlay. */
body.framework-locked .topbar-trends-btn,
body.framework-locked .topbar-data {
  opacity: 0.45;
  transition: opacity 240ms ease;
}
body.framework-locked .topbar-trends-btn:hover,
body.framework-locked .topbar-data:hover {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .topbar-context { transition: none; }
  body.framework-locked .topbar-trends-btn,
  body.framework-locked .topbar-data { transition: none; }
}

/* ═══════════ TAB CONTENT ═══════════ */
.tab-content {
  overflow: hidden;
  position: relative;
}

.tab-pane {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

.tab-pane.active {
  display: block;
}

/* Hide scrollbar but allow scrolling */
.tab-pane::-webkit-scrollbar { width: 4px; }
.tab-pane::-webkit-scrollbar-track { background: transparent; }
.tab-pane::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ═══════════ BOTTOM NAV ═══════════ */
.bottom-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  z-index: 100;
  position: relative;
}

.nav-tab {
  flex: 1;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 0;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.2s;
  position: relative;
}

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

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

.nav-tab-label {
  display: inline-block;
}

.nav-tab.is-next-step::after {
  content: '';
  position: absolute;
  top: 12px;
  right: calc(50% - 24px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.95;
}

.bottom-nav:not(.is-guided) .nav-tab.is-next-step::after {
  display: none;
}

.bottom-nav.is-guided .nav-tab.is-next-step::after {
  animation: nav-next-step-pulse 1800ms ease-out infinite;
}

@keyframes nav-next-step-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(38, 116, 255, 0.26);
  }
  50% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(38, 116, 255, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(38, 116, 255, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bottom-nav.is-guided .nav-tab.is-next-step::after {
    animation: none;
  }
}

.nav-indicator {
  position: absolute;
  top: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.nav-tab-icon {
  width: 22px;
  height: 22px;
  opacity: 0.5;
}

.nav-tab.active .nav-tab-icon {
  opacity: 1;
}

.nav-tab .nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}

/* During first-time guided nav, suppress the normal plan urgency dot so
   the single onboarding cue is unambiguous. */
.bottom-nav.is-guided .nav-tab .nav-badge {
  display: none;
}

/* ═══════════ OVERVIEW LAYOUT ═══════════ */
.overview {
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100%;
  overflow: hidden;
}

.overview-main {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 360px) 1fr;
  align-items: stretch;
  padding: var(--space-lg) var(--space-xl);
  gap: var(--space-xl);
  min-height: 0;
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

.overview-readouts {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  align-items: stretch;
  justify-content: center;
  position: relative;
  z-index: 1;
  min-height: 0;
}

.overview-readouts.left,
.overview-readouts.right {
  align-items: stretch;
}

.readouts-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.overview-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  height: 100%;
  position: relative;
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: var(--space-sm) var(--space-xl);
  border-top: 1px solid var(--border-subtle);
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

/* ═══════════ SLIDE-OVER PANEL ═══════════ */
.slide-over-backdrop {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.08);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-over-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.slide-over {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 0;
  /* Scales gently with viewport so the drawer feels right on a 13"
     laptop AND a 32" monitor. 720px floor protects the table from
     getting cramped; 1080px ceiling keeps the panel feeling like a
     focused reference rather than a second app. */
  width: clamp(720px, 55vw, 1080px);
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.08);
  z-index: 210;
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-over.open {
  transform: translateX(0);
}

/* ═══════════ LIFE CALENDAR (immersive) ═══════════
   Full-viewport overlay — covers the topbar too. The calendar is the
   contemplative "stare death in the face" view; visually taking over
   the whole screen (rather than sitting under the topbar) reinforces
   that this is a different psychological register from the dashboard.
   The user enters by intent (hero click) and exits via ✕ / Escape /
   backdrop, so orientation isn't an issue. Highest z-index in the app. */
.life-calendar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 30, 0.6);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.life-calendar-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.life-calendar {
  position: fixed;
  inset: 0;
  background: var(--bg-panel);
  z-index: 410;
  opacity: 0;
  transform: scale(0.985) translateY(12px);
  pointer-events: none;
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Seasonal photographic backdrop. Four full-bleed image layers stacked
   inside the canvas row of the frame grid; the layer matching the panel's
   data-s fades in, others fade out. Lives ONLY in the body region —
   header and footer occupy other grid rows and stay on clean white, so
   the chrome plane (logo, close, legend, toggles) never sits on imagery.
   The horizontal mask carves left/right "wings": grid column reads on
   white, photo lives only outside the data column. No vertical mask is
   needed — the grid placement handles that structurally.
   Tuning knobs:
     · opacity (intensity)  — currently 0.5 (sits in upper register)
     · blur (literalness)   — 2.5px reads as photo, not color field
     · saturate (charge)    — 0.4 keeps it warm-light, not iconographic
     · brightness/contrast  — slight lift + slight flatten so the image
       hands off cleanly into the surrounding white. */
.lc-seasons {
  position: relative;
  pointer-events: none;
  overflow: hidden;
}
.lc-season {
  position: absolute;
  inset: -6%;            /* extend so blur edges don't reveal a hard border */
  background-size: cover;
  background-position: center;
  filter: blur(2.5px) saturate(0.4) brightness(1.05) contrast(0.95);
  opacity: 0;
  /* Slow, cinematic cross-fade between seasons. The hover-driven season
     swap should feel like the room's light changing, not a UI switch. */
  transition: opacity 1.4s cubic-bezier(0.4, 0, 0.2, 1);
  /* Horizontal wings only: photo lives outside the central data column,
     fades to transparent across the grid, returns at the right margin.
     Vertical containment is handled by the grid row, not by mask. */
  -webkit-mask-image: linear-gradient(
    to right,
    rgba(0,0,0,1) 0%,
    rgba(0,0,0,1) 16%,
    rgba(0,0,0,0) 30%,
    rgba(0,0,0,0) 70%,
    rgba(0,0,0,1) 84%,
    rgba(0,0,0,1) 100%
  );
          mask-image: linear-gradient(
    to right,
    rgba(0,0,0,1) 0%,
    rgba(0,0,0,1) 16%,
    rgba(0,0,0,0) 30%,
    rgba(0,0,0,0) 70%,
    rgba(0,0,0,1) 84%,
    rgba(0,0,0,1) 100%
  );
}
.lc-season-spring { background-image: var(--season-img-spring); }
.lc-season-summer { background-image: var(--season-img-summer); }
.lc-season-autumn { background-image: var(--season-img-autumn); }
.lc-season-winter { background-image: var(--season-img-winter); }
.life-calendar[data-s="0"] .lc-season-spring { opacity: 0.5; }
.life-calendar[data-s="1"] .lc-season-summer { opacity: 0.5; }
.life-calendar[data-s="2"] .lc-season-autumn { opacity: 0.5; }
.life-calendar[data-s="3"] .lc-season-winter { opacity: 0.5; }

.life-calendar.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ═══════════ FRAMEWORK OVERLAY ═══════════
   "How It Works" reference content sits as a full-screen panel below
   the topbar. The topbar stays visible — and its `?` button is the
   only dismiss affordance, flipping to `×` while the overlay is open
   (see .topbar-help[aria-expanded] in this file). Pure fade-in: a
   slide-up read like a sheet, but this is a destination, not a sheet.
   Backdrop is a faint chrome wash, no shadow or border to avoid a
   visible band under the topbar. */
.framework-backdrop {
  position: fixed;
  top: 56px;             /* leave the topbar uncovered */
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 20, 30, 0.18);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

.framework-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.framework-overlay {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-panel);
  z-index: 210;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.framework-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.framework-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar to match the .tab-pane treatment so the overlay reads
   as part of the same surface family. */
.framework-scroll::-webkit-scrollbar { width: 4px; }
.framework-scroll::-webkit-scrollbar-track { background: transparent; }
.framework-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Match the topbar's content column so the framework body's left/right
   edges align with the AESCLE logo and the topbar buttons. The default
   .view-container caps at 1200px; reference content is text-only and
   reads better at the chrome's 1080px width. */
.framework-overlay .view-container {
  max-width: 1080px;
}

body.framework-locked { overflow: hidden; }

/* ═══════════ SCROLLABLE TAB VIEWS ═══════════ */
/* Width matches the topbar's content column (see .topbar padding) so
   tab titles and content align with the AESCLE logo and topbar buttons
   on the same vertical gutter. */
.view-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-lg) var(--space-2xl);
  width: 100%;
}

.view-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.view-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-primary);
}

.view-section {
  margin-bottom: var(--space-xl);
}

/* ═══════════ BASELINE LAYOUT ═══════════ */
.baseline-wide {
  max-width: 1080px;
}

.baseline-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: stretch;
  margin-bottom: var(--space-xl);
}

.baseline-hero-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.baseline-hero-col > .baseline-cite {
  margin-top: auto;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}
