/* ================= FOOTER MODAL: shell ================= */

/* Content templates loaded via AJAX: source only, never shown */
#footer-modal-content {
    display: none;
}

/* Scroll lock (Lenis is stopped from JS as well) */
html.footer-modal-open {
    overflow: hidden;
}

.footer-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(5, 110, 142, 0.2) 0%, rgba(138, 199, 209, 0.2) 100%);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.footer-modal-overlay.is-open {
    opacity: 1;
}

.footer-modal-box {
    position: relative;
    width: 90%;
    max-width: 1000px;
    padding: 32px 40px;
    background: white;
    text-align: center;
    font-family: var(--mono);
    box-shadow: -1px 1px 40px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.footer-modal-box:focus {
    outline: none; /* focus lands here programmatically; the close button carries the visible ring */
}
.footer-modal-overlay.is-open .footer-modal-box {
    opacity: 1;
    transform: scale(1);
}

/* Title: prefixed with .footer-modal-box so global h2 rules can't win */
.footer-modal-box .footer-modal-title {
    margin: 0 0 8px;
    font-size: clamp(22px, 2.4vw, 26px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    color: var(--rem-navy);
}

.footer-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--rem-navy);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}
.footer-modal-close:hover,
.footer-modal-close:focus-visible {
    opacity: 1;
}
.footer-modal-close:focus-visible {
    outline: 2px solid var(--rem-navy);
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .footer-modal-box { padding: 28px 20px 24px; }
    .footer-modal-box .footer-modal-content { max-height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
    .footer-modal-overlay,
    .footer-modal-box { transition: none; }
}

/* ================= FOOTER MODAL: content ================= */
/* Typography and spacing are set explicitly (not inherited), so the modal
   looks the same regardless of what base.css does to h2, h3, p, a.
   Every rule is prefixed with .footer-modal-box to out-rank global element rules. */

.footer-modal-box .footer-modal-content {
    --modal-text: #000;

    /* scroll area */
    max-height: 60vh;
    overflow-y: auto;
    overscroll-behavior: contain;

    /* type */
    font-size: 13px;
    line-height: 1.6;
    text-align: left;
    color: #333;

    /* vertical rhythm: one gap between every block, so paragraphs never sit flat */
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.footer-modal-box .footer-modal-content > * {
    flex-shrink: 0;
}

.footer-modal-box .footer-modal-content p {
    margin: 0;
}

.footer-modal-box .footer-modal-content span {
    font-weight: 500;
    color: var(--modal-text);
}

/* Section titles: smaller and teal, with extra air above (on top of the 10px gap) */
.footer-modal-box .footer-modal-content :is(h2, h3) {
    margin: 14px 0 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: normal;
    text-transform: none;
    color: var(--rem-teal);
}

/* Lists and their items stack with a gap; .bullet lists opt out below */
.footer-modal-box .footer-modal-content ul,
.footer-modal-box .footer-modal-content ul:not(.bullet) > li {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    padding-top: 15px;
}

/* Links (visited included, so the browser's purple never shows) */
.footer-modal-box .footer-modal-content a,
.footer-modal-box .footer-modal-content a:visited {
    color: var(--rem-teal);
    text-decoration: none;
}
.footer-modal-box .footer-modal-content a:hover {
    text-decoration: underline;
}
.footer-modal-box .footer-modal-content a:focus-visible {
    outline: 2px solid var(--rem-teal);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Bullet lists */
.footer-modal-box .footer-modal-content ul.bullet {
    display: block;
    list-style: disc;
    margin: 0 0 0 20px;
    padding-left: 20px;
}
.footer-modal-box .footer-modal-content ul.bullet li {
    display: list-item;
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Contact section */
.footer-modal-box .footer-modal-content .contact li.contact {
    list-style: none;
}
.footer-modal-box .footer-modal-content li.contact p {
    color: var(--modal-text);
}
.footer-modal-box .footer-modal-content .contact.flex-wrapper {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Version / year line: bottom right, with a hairline above */
.footer-modal-box .footer-modal-meta {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 11px;
    line-height: 1.6;
    letter-spacing: 0.2px;
    text-align: right;
    color: #666;
}
