/* =====================================================================
   animatsu template - template.css
   1 Tokens  2 Base  3 Header  4 Navigation  5 Layout  6 Cards/Modules
   7 Footer  8 Forms/Buttons  9 Tables/Pagination/Alerts  10 Joomla compat
   11 Back to top  12 Motion  13 Pastel  14 Glass  15 Preferences panel
   16 Admin overrides  17 Print / accessibility
   (brand colours + container width + font come from index.php inline CSS)
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --primary: #634c9f; --primary-rgb: 99 76 159; --primary-hover: #4d397f;
  --primary-soft: #eeeaf7; --primary-soft-dark: #302744; --primary-light: #b7a7dc;
  --container-width: 1280px; --glass-blur: 14px;
  --font-body: system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;

  --link: var(--primary);
  --page-bg: #f5f6f8; --surface: #fff; --surface-alt: #f8fafc;
  --surface-glass: rgb(255 255 255 / .72);
  --text: #273142; --text-muted: #667085; --border: #e2e8f0;
  --header-bg: #fff; --header-glass: rgb(255 255 255 / .78);
  --footer-bg: #211a35; --footer-text: #e9e5f3;
  --shadow: 0 4px 18px rgb(15 23 42 / .07);
  --shadow-lg: 0 14px 36px rgb(15 23 42 / .16);
  --radius: .85rem; --radius-sm: .55rem;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --t-fast: .16s; --t: .28s; --t-slow: .5s;
  --sticky-offset: 0px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --link: var(--primary-light);
  --page-bg: #11131a; --surface: #1b1e27; --surface-alt: #232733;
  --surface-glass: rgb(27 30 39 / .68);
  --text: #f1f3f7; --text-muted: #aeb6c5; --border: #343a49;
  --header-bg: #181b23; --header-glass: rgb(24 27 35 / .78);
  --footer-bg: #0c0d12; --footer-text: #d8dce6;
  --primary-soft: var(--primary-soft-dark);
  --shadow: 0 4px 18px rgb(0 0 0 / .28);
  --shadow-lg: 0 14px 36px rgb(0 0 0 / .5);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  min-height: 100%;
  font-size: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--sticky-offset) + 1rem);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
html.is-autoscrolling { scroll-behavior: auto !important; }

body {
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; margin: 0;
  color: var(--text); background: var(--page-bg);
  font-family: var(--font-body); line-height: 1.7;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color var(--t) ease, color var(--t) ease;
}
body.menu-open { overflow: hidden; }

:where(a) { color: var(--link); transition: color var(--t-fast) ease, opacity var(--t-fast) ease; }
:where(a:hover) { color: var(--primary-hover); }
html[data-theme="dark"] :where(a:hover) { color: #fff; }
:where(:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
html[data-theme="dark"] :where(:focus-visible) { outline-color: var(--primary-light); }
#main-content:focus { outline: none; }

button, input, select, textarea { font-family: inherit; }
img, svg, video, iframe { max-width: 100%; }
img { height: auto; }
::selection { background: rgb(var(--primary-rgb) / .28); }

.skip-link {
  position: absolute; top: -100px; left: 1rem; z-index: 1000; padding: .75rem 1.25rem;
  color: #fff; background: var(--primary); border-radius: .5rem; font-weight: 600; text-decoration: none;
  box-shadow: 0 4px 12px rgb(0 0 0 / .25); transition: top var(--t-fast) ease-in-out;
}
.skip-link:focus { top: 1rem; outline: 3px solid #fff; outline-offset: 2px; color: #fff; }

.site-container {
  width: 100%; max-width: var(--container-width); margin-inline: auto;
  padding-inline: clamp(.85rem, 3.5vw, 1.75rem);
}

/* ---------- 3. Header ---------- */
.site-topbar { padding: .5rem 0; color: #fff; background: var(--topbar-bg, var(--primary-hover)); font-size: .875rem; }
.site-topbar a { color: inherit; }

.site-header {
  position: relative; z-index: 110; border-bottom: 1px solid var(--border); background: var(--header-bg);
  transition: transform .38s var(--ease-out), background-color var(--t) ease, box-shadow var(--t) ease;
}
.header-inner { display: flex; min-height: 76px; align-items: center; gap: 1rem; }

.site-brand { display: flex; min-width: 0; min-height: 56px; flex: 1 1 auto; flex-direction: column; justify-content: center; margin-right: auto; }
.site-title {
  display: inline-flex; align-items: center; align-self: flex-start; color: var(--link);
  font-size: clamp(1.15rem, 3.5vw, 1.85rem); font-weight: 700; line-height: 1.25; text-decoration: none; word-break: break-word;
}
.site-title-image { display: block; height: 56px; width: auto; max-width: 100%; object-fit: contain; }
.site-slogan { margin: .15rem 0 0; color: var(--text-muted); font-size: clamp(.78rem, 2vw, .875rem); line-height: 1.35; }

.header-modules { min-width: 0; }
.header-actions { display: flex; flex-shrink: 0; align-items: center; gap: .75rem; margin-left: auto; }
.header-search { width: min(320px, 28vw); }

/* Theme toggle = small switch (a setting), Menu toggle = filled button (the main action on mobile) */
.theme-toggle {
  position: relative; flex: 0 0 auto; width: 3.5rem; height: 2rem; padding: 0; border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-muted); background: var(--surface-alt); cursor: pointer;
  transition: background-color var(--t) ease, border-color var(--t) ease, box-shadow var(--t-fast) ease;
}
.theme-toggle::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: calc(2rem - 8px); height: calc(2rem - 8px); border-radius: 50%;
  background: var(--primary); box-shadow: 0 2px 6px rgb(var(--primary-rgb) / .45);
  transition: transform .45s var(--ease-out), background-color var(--t) ease;
}
html[data-theme="dark"] .theme-toggle::before { transform: translateX(1.5rem); }
.theme-toggle:hover { border-color: var(--primary); }
.theme-toggle:active::before { width: calc(2rem - 2px); }
html[data-theme="dark"] .theme-toggle:active::before { transform: translateX(1.1rem); }
.theme-icon-light, .theme-icon-dark { position: absolute; top: 50%; margin-top: -7px; pointer-events: none; transition: color var(--t) ease, transform .45s var(--ease-out); }
.theme-icon-light { left: 8px; color: #fff; }
.theme-icon-dark { right: 8px; }
html[data-theme="dark"] .theme-icon-light { color: var(--text-muted); transform: rotate(-90deg); }
html[data-theme="dark"] .theme-icon-dark { color: #fff; }
html[data-theme="light"] .theme-icon-dark { transform: rotate(90deg); }

.menu-toggle {
  display: none; align-items: center; gap: .55rem; height: 44px; padding: 0 1rem 0 .9rem; border: 0; border-radius: .9rem;
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-hover)); cursor: pointer;
  font-size: .95rem; font-weight: 600; box-shadow: 0 6px 16px -4px rgb(var(--primary-rgb) / .55);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) ease, filter var(--t-fast) ease;
}
.menu-toggle:hover { filter: brightness(1.08); }
.menu-toggle:active { transform: scale(.95); }
.hamburger { display: flex; flex-direction: column; justify-content: center; gap: 4px; width: 18px; height: 18px; }
.hamburger-line { display: block; height: 2px; border-radius: 2px; background: currentColor; transition: transform var(--t) var(--ease-out), opacity var(--t-fast) ease, width var(--t) var(--ease-out); }
.hamburger-line:nth-child(2) { width: 70%; }
.menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) { opacity: 0; transform: translateX(8px); }
.menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- 4. Navigation ---------- */
.nav-sentinel { height: 1px; margin-bottom: -1px; pointer-events: none; }
.nav-drawer-head, .nav-close { display: none; }

.primary-navigation {
  position: relative; z-index: 100; color: var(--nav-ink, #fff);
  background: var(--nav-bg, linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%));
  transition: box-shadow var(--t) ease, background-color var(--t) ease;
}
.primary-navigation.is-stuck { box-shadow: 0 8px 24px rgb(15 23 42 / .22); }

.primary-navigation ul, .primary-navigation ul.menu, .primary-navigation ul.nav { margin: 0; padding: 0; list-style: none; }
.primary-navigation .site-container > ul,
.primary-navigation .site-container > div > ul { display: flex; flex-wrap: wrap; gap: .2rem; padding-block: .4rem; }
.primary-navigation li { position: relative; }

.primary-navigation a,
.primary-navigation .nav-header, .primary-navigation .separator,
.primary-navigation .mod-menu__heading, .primary-navigation .mod-menu__separator {
  position: relative; display: block; padding: .6rem 1rem; color: inherit; text-decoration: none; cursor: pointer;
  border-radius: .65rem; transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.primary-navigation .tree-toggle, .primary-navigation .mod-menu__toggle-sub { display: none; }

.primary-navigation li.parent > a, .primary-navigation li.deeper > a,
.primary-navigation li.parent > .nav-header, .primary-navigation li.deeper > .nav-header,
.primary-navigation li.parent > .separator, .primary-navigation li.parent > .mod-menu__heading { display: inline-flex; align-items: center; gap: .45rem; }
.primary-navigation li.parent > a::after, .primary-navigation li.deeper > a::after,
.primary-navigation li.parent > .nav-header::after, .primary-navigation li.deeper > .nav-header::after,
.primary-navigation li.parent > .separator::after, .primary-navigation li.parent > .mod-menu__heading::after {
  content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-2px); transition: transform var(--t) var(--ease-out); opacity: .8;
}

