/* =========================================================================
   DinoLife adaptive rendering budget (website)
   Loaded last so it wins over page-level decorative CSS.
   ========================================================================= */

/* Cross-document navigation gets a GPU-composited cross-fade instead of a blank
   white flash. Chromium ignores this on unsupported builds; it never changes the
   document lifecycle or page JavaScript. */
@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.18s;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }
}

:root[data-perf="lite"],
:root[data-perf="balanced"] {
    --dl-perf-blur: none;
    --dl-perf-shadow: none;
}

/* Blur forces the compositor to re-read the page behind every translucent panel.
   On The Isle minimum spec this is the single largest source of browser/overlay
   frame-time spikes, so lite and balanced use near-opaque fills instead. */
:root[data-perf="lite"] *,
:root[data-perf="lite"] *::before,
:root[data-perf="lite"] *::after,
:root[data-perf="balanced"] *,
:root[data-perf="balanced"] *::before,
:root[data-perf="balanced"] *::after {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

/* Decorative infinite loops are paused entirely on minimum-spec devices. Real
   loading indicators remain visible and animated. */
:root[data-perf="lite"] *,
:root[data-perf="lite"] *::before,
:root[data-perf="lite"] *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.08s !important;
}

:root[data-perf="lite"] :is(.ri-spin, .spinner, .loading-spinner, .fa-spin, .dl-spinner, .pulse-dot),
:root[data-perf="lite"] :is(.ri-spin, .spinner, .loading-spinner, .fa-spin, .dl-spinner, .pulse-dot)::before,
:root[data-perf="lite"] :is(.ri-spin, .spinner, .loading-spinner, .fa-spin, .dl-spinner, .pulse-dot)::after {
    animation-duration: 0.9s !important;
    animation-iteration-count: infinite !important;
}

:root[data-perf="lite"] * {
    text-shadow: none !important;
}

:root[data-perf="lite"] :is(.glass-panel, .card, .modal-content, .cyber-modal, .site-announcement-bar,
    .main-sidebar, .navbar, .top-nav, .sidebar, .news-card, .quest-card, .shop-card,
    .market-card, .feature-card, .stat-card) {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55) !important;
    background-color: rgba(9, 14, 24, 0.94) !important;
}

/* Long pages: let Chromium skip layout/paint for off-screen sections. The intrinsic
   size prevents scrollbar jumps while content is still unrendered. Balanced gets
   the same treatment because a 4-core/8 GB machine is also running The Isle. */
:root[data-perf="lite"] main>section:nth-of-type(n+2),
:root[data-perf="lite"] .public-page-section:not(:first-child),
:root[data-perf="lite"] footer,
:root[data-perf="balanced"] main>section:nth-of-type(n+2),
:root[data-perf="balanced"] .public-page-section:not(:first-child),
:root[data-perf="balanced"] footer {
    content-visibility: auto;
    contain-intrinsic-size: auto 640px;
}

:root[data-perf="lite"] {
    scroll-behavior: auto !important;
}

:root[data-perf="lite"] body {
    scroll-behavior: auto !important;
}

:root[data-perf="lite"] body::before,
:root[data-perf="lite"] body::after {
    display: none !important;
    animation: none !important;
}

/* The ambient layer is a fixed, full-screen composited stack. On minimum-spec
   hardware the dark body gradient already provides the visual identity. */
:root[data-perf="lite"] .aaa-background,
:root[data-perf="lite"] .scanlines,
:root[data-perf="lite"] .noise-overlay,
:root[data-perf="balanced"] .aaa-background,
:root[data-perf="balanced"] .scanlines {
    display: none !important;
}

:root[data-perf="balanced"] body::before {
    display: none !important;
}

/* Balanced keeps colour, borders and transitions but drops the blur and the
   heaviest fixed-background repaint. */
:root[data-perf="balanced"] :is(.site-announcement-bar, .main-sidebar, .navbar, .top-nav,
    .modal-content, .cyber-modal, .glass-panel) {
    background-color: rgba(9, 14, 24, 0.94) !important;
}

:root[data-perf="balanced"] body::before {
    background-attachment: scroll !important;
}

/* Tab hidden: compositor work stops until the user returns. */
:root.page-hidden *,
:root.page-hidden *::before,
:root.page-hidden *::after {
    animation-play-state: paused !important;
}

/* Respect the OS reduced-motion setting even on high-end devices. */
@media (prefers-reduced-motion: reduce) {

    :root *,
    :root *::before,
    :root *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* Keep map panes composited without promoting every marker individually. */
.leaflet-container {
    contain: layout paint style;
    -webkit-tap-highlight-color: transparent;
}

.leaflet-marker-icon,
.leaflet-marker-shadow {
    will-change: auto;
}

:root[data-perf="lite"] .leaflet-marker-icon {
    image-rendering: auto;
}

:root[data-perf="lite"] .leaflet-tooltip,
:root[data-perf="lite"] .leaflet-popup-content-wrapper {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6) !important;
}

/* Official download portal: the two large blurred orbs and the shine sweep are
   pure decoration. Minimum-spec players should not pay for them while the game
   is running, and below-the-fold cards can stay unpainted until scrolled into
   view. */
