/* =========================================================
   ToolZen Hub
   CAGR Calculator

   Only what the shared calculator styles do not already provide:
   the period pair, the mode choice, the Investment B block, the
   notes and the comparison table. Buttons, focus, fields and headings
   come from the shared layer (components/buttons.css,
   base/accessibility.css, calculator-base.css, calculator-form.css).
   Loaded after calculator-responsive.css.
========================================================= */


/* =========================================================
   FORM
   The period is two number fields side by side (years and
   months). The mode is a group of two radio buttons
   drawn as segments; the selected one has a tick and a heavier
   border as well as a colour, so the choice never relies on
   colour alone.
========================================================= */

.cagr-period,
.cagr-mode {

    min-width: 0;

    margin: 0;
    padding: 0;

    border: 0;

}

.cagr-period legend,
.cagr-mode legend {

    padding: 0;

}

.cagr-pair {

    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;

}

.cagr-mode__options {

    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    margin: 6px 0 8px;

}

.cagr-mode__option {

    position: relative;

    display: inline-flex;

    flex: 1 1 160px;

    cursor: pointer;

}

/* the radio itself is hidden; its label is the control and keeps the focus ring */

.cagr-mode__option input {

    position: absolute;

    width: 1px;
    height: 1px;

    margin: 0;

    opacity: 0;

}

.cagr-mode__option span {

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    box-sizing: border-box;

    width: 100%;
    min-height: 44px;

    padding: 8px 14px;

    border: 1px solid #d0d5dd;
    border-radius: 10px;

    background: var(--color-white);

    color: #344054;

    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;

    transition:
        background .2s ease,
        border-color .2s ease;

}

.cagr-mode__option:hover span {

    background: #f2f4f7;

}

.cagr-mode__option input:checked + span {

    border: 2px solid var(--color-brand-green);

    background: #ecfdf3;

    color: var(--color-ink);

    font-weight: 750;

}

.cagr-mode__option input:checked + span::before {

    content: "✓";
    content: "✓" / "";

    font-weight: 800;

}

.cagr-mode__option input:focus-visible + span {

    outline: 2px solid var(--color-brand-green);
    outline-offset: 2px;

}

/* the optional second investment sits under the main fields, set apart by a rule and a heading */

.cagr-more {

    margin-top: 24px;
    padding-top: 20px;

    border-top: 1px solid var(--color-slate-200);

}

.cagr-more__title {

    margin: 0 0 4px;

    color: var(--color-ink);

    font-size: 16px;
    font-weight: 750;
    line-height: 1.4;

}

.cagr-more__text {

    margin: 0 0 16px;

    color: var(--color-ink-muted);

    font-size: 13px;
    line-height: 1.5;

}


/* =========================================================
   RESULTS
========================================================= */

.cagr-subtitle {

    margin: 28px 0 14px;
    padding-top: 20px;

    border-top: 1px solid var(--color-slate-200);

    color: var(--color-ink);

    font-size: 16px;
    font-weight: 750;
    line-height: 1.4;

}

#cagr-results .calculator-results__summary p {

    margin: 0 0 8px;

}

#cagr-results .calculator-results__summary p:last-child {

    margin-bottom: 0;

}


/* =========================================================
   NOTES
   The trust note is calm and starts with words, so its meaning
   never depends on colour. The different-period note is plain
   text in a neutral box; it is information, not an error.
========================================================= */

.cagr-note {

    margin: 10px 0 0;

    color: var(--color-ink-muted);

    font-size: 11px;
    line-height: 1.5;

}

.cagr-note--plain {

    margin: 12px 0 12px;

    color: #475467;

    font-size: 12px;

}

.cagr-note--trust {

    margin: 16px 0 0;
    padding: 12px 14px;

    border: 1px solid #fedf89;
    border-left: 4px solid #f79009;
    border-radius: 8px;

    background: #fffcf5;

    color: var(--color-ink);

    font-size: 13px;
    line-height: 1.55;

}

.cagr-note--period {

    margin: 12px 0 0;
    padding: 12px 14px;

    border: 1px solid #d0d5dd;
    border-left: 4px solid var(--color-ink-muted);
    border-radius: 8px;

    background: #f9fafb;

    color: var(--color-ink);

    font-size: 13px;
    line-height: 1.55;

}


/* =========================================================
   COMPARISON TABLE
========================================================= */

.cagr-table th:not(:first-child),
.cagr-table td {

    text-align: right;

}

.cagr-table tbody th {

    background: var(--color-white);

    color: var(--color-ink);

}

/* the first column stays in view when a narrow screen scrolls the table sideways */

.cagr-table th:first-child {

    position: sticky;
    left: 0;

    text-align: left;

    box-shadow: 1px 0 0 #eaecf0;

}

.cagr-table thead th:first-child {

    background: #f9fafb;

}

#cagr-results .calculator-results__table-wrapper:focus-visible {

    outline: 2px solid var(--color-brand-green);
    outline-offset: 2px;

}


/* =========================================================
   TEXT FOR SCREEN READERS ONLY
========================================================= */

.cagr-sr-only {

    position: absolute;

    width: 1px;
    height: 1px;

    margin: -1px;
    padding: 0;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);

    white-space: nowrap;

    border: 0;

}
