/* Progressive compatibility layer: stable fallbacks first, newer browser features enhance them. */
:root,
html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

html {
  min-height: 100%;
  height: 100%;
  height: -webkit-fill-available;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  height: 100vh;
  height: -webkit-fill-available;
  height: 100dvh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  -webkit-tap-highlight-color: transparent;
}

.bar,
.techPanel {
  -webkit-overflow-scrolling: touch;
}

#cv {
  touch-action: pan-x pan-y;
}

html[data-theme="light"] .splash {
  background: radial-gradient(circle at 50% 42%, #e8f2fd 0, #f4f7fb 48%, #edf2f8 100%);
}

html[data-theme="light"] .splash:before,
html[data-theme="light"] .splash:after {
  border-color: rgba(35, 119, 216, .18);
}

html[data-theme="light"] .splash__card {
  border-color: rgba(35, 119, 216, .24);
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 24px 80px rgba(29, 58, 92, .14), inset 0 1px rgba(255, 255, 255, .8);
}

.splash__mark {
  object-fit: contain;
  filter: none;
}

html[data-theme="light"] .splash__title {
  color: #18212d;
}

html[data-theme="light"] .splash__subtitle,
html[data-theme="light"] .splash__status {
  color: #566374;
}

html[data-theme="light"] .splash__eyebrow {
  color: #118b68;
}

@media (pointer: coarse) {
  button,
  select {
    min-height: 44px;
  }
}

@media (hover: hover) and (pointer: fine) {
  button:hover,
  select:hover {
    transform: translateY(-1px);
  }
}

@media (hover: none) {
  button:hover,
  select:hover {
    transform: none;
  }
}

@media (prefers-contrast: more) {
  .bar,
  .focus,
  .decision,
  .techMetric,
  button,
  select,
  .decision__checks span {
    border-color: currentColor;
  }
}

@media (forced-colors: active) {
  .bar,
  .focus,
  .decision,
  .techMetric,
  button,
  select,
  .decision__checks span {
    border-color: CanvasText;
  }

  button.on {
    color: HighlightText;
    border-color: Highlight;
    background: Highlight;
  }
}

@supports not (color: color-mix(in srgb, black, white)) {
  :root,
  html[data-theme="dark"] {
    --ui-surface: rgba(18, 25, 36, .92);
    --ui-ring: rgba(74, 163, 255, .5);
  }

  html[data-theme="light"] {
    --ui-surface: rgba(255, 255, 255, .94);
    --ui-ring: rgba(35, 119, 216, .48);
  }

  body {
    background: var(--bg);
  }

  .bar button:hover,
  .bar select:hover {
    border-color: var(--ac);
  }

  .decision__state,
  .decision__checks span {
    background: var(--button);
  }
}
