/*
 * Ekāgnikāṇḍam-specific styles
 *
 * Supplements veda-brahmana.css with styles unique to Ekāgnikāṇḍam pages:
 * - Khanda headers and navigation
 * - Inline expansion blocks (visually distinguished)
 * - Anushaṅga blocks (expanded trailing forms)
 * - Cross-reference links (TS, TB, eAK)
 * - Korvai sections (khanda-level and prapathaka-level)
 * - Sub-section headers with reference numbers
 */

/* ============================================
   Ekāgnikāṇḍam Page Body
   ============================================ */

.ekagnikandam-page {
    --eak-accent: #6b3a2e;
    --eak-accent-light: #a86c5e;
    --eak-expansion-bg: #fdf6f0;
    --eak-expansion-border: #d4a574;
    --eak-anushanga-bg: #f0f5e8;
    --eak-anushanga-border: #8db070;
    --eak-ref-color: #2e7d32;
    --eak-ref-hover: #43a047;
    --eak-korvai-bg: rgba(184, 134, 11, 0.06);
}


/* ============================================
   Khanda Structures
   ============================================ */

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

.khanda-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(184, 134, 11, 0.08), rgba(184, 134, 11, 0.02));
    border-left: 4px solid var(--eak-accent);
    border-radius: 0 8px 8px 0;
}

.khanda-reference {
    font-family: 'Noto Sans', system-ui, 'Krishna Sanskrit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--eak-accent);
    background: rgba(107, 58, 46, 0.1);
    padding: 0.2em 0.5em;
    border-radius: 4px;
    white-space: nowrap;
}

.khanda-title {
    font-family: var(--veda-font-primary);
    font-size: 1.2rem;
    font-weight: 500;
    color: #3a2e24;
    margin: 0;
    line-height: 1.8;
}


/* ============================================
   Sub-section Headers
   ============================================ */

.sub-section {
    margin-bottom: 1.5rem;
}

.sub-section-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 1rem 0 0.5rem;
    padding: 0.3rem 0.6rem;
    border-bottom: 1px dashed rgba(184, 134, 11, 0.3);
}

.sub-section-ref {
    font-family: 'Noto Sans', system-ui, 'Krishna Sanskrit', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: #888;
    white-space: nowrap;
}

.sub-section-title {
    font-size: 1.05rem;
    color: #5a4a40;
    font-style: italic;
}

.sub-section-content {
    font-family: var(--veda-font-primary);
    font-size: 1.6rem;
    line-height: 2;
    padding: 0.5rem 0;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
    unicode-bidi: embed;
}


/* ============================================
   Mantra Text
   ============================================ */

.mantra-text {
    display: inline;
    font-family: var(--veda-font-primary);
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
}

.mantra-number {
    font-size: 0.85em;
    color: #b8860b;
    font-weight: 500;
    margin: 0 0.15em;
    white-space: nowrap;
}

.mantra-ref {
    margin-left: 0.25em;
}


/* ============================================
   Expansion Blocks (Inline, Visually Distinguished)
   ============================================ */

.expansions-block {
    margin: 0.75rem 0;
}

.expansion-entry {
    margin: 0.75rem 0;
    padding: 1rem 1.25rem;
    background: var(--eak-expansion-bg);
    border-left: 4px solid var(--eak-expansion-border);
    border-radius: 0 8px 8px 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    transition: border-left-color 0.3s, box-shadow 0.3s;
}

.expansion-entry:target {
    animation: highlight-expansion 2s ease-out;
    border-left-color: #8b4513;
    box-shadow: 0 0 20px rgba(139, 69, 19, 0.3);
}

@keyframes highlight-expansion {
    0% { background: #fff8dc; }
    100% { background: var(--eak-expansion-bg); }
}

.expansion-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.expansion-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--eak-accent);
    font-family: system-ui, 'Krishna Sanskrit', sans-serif;
    letter-spacing: 0.02em;
}

.expansion-short {
    font-size: 1rem;
    color: #555;
    padding-left: 0.25rem;
}

.expansion-full {
    font-family: var(--veda-font-primary);
    font-size: 1.1rem;
    color: #1a1a1a;
    line-height: 1.8;
    padding-top: 0.25rem;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
}

.expansion-ref {
    font-size: 0.85em;
    margin-top: 0.5rem;
    display: block;
}


/* ============================================
   Anushaṅga Blocks
   ============================================ */

.anushanga-block {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    background: var(--eak-anushanga-bg);
    border-left: 4px solid var(--eak-anushanga-border);
    border-radius: 0 8px 8px 0;
}

.anushanga-header {
    margin-bottom: 0.75rem;
}

.anushanga-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a7c31;
    font-family: system-ui, 'Krishna Sanskrit', sans-serif;
}

