/* ================================
   App loading screen
================================ */

._dash-loading {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #1B1D3C;
  z-index: 99999;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: transparent !important;
  font-size: 0 !important;
}

/* Branded title */
._dash-loading::before {
  content: "Legacy Insight Portal";
  display: block;
  color: #FDFDFD;
  font-family: inherit;
  font-size: 26px;
  font-weight: 300;
  letter-spacing: 0.06em;
  margin-bottom: 28px;
}

/* Cyan spinner */
._dash-loading::after {
  content: "";
  display: block;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(24, 240, 255, 0.2);
  border-top-color: #18F0FF;
  border-radius: 50%;
  animation: dash-loading-spin 0.85s linear infinite;
}

@keyframes dash-loading-spin {
  to { transform: rotate(360deg); }
}

/* ================================
   Base page + typography
================================ */

html, body {
  background-color: #1F223C;
  color: white;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-weight: 200; /* Normal */
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 100; /* Semi-light for headings */
}

button, .btn {
  font-weight: 200;
}

/* Button press effect */
button:active {
  transform: scale(0.97);
}

/* ================================
   Animations
================================ */

.fade-in {
  animation: fadeIn ease 0.8s;
  opacity: 0;
  animation-fill-mode: forwards;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tab transition animations */
.tab-slide-left {
  animation: slideLeft 1.2s ease-out forwards;
}

.tab-slide-right {
  animation: slideRight 1.2s ease-out forwards;
}

@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(-100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ================================
   Layout containers / background
================================ */

/* Main content wrapper (anchors swirl) */
.main-content {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 20px;
  padding-left: 20px;
  padding-right: 10px;
}

/* Static swirling background */
.swirl-bg {
  position: absolute;
  inset: -50%;
  background: linear-gradient(
    90deg,
    rgba(27, 29, 60, 1) 30%,
    rgba(255,110,199,0.2) 60%,
    rgba(255,110,199,0.3) 70%,
    rgba(255,110,199,0.2) 95%,
    rgba(255,110,199,0.4) 100%
  );
  filter: blur(40px);
  z-index: 0;
}

/* Real page content sits on top */
.page-container {
  border-color: red; /* debug only if needed */
  position: relative;
  z-index: 1;
  flex: 1;
  background-color: inherit;
  overflow: auto;
}

/* Wallpaper background (SVG topo) */
.wallpaper {
  z-index: 0;
  background-color: #1B1D3C;  /* fallback */
  background-image: url("topography.svg");
  background-repeat: repeat;
}

/* Scale container for 1920x1080 layout */
#scale-container {
  transform-origin: top left;
  width: 1920px;
  height: 1080px;
  margin: 0 auto;
  position: relative;
}

/* Generic main-wrapper note – actual flex on parent (layout.py) */
.main-wrapper {
  /* parent flex in layout.py handles placement */
}

/* ================================
   Typography sizing (responsive)
================================ */

h6 {
  font-size: clamp(12px, 1.5vw, 18px);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 1.2em;
}

h1 {
  font-size: clamp(10px, 3.5vw, 32px);
  line-height: 1.4;
}

h2 {
  font-size: clamp(10px, 3.5vw, 20px);
  line-height: 1.4;
}

/* Allow markdown-rendered headings to wrap naturally, without clipping descenders */
.dash-markdown h1,
.dash-markdown h2,
.dash-markdown h3,
.dash-markdown h4,
.dash-markdown h5,
.dash-markdown h6 {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  max-height: none !important;
  line-height: 1.6 !important;
  padding-top: 0.2em !important;
  padding-bottom: 0.2em !important;
  margin-top: 0 !important;
}

.dash-markdown h1 {
  text-align: center !important;
  font-size: clamp(18px, 3vw, 32px) !important;
}

.methodology-content .dash-markdown h1 {
  font-size: clamp(18px, 3vw, 32px) !important;
}

.methodology-card {
  background: linear-gradient(135deg, #1e2a4a 0%, #1B1D3C 40%, #162040 100%) !important;
  border: 1px solid rgba(100, 160, 255, 0.15) !important;
}

.methodology-card .card-body {
  background: transparent !important;
}

.methodology-content .dash-markdown h2 {
  font-size: clamp(12px, 1.2vw, 16px) !important;
  font-weight: 400 !important;
}

.dash-markdown h2 {
  font-size: clamp(11px, 1.5vw, 18px) !important;
}

.dash-markdown h3 {
  font-size: clamp(10px, 1.2vw, 16px) !important;
}

/* Ensure the markdown container itself doesn't clip */
.dash-markdown {
  overflow: visible !important;
}

/* ================================
   Scrollbars (global)
================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* ================================
   Explainer tiles – fill height
================================ */

.explain-fill > * {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.explain-fill .dash-markdown {
  overflow: auto;
  min-height: 0;
}

/* ================================
   Methodology page — responsive
================================ */

@media (max-width: 992px) {
  .methodology-image-col {
    display: none !important;
  }
}

@media (max-width: 576px) {
  #methodology-tabs {
    flex-direction: column !important;
  }
  #methodology-tabs .nav-item {
    width: 100%;
  }
  #methodology-tabs .nav-link {
    border-radius: 6px !important;
    margin-bottom: 2px;
  }
  .methodology-card,
  .methodology-card .card-body {
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
  }
}

.methodology-plain-text {
  display: none;
}

