/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0e1a;
  --bg-card: #111827;
  --bg-card-hover: #1a2040;
  --border: #1f2937;
  --border-accent: #d4c18c33;
  --gold: #d4c18c;
  --gold-dim: #d4c18c99;
  --text: #e0e0e0;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --code: #93c5fd;
  --link: #d4c18c;
  --link-hover: #e8d9a8;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --max-width: 960px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--link-hover); text-decoration: underline; }

code {
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--gold);
}

/* === LAYOUT === */
.site-header {
  border-bottom: 2px solid var(--gold);
  padding: 2rem 2rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-header h1 {
  color: var(--gold);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-header .subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem;
}

/* === NAV BREADCRUMB === */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb .sep { color: var(--text-dim); }

/* === BADGE / PILL === */
.badge {
  display: inline-block;
  background: var(--bg-card);
  color: var(--gold);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  border: 1px solid var(--border-accent);
  text-decoration: none;
}

.badge:hover { background: var(--bg-card-hover); text-decoration: none; }

.badge-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }

/* === JOURNEY HEADER === */
.journey-header {
  border-bottom: 2px solid var(--gold);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.journey-header h1 {
  color: var(--gold);
  font-size: 1.5rem;
  margin: 0;
}

.journey-header .desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

/* === PROGRESS INDICATOR === */
.progress-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2.5rem;
  padding: 0 1rem;
}

.progress-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--gold);
  color: var(--bg);
}

.progress-line {
  flex: 1;
  height: 2px;
  background: var(--gold);
}

