/* Shared mobile corrections. Desktop styling remains in the original files. */
@media (max-width: 768px) {
    /* Keep the header on one row even on a 320px screen. */
    .universes-nav {
        padding: 7px 0;
    }

    .universes-nav-content {
        flex-wrap: nowrap;
        gap: 12px;
        padding-inline: clamp(12px, 3vw, 20px);
    }

    .universes-nav-content > a {
        display: inline-flex;
        align-items: center;
        min-width: 0;
        min-height: 44px;
    }

    .universes-nav-logo {
        max-width: min(220px, 32vw);
    }

    .nav-right-group {
        flex-shrink: 0;
        gap: 0.5rem;
    }

    .nav-download-btn {
        min-height: 44px;
    }
}

@media (max-width: 1000px) {
    /* Use the stable visible height when mobile browser bars are expanded. */
    .universes-page {
        min-height: 100svh;
    }

    #home.hero {
        min-height: calc(100svh + 220px);
    }

    /* Readable fields avoid focus zoom on iOS without disabling pinch zoom. */
    .rf-input,
    .rf-textarea,
    .rf-other-input,
    .footer-newsletter-input {
        font-size: max(16px, 1rem);
        min-width: 0;
        max-width: 100%;
    }
}

/* Tablet layouts use the available width without changing phone layouts. */
@media (min-width: 601px) and (max-width: 1400px) {
    #home.hero {
        min-height: 100svh;
        padding-top: 110px;
        padding-bottom: 7rem;
    }

    .hero .container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2rem;
        padding-inline: clamp(24px, 3.5vw, 48px);
    }

    .hero-content {
        min-width: 0;
        width: 100%;
        padding: 0;
    }

    .hero-logo {
        max-width: 360px;
        margin: 0 0 1.25rem;
    }

    .hero-tagline { margin-top: 0; }
    .hero-description, .funding-goal { max-width: none; }

    .hero-buttons {
        flex-direction: row;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

    .hero-buttons .btn {
        flex: 1 1 200px;
        width: auto;
        min-height: 48px;
    }

    .hero-video { min-width: 0; width: 100%; }
    .hero-video-tabs { gap: 1rem; margin-bottom: 1rem; }
    .hero-video-tab { min-height: 48px; }

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

    .support-grid, .why-grid, .change-grid, .team-grid, .rewards-grid {
        gap: 1.5rem;
    }

    .why-name { min-height: 0; }
    .memo-layout { gap: 2rem; }
    .memo-column { min-width: 0; }

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

    .rf-input, .rf-textarea, .rf-other-input, .footer-newsletter-input {
        font-size: max(16px, 1rem);
        min-width: 0;
        max-width: 100%;
    }
}

/* Portrait tablets keep the introduction and preview on the same center line. */
@media (min-width: 601px) and (max-width: 1000px),
       (min-width: 1001px) and (max-width: 1100px) and (orientation: portrait) {
    .hero .container {
        grid-template-columns: minmax(0, 1fr);
        max-width: 840px;
        gap: 2.5rem;
    }

    .hero-content { max-width: none; margin: 0; }
    .hero-logo { margin-inline: auto; }
    .hero-tagline, .hero-description { text-align: center; max-width: none; }
    .hero-buttons { justify-content: center; }
    .hero-video video,
.hero-video video.hero-video-contain,
.hero-video img.hero-video-image {
        aspect-ratio: 16 / 9;
    }
}

@media (min-width: 601px) and (max-width: 1000px) {
    .support-grid, .why-grid, .change-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .problem-grid { grid-template-columns: minmax(0, 1fr); }
    .footer-nav-blocks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Keep portrait framing stable when a tablet rotates. */
@media (min-width: 601px) and (max-width: 1400px) {
    .team-grid {
        grid-template-columns: minmax(0, 1fr);
        max-width: 900px;
        margin-inline: auto;
    }
    .team-card {
        display: grid;
        grid-template-columns: clamp(180px, 22vw, 220px) minmax(0, 1fr);
    }
    .team-photo-box {
        position: relative;
        width: 100%;
        max-width: none;
        aspect-ratio: 3 / 4;
        align-self: stretch;
    }
    .team-photo {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        aspect-ratio: auto;
        object-fit: cover;
    }
}

/* Stack document navigation before the reading column on smaller tablets. */
@media (min-width: 601px) and (max-width: 1100px) {
    .memo-layout { grid-template-columns: minmax(0, 1fr); }
    .memo-toc { position: static; order: -1; max-height: 14rem; }
    .memo-column { max-width: none; }
}

@media (min-width: 1101px) and (max-width: 1400px) {
    .rewards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
