/* ============================================
   TOPIC ARTICLE PAGES — shared styles for the
   "How to study <topic>" study plan series.
   Builds on base.css + articles.css (dark theme).
   ============================================ */

:root {
    --plan-bg: #09090B;
    --plan-panel: #0F0F12;
    --plan-panel-2: #18181B;
    --plan-border: #27272A;
    --plan-blue: #60A5FA;
    --plan-blue-deep: #3B82F6;
    --plan-green: #4ADE80;
    --plan-green-deep: #34D399;
    --plan-text: #FAFAFA;
    --plan-text-soft: #E4E4E7;
    --plan-text-muted: #A1A1AA;
}

html {
    scroll-behavior: smooth;
}

main.ta-main {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1.25rem 4rem;
}

main.ta-main p {
    font-size: 1.06rem;
    line-height: 1.75;
}

/* ---- Reading progress bar ---- */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--plan-blue-deep), var(--plan-blue), var(--plan-green));
    z-index: 1000;
    transition: width 80ms linear;
}

/* ---- Hero ---- */
.ta-hero {
    position: relative;
    text-align: center;
    padding: 4.5rem 0 2.5rem;
}

.ta-hero::before {
    content: "";
    position: absolute;
    inset: -40% 0 auto;
    height: 130%;
    background:
        radial-gradient(ellipse 45% 55% at 30% 20%, rgba(59, 130, 246, 0.16), transparent 70%),
        radial-gradient(ellipse 40% 50% at 75% 10%, rgba(52, 211, 153, 0.10), transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.1rem;
    border: 1px solid var(--plan-border);
    border-radius: 999px;
    background: rgba(24, 24, 27, 0.7);
    color: var(--plan-text-soft);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    backdrop-filter: blur(6px);
}

.brand-pill .sigma {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--plan-blue-deep), var(--plan-green-deep));
    color: #fff;
    font-weight: 700;
}

.brand-pill .dot {
    color: var(--plan-text-muted);
}

.brand-pill:hover {
    border-color: var(--plan-blue-deep);
    color: var(--plan-text);
}

.ta-topic-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.2rem;
    height: 4.2rem;
    margin-top: 1.8rem;
    border-radius: 18px;
    border: 1px solid var(--plan-border);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(52, 211, 153, 0.16));
}

.ta-topic-icon img {
    width: 2.6rem;
    height: 2.6rem;
}

.ta-hero .eyebrow {
    display: block;
    margin-top: 1.2rem;
    color: var(--plan-text-muted);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ta-hero h1 {
    margin: 0.4rem auto 0;
    max-width: 14em;
    font-size: clamp(2.3rem, 6vw, 3.2rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, var(--plan-blue), var(--plan-green));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ta-hero .lead {
    margin: 1.3rem auto 0;
    max-width: 38em;
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--plan-text-muted);
}

/* ---- Section chip nav ---- */
.section-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.8rem 0.2rem;
    margin: 1.5rem -0.2rem 0;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--plan-border);
    scrollbar-width: none;
}

.section-nav::-webkit-scrollbar {
    display: none;
}

.section-nav a {
    flex: none;
    padding: 0.42rem 0.95rem;
    border: 1px solid var(--plan-border);
    border-radius: 999px;
    background: var(--plan-panel-2);
    color: var(--plan-text-soft);
    font-size: 0.86rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 150ms ease, color 150ms ease;
}

.section-nav a:hover {
    border-color: var(--plan-blue-deep);
    color: var(--plan-blue);
}

/* ---- Article sections ---- */
.ta-section {
    scroll-margin-top: 4.5rem;
    margin-top: 4.5rem;
}

.section-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    border-bottom: 1px solid var(--plan-border);
    padding-bottom: 0.8rem;
    margin-bottom: 1.5rem;
}

.section-num {
    flex: none;
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(180deg, var(--plan-blue), rgba(96, 165, 250, 0.25));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.section-head h2 {
    margin: 0 !important;
    color: var(--plan-blue);
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    letter-spacing: -0.01em;
}

/* ---- Sub-headings within a section ---- */
.ta-section h3 {
    margin: 2.4rem 0 0.9rem;
    color: var(--plan-text);
    font-size: 1.3rem;
    letter-spacing: -0.01em;
}

.ta-section h3 .h3-tag {
    color: var(--plan-blue);
}

/* ---- Figures ---- */
.plan-figure {
    margin: 2.2rem auto;
    text-align: center;
}

.plan-figure img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

.plan-figure.narrow img {
    max-width: 420px;
}

/* ---- Example question cards ---- */
.example-question {
    margin: 1.4rem 0;
    padding: 1rem 1.3rem;
    background: var(--plan-panel);
    border: 1px solid var(--plan-border);
    border-left: 3px solid var(--plan-blue-deep);
    border-radius: 12px;
}

.example-question .eq-label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--plan-blue);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.example-question p {
    margin: 0;
    color: var(--plan-text);
    font-size: 1.08rem !important;
    font-weight: 500;
    line-height: 1.6 !important;
}