:root[data-perf="lite"] .portal-orb-1,
:root[data-perf="lite"] .portal-orb-2,
:root[data-perf="lite"] .btn-master-download::before,
:root[data-perf="lite"] .download-hero-card::before {
    display: none !important;
    animation: none !important;
}

:root[data-perf="balanced"] .portal-orb-1,
:root[data-perf="balanced"] .portal-orb-2 {
    filter: blur(22px) !important;
    opacity: 0.55;
    animation: none !important;
}

:root[data-perf="lite"] .dl-lazy-section,
:root[data-perf="balanced"] .dl-lazy-section {
    content-visibility: auto;
    contain-intrinsic-size: auto 560px;
}

@media (max-width: 640px) {
    .dl-release-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .dl-changelog {
        max-height: 170px;
    }
}

/* =========================================================================
   Live tactical map budget (page-map)
   =========================================================================
   The map is a continuous GPU/compositor workload: every pan and zoom moves
   hundreds of markers and tile layers. Decorative blur, per-marker
   drop-shadow filters and infinite pulses multiply that cost on every frame,
   even on high-end machines. These rules keep the tactical identity but remove
   work that cannot be seen at map scale.
   ------------------------------------------------------------------------- */

/* The global particle canvas is never useful behind the map. */
.page-map #ember-canvas {
    display: none !important;
}

/* A blurred 340 px sidebar forces the compositor to re-read the map behind it
   for every pan frame. Use a near-opaque tactical panel instead. */
.page-map .map-sidebar,
.page-map .leaflet-popup-content-wrapper,
.page-map .codex-modal-container,
.page-map .vip-modal-box {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background-color: rgba(8, 13, 23, 0.97) !important;
}

/* Per-icon drop-shadows are the single most expensive marker style: each one
   becomes its own filter surface that must be re-rasterised while panning. */
.page-map .poi-marker-wrap,
.page-map .poi-marker-wrap,
.page-map .leaflet-marker-icon,
.page-map .leaflet-marker-icon *,
.page-map .poi-badge-inner,
.page-map .poi-badge-inner i,
.page-map .poi-marker-wrap:hover .poi-badge-inner,
.page-map .tactical-region-badge,
.page-map .tactical-region-badge i,
.page-map .tactical-heading-arrow svg,
.page-map .tactical-sight-cone,
.page-map .party-pin-ring,
.page-map .clan-pin-ring,
.page-map .quest-pin-ring,
.page-map .prime-pin-ring,
.page-map .tactical-pinpoint-pin,
.page-map .tactical-search-pin,
.page-map .map-reticle,
.page-map .tactical-player-core-dot {
    filter: none !important;
    text-shadow: none !important;
}

/* Every translucent site chrome layer also blurs the moving map behind it.
   On the map page the tactical panels are opaque enough without any backdrop
   filter, so remove all of them regardless of hardware tier. */
.page-map *,
.page-map *::before,
.page-map *::after {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

.page-map .poi-badge-inner,
.page-map .poi-badge-inner i {
    transition: none !important;
}

.page-map .poi-marker-wrap:hover {
    z-index: 99999 !important;
}

/* Decorative loops keep the compositor awake while the player is reading the
   map. Keep only the live player beacon (real gameplay information). */
.page-map .map-sidebar-header i,
.page-map .prime-btn i,
.page-map .weather-hud h4 i,
.page-map .quest-pin-ring,
.page-map .prime-pin-ring,
.page-map .tactical-pinpoint-pin,
.page-map .tactical-search-pin,
.page-map .tactical-zone-warzone {
    animation: none !important;
}

/* Leaflet already positions tiles with an inline transform. Promoting every
   tile (and every marker) to its own compositor layer costs GPU memory and
   causes long raster queues on zoom. */
.page-map .leaflet-tile-container,
.page-map .leaflet-tile {
    will-change: auto !important;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
    image-rendering: auto !important;
}

/* Tile cross-fades add an opacity animation over every newly decoded tile. */
.page-map .leaflet-tile {
    transition: none !important;
}

.page-map .leaflet-popup-content-wrapper {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.72) !important;
}

.page-map .leaflet-marker-icon,
.page-map .leaflet-marker-shadow {
    will-change: auto !important;
}

/* Lite/balanced users additionally skip the remaining marker glow shadows and
   the reticle gradient. The map stays fully functional and readable. */
:root[data-perf="lite"] .page-map .tactical-region-badge,
:root[data-perf="balanced"] .page-map .tactical-region-badge,
:root[data-perf="lite"] .page-map .party-pin-badge,
:root[data-perf="lite"] .page-map .clan-pin-badge,
:root[data-perf="lite"] .page-map .quest-pin-badge,
:root[data-perf="lite"] .page-map .prime-pin-badge,
:root[data-perf="lite"] .page-map .my-dino-badge {
    box-shadow: none !important;
}

:root[data-perf="lite"] .page-map .map-reticle {
    display: none !important;
}

:root[data-perf="lite"] .page-map .tactical-sight-cone {
    display: none !important;
}