/* ============================================================================
   RS-TH15 — Theme Release Candidate
   Final non-destructive consolidation/performance layer based on RS-TH13.
   RS-TH14 was cancelled and is intentionally not included.
============================================================================ */

:root {
  --theme-rc-version: "20260712_rs_th15_rc1";
  --theme-control-min-size: 44px;
  --theme-content-max: 1440px;
  --theme-media-radius: var(--theme-radius-md, .9rem);
  --theme-layout-gutter: clamp(1rem, 2vw, 1.75rem);
  --theme-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme-rc] {
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.theme-rc {
  min-inline-size: 0;
  padding-bottom: var(--theme-safe-bottom);
}

body.theme-rc :where(.app-main, #main-content, .container, .container-fluid, .row, [class*="grid"], [class*="layout"]) {
  min-inline-size: 0;
}

body.theme-rc :where(img, video, canvas, svg) {
  max-inline-size: 100%;
}

body.theme-rc img[width][height] {
  block-size: auto;
}

body.theme-rc img[data-rc-dimensioned] {
  object-fit: cover;
}

body.theme-rc :where(iframe, video) {
  max-inline-size: 100%;
}

body.theme-rc :where(.table-responsive, .dataTables_wrapper, .herb-table-region, .map-shell, .chart-wrap) {
  min-inline-size: 0;
  overscroll-behavior-inline: contain;
}

body.theme-rc :where(.chart-wrap, [data-chart-shell], [data-map-shell]) {
  contain: layout paint;
}

body.theme-rc :where(button, .btn, [role="button"], input, select, textarea) {
  touch-action: manipulation;
}

body.theme-rc :where([data-rc-deferred-section]) {
  content-visibility: auto;
  contain-intrinsic-block-size: 720px;
}

body.theme-rc :where(.modal, .offcanvas, .dropdown-menu, .popover, .tooltip, .leaflet-pane, .leaflet-control-container) {
  content-visibility: visible;
}

body.theme-rc .theme-rc-only-debug {
  display: none;
}

body.theme-rc[data-debug="1"] .theme-rc-only-debug {
  display: block;
}

@media (max-width: 767.98px) {
  :root {
    --theme-layout-gutter: 1rem;
  }

  body.theme-rc :where(.app-main, #main-content) {
    max-inline-size: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.theme-rc :where(*) {
    scroll-behavior: auto;
  }
}

@media (forced-colors: active) {
  body.theme-rc :where(.card, .panel, .modal-content, .dropdown-menu) {
    border-color: CanvasText;
  }
}

@media print {
  html[data-theme-rc] {
    scrollbar-gutter: auto;
  }

  body.theme-rc :where([data-rc-deferred-section]) {
    content-visibility: visible;
    contain-intrinsic-size: auto;
  }
}
