/* ============================================================
   Resident Information Form (/resident-info/, /es/resident-info/)
   Light theme on top of style.css tokens. Small text uses --ink-soft
   (not --muted) so hints keep 4.5:1 contrast on white.
   ============================================================ */

.rf-page { background: var(--paper-alt); }

/* Keeps scrolled-to and focused fields clear of the fixed nav. */
html { scroll-padding-top: 5.5rem; }

/* Several components set display, which would otherwise override the hidden attribute. */
.rf-page [hidden] { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Page header ---------- */
.rf-hero {
    background:
        radial-gradient(1200px 400px at 85% -10%, rgba(187,213,234,0.16), transparent 60%),
        linear-gradient(160deg, #152435 0%, #1d3650 100%);
    color: #fff;
    padding: 8rem 0 5.5rem;
}

.rf-hero .container { max-width: 920px; }

.rf-hero h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4.4vw, 3rem);
    line-height: 1.05;
    letter-spacing: -0.025em;
    margin-bottom: 0.8rem;
}

.rf-hero h1 span { color: #BBD5EA; }

.rf-lede {
    color: rgba(255,255,255,0.86);
    font-size: 1.05rem;
    max-width: 640px;
    margin-bottom: 1.5rem;
}

.rf-trust {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.6rem;
}

.rf-trust li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.86);
}

.rf-trust i { color: #BBD5EA; width: 1rem; text-align: center; }

/* ---------- Layout ---------- */
.rf-main {
    max-width: 920px;
    margin: -3rem auto 0;
    padding: 0 1.5rem 4rem;
    position: relative;
}

.rf { display: flex; flex-direction: column; gap: 1.25rem; }

.rf-section {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.6rem 1.6rem 1.7rem;
    min-width: 0;
}

.rf-section-head {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    margin-bottom: 1.2rem;
}

.rf-step {
    flex: none;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent-tint);
    color: var(--accent-dark);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex; align-items: center; justify-content: center;
}

.rf-section-head h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: -0.015em;
    color: var(--ink);
    line-height: 1.2;
    margin-top: 0.2rem;
}

.rf-section-head p {
    color: var(--ink-soft);
    font-size: 0.92rem;
    margin-top: 0.25rem;
}

/* ---------- Fields ---------- */
.rf-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.1rem;
}

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

.rf-span-2 { grid-column: span 2; }
.rf-span-all { grid-column: 1 / -1; }

.rf-field {
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
    min-width: 0;
    border: 0;
    margin: 0;
    padding: 0;
}

.rf-field > label,
.rf-field > legend,
.rf-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink);
    padding: 0;
}

.rf-req { color: #B42318; margin-left: 0.15rem; }

.rf-opt { color: var(--ink-soft); font-weight: 400; }

.rf-help { font-size: 0.82rem; color: var(--ink-soft); line-height: 1.45; }

.rf-field input[type="text"],
.rf-field input[type="tel"],
.rf-field input[type="email"],
.rf-field input[type="date"],
.rf-field input[type="number"],
.rf-field select,
.rf-field textarea {
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid #7D868F;
    border-radius: var(--radius-sm);
    padding: 0.68rem 0.85rem;
    width: 100%;
    min-height: 46px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rf-field select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.2rem;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234C544F' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
}

.rf-field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

.rf-field input::placeholder,
.rf-field textarea::placeholder { color: #6B736E; }

.rf-field input:focus,
.rf-field select:focus,
.rf-field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47,93,128,0.22);
    /* Invisible normally; drawn in the system color in forced-colors mode, which drops box-shadow. */
    outline: 2px solid transparent;
    outline-offset: 1px;
}

.rf-field input:disabled,
.rf-field select:disabled { background: var(--paper-alt); color: var(--ink-soft); }

.rf-pair { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 0.6rem; }

