/*
 * QuantStock - UX polish (uniform headings + anchor offsets)
 * Loaded AFTER each page's own CSS. Pure presentation: no URLs, text, titles or ad code are touched.
 * Undo: remove the <link> to this file (or revert the commit).
 *
 * Heading scale used on every page (desktop -> mobile via clamp):
 *   H1 2.5rem | H2 2rem | H3 1.5rem | H4 1.125rem | H5 1rem | H6 0.875rem
 * Component classes (.card-title, .feature-card h3, ...) that set their own size keep winning,
 * because these rules are plain tag selectors (lowest specificity).
 * .qs-h1 ... .qs-h6 give any element the look of that level without changing its tag,
 * so the HTML outline can stay correct (H1 > H2 > H3, no skipped levels).
 */
:root {
    --qs-h1: clamp(1.9rem, 4.2vw, 2.5rem);
    --qs-h2: clamp(1.5rem, 3vw, 2rem);
    --qs-h3: clamp(1.25rem, 2.2vw, 1.5rem);
    --qs-h4: 1.125rem;
    --qs-h5: 1rem;
    --qs-h6: 0.875rem;
    --qs-anchor-gap: 16px;
}

/* Anchor links (table of contents, #hash links): never hide the title under a fixed header */
html {
    scroll-padding-top: calc(var(--header-height, 0px) + var(--qs-anchor-gap));
}

/* One scale for every page */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    text-wrap: balance;
}
h1 { font-size: var(--qs-h1); }
h2 { font-size: var(--qs-h2); }
h3 { font-size: var(--qs-h3); }
h4 { font-size: var(--qs-h4); }
h5 { font-size: var(--qs-h5); }
h6 { font-size: var(--qs-h6); }

/* Footer column titles stay compact on every page */
.accordion-header { font-size: 1rem; margin: 0; }
footer h2, footer h3, footer h4 { font-size: 1.2rem; }

/* Look-only helpers (class beats tag selectors, also beats Bootstrap's h1-h6) */
.qs-h1 { font-size: var(--qs-h1); }
.qs-h2 { font-size: var(--qs-h2); }
.qs-h3 { font-size: var(--qs-h3); }
.qs-h4 { font-size: var(--qs-h4); }
.qs-h5 { font-size: var(--qs-h5); }
.qs-h6 { font-size: var(--qs-h6); }

/* Section titles: same rhythm everywhere */
h2 + p, h3 + p, h4 + p { margin-top: 0; }

/* Keep keyboard focus visible on headings that are link targets */
:target { outline: none; }
h1:focus, h2:focus, h3:focus, h4:focus { outline: none; }

/* Respect users who ask for less motion (smooth anchor scrolling can feel like titles "fly past") */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto !important; }
}
