/* Akhil's Digital Brain — shared design system */
:root {
  --bg: #070b14;
  --surface: #0e1626;
  --surface-2: #111d31;
  --text: #e9f1ff;
  --muted: #92a4c3;
  --accent: #5ee7ff;
  --accent-2: #8b7cff;
  --border: rgba(255,255,255,.10);
  --radius: 14px;
  --max-width: 1180px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  line-height: 1.7;
}

a { color: var(--accent); }

.site {
  width: min(100% - 32px, var(--max-width));
  margin: auto;
}

.site-header {
  padding: 28px 0 10px;
}

.site-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: -.04em;
}

.site-subtitle {
  color: var(--muted);
  margin-top: 6px;
}

.brain-shell {
  margin: 22px 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: radial-gradient(circle at center, rgba(94,231,255,.08), transparent 60%), var(--surface);
  overflow: hidden;
}

/* Graphical Digital Brain Interface */
.brain-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 16px;
  flex-wrap: wrap;
}

.brain-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brain-heading {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #ffffff 15%, #7ee7ff 55%, #b292ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 35px rgba(94, 231, 255, 0.25);
}

.brain-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(94, 231, 255, 0.12);
  border: 1px solid rgba(94, 231, 255, 0.25);
  border-radius: 999px;
  padding: 4px 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 380px;
}

.search-input {
  width: 100%;
  padding: 10px 42px 10px 40px;
  background: rgba(17, 29, 49, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 231, 255, 0.2), 0 4px 20px rgba(0, 0, 0, 0.4);
  background: rgba(17, 29, 49, 0.95);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 1rem;
}

.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--muted);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(14, 22, 38, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(94, 231, 255, 0.25);
  border-radius: 12px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  z-index: 50;
  display: none;
}

.search-dropdown.active {
  display: block;
}

.search-result-item {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
  display: block;
  color: var(--text);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover, .search-result-item.selected {
  background: rgba(94, 231, 255, 0.12);
}

.search-result-title {
  font-weight: 600;
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 3px;
}

.search-result-summary {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Fullscreen Graphical Canvas Stage */
.graph-stage {
  position: relative;
  width: 100%;
  height: calc(100vh - 140px);
  min-height: 560px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: radial-gradient(circle at center, #0f1c32 0%, #080d19 70%, #04070d 100%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 100px rgba(94, 231, 255, 0.03);
}

.graph-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.graph-canvas:active {
  cursor: grabbing;
}

/* HUD Controls */
.graph-hud {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.hud-btn {
  width: 38px;
  height: 38px;
  background: rgba(17, 29, 49, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.hud-btn:hover {
  background: var(--accent);
  color: #070b14;
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(94, 231, 255, 0.4);
}

/* Inspector Floating Glass Panel */
.node-inspector {
  position: absolute;
  bottom: 20px;
  left: 20px;
  max-width: 360px;
  background: rgba(14, 22, 38, 0.90);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(94, 231, 255, 0.25);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  z-index: 20;
  transition: opacity 0.25s ease, transform 0.25s ease;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.node-inspector.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.inspector-type {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-2);
}

.inspector-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.inspector-summary {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 14px;
}

.inspector-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #070b14;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  transition: filter 0.2s ease, transform 0.15s ease;
}

.inspector-link:hover {
  filter: brightness(1.15);
  transform: translateX(2px);
}

.inspector-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}

.inspector-close:hover {
  color: #fff;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 22px 0 40px;
}

.panel, .note-definition, .note-important, .note-example,
.note-warning, .note-formula, .note-code, .note-takeaway {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel h2, .panel h3 { margin-top: 0; }

.note-definition { border-left: 4px solid var(--accent); }
.note-important { border-left: 4px solid var(--accent-2); }
.note-example { border-left: 4px solid #56d364; }
.note-warning { border-left: 4px solid #ffb86b; }
.note-formula { overflow-x: auto; }
.note-code { overflow-x: auto; font-family: ui-monospace, monospace; }
.note-takeaway { border-left: 4px solid #e879f9; }

/* Tables & Data */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 0.95rem;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--accent);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Code & Preformatted */
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
  color: #79c0ff;
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #e6edf3;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

/* Formula & Math Display */
.math-display {
  display: block;
  text-align: center;
  padding: 14px 18px;
  margin: 16px 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: "Latin Modern Math", "Cambria Math", Georgia, serif;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.math-display strong {
  color: var(--accent);
}

.tags-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 20px;
}

.tag-pill {
  display: inline-block;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(94, 231, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(94, 231, 255, 0.25);
  text-transform: lowercase;
}

img { max-width: 100%; border-radius: 12px; }

@media (max-width: 700px) {
  .site { width: min(100% - 20px, var(--max-width)); }
  .brain-canvas { min-height: 420px; }
  table { display: block; overflow-x: auto; }
}
