/* =============================================================
   Payette River Brand CSS
   Source of truth: guidelines/payette-river-style-guidelines.md
   
   Usage:  All colors must reference these custom properties.
           Never hardcode hex values in component or page styles.
   To use a logo: place logo-primary.png and logo-secondary.png
           in wwwroot/images/ and update the .brand-logo rule.
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,400;0,600;1,400&family=Merriweather:wght@400&display=swap');

/* ---- CSS Custom Properties ---- */
:root {
    /* Brand Colors */
    --color-primary:        #002F6C;
    --color-secondary:      #B2BBCE;
    --color-accent:         #CAB64B;
    --color-primary-dark:   #001e47;
    --color-primary-light:  #e8edf5;

    /* Semantic */
    --color-surface:        #ffffff;
    --color-surface-muted:  #f5f6fa;
    --color-border:         #d1d5db;
    --color-text:           #111827;
    --color-text-muted:     #6b7280;
    --color-negative:       #b91c1c;
    --color-positive:       #15803d;
    --color-caution:        #92400e;
    --color-caution-bg:     #fffbeb;
    --color-positive-bg:    #f0fdf4;
    --color-negative-bg:    #fef2f2;

    /* Chart palette — brand-derived and validated for color-vision safety (adjacent-pair
       CVD ΔE and lightness/chroma checks). Categorical slots are assigned in this fixed
       order and never cycled; overflow folds into --chart-other. The sequential ramp is
       one navy hue, light→dark, for ordered series (e.g. the ST/MT/LT liquidity spectrum). */
    --chart-cat-1:          #2A5CA8;
    --chart-cat-2:          #B4941F;
    --chart-cat-3:          #6D9EEA;
    --chart-cat-4:          #8F6400;
    --chart-cat-5:          #0797A7;
    --chart-other:          #6b7280;
    --chart-seq-1:          #8CA9D6;
    --chart-seq-2:          #3E6DAE;
    --chart-seq-3:          #002F6C;

    /* Typography */
    --font-header:          "Montserrat", sans-serif;
    --font-body:            "Montserrat", sans-serif;
    --font-italic:          "Montserrat", sans-serif;
    --font-subheading:      "Merriweather", serif;

    /* Layout — header height matches the marketing site (135px); shrinks on mobile below. */
    --nav-height:           135px;
    --sidebar-width:        240px;
    --content-max-width:    1200px;
    --radius:               6px;
    --shadow-sm:            0 1px 3px rgba(0,0,0,.08);
    --shadow-md:            0 4px 12px rgba(0,0,0,.12);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-surface-muted);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-header); font-weight: 600; line-height: 1.3; }
h1 { font-size: 2rem;    color: var(--color-primary); }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

.section-heading {
    font-family: var(--font-subheading);
    font-size: 1.25rem;
    color: var(--color-primary);
    margin: 2rem 0 1rem;
}

p { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--color-primary); text-decoration: underline; }
a:hover { color: var(--color-primary-dark); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-family: var(--font-header);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #fff;
}

.btn-secondary {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--color-primary-light);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    border-color: var(--color-border);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.btn-accent {
    background: var(--color-accent);
    color: var(--color-primary);
    border-color: var(--color-accent);
}

/* ---- Cards ---- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}

.card-accent {
    border-left: 4px solid var(--color-accent);
}

.card-title {
    font-family: var(--font-header);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
}

.card-body { color: var(--color-text); }

/* ---- Forms ---- */
label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1rem;
}

input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="tel"],
select,
textarea {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.15s;
    width: 100%;
}

input:hover, select:hover, textarea:hover {
    border-color: var(--color-text-muted);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0,47,108,0.20);
}

/* ---- Tables ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.data-table th, .data-table td {
    padding: 0.625rem 0.875rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.data-table th {
    font-family: var(--font-header);
    font-weight: 600;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.data-table tbody tr:hover { background: var(--color-surface-muted); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ---- Info blocks ---- */
.info-block {
    background: var(--color-surface-muted);
    border-radius: var(--radius);
    padding: 1rem;
}
.info-block h3 {
    font-size: 0.9rem;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}
.info-block p { font-size: 0.875rem; color: var(--color-text-muted); }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* ---- Dividers ---- */
.section-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

/* ---- Page header ---- */
.page-header {
    margin-bottom: 2rem;
}
.page-header h1 { margin-bottom: 0.375rem; }
.page-header p { color: var(--color-text-muted); font-size: 1rem; }