/* Phone fields: intl-tel-input wraps each tel input with a country flag and dial-code button. */
.rf-field .iti { display: block; width: 100%; }
/* Above later positioned siblings (the SSN show/hide control, the next card) when the list is open. */
.rf-page .rf-field .iti__country-selector { z-index: 50; }
.rf-field .iti__selected-country:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* SSN/ITIN: masked like a password, with a show/hide toggle */
.rf-secret { position: relative; }
.rf-secret input { padding-right: 4.6rem; letter-spacing: 0.06em; }
.rf-secret input.masked { -webkit-text-security: disc; }
.rf-reveal {
    position: absolute;
    top: 50%; right: 0.4rem;
    transform: translateY(-50%);
    min-height: 34px;
    padding: 0.3rem 0.65rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--accent-dark);
    font: 600 0.8rem var(--font-sans);
    cursor: pointer;
}
.rf-reveal:hover { background: var(--accent-tint); }
.rf-reveal:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }

/* Choice pills: native radios/checkboxes, larger hit area */
.rf-choices { display: flex; flex-wrap: wrap; gap: 0.55rem; }

.rf-choice {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 44px;
    padding: 0.55rem 0.95rem;
    border: 1px solid #C9D1D9;
    border-radius: 999px;
    background: var(--paper);
    font-size: 0.92rem;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.rf-choice:hover { border-color: var(--accent); }

.rf-choice input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; flex: none; }

.rf-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }

.rf-choice:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(47,93,128,0.28); }

.rf-check {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.92rem;
    color: var(--ink);
    cursor: pointer;
    line-height: 1.45;
}

.rf-check input { accent-color: var(--accent); width: 20px; height: 20px; margin: 0.1rem 0 0; flex: none; }

.rf-field > label.rf-check { font-weight: 400; font-size: 0.92rem; }
.rf-check a { color: var(--accent-dark); font-weight: 600; text-decoration: underline; }

.rf-field > label.rf-intercom { margin-top: 0.3rem; font-size: 0.86rem; }
.rf-intercom input { width: 18px; height: 18px; }

/* ---------- Repeatable items ---------- */
.rf-list { display: flex; flex-direction: column; gap: 1rem; }

.rf-item {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #FAFBFC;
    padding: 1.15rem 1.15rem 1.25rem;
    margin: 0;
    min-width: 0;
}

.rf-item > legend {
    float: left;
    width: 100%;
    padding: 0;
    margin-bottom: 0.95rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.02rem;
    color: var(--ink);
}

.rf-item > .rf-grid { clear: both; }

@media (min-width: 701px) {
    .rf-item > legend { padding-right: 14rem; }
}

.rf-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    background: var(--accent-tint);
    color: var(--accent-dark);
    font-family: var(--font-sans);
    font-size: 0.74rem;
    font-weight: 600;
    vertical-align: 0.12rem;
}

.rf-item-tools {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    display: flex;
    gap: 0.35rem;
}

.rf-up,
.rf-remove { white-space: nowrap; }

.rf-up {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 36px;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--accent-dark);
    font: 600 0.82rem var(--font-sans);
    cursor: pointer;
}

.rf-up:hover { background: var(--accent-tint); }
.rf-up:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.rf-remove {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 36px;
    padding: 0.35rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: #9B1C14;
    font: 600 0.82rem var(--font-sans);
    cursor: pointer;
}

