/* ============================================================
   Shared design system for /learn/math/*.html SEO landing pages.
   Linked from each standalone HTML page in this folder.
   Brand-consistent with the rest of /learn/ (ink + accent2).
   ============================================================ */

:root {
    --ink: #0d1117;
    --ink-soft: #1a1a2e;
    --bg: #fafafa;
    --card: #ffffff;
    --text: #1a1a2e;
    --muted: #5b6172;
    --accent: #e85a1c;
    --accent2: #f7a51e;
    --border: #e6e8ee;
    --soft: #fff7e6;
    --maxw: 880px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Heebo', system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Header / hero ---------- */
header.page-header {
    background: linear-gradient(140deg, var(--ink) 0%, #161b2e 100%);
    color: #fff;
    padding: 56px 0 64px;
    position: relative;
    overflow: hidden;
}
header.page-header::before {
    content: '';
    position: absolute;
    top: -80px; left: -80px;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(247,165,30,0.18), transparent 70%);
}
.crumbs {
    font-size: 14px;
    color: #c8ccd6;
    margin-bottom: 18px;
}
.crumbs a { color: #c8ccd6; }
.crumbs a:hover { color: #fff; }
header.page-header h1 {
    font-family: 'Frank Ruhl Libre', Georgia, serif;
    font-size: clamp(30px, 5.2vw, 46px);
    font-weight: 800;
    margin: 0 0 14px;
    line-height: 1.2;
    color: var(--accent2);
}
header.page-header h1 em {
    font-style: normal;
    color: var(--accent2);
}
header.page-header .lead {
    font-size: clamp(16px, 2.4vw, 19px);
    color: #d6d9e2;
    max-width: 640px;
    margin: 0;
}

/* ---------- Sections ---------- */
main { padding: 40px 0 80px; }

section { margin: 40px 0; }

h2 {
    font-family: 'Frank Ruhl Libre', Georgia, serif;
    font-size: clamp(22px, 3.4vw, 30px);
    font-weight: 700;
    color: var(--ink-soft);
    margin: 0 0 16px;
    line-height: 1.3;
}

h3 {
    font-size: clamp(18px, 2.6vw, 22px);
    font-weight: 700;
    color: var(--ink-soft);
    margin: 24px 0 10px;
}

p { margin: 0 0 14px; }

ul, ol { padding-right: 22px; margin: 0 0 14px; }
li { margin-bottom: 6px; }

strong { color: var(--ink-soft); }

/* ---------- Formula hero ---------- */
.formula-hero {
    background: var(--ink);
    border-radius: 20px;
    padding: 44px 32px;
    margin: 32px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.formula-hero::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(247,165,30,0.15), transparent 70%);
}
.formula-label {
    color: #b9bdca;
    font-size: 14px;
    letter-spacing: 0.04em;
    margin: 0 0 14px;
    text-transform: uppercase;
}
.formula-main {
    color: var(--accent2);
    font-size: clamp(22px, 4.2vw, 36px);
    font-weight: 700;
    line-height: 1.4;
}
.formula-desc {
    color: #d6d9e2;
    font-size: 14px;
    margin-top: 14px;
}

/* ---------- Example cards ---------- */
.examples {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 20px 0;
}
@media (min-width: 640px) {
    .examples.two { grid-template-columns: 1fr 1fr; }
}
.example {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 22px 18px;
    box-shadow: 0 1px 3px rgba(13,17,23,0.04);
}
.example h3 {
    margin-top: 0;
    color: var(--accent);
    font-size: 17px;
}
.example .steps {
    background: var(--soft);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 15px;
    margin: 12px 0 0;
    list-style: none;
    padding-right: 16px;
}
.example .steps li {
    padding: 4px 0;
    direction: ltr;
    text-align: right;
}
.example .steps li::before {
    content: '◂';
    color: var(--accent2);
    margin-left: 8px;
}

/* ---------- Quick facts grid ---------- */
.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 20px 0;
}
.fact {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
}
.fact .k {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 6px;
}
.fact .v {
    font-weight: 700;
    color: var(--ink-soft);
    font-size: 16px;
    margin: 0;
}

/* ---------- FAQ ---------- */
.faq details {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 12px;
}
.faq summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--ink-soft);
    font-size: 17px;
    list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: '+';
    float: left;
    color: var(--accent);
    font-weight: 800;
    font-size: 22px;
    line-height: 1;
}
.faq details[open] summary::after { content: '–'; }
.faq details > p,
.faq details > div { margin-top: 10px; color: var(--text); }

/* ---------- Related links ---------- */
.related {
    background: var(--ink-soft);
    color: #e6e8ee;
    border-radius: 18px;
    padding: 30px 28px;
    margin-top: 40px;
}
.related h2 { color: #fff; margin-top: 0; }
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 18px;
}
.related-grid a {
    background: rgba(255,255,255,0.06);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    font-weight: 600;
    transition: background .15s;
}
.related-grid a:hover {
    background: rgba(247,165,30,0.2);
    text-decoration: none;
}

/* ---------- CTA ---------- */
.cta {
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    color: #fff;
    border-radius: 18px;
    padding: 34px 28px;
    text-align: center;
    margin: 40px 0;
}
.cta h2 { color: #fff; margin-top: 0; }
.cta p { color: #fff7e6; max-width: 540px; margin: 0 auto 18px; }
.cta a.btn {
    display: inline-block;
    background: #fff;
    color: var(--accent);
    padding: 12px 28px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 16px;
}
.cta a.btn:hover { text-decoration: none; background: var(--ink-soft); color: #fff; }

/* ---------- Footer ---------- */
footer.page-footer {
    background: var(--ink);
    color: #9ca0ad;
    padding: 28px 0;
    text-align: center;
    font-size: 14px;
}
footer.page-footer a { color: var(--accent2); }

/* ---------- KaTeX overrides for RTL Hebrew context ---------- */
.katex,
.katex-html,
.katex-display {
    direction: ltr;
    unicode-bidi: isolate;
}

.katex {
    line-height: 1.2;
}

.katex-display {
    margin: 0.2em auto !important;
    padding: 0.1em 0;
    overflow-x: auto;
    overflow-y: hidden;
    text-align: center;
    max-width: 100%;
}

.formula-main .katex,
.formula-main .katex-display {
    direction: ltr;
}
