/* ========================================================================
 * DEPRECATED BUTTON STYLES - DO NOT USE
 * ========================================================================
 * These button styles have been replaced by the unified button system
 * in buttons.css. This conflicted with landing.css causing inconsistencies.
 * Please use the new system for all new code:
 *   - .btn .btn--primary (instead of .btn-primary)
 *   - Use .btn--pill for pill shape or .btn--rounded for rounded rectangles
 *
 * TODO: Remove these styles after all pages have been migrated to buttons.css
 * ======================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-weight: 700;
    font-size: 15px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.25);
}

.btn-primary {
    background: #ffffff;
    color: var(--primary, #312e81);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(79, 70, 229, 0.28);
}
/* ======================================================================== */

main {
    flex: 1;
    padding: clamp(48px, 8vw, 72px) max(5%, calc(50% - 600px));
    display: flex;
    flex-direction: column;
    gap: clamp(32px, 6vw, 48px);
}

section {
    background: #ffffff;
    border-radius: 20px;
    padding: clamp(28px, 4vw, 40px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* Links section: minimal chrome (cards stand alone) */
section.section--links {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

/* Edit mode: dotted boundary for links section */
body.is-edit-mode section.section--links {
    border: 2px dashed rgba(99, 102, 241, 0.25);
    border-radius: 16px;
    padding: clamp(20px, 3vw, 28px);
    position: relative;
    transition: border-color 0.2s ease;
}

body.is-edit-mode section.section--links:hover {
    border-color: rgba(99, 102, 241, 0.5);
}

section h2 {
    font-size: clamp(24px, 3vw, 32px);
    margin: 0 0 18px;
    color: var(--primary, #312e81);
    font-weight: 800;
}

.section-lead {
    margin-bottom: clamp(20px, 3vw, 28px);
    color: #4b5563;
    font-size: clamp(16px, 2.2vw, 18px);
}

.section-lead a {
    color: #6b7280;
    text-decoration: none;
    border-bottom: 1px solid rgba(107, 114, 128, 0.25);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.section-lead a:hover {
    color: #4b5563;
    border-bottom-color: rgba(75, 85, 99, 0.4);
}

.page-sections {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: clamp(48px, 8vw, 72px);
}

/* Card entrance animations - individual cards fade in as they scroll into view */
.has-entrance .card,
.has-entrance .faq-item,
.has-entrance .sponsor-list-item,
.has-entrance .unit-list-item {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.has-entrance .card.is-visible,
.has-entrance .faq-item.is-visible,
.has-entrance .sponsor-list-item.is-visible,
.has-entrance .unit-list-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.page-section-wrapper {
    position: relative;
}

.page-section-loading-global {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: auto;
}

.page-section-loading__spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(31, 41, 55, 0.2);
    border-top-color: var(--primary, #1f2937);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.3);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.section-block {
    position: relative;
}

.page-section__controls {
    position: absolute;
    top: -16px;
    right: 0;
    display: flex;
    gap: 8px;
    z-index: 20;
}

.page-section__control {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: #ffffff;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.page-section__control::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateX(-50%) translateY(-4px);
    z-index: 100;
}

.page-section__control::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(15, 23, 42, 0.95);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 100;
}

.page-section__control:hover::after,
.page-section__control:hover::before {
    opacity: 1;
}

.page-section__control:hover::after {
    transform: translateX(-50%) translateY(0);
}

.page-section__control:hover,
.page-section__control:focus-visible {
    background: rgba(31, 41, 55, 0.12);
    border-color: rgba(31, 41, 55, 0.35);
    color: var(--primary, #1f2937);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
    outline: none;
}

.page-section__control--danger:hover,
.page-section__control--danger:focus-visible {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #b91c1c;
}

.page-section__control--settings {
    background: var(--primary, #1f2937);
    border-color: var(--primary, #1f2937);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.page-section__control--settings:hover,
.page-section__control--settings:focus-visible {
    background: var(--primary, #111827);
    border-color: var(--primary, #111827);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.3);
}

.page-section__control:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.page-section-insert {
    position: relative;
    height: 0;
    margin: calc(-1 * clamp(48px, 8vw, 72px) / 2) 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.page-section-insert__button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px dashed rgba(148, 163, 184, 0.7);
    background: #ffffff;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.page-section-insert__button:hover,
.page-section-insert__button:focus-visible {
    border-color: var(--primary, #1f2937);
    background: rgba(31, 41, 55, 0.08);
    color: var(--primary, #1f2937);
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.15);
    outline: none;
}

.page-section-empty {
    text-align: center;
    color: #64748b;
    font-size: clamp(16px, 2vw, 18px);
    margin: clamp(24px, 6vw, 48px) 0;
}

.section-add-grid {
    display: grid;
    gap: 16px;
}

.section-add-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: #f8fafc;
    color: #1f2937;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.section-add-option:hover,
.section-add-option:focus-visible {
    border-color: rgba(99, 102, 241, 0.6);
    background: rgba(99, 102, 241, 0.12);
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.12);
    outline: none;
}

.section-add-option__icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(79, 70, 229, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4338ca;
}

.section-add-option strong {
    display: block;
    font-size: 15px;
}

.section-add-option p {
    margin: 4px 0 0;
    font-size: 13px;
    color: #64748b;
}

.grid {
    display: grid;
    gap: clamp(16px, 3vw, 24px);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 20px;
    padding: clamp(12px, 2vw, 18px);
    background: rgba(249, 250, 251, 0.9);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(100, 116, 139, 0.14);
}

.card .card-button {
    margin-top: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    border: none;
    background: var(--primary, #1f2937);
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.card .card-button:hover {
    background: var(--primary, #0f172a);
    transform: translateY(-1px);
}

.card .card-button:focus-visible {
    outline: 3px solid rgba(67, 56, 202, 0.4);
    outline-offset: 3px;
}

.card h3 {
    margin: 0 0 12px;
    font-size: clamp(18px, 2.4vw, 22px);
    color: #1f2937;
}

.card p {
    margin: 0;
    color: #4b5563;
    font-size: 15px;
}

/* Mobile Responsive - Full width sections */
@media (max-width: 640px) {
    main {
        padding-left: 3%;
        padding-right: 3%;
    }

    section {
        border-radius: 16px;
        padding: clamp(20px, 5vw, 28px);
    }

    section h2 {
        font-size: clamp(20px, 5vw, 26px);
    }

    /* Edit mode: more gap between sections so + button doesn't overlap gear */
    body.is-edit-mode .page-sections {
        gap: clamp(64px, 12vw, 80px);
    }

    /* Edit mode: section controls need breathing room */
    body.is-edit-mode section {
        padding-top: clamp(36px, 6vw, 44px);
    }

    /* Section controls: wrap if needed */
    .page-section__controls {
        top: -12px;
        gap: 5px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

@media (max-width: 400px) {
    main {
        padding-left: 2%;
        padding-right: 2%;
    }

    section {
        border-radius: 12px;
        padding: 16px;
    }

    body.is-edit-mode section {
        padding-top: 36px;
    }
}