/* === STEP === */
.step {
  border-left: 3px solid var(--gold);
  padding-left: 1.5rem;
  margin-bottom: 2.5rem;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.step-num {
  background: var(--gold);
  color: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.step-route {
  color: var(--gold-dim);
  font-size: 0.75rem;
}

.step h3 {
  color: #fff;
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.step p {
  color: #ccc;
  line-height: 1.6;
  margin: 0 0 1rem;
}

/* === EXPANDABLE TECHNICAL PANEL === */
.tech-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.tech-toggle {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.tech-toggle:hover { background: var(--bg-card-hover); }

.tech-toggle span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.tech-toggle .arrow {
  color: var(--text-dim);
  font-size: 0.75rem;
  transition: transform 0.2s;
}

.tech-toggle.open .arrow { transform: rotate(90deg); }

.tech-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 1rem;
}

.tech-body.open { display: block; }

.tech-section {
  margin-bottom: 0.75rem;
}

.tech-section:last-child { margin-bottom: 0; }

.tech-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.tech-value {
  color: var(--code);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

.tech-value.prose {
  color: #ccc;
  font-family: var(--font);
}

/* === JOURNEY FOOTER === */
.journey-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
}

.journey-footer a { color: var(--code); }

/* === COMPONENT PAGE === */
.component-header {
  border-bottom: 2px solid var(--gold);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.component-header h1 {
  color: var(--gold);
  font-size: 1.5rem;
  margin: 0;
}

.component-header .desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

.component-section {
  margin-bottom: 2rem;
}

.component-section h2 {
  color: #fff;
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.component-section p {
  color: #ccc;
  line-height: 1.6;
  margin: 0 0 0.75rem;
}

.component-section ul {
  list-style: none;
  padding: 0;
}

.component-section li {
  color: #ccc;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.component-section li:last-child { border-bottom: none; }

.file-list li {
  font-family: var(--font-mono);
  color: var(--code);
  font-size: 0.85rem;
}

.file-list .file-desc {
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

/* === JOURNEY CARD GRID (HOME) === */
.journey-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.journey-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
  display: block;
}

.journey-card:hover {
  border-color: var(--gold);
  background: var(--bg-card-hover);
  text-decoration: none;
}

.journey-card .num {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.journey-card h3 {
  color: #fff;
  font-size: 1rem;
  margin: 0.25rem 0 0.5rem;
}

.journey-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

/* === GOTCHA BOX === */
.gotcha {
  background: #1a1200;
  border: 1px solid #d4c18c44;
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #ccc;
}

.gotcha strong { color: var(--gold); }

/* === LAYER SECTIONS (HOME) === */
.layer-section {
  margin-bottom: 0.5rem;
}

.layer-label {
  color: var(--text-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}

.layer-arrow {
  text-align: center;
  color: var(--text-dim);
  font-size: 1rem;
  padding: 0.25rem 0;
}

/* === HORIZONTAL ACCORDION === */
.h-accordion {
  display: flex;
  gap: 4px;
  min-height: 48px;
}

.h-accordion-item {
  flex: 0 0 auto;
  transition: flex 0.35s ease;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
}

.h-accordion-item.open {
  flex: 1 1 320px;
  border-color: var(--gold);
}

.h-accordion-tab {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  transition: background 0.2s, color 0.2s;
  width: 100%;
}

.h-accordion-tab:hover {
  background: var(--bg-card-hover);
  color: #fff;
}

.h-accordion-item.open .h-accordion-tab {
  color: var(--gold);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.h-accordion-panel {
  display: none;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-y: auto;
}

.h-accordion-item.open .h-accordion-panel {
  display: block;
}

.h-accordion-panel p {
  color: #ccc;
  margin: 0 0 0.5rem;
}

.h-accordion-panel .panel-detail {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.h-accordion-panel .panel-files {
  font-size: 0.8rem;
  color: var(--code);
  margin: 0.5rem 0;
}

.h-accordion-panel .panel-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--gold);
}

/* Brain layer highlight */
.h-accordion.brain-layer .h-accordion-item {
  border-color: var(--gold-dim);
}

.h-accordion.brain-layer .h-accordion-tab {
  color: var(--gold);
}

/* === VERTICAL ACCORDION (JOURNEYS) === */
.v-accordion {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.v-accordion-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.2s;
}

.v-accordion-item.open {
  border-color: var(--gold);
}

.v-accordion-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  transition: background 0.2s;
}

.v-accordion-header:hover {
  background: var(--bg-card-hover);
}

.v-num {
  background: var(--gold);
  color: var(--bg);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.v-title {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

.v-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v-arrow {
  color: var(--text-dim);
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.v-accordion-item.open .v-arrow {
  transform: rotate(90deg);
}

.v-accordion-body {
  display: none;
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.v-accordion-item.open .v-accordion-body {
  display: block;
}

.v-badge-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 0 0.5rem;
}

.v-steps {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.5rem 0;
}

.v-step {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  color: #ccc;
  font-size: 0.85rem;
  line-height: 1.4;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}

.v-step:last-child { border-bottom: none; }

.v-step-num {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--gold);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.v-read-more {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
}

/* === PLAIN-ENGLISH INTRO === */
.intro-block {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}
.intro-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: 1.25rem 1.15rem;
}
.intro-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-dim);
  margin-bottom: 0.4rem;
  font-weight: 700;
}
.intro-card h3 {
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}
.intro-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}
@media (max-width: 760px) { .intro-block { grid-template-columns: 1fr; } }

/* === ADJUST BLOCK === */
.adjust-block {
  margin: 2.5rem 0;
  padding: 1.75rem 1.5rem;
  background: linear-gradient(180deg, rgba(212,193,140,0.04) 0%, transparent 100%);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
}
.adjust-block > h2 {
  color: var(--gold);
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}
.adjust-lead {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.adjust-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.adjust-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.1rem 1.15rem;
  position: relative;
}
.adjust-num {
  position: absolute;
  top: -10px; left: 12px;
  background: var(--gold);
  color: var(--bg);
  font-weight: 800;
  font-size: 0.78rem;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.adjust-card h4 {
  color: var(--text);
  font-size: 0.98rem;
  margin-bottom: 0.45rem;
  margin-top: 0.25rem;
}
.adjust-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 0.55rem;
}
.adjust-how {
  color: var(--text) !important;
  background: rgba(212,193,140,0.06);
  border-left: 2px solid var(--gold-dim);
  padding: 0.5rem 0.7rem;
  border-radius: 3px;
}
.adjust-owner {
  color: var(--gold-dim) !important;
  font-size: 0.78rem !important;
  font-style: italic;
  margin-top: 0.55rem;
  margin-bottom: 0 !important;
}
@media (max-width: 760px) { .adjust-grid { grid-template-columns: 1fr; } }

/* === SECTION HEADINGS === */
.section-heading {
  color: var(--text);
  font-size: 1.4rem;
  margin-top: 3rem;
  margin-bottom: 0.3rem;
}
.section-heading-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* === DIAGRAMS === */
.diagram-block {
  margin: 2.5rem 0;
}
.diagram-block > h2 {
  color: var(--text);
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}
.svg-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0 0.75rem;
  overflow-x: auto;
}
.flow-svg {
  width: 100%;
  height: auto;
  min-width: 700px;
}
.d-node rect {
  fill: var(--bg-card-hover);
  stroke: var(--gold-dim);
  stroke-width: 1;
}
.d-brain rect {
  fill: rgba(212,193,140,0.12);
  stroke: var(--gold);
  stroke-width: 2;
}
.d-patient rect { fill: rgba(147,197,253,0.08); stroke: var(--code); }
.d-store rect { fill: rgba(212,193,140,0.06); }
.d-title {
  fill: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
}
.d-brain-title {
  fill: var(--gold);
  font-size: 15px;
  font-weight: 700;
}
.d-sub {
  fill: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
}
.tl-label {
  fill: var(--gold);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
}
.tl-highlight { font-size: 13px; }
.tl-day {
  fill: var(--text);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
}
.tl-desc {
  fill: var(--text-muted);
  font-family: var(--font);
  font-size: 10px;
}
.diagram-caption {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
  font-style: italic;
  padding: 0 0.25rem;
}
