.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 10000;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
    padding: 0.65rem 1rem;
    background: #fff;
    color: #0f1530;
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Decorative motion: snap to end state (transform + opacity only in keyframes). */
    body.page-enter main,
    body.page-enter .hero,
    .reveal-on-load {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }

    body::after {
        animation: none !important;
        transform: none !important;
        opacity: 0.2 !important;
    }

    .hero-badge::before {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        box-shadow: 0 0 6px var(--accent-400, #7c9cff) !important;
    }
}

/* JS mirrors prefers-reduced-motion onto <html> for snap + class-based checks. */
html.pathway-reduced-motion .pathway-celeb-canvas {
    display: none !important;
}

html.pathway-reduced-motion body::after {
    animation: none !important;
    transform: none !important;
    opacity: 0.2 !important;
}

@media (max-width: 768px) {
    .btn,
    .nav-link,
    .mobile-tabbar-link {
        min-height: 48px;
    }
}

.btn {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.pwa-install-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin: 0.75rem auto 0;
    width: min(1180px, calc(100% - 2 * var(--rail-x, 16px)));
    max-width: none;
    box-sizing: border-box;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    background: rgba(124, 156, 255, 0.12);
    border: 1px solid rgba(124, 156, 255, 0.35);
}

.pwa-install-banner p {
    margin: 0;
    color: #0a0a0a;
}

.pwa-install-banner[hidden] {
    display: none !important;
}

.outcomes-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.outcome-stat {
    padding: 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.outcome-stat strong {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.curriculum-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.curriculum-filters select {
    min-height: 44px;
    min-width: 160px;
}

.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-enter main,
.page-enter .hero {
    animation: pageFadeIn 0.68s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.reveal-on-load {
    animation: cardRise 0.88s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.btn-pressed {
    transform: scale(0.98);
}

.native-standalone body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.native-standalone .topbar {
    padding-top: max(0.5rem, env(safe-area-inset-top));
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(22px);
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes cardRise {
    from {
        opacity: 0;
        transform: translateY(36px) scale(0.982);
        filter: blur(1.5px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }

    .card img,
    .feature-box img,
    .step-item img {
        transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .card:hover img,
    .feature-box:hover img,
    .step-item:hover img {
        transform: scale(1.045);
    }
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    overflow-x: clip;
}

img,
video,
canvas,
svg {
    max-width: 100%;
    height: auto;
}

table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 820px) {
    .container {
        width: min(1180px, 94%);
        padding-left: max(12px, env(safe-area-inset-left, 0px));
        padding-right: max(12px, env(safe-area-inset-right, 0px));
    }

    main.container {
        padding-top: 20px !important;
    }

    .hero {
        padding: 56px 0 44px;
    }

    .hero .meta,
    .hero .cta-row,
    .cta-row,
    .challenge-actions,
    .focus-actions,
    .judge-tour-actions,
    .curriculum-filters,
    .pwa-install-banner {
        flex-direction: column;
        align-items: stretch;
    }

    .cta-row:not(.pathway-hero-quicklinks):not(.hero-secondary-row) .btn,
    .cta-row:not(.pathway-hero-quicklinks):not(.hero-secondary-row) a.btn,
    .cta-row:not(.pathway-hero-quicklinks):not(.hero-secondary-row) form,
    .challenge-actions .btn,
    .challenge-actions form,
    .focus-actions .btn,
    .judge-tour-actions .btn,
    .curriculum-filters select,
    .curriculum-filters .btn,
    .inline-form,
    .inline-form .btn {
        width: 100%;
    }

    .grid-2,
    .grid-3,
    .outcomes-grid,
    .hero-journey-metrics,
    .hero-journey-metrics--compact,
    .comp-admin-grid,
    .verified-library-grid {
        grid-template-columns: 1fr !important;
    }

    .card,
    .feature-box,
    .challenge-panel,
    .focus-mode-card,
    .buddy-card {
        padding: 18px 16px;
    }

    .verified-resource-item {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

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

    .challenge-option {
        align-items: flex-start;
    }

    .judge-tour-card,
    .retention-modal-card {
        width: min(560px, 100%);
        margin: 0 auto;
    }

    .admin-login-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .admin-login-aside,
    .admin-login-main {
        border-radius: 0;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        width: 100%;
        max-height: none;
    }

    .admin-topbar-inner {
        flex-wrap: wrap;
        gap: 10px;
    }

    .admin-topbar-nav {
        width: 100%;
        flex-wrap: wrap;
    }

    .comp-shell .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .focus-timer {
        font-size: clamp(2.5rem, 16vw, 4rem);
    }

    .comp-shell .stats {
        grid-template-columns: 1fr;
    }
}
