/* ========================================
   INDIVIDUAL TOPIC PAGE CSS
   Slate/Charcoal Academic Theme
======================================== */

/* Topic Page Hero */
.tp-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    padding: 2.5rem var(--gap-md);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.tp-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
}
.tp-hero-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin: 0 auto 1rem;
}
.tp-hero h1 { font-size: 1.5rem; font-weight: 800; color: white; margin: 0 0 0.5rem 0; position: relative; }
.tp-hero p { font-size: 0.85rem; line-height: 1.6; color: white; max-width: 650px; margin: 0 auto; position: relative; }

/* Breadcrumb */
.tp-breadcrumb { padding: 0.75rem var(--gap-md); background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.tp-breadcrumb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; max-width: 900px; margin-inline: auto; font-size: 0.75rem; }
.tp-breadcrumb-list a { color: #6366f1; text-decoration: none; font-weight: 500; }
.tp-breadcrumb-list a:hover { text-decoration: underline; }
.tp-breadcrumb-sep { color: #94a3b8; }
.tp-breadcrumb-current { color: #64748b; font-weight: 600; }

/* Topic Content Area */
.tp-content-section { max-width: 900px; margin: 0 auto; padding: 2rem var(--gap-md) 3rem; }

/* Calculator Embed */
.tp-calculator-wrap {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.tp-calc-header {
    background: linear-gradient(135deg, #1e293b, #334155);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.tp-calc-header i { color: #6366f1; font-size: 1rem; }
.tp-calc-header h2 { font-size: 0.9rem; font-weight: 700; color: white; margin: 0; }
.tp-calc-body { padding: 1.25rem; }

.tp-calc-formula {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}
.tp-calc-formula-label { font-size: 0.65rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; }
.tp-calc-formula-eq { font-size: 1.1rem; font-weight: 700; color: #1e293b; font-family: 'Courier New', monospace; }

.tp-calc-inputs { display: grid; grid-template-columns: 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.tp-calc-group { display: flex; flex-direction: column; gap: 0.25rem; }
.tp-calc-label { font-size: 0.7rem; font-weight: 600; color: #64748b; display: flex; align-items: center; gap: 0.3rem; }
.tp-calc-label span { font-family: 'Courier New', monospace; color: #6366f1; font-weight: 700; }
.tp-calc-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; }
.tp-calc-input {
    padding: 0.65rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    transition: border-color 0.15s;
}
.tp-calc-input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.tp-calc-unit {
    padding: 0.65rem 0.75rem;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    min-width: 60px;
    justify-content: center;
}
.tp-calc-btn {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 1rem;
}
.tp-calc-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(99,102,241,0.4); }
.tp-calc-result {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 2px solid #86efac;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}
.tp-calc-result-label { font-size: 0.65rem; font-weight: 700; color: #14532d; text-transform: uppercase; margin-bottom: 0.3rem; }
.tp-calc-result-value { font-size: 1.5rem; font-weight: 700; color: #166534; font-family: 'Courier New', monospace; }
.tp-calc-result-unit { font-size: 0.8rem; color: #15803d; font-weight: 600; }

/* Topic Concepts */
.tp-concept { margin-bottom: 2.25rem; }
.tp-concept h3 { display: flex; align-items: center; gap: 0.6rem; font-size: 1.1rem; font-weight: 700; color: #9ea4ae; margin: 0 0 0.75rem 0; }
.tp-concept-num { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; min-width: 30px; border-radius: 50%; font-size: 0.85rem; font-weight: 800; color: white; }
.tp-concept > p { font-size: 0.875rem; line-height: 1.75; color: #9ea4ae; margin: 0 0 1rem 0; }

.tp-formula { background: linear-gradient(135deg, #f8fafc, #f1f5f9); border: 2px solid #e2e8f0; border-radius: 12px; padding: 1.25rem; margin: 1rem 0; text-align: center; }
.tp-formula-main { font-size: 1.3rem; font-weight: 800; color: #1e293b; font-family: 'Courier New', monospace; margin-bottom: 0.6rem; }
.tp-formula-vars { display: flex; flex-direction: column; gap: 0.25rem; }
.tp-formula-vars span { font-size: 0.75rem; color: #64748b; font-family: 'Courier New', monospace; }

.tp-table { border: 2px solid #e2e8f0; border-radius: 12px; overflow: hidden; margin: 1rem 0; }
.tp-table-row { display: flex; justify-content: space-between; align-items: center; padding: 0.7rem 1rem; border-bottom: 1px solid #f1f5f9; }
.tp-table-row:last-child { border-bottom: none; }
.tp-table-row:nth-child(even) { background: #f8fafc; }
.tp-table-cell { font-family: 'Courier New', monospace; font-size: 0.85rem; font-weight: 700; color: #9ea4ae; }
.tp-table-note { font-size: 0.7rem; color: #94a3b8; font-weight: 600; text-align: right; }

.tp-insight { display: flex; gap: 0.75rem; background: linear-gradient(135deg, #fefce8, #fef9c3); border: 2px solid #fde047; border-radius: 10px; padding: 1rem; margin: 1rem 0; }
.tp-insight i { color: #ca8a04; font-size: 1rem; margin-top: 2px; flex-shrink: 0; }
.tp-insight span { font-size: 0.8rem; line-height: 1.6; color: #713f12; }

.tp-two-col { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 1rem 0; }
.tp-col { background: #f8fafc; border: 2px solid #e2e8f0; border-radius: 12px; padding: 1rem; }
.tp-col-title { font-size: 0.7rem; font-weight: 700; color: #6366f1; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.5rem; }
.tp-col p { font-size: 0.8rem; line-height: 1.6; color: #475569; margin: 0 0 0.5rem 0; }

.tp-diagram { margin: 1.25rem 0; border: 2px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.tp-svg-wrap { background: white; padding: 1rem; display: flex; justify-content: center; }
.tp-svg { width: 100%; max-width: 500px; height: auto; }
.tp-diagram-caption { background: #f8fafc; padding: 0.75rem 1rem; font-size: 0.75rem; line-height: 1.6; color: #64748b; border-top: 1px solid #e2e8f0; }

/* Worked Examples */
.tp-example { background: white; border: 2px solid #e2e8f0; border-radius: 14px; margin-bottom: 1.75rem; overflow: hidden; }
.tp-ex-header { background: linear-gradient(135deg, #1e293b, #334155); padding: 1rem 1.25rem; }
.tp-ex-badge { display: inline-block; background: #fbbf24; color: #1e293b; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; }
.tp-ex-header h4 { font-size: 1rem; font-weight: 700; color: white; margin: 0; }
.tp-ex-problem { padding: 1.25rem; background: #fefce8; border-bottom: 2px solid #fde047; font-size: 0.85rem; line-height: 1.7; color: #713f12; }
.tp-ex-solution { padding: 1.25rem; }
.tp-sol-step { margin-bottom: 1.25rem; }
.tp-sol-step:last-child { margin-bottom: 0; }
.tp-sol-label { font-size: 0.7rem; font-weight: 700; color: #6366f1; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.5rem; padding-bottom: 0.3rem; border-bottom: 1px solid #e2e8f0; }
.tp-sol-content { padding-left: 0.5rem; }
.tp-sol-content p { font-size: 0.825rem; line-height: 1.6; color: #475569; margin: 0 0 0.5rem 0; }
.tp-math { font-family: 'Courier New', monospace; font-size: 0.85rem; color: #1e293b; padding: 0.3rem 0; line-height: 1.5; }
.tp-result { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border: 1px solid #86efac; border-radius: 6px; padding: 0.4rem 0.75rem; font-weight: 700; color: #166534; display: inline-block; margin: 0.25rem 0; }
.tp-ex-answer { padding: 1rem 1.25rem; background: linear-gradient(135deg, #f8fafc, #f1f5f9); border-top: 2px solid #e2e8f0; font-size: 0.825rem; line-height: 1.6; color: #475569; }

/* Back to Topics link */
.tp-back-link { display: inline-flex; align-items: center; gap: 0.4rem; color: #6366f1; font-size: 0.8rem; font-weight: 600; text-decoration: none; margin-bottom: 1.5rem; transition: gap 0.15s; }
.tp-back-link:hover { gap: 0.6rem; }

/* Related Topics */
.tp-related { margin-top: 2rem; padding-top: 2rem; border-top: 2px solid #e2e8f0; }
.tp-related h3 { font-size: 1rem; font-weight: 700; color: #1e293b; margin: 0 0 1rem 0; }
.tp-related-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.tp-related-card { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: #f8fafc; border: 2px solid #e2e8f0; border-radius: 10px; text-decoration: none; transition: all 0.15s; }
.tp-related-card:hover { border-color: #6366f1; transform: translateX(4px); }
.tp-related-icon { width: 36px; height: 36px; min-width: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; color: white; }
.tp-related-card span { font-size: 0.8rem; font-weight: 600; color: #1e293b; }

@media (min-width: 576px) {
    .tp-calc-inputs { grid-template-columns: 1fr 1fr; }
    .tp-two-col { grid-template-columns: 1fr 1fr; }
    .tp-related-grid { grid-template-columns: 1fr 1fr; }
    .tp-hero h1 { font-size: 1.75rem; }
}
@media (min-width: 768px) {
    .tp-hero { padding: 3rem var(--gap-md); }
    .tp-hero h1 { font-size: 2rem; }
    .tp-content-section { padding: 2.5rem var(--gap-lg) 3rem; }
}
@media (min-width: 1024px) {
    .tp-related-grid { grid-template-columns: 1fr 1fr 1fr; }
}
@media print {
    .tp-hero { background: white; } .tp-hero h1 { color: #1e293b; }
    .tp-calculator-wrap { display: none; }
    .tp-example { break-inside: avoid; }
}