/* ---- Key point callout ---- */
.ta-callout {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    margin: 1.8rem 0;
    padding: 1.05rem 1.3rem;
    background: linear-gradient(180deg, rgba(52, 211, 153, 0.14), rgba(52, 211, 153, 0.07));
    border: 1px solid rgba(52, 211, 153, 0.35);
    border-radius: 14px;
}

.ta-callout .note-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 9px;
    background: rgba(52, 211, 153, 0.2);
    color: var(--plan-green);
    font-weight: 700;
}

.ta-callout p {
    margin: 0;
    color: #A7F3D0;
    font-size: 1rem !important;
    font-weight: 500;
    line-height: 1.6 !important;
}

/* ---- Concept connection table ---- */
.connection-table {
    display: grid;
    gap: 0.6rem;
    margin: 1.8rem 0;
}

.connection-head,
.connection-row {
    display: grid;
    grid-template-columns: 9.5rem 1fr 1.35fr;
    gap: 1.2rem;
    align-items: center;
}

.connection-head {
    padding: 0 1.2rem;
    color: var(--plan-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.connection-row {
    padding: 1rem 1.2rem;
    background: var(--plan-panel);
    border: 1px solid var(--plan-border);
    border-radius: 12px;
}

.connection-row .conn-topic {
    justify-self: start;
    max-width: 100%;
    padding: 0.35rem 0.85rem;
    border: 1px solid rgba(59, 130, 246, 0.45);
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    color: var(--plan-blue);
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.3;
}

.connection-row > span,
.connection-head > span {
    min-width: 0;
}

.connection-row .conn-example {
    color: var(--plan-text);
    font-size: 1.02rem;
    overflow-x: auto;
}

.connection-row .conn-example img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.connection-row .conn-skill {
    color: var(--plan-text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.connection-row .conn-skill strong {
    color: var(--plan-green);
    font-weight: 600;
}

@media (max-width: 720px) {
    .connection-head {
        display: none;
    }
    .connection-row {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }
}

/* ---- Numbered study steps ---- */
.study-steps {
    list-style: none;
    counter-reset: step;
    display: grid;
    gap: 0.6rem;
    margin: 1.6rem 0;
    padding: 0;
}

.study-steps li {
    position: relative;
    counter-increment: step;
    padding: 0.85rem 1.1rem 0.85rem 3.4rem;
    background: var(--plan-panel);
    border: 1px solid var(--plan-border);
    border-radius: 12px;
    color: var(--plan-text-soft);
    font-weight: 500;
}

.study-steps li::before {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--plan-blue);
    font-weight: 800;
    font-size: 0.95rem;
}

/* ---- Expandable study steps (accordion) ---- */
.study-accordion {
    counter-reset: step;
    display: grid;
    gap: 0.6rem;
    margin: 1.6rem 0;
}

details.study-step {
    background: var(--plan-panel);
    border: 1px solid var(--plan-border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 150ms ease;
}

details.study-step:hover,
details.study-step[open] {
    border-color: rgba(59, 130, 246, 0.5);
}

details.study-step summary {
    position: relative;
    counter-increment: step;
    padding: 0.9rem 3rem 0.9rem 3.4rem;
    color: var(--plan-text-soft);
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

details.study-step summary::-webkit-details-marker {
    display: none;
}

details.study-step summary::before {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--plan-blue);
    font-weight: 800;
    font-size: 0.95rem;
}

details.study-step summary::after {
    content: "▾";
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--plan-text-muted);
    transition: transform 200ms ease;
}

details.study-step[open] summary {
    color: var(--plan-blue);
    font-weight: 600;
    border-bottom: 1px solid var(--plan-border);
}

details.study-step[open] summary::after {
    transform: translateY(-50%) rotate(180deg);
    color: var(--plan-blue);
}

details.study-step .step-body {
    padding: 0.4rem 1.4rem 1.3rem;
}

details.study-step .step-body p {
    font-size: 1rem !important;
    line-height: 1.7 !important;
}

details.study-step .step-body .plan-figure {
    margin: 1.4rem auto;
}

/* ---- Inline maths example panels ---- */
.math-examples {
    display: grid;
    gap: 0.9rem;
    margin: 1.4rem 0;
    padding: 1.2rem 1.3rem;
    background: var(--plan-panel-2);
    border: 1px solid var(--plan-border);
    border-radius: 12px;
    /* The whole panel scrolls horizontally as one block when the widest
       equation overflows, so every row moves together and the labels stay
       aligned. Scrollbar is hidden — see below. */
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* old Edge/IE */
}

.math-examples::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

.math-examples .mx-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    color: var(--plan-text);
    font-size: 1.05rem;
}

.math-examples .mx-label {
    color: var(--plan-text-muted);
    font-size: 0.88rem;
    min-width: 6.5rem;
    text-align: right;
    flex-shrink: 0;
}

/* Plain-text vocabulary terms shown as pills (see the mx_terms macro). */
.math-examples .mx-terms {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.math-examples .mx-term {
    padding: 0.34rem 0.85rem;
    border: 1px solid var(--plan-border);
    border-radius: 999px;
    background: var(--plan-panel);
    color: var(--plan-text-soft);
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
}

.math-examples .verdict-yes {
    color: var(--plan-green);
    font-weight: 700;
    font-size: 1.15rem;
}

.math-examples .verdict-no {
    color: #F87171;
    font-weight: 700;
    font-size: 1.15rem;
}

/* ---- Footer navigation ---- */
.article-footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 3rem;
}

.article-footer-nav a {
    display: inline-block;
    padding: 0.7rem 1.3rem;
    border: 1px solid var(--plan-border);
    border-radius: 12px;
    background: var(--plan-panel);
    color: var(--plan-blue) !important;
    font-weight: 600;
    text-decoration: none !important;
    transition: border-color 150ms ease, transform 150ms ease;
}

.article-footer-nav a:hover {
    border-color: var(--plan-blue-deep);
    transform: translateY(-2px);
}

/* ---- Scroll reveal ---- */
.reveal-init {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.reveal-init.in-view {
    opacity: 1;
    transform: none;
}

/* ---- CTA ---- */
.plan-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 4.5rem;
    padding: 2rem 2.2rem;
    border-radius: 20px;
    border: 1px solid var(--plan-border);
    background:
        radial-gradient(ellipse 60% 120% at 0% 0%, rgba(59, 130, 246, 0.18), transparent 65%),
        radial-gradient(ellipse 60% 120% at 100% 100%, rgba(52, 211, 153, 0.14), transparent 65%),
        var(--plan-panel);
}

.plan-cta .brand-mini {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--plan-text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.plan-cta .brand-mini .sigma {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--plan-blue-deep), var(--plan-green-deep));
    color: #fff;
    font-size: 0.85rem;
}

.plan-cta h2 {
    margin: 0.55rem 0 0.4rem !important;
    font-size: 1.5rem;
    color: var(--plan-text);
}

.plan-cta p {
    margin: 0;
    max-width: 36em;
    color: var(--plan-text-muted);
    font-size: 0.98rem !important;
    line-height: 1.65 !important;
}

.cta-stats {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1.2rem 0 0;
    padding: 0;
}

.cta-stats li {
    padding: 0.5rem 1rem;
    border: 1px solid var(--plan-border);
    border-radius: 999px;
    background: rgba(9, 9, 11, 0.5);
    color: var(--plan-text-muted);
    font-size: 0.9rem;
}

.cta-stats li strong {
    color: var(--plan-blue);
    font-weight: 700;
    margin-right: 0.3rem;
}

.cta-stats li.topic-stat strong {
    color: var(--plan-green);
}

.cta-btn {
    flex: none;
    display: inline-block;
    padding: 0.85rem 1.7rem;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--plan-blue-deep), var(--plan-green-deep));
    color: #fff !important;
    font-weight: 700;
    text-decoration: none !important;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

/* ---- Mobile ---- */
@media (max-width: 720px) {
    .ta-hero {
        padding-top: 3rem;
    }
    .section-num {
        font-size: 1.9rem;
    }
    .plan-cta {
        padding: 1.6rem 1.4rem;
    }
    .math-examples {
        padding: 1.1rem 1rem;
    }
    /* Left-align so an overflowing equation scrolls from its start and stays
       fully reachable (centering would clip the leading edge). */
    .math-examples .mx-row {
        justify-content: flex-start;
    }
    .math-examples .mx-label {
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    .reveal-init {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
