/* HFC Bank loan portal - shared styles. */

:root {
    /* HFC brand palette. Red and blue are used sparingly. */
    --brand: #31165b;
    --yellow: #ffc20e;
    --yellow-dark: #e5ab00;
    --white: #ffffff;
    --red: #ed1c24;
    --blue: #17479e;

    --ink: #1f1a2b;
    --muted: #5a5466;
    --line: #e1dde8;
    --page: #f5f4f8;
    --surface: var(--white);
    --notice-bg: #fff7dc;
    --error: #b3121a;
    --ok-bg: #e9f5ed;
    --ok-line: #2c7a4b;
    --warn-bg: #fff7dc;
    --warn-line: #b98900;
    --bad-bg: #fdeceb;
    --bad-line: var(--red);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 16px;
}

.skip-link {
    position: absolute;
    left: -9999px;
}

.skip-link:focus {
    left: 16px;
    top: 8px;
    z-index: 10;
    padding: 8px 12px;
    background: var(--surface);
}

/* Header and footer */

.site-header {
    background: var(--brand);
    border-bottom: 4px solid var(--yellow);
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 24px;
    padding-top: 12px;
    padding-bottom: 12px;
}

.brand {
    display: block;
    line-height: 0;
}

.brand img {
    display: block;
    height: 44px;
    width: auto;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav a,
.nav-button {
    padding: 0;
    background: none;
    border: 0;
    color: var(--white);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.nav a:hover,
.nav a[aria-current="page"],
.nav-button:hover {
    text-decoration: underline;
    text-decoration-color: var(--yellow);
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
}

.nav a.nav-cta {
    padding: 6px 14px;
    background: var(--yellow);
    border-radius: 6px;
    color: var(--brand);
    font-weight: bold;
}

.nav a.nav-cta:hover {
    background: var(--yellow-dark);
    text-decoration: none;
}

.site-header :focus-visible {
    outline-color: var(--yellow);
}

main.container {
    padding-top: 24px;
    padding-bottom: 32px;
}

.site-footer {
    padding: 16px 0 32px;
    color: var(--muted);
    font-size: 0.875rem;
}

/* Cards and text */

.card {
    margin: 0 0 16px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

fieldset.card {
    min-width: 0;
}

.card-narrow {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

a {
    color: var(--blue);
}

.aside {
    margin: 16px 0 0;
    font-size: 0.95rem;
}

.status {
    margin: 0 0 16px;
    padding: 10px 12px;
    background: var(--ok-bg);
    border: 1px solid var(--ok-line);
    border-radius: 6px;
}

.stack .field {
    margin-bottom: 16px;
}

h1,
h2,
h3,
fieldset.card > legend {
    color: var(--brand);
    line-height: 1.25;
}

h1 {
    margin: 0 0 12px;
    font-size: 1.5rem;
}

h2 {
    margin: 0 0 12px;
    font-size: 1.2rem;
}

h3 {
    margin: 0 0 4px;
    font-size: 1rem;
}

fieldset.card > legend {
    float: left;
    width: 100%;
    margin: 0 0 12px;
    padding: 0;
    font-size: 1.2rem;
    font-weight: bold;
}

fieldset.card > legend + * {
    clear: both;
}

.lead {
    font-size: 1.1rem;
}

.notice {
    margin: 12px 0 0;
    padding: 10px 12px;
    background: var(--notice-bg);
    border: 1px solid var(--yellow);
    border-radius: 6px;
    font-size: 0.9rem;
}

.facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin: 16px 0;
    padding: 0;
    list-style: none;
}

.steps {
    margin: 0;
    padding-left: 20px;
}

.steps li {
    margin-bottom: 12px;
}

.steps p {
    margin: 0;
}

/* Forms */

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field label,
.choice legend {
    display: block;
    font-weight: bold;
}

.help {
    margin: 2px 0 6px;
    color: var(--muted);
    font-size: 0.85rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #8a8496;
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
    border-color: var(--red);
    border-width: 2px;
}

:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

.choice {
    margin: 16px 0 0;
    padding: 0;
    border: 0;
}

.choice legend {
    padding: 0;
    margin-bottom: 4px;
}

.choice label {
    display: inline-block;
    margin: 4px 20px 4px 0;
    padding: 4px 0;
}

.error {
    margin: 4px 0 0;
    color: var(--error);
    font-size: 0.9rem;
    font-weight: bold;
}

.error-summary {
    margin: 0 0 16px;
    padding: 10px 12px;
    background: var(--bad-bg);
    border: 1px solid var(--bad-line);
    border-radius: 6px;
    color: var(--error);
    font-weight: bold;
}

/* Buttons */

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.actions-end {
    justify-content: flex-end;
}

.button {
    display: inline-block;
    padding: 11px 22px;
    background: var(--yellow);
    border: 2px solid var(--yellow);
    border-radius: 6px;
    color: var(--brand);
    font: inherit;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--yellow-dark);
    border-color: var(--yellow-dark);
}

.button-secondary {
    background: var(--surface);
    border-color: var(--brand);
    color: var(--brand);
}

.button-secondary:hover {
    background: var(--page);
    border-color: var(--brand);
}

/* Calculator result */

.result {
    border-left-width: 6px;
}

.result-eligible {
    background: var(--ok-bg);
    border-color: var(--ok-line);
}

.result-smaller {
    background: var(--warn-bg);
    border-color: var(--warn-line);
}

.result-declined {
    background: var(--bad-bg);
    border-color: var(--bad-line);
}

.result-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 8px;
}

.result-header h2 {
    margin: 0;
}

.badge {
    padding: 2px 10px;
    background: var(--brand);
    border-radius: 999px;
    color: var(--white);
    font-size: 0.8rem;
    font-weight: bold;
}

.result-message {
    margin: 0 0 12px;
    font-size: 1.05rem;
}

.result-reasons {
    margin: 0 0 12px;
    padding-left: 20px;
}

.figures {
    margin: 0 0 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.figure {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
}

.figure:last-child {
    border-bottom: 0;
}

.figure dt {
    color: var(--muted);
}

.figure dd {
    margin: 0;
    font-weight: bold;
    text-align: right;
}

.result-note {
    margin: 0 0 12px;
    font-size: 0.9rem;
}

.disclaimer {
    color: var(--muted);
    font-size: 0.9rem;
}

.disclaimer p {
    margin: 0;
}

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

    .card {
        padding: 16px;
    }

    .button {
        width: 100%;
        text-align: center;
    }

    .brand img {
        height: 36px;
    }

    .figure {
        flex-direction: column;
        gap: 0;
    }

    .figure dd {
        text-align: left;
    }
}