.rf-remove:hover { background: #FDECEA; border-color: #F4C7C2; }
.rf-remove:focus-visible { outline: 3px solid #9B1C14; outline-offset: 1px; }

/* Full-width "add another" bar: clearly a button, but quieter than the solid Send button. */
.rf-add {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    min-height: 56px;
    margin-top: 1rem;
    padding: 0.8rem 1.2rem;
    border: 2px dashed var(--accent);
    border-radius: 12px;
    background: #EAF0F5;
    color: var(--accent-deep);
    font: 700 1rem var(--font-sans);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.rf-add-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
}

.rf-add:hover { background: #DCE6EE; border-style: solid; }
.rf-add:active { background: #D0DDE8; }
.rf-add:focus-visible { outline: 3px solid var(--accent-deep); outline-offset: 2px; }

@media (forced-colors: active) {
    .rf-add-icon { forced-color-adjust: none; background: ButtonText; color: ButtonFace; }
}
.rf-add[hidden] { display: none; }
.rf-full-note { margin-top: 1rem; }

/* ---------- Notes / callouts ---------- */
.rf-note {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: var(--accent-tint);
    color: var(--accent-deep);
    font-size: 0.88rem;
    line-height: 1.5;
}

.rf-note i { color: var(--accent-dark); margin-top: 0.2rem; }
.rf-note a { color: var(--accent-dark); font-weight: 600; }

/* ---------- Errors ---------- */
.rf-field.invalid input:not(.iti__search-input),
.rf-field.invalid select,
.rf-field.invalid textarea { border-color: #B42318; box-shadow: 0 0 0 3px rgba(180,35,24,0.12); }

.rf-field.invalid .rf-choice { border-color: #B42318; }

.rf-error {
    font-size: 0.83rem;
    font-weight: 500;
    color: #B42318;
}

.rf-error:empty { display: none; }

.rf-summary {
    border: 1px solid #F4C7C2;
    background: #FEF3F2;
    border-radius: 12px;
    padding: 1rem 1.15rem;
    color: #7A1A12;
    font-size: 0.92rem;
}

.rf-summary h2 { font-size: 1rem; margin-bottom: 0.45rem; color: #7A1A12; }
.rf-summary ul { margin: 0 0 0 1.1rem; }
.rf-summary li { margin: 0.15rem 0; }
.rf-summary a { color: #9B1C14; font-weight: 600; }
.rf-summary[hidden] { display: none; }

/* ---------- Submit ---------- */
.rf-submit-row { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 0.4rem; }

.rf-submit-row .btn { font-size: 1rem; padding: 0.95rem 1.6rem; }
.rf-submit-row .btn[aria-disabled="true"] { opacity: 0.7; cursor: progress; transform: none; }

.rf-status { font-size: 0.95rem; min-height: 1.3em; color: var(--ink-soft); }
.rf-status.err { color: #B42318; font-weight: 500; }

.rf-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Done ---------- */
.rf-done {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 2rem 1.8rem;
}

.rf-done-icon {
    width: 54px; height: 54px;
    border-radius: 50%;
    background: #E7F3E9;
    color: var(--ok);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.rf-done h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 0.6rem;
}

/* Focus is moved to these containers by script (tabindex="-1"); they aren't controls. */
.rf-done:focus, .rf-summary:focus { outline: none; }

.rf-done p { color: var(--ink-soft); margin-bottom: 1rem; max-width: 640px; }

.rf-done-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.2rem 0 1.6rem; }

.btn-outline {
    background: var(--paper);
    color: var(--accent-dark);
    border: 1px solid var(--accent);
}
.btn-outline:hover { background: var(--accent-tint); color: var(--accent-dark); }

.rf-copy { border-top: 1px solid var(--line); padding-top: 1.2rem; }

.rf-copy h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    margin: 1rem 0 0.4rem;
    color: var(--ink);
}

.rf-copy h3:first-child { margin-top: 0; }

.rf-copy dl { display: grid; grid-template-columns: minmax(150px, 30%) 1fr; gap: 0.3rem 1rem; font-size: 0.9rem; }
.rf-copy dt { color: var(--ink-soft); }
.rf-copy dd { color: var(--ink); margin: 0; overflow-wrap: anywhere; white-space: pre-line; }

.rf-back { margin-top: 1rem; font-size: 0.9rem; }
.rf-back a { color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.rf-back a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
    .rf-hero { padding: 6.5rem 0 4.5rem; }
    .rf-main { padding: 0 1rem 3rem; }
    .rf-section { padding: 1.25rem 1.1rem 1.35rem; }
    .rf-grid, .rf-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .rf-span-2 { grid-column: auto; }
    .rf-item { padding: 1rem 0.9rem 1.1rem; }
    .rf-item-tools { position: static; justify-content: flex-end; margin: -0.5rem 0 0.75rem; }
    .rf-copy dl { grid-template-columns: 1fr; gap: 0.1rem; }
    .rf-copy dd { margin-bottom: 0.45rem; }
}

@media (prefers-reduced-motion: reduce) {
    .rf-field input, .rf-field select, .rf-field textarea, .rf-choice, .rf-add { transition: none; }
}

/* ---------- Print: the confirmation copy only ---------- */
@media print {
    .site-nav, .rf-hero, .footer, .rf-done-actions, .rf-done-icon, .rf-back { display: none !important; }
    .rf-page { background: #fff; }
    .rf-main { margin: 0; padding: 0; max-width: none; }
    .rf-done { border: 0; box-shadow: none; padding: 0; }
    .rf-copy { border-top: 0; }
    .rf-copy h3 { break-after: avoid; }
}
