/* RESPONSIVE: all @media rules. Load this file LAST.
   Index: <=1060 menu becomes dropdown | <=860 single column, games rows |
          <=480 tight characters | reduced motion */

/* ===== <= 1060px: hamburger menu + dropdowns ===== */
@media (max-width: 1060px) { /* menu turns into a hamburger below this width */
    .header-inner {
        grid-template-columns: 1fr auto;
    }
    .menu-btn {
        display: block;
    }
    /* menu and time popup share the same wide dropdown look */
    .nav,
    .time-pop {
        position: absolute;
        top: calc(100% + 6px);
        left: var(--pad-l);
        right: var(--pad-r);
        width: auto;
        border-radius: var(--r-lg);
        background: var(--card);
        box-shadow: var(--shadow);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px) scale(0.96);
        transform-origin: top center;
        transition: opacity var(--t-quick) var(--ease), transform var(--t-base) var(--ease), visibility var(--t-quick);
    }
    .nav {
        padding: 10px;
    }
    .nav ul {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .nav a {
        display: block;
        padding: 12px;
        border-radius: var(--pill);
        background: var(--paper);
        text-align: center;
        font-size: 1rem;
        transition: background var(--t-quick) var(--ease);
    }
    .nav a::after {
        display: none;
    }
    .nav a:active,
    .nav a.active {
        background: var(--hl);
    }
    .site-header.open .nav,
    .site-header.time-open .time-pop {
        opacity: 1;
        visibility: visible;
        transform: none;
    }
}

/* ===== <= 860px: single column ===== */
@media (max-width: 860px) { /* single column below this width */
    .id-card {
        grid-template-columns: 1fr;
    }
    .id-photo {
        width: 100%;
        max-width: 460px;
        margin-inline: auto;
    }
    /* "hi, i'm Eli" scales with screen width so it never wraps */
    .id-info h1 {
        font-size: clamp(
            3rem,
            calc(
                (100vw - 2 * var(--pad) - 2 * var(--inset) - 2 * var(--inset-text) - 24px) / 3.75
            ),
            8rem
        );
    }
    .duo,
    .cards3,
    .chars,
    .shows {
        grid-template-columns: 1fr;
    }
    .shows-view {
        max-width: 420px;
        margin-inline: auto;
    }
    .char-grid {
        width: 100%;
        max-width: 480px;
        margin-inline: auto;
    }
    /* games: stacked rows, tap one to open it */
    .games-acc {
        flex-direction: column;
        height: auto;
    }
    .games-acc > li,
    .games-acc > li.is-active {
        flex: none;
    }
    .games-acc > li {
        height: 84px;
    }
    .games-acc > li.is-active {
        height: 300px;
    }
    .game-v {
        top: 50%;
        bottom: auto;
        writing-mode: horizontal-tb;
        transform: translate(-50%, -50%);
    }
}

/* ===== <= 480px: tighter character cards ===== */
@media (max-width: 480px) { /* tighter character cards below this width */
    .char-grid {
        gap: 10px;
    }
    .char {
        gap: 10px;
    }
}

/* ===== REDUCED MOTION: fast fades, no hidden content ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 300ms !important;
        animation-duration: 300ms !important;
    }
    .js .reveal {
        opacity: 1;
    }
    .js .words:not(.in) .wi {
        transform: none;
    }
}

/* ===== PROFILE LOOK ON PHONE (config.js: profile.photoAtBottomOnPhone) ===== */
/* profile photo layout on phones */
@media (max-width: 860px) {
    .id-card[data-photo-side] {
        grid-template-columns: 1fr;
    }
    /* false: photo on top, big "hi, i'm" */
    .id-card[data-photo-bottom="no"] .id-photo {
        order: 1;
    }
    .id-card[data-photo-bottom="no"] .id-info {
        order: 2;
    }
    .id-card[data-photo-bottom="no"] .id-info h1 {
        font-size: clamp(
            3rem,
            calc(
                (100vw - 2 * var(--pad) - 2 * var(--inset) - 2 * var(--inset-text) - 24px) / 3.75
            ),
            8rem
        );
    }
    .id-card[data-photo-bottom="no"] .id-info .line {
        white-space: nowrap;
    }
    /* true: text first, photo at the bottom */
    .id-card[data-photo-bottom="yes"] .id-info {
        order: 1;
    }
    .id-card[data-photo-bottom="yes"] .id-photo {
        order: 2;
    }
    .id-card[data-photo-bottom="yes"] .id-info h1 {
        font-size: clamp(2rem, 3.7vw, 3.6rem);
    }
    .id-card[data-photo-bottom="yes"] .id-info .line {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}
