/* ===========================
   THE STRUCTURE OF POWER
   CLI-Aesthetic Report Site
   =========================== */

:root {
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --bg-card: #111111;
  --bg-sidebar: #050505;
  --border: #222222;
  --border-active: #444444;

  --text: #d4d4d4;
  --text-dim: #888888;
  --text-bright: #ffffff;
  --text-muted: #555555;

  --green: #4ec968;
  --green-dim: #0d1f0d;
  --red: #ff6b6b;
  --red-dim: #1f0d0d;
  --blue: #6cb6ff;
  --blue-dim: #0d0d1f;
  --yellow: #e0a832;
  --yellow-dim: #1f1a0d;
  --cyan: #66e0e8;
  --purple: #c49bff;
  --orange: #f5994e;

  --umg: #6cb6ff;
  --sony: #ff6b6b;
  --wmg: #e0a832;

  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-size-base: 14px;
  --font-size-sm: 12px;
  --font-size-xs: 11px;
  --font-size-lg: 16px;

  --sidebar-width: 280px;
  --content-max-width: 900px;
  --section-spacing: 4rem;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  scroll-padding-top: 60px;
}

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

/* Scanlines */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* Terminal Chrome */
.terminal-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.terminal-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: 38px;
  background: #0a0a0a;
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
}

.terminal-buttons {
  display: flex;
  gap: 8px;
  margin-right: 16px;
}

