/* Finance Tip — Main Zone, designed as a spiral-bound notebook.
 * Paper, border, text, ruled lines, and spiral coil all pull from the
 * theme CSS variables set on the slide root (--bg, --text, --accent,
 * --bar) so the notebook adapts to whichever theme the user picked. */

.finance-main-wrap {
    width: 100cqw;
    height: 100cqh;
    container-type: size;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: visible;
    background: transparent;
    color: var(--text);
    font-family: 'Geist Mono', 'Roboto Mono', monospace;
}

/* Note page with thick accent-colored border. */
.finance-main-paper {
    position: relative;
    width: 80%;
    /* Paper height + spiral overhang above = 80% of slide height.
     * Spiral straddles the top border, so ~half its height sits above
     * the paper. margin-top shifts the group down so it's vertically
     * centered (flex centers just the paper, not the spiral overhang). */
    height: 72%;
    margin-top: 5.2cqh;
    box-sizing: border-box;
    background: #FFF;
    border: 1.2cqmin solid var(--text);
    border-radius: 0;
    display: grid;
    grid-template-rows: 22cqh 1fr 8%;
    grid-template-areas:
        "banner"
        "paper"
        "footer";
    overflow: visible;
    box-shadow: 0 1.2cqmin 2.4cqmin rgba(0, 0, 0, 0.32);
}

/* Spiral binding band across the top of the page. */
.finance-main-banner-block {
    grid-area: banner;
    position: relative;
    background: var(--bar);
    border-bottom: 0.5cqmin solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    padding: 4cqh 6cqw 6cqh;
    box-sizing: border-box;
}

/* Spiral binding rendered from spiral_binding.svg — keeps its own
 * dark-blue color, regardless of theme. */
.finance-main-spirals {
    position: absolute;
    top: -1.2cqmin;
    left: 50%;
    width: 90%;
    aspect-ratio: 890 / 70;
    transform: translate(-50%, -50%);
    background: url("../img/spiral_binding.dac596311b01.svg") center / 100% 100% no-repeat;
    pointer-events: none;
}

/* Inner sizing-target — the binary-search fit (fitFinanceText) sets a
 * font-size on this in cqmin so the header text fills the spiral band. */
.finance-main-banner-fit {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 3.5cqmin;
    width: max-content;
    max-width: 100%;
    margin-top: 4cqh;
}

/* "FINANCE TIP" header sitting on the spiral band. */
.finance-main-wrap .finance-main-header {
    font-family: 'Geist Mono', 'Roboto Mono', monospace;
    font-size: 1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--text);
    line-height: 1;
    white-space: nowrap;
}

/* Paper content area — ruled lines live on the text rows themselves so
 * they always sit exactly under each baseline, regardless of how the
 * JS fit scales the body font-size. */
.finance-main-paper-block {
    grid-area: paper;
    padding: 4cqh 6cqw 2cqh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--text);
    overflow: hidden;
    position: relative;
}

/* Body wrapper — the binary-search fit sizes this in cqmin so the
 * headline + category + body + source all scale together. */
.finance-main-wrap .finance-main-body {
    font-size: inherit;
    line-height: 1.35;
    font-family: 'Georgia', serif;
    text-align: start;
}

.finance-main-wrap .finance-main-headline {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 1.45em;
    font-weight: 700;
    line-height: 1.08;
    color: var(--text);
    letter-spacing: -0.005em;
    margin-bottom: 0.25em;
}

.finance-main-wrap .finance-main-headline-icon {
    color: var(--accent);
    font-size: 0.85em;
    margin-right: 0.4em;
    vertical-align: baseline;
}

.finance-main-wrap .finance-main-category {
    font-family: 'Georgia', serif;
    font-size: 0.62em;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent);
    opacity: 0.95;
    margin-bottom: 0.9em;
    font-style: normal;
    line-height: 1;
}

.finance-main-wrap .finance-main-text {
    font-family: 'Georgia', serif;
    font-size: 1em;
    /* line-height matches the rule spacing so each line of body text
     * lands exactly on its own ruled line. */
    line-height: 1.7;
    color: var(--text);
    background-image: linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(1.7em - 0.15cqmin),
        var(--bar) calc(1.7em - 0.15cqmin),
        var(--bar) 1.7em
    );
    background-size: 100% 1.7em;
    background-repeat: repeat-y;
    background-position: 0 0.18em;
}

.finance-main-wrap .finance-main-source {
    font-family: 'Georgia', serif;
    font-size: 0.7em;
    line-height: 1.35;
    margin-top: 0.7em;
    color: var(--text);
    opacity: 0.7;
    text-align: start;
}

/* Disclaimer footer along the bottom of the note. */
.finance-main-footer-block {
    grid-area: footer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4cqw 0;
    position: relative;
    border-top: 0.2cqmin dashed var(--bar);
}

.finance-main-wrap .finance-main-disclaimer {
    font-family: 'Geist Mono', 'Roboto Mono', monospace;
    font-size: 1.9cqmin;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--accent);
    opacity: 0.85;
    line-height: 1;
    text-align: center;
}
