/* Workshop Investment Calculator (/investment/).
   Platform tokens only; the ws_* component CSS handles the components
   themselves, this sheet handles page layout and the results rail.
   Spec: .scratch/investment-calculator/spec.md */

/* The header (ws_header) is full bleed with a 24px gutter and no max-width at
   any breakpoint, so the page repeats those metrics exactly. A centred column
   would put the hero 112px right of the logotype at 1440 and 8px left of it
   below 1232. Keep the two in step: --space-6 is the header's literal 24px. */
.iv-wrap {
    margin: 0;
    padding: var(--space-8) var(--space-6) var(--space-20, 80px);
}

/* Guard: several branch containers are grids or flex, which would defeat
   the hidden attribute. Attribute pair outranks the single class. */
.iv-form [hidden],
[data-iv-show][hidden] {
    display: none !important;
}

/* .icon is width:1em globally and a md button's text is 11px under
   html { font-size: 80% }, so an unpinned button icon draws as a speck next
   to its label. Pin the box the way the app dashboard pins its hero actions;
   the child selector catches the font-glyph fallback as well as the SVG. */
.iv-wrap .ws-btn__icon,
.iv-wrap .ws-btn__icon > * {
    width: var(--icon-sm);
    height: var(--icon-sm);
    font-size: var(--icon-sm);
    flex-shrink: 0;
}

/* ---------- Hero ---------- */

.iv-hero {
    max-width: 720px;
    margin: 0 0 var(--space-6);
}

/* ws_pill (tint/learn) owns the fill and the full radius; this adds the eyebrow
   treatment it does not carry, and the gap to the title. The colour is
   deliberately not the component's --phase-learn: on a --phase-learn-light fill
   that reads 3.13:1, so the eyebrow keeps --phase-learn-dark for 4.11:1.
   Two classes are required to carry it: the component sets colour on
   .ws-pill--tint.ws-pill--learn, so a single class loses on specificity, not
   source order. The print rule below still hides it by the single class. */
.iv-hero .iv-hero__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--phase-learn-dark);
    margin: 0 0 var(--space-2);
}

.iv-hero__title {
    font-family: var(--font-heading);
    font-size: var(--text-display);
    line-height: 1.05;
    color: var(--text-dark);
    margin: 0 0 var(--space-3);
}

.iv-hero__lede {
    font-family: var(--font-body);
    font-size: var(--text-h3);
    line-height: 1.5;
    color: var(--gray-500);
    margin: 0;
}

.iv-formula {
    font-family: var(--font-body);
    font-size: var(--text-body);
    color: var(--gray-500);
    background: var(--phase-learn-very-light);
    border: 1px solid var(--phase-learn-light);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    max-width: 1200px;
    margin: 0 auto var(--space-8) 0;
}

.iv-formula strong {
    color: var(--phase-learn-dark);
}

/* ---------- Layout ---------- */

/* Left anchored, never centred: the wrapper is full bleed so the content
   column can start on the logotype, and this cap only stops it growing past
   the measure. An auto left margin would re-centre it and break the
   alignment the moment the viewport passed 1248px. Every non-print section
   of the page carries the same cap so the column reads as one edge. */
.iv-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
    gap: var(--space-8);
    align-items: start;
    max-width: 1200px;
    margin-right: auto;
}

/* ---------- Form ---------- */

.iv-section {
    border: none;
    padding: 0;
    margin: 0 0 var(--space-8);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.iv-section__legend {
    font-family: var(--font-heading);
    font-size: var(--text-h2);
    color: var(--text-dark);
    padding: 0;
    margin-bottom: var(--space-2);
}

.iv-grid {
    display: grid;
    gap: var(--space-3);
}

.iv-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.iv-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- Results rail ---------- */

.iv-rail {
    position: sticky;
    top: var(--space-8);
}

.iv-rail__card {
    background: var(--bg-white);
    border: 1px solid var(--phase-learn-dark);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.iv-rail__label {
    font-family: var(--font-body);
    font-size: var(--text-caption);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-500);
    margin: 0;
}

.iv-rail__total {
    font-family: var(--font-heading);
    font-size: var(--text-display);
    line-height: 1;
    color: var(--phase-learn-dark);
    margin: 0;
}

.iv-split {
    display: flex;
    height: var(--space-3);
    border-radius: var(--radius-full);
    overflow: hidden;
    background: var(--gray-100);
}

/* No width transition: the bar tracks live input, and animating a layout
   property on every keystroke is exactly the thrash motion.md bans. */
.iv-split__time {
    background: var(--phase-learn-dark);
}

.iv-split__cash {
    background: var(--phase-learn-light);
}

.iv-split__legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
}

.iv-split__legend p {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    font-family: var(--font-body);
    font-size: var(--text-caption);
    color: var(--gray-500);
    margin: 0;
}

