@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* ==========================================================================
   FLUID CYMATICS - STYLESHEET
   ========================================================================== */

:root {
  --color-cahier: #B7A07C;       /* B7A07C - Cahier - Headers & Assets */
  --color-accent-hi: #4A7B7C;    /* 4A7B7C - Teal - Accent Hi - primary accent */
  --color-accent-lo: #586C57;    /* 586C57 - Moss - Accent Lo - secondary accent */
  --color-canvas-bg: #080808;    /* 080808 - Black - Canvas Background */
  --color-navbar-bg: #1F1F1D;    /* 1F1F1D - Dark Brown - banner, secondary dark areas */
  --color-callout-bg: #171717;   /* 171717 - Brown - Callouts & HZ Lines */
  --color-text-white: #ACACAC;   /* ACACAC - Silver - Main Body Text */
  --color-link: #D9D9D9;         /* D9D9D9 - White - Link */
  --color-bright-white: #FFFFFF; /* FFFFFF - Bright White - Hover Link */
  --color-visited: #5A5A5A;      /* 5A5A5A - VisitedLink */

  --font-mono: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --bg-charcoal: #121212;
  --cahier-tan: #B7A07C;
  --moss-green: #586C57;
  --cymatic-teal: #4A7B7C;


  --node-idle: var(--moss-green);
  --node-active: #00e5ff;
  --node-glow: rgba(0, 229, 255, 0.35);
}

.graph-node.active {
  fill: var(--node-active);
  filter: drop-shadow(0px 0px 8px var(--node-glow));
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: linear-gradient(180deg, #080808 40%, #000C29 100%);
  color: var(--color-text-white);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#scene-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* --- PERSISTENT HEADER BANNER (#ui-header) --- */
#ui-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 120px;
  background-color: var(--color-canvas-bg);
  /* 1px Minimal Silver Chassis Line */
  border-bottom: 1px solid var(--color-text-white);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px 0 0;
  overflow: hidden;
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Flush-Left Manuscript Container with 1px Silver Margin Line */
.banner-left-asset {
  height: 100%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  background-color: var(--color-canvas-bg);
  /* Matching 2px Minimal Silver Hairline */
  border-right: 2px solid var(--color-text-white);
}

.banner-img {
  height: 100%;
  width: auto;
  object-fit: contain;
  object-position: left center;
}

/* Brand Block Wrapper */
.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-left: 20px; /* Snaps cleanly against the 1px silver line */
  margin-right: auto;
}

.brand-logo-img {
  height: 68px;
  width: auto;
  transition: height 0.3s ease;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-line-2 {
  color: var(--color-accent-hi); /* Teal Primary Accent */
  font-size: 13px;
  letter-spacing: 0.08em;
  font-weight: 600;
    opacity: 0.9;
}

.brand-line-3 {
  color: var(--color-cahier); /* Silver Main Body Text */
  font-size: 11px;
  line-height: 1.4;
  opacity: 0.86;
}

.header-controls {
  display: flex;
  align-items: center;
  margin-left: auto;
  padding-right: 24px;
  flex-shrink: 0; 
  z-index: 10;
}

.btn-system {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-text-white);
  color: var(--color-text-white);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 2px;
}

.btn-icon {
  width: 13px;
  height: 13px;
  transition: transform 0.3s ease;
}

.btn-system:hover {
  background: rgba(74, 123, 124, 0.15);
  border-color: var(--color-accent-hi);
  color: #FFFFFF;
}

.btn-system:hover .btn-icon {
  transform: rotate(-90deg);
}

.btn-system:active {
  transform: scale(0.97);
}


/* --- DYNAMIC SHRINK ENGINE OVERRIDES --- */
#ui-header.shrink {
  height: 72px;
  background-color: var(--color-canvas-bg);
}

#ui-header.shrink .brand-logo-img {
  height: 40px;
}

#ui-header.shrink .brand-line-3 {
  display: none;
}

/* ==========================================
   PERSISTENT FOOTER BAR (#ui-footer)
   ========================================== */
#ui-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  min-height: 40px; /* Fluid baseline: allows expansion on text wrap */
  height: auto;     /* Dynamic vertical sizing */
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 24px calc(8px + env(safe-area-inset-bottom, 0px)) 24px;
  background-color: var(--color-canvas-bg);
  border-top: 1px solid var(--color-callout-bg);
  pointer-events: auto;
  box-sizing: border-box;
}

.footer-quote {
  color: var(--color-text-white);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  margin: 0;
  opacity: 0.8;
  letter-spacing: 0.02em;
}

