/* Human Design.ai–inspired layout — sidebar | workspace | chart rail */

.chart-shell.hd-pro-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: calc(100vh - 56px);
}

@media (min-width: 1024px) {
  .chart-shell.hd-pro-layout {
    display: grid;
    grid-template-columns: 228px minmax(0, 1fr) min(360px, 34vw);
    min-height: 100vh;
  }

  .chart-sidebar {
    grid-column: 1;
    grid-row: 1;
  }

  .app-shell.hd-chart-app { max-width: 100%; }
}

.chart-sidebar-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 12px 14px;
  padding: 11px 14px;
  border-radius: var(--r-pill);
  background: var(--text-1);
  color: var(--bg);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.chart-sidebar-cta:hover { opacity: 0.92; }

.chart-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  flex: 1;
}

@media (min-width: 1024px) {
  .chart-workspace {
    grid-column: 2;
    border-right: 1px solid var(--border);
    overflow: hidden;
  }
}

.chart-workspace-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--s1);
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .chart-workspace-topbar { display: flex; }
}

.chart-workspace-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
}

.chart-workspace-actions { display: flex; gap: 8px; }

.chart-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.chart-pill-practice {
  background: var(--violet);
  color: #fff;
}

.chart-pill-chat {
  background: var(--s2);
  color: var(--text-1);
  border: 1px solid var(--border-md);
}

.chart-main.hd-pro-main {
  flex: 1;
  overflow-y: auto;
}

.chart-welcome {
  text-align: left;
  padding: 22px 20px 20px;
  margin-bottom: 16px;
  border-radius: var(--r-xl);
  background: var(--s1);
  border: 1px solid var(--border);
}

.chart-identity-brief {
  padding: 22px 20px 18px;
  margin-bottom: 14px;
  border-radius: var(--r-xl);
  background: linear-gradient(145deg, var(--s1) 0%, rgba(123, 97, 255, 0.06) 100%);
  border: 1px solid var(--border-md);
}

.chart-identity-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 8px;
}

.chart-identity-headline {
  font-size: clamp(20px, 4vw, 24px);
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.35;
  margin: 0 0 10px;
  letter-spacing: -.02em;
}

.chart-identity-lead {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-2);
  margin: 0 0 16px;
  max-width: 42em;
}

.chart-signal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .chart-signal-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.chart-signal-card {
  padding: 14px 14px 12px;
  border-radius: var(--r-md);
  background: var(--s2);
  border: 1px solid var(--border);
}

.chart-signal-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 4px;
}

.chart-signal-value {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.35;
  margin-bottom: 6px;
}

.chart-signal-hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-3);
  margin: 0;
}

.chart-insight-strip {
  padding: 16px 18px;
  margin-bottom: 14px;
  border-radius: var(--r-lg);
  border-left: 3px solid var(--violet);
  background: rgba(123, 97, 255, 0.07);
}

.chart-insight-quote {
  font-size: 14px;
  font-style: italic;
  line-height: 1.65;
  color: var(--text-1);
  margin: 0;
}

.chart-insight-meta {
  font-size: 11px;
  color: var(--text-3);
  margin: 8px 0 0;
}

.chart-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 6px;
}

.chart-section-sub {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-3);
  margin: 0 0 14px;
  max-width: 36em;
}

.chart-energy-intro {
  margin-bottom: 10px;
}

.chart-energy-intro p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-2);
  margin: 0 0 4px;
}

.chart-welcome-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: var(--teal-dim);
}

.chart-welcome-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 8px;
}

.chart-welcome-sub {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  margin: 0 auto 16px;
  max-width: 36em;
}

.chart-prompt-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.chart-prompt-chip {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-md);
  background: var(--s2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.chart-prompt-chip:hover {
  border-color: var(--violet);
  color: var(--violet);
  background: var(--violet-dim);
}

.chart-ask-strip {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-md);
  background: var(--s2);
  margin-bottom: 16px;
}

.chart-ask-strip textarea {
  flex: 1;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
}

.chart-ask-strip button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--violet);
  color: #fff;
  cursor: pointer;
}

@media (max-width: 1023px) {
  .chart-detail-panel {
    display: flex;
    flex-direction: column;
    order: -1;
    border-bottom: 1px solid var(--border);
    background: var(--s1);
  }

  .chart-shell.hd-pro-layout {
    overflow-y: auto;
  }
}

.chart-detail-panel {
  display: flex;
  flex-direction: column;
  background: var(--s1);
}

