/* ============================================================
   layout.css — sidebar, header, main content, page structure, grids
   ============================================================ */

/* ─── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-base);
  border-right: 1px solid var(--border-subtle);
  padding: 34px 20px 26px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 10;
}

.logo { margin-bottom: 4px; }

.logo-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 24px;
  font-weight: 300;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--text-primary);
}

.logo-sub {
  /* Brand tagline — the one sanctioned exception to the 13px floor
     (decorative, not informational), so the sidebar can stay slim. */
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(242,239,232,0.55);
  margin-top: 8px;
}

/* A short gold rule under the wordmark — the one jewel in the chrome. */
.logo::after {
  content: '';
  display: block;
  width: 22px;
  height: 1px;
  background: var(--accent);
  opacity: 0.6;
  margin-top: 14px;
}

.nav-section { padding: 0; }

.nav-section-label {
  font-family: var(--font-data);
  font-size: 13px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(242,239,232,0.42);
  margin-top: 28px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 9px 13px;
  cursor: pointer;
  font-family: var(--font-data);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(242,239,232,0.72);
  border-left: 1px solid transparent;
  margin-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.nav-item:hover { color: rgba(242,239,232,0.94); }

.nav-item.active {
  color: var(--text-primary);
  border-left: 1px solid var(--accent);
  background: linear-gradient(90deg, rgba(200,169,126,0.08), transparent 72%);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

/* One-time entrance — the chrome composes itself, quickly and quietly. */
@keyframes sideIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}
.logo                        { animation: sideIn 0.55s cubic-bezier(0.22,0.61,0.36,1) backwards; }
.sidebar .nav-section:nth-of-type(1) { animation: sideIn 0.55s cubic-bezier(0.22,0.61,0.36,1) 0.06s backwards; }
.sidebar .nav-section:nth-of-type(2) { animation: sideIn 0.55s cubic-bezier(0.22,0.61,0.36,1) 0.12s backwards; }
.sidebar .nav-section:nth-of-type(3) { animation: sideIn 0.55s cubic-bezier(0.22,0.61,0.36,1) 0.18s backwards; }
.sidebar-footer              { animation: sideIn 0.55s cubic-bezier(0.22,0.61,0.36,1) 0.26s backwards; }
@media (prefers-reduced-motion: reduce) {
  .logo, .sidebar .nav-section, .sidebar-footer { animation: none; }
}


/* ─── Main Content ────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  /* Pages scroll DOWN only — never sideways. Wide data (tables, the DCF
     sensitivity matrix) scrolls inside its own wrapper instead. */
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  /* a faint warm breath at the top of every page */
  background: radial-gradient(1100px 520px at 80% -180px, rgba(200,169,126,0.05), transparent 65%);
}

/* Glass header — content slides beneath it as you scroll. */
.page-header {
  padding: 20px 32px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: rgba(7,7,7,0.78);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 5;
}

.page-title {
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--text-primary);
}

.header-actions { display: flex; gap: 8px; align-items: center; }

.page-content { padding: 26px 32px 40px; }

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.25s ease; }


/* ─── Grids ───────────────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
/* Grid items default to min-width:auto, so a canvas sized against a wider
   container props the whole card open and the page pans sideways on a phone.
   Letting items shrink keeps every grid inside the viewport. */
.grid-2 > *, .grid-3 > *, .grid-4 > *, .grid-2-1 > *, .grid-3-2 > * { min-width: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-3-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
