/* ==================================================================
   FOUNDATIONS PAGE
   ================================================================== */

/* -- HERO --------------------------------------------------------- */
.fnd-hero {
    padding: 10rem 2rem 4rem;
}

.fnd-hero-inner {
    max-width: var(--max-w);
    margin: 0 auto;
}

/* -- FOUNDATION SECTIONS ------------------------------------------ */
.fnd-section {
    border-top: 1px solid var(--border);
    padding: 5rem 2rem 4rem;
}

.fnd-section-inner {
    max-width: var(--max-w-narrow);
    margin: 0 auto;
}

/* Section headers */
.fnd-section-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.fnd-layer-num {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 2.5rem;
    font-weight: 300;
    line-height: 1;
    flex-shrink: 0;
}

.fnd-layer-name {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin-bottom: 0.4rem;
}

.fnd-layer-sub {
    font-size: 0.9rem;
    color: var(--warm-muted);
    font-weight: 300;
}

/* Content area with left border accent */
.fnd-content {
    padding-left: 2rem;
    margin-bottom: 2rem;
}

.fnd-content--gold { border-left: 2px solid var(--gold-dim); }
.fnd-content--teal { border-left: 2px solid var(--teal-dim); }
.fnd-content--purple { border-left: 2px solid var(--aoif-feedback); }

/* Body text */
.fnd-body {
    color: var(--warm-dim);
    font-size: 0.95rem;
    line-height: 1.85;
    margin-bottom: 1rem;
}

.fnd-body:last-child {
    margin-bottom: 0;
}

.fnd-body strong {
    color: var(--warm);
    font-weight: 600;
}

/* Section headings within documents */
.fnd-heading {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.fnd-heading:first-child {
    margin-top: 0;
}

.fnd-subheading {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

/* -- EXPAND / COLLAPSE -------------------------------------------- */
.fnd-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--warm-muted);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    margin-top: 2rem;
    transition: all 0.2s;
}

.fnd-expand-btn:hover {
    color: var(--warm);
    border-color: var(--border-hover);
}

.fnd-expand-icon {
    font-size: 1rem;
    line-height: 1;
}

.fnd-expanded {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease;
}

.fnd-expanded--open {
    max-height: 30000px;
    opacity: 1;
    margin-top: 1rem;
}

/* -- TABLES ------------------------------------------------------- */
.fnd-table-wrap {
    margin: 1.5rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.fnd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.fnd-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--warm);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-hover);
    background: var(--surface);
}

.fnd-table td {
    padding: 0.75rem 1rem;
    color: var(--warm-dim);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.6;
}

.fnd-table td strong {
    color: var(--warm);
    font-weight: 600;
}

.fnd-table-note {
    font-size: 0.75rem;
    color: var(--warm-muted);
    font-weight: 300;
}

/* -- DOWNLOADS ---------------------------------------------------- */
.fnd-downloads {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border);
}

.fnd-downloads-headline {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 400;
    line-height: 1.25;
    color: var(--warm);
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.fnd-downloads-sub {
    color: var(--warm-dim);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 2rem;
}

.fnd-downloads-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.fnd-download-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--gold-dim);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
}

.fnd-download-card:hover {
    border-color: var(--border-hover);
    background: var(--surface-2);
}

.fnd-download-card-inner {
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.fnd-download-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--warm);
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.fnd-download-desc {
    color: var(--warm-dim);
    font-size: 0.85rem;
    line-height: 1.65;
    flex: 1;
    margin-bottom: 1.25rem;
}

.fnd-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gold);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.5rem 0;
    border: none;
    background: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.fnd-download-btn:hover {
    opacity: 0.8;
}

.fnd-download-btn svg {
    flex-shrink: 0;
}

/* Quick Start Guide link */
.fnd-quickstart-link {
    background: none;
    border: none;
    color: var(--gold);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    border-bottom: 1px solid var(--gold-dim);
    transition: border-color 0.2s;
}

.fnd-quickstart-link:hover {
    border-color: var(--gold);
}