@media (min-width: 768px) and (max-width: 1023px) {
  .chart-shell.hd-pro-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }

  .chart-sidebar {
    grid-column: 1;
    grid-row: 1 / span 2;
    display: flex;
    border-right: 1px solid var(--border);
  }

  .chart-detail-panel {
    grid-column: 2;
    grid-row: 1;
    order: 0;
    max-height: 42vh;
  }

  .chart-workspace {
    grid-column: 2;
    grid-row: 2;
    order: 0;
  }

  .chart-rail-bodygraph .bodygraph-svg-wrap svg {
    max-height: 28vh;
  }
}

@media (min-width: 1024px) {
  .chart-detail-panel {
    display: flex;
    flex-direction: column;
    grid-column: 3;
    grid-row: 1;
    order: 0;
    border-bottom: none;
    border-left: 1px solid var(--border);
    overflow: hidden;
    min-height: 0;
    max-height: none;
  }
}

.chart-rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chart-rail-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
}

.chart-rail-tools { display: flex; gap: 4px; }

.chart-rail-tool {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 14px;
}

.chart-rail-tool:hover { background: var(--s2); color: var(--text-1); }

.chart-rail-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 20px;
}

.chart-rail-bodygraph {
  margin-bottom: 12px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}

.chart-rail-bodygraph .bodygraph-svg-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(52vh, 480px);
  margin: 0 auto;
}

.chart-rail-type { text-align: center; padding: 8px 4px 12px; }

.chart-rail-type-badge {
  display: inline-flex;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 8px;
}

.chart-rail-type-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
}

.chart-rail-stats { border-top: 1px solid var(--border); }

.hd-stat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}

.hd-stat-row:last-child { border-bottom: none; }

.hd-stat-key {
  color: var(--text-3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hd-stat-val {
  color: var(--text-1);
  font-weight: 700;
  text-align: right;
}

.hd-stat-val.is-gated { filter: blur(4px); user-select: none; }

.hd-panel-block {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.hd-panel-block:last-child { border-bottom: none; }

.hd-panel-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

.hd-prop-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.hd-prop-row:last-child { border-bottom: none; }
.hd-prop-key { color: var(--text-2); font-weight: 500; }
.hd-prop-val { color: var(--text-1); font-weight: 600; text-align: right; }

.hd-panel-cta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.hd-panel-cta a,
.hd-panel-cta button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
}

.hd-panel-cta .hd-cta-primary {
  background: var(--brand-primary);
  color: #fff;
  border: none;
}

.hd-panel-cta .hd-cta-ghost {
  background: var(--s2);
  color: var(--text-1);
  border: 1px solid var(--border-md);
}

/* ── Shared Discover sidebar ─────────────────────────────────────────── */
.chart-sidebar {
  display: none;
}

@media (min-width: 768px) {
  .app-shell.hd-chart-app { max-width: 100%; display: flex; flex-direction: column; }
  .app-shell.hd-chart-app .back-header.shell-back-header { display: none; }

  .chart-sidebar {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--s1);
    overflow-y: auto;
    padding: 16px 0 24px;
  }

  .sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
  }

  .sidebar-brand .sb-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--teal);
    display: block;
    margin-bottom: 2px;
  }

  .sidebar-brand .sb-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-1);
  }

  .sidebar-nav { padding: 0 10px; }

  .sidebar-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    font-size: 13px;
    color: var(--text-2);
    text-decoration: none;
    margin-bottom: 8px;
    transition: background var(--ease);
  }

  .sidebar-back:hover { background: var(--s2); }

  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    transition: background var(--ease), color var(--ease);
    margin-bottom: 4px;
  }

  .sidebar-item:hover { background: var(--s2); color: var(--text-1); }

  .sidebar-item.active {
    background: var(--violet-dim);
    color: var(--violet);
    font-weight: 600;
    border: 1px solid rgba(123, 97, 255, 0.22);
  }

  .sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 10px 12px;
  }
}

/* Mobile: horizontal workspace tabs under topbar */
.discover-mobile-nav {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  background: var(--s1);
  flex-shrink: 0;
}

.discover-mobile-nav::-webkit-scrollbar { display: none; }

@media (min-width: 768px) {
  .discover-mobile-nav,
  #discover-mobile-nav-mount { display: none; }
}

.discover-mobile-nav-item {
  flex-shrink: 0;
  padding: 7px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-2);
  background: var(--s2);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.discover-mobile-nav-item.is-active {
  background: var(--violet-dim);
  color: var(--violet);
  border-color: rgba(123, 97, 255, 0.25);
}

