/* Shared responsive + performance overrides, loaded after each page stylesheet. */
html { -webkit-text-size-adjust: 100%; }
img { max-width: 100%; }

/* Skip rendering off-screen cards until scrolled near them. */
.card-wrapper, .poke-card, .cat-card, .category-card {
    content-visibility: auto;
    contain-intrinsic-size: auto 260px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media (max-width: 1024px) {
    header { width: 94%; padding: 14px 24px; }
    .search-container { width: 90%; }
    .random-pokemon-img { width: 300px; right: 5%; }
    .side-card-top { width: 380px; right: 4%; }
    .side-card-bottom-description { right: 6%; }
}

@media (max-width: 800px) {
    header {
        top: 12px; width: calc(100% - 24px); padding: 10px 14px;
        border-radius: 24px; flex-wrap: wrap; justify-content: center; gap: 4px 0;
    }
    header a { padding: 4px 9px; font-size: 14px; }
    header svg { width: 28px; height: 28px; }

    .resources-page, .detail-page { padding-top: 130px; }
    .collection-page { padding-top: 150px; }
    .category-page { padding-top: 140px; }
    .journal-container { padding-top: 130px; }

    .search-overlay { padding-top: 100px; }
    .search-container { width: calc(100% - 24px); padding: 18px; }
    .result-list-container { max-height: 55vh; }
    .search-sprites { width: calc(50% - 10px); }

    .page-title { font-size: 34px; }
    .filter-toolbar { margin: 0 12px 24px; padding: 16px; border-radius: 22px; }
    .search-bar-container { flex-direction: column; }
    .search-bar-container button { padding: 12px; }
    .filter-dropdown { min-width: 100%; }
    .filters-group { min-width: 100%; }
    .collection-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 0 12px; }
    .sprite-img { width: 110px; height: 110px; }
    .pokemon-card-expand[open] { padding: 22px; max-height: 88vh; overflow-y: auto; }

    .detail-page { grid-template-columns: 1fr; }
    .detail-top { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .detail-grid, .difficulty-grid { grid-template-columns: 1fr; }
    .mini-sprite { width: 90px; height: 90px; }

    /* Home: stack the absolutely positioned hero content. */
    .hero-container { height: auto; min-height: 100svh; padding-top: 140px; overflow: visible; }
    .screen { position: relative; height: auto; transition: none; }
    #accueil-screen { transform: none !important; }
    #screen-2:checked ~ #accueil-screen { display: none; }
    #univers-screen { transform: none !important; display: none; flex-direction: column; padding: 0 12px 80px; }
    #screen-2:checked ~ #univers-screen { display: flex; }
    #screen-1:checked ~ #univers-screen { display: none; }
    .pokemon-display-area { display: flex; flex-direction: column; align-items: center; gap: 12px; height: auto; padding: 20px 0 60px; }
    .txt { position: static; transform: none; width: calc(100% - 24px); margin: 0 12px; padding: 20px; font-size: 18px; order: -1; }
    .random-pokemon-img, .random-pokemon-name, .new-pokemon-btn { position: static; width: 220px; max-width: 70%; }
    .random-pokemon-name { width: auto; }
    .main-card, .side-cards-wrapper { width: 100%; height: auto; }
    .side-card-top, .side-card-bottom-description, .documentation-link {
        position: static; width: 100%; align-self: stretch;
    }
    .univers-slider { position: fixed; bottom: 14px; z-index: 50; }
}

@media (max-width: 420px) {
    header a { padding: 4px 6px; font-size: 13px; }
    .collection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .resources-grid { grid-template-columns: 1fr; }
}

/* Header icons were opacity:0 on several pages, leaving them clickable but invisible. */
.header-icon-transparent { opacity: 1 !important; cursor: pointer; }
.header-icon-transparent svg { stroke: black; }