/* -- MODAL -------------------------------------------------------- */
.fnd-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(5, 10, 18, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fnd-modal-overlay.fnd-modal--open {
    opacity: 1;
    visibility: visible;
}

.fnd-modal {
    position: relative;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-y: auto;
    padding: 3rem;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-3) transparent;
}

.fnd-modal::-webkit-scrollbar {
    width: 4px;
}

.fnd-modal::-webkit-scrollbar-track {
    background: transparent;
}

.fnd-modal::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 2px;
}

.fnd-modal-close {
    position: sticky;
    top: 0;
    float: right;
    background: none;
    border: none;
    color: var(--warm-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
    z-index: 1;
}

.fnd-modal-close:hover {
    color: var(--warm);
}

.fnd-modal-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.35rem;
    font-weight: 400;
    color: var(--warm);
    letter-spacing: -0.01em;
    margin-bottom: 1.5rem;
    padding-right: 2rem;
}

.fnd-modal-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gold);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.fnd-modal-body {
    color: var(--warm-dim);
    font-size: 0.9rem;
    line-height: 1.8;
    margin-bottom: 0.75rem;
}

.fnd-modal-body strong {
    color: var(--warm);
    font-weight: 600;
}

.fnd-modal-list {
    color: var(--warm-dim);
    font-size: 0.9rem;
    line-height: 1.8;
    margin: 0.75rem 0 1rem 1.5rem;
}

.fnd-modal-list li {
    margin-bottom: 0.4rem;
}

.fnd-modal-list li strong {
    color: var(--warm);
    font-weight: 600;
}

/* -- GUIDING PRINCIPLES ------------------------------------------- */
.fnd-gp {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border);
}

.fnd-gp-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 1.5rem;
}

.fnd-gp-closing {
    color: var(--warm-muted);
    font-size: 0.88rem;
    line-height: 1.8;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Accordion */
.fnd-accordion {
    margin-top: 2rem;
}

.fnd-accordion-item {
    border-bottom: 1px solid var(--border);
}

.fnd-accordion-item:first-child {
    border-top: 1px solid var(--border);
}

.fnd-accordion-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    background: none;
    border: none;
    padding: 1.15rem 0;
    cursor: pointer;
    text-align: left;
    color: var(--warm);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: color 0.2s;
}

.fnd-accordion-btn:hover {
    color: var(--teal);
}

.fnd-accordion-num {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.75rem;
    color: var(--teal);
    opacity: 0.5;
    flex-shrink: 0;
    width: 1.5rem;
}

.fnd-accordion-label {
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    flex: 1;
}

.fnd-accordion-icon {
    font-size: 1.1rem;
    color: var(--warm-muted);
    flex-shrink: 0;
    transition: transform 0.2s;
    line-height: 1;
}

.fnd-accordion-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s ease;
    padding-left: 2.5rem;
}

.fnd-accordion-panel--open {
    max-height: 5000px;
    opacity: 1;
    padding-bottom: 1.5rem;
}

/* -- RESPONSIVE --------------------------------------------------- */
@media (max-width: 960px) {
    .fnd-downloads-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
}

@media (max-width: 900px) {
    .fnd-hero {
        padding: 8rem 2rem 4rem;
    }

    .fnd-section {
        padding: 4rem 2rem 3rem;
    }

    .fnd-layer-num {
        font-size: 2rem;
    }

    .fnd-layer-name {
        font-size: 1.3rem;
    }
}

@media (max-width: 600px) {
    .fnd-hero {
        padding: 7rem 1.5rem 3rem;
    }

    .fnd-section {
        padding: 3.5rem 1.5rem 2.5rem;
    }

    .fnd-section-header {
        gap: 1rem;
    }

    .fnd-layer-num {
        font-size: 1.75rem;
    }

    .fnd-layer-name {
        font-size: 1.15rem;
    }

    .fnd-content {
        padding-left: 1.25rem;
    }

    .fnd-modal {
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        padding: 2rem 1.5rem;
    }

    .fnd-modal-overlay {
        align-items: stretch;
    }

    .fnd-downloads-grid {
        grid-template-columns: 1fr;
    }
}