@media (min-width: 768px) {
  html[data-sticky-nav="on"] .primary-navigation { position: sticky; top: 0; }

  .primary-navigation > .site-container > ul > li > a::before,
  .primary-navigation > .site-container > div > ul > li > a::before {
    content: ""; position: absolute; left: 50%; bottom: .22rem; width: 0; height: 3px; border-radius: 3px; background: currentColor;
    transform: translateX(-50%); transition: width var(--t) var(--ease-out);
  }
  .primary-navigation > .site-container > ul > li:is(:hover, :has(:focus-visible), .is-open, .active, .current) > a,
  .primary-navigation > .site-container > div > ul > li:is(:hover, :has(:focus-visible), .is-open, .active, .current) > a { background: rgb(255 255 255 / .16); }
  .primary-navigation > .site-container > ul > li:is(:hover, .active, .current) > a::before,
  .primary-navigation > .site-container > div > ul > li:is(:hover, .active, .current) > a::before { width: 1.4rem; }
  .primary-navigation li.parent:is(:hover, :has(:focus-visible), .is-open) > a::after,
  .primary-navigation li.deeper:is(:hover, :has(:focus-visible), .is-open) > a::after { transform: rotate(-135deg) translateY(-2px); }

  /* hover bridge: lives on the <li>, so it can never be clipped by the dropdown's own overflow */
  .primary-navigation li.parent::after, .primary-navigation li.deeper::after {
    content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 14px; pointer-events: none;
  }
  .primary-navigation li:is(:hover, :has(:focus-visible), .is-open)::after { pointer-events: auto; }

  /* dropdown */
  .primary-navigation li > ul {
    position: absolute; top: calc(100% + 10px); left: 0; z-index: 120; min-width: 14.5rem; max-width: min(24rem, 92vw); margin: 0; padding: .45rem;
    color: var(--text); background: var(--drop-bg, var(--surface)); border: 1px solid var(--border); border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(8px) scale(.98); transform-origin: top left;
    transition: opacity var(--t) var(--ease-out), transform var(--t) var(--ease-out), visibility 0s linear .18s;
  }
  .primary-navigation li:is(:hover, :has(:focus-visible), .is-open) > ul { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition-delay: 0s; }
  .primary-navigation li.flip-left > ul { left: auto; right: 0; transform-origin: top right; }
  /* only leaf dropdowns scroll (overflow on a branch would clip its fly-outs) */
  .primary-navigation li > ul:not(:has(ul)) { max-height: calc(100vh - var(--sticky-offset) - 40px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

  .primary-navigation li li > a, .primary-navigation li li > .nav-header, .primary-navigation li li > .separator, .primary-navigation li li > .mod-menu__heading {
    padding: .55rem .85rem; color: var(--text); font-size: .93rem; border-radius: .6rem;
  }
  .primary-navigation li li > a { transition: background-color var(--t-fast) ease, color var(--t-fast) ease, padding var(--t) var(--ease-out); }
  .primary-navigation li li > a:is(:hover, :focus-visible), .primary-navigation li li:is(:hover, .active, .current) > a {
    color: var(--link); background: var(--primary-soft); padding-left: 1.1rem;
  }
  .primary-navigation li li > a::before { display: none; }
  .primary-navigation li li.parent > a { display: flex; justify-content: space-between; }
  .primary-navigation li li.parent > a::after { transform: rotate(-45deg); }

  /* fly-outs (3rd level and deeper) */
  .primary-navigation li li.parent::after, .primary-navigation li li.deeper::after { left: 100%; right: auto; top: 0; bottom: 0; width: 14px; height: auto; }
  .primary-navigation li ul ul { top: -.45rem; left: calc(100% + 8px); transform: translateX(-8px) scale(.98); }
  .primary-navigation li li:is(:hover, :has(:focus-visible), .is-open) > ul { transform: none; }
  .primary-navigation li li.flip-left > ul { left: auto; right: calc(100% + 8px); transform-origin: top right; }
  .primary-navigation li li.flip-left::after { left: auto; right: 100%; }
}

/* ---------- 5. Banner / breadcrumbs / layout ---------- */
.site-banner { overflow: hidden; background: var(--surface-alt); }
.site-banner img { display: block; max-width: 100%; max-height: 320px; margin: 20px auto; object-fit: cover; border-radius: 12px; }

.breadcrumbs-wrapper { border-bottom: 1px solid var(--border); background: var(--crumb-bg, var(--surface)); }
.breadcrumbs-wrapper .site-container { display: flex; align-items: center; min-height: 2.75rem; padding-block: .6rem; }
.breadcrumbs-wrapper:has(.breadcrumb:empty), .breadcrumbs-wrapper:has(.breadcrumbs:empty) { display: none; }

.breadcrumb, .breadcrumbs, ul.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .45rem; width: 100%; margin: 0; padding: 0;
  color: var(--text-muted); list-style: none; font-size: .9rem; line-height: 1.5rem;
}
.breadcrumb li, .breadcrumb .breadcrumb-item { display: inline-flex; align-items: center; min-height: 1.5rem; }
.breadcrumb li + li::before { margin-right: .45rem; color: var(--text-muted); content: "›"; font-size: 1.1em; }
.breadcrumb a { color: var(--link); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .divider, .breadcrumb .icon-location, .breadcrumb .mod-breadcrumbs__here { display: none; }
.breadcrumb .mod-breadcrumbs__here + li::before { content: none; margin: 0; }
.breadcrumb li.active { color: var(--text); font-weight: 500; }

.site-main { flex: 1 0 auto; padding: clamp(1.25rem, 3vw, 2rem) 0; height: auto; min-height: 0;}
.content-layout { display: grid; align-items: start; gap: 1.5rem; }
.layout-full { grid-template-columns: minmax(0, 1fr); }
.layout-full .component-area { width: 100%; max-width: 960px; margin-inline: auto; }
.layout-left { grid-template-columns: 260px minmax(0, 1fr); }
.layout-right { grid-template-columns: minmax(0, 1fr) 300px; }
.layout-three-columns { grid-template-columns: 240px minmax(0, 1fr) 280px; }
.component-area, .sidebar { min-width: 0; }
.content-top { margin-bottom: 1.5rem; }
.content-bottom { margin-top: 1.5rem; }
.container-modules { margin-bottom: 1.5rem; }
.container-modules .module-card:last-child { margin-bottom: 0; }

/* ---------- 6. Cards & modules ---------- */
.component-card, .module-card {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg, var(--surface)); box-shadow: var(--shadow);
  transition: box-shadow var(--t) ease, transform var(--t) var(--ease-out), border-color var(--t) ease, background-color var(--t) ease;
}
.component-card { padding: var(--component-pad, clamp(1rem, 3vw, 2rem)); }
.module-card {
  --title-bg: linear-gradient(120deg, var(--primary), var(--primary-hover)); --title-ink: #fff;
  --title-mark: rgb(255 255 255 / .6); --title-line: transparent;
  margin-bottom: 1.5rem;
}
.module-card:last-child { margin-bottom: 0; }
@media (hover: hover) { .module-card:hover { box-shadow: var(--shadow-lg); border-color: rgb(var(--primary-rgb) / .35); } }

.module-card > .module-title {
  position: relative; margin: 0; padding: .85rem 1rem .85rem 1.5rem; color: var(--title-ink);
  background: var(--title-bg); border-bottom: 1px solid var(--title-line);
  font-size: 1.05rem; font-weight: 600; letter-spacing: .01em; text-align: left;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}
.module-card > .module-title::before { content: ""; position: absolute; top: .6rem; bottom: .6rem; left: .6rem; width: 4px; border-radius: 4px; background: var(--title-mark); }
.module-card > .module-content { padding: var(--module-pad, 1.15rem 1.25rem); }
.module-card > .module-content > *:first-child { margin-top: 0; }
.module-card > .module-content > *:last-child { margin-bottom: 0; }
.module-plain .module-title { margin: 0 0 .5rem; }

/* Menus inside sidebars / modules (":where" = zero specificity, any module CSS wins) */
:where(.sidebar, .module-content) :where(ul.menu, ul.nav, ul.mod-menu) { margin: 0; padding: 0; list-style: none; }
:where(.sidebar, .module-content) :where(ul.menu, ul.nav, ul.mod-menu) > li { border-bottom: 1px solid var(--border); }
:where(.sidebar, .module-content) :where(ul.menu, ul.nav, ul.mod-menu) > li:last-child { border-bottom: 0; }
:where(.sidebar, .module-content) :where(ul.menu, ul.nav, ul.mod-menu) :where(a, .nav-header, .mod-menu__heading) {
  position: relative; display: block; padding: .65rem .75rem .65rem 1rem; color: var(--text); text-decoration: none; border-radius: .5rem;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, padding-left var(--t) var(--ease-out);
}
:where(.sidebar, .module-content) :where(ul.menu, ul.nav, ul.mod-menu) a::before {
  content: ""; position: absolute; top: .3rem; bottom: .3rem; left: 0; width: 3px; border-radius: 3px; background: var(--primary);
  transform: scaleY(0); transition: transform var(--t) var(--ease-out);
}
:where(.sidebar, .module-content) :where(ul.menu, ul.nav, ul.mod-menu) a:hover { color: var(--link); background: var(--primary-soft); padding-left: 1.2rem; }
:where(.sidebar, .module-content) :where(ul.menu, ul.nav, ul.mod-menu) a:hover::before { transform: scaleY(1); }
:where(.sidebar, .module-content) :where(ul.menu, ul.nav, ul.mod-menu) :where(li.active, li.current) > a { color: var(--link); background: var(--primary-soft); font-weight: 600; }
:where(.sidebar, .module-content) :where(ul.menu, ul.nav, ul.mod-menu) li ul { margin: 0; padding-left: 1rem; list-style: none; }

/* ---------- 7. Footer ---------- */
.site-footer { flex: 0 0 auto; padding: 1.5rem 0; color: var(--footer-text); background: var(--footer-bg-t, var(--footer-bg)); }
.footer-inner { margin: 1rem .5rem 0; }
.footer-inner p { margin: 0; }
.footer-columns { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; }
.footer-col { min-width: 0; }
.footer-col-left { flex: 1 1 auto; text-align: left; }
.footer-col-right { flex: 0 1 auto; text-align: right; }
.footer-col a, .footer-module a, .footer-inner a { color: inherit; }
.footer-module { min-width: 0; }
.footer-module-title { margin: 0 0 .75rem; color: #fff; font-size: 1.05rem; font-weight: 600; }
.footer-module iframe { width: 100%; border: 0; border-radius: .5rem; }

/* ---------- 8. Forms & buttons ----------
   Everything here is wrapped in :where() => specificity 0.
   Module / plugin CSS (even a single class) always wins; the template only provides defaults.
   A plain <button> is NOT touched: only .btn, submit/reset inputs get a style, and only
   "primary" things (.btn-primary, submit) are filled. */
:where(.site-main, .site-header, .site-footer, .site-topbar) :where(input:not([type=checkbox], [type=radio], [type=range], [type=file], [type=color], [type=submit], [type=button], [type=reset], [type=image], [type=hidden]), select, textarea, .form-control, .form-select, .inputbox) {
  width: 100%; max-width: 100%; padding: .6rem .85rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); background: var(--surface);
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
:where(.site-main, .site-header, .site-footer) :where(input:not([type=checkbox], [type=radio], [type=submit], [type=button], [type=reset]), select, textarea):where(:hover) { border-color: rgb(var(--primary-rgb) / .55); }
:where(.site-main, .site-header, .site-footer) :where(input:not([type=checkbox], [type=radio], [type=submit], [type=button], [type=reset]), select, textarea):where(:focus) { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 4px rgb(var(--primary-rgb) / .2); }
:where(input[type=checkbox], input[type=radio]) { accent-color: var(--primary); }
:where(::placeholder) { color: var(--text-muted); opacity: .8; }

/* base = neutral (secondary) */
:where(.site-main, .site-header, .site-footer, .site-topbar) :where(.btn, input[type=submit], input[type=button], input[type=reset], button[type=submit], button[type=reset]) {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.1rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); background: var(--surface);
  font-weight: 500; line-height: 1.4; text-decoration: none; cursor: pointer;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) ease;
}
:where(.site-main, .site-header, .site-footer, .site-topbar) :where(.btn, input[type=submit], input[type=button], input[type=reset], button[type=submit], button[type=reset]):where(:hover) { border-color: var(--primary); color: var(--link); background: var(--primary-soft); }
:where(.site-main, .site-header, .site-footer, .site-topbar) :where(.btn, input[type=submit], input[type=button], input[type=reset], button[type=submit], button[type=reset]):where(:active) { transform: translateY(1px) scale(.98); }

