/* ============================================================
   DETAILS.CSS — Dynamic.html
   Project-click interaction, side panel, warm palette
   ============================================================ */

.details-page {
  display: flex;
  gap: 0;
  align-items: flex-start;
}

.chart-area {
  flex: 1;
  min-width: 0;
}

.details-header {
  padding: 4rem 0 1.5rem;
  padding-left: 110px;  /* aligns with sankey left margin */
}

.details-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.details-header__subtitle {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-top: 0.5rem;
}

.chart-hint {
  font-size: 0.72rem;
  color: var(--text-light);
  letter-spacing: 0.06em;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-hint::before {
  content: '↗';
  font-size: 0.72rem;
  color: var(--accent);
}

.sankey-wrapper {
  width: 100%;
  overflow-x: auto;
}

#sankey-svg {
  display: block;
  width: 100%;
}

/* ============================================================
   SIDE PANEL
   ============================================================ */

.side-panel {
  width: 0;
  overflow: hidden;
  opacity: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--line);
  transition: width 0.32s ease, opacity 0.25s ease;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  flex-shrink: 0;
}

.side-panel.open {
  width: 300px;
  opacity: 1;
}

.side-panel__inner {
  padding: 2rem 1.75rem;
  min-width: 268px;
}

.side-panel__eyebrow {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.side-panel__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 300;
  color: var(--text-dark);
  line-height: 1.2;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.side-panel__section-label {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-light);
  margin: 1.25rem 0 0.5rem;
}

.side-panel__body {
  font-size: 0.72rem;
  line-height: 1.82;
  color: var(--text-mid);
}

.side-panel__body p + p { margin-top: 0.8rem; }

.side-panel__flow { margin-top: 0.5rem; }

.side-panel__flow-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.side-panel__flow-item:last-child { border-bottom: none; }

.side-panel__flow-project {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 0.15rem;
}

.side-panel__flow-tech {
  display: block;
  font-size: 0.62rem;
  color: var(--text-light);
  font-style: italic;
  line-height: 1.5;
}

.side-panel__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 1.25rem;
}

.side-panel__tag {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(107, 85, 64, 0.28);
  padding: 0.2rem 0.55rem;
  background: rgba(107, 85, 64, 0.05);
}

/* ============================================================
   SANKEY NODE STATES
   ============================================================ */

.s-node rect      { transition: opacity 0.18s; }
.s-node.project   { cursor: pointer; }

.s-node text {
  font-family: var(--font-body);
  pointer-events: none;
}

/* Clicked project */
.s-node.active rect  { opacity: 1; }
.s-node.active text  { font-weight: 700 !important; fill: var(--text-dark) !important; }

/* Connected company + techs */
.s-node.connected rect { opacity: 0.9; }
.s-node.connected text { fill: var(--text-dark) !important; }

/* Everything else fades */
.s-node.dimmed rect  { opacity: 0.12; }
.s-node.dimmed text  { opacity: 0.25; }

.s-link { fill: none; transition: opacity 0.2s, stroke 0.2s; }

/* ── Instruction banner ──────────────────────────────────── */
.chart-instruction {
  font-size: 0.78rem;
  color: var(--text-mid);
  background: rgba(107, 85, 64, 0.07);
  border-left: 2px solid var(--accent);
  padding: 0.6rem 1rem;
  margin-bottom: 1.5rem;
  margin-left: 110px;   /* align with sankey left margin */
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 480px;
}

.chart-instruction__icon {
  color: var(--accent);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.chart-instruction strong {
  font-weight: 600;
  color: var(--text-dark);
}

/* ============================================================
   MOBILE RESPONSIVE — accordion replaces Sankey on mobile
   ============================================================ */

@media (max-width: 768px) {
  
  /* Hide Sankey completely on mobile */
  .sankey-wrapper {
    display: none !important;
  }
  
  /* Show mobile accordion instead */
  .mobile-accordion {
    display: block;
  }
  
  /* Reduce header padding on mobile */
  .details-header {
    padding-left: 0;
    text-align: center;
  }
  
  /* Stack chart area vertically, remove flex */
  .details-page {
    display: block;
  }
  
  /* Hide side panel on mobile — content goes inline */
  .side-panel {
    display: none !important;
  }
  
  /* Center instruction banner on mobile */
  .chart-instruction {
    margin-left: 0;
    text-align: center;
  }
  
}

/* Hide mobile accordion on desktop */
.mobile-accordion {
  display: none;
}

/* ── Mobile accordion styles ──────────────────────────────── */
@media (max-width: 768px) {
  
  .mobile-accordion {
    margin-top: 1.5rem;
  }
  
  .accordion-company {
    border: 1px solid var(--line);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    overflow: hidden;
  }
  
  .accordion-company__header {
    background: var(--bg-card);
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
  }
  
  .accordion-company__header:hover {
    background: rgba(107, 85, 64, 0.08);
  }
  
  .accordion-company__chevron {
    font-size: 0.8rem;
    color: var(--text-light);
    transition: transform 0.2s;
  }
  
  .accordion-company.open .accordion-company__chevron {
    transform: rotate(180deg);
  }
  
  .accordion-company__content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  
  .accordion-company.open .accordion-company__content {
    max-height: 1000px;
  }
  
  .accordion-project {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--line);
    cursor: pointer;
    transition: background-color 0.15s;
  }
  
  .accordion-project:hover {
    background: rgba(107, 85, 64, 0.04);
  }
  
  .accordion-project__name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.4rem;
  }
  
  .accordion-project__summary {
    font-size: 0.75rem;
    color: var(--text-light);
    line-height: 1.5;
  }
  
  /* Expanded project details */
  .accordion-project__details {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(107, 85, 64, 0.15);
    display: none;
  }
  
  .accordion-project.expanded .accordion-project__details {
    display: block;
  }
  
  .accordion-project__body {
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--text-mid);
    margin-bottom: 1rem;
  }
  
  .accordion-project__tech-label {
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 0.5rem;
  }
  
  .accordion-project__tech-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  
  .accordion-project__tech-tag {
    font-size: 0.64rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid rgba(107, 85, 64, 0.25);
    padding: 0.2rem 0.5rem;
    background: rgba(107, 85, 64, 0.04);
    border-radius: 2px;
  }
  
}