.terminal-buttons span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.btn-close { background: #ff5f57; }
.btn-minimize { background: #febc2e; }
.btn-maximize { background: #28c840; }

.terminal-title {
  color: var(--text-dim);
  font-size: var(--font-size-xs);
  letter-spacing: 0.5px;
}

.terminal-body {
  display: flex;
  margin-top: 38px;
  min-height: calc(100vh - 38px);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 38px;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  font-size: var(--font-size-sm);
}

.toc-content {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.toc-group {
  margin-bottom: 4px;
}

.toc-group-label {
  padding: 12px 16px 4px;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.toc-link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 16px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: var(--font-size-sm);
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}

.toc-link:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.03);
  border-left-color: var(--border-active);
}

.toc-link.active {
  color: var(--green);
  background: var(--green-dim);
  border-left-color: var(--green);
}

.toc-marker {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  min-width: 16px;
}

.toc-link.active .toc-marker {
  color: var(--green);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-meta {
  font-size: var(--font-size-xs);
  line-height: 1.8;
}

.output {
  color: var(--text-dim);
  padding-left: 20px;
}

/* Mobile TOC Toggle */
.mobile-toc-toggle {
  display: none;
  position: fixed;
  top: 46px;
  left: 12px;
  z-index: 60;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.hamburger {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-dim);
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 2px;
  background: var(--text-dim);
  left: 0;
}

.hamburger::before { top: -6px; }
.hamburger::after { top: 6px; }

/* Main Content */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  padding: 2rem 3rem;
  max-width: calc(var(--content-max-width) + var(--sidebar-width) + 6rem);
}

/* Prompt styling */
.prompt {
  color: var(--green);
  font-weight: 600;
}

.cmd {
  color: var(--cyan);
}

/* Cursor blink */
.cursor-blink {
  animation: blink 1s step-end infinite;
  color: var(--green);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Hero Section */
.hero-section {
  padding-top: 2rem;
  padding-bottom: var(--section-spacing);
}

.boot-sequence {
  margin-bottom: 2rem;
  font-size: var(--font-size-sm);
}

.boot-line {
  margin-bottom: 2px;
  opacity: 0;
  animation: bootFade 0.3s ease forwards;
}

.boot-line:nth-child(1) { animation-delay: 0.2s; }
.boot-line:nth-child(2) { animation-delay: 0.5s; }
.boot-line:nth-child(3) { animation-delay: 0.8s; }
.boot-line:nth-child(4) { animation-delay: 1.1s; }
.boot-line:nth-child(5) { animation-delay: 1.4s; }

@keyframes bootFade {
  to { opacity: 1; }
}

.boot-ok {
  color: var(--green);
  font-weight: 600;
}

.ascii-title {
  color: var(--cyan);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 500;
  margin-bottom: 2rem;
  overflow-x: auto;
  opacity: 0;
  animation: bootFade 0.5s ease forwards;
  animation-delay: 1.6s;
}

.hero-subtitle {
  opacity: 0;
  animation: bootFade 0.5s ease forwards;
  animation-delay: 2s;
}

.hero-subtitle p {
  font-size: var(--font-size-lg);
  color: var(--text-bright);
  margin-bottom: 4px;
}

.hero-tagline {
  font-size: var(--font-size-sm) !important;
  color: var(--text-dim) !important;
}

.hero-meta {
  margin-top: 2rem;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  opacity: 0;
  animation: bootFade 0.5s ease forwards;
  animation-delay: 2.3s;
}

.meta-row {
  display: flex;
  gap: 12px;
  font-size: var(--font-size-sm);
  margin-bottom: 4px;
}

.meta-label {
  color: var(--yellow);
  min-width: 120px;
}

.meta-value {
  color: var(--text);
}

.scroll-prompt {
  margin-top: 2rem;
  font-size: var(--font-size-sm);
  opacity: 0;
  animation: bootFade 0.5s ease forwards;
  animation-delay: 2.6s;
}

/* Sections */
.section {
  padding-bottom: var(--section-spacing);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--section-spacing);
}

.section:last-of-type {
  border-bottom: none;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 2rem;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-number {
  color: var(--green);
  font-size: var(--font-size-lg);
  font-weight: 700;
  min-width: 28px;
}

.section-header h2 {
  color: var(--text-bright);
  font-size: var(--font-size-lg);
  font-weight: 600;
  line-height: 1.4;
}

.date-range {
  color: var(--text-dim);
  font-weight: 400;
  font-size: var(--font-size-sm);
}

.section-body h3 {
  color: var(--cyan);
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-left: 8px;
  border-left: 2px solid var(--cyan);
}

.section-body h3:first-child {
  margin-top: 0;
}

.section-body h4 {
  color: var(--text-bright);
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.section-body p {
  margin-bottom: 1rem;
}

.section-body ul, .section-body ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.section-body li {
  margin-bottom: 0.5rem;
}

.section-body strong {
  color: var(--text-bright);
}

.section-body a {
  color: var(--blue);
  text-decoration: none;
}

.section-body a:hover {
  text-decoration: underline;
}

/* Citations */
cite {
  display: block;
  font-style: normal;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

/* Callouts */
.callout {
  padding: 12px 16px;
  background: var(--blue-dim);
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: 4px;
  margin-bottom: 1.5rem;
  font-size: var(--font-size-sm);
}

.callout-axiom {
  background: var(--green-dim);
  border-color: rgba(63, 185, 80, 0.2);
}

.callout-note {
  background: var(--yellow-dim);
  border-color: rgba(210, 153, 34, 0.2);
}

/* Flag for single-source */
.flag {
  color: var(--yellow);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

/* Label Cards */
.label-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 12px;
}

.label-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.label-name {
  color: var(--text-bright);
  font-weight: 700;
  font-size: var(--font-size-base);
}

.label-meta {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}

.label-card p {
  font-size: var(--font-size-sm);
  margin-bottom: 0;
}

.label-card cite {
  margin-top: 8px;
}

/* Color labels */
.umg-color { color: var(--umg) !important; }
.sony-color { color: var(--sony) !important; }
.wmg-color { color: var(--wmg) !important; }

.label-group-header {
  font-weight: 700 !important;
  border-left: none !important;
  padding-left: 0 !important;
  margin-top: 2rem !important;
}

/* Tables */
.data-table-wrapper {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.data-table caption {
  text-align: left;
  color: var(--text-dim);
  font-size: var(--font-size-xs);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.data-table th {
  text-align: left;
  color: var(--cyan);
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  font-size: var(--font-size-xs);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table.compact td {
  padding: 4px 12px;
  font-size: var(--font-size-xs);
}

.row-highlight {
  background: var(--red-dim) !important;
}

.row-highlight td {
  color: var(--text-bright);
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 1.5rem 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  text-align: center;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.stat-positive .stat-number {
  color: var(--green);
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-dim);
  line-height: 1.4;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 24px;
  margin: 1.5rem 0;
  border-left: 2px solid var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 20px 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--text-muted);
}

.timeline-major::before {
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.4);
}

.timeline-date {
  font-size: var(--font-size-xs);
  color: var(--yellow);
  font-weight: 600;
  margin-bottom: 2px;
}

.timeline-content {
  font-size: var(--font-size-sm);
  color: var(--text);
}

.highlight {
  color: var(--green);
  font-weight: 700;
}

/* Comparison Boxes */
.comparison-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 1.5rem 0;
}

.comparison-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
}

.comparison-header {
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: var(--text-bright);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.comparison-positive {
  color: var(--green) !important;
  border-bottom-color: rgba(63, 185, 80, 0.3) !important;
}

.comparison-negative {
  color: var(--red) !important;
  border-bottom-color: rgba(248, 81, 73, 0.3) !important;
}

.comparison-col p,
.comparison-col ul {
  font-size: var(--font-size-sm);
}

.comparison-col li {
  margin-bottom: 4px;
}

/* Code Blocks */
.code-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 1.5rem 0;
  overflow-x: auto;
}

.code-header {
  padding: 6px 12px;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.code-block pre {
  padding: 16px;
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: var(--text);
  margin: 0;
  white-space: pre;
}

.mini-code {
  font-size: var(--font-size-xs) !important;
  line-height: 1.8 !important;
  color: var(--text) !important;
  white-space: pre !important;
  font-family: var(--font-mono) !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Axiom list */
.axiom-list {
  counter-reset: axiom;
  list-style: none;
  padding-left: 0;
}

.axiom-list li {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: var(--font-size-sm);
}

.axiom-list li::before {
  counter-increment: axiom;
  content: counter(axiom) ".";
  color: var(--green);
  font-weight: 700;
  margin-right: 8px;
}

/* Theme Cards */
.theme-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 16px;
}

.theme-card h3 {
  margin-top: 0 !important;
  padding-left: 0 !important;
  border-left: none !important;
  color: var(--purple) !important;
}

/* Cycle Diagram */
.cycle-diagram {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 1rem 0;
  font-size: var(--font-size-xs);
}

.cycle-step {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 4px;
  color: var(--text);
}

.cycle-repeat {
  border-color: var(--green);
  color: var(--green);
}

.cycle-arrow {
  color: var(--text-muted);
  font-weight: 700;
}

/* Single Source List */
.single-source-list {
  list-style: none;
  padding-left: 0;
}

.single-source-list li {
  padding: 4px 0;
  font-size: var(--font-size-sm);
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.footer-line {
  font-size: var(--font-size-sm);
  margin-bottom: 4px;
}

.footer-dim {
  margin-top: 1rem;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-toc-toggle {
    display: flex;
  }

  .content {
    margin-left: 0;
    padding: 2rem 1.5rem;
    padding-top: 3rem;
  }

  .ascii-title {
    font-size: 10px;
  }

  .comparison-box {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .terminal-title {
    display: none;
  }
}

@media (max-width: 500px) {
  :root {
    --font-size-base: 13px;
  }

  .ascii-title {
    font-size: 8px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 1.5rem 1rem;
    padding-top: 3rem;
  }
}

/* Selection */
::selection {
  background: rgba(88, 166, 255, 0.3);
  color: var(--text-bright);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-active);
}
