/* ============================================================
   base.css — reset, body, background overlay
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg) url('/images/nightcity-bg.png') center top / cover no-repeat fixed;
  min-height: 100vh;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at top, rgba(80, 20, 160, 0.22), transparent 55%),
    linear-gradient(180deg, rgba(5, 3, 15, 0.6), rgba(5, 3, 15, 0.88));
  pointer-events: none;
  z-index: 0;
}

#portal {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: row;
}

/* Main wrapper: everything to the right of sidebar */
#main-wrap {
  flex: 1;
  margin-left: 230px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Scrollable content area below header */
#content-area {
  flex: 1;
  padding-top: var(--header-h);
  display: flex;
  flex-direction: column;
}

/* Section visibility */
.portal-section {
  display: none;
  flex: 1;
}
.portal-section.active {
  display: flex;
  flex-direction: column;
}

/* Overview / mindmap section */
.overview-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px var(--gap);
  gap: 16px;
}

.mindmap-container {
  width: 100%;
  max-width: 960px;
}

#mindmap-canvas, #homelab-mindmap {
  width: 100%;
  height: auto;
}

/* Stats bar below mindmap */
.overview-stats {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(8,6,22,0.7);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.ov-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 24px;
  gap: 2px;
}

.ov-stat-val {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
}

.ov-stat-lbl {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ov-stat-sep {
  width: 1px;
  height: 36px;
  background: rgba(255,255,255,0.07);
}

/* Section views (Infrastructure, Monitoring, etc.) */
.section-view {
  padding: 20px var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  flex: 1;
}

.section-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.section-view-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-view-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 20px;
  border-radius: 2px;
  background: var(--section-accent, var(--cyan));
  box-shadow: 0 0 8px var(--section-accent, var(--cyan));
}

.section-view-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.section-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 8px;
}

.section-service-card {
  background: rgba(8,6,22,0.75);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(8px);
}

/* ── Stats-driven Ko-fi CTA ─────────────────────────────── */
.support-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  margin-top: 4px;
  background: rgba(4,2,12,0.88);
  border: 1px solid rgba(0,229,255,0.10);
  border-top: 1px solid rgba(0,229,255,0.18);
  border-radius: 0 0 var(--radius) var(--radius);
  gap: 12px;
}
.cta-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cta-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 48px;
}
.cta-stat-val {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.cta-stat-lbl {
  font-family: var(--font-mono);
  font-size: 6.5px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cta-divider {
  color: rgba(0,229,255,0.18);
  font-size: 14px;
  line-height: 1;
  user-select: none;
}
.cta-kofi {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(255,94,58,0.10);
  border: 1px solid rgba(255,94,58,0.30);
  border-radius: var(--radius);
  color: #ff6e50;
  font-family: var(--font-display);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.cta-kofi:hover {
  background: rgba(255,94,58,0.20);
  border-color: rgba(255,94,58,0.60);
  color: #ff8c70;
}
.cta-kofi-icon {
  font-size: 11px;
  animation: kofi-beat 2.2s ease-in-out infinite;
  display: inline-block;
}
@keyframes kofi-beat {
  0%, 100% { transform: scale(1); }
  14%       { transform: scale(1.3); }
  28%       { transform: scale(1); }
  42%       { transform: scale(1.15); }
  56%       { transform: scale(1); }
}

/* ── Study Drawer Leaderboard ────────────────────────────── */
.lb-section {
  border-top: 1px solid rgba(0,229,255,0.10);
  padding: 12px 14px 16px;
  flex-shrink: 0;
}
.lb-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.lb-title {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.lb-sub {
  font-family: var(--font-mono);
  font-size: 7.5px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
.lb-list { display: flex; flex-direction: column; gap: 8px; }
.lb-loading, .lb-empty {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  padding: 6px 0;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: rgba(0,229,255,0.03);
  border: 1px solid rgba(0,229,255,0.07);
  border-radius: 4px;
}
.lb-rank {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.lb-info {
  flex: 1;
  min-width: 0;
}
.lb-name {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.lb-bar-wrap {
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.lb-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.lb-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.lb-title-badge {
  font-family: var(--font-display);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 1px 5px;
  border: 1px solid;
  border-radius: 2px;
  text-transform: uppercase;
}
.lb-xp {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-dim);
}
.lb-acc {
  font-family: var(--font-mono);
  font-size: 7.5px;
  color: var(--text-muted);
}