/* ---- Feature grid (SBLOC home) ---- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.feature-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}
.feature-card h2 { font-size: 1.1rem; }
.feature-card p { color: var(--color-text-muted); font-size: 0.9rem; flex: 1; }
.feature-icon { font-size: 2rem; }

/* ---- Disclosure ---- */
.disclosure-text {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ---- Visualizer layout ---- */
.visualizer-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    align-items: start;
}
/* Allow each column to shrink below its content's intrinsic width. Without this,
   a grid/flex track defaults to min-width:auto and the results column (cards,
   chart) refuses to narrow, forcing horizontal page scroll on small screens. */
.visualizer-layout > * { min-width: 0; }
@media (max-width: 768px) {
    .visualizer-layout { grid-template-columns: 1fr; }
}

.input-panel label { margin-bottom: 0.875rem; }

/* ---- Callouts ---- */
.payoff-callout, .no-payoff-callout {
    display: none;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.payoff-callout.visible { display: block; background: var(--color-positive-bg); border-left: 4px solid var(--color-positive); }
.no-payoff-callout.visible { display: block; background: var(--color-caution-bg); border-left: 4px solid var(--color-accent); }
.payoff-callout h3, .no-payoff-callout h3 { font-size: 0.95rem; margin-bottom: 0.25rem; }

/* ---- Stat row ---- */
.stat-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.stat-box {
    flex: 1;
    min-width: 140px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    text-align: center;
}
.stat-value {
    font-family: var(--font-header);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary);
}
.stat-label { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 0.25rem; }
/* Highlight the preferred/winning stat box (e.g. the lower-tax strategy). */
.stat-box--accent { border-color: var(--color-primary); border-width: 2px; background: var(--color-primary-light); }

/* ---- Scenario toggle ---- */
.scenario-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.toggle-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.toggle-btn-active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ---- Schedule table ---- */
.schedule-wrapper { margin-top: 1.5rem; }
.schedule-group-header {
    text-align: center;
    font-size: 0.78rem;
    padding: 0.5rem;
}
.schedule-group-reinvest { background: rgba(0,47,108,0.06); }
.schedule-group-paydown  { background: rgba(202,182,75,0.10); }
.schedule-sub { font-size: 0.75rem; font-weight: 600; }
.schedule-year-col { font-weight: 600; min-width: 70px; }
.schedule-sbloc-col { color: var(--color-negative); }
.schedule-row-start td { font-weight: 600; background: var(--color-primary-light); }

/* ---- Flowchart ---- */
.flow-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 900px) { .flow-layout { grid-template-columns: 1fr; } }

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}
.option-btn {
    text-align: left;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}
.option-btn:hover { background: var(--color-primary-light); border-color: var(--color-primary); color: var(--color-primary); }

.step-meta { font-size: 0.82rem; color: var(--color-text-muted); font-style: italic; margin-top: 0.75rem; }

.path-list { padding-left: 1.25rem; font-size: 0.875rem; }
.path-list li { margin-bottom: 0.375rem; color: var(--color-text-muted); }

/* ---- Money-movement flow ----
   A vertical sequence of stages with labelled connectors, for showing where money goes and what
   happens to it at each hop. Distinct from .flow-layout above, which is a decision tree. Pure CSS
   and markup — no canvas — so it prints as-is and needs no image capture. */
.money-flow { margin: 1rem 0; }
.money-flow-step {
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.875rem 1.125rem;
    background: var(--color-surface);
}
.money-flow-step h3 { font-size: 0.95rem; margin-bottom: 0.25rem; }
.money-flow-step p { font-size: 0.85rem; color: var(--color-text-muted); margin: 0; }
.money-flow-step--start { border-left-color: var(--color-primary); }
.money-flow-step--gain  { border-left-color: var(--color-positive); background: var(--color-positive-bg); }
.money-flow-step--cost  { border-left-color: var(--color-accent); background: var(--color-caution-bg); }

/* The connector carries the label — "deducted at 21%", "less fees" — because the transition is the
   part being explained, not the boxes. */
.money-flow-arrow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0 0.4rem 1.125rem;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}
.money-flow-arrow::before {
    content: "\2193";
    font-size: 1.15rem;
    line-height: 1;
    color: var(--color-primary);
}

.outcome-box {
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    border: 1px solid var(--color-border);
}
.outcome-box h3 { margin-bottom: 0.375rem; font-size: 0.95rem; }
.outcome-neutral { background: var(--color-surface-muted); }
.outcome-positive { background: var(--color-positive-bg); border-color: var(--color-positive); }
.outcome-positive h3 { color: var(--color-positive); }
.outcome-caution  { background: var(--color-caution-bg); border-color: var(--color-accent); }
.outcome-caution  h3 { color: var(--color-caution); }
.outcome-negative { background: var(--color-negative-bg); border-color: var(--color-negative); }
.outcome-negative h3 { color: var(--color-negative); }

/* ---- Use case grid ---- */
.use-case-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

/* ---- Utilities ---- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