/* Mobile: collapsible chart rail summary bar */
.chart-rail-mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--s2);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.chart-rail-mobile-type {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
}

.chart-rail-mobile-chevron {
  color: var(--text-3);
  font-size: 12px;
  transition: transform var(--ease);
}

.chart-rail-collapsible.is-collapsed .chart-rail-mobile-chevron {
  transform: rotate(-90deg);
}

.chart-rail-collapsible.is-collapsed .chart-rail-header,
.chart-rail-collapsible.is-collapsed .chart-rail-body {
  display: none;
}

@media (min-width: 1024px) {
  .chart-rail-mobile-toggle { display: none !important; }

  .chart-rail-collapsible.is-collapsed .chart-rail-header {
    display: flex;
  }

  .chart-rail-collapsible.is-collapsed .chart-rail-body {
    display: block;
  }
}

.discover-workspace-inner {
  padding: 16px 16px 88px;
}

@media (min-width: 768px) {
  .discover-workspace-inner {
    padding: 20px 24px 40px;
  }
}

@media (min-width: 1024px) {
  .discover-workspace-inner {
    padding: 24px 32px 40px;
  }
}

body.discover-reports-shell .rpt-header .page-label {
  color: var(--teal);
}

/* ── Chat HD.ai polish ──────────────────────────────────────────────── */
body.chat-pro-layout #chat-topbar {
  height: 56px;
  padding: 0 16px;
}

#chat-sidebar-pro .session-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

#chat-sidebar-pro .session-item.active,
#chat-sidebar-pro .session-item:hover {
  background: var(--s1);
  border-color: var(--border);
  color: var(--text-1);
}

#messages {
  padding: 16px;
  gap: 12px;
}

.msg-row, .message-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

#chip-row {
  padding: 8px 16px;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--s1);
}

.intent-cta-card,
.upgrade-card {
  background: var(--s1) !important;
  border: 1px solid var(--border-md) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-sm) !important;
}

.intent-cta-title,
.upgrade-card-title { color: var(--text-1) !important; }

.intent-cta-sub,
.upgrade-card-sub { color: var(--text-2) !important; }

.intent-cta-btn,
.upgrade-card-btn {
  background: var(--brand-primary) !important;
  color: #fff !important;
  border: none !important;
  border-radius: var(--r-pill) !important;
}

#q-counter-bar {
  background: var(--s2) !important;
  color: var(--text-2) !important;
}

.q-bar-track { background: var(--border) !important; }
.q-bar-fill { background: var(--brand-primary) !important; }

#hd-context-strip {
  background: var(--brand-primary-dim) !important;
  color: var(--text-2) !important;
}

.hd-tag {
  background: var(--s1) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-2) !important;
}

#input-wrap {
  background: var(--s1) !important;
  padding: 12px 16px 16px !important;
}

/* ── Warm elegant foundation — display-font headlines ────────────────── */
.chart-identity-headline,
.chart-welcome-title,
.chart-rail-type-name {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: var(--tracking-display);
}

/* ═══════════════════════════════════════════════════════════════════════
   Warm Elegant Foundation — Phase 3 Discover / HD editorial layer
   Aligns display headings to the Fraunces serif spine and adds the
   scroll-reveal primitives editorial sections opt into with data-reveal.
   ═══════════════════════════════════════════════════════════════════════ */

/* Serif display voice for the identity / workspace headlines */
.chart-identity-headline,
.chart-welcome-title,
.type-hero .th-type,
.arch-hero .ah-name,
.narrative-card .nc-essence {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-display, -0.02em);
}

.chart-identity-brief {
  /* Warm cream wash instead of the old cool violet-only tint */
  background: linear-gradient(150deg, var(--s1) 0%, var(--brand-primary-dim) 100%);
}

.chart-insight-strip {
  background: var(--brand-primary-dim);
}

.chart-insight-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
}

/* Editorial reveal — used by static Discover/HD sections via data-reveal.
   Progressive: hidden only when JS marks the doc reveal-ready, so no-JS
   and reduced-motion users always see content. */
html.reveal-ready [data-reveal]:not(.is-revealed),
html.reveal-ready [data-reveal-stagger]:not(.is-revealed) > * {
  opacity: 0;
  transform: translateY(14px);
}

[data-reveal].is-revealed,
[data-reveal-stagger].is-revealed > *,
[data-reveal-stagger] > *.is-revealed {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 480ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
              transform 480ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}

@media (prefers-reduced-motion: reduce) {
  html.reveal-ready [data-reveal],
  html.reveal-ready [data-reveal-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