/* primary = filled: only .btn-primary and real submit buttons */
:where(.site-main, .site-header, .site-footer) :where(.btn-primary, input[type=submit], button[type=submit]) { color: #fff; background: var(--primary); border-color: var(--primary); }
:where(.site-main, .site-header, .site-footer) :where(.btn-primary, input[type=submit], button[type=submit]):where(:hover) { color: #fff; background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 6px 16px rgb(var(--primary-rgb) / .3); }
:where(.btn-success) { color: #fff; background: #16a34a; border-color: #16a34a; } :where(.btn-success:hover) { color: #fff; background: #15803d; border-color: #15803d; }
:where(.btn-danger) { color: #fff; background: #dc2626; border-color: #dc2626; } :where(.btn-danger:hover) { color: #fff; background: #b91c1c; border-color: #b91c1c; }
:where(.btn-warning) { color: #1f2433; background: #fbbf24; border-color: #fbbf24; } :where(.btn-warning:hover) { color: #1f2433; background: #f59e0b; border-color: #f59e0b; }
:where(.btn-info) { color: #fff; background: #0891b2; border-color: #0891b2; } :where(.btn-info:hover) { color: #fff; background: #0e7490; border-color: #0e7490; }
:where(.btn-outline-primary) { color: var(--link); background: transparent; border-color: var(--primary); } :where(.btn-outline-primary:hover) { color: #fff; background: var(--primary); }
:where(.btn-outline-secondary) { background: transparent; }
:where(.btn-link) { padding: 0; border: 0; color: var(--link); background: none; cursor: pointer; text-decoration: underline; }
:where(.btn-sm) { padding: .3rem .7rem; font-size: .85rem; } :where(.btn-lg) { padding: .8rem 1.5rem; font-size: 1.1rem; }
:where(.btn:disabled, .btn.disabled, input[type=submit]:disabled) { opacity: .55; cursor: not-allowed; box-shadow: none; pointer-events: none; }

:where(.header-search form, .mod-finder form, .mod-search form), :where(.header-search .input-group, .mod-finder .input-group, .mod-search .input-group) { display: flex; align-items: stretch; gap: .5rem; }
:where(.header-search .input-group > input, .mod-finder .input-group > input, .mod-search .input-group > input) { flex: 1 1 auto; min-width: 0; }

/* ---------- 9. Tables / pagination / alerts (all zero-specificity defaults) ---------- */
:where(.component-card, .module-content) :where(table) { width: 100%; border-collapse: collapse; }
:where(.component-card, .module-content) :where(th, td) { padding: .7rem .8rem; border: 1px solid var(--border); text-align: left; vertical-align: top; }
:where(.component-card, .module-content) :where(th) { background: var(--surface-alt); font-weight: 600; }
:where(.table-responsive) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
:where(.table-striped tbody tr:nth-child(even) > *) { background: var(--surface-alt); }
:where(.table-hover tbody tr:hover > *) { background: var(--primary-soft); }

:where(.pagination, .pagination ul, .pagination-list) { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
:where(.pagination li, .page-item) { display: flex; }
:where(.pagination a, .pagination span, .pagination-list a, .pagination-list span, .page-link) {
  display: flex; align-items: center; justify-content: center; min-width: 2.6rem; min-height: 2.6rem; padding: .4rem .75rem;
  border: 1px solid var(--border); border-radius: .6rem; color: var(--text); background: var(--surface); text-decoration: none; cursor: pointer;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
}
:where(.pagination a:hover, .page-link:hover) { border-color: var(--primary); color: var(--link); background: var(--primary-soft); transform: translateY(-2px); }
:where(.pagination .active a, .pagination .active span, .page-item.active .page-link) { border-color: var(--primary); color: #fff; background: var(--primary); }
:where(.pagination .disabled a, .pagination .disabled span) { opacity: .5; pointer-events: none; }
:where(.pagination .counter) { width: 100%; margin: .5rem 0 0; color: var(--text-muted); font-size: .85rem; text-align: center; }

#system-message-container { margin-bottom: 1rem; }
:where(.alert, #system-message > div) { margin-bottom: 1rem; padding: 1rem 1.15rem; border: 1px solid #bfdbfe; border-left-width: 5px; border-radius: .75rem; color: #1e40af; background: #eff6ff; }
:where(.alert-success) { border-color: #86efac; color: #166534; background: #f0fdf4; }
:where(.alert-warning) { border-color: #fde68a; color: #92400e; background: #fffbeb; }
:where(.alert-error, .alert-danger) { border-color: #fca5a5; color: #991b1b; background: #fef2f2; }
html[data-theme="dark"] :where(.alert, #system-message > div) { border-color: #1e3a8a; color: #93c5fd; background: #0f172a; }
html[data-theme="dark"] :where(.alert-success) { border-color: #065f46; color: #86efac; background: #064e3b; }
html[data-theme="dark"] :where(.alert-warning) { border-color: #78350f; color: #fde68a; background: #451a03; }
html[data-theme="dark"] :where(.alert-error, .alert-danger) { border-color: #7f1d1d; color: #fca5a5; background: #450a0a; }

/* ---------- 10. Joomla core markup (Bootstrap is not loaded) ---------- */
:where(.item-page, .blog, .category-list, .contact, .registration, .login, .profile) { min-width: 0; }
:where(.page-header h1, .page-header h2, .item-page > h1, .blog > h1) { margin-top: 0; color: var(--text); line-height: 1.35; }
:where(.page-header) { margin-bottom: 1.25rem; padding-bottom: .75rem; border-bottom: 2px solid var(--primary-soft); }

:where(.article-info) { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0 0 1rem; padding: 0; color: var(--text-muted); font-size: .85rem; }
:where(.article-info dd) { margin: 0; } :where(.article-info dt) { display: none; }
:where(.tags, .tags .list-inline) { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 1rem 0; list-style: none; }
:where(.tags a, .tag-list a) { display: inline-block; padding: .15rem .7rem; border-radius: 999px; color: var(--link); background: var(--primary-soft); font-size: .8rem; text-decoration: none; }
:where(.tags a:hover) { color: #fff; background: var(--primary); }
:where(.pager, .pagenavigation) { margin-top: 1.5rem; }
:where(.pager ul, .pagenavigation ul) { display: flex; justify-content: space-between; gap: .5rem; padding: 0; list-style: none; }

.blog-items[class*="columns-"] { display: grid; gap: 1.5rem; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
.blog-items.columns-2 { --cols: 2; } .blog-items.columns-3 { --cols: 3; } .blog-items.columns-4 { --cols: 4; }
.blog-items.items-leading, .blog-items.items-leading .blog-item { grid-column: 1 / -1; }

:where(.control-group, .mb-3) { margin-bottom: 1rem; }
:where(.control-label label, .form-label) { display: inline-block; margin-bottom: .3rem; font-weight: 500; }
:where(.star, .required) { color: #dc2626; }
:where(.form-text) { color: var(--text-muted); font-size: .85rem; }
:where(.form-check) { display: flex; align-items: center; gap: .5rem; }
:where(.invalid-feedback, .form-control-feedback) { color: #dc2626; font-size: .85rem; }
:where(.component-card) :where(fieldset) { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin: 0 0 1rem; }
:where(.component-card) :where(legend) { padding: 0 .5rem; font-weight: 600; }

:where(.img-fluid) { max-width: 100%; height: auto; }
:where(.float-start, .pull-left) { float: left; margin: 0 1rem .75rem 0; } :where(.float-end, .pull-right) { float: right; margin: 0 0 .75rem 1rem; }
:where(.text-center) { text-align: center; } :where(.text-end) { text-align: right; } :where(.text-muted) { color: var(--text-muted); }
.visually-hidden, .visually-hidden-focusable:not(:focus):not(:has(:focus-visible)) {
  position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important;
  overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
:where(.list-unstyled) { margin: 0; padding-left: 0; list-style: none; }
:where(.badge) { display: inline-block; padding: .15rem .6rem; border-radius: 999px; color: #fff; background: var(--primary); font-size: .75rem; font-weight: 600; }
:where(.list-group) { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
:where(.list-group-item) { padding: .7rem 1rem; border-bottom: 1px solid var(--border); } :where(.list-group-item:last-child) { border-bottom: 0; }

/* ---------- 11. Back to top ---------- */
.back-to-top {
  position: fixed; right: max(1.25rem, env(safe-area-inset-right)); bottom: max(1.25rem, env(safe-area-inset-bottom)); z-index: 50;
  display: inline-grid; place-items: center; width: 52px; height: 52px; padding: 0; overflow: hidden;
  border: 0; border-radius: 50%; color: var(--link); background: var(--surface); box-shadow: var(--shadow-lg); cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(24px) scale(.6);
  transition: opacity var(--t) ease, transform .5s var(--ease-out), visibility 0s linear .5s, background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.back-to-top:hover { color: #fff; background: var(--primary); transform: translateY(-4px) scale(1.06); }
.back-to-top:active { transform: scale(.92); }
.btt-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.btt-ring circle { fill: none; stroke-width: 3; }
.btt-ring-track { stroke: var(--border); transition: stroke var(--t) ease; }
.btt-ring-bar { stroke: var(--primary); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke var(--t) ease; }
.back-to-top:hover .btt-ring-track { stroke: rgb(255 255 255 / .3); } .back-to-top:hover .btt-ring-bar { stroke: #fff; }
.btt-arrow { display: grid; place-items: center; }
.back-to-top:hover .btt-arrow { animation: btt-nudge .9s var(--ease-io) infinite; }
.back-to-top.is-launching .btt-arrow { animation: btt-launch .6s var(--ease-out); }
@keyframes btt-nudge { 50% { transform: translateY(-3px); } }
@keyframes btt-launch { 0% { transform: none; opacity: 1; } 45% { transform: translateY(-130%); opacity: 0; } 46% { transform: translateY(130%); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ---------- 12. Motion ---------- */
.menu-overlay { position: fixed; inset: 0; z-index: 190; background: rgb(8 10 20 / 0); visibility: hidden; pointer-events: none; transition: background-color .35s ease, visibility 0s linear .35s; }
.menu-overlay.is-active { background: rgb(8 10 20 / .5); visibility: visible; pointer-events: auto; transition-delay: 0s; }

html[data-anim="on"] .component-card { animation: enter-up .6s var(--ease-out) both; }
html[data-anim="on"][data-page-transition="on"] .component-card { animation: none; }
html[data-anim="on"] .sidebar > .module-card { animation: enter-up .6s var(--ease-out) both; }
html[data-anim="on"] .sidebar > .module-card:nth-child(2) { animation-delay: .06s; }
html[data-anim="on"] .sidebar > .module-card:nth-child(3) { animation-delay: .12s; }
html[data-anim="on"] .sidebar > .module-card:nth-child(n+4) { animation-delay: .18s; }
@keyframes enter-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* scroll reveal (JS adds .will-reveal only to elements below the fold) */
html[data-anim="on"] .will-reveal { opacity: 0; transform: translateY(22px) scale(.985); animation: none; }
html[data-anim="on"] .will-reveal.is-revealed {
  opacity: 1; transform: none;
  transition: opacity .65s var(--ease-out) var(--reveal-delay, 0ms), transform .65s var(--ease-out) var(--reveal-delay, 0ms), box-shadow var(--t) ease, border-color var(--t) ease;
}

/* cross-document page transition: plain root cross-fade (no named layers, so sticky nav / glass stay stable) */
@media (prefers-reduced-motion: no-preference) {
  html[data-page-transition="on"] ::view-transition-old(root) { animation: vt-out .18s ease both; }
  html[data-page-transition="on"] ::view-transition-new(root) { animation: vt-in .3s var(--ease-out) both; }
}
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
/* theme switch: the JS circle-reveal animates the new snapshot itself */
html.theme-switching::view-transition-old(root), html.theme-switching::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.theme-switching::view-transition-old(root) { z-index: 1; }
html.theme-switching::view-transition-new(root) { z-index: 2; }

/* ---------- 13. Pastel mode ----------
   Everything that differs per module / per surface is a CUSTOM PROPERTY (--card-bg, --title-*,
   --nav-*), never a direct background on a high-specificity selector. That is what broke
   pastel + blur before: the pastel / glass rules out-ranked .mc-ghost, .mc-outline, .mc-soft...
   so those variants lost their own backgrounds. Now variants always win. */
html[data-pastel="on"] {
  --page-bg: var(--pastel-bg); --surface: #fff; --surface-alt: var(--pastel-1); --border: rgb(var(--primary-rgb) / .16);
  --surface-glass: rgb(255 255 255 / .62); --header-glass: rgb(255 255 255 / .6);
  --header-bg: #fff; /* solid: the mobile header is fixed, content must never show through it */
  --shadow: 0 8px 28px rgb(var(--primary-rgb) / .1); --shadow-lg: 0 18px 44px rgb(var(--primary-rgb) / .2);
  --radius: 1.15rem; --radius-sm: .8rem; --footer-bg: var(--primary-hover);
  --nav-bg: linear-gradient(120deg, var(--pastel-1), var(--pastel-2) 55%, var(--pastel-3)); --nav-ink: var(--primary-hover);
  --drawer-foot-bg: var(--pastel-2);
}
html[data-pastel="on"][data-theme="dark"] {
  --page-bg: var(--pastel-bg-dark); --surface: #1d1b27; --surface-alt: var(--pastel-1-dark); --border: rgb(255 255 255 / .1);
  --surface-glass: rgb(32 29 44 / .6); --header-glass: rgb(26 24 36 / .62); --header-bg: #1a1824; --footer-bg: #0f0d16;
  --shadow: 0 4px 18px rgb(0 0 0 / .28); --shadow-lg: 0 14px 36px rgb(0 0 0 / .5);
  --nav-bg: linear-gradient(120deg, var(--pastel-1-dark), var(--pastel-2-dark)); --nav-ink: var(--primary-light);
  --drawer-foot-bg: var(--pastel-1-dark);
}

/* soft colour wash behind the page (also what the blur has to look at) */
html[data-pastel="on"] body::before,
html[data-glass="nav"]:not([data-pastel="on"]) body::before,
html[data-glass="all"]:not([data-pastel="on"]) body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; transform: translateZ(0);
}
html[data-pastel="on"] body::before {
  background:
    radial-gradient(40rem 28rem at 8% -6%, var(--pastel-1), transparent 70%),
    radial-gradient(34rem 26rem at 96% 8%, var(--pastel-2), transparent 70%),
    radial-gradient(36rem 28rem at 60% 108%, var(--pastel-3), transparent 70%);
  opacity: .9;
}
html[data-pastel="on"][data-theme="dark"] body::before {
  background:
    radial-gradient(40rem 28rem at 8% -6%, var(--pastel-1-dark), transparent 70%),
    radial-gradient(34rem 26rem at 96% 8%, var(--pastel-2-dark), transparent 70%);
  opacity: 1;
}
html[data-pastel="on"] body, html:is([data-glass="nav"], [data-glass="all"]) body { position: relative; isolation: isolate; }

html[data-pastel="on"] .primary-navigation { border-bottom: 1px solid var(--border); }
html[data-pastel="on"] .primary-navigation > .site-container > ul > li:is(:hover, :has(:focus-visible), .is-open, .active, .current) > a,
html[data-pastel="on"] .primary-navigation > .site-container > div > ul > li:is(:hover, :has(:focus-visible), .is-open, .active, .current) > a { background: rgb(255 255 255 / .7); }
html[data-pastel="on"][data-theme="dark"] .primary-navigation > .site-container > ul > li:is(:hover, :has(:focus-visible), .is-open, .active, .current) > a,
html[data-pastel="on"][data-theme="dark"] .primary-navigation > .site-container > div > ul > li:is(:hover, :has(:focus-visible), .is-open, .active, .current) > a { background: rgb(255 255 255 / .1); }

html[data-pastel="on"] .module-card {
  --title-bg: linear-gradient(120deg, var(--pastel-1), var(--pastel-2)); --title-ink: var(--primary-hover);
  --title-mark: rgb(var(--primary-rgb) / .7); --title-line: var(--border);
}
html[data-pastel="on"][data-theme="dark"] .module-card {
  --title-bg: linear-gradient(120deg, var(--pastel-1-dark), var(--pastel-2-dark)); --title-ink: var(--primary-light);
}
html[data-pastel="on"] .menu-toggle { color: var(--primary-hover); background: linear-gradient(135deg, var(--pastel-1), var(--pastel-2)); border: 1px solid var(--border); box-shadow: 0 6px 16px -6px rgb(var(--primary-rgb) / .4); }
html[data-pastel="on"][data-theme="dark"] .menu-toggle { color: var(--primary-light); background: linear-gradient(135deg, var(--pastel-1-dark), var(--pastel-2-dark)); }
html[data-pastel="on"] .site-topbar { color: var(--primary-hover); background: var(--topbar-bg, var(--pastel-1)); }
html[data-pastel="on"][data-theme="dark"] .site-topbar { color: var(--primary-light); background: var(--topbar-bg, var(--pastel-1-dark)); }
html[data-pastel="on"] .page-header { border-bottom-color: var(--pastel-2); }

/* ---------- 14. Gaussian blur / glass (admin default, visitor can override: off | nav | all) ----------
   Rules that keep it stable:
   - blur is never nested (dropdowns stay solid inside the blurred nav)
   - cards blur through a ::before layer, so the card itself is not a containing block
     for position:fixed descendants (modals, lightboxes)
   - a colour wash sits behind the page, otherwise there is nothing to blur
   - the glass background is the variable --card-bg, so any module variant can still replace it */
html:is([data-glass="nav"], [data-glass="all"]):not([data-pastel="on"]) body::before {
  background:
    radial-gradient(34rem 26rem at 4% 0%, rgb(var(--primary-rgb) / .26), transparent 70%),
    radial-gradient(30rem 24rem at 98% 30%, rgb(236 72 153 / .14), transparent 70%),
    radial-gradient(34rem 26rem at 40% 105%, rgb(59 130 246 / .16), transparent 70%);
}
html[data-theme="dark"]:is([data-glass="nav"], [data-glass="all"]):not([data-pastel="on"]) body::before {
  background:
    radial-gradient(34rem 26rem at 4% 0%, rgb(var(--primary-rgb) / .38), transparent 70%),
    radial-gradient(30rem 24rem at 98% 30%, rgb(236 72 153 / .16), transparent 70%),
    radial-gradient(34rem 26rem at 40% 105%, rgb(59 130 246 / .18), transparent 70%);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  html:is([data-glass="nav"], [data-glass="all"]) :is(.site-header, .primary-navigation, .prefs-panel) {
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.5); backdrop-filter: blur(var(--glass-blur)) saturate(1.5);
  }
  html:is([data-glass="nav"], [data-glass="all"]) .site-header { background: var(--header-glass); }

  /* nav colours: white text on primary needs a mostly opaque bar (was .8: too weak over a light page) */
  html:is([data-glass="nav"], [data-glass="all"]):not([data-pastel="on"]) { --nav-bg: rgb(var(--primary-rgb) / .9); }
  html[data-pastel="on"]:is([data-glass="nav"], [data-glass="all"]) { --nav-bg: rgb(255 255 255 / .62); }
  html[data-pastel="on"][data-theme="dark"]:is([data-glass="nav"], [data-glass="all"]) { --nav-bg: rgb(40 34 58 / .66); }

  html:is([data-glass="nav"], [data-glass="all"]) .menu-overlay.is-active { -webkit-backdrop-filter: blur(calc(var(--glass-blur) * .4)); backdrop-filter: blur(calc(var(--glass-blur) * .4)); }
  html:is([data-glass="nav"], [data-glass="all"]) .back-to-top { background: var(--surface-glass); -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur)); }

  html[data-glass="all"] { --card-bg: var(--surface-glass); }
  html[data-glass="all"] :where(.component-card, .module-card) { isolation: isolate; }
  html[data-glass="all"] :where(.component-card, .module-card)::before {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4); backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  }
  html[data-glass="all"] .breadcrumbs-wrapper { background: var(--surface-glass); -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur)); }

  /* module title bars on glass */
  html[data-glass="all"]:not([data-pastel="on"]) .module-card { --title-bg: rgb(var(--primary-rgb) / .88); }
  html[data-glass="all"][data-pastel="on"] .module-card { --title-bg: rgb(255 255 255 / .45); }
  html[data-glass="all"][data-pastel="on"][data-theme="dark"] .module-card { --title-bg: rgb(255 255 255 / .06); }

  /* ghost / outline are meant to be bare: no blur layer (soft, dark and accent keep their colour AND get the blur) */
  .module-card:is(.mc-ghost, .mc-outline)::before { display: none; }

  /* heavy on phones: lighter blur there, and none if the visitor asks for less transparency */
  @media (max-width: 767px) { html { --glass-blur: min(var(--glass-blur-set, 14px), 10px); } }
  @media (prefers-reduced-transparency: reduce) {
    html[data-glass] :is(.site-header, .primary-navigation, .back-to-top, .breadcrumbs-wrapper, .menu-overlay) { -webkit-backdrop-filter: none; backdrop-filter: none; }
    html[data-glass] :where(.component-card, .module-card)::before { display: none; }
    html[data-glass] { --card-bg: var(--surface); --nav-bg: linear-gradient(135deg, var(--primary), var(--primary-hover)); }
  }
}
/* browsers without backdrop-filter simply stay solid and readable: nothing above applies */

/* ---------- 14b. Alpha / transparency for EVERY surface (admin default 20 %, visitor slider) ----------
   One idea: each kind of surface has an opacity token, and its colour goes through
   color-mix(in srgb, <colour> <opacity>, transparent). 100 % = exactly the old solid colour, so nothing changes
   until pastel or blur is on.
     --tx-card    cards, breadcrumbs, topbar            (pastel, or blur "all")
     --tx-over    header, nav bar, mobile drawer        (blur nav/all; with pastel only: >= 90 %, nothing blurs the page behind)
     --tx-drop    desktop dropdown menus                (>= 90 %: they overlap content and cannot blur, blur is never nested)
     --tx-strong  panel, footer, colour-filled bars     (>= 85 %: white text must stay readable)
   [data-theme][data-pastel][data-glass] outranks every pastel / dark / glass rule above, so the slider always wins.
   Browsers without color-mix() keep the fixed look from sections 13 and 14. */
@supports (color: color-mix(in srgb, red 50%, transparent)) {
  html[data-theme][data-pastel="on"][data-glass] { --tx-card: var(--glass-op, 80%); --tx-over: var(--glass-op-flat, 90%); --tx-drop: var(--glass-op-flat, 90%); --tx-strong: var(--glass-op-nav, 85%); }
  html[data-theme][data-pastel][data-glass="all"] { --tx-card: var(--glass-op, 80%); }
  html[data-theme][data-pastel][data-glass="nav"], html[data-theme][data-pastel][data-glass="all"] {
    --tx-over: var(--glass-op, 80%); --tx-drop: var(--glass-op-flat, 90%); --tx-strong: var(--glass-op-nav, 85%);
  }

  html[data-theme][data-pastel][data-glass] {
    --card-bg: color-mix(in srgb, var(--surface) var(--tx-card, 100%), transparent);
    --crumb-bg: color-mix(in srgb, var(--surface) var(--tx-card, 100%), transparent);
    --surface-glass: color-mix(in srgb, var(--surface) var(--tx-over, 100%), transparent);
    --header-glass: color-mix(in srgb, var(--surface) var(--tx-over, 100%), transparent);
    --drop-bg: color-mix(in srgb, var(--surface) var(--tx-drop, 100%), transparent);
    --panel-bg: color-mix(in srgb, var(--surface) var(--tx-strong, 100%), transparent);
    --footer-bg-t: color-mix(in srgb, var(--footer-bg) var(--tx-strong, 100%), transparent);
  }
  html[data-theme][data-pastel="on"][data-glass] { --header-bg: color-mix(in srgb, var(--surface) var(--tx-over, 100%), transparent); }

  /* top bar */
  html[data-theme][data-pastel="on"][data-glass] { --topbar-bg: color-mix(in srgb, var(--pastel-1) var(--tx-card, 100%), transparent); }
  html[data-theme="dark"][data-pastel="on"][data-glass] { --topbar-bg: color-mix(in srgb, var(--pastel-1-dark) var(--tx-card, 100%), transparent); }
  html[data-theme][data-pastel="off"][data-glass="all"] { --topbar-bg: color-mix(in srgb, var(--primary-hover) var(--tx-strong, 100%), transparent); }

  /* menu bar + mobile drawer (declared on the element so the drawer can use its own --tx-over) */
  html[data-theme][data-pastel="off"]:is([data-glass="nav"], [data-glass="all"]) .primary-navigation { --nav-bg: color-mix(in srgb, var(--primary) var(--tx-strong, 100%), transparent); }
  html[data-theme][data-pastel="on"][data-glass] .primary-navigation {
    --nav-bg: linear-gradient(120deg, color-mix(in srgb, var(--pastel-1) var(--tx-over, 100%), transparent), color-mix(in srgb, var(--pastel-2) var(--tx-over, 100%), transparent) 55%, color-mix(in srgb, var(--pastel-3) var(--tx-over, 100%), transparent));
  }
  html[data-theme="dark"][data-pastel="on"][data-glass] .primary-navigation {
    --nav-bg: linear-gradient(120deg, color-mix(in srgb, var(--pastel-1-dark) var(--tx-over, 100%), transparent), color-mix(in srgb, var(--pastel-2-dark) var(--tx-over, 100%), transparent));
  }

  /* module title bars: derived from the MODULE's own --primary, so .mc-green / .mc-blue... keep their colour in pastel */
  html[data-theme][data-pastel="on"][data-glass] .module-card {
    --title-bg: linear-gradient(120deg, color-mix(in srgb, var(--primary) 18%, #fff), color-mix(in srgb, var(--primary) 26%, #fff1f7));
  }
  html[data-theme="dark"][data-pastel="on"][data-glass] .module-card {
    --title-bg: linear-gradient(120deg, color-mix(in srgb, var(--primary) 30%, #14161d), color-mix(in srgb, var(--primary) 26%, #2a1a28));
  }
  html[data-theme][data-pastel="off"][data-glass="all"] .module-card { --title-bg: color-mix(in srgb, var(--primary) var(--tx-strong, 100%), transparent); }

  /* module variants keep THEIR colours but take part in transparency (and blur). ghost / outline are already transparent. */
  html[data-theme] .module-card.mc-soft { background: color-mix(in srgb, var(--primary-soft) var(--tx-card, 100%), transparent); }
  html[data-theme] .module-card.mc-dark { background: color-mix(in srgb, #1f2230 var(--tx-strong, 100%), transparent); }
  html[data-theme] .module-card.mc-accent > .module-title { background: color-mix(in srgb, var(--primary-soft) var(--tx-card, 100%), transparent); }
}

/* weak phone / data saver (boot.js sets data-lite): no blur layer per card, solid surfaces instead */
html[data-lite] :where(.component-card, .module-card)::before { display: none; }
html[data-lite][data-theme][data-pastel][data-glass] { --card-bg: var(--surface); }
html[data-lite][data-theme] .module-card.mc-soft { background: var(--primary-soft); }
html[data-lite][data-theme] .module-card.mc-dark { background: #1f2230; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .content-layout { gap: 1.25rem; }
  .layout-three-columns, .layout-left, .layout-right { grid-template-columns: minmax(0, 1fr); }
  .component-area { order: 1; }
  .sidebar-left { order: 2; } .sidebar-right { order: 3; }
  .sidebar { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; align-items: start; }
  .sidebar > .module-card { margin-bottom: 0; }
  .blog-items.columns-3, .blog-items.columns-4 { --cols: 2; }
}

@media (max-width: 767px) {
  .site-topbar { font-size: .8rem; text-align: center; }
  .header-inner { min-height: 64px; row-gap: .65rem; flex-wrap: nowrap; padding-block: .4rem; }
  .site-brand { order: 1; min-height: 0; }
  .site-title { font-size: clamp(1.1rem, 4.5vw, 1.45rem); }
  .site-title-image { height: 44px; }
  .header-actions { order: 2; gap: .6rem; }
  .header-modules { order: 3; width: 100%; }
  .header-search { order: 4; width: 100%; max-width: 100%; }
  .menu-toggle { display: inline-flex; }

  .site-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 210; will-change: transform;
    padding-top: env(safe-area-inset-top); background: var(--header-bg);
  }
  .site-header.is-hidden { transform: translateY(-100%); box-shadow: none; }
  body.menu-open .site-header { z-index: 185; } /* under the dimmed overlay while the drawer is open */
  body { padding-top: var(--mobile-header-h, 70px); }

  .site-banner img { max-width: 100%; margin: 0 auto; border-radius: 0; }
  .site-banner .site-container { padding-inline: 0; }

  /* drawer */
  .primary-navigation {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 200; width: min(340px, 88vw); overflow-y: auto; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch; border-radius: 1.5rem 0 0 1.5rem; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    transform: translateX(105%); visibility: hidden; box-shadow: none;
    transition: transform .42s var(--ease-out), visibility 0s linear .42s, box-shadow .3s ease;
  }
  .primary-navigation[data-open="true"] { transform: none; visibility: visible; box-shadow: -14px 0 44px rgb(0 0 0 / .35); transition-delay: 0s; }

  .nav-drawer-head {
    position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: calc(.9rem + env(safe-area-inset-top)) 1rem .9rem 1.4rem; background: var(--primary);
    border-bottom: 1px solid rgb(255 255 255 / .16);
  }
  .nav-drawer-title { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-close { display: inline-grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; color: inherit; background: rgb(255 255 255 / .16); cursor: pointer; transition: transform var(--t) var(--ease-out), background-color var(--t-fast) ease; }
  .nav-close:hover { background: rgb(255 255 255 / .3); transform: rotate(90deg); }

  .primary-navigation .site-container { padding: .6rem .7rem 0; }
  .primary-navigation .site-container > ul, .primary-navigation .site-container > div > ul { display: block; padding: 0; }
  .primary-navigation li { display: flex; flex-wrap: wrap; align-items: center; width: 100%; margin-bottom: .2rem; }
  .primary-navigation a, .primary-navigation .nav-header, .primary-navigation .separator, .primary-navigation .mod-menu__heading {
    display: flex; flex: 1 1 0; align-items: center; min-width: 0; min-height: 48px; padding: .75rem 1rem; font-size: 1rem; border-radius: .85rem;
  }
  .primary-navigation li:is(.active, .current) > a { background: rgb(255 255 255 / .2); font-weight: 600; }
  .primary-navigation a:active { background: rgb(255 255 255 / .22); }
  .primary-navigation li.parent > a::after, .primary-navigation li.deeper > a::after,
  .primary-navigation li.parent > .nav-header::after, .primary-navigation li.deeper > .nav-header::after,
  .primary-navigation li.parent > .separator::after, .primary-navigation li.parent > .mod-menu__heading::after { display: none; }

  /* expand arrow: a small round button, clearly secondary to the link */
  .primary-navigation .tree-toggle {
    display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center; margin-left: .3rem; padding: 0;
    border: 0; border-radius: 50%; color: inherit; background: rgb(255 255 255 / .12); cursor: pointer;
    transition: background-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
  }
  .primary-navigation .tree-toggle:active { transform: scale(.9); }
  .tree-toggle-icon { display: block; width: 8px; height: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-2px, -2px); transition: transform var(--t) var(--ease-out); }
  .tree-toggle[aria-expanded="true"] .tree-toggle-icon { transform: rotate(-135deg) translate(-2px, -2px); }
  .tree-toggle[aria-expanded="true"] { background: rgb(255 255 255 / .26); }

  .primary-navigation li > ul {
    flex: 0 0 auto; width: calc(100% - .9rem); max-height: 0; overflow: hidden; margin: 0 0 0 .9rem; padding: 0 0 0 .9rem;
    transition: max-height .34s var(--ease-io);
  }
  .primary-navigation li.sub-open > ul { padding-block: .25rem; }
  .primary-navigation li li a, .primary-navigation li li .nav-header { min-height: 44px; padding: .6rem .9rem; font-size: .94rem; }
  .primary-navigation li li .tree-toggle { flex-basis: 36px; width: 36px; height: 36px; }

  html[data-anim="on"] .primary-navigation[data-open="true"] .site-container > ul > li,
  html[data-anim="on"] .primary-navigation[data-open="true"] .site-container > div > ul > li {
    animation: nav-item-in .5s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 38ms + 120ms);
  }
  @keyframes nav-item-in { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }

  html[data-pastel="on"] .nav-drawer-head { background: var(--pastel-1); border-bottom-color: var(--border); }
  html[data-pastel="on"][data-theme="dark"] .nav-drawer-head { background: var(--pastel-1-dark); }
  html[data-pastel="on"] .nav-close { background: rgb(255 255 255 / .7); }
  html[data-pastel="on"] .tree-toggle { background: rgb(255 255 255 / .55); }
  html[data-pastel="on"] .primary-navigation li:is(.active, .current) > a { background: rgb(255 255 255 / .8); }
  html[data-pastel="on"] .primary-navigation a:active { background: rgb(var(--primary-rgb) / .14); }
  /* dark: the light-mode white highlight made the selected item (and its submenu items) unreadable */
  html[data-pastel="on"][data-theme="dark"] .primary-navigation li:is(.active, .current) > a { color: #fff; background: rgb(255 255 255 / .14); }
  html[data-pastel="on"][data-theme="dark"] .primary-navigation li li:is(.active, .current) > a { background: rgb(255 255 255 / .1); }
  html[data-pastel="on"][data-theme="dark"] .primary-navigation a:active { background: rgb(255 255 255 / .2); }
  html[data-pastel="on"][data-theme="dark"] :is(.nav-close, .tree-toggle) { background: rgb(255 255 255 / .1); }

  /* The drawer sits on top of page content, so it keeps at least ~85 % opacity (see 14b) but follows the
     transparency setting above that, with blur behind it when blur is on */
  .primary-navigation { --tx-over: var(--glass-op-nav, 100%); }
  html:is([data-glass="nav"], [data-glass="all"]) .nav-drawer-head { background: transparent; }

  /* drawer bottom: preferences link, right-aligned and always reachable */
  .primary-navigation { display: flex; flex-direction: column; padding-bottom: 0; }
  .primary-navigation > .site-container { flex: 1 0 auto; }
  .nav-drawer-foot {
    position: sticky; bottom: 0; z-index: 2; display: flex; flex: 0 0 auto; justify-content: flex-end; margin-top: 1rem;
    padding: .5rem 1rem calc(.5rem + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--drawer-foot-bg, var(--primary-hover)) 72%, transparent);
  }

  .site-main { padding: 1.25rem 0; }
  .content-layout { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .sidebar { display: block; }
  .sidebar > .module-card { margin-bottom: 1.25rem; }
  .component-card { padding: var(--component-pad-m, 1.1rem); border-radius: .85rem; }
  .module-card { margin-bottom: 1.25rem; border-radius: .85rem; }
  .blog-items[class*="columns-"] { --cols: 1 !important; }

  .pull-left, .pull-right, .float-start, .float-end, .item-image.pull-left, .item-image.pull-right { float: none !important; display: block; width: 100% !important; margin: 0 0 1rem !important; }
  :is(.pull-left, .pull-right, .item-image) img { width: 100% !important; height: auto; }
  :is(.item-page, .category-list) table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .back-to-top { width: 46px; height: 46px; }
}

@media (max-width: 400px) {
  .menu-toggle { width: 44px; padding: 0; justify-content: center; }
  .menu-toggle-label { display: none; }
}
@media (min-width: 768px) { .menu-toggle-label { display: none; } }

@media (max-width: 480px) {
  .module-card > .module-title { padding: .75rem .9rem .75rem 1.4rem; font-size: .975rem; }
  .module-card > .module-content { padding: var(--module-pad-m, .9rem); }
  .breadcrumb { font-size: .8rem; }
  .footer-columns { flex-direction: column; align-items: center; text-align: center; gap: .5rem; }
  .footer-col-left, .footer-col-right { text-align: center; }
}

/* ---------- 15. Preferences panel (visitor settings) ---------- */
.prefs-toggle {
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 2.25rem; height: 2.25rem; padding: 0;
  border: 1px solid var(--border); border-radius: 50%; color: var(--text-muted); background: var(--surface-alt); cursor: pointer;
  transition: background-color var(--t) ease, border-color var(--t) ease, color var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
}
.prefs-toggle:hover { border-color: var(--primary); color: var(--link); }
.prefs-toggle:active { transform: scale(.92); }
.prefs-toggle[aria-expanded="true"] { border-color: var(--primary); color: #fff; background: var(--primary); }
/* with a menu module the button lives at the bottom of the mobile drawer instead */
@media (max-width: 767px) { body.has-menu .prefs-toggle--header { display: none; } }
@media (min-width: 768px) { .nav-drawer-foot { display: none; } }

.prefs-link {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 36px; padding: .25rem .8rem; border: 0; border-radius: 999px;
  color: var(--nav-ink, #fff); background: rgb(255 255 255 / .18); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: background-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
}
.prefs-link:active { transform: scale(.96); }
html[data-pastel="on"] .prefs-link { background: rgb(255 255 255 / .75); }
html[data-pastel="on"][data-theme="dark"] .prefs-link { background: rgb(255 255 255 / .12); }

.prefs-overlay { position: fixed; inset: 0; z-index: 300; background: transparent; visibility: hidden; pointer-events: none; }
.prefs-overlay.is-active { visibility: visible; pointer-events: auto; }

.prefs-panel {
  position: fixed; z-index: 310; top: var(--prefs-top, 4.5rem); right: max(1rem, env(safe-area-inset-right));
  display: flex; flex-direction: column; width: min(390px, calc(100vw - 2rem)); max-height: calc(100vh - var(--prefs-top, 4.5rem) - 1rem); max-height: calc(100dvh - var(--prefs-top, 4.5rem) - 1rem);
  color: var(--text); background: var(--panel-bg, var(--surface)); border: 1px solid var(--border); border-radius: 1.1rem; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.98); transform-origin: top right;
  transition: opacity var(--t) var(--ease-out), transform var(--t) var(--ease-out), visibility 0s linear var(--t);
}
.prefs-panel.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.prefs-panel:focus { outline: none; }

.prefs-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem .85rem 1.25rem; border-bottom: 1px solid var(--border); }
.prefs-title { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.prefs-close {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  color: var(--text-muted); background: var(--surface-alt); cursor: pointer; transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.prefs-close:hover { color: var(--link); background: var(--primary-soft); }

.prefs-body { flex: 1 1 auto; min-height: 0; padding: .5rem 1.25rem 1rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.prefs-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.prefs-group + .prefs-group { margin-top: 1.1rem; }
.prefs-group > legend, .prefs-label { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; width: 100%; margin: .6rem 0 .45rem; padding: 0; font-size: .85rem; font-weight: 600; color: var(--text); }
.prefs-label output { color: var(--text-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.prefs-note { margin: .4rem 0 0; color: var(--text-muted); font-size: .78rem; line-height: 1.5; }

.prefs-seg { display: flex; gap: .2rem; padding: .2rem; border: 1px solid var(--border); border-radius: .85rem; background: var(--surface-alt); }
.prefs-seg label { position: relative; display: flex; flex: 1 1 0; min-width: 0; }
.prefs-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.prefs-seg span {
  display: grid; place-items: center; flex: 1; min-height: 40px; padding: .3rem .35rem; border-radius: .65rem; color: var(--text-muted);
  font-size: .85rem; line-height: 1.25; text-align: center; transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.prefs-seg label:hover span { color: var(--link); }
.prefs-seg input:checked + span { color: #fff; background: var(--primary); font-weight: 600; box-shadow: 0 2px 8px rgb(var(--primary-rgb) / .35); }
.prefs-seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.prefs-seg--4 span { font-size: .78rem; }

.prefs-select {
  width: 100%; min-height: 44px; padding: .5rem .8rem; border: 1px solid var(--border); border-radius: .7rem; color: var(--text); background: var(--surface-alt); font: inherit;
}
.prefs-select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.prefs-size { display: flex; align-items: center; gap: .6rem; }
.prefs-step {
  display: inline-grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; padding: 0; border: 1px solid var(--border); border-radius: 50%;
  color: var(--text); background: var(--surface-alt); font: inherit; font-weight: 700; cursor: pointer;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
}
.prefs-step:hover { border-color: var(--primary); color: var(--link); }
.prefs-step:active { transform: scale(.9); }
.prefs-range { width: 100%; height: 44px; margin: 0; accent-color: var(--primary); cursor: pointer; }
@media (hover: none) { .prefs-cursor { display: none; } }
.prefs-size input[type="range"] { flex: 1 1 auto; min-width: 0; height: 44px; margin: 0; accent-color: var(--primary); cursor: pointer; }

.prefs-swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.prefs-swatch {
  position: relative; width: 36px; height: 36px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: var(--sw); cursor: pointer;
  box-shadow: inset 0 0 0 2px var(--surface); transition: transform var(--t-fast) var(--ease-out), border-color var(--t-fast) ease;
}
.prefs-swatch:hover { transform: scale(1.12); }
.prefs-swatch[aria-pressed="true"] { border-color: var(--text); }
.prefs-swatch[aria-pressed="true"]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); }
.prefs-custom-color { display: inline-flex; align-items: center; gap: .6rem; margin-top: .65rem; font-size: .85rem; color: var(--text-muted); cursor: pointer; }
.prefs-custom-color input { width: 40px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: .5rem; background: none; cursor: pointer; }

.prefs-foot { flex: 0 0 auto; display: flex; justify-content: flex-end; padding: .75rem 1.25rem calc(.75rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.prefs-reset {
  min-height: 42px; padding: .4rem 1rem; border: 1px solid var(--border); border-radius: .7rem; color: var(--text); background: var(--surface); font: inherit; font-size: .9rem; cursor: pointer;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease;
}
.prefs-reset:hover { border-color: #dc2626; color: #dc2626; }

/* phone: bottom sheet */
@media (max-width: 767px) {
  .prefs-overlay.is-active { background: rgb(8 10 20 / .5); }
  .prefs-panel {
    top: auto; right: 0; bottom: 0; left: 0; width: auto; max-height: 88vh; max-height: 88dvh; border-width: 1px 0 0; border-radius: 1.4rem 1.4rem 0 0;
    transform: translateY(100%); transform-origin: bottom center; transition: transform .42s var(--ease-out), opacity var(--t) ease, visibility 0s linear .42s;
  }
  .prefs-panel.is-open { transform: none; }
  body.prefs-open { overflow: hidden; }
}

/* Google Translate (loaded only after the visitor picks another language): hide its toolbar and stop it
   pushing the page down, which would break the fixed mobile header */
.gt-container { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body { top: 0 !important; }
.skiptranslate > iframe, .goog-te-banner-frame, #goog-gt-tt, .goog-te-balloon-frame, .goog-tooltip, .VIpgJd-ZVi9od-ORHb-OEVmcd, .VIpgJd-ZVi9od-aZ2wEe-wOHMyf { display: none !important; visibility: hidden !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }

/* ---------- 15b. Custom mouse cursors ----------
   Files live in /cursor (see cursor/README.txt); index.php turns them into --cur-* variables.
   Active only when <html data-cursor="custom"> (admin default, visitor can switch) and only for
   real mice: touch screens have no pointer to restyle. Every var() has the system cursor as fallback. */
@media (hover: hover) and (pointer: fine) {
  html[data-cursor="custom"], html[data-cursor="custom"] body { cursor: var(--cur-normal, auto); }

  html[data-cursor="custom"] :is(.component-card, .module-content, .footer-module-content) :is(p, h1, h2, h3, h4, h5, h6, blockquote, pre, code, figcaption, dd, dt, td, th),
  html[data-cursor="custom"] :is(input:not([type="button"], [type="submit"], [type="reset"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="image"]), textarea, [contenteditable=""], [contenteditable="true"]) {
    cursor: var(--cur-handwriting, var(--cur-text, text)); /* fields you type in */
  }

  html[data-cursor="custom"] :is(a[href], button:not(:disabled), summary, select, label[for], [role="button"], [role="tab"], [role="switch"], [role="menuitem"],
    input[type="submit"], input[type="button"], input[type="reset"], input[type="checkbox"], input[type="radio"], input[type="range"], input[type="image"], input[type="file"], input[type="color"],
    .btn, .tree-toggle, .prefs-seg label, .prefs-swatch, [onclick]) { cursor: var(--cur-pointer, pointer); }

  html[data-cursor="custom"] :is(button, input, select, textarea, a, .btn):is(:disabled, [aria-disabled="true"], .disabled),
  html[data-cursor="custom"] .cur-not-allowed { cursor: var(--cur-not-allowed, not-allowed); }

  html[data-cursor="custom"] [aria-busy="true"] { cursor: var(--cur-progress, var(--cur-loading, progress)); }
  html[data-cursor="custom"] :is(abbr[title], .cur-help) { cursor: var(--cur-help, help); }
  html[data-cursor="custom"] .cur-move { cursor: var(--cur-move, move); }
  html[data-cursor="custom"] .cur-crosshair { cursor: var(--cur-crosshair, crosshair); }
  html[data-cursor="custom"] .cur-zoom-in { cursor: var(--cur-zoom-in, zoom-in); }
  html[data-cursor="custom"] .cur-zoom-out { cursor: var(--cur-zoom-out, zoom-out); }
  html[data-cursor="custom"] .cur-resize-h { cursor: var(--cur-resize-h, ew-resize); }
  html[data-cursor="custom"] .cur-resize-v { cursor: var(--cur-resize-v, ns-resize); }
  html[data-cursor="custom"] :is([draggable="true"], .cur-grab) { cursor: var(--cur-grab, grab); }
  html[data-cursor="custom"] :is([draggable="true"], .cur-grab):active { cursor: var(--cur-grabbing, grabbing); }
  html[data-cursor="custom"] .cur-wait { cursor: var(--cur-loading, var(--cur-progress, wait)); }

  /* while a link / form is being followed (template.js adds .is-busy) */
  html[data-cursor="custom"] body.is-busy, html[data-cursor="custom"] body.is-busy * { cursor: var(--cur-loading, var(--cur-progress, wait)) !important; }
}

/* ---------- 15c. Sideways-scrollable content (tables, code) ----------
   template.js wraps each one in .scroll-x and keeps .is-scrollable / .can-left / .can-right current.
   Three cues, because no single one works everywhere: faded edge, arrow badge (nudges until the visitor
   scrolls), and a visible thin scrollbar for mouse users. */
.scroll-x { position: relative; max-width: 100%; }
.scroll-x-body { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: rgb(var(--primary-rgb) / .55) transparent; }
.scroll-x-body::-webkit-scrollbar { height: 8px; }
.scroll-x-body::-webkit-scrollbar-thumb { border-radius: 8px; background: rgb(var(--primary-rgb) / .5); }
.scroll-x-body:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.scroll-x .ui-table-wrap > table { display: table; overflow: visible; width: 100%; }

.scroll-x.is-scrollable > .scroll-x-body {
  --fl: 0px; --fr: 0px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
}
.scroll-x.can-left > .scroll-x-body { --fl: 44px; }
.scroll-x.can-right > .scroll-x-body { --fr: 44px; }

.scroll-x::before, .scroll-x::after {
  content: ""; position: absolute; z-index: 2; top: clamp(26px, 50%, 170px); width: 30px; height: 30px; margin-top: -15px; border-radius: 50%;
  pointer-events: none; opacity: 0; transition: opacity .25s ease;
  background: var(--primary) center / 16px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E");
  box-shadow: 0 2px 10px rgb(0 0 0 / .28);
}
.scroll-x::before { left: 6px; transform: scaleX(-1); }
.scroll-x::after { right: 6px; }
.scroll-x.can-left::before, .scroll-x.can-right::after { opacity: .92; }
.scroll-x:not(.has-scrolled).can-right::after { animation: sx-nudge 1.3s ease-in-out 3; }
@keyframes sx-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .scroll-x:not(.has-scrolled).can-right::after { animation: none; } }

/* off-screen ticker does not animate */
.ui-ticker.is-offscreen .ui-ticker-inner { animation-play-state: paused; }

/* ---------- 16. Admin overrides: component & module surfaces ----------
   Written by index.php into <html data-comp-* data-mod-*>. "!important" is deliberate: when the admin
   switches a part OFF it must win over pastel, blur and module variants alike. */
html[data-comp-bg="off"] .component-card { background: transparent !important; }
html[data-comp-bg="off"] .component-card::before { display: none !important; }
html[data-comp-border="off"] .component-card { border-color: transparent !important; }
html[data-comp-shadow="off"] .component-card { box-shadow: none !important; }

html[data-mod-bg="off"] :is(.module-card, .footer-module) { background: transparent !important; }
html[data-mod-bg="off"] .module-card::before { display: none !important; }
html[data-mod-border="off"] .module-card { border-color: transparent !important; }
html[data-mod-shadow="off"] .module-card { box-shadow: none !important; }
html[data-mod-title="plain"] .module-card > .module-title {
  color: var(--text) !important; background: none !important; border-bottom: 1px solid var(--border) !important;
}
html[data-mod-title="plain"] .module-card > .module-title::before { background: var(--primary) !important; opacity: 1 !important; }

/* ---------- 17. Print / accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-delay: 0s !important; }
  .will-reveal { opacity: 1 !important; transform: none !important; }
}

@media print {
  .scroll-x::before, .scroll-x::after { display: none !important; }
  .scroll-x-body { overflow: visible !important; -webkit-mask-image: none !important; mask-image: none !important; }
  .site-topbar, .header-actions, .prefs-panel, .prefs-overlay, .gt-container, .primary-navigation, .site-banner, .breadcrumbs-wrapper, .sidebar, .content-top, .content-bottom, .site-footer, .back-to-top, .skip-link, .menu-overlay { display: none !important; }
  body { padding: 0 !important; color: #000 !important; background: #fff !important; }
  body::before { display: none !important; }
  .site-header { position: static !important; border: 0; }
  .site-container, .content-layout, .component-area, .component-card { width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: transparent !important; animation: none !important; }
  a { color: #000 !important; text-decoration: underline !important; }
  .will-reveal { opacity: 1 !important; transform: none !important; }
}