.anushanga-entries {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.anushanga-entry {
    font-family: var(--veda-font-primary);
    font-size: 1.1rem;
    line-height: 1.8;
    padding: 0.2rem 0;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
}

.anushanga-num {
    font-size: 0.85em;
    color: var(--eak-anushanga-border);
    font-weight: 500;
    margin-left: 0.25em;
}


/* ============================================
   Cross-Reference Links (TS, TB, eAK)
   ============================================ */

.cross-ref {
    color: var(--eak-ref-color);
    text-decoration: none;
    font-family: 'Noto Sans', system-ui, 'Krishna Sanskrit', sans-serif;
    font-size: 0.9em;
    white-space: nowrap;
    border-bottom: 1px dotted var(--eak-ref-color);
    transition: color 0.2s, border-bottom-color 0.2s;
}

.cross-ref:hover {
    color: var(--eak-ref-hover);
    border-bottom-color: var(--eak-ref-hover);
    text-decoration: none;
}

.cross-references {
    margin: 0.5rem 0;
    padding: 0.25rem 0;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cross-references::before {
    content: 'Ref:';
    font-size: 0.8rem;
    color: #999;
    font-family: system-ui, 'Krishna Sanskrit', sans-serif;
    align-self: center;
}


/* ============================================
   Korvai Sections (Khanda & Prapathaka Level)
   ============================================ */

.khanda-korvai {
    margin: 0.75rem 0;
    padding: 0.5rem 1rem;
    background: var(--eak-korvai-bg);
    border-radius: 6px;
    font-size: 0.95rem;
    color: #6b5b4f;
    text-align: center;
    line-height: 1.8;
}

.korvai-label {
    font-family: 'Noto Sans', system-ui, 'Krishna Sanskrit', sans-serif;
    font-weight: 600;
    font-size: 0.85em;
    color: #8b6914;
    margin: 0 0.3em;
}

.korvai-count {
    font-family: 'Noto Sans', system-ui, 'Krishna Sanskrit', sans-serif;
    font-size: 0.85em;
    color: #999;
}

.khanda-special-korvai {
    margin: 0.5rem 0;
    padding: 0.5rem 1rem;
    background: rgba(184, 134, 11, 0.04);
    border: 1px dashed rgba(184, 134, 11, 0.2);
    border-radius: 6px;
    font-size: 0.9rem;
    color: #8b6914;
    font-style: italic;
    text-align: center;
    line-height: 1.8;
}


/* ============================================
   Concluding Korvais (Prapathaka Level)
   ============================================ */

.concluding-korvais {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, #faf8f5 0%, #f5f0e8 100%);
    border: 2px solid #d4a574;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.1);
}

.concluding-title {
    font-size: 1.3rem;
    color: #8b4513;
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.concluding-korvai-item {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: white;
    border-left: 3px solid #d4a574;
    border-radius: 0 6px 6px 0;
}

.concluding-korvai-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #8b6914;
    font-family: system-ui, 'Krishna Sanskrit', sans-serif;
    display: block;
    margin-bottom: 0.3rem;
}

.concluding-korvai-text {
    font-family: var(--veda-font-primary);
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
}


/* ============================================
   Conclusion Section
   ============================================ */

.conclusion-section {
    margin: 2rem 0;
    padding: 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(255,248,235,0.6) 0%, rgba(255,243,218,0.4) 50%, rgba(255,248,235,0.6) 100%);
    border-radius: 12px;
    border: 1px solid rgba(184,134,11,0.15);
}

.conclusion-line {
    font-family: var(--veda-font-primary);
    font-size: 1.1rem;
    color: #8b4513;
    line-height: 2;
    font-weight: 500;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
}


/* ============================================
   Khanda Navigation (Side Rail)
   ============================================ */

/* Uses .anuvaka-nav from veda-brahmana.css
   Override only specific things needed */

.khanda-nav-topic {
    display: block;
    font-weight: 600;
    font-size: 0.95em;
    line-height: 1.4;
    color: var(--veda-ink-dark, #3a2e24);
}


/* ============================================
   Prārambha Section (opening mantras, separate
   from the invocation prayer, styled like a
   śānti pāṭha)
   ============================================ */

.praarambha-section {
    max-width: var(--veda-reading-width, 52rem);
    margin: 1.5rem auto 2rem;
    padding: 1.5rem 2rem;
    border-top: 2px solid rgba(184, 134, 11, 0.15);
    border-bottom: 2px solid rgba(184, 134, 11, 0.15);
    background: linear-gradient(
        135deg,
        rgba(255, 248, 235, 0.4) 0%,
        rgba(255, 243, 218, 0.2) 50%,
        rgba(255, 248, 235, 0.4) 100%
    );
    border-radius: 8px;
}

.praarambha-text {
    font-family: var(--veda-font-primary);
    font-size: 1.4rem;
    line-height: 2;
    color: var(--veda-ink-medium, #5a4a40);
    text-align: center;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
}

.praarambha-line {
    margin: 0.15rem 0;
}


/* ============================================
   Responsive Styles
   ============================================ */

@media (max-width: 768px) {
    .khanda-header {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.5rem 0.75rem;
    }
    
    .expansion-entry {
        padding: 0.75rem 1rem;
    }
    
    .anushanga-block {
        padding: 0.75rem 1rem;
    }
    
    .concluding-korvais {
        padding: 1rem;
    }
    
    .sub-section-header {
        flex-direction: column;
        gap: 0.2rem;
    }
}

@media (max-width: 480px) {
    .khanda-title {
        font-size: 1.05rem;
    }
    
    .sub-section-content {
        font-size: 1.05rem;
    }
    
    .expansion-full {
        font-size: 1rem;
    }
    
    .anushanga-entry {
        font-size: 1rem;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .expansion-entry {
        break-inside: avoid;
        border-left-color: #999;
        box-shadow: none;
    }
    
    .anushanga-block {
        break-inside: avoid;
        border-left-color: #999;
    }
    
    .cross-ref {
        color: #333;
        border-bottom: none;
    }
    
    .cross-ref::after {
        content: ' [' attr(href) ']';
        font-size: 0.7em;
        color: #666;
    }
    
    .concluding-korvais {
        border-color: #999;
        box-shadow: none;
    }
}


/* ════════════════════════════════════════════════════════════════
   REDESIGN 2026 LAYER — scholarly modern manuscript (veda-ekagnikandam)
   Appended override layer; original rules above untouched.
   ════════════════════════════════════════════════════════════════ */

:root {
  --veda-parchment: #f9f5ec;
  --veda-ink-dark: #2b2016;
  --veda-ink-medium: #4d3c2a;
  --veda-ink-light: #6b5d4a;
  --veda-accent-gold: #b8952f;
  --veda-accent-copper: #7a2a17;
  --veda-accent-sage: #8a6a2f;
  --veda-divider: #d8c9a8;
}

/* Progress bar */
.reading-progress-container { background: #efe7d2; }
.reading-progress-bar { background: linear-gradient(90deg, #b8952f, #7a2a17); }

/* Breadcrumb card */
.breadcrumb-nav {
  background: #fffdf7;
  border: 1px solid #e2d6b8;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(46, 42, 38, 0.06);
  padding: 0.6rem 1rem;
}
.breadcrumb-nav:hover { transform: none; box-shadow: 0 4px 14px rgba(46, 42, 38, 0.1); }
.breadcrumb-link { color: #8a6a2f; font-weight: 600; text-decoration-style: dotted; text-decoration-color: #c9b98e; }
.breadcrumb-link:hover { color: #7a2a17; background: none; }
.breadcrumb-separator { color: #c9b98e; }
.breadcrumb-current { color: #3d2317; font-weight: 700; }

/* Anuvāka rail */
.anuvaka-nav {
  background: #fffdf7;
  border: 1px solid #e2d6b8;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(46, 42, 38, 0.08);
}
.anuvaka-nav-title { color: #3d2317; border-bottom: 1px solid #efe7d2; padding-bottom: 8px; }
.anuvaka-nav-item { color: #5c4a33; border-left: 3px solid transparent; border-radius: 0 8px 8px 0; }
.anuvaka-nav-item:hover { background: #f4eedd; color: #3d2317; }
.anuvaka-nav-item.active {
  background: linear-gradient(90deg, rgba(122, 42, 23, 0.07), transparent);
  border-left-color: #7a2a17;
  color: #7a2a17;
  font-weight: 700;
}
.anuvaka-nav-preview { color: #a08e6e; font-style: italic; }

/* Script selector (overrides page-inline styles) */
body .script-selector {
  background: #fffdf7;
  border: 1px solid #e2d6b8;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(46, 42, 38, 0.08);
  padding: 8px 14px;
}
body .script-selector label { color: #8a6a2f; font-weight: 600; }
body .script-selector select { border: 1px solid #d8c9a8; border-radius: 8px; background: #fffdf7; color: #3d2317; }
body .script-selector select:hover { border-color: #b8952f; }

/* Text accents */
.pancashati-number, .pancashati-number strong { color: #b8952f; }
.pancashati-text.highlight { background: rgba(184, 149, 47, 0.28); }
.anuvaka-korvai { color: #8a6a2f; }
.anuvaka-number { color: #7a2a17; }
.om-symbol { color: #b8952f; }
.anuvaka-separator-icon { color: #c9a961; }
.cross-ref { color: #2f6db8; text-decoration: none; border-bottom: 1px dotted #2f6db8; }
.cross-ref:hover { color: #1e4f8f; border-bottom-style: solid; }

/* Stats table */
.stats-table { border: 1px solid #e2d6b8; border-radius: 12px; box-shadow: 0 4px 16px rgba(46, 42, 38, 0.06); }
.stats-table thead tr { background: linear-gradient(180deg, #f6efdc, #f2e8cf); }
.stats-table th { color: #5c4a33; border-bottom: 1px solid #d8c9a8; }
.stats-table td { color: #7a2a17; }
.stats-table th + th, .stats-table td + td { border-left-color: #e2d6b8; }


/* ── V2.3: 7a header fidelity ── */

/* Woven top border on reading pages (matches portal home) */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, #7a2a17 0 22px, #b8952f 22px 26px);
  z-index: 1002;
  pointer-events: none;
}

/* Progress line: fixed below the nav/search header row */
.reading-progress-container { top: 84px; z-index: 997; }
@media (max-width: 768px) {
  .reading-progress-container { top: 6px; }
}
