/* Keep Kenta on the left and the hero copy on the right throughout the site. */
.hero {
    grid-template-columns: 270px minmax(0, 1fr);
}

.hero > .rank-kenta {
    grid-column: 1;
    grid-row: 1;
}

.hero > .hero-copy {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 100%;
}

.quiz-hero:has(> img) {
    grid-template-columns: 210px minmax(0, 1fr);
}

.quiz-hero:has(> img) > img,
.draw-hero > img,
.tree-hero > img,
.corner-hero > img,
.private-study-hero > img {
    grid-column: 1;
    grid-row: 1;
}

.quiz-hero:has(> img) > div,
.draw-hero > div,
.tree-hero > div,
.corner-hero > div,
.private-study-hero > div {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 100%;
}

.draw-hero {
    grid-template-columns: 250px minmax(0, 1fr);
}

.tree-hero {
    grid-template-columns: 250px minmax(0, 1fr);
}

.corner-hero {
    grid-template-columns: 260px minmax(0, 1fr);
}

.private-study-hero {
    grid-template-columns: 240px minmax(0, 1fr);
}

/* Keep welcome text readable over the scenic Winter, Sakura, and Midnight backdrops. */
.welcome-hero {
    grid-template-columns: 360px minmax(0, 1fr);
}

.rank-kenta-welcome {
    grid-column: 1;
    grid-row: 1;
}

.welcome-copy {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
}

[data-theme="winter"] .welcome-copy,
[data-theme="sakura"] .welcome-copy {
    width: 100%;
    max-width: 760px;
    padding: 24px 28px;
    color: var(--ink);
    background: rgba(251, 253, 255, 0.98);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 18px 44px rgba(31, 48, 66, 0.2);
}

[data-theme="midnight"] .welcome-copy {
    width: 100%;
    max-width: 760px;
    padding: 24px 28px;
    color: var(--ink);
    background: rgba(26, 20, 48, 0.98);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 18px 44px rgba(6, 2, 20, 0.48);
}

[data-theme="night"] .welcome-copy {
    width: 100%;
    max-width: 760px;
    padding: 24px 28px;
    color: var(--ink);
    background: rgba(22, 24, 32, 0.98);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.52);
}

@media (max-width: 760px) {
    .welcome-hero,
    .hero,
    .quiz-hero:has(> img),
    .draw-hero,
    .tree-hero,
    .corner-hero,
    .private-study-hero {
        grid-template-columns: 1fr;
    }

    .rank-kenta-welcome {
        grid-column: 1;
        grid-row: 1;
    }

    .welcome-copy,
    .hero > .hero-copy,
    .quiz-hero:has(> img) > div,
    .draw-hero > div,
    .tree-hero > div,
    .corner-hero > div,
    .private-study-hero > div {
        grid-column: 1;
        grid-row: 2;
        justify-self: stretch;
    }

    .hero > .rank-kenta,
    .quiz-hero:has(> img) > img,
    .draw-hero > img,
    .tree-hero > img,
    .corner-hero > img,
    .private-study-hero > img {
        grid-column: 1;
        grid-row: 1;
    }
}

/* Final shared hero layout: keep each mascot/illustration separate from its copy. */
:is(.hero, .welcome-hero, .quiz-hero, .draw-hero, .tree-hero, .corner-hero, .private-study-hero) {
    display: grid !important;
    grid-template-columns: minmax(190px, 30%) minmax(0, 1fr) !important;
    gap: clamp(18px, 4vw, 48px) !important;
    align-items: center;
}

:is(.hero, .welcome-hero, .quiz-hero, .draw-hero, .tree-hero, .corner-hero, .private-study-hero) > :is(.rank-kenta, .rank-kenta-welcome, img, .grammar-symbol) {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: center;
    min-width: 0;
    max-width: 100%;
}

:is(.hero, .welcome-hero, .quiz-hero, .draw-hero, .tree-hero, .corner-hero, .private-study-hero) > :is(.hero-copy, .welcome-copy, div:not(.rank-kenta):not(.grammar-symbol)) {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

:is(.hero, .welcome-hero, .quiz-hero, .draw-hero, .tree-hero, .corner-hero, .private-study-hero) > img {
    display: block !important;
    width: 100%;
    max-height: 300px;
    object-fit: contain;
}

@media (max-width: 760px) {
    :is(.hero, .welcome-hero, .quiz-hero, .draw-hero, .tree-hero, .corner-hero, .private-study-hero) {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
    }

    :is(.hero, .welcome-hero, .quiz-hero, .draw-hero, .tree-hero, .corner-hero, .private-study-hero) > :is(.rank-kenta, .rank-kenta-welcome, img, .grammar-symbol) {
        grid-column: 1 !important;
        grid-row: 1 !important;
        width: min(220px, 70vw);
        max-height: 220px;
        margin: 0 auto;
    }

    :is(.hero, .welcome-hero, .quiz-hero, .draw-hero, .tree-hero, .corner-hero, .private-study-hero) > :is(.hero-copy, .welcome-copy, div:not(.rank-kenta):not(.grammar-symbol)) {
        grid-column: 1 !important;
        grid-row: 2 !important;
        justify-self: stretch;
        text-align: left;
    }
}
