/* The graphics quality tier's styles (perf.js sets html[data-perf] = low | medium | high before the first paint), and
   perf.js's suggestion card. Linked after each page's own stylesheets, so the tiers live here and nowhere else. Medium and High look as before;
   Low drops the backdrop blurs, which the browser recomputes for every frame something moves under them (the app bar,
   sheets, menus and dialogs over the maps and Home's moving pictures). The glass turns nearly opaque instead, so text
   on it keeps at least its contrast (dark text on white or near white: well over 4.5:1). The canvases and the map draw
   less through perf.js's PRESETS, not here. */

html[data-perf="low"] {
  --blur: none;
  --blur-thick: none;
  --glass: rgba(255, 255, 255, .95);
  --glass-thick: rgba(255, 255, 255, .97);
  --glass-solid: #fff;
}
html[data-perf="low"] *::backdrop,
html[data-perf="low"] .country-veil,
html[data-perf="low"] .section-loader { -webkit-backdrop-filter: none; backdrop-filter: none; }
html[data-perf="low"] .section-loader { background: rgb(231 237 245 / .94); }   /* the maps' loading and error cover (section-loader.css) */
/* A closed resort on the trail map: its chairs' canvas faint like its runs (trail-map.js closedAlpha), not blurred */
html[data-perf="low"] .is-closed-blur .tm-chairs { filter: none; opacity: .55; }
/* The app bar's drifting ridge and falling snow (resort.css .app-scene) repaint the bar every frame on every page: still
   at Low, the same whole frame as with reduced motion (2026-11-04, iOS Safari check) */
html[data-perf="low"] .app-scene i,
html[data-perf="low"] .app-scene-snow::before,
html[data-perf="low"] .app-scene-snow::after { animation: none; }

/* ---------- The suggestion card (perf.js showAdvice): at the side, bottom right; across the foot on phones ---------- */
.perf-advice {
  position: fixed; z-index: 70; right: max(16px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(360px, calc(100vw - 32px)); box-sizing: border-box;
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 4px 14px 14px;
  border-radius: var(--radius-lg); border: 1px solid var(--glass-border);
  background: var(--glass-solid);   /* no backdrop blur: it would be redrawn for every frame of a page already slow */
  box-shadow: var(--shadow); color: var(--text); font-family: var(--font);
  animation: perf-advice-in var(--dur) var(--ease-out);
}
@keyframes perf-advice-in { from { opacity: 0; transform: translateX(16px); } }
@keyframes perf-advice-up { from { opacity: 0; transform: translateY(12px); } }
.perf-advice-icon {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: rgb(var(--accent-rgb) / .1); color: var(--accent);
}
.perf-advice-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.perf-advice-body { flex: 1; min-width: 0; padding-top: 1px; }
.perf-advice-text { margin: 0; font-size: 14px; line-height: 1.4; }
.perf-advice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.perf-advice-actions button {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  font: 600 14px/1 var(--font); transition: background var(--dur-fast) var(--ease);
}
.perf-advice-switch { background: var(--accent); color: var(--on-accent); }
.perf-advice-switch:hover { background: var(--accent-hover); }
.perf-advice-keep { background: var(--fill); color: var(--text); }
.perf-advice-keep:hover { background: var(--fill-hover); }
@media (max-width: 600px), (pointer: coarse) { .perf-advice-actions button { min-height: 44px; } }   /* a finger's target (36 px, iOS Safari 2026-11-08) */
.perf-advice-close {
  flex: none; width: 44px; height: 44px; margin: -10px 0 -10px; border: 0; border-radius: 50%; background: none;
  color: var(--muted); font: 22px/1 var(--font); cursor: pointer;
}
.perf-advice-close:hover { background: var(--fill); color: var(--text); }
@media (max-width: 640px) {
  .perf-advice { left: var(--gutter); right: var(--gutter); width: auto; bottom: calc(12px + env(safe-area-inset-bottom)); animation-name: perf-advice-up; }
}
@media (prefers-contrast: more) { .perf-advice { background: #fff; border-color: var(--stroke); } }
@media (forced-colors: active) { .perf-advice { border: 1px solid CanvasText; } }

/* ---------- Diagnostics (development only: ?perf=debug or localStorage skiapp.perfDebug = "1") ---------- */
.perf-debug {
  position: fixed; left: 8px; bottom: 8px; z-index: 2147483000; max-width: min(560px, calc(100vw - 16px));
  padding: 8px 10px; border-radius: 8px; background: rgb(11 37 69 / .9); color: #fff;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; pointer-events: none;
}
