/**
 * Constants Explorer Styles — P3 Sprint 5 Task 5.1
 * Tabbed interface for browsing Sankhya constants by category
 * Scoped under .discovery-zone to prevent global style bleed
 */

.discovery-zone .constants-explorer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--ocean, #0D3B6E);
}

.discovery-zone .explorer-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ocean, #0D3B6E);
}

.discovery-zone .state-filter-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.discovery-zone .filter-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text, #333);
}

.discovery-zone .state-filter-group {
  display: flex;
  gap: 0.5rem;
}

.discovery-zone .state-filter-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ocean, #0D3B6E);
  background: white;
  border: 1.5px solid var(--ocean, #0D3B6E);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.discovery-zone .state-filter-btn:hover {
  background: rgba(13, 59, 110, 0.05);
}

.discovery-zone .state-filter-btn:focus {
  outline: 2px solid var(--gold, #C8963E);
  outline-offset: 2px;
}

.discovery-zone .state-filter-btn.active {
  background: var(--ocean, #0D3B6E);
  color: white;
}

/* Category Tabs */
.discovery-zone .category-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding: 0.5rem;
  background: rgba(13, 59, 110, 0.03);
  border-radius: 8px;
  overflow-x: auto;
}

.discovery-zone .category-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ocean, #0D3B6E);
  background: white;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.discovery-zone .category-tab:hover {
  border-color: var(--ocean, #0D3B6E);
  background: rgba(13, 59, 110, 0.05);
}

.discovery-zone .category-tab:focus {
  outline: 2px solid var(--gold, #C8963E);
  outline-offset: 2px;
}

.discovery-zone .category-tab.active {
  background: var(--ocean, #0D3B6E);
  color: white;
  border-color: var(--ocean, #0D3B6E);
}

.discovery-zone .tab-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(200, 150, 62, 0.2);
  color: var(--gold-dk, #9B7530);
  border-radius: 10px;
}

.discovery-zone .category-tab.active .tab-count-badge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Constants Grid */
.discovery-zone .constants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .discovery-zone .constants-grid {
    grid-template-columns: 1fr;
  }
}

.discovery-zone .constants-empty {
  grid-column: 1 / -1;
  padding: 3rem;
  text-align: center;
  font-size: 1.1rem;
  color: #666;
  background: rgba(13, 59, 110, 0.03);
  border-radius: 8px;
}

/* Constant Card */
.discovery-zone .constant-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.25rem;
  transition: all 0.2s ease;
}

.discovery-zone .constant-card:hover {
  border-color: var(--ocean, #0D3B6E);
  box-shadow: 0 4px 12px rgba(13, 59, 110, 0.1);
}

.discovery-zone .constant-card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.discovery-zone .constant-symbol-id {
  flex-shrink: 0;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--forest, #2D6A4F);
}

.discovery-zone .constant-names {
  flex: 1;
}

.discovery-zone .constant-sankhya-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ocean, #0D3B6E);
  margin-bottom: 0.25rem;
}

.discovery-zone .constant-physics-name {
  font-size: 0.9rem;
  font-style: italic;
  color: #666;
}

/* State Badge */
.discovery-zone .constant-state-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.discovery-zone .constant-state-badge.state-foundational {
  background: rgba(128, 128, 128, 0.15);
  color: #555;
}

.discovery-zone .constant-state-badge.state-expansive {
  background: rgba(21, 101, 192, 0.15);
  color: var(--guna-expansive, #1565C0);
}

.discovery-zone .constant-state-badge.state-resonant {
  background: rgba(39, 174, 96, 0.15);
  color: var(--guna-resonant, #27AE60);
}

.discovery-zone .constant-state-badge.state-coherent {
  background: rgba(192, 57, 43, 0.15);
  color: var(--guna-coherent, #C0392B);
}

/* Derivation Container */
.discovery-zone .constant-derivation {
  margin: 1rem 0;
  min-height: 60px;
}

.discovery-zone .constant-value-display {
  padding: 0.75rem;
  background: rgba(13, 59, 110, 0.03);
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  color: var(--ocean, #0D3B6E);
}

/* Repeating-decimal series table (n/7 on the 1/7 card, n/9 on the 10 card) */
.discovery-zone .constant-series {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: var(--dz-bg-soft, #F6F8FB);
  border: 1px solid var(--dz-line, #E3E8EE);
  border-radius: 10px;
}
.discovery-zone .constant-series-caption {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--dz-ocean, #0D3B6E);
  margin-bottom: 0.5rem;
}
.discovery-zone .constant-series-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.discovery-zone .constant-series-table th,
.discovery-zone .constant-series-table td {
  padding: 0.28rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--dz-line, #E3E8EE);
  font-size: 0.9rem;
}
.discovery-zone .constant-series-table tr:last-child th,
.discovery-zone .constant-series-table tr:last-child td {
  border-bottom: none;
}
.discovery-zone .constant-series-table th {
  width: 4.5rem;
  font-weight: 700;
  color: var(--dz-forest, #2D6A4F);
  font-family: var(--serif, Georgia, serif);
}
.discovery-zone .constant-series-table td {
  color: var(--dz-ink, #1a2733);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* Substratum narrative — the six key numbers of SANKEINSTEIN1 */
.discovery-zone .constant-substratum {
  margin-top: 1rem;
  padding: 1rem 1.1rem 1.1rem;
  background: linear-gradient(180deg, #FBFCFE 0%, var(--dz-bg-soft, #F6F8FB) 100%);
  border: 1px solid var(--dz-line, #E3E8EE);
  border-left: 4px solid var(--dz-gold, #C8963E);
  border-radius: 10px;
}
.discovery-zone .constant-substratum-band {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.7rem;
  border-bottom: 1px solid var(--dz-line, #E3E8EE);
}
.discovery-zone .constant-substratum-glyph {
  font-size: 1.6rem;
  color: var(--dz-ocean, #0D3B6E);
  line-height: 1;
  flex: 0 0 auto;
}
.discovery-zone .constant-substratum-modality {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.discovery-zone .constant-substratum-role {
  font-family: var(--serif, Georgia, serif);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--dz-ocean, #0D3B6E);
}
.discovery-zone .constant-substratum-cell {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--dz-forest, #2D6A4F);
}
.discovery-zone .constant-substratum-summary {
  margin: 0 0 0.9rem;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--dz-ink, #1a2733);
}
.discovery-zone .constant-substratum-forms {
  margin-bottom: 0.9rem;
}
.discovery-zone .constant-substratum-forms-label,
.discovery-zone .constant-substratum-props-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--dz-forest, #2D6A4F);
  margin-bottom: 0.45rem;
}
.discovery-zone .constant-substratum-form {
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.35rem;
  background: #fff;
  border: 1px solid var(--dz-line, #E3E8EE);
  border-radius: 8px;
  overflow-x: auto;
}
.discovery-zone .constant-substratum-form:last-child {
  margin-bottom: 0;
}
.discovery-zone .constant-substratum-props {
  margin-bottom: 0.9rem;
}
.discovery-zone .constant-substratum-prop-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.discovery-zone .constant-substratum-prop-list li {
  font-size: 0.86rem;
  line-height: 1.45;
  color: #55606b;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.2rem;
}
.discovery-zone .constant-substratum-prop-list li strong {
  color: #55606b;
}
.discovery-zone .constant-substratum-prop-list li.is-active {
  background: rgba(200, 150, 62, 0.12);
  color: var(--dz-ink, #1a2733);
}
.discovery-zone .constant-substratum-prop-list li.is-active strong {
  color: var(--dz-ocean, #0D3B6E);
}
.discovery-zone .constant-substratum-master {
  padding: 0.8rem 0.9rem;
  background: var(--dz-ocean, #0D3B6E);
  border-radius: 8px;
  text-align: center;
}
.discovery-zone .constant-substratum-master-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dz-gold, #C8963E);
  margin-bottom: 0.45rem;
}
.discovery-zone .constant-substratum-master-eq {
  color: #fff;
  margin-bottom: 0.3rem;
}
.discovery-zone .constant-substratum-master-eq:last-child {
  margin-bottom: 0;
}
.discovery-zone .constant-substratum-master-eq .katex {
  color: #fff;
}

/* Card Footer */
.discovery-zone .constant-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e0e0e0;
}

.discovery-zone .constant-source {
  font-size: 0.8rem;
  color: #666;
  font-style: italic;
}

.discovery-zone .constant-sandbox-btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  background: var(--ocean, #0D3B6E);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.discovery-zone .constant-sandbox-btn:hover:not(:disabled) {
  background: #0A2D52;
  transform: translateX(2px);
}

.discovery-zone .constant-sandbox-btn:focus {
  outline: 2px solid var(--gold, #C8963E);
  outline-offset: 2px;
}

.discovery-zone .constant-sandbox-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .discovery-zone .constants-explorer-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .discovery-zone .state-filter-container {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .discovery-zone .state-filter-group {
    flex-wrap: wrap;
    width: 100%;
  }

  .discovery-zone .state-filter-btn {
    flex: 1;
    min-width: 100px;
  }

  .discovery-zone .category-tabs {
    flex-direction: column;
  }

  .discovery-zone .category-tab {
    justify-content: space-between;
  }

  .discovery-zone .constant-card-footer {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .discovery-zone .constant-sandbox-btn {
    width: 100%;
  }
}



/* Jump-to highlight when a constant card is targeted from search */
.constant-card-jump-highlight {
  animation: constant-card-jump-pulse 1.8s ease-out;
  box-shadow: 0 0 0 3px var(--dz-gold, #C8963E), 0 8px 24px rgba(200, 150, 62, 0.35);
  border-color: var(--dz-gold, #C8963E) !important;
}

@keyframes constant-card-jump-pulse {
  0%   { box-shadow: 0 0 0 4px var(--dz-gold, #C8963E), 0 8px 28px rgba(200, 150, 62, 0.55); }
  100% { box-shadow: 0 0 0 3px rgba(200, 150, 62, 0.0), 0 8px 24px rgba(200, 150, 62, 0.0); }
}



/* =========================================================================
   INLINE CONSTANT EXPLORER (2026-07-23)
   Slides open directly below the Sankhya Calculator when a symbol is
   clicked. The body carries the .discovery-zone class so every existing
   .discovery-zone .constant-card rule (and guna variables) applies here.
   ========================================================================= */
.sc-inline-explorer {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  margin: 0;
  border-radius: 14px;
  transition: max-height 0.38s ease, opacity 0.32s ease,
              transform 0.32s ease, margin 0.32s ease;
}
/* When revealed, JS removes [hidden] and adds .is-open */
.sc-inline-explorer.is-open {
  max-height: 2600px;
  opacity: 1;
  transform: translateY(0);
  margin: 18px 0 8px;
}
/* Belt-and-suspenders: the [hidden] attribute keeps it collapsed pre-JS */
.sc-inline-explorer[hidden] {
  display: none;
}

.sc-inline-explorer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--dz-ocean, #0D3B6E);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px 12px 0 0;
}
.sc-inline-explorer-eyebrow {
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.sc-inline-explorer-close {
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}
.sc-inline-explorer-close:hover {
  background: rgba(255, 255, 255, 0.28);
}
.sc-inline-explorer-close:focus-visible {
  outline: 3px solid var(--dz-gold, #C8963E);
  outline-offset: 2px;
}

.sc-inline-explorer-body {
  background: var(--dz-bg-soft, #F6F8FB);
  border: 1px solid var(--dz-line, #E3E8EE);
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 18px;
}
/* The card sits flush inside the panel body */
.sc-inline-explorer-body.discovery-zone .constant-card {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .sc-inline-explorer {
    transition: none;
  }
}