.footer-quote span {
  color: var(--color-cahier);
  font-weight: 500;
  white-space: nowrap; /* Keeps Stockhausen attribution intact */
}

/* --- MOBILE RESPONSIVE ENGINE --- */
@media (max-width: 768px) {
  #ui-footer {
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)) 16px;
  }
  
  .footer-quote {
    font-size: 10px;
    line-height: 1.35;
  }
}

/* ==========================================
   PROJECTED HTML NODE LABELS
   ========================================== */
#labels-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.node-label {
  position: absolute;
  color: var(--color-text-white);
  font-size: 10px;
  letter-spacing: 0.05em;
  pointer-events: auto;
  text-shadow: 0 1px 4px rgba(8, 8, 8, 0.95);
  transform: translate(16px, -50%);
  white-space: nowrap;
  user-select: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.node-label:hover, .node-label.active {
  color: var(--color-bright-white);
  border-bottom: 1px dotted var(--color-bright-white);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  opacity: 1 !important;
}

.node-label.adjacent {
  color: var(--color-cahier);
  opacity: 0.95 !important;
}

/* ==========================================
   WIDE READING TROUGH INSPECTOR PANEL
   ========================================== */
#inspector-panel {
  position: fixed;
  top: calc(var(--header-height, 93px) - 1px); 
  right: -800px;
  width: 720px;
  max-width: 85vw;
  height: calc(100vh - var(--header-height, 93px) - 39px);
  background: var(--color-canvas-bg);
  backdrop-filter: none;
  border-left: 1px solid var(--color-text-white); 
  z-index: 9999;
  padding: 48px;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 28px;
  pointer-events: auto;
  box-shadow: none;
  overflow-y: auto;
}

#inspector-panel.open {
  right: 0 !important;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-visited);
  padding-bottom: 16px;
}

.panel-title {
  color: var(--color-cahier);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-body {
  color: var(--color-text-white);
  font-size: 13px;
  line-height: 1.85;
  max-width: 65ch;
}

.close-btn {
  color: var(--color-visited);
  cursor: pointer;
  font-size: 20px;
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: var(--color-bright-white);
}

/* =========================================================================
   CLEAN MERGED RESPONSIVE & MOBILE CHASSIS ENGINE
   ========================================================================= */

/* 1. MOBILE & SMALL VIEWPORTS (<= 768px) */
@media (max-width: 768px) {
  /* Header Container */
  #ui-header {
    height: 54px;
    padding: 0 12px;
    gap: 8px;
    justify-content: flex-start;
  }

  /* Compact Book Asset (Centers & Auto-Truncates Geometry Proof) */
  .banner-left-asset {
    display: block !important;
    width: 58px;
    height: 100%;
    flex-shrink: 0;
    overflow: hidden;
  }

  .banner-left-asset img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center; /* Forces truncation toward center geometry */
  }

  /* Brand & Logo Elements */
  .brand-wrapper {
    padding-left: 4px;
    gap: 8px;
  }

  .brand-logo-img {
    height: 24px;
    width: auto;
  }

  .brand-text-block {
    gap: 2px;
  }

  .brand-line-2 {
    font-size: 10px;
    letter-spacing: 0.04em;
    line-height: 1.2;
  }

  /* Hide long tagline on mobile to save horizontal space */
  .brand-line-3 {
    display: none !important;
  }

  /* Header Reset Control (Far Right) */
  .header-controls {
    padding-right: 0;
    margin-left: auto;
  }

  .btn-system {
    padding: 4px 8px;
    font-size: 8px;
    gap: 4px;
  }

  .btn-icon {
    width: 10px;
    height: 10px;
  }

  /* Footer & Panels */
  .footer-quote {
    display: none;
  }

  #inspector-panel {
    width: 100vw;
    max-width: 100vw;
    padding: 24px;
    right: -100vw;
    -webkit-overflow-scrolling: touch;
  }

  #inspector-panel.open {
    right: 0 !important;
  }
}

/* 2. TABLET & INTERMEDIATE BREAKPOINT (769px - 1180px) */
@media (min-width: 769px) and (max-width: 1180px) {
  #ui-header {
    height: 88px;
    padding-right: 24px;
  }

  .banner-left-asset {
    max-width: 160px;
    flex-shrink: 0;
    overflow: hidden;
  }

  .brand-logo-img {
    height: 48px;
    width: auto;
  }

  .brand-wrapper {
    padding-left: 16px;
    white-space: nowrap;
  }

  .brand-line-2 {
    font-size: 12px;
  }

  .brand-line-3 {
    display: none !important;
  }

  #inspector-panel {
    width: 50vw;
    max-width: 50vw;
  }
}