.iv-split__legend strong {
    color: var(--text-dark);
}

.iv-dot {
    width: var(--space-2);
    height: var(--space-2);
    border-radius: var(--radius-full);
    display: inline-block;
}

.iv-dot--time { background: var(--phase-learn-dark); }
.iv-dot--cash { background: var(--phase-learn-light); }

.iv-breakeven {
    font-family: var(--font-body);
    font-size: var(--text-body);
    line-height: 1.5;
    color: var(--text-dark);
    background: var(--phase-learn-very-light);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    margin: 0;
}

.iv-breakdown {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-1) var(--space-3);
    font-family: var(--font-body);
    font-size: var(--text-caption);
}

.iv-breakdown dt {
    color: var(--gray-500);
}

.iv-breakdown dd {
    margin: 0;
    color: var(--text-dark);
    font-weight: var(--font-medium);
    text-align: right;
}

.iv-breakdown dt.iv-breakdown--total,
.iv-breakdown dd.iv-breakdown--total {
    border-top: 1px solid var(--gray-200);
    padding-top: var(--space-1-5);
    color: var(--text-dark);
    font-weight: var(--font-semibold);
}

.iv-rail__actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* ---------- CTA cards ---------- */

.iv-cta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    max-width: 1200px;
    margin-top: var(--space-10);
    margin-right: auto;
}

.iv-cta__card {
    padding: var(--space-5);
}

.iv-cta__title {
    font-family: var(--font-heading);
    font-size: var(--text-h2);
    color: var(--text-dark);
    margin: 0 0 var(--space-2);
}

.iv-cta__sub {
    font-family: var(--font-body);
    font-size: var(--text-body);
    color: var(--gray-500);
    margin: 0 0 var(--space-4);
}

/* ---------- Mobile ---------- */

.iv-mobilebar {
    display: none;
}

@media (max-width: 899px) {
    .iv-layout {
        grid-template-columns: 1fr;
    }

    .iv-rail {
        position: static;
    }

    .iv-grid--2,
    .iv-grid--3 {
        grid-template-columns: 1fr;
    }

    .iv-cta {
        grid-template-columns: 1fr;
    }

    .iv-mobilebar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        background: var(--bg-white);
        border-top: 1px solid var(--gray-200);
        box-shadow: var(--shadow-md);
        /* Same gutter as .iv-wrap so the running total sits under the column
           it summarises rather than 8px inside it. */
        padding: var(--space-2-5) var(--space-6);
    }

    .iv-mobilebar__total {
        font-family: var(--font-body);
        font-size: var(--text-caption);
        color: var(--gray-500);
        margin: 0;
        display: flex;
        align-items: baseline;
        gap: var(--space-2);
    }

    .iv-mobilebar__total strong {
        font-family: var(--font-heading);
        font-size: var(--text-h3);
        color: var(--phase-learn-dark);
    }

    .iv-mobilebar__jump {
        font-family: var(--font-body);
        font-size: var(--text-caption);
        font-weight: var(--font-semibold);
        color: var(--phase-learn-dark);
        background: var(--phase-learn-very-light);
        border: 1px solid var(--phase-learn-light);
        border-radius: var(--radius-full);
        padding: var(--space-1-5) var(--space-3);
        cursor: pointer;
    }

}

/* ---------- Print: a one-page summary for the stakeholder ---------- */

.iv-printdate,
.iv-printmeta {
    display: none;
}

@media print {
    .wsh-header,
    .iv-hero__eyebrow,
    .iv-form,
    .iv-rail__actions,
    .iv-mobilebar,
    .iv-cta,
    #cta,
    footer,
    .ws-footer,
    .site-footer {
        display: none !important;
    }

    .iv-layout {
        display: block;
    }

    .iv-rail {
        position: static;
    }

    .iv-rail__card {
        border: 1px solid var(--gray-300);
        box-shadow: none;
    }

    .iv-printdate {
        display: block;
        font-family: var(--font-body);
        font-size: var(--text-small);
        color: var(--gray-500);
        margin: var(--space-4) 0 0;
    }

    .iv-printmeta {
        display: block;
        font-family: var(--font-body);
        font-size: var(--text-body);
        color: var(--text-dark);
        margin: var(--space-4) 0;
    }

    .iv-printmeta::after {
        content: ' Estimated with workshopr.io/investment';
        color: var(--gray-500);
    }

    /* accordion.php puts hidden on the panel, not the content, so the
       panel itself must be forced open or the breakdown never prints. */
    #ivBreakdownAcc .ws-accordion__panel[hidden] {
        display: block !important;
    }

    #ivBreakdownAcc .ws-accordion__content,
    .iv-breakdown {
        display: grid !important;
    }
}
