/* Kalc shared stylesheet for programmatic SEO pages */
:root {
    --bg-page: #F7F4EF;
    --bg-card: #FFFFFF;
    --bg-soft: #FBF9F4;
    --bg-accent: #F1EDFE;
    --brand: #7C6DFA;
    --brand-dark: #5B4DD9;
    --brand-soft: #ECE7FF;
    --ink: #0E0E1C;
    --ink-2: #2E2E3F;
    --muted: #6B6B7C;
    --muted-2: #9090A0;
    --line: #ECE7DD;
    --line-2: #E0DAC9;
    --shadow: 0 1px 2px rgba(15, 15, 30, 0.04), 0 8px 24px rgba(15, 15, 30, 0.06);
    --shadow-lg: 0 4px 12px rgba(15, 15, 30, 0.06), 0 24px 48px rgba(15, 15, 30, 0.08);
    --radius: 18px;
    --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    background: var(--bg-page);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "Segoe UI", system-ui, sans-serif;
    line-height: 1.6;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 880px; margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- Nav ---------- */
.site-nav {
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    background: rgba(247, 244, 239, 0.85);
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}
.site-nav.scrolled { border-bottom-color: var(--line); }
.nav-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0;
}
.brand-mark {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 20px; letter-spacing: -0.01em;
    color: var(--ink) !important;
}
.brand-mark:hover { text-decoration: none; }
.brand-mark .icon {
    width: 30px; height: 30px;
    background: var(--brand); border-radius: 8px;
    display: grid; place-items: center;
    color: white; font-weight: 800; font-size: 17px;
}
.brand-mark .accent { color: var(--brand); }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a:not(.nav-cta) {
    color: var(--ink-2); font-size: 15px; font-weight: 500;
}
.nav-links a:not(.nav-cta):hover { color: var(--brand); }
.nav-links a.nav-cta {
    background: var(--ink); color: #FFFFFF;
    padding: 9px 16px; border-radius: 10px;
    font-size: 14px; font-weight: 600;
}
.nav-links a.nav-cta:hover {
    background: var(--brand); color: #FFFFFF; text-decoration: none;
}
@media (max-width: 800px) {
    .nav-links { gap: 14px; }
    .nav-links a:not(.nav-cta) { display: none; }
}

/* ---------- Article layout ---------- */
.breadcrumb {
    padding: 24px 0 8px;
    font-size: 14px;
    color: var(--muted);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb span { margin: 0 6px; color: var(--muted-2); }

.article-header { padding: 16px 0 32px; }
.article-meta {
    display: flex; gap: 12px; flex-wrap: wrap;
    font-size: 13px; color: var(--muted);
    margin-bottom: 16px;
}
.article-meta .pill {
    background: var(--brand-soft); color: var(--brand-dark);
    padding: 3px 10px; border-radius: 100px;
    font-weight: 600; font-size: 12px;
}
.article-header h1 {
    font-size: 42px; line-height: 1.1; letter-spacing: -0.02em;
    font-weight: 800; color: var(--ink);
    margin-bottom: 18px;
}
.article-header .lede {
    font-size: 19px; color: var(--muted); line-height: 1.6;
    max-width: 720px;
}
@media (max-width: 700px) {
    .article-header h1 { font-size: 30px; }
    .article-header .lede { font-size: 17px; }
}

/* ---------- Article content ---------- */
.article-content { padding: 8px 0 64px; }
.article-content h2 {
    font-size: 26px; font-weight: 800; letter-spacing: -0.01em;
    color: var(--ink);
    margin: 48px 0 16px;
}
.article-content h3 {
    font-size: 19px; font-weight: 700;
    color: var(--ink);
    margin: 32px 0 10px;
}
.article-content p { margin-bottom: 16px; color: var(--ink-2); }
.article-content ul, .article-content ol {
    margin: 12px 0 20px 24px;
    color: var(--ink-2);
}
.article-content li { margin-bottom: 8px; }
.article-content strong { color: var(--ink); font-weight: 600; }

/* Tables */
.data-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 24px 0;
}
.data-table {
    width: 100%; border-collapse: collapse; font-size: 16px;
}
.data-table th, .data-table td {
    padding: 14px 18px; text-align: left;
    border-bottom: 1px solid var(--line);
}
.data-table th {
    background: var(--bg-soft);
    font-weight: 700; color: var(--ink);
    font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table .result {
    font-weight: 700; color: var(--brand);
    font-variant-numeric: tabular-nums;
}

/* Multiplication table specific */
.mult-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 20px 0 28px;
}
.mult-item {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 18px;
    display: flex; justify-content: space-between; align-items: center;
    font-variant-numeric: tabular-nums;
}
.mult-item .lhs { color: var(--ink-2); font-weight: 500; }
.mult-item .rhs {
    color: var(--brand); font-weight: 700; font-size: 18px;
}
@media (max-width: 600px) {
    .mult-grid { grid-template-columns: 1fr; }
}

/* Tip / callout */
.callout {
    background: var(--bg-accent);
    border: 1px solid var(--brand-soft);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    margin: 24px 0;
    font-size: 16px;
    color: var(--ink-2);
}
.callout strong { color: var(--brand-dark); }

/* Inline CTA card */
.inline-cta {
    background: linear-gradient(135deg, #7C6DFA 0%, #5B4DD9 100%);
    color: #FFFFFF;
    border-radius: var(--radius);
    padding: 32px 28px;
    margin: 40px 0;
    display: flex; gap: 24px; align-items: center; justify-content: space-between;
}
.inline-cta-text { flex: 1; }
.inline-cta h3 {
    color: #FFFFFF; font-size: 20px; font-weight: 700;
    margin-bottom: 6px;
}
.inline-cta p {
    color: rgba(255,255,255,0.85); font-size: 15px;
}
.inline-cta .cta-btn {
    background: #FFFFFF; color: var(--brand-dark);
    padding: 12px 22px; border-radius: 10px;
    font-weight: 700; font-size: 15px;
    white-space: nowrap;
}
.inline-cta .cta-btn:hover { text-decoration: none; background: var(--brand-soft); }
@media (max-width: 600px) {
    .inline-cta { flex-direction: column; align-items: flex-start; padding: 24px 22px; }
}

/* Related links */
.related {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    margin: 40px 0;
}
.related h3 {
    font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--muted); font-weight: 700;
    margin-bottom: 14px;
}
.related ul { list-style: none; margin: 0; }
.related li { margin-bottom: 10px; }
.related a {
    color: var(--ink); font-weight: 500;
    display: inline-flex; align-items: center; gap: 8px;
}
.related a::before {
    content: "→"; color: var(--brand); font-weight: 700;
}

/* Hub grid (for index pages) */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin: 32px 0;
}
.hub-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 24px;
    transition: transform .15s, box-shadow .15s, border-color .15s;
    display: block;
    color: var(--ink) !important;
}
.hub-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--brand-soft);
    text-decoration: none;
}
.hub-card .num {
    font-size: 36px; font-weight: 800;
    color: var(--brand); letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 8px;
}
.hub-card h3 {
    font-size: 16px; font-weight: 700;
    color: var(--ink); margin-bottom: 4px;
}
.hub-card p {
    font-size: 13px; color: var(--muted);
}

/* Footer (compact for inner pages) */
.site-footer {
    padding: 48px 0 32px;
    border-top: 1px solid var(--line);
    margin-top: 48px;
    text-align: center;
    font-size: 14px; color: var(--muted);
}
.site-footer a { color: var(--muted); margin: 0 8px; }
.site-footer a:hover { color: var(--brand); }
