/**
 * Forma template — base styles.
 *
 * Layered so that the generated per-element CSS (printed in <head> after this file)
 * always wins over these defaults without needing !important.
 */

/* ---------------------------------------------------------------- tokens -- */
:root {
  --forma-font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --forma-font-headings: var(--forma-font-body);
  --forma-font-size-base: 1rem;
  --forma-line-height: 1.65;

  --forma-color-text: #1f2937;
  --forma-color-heading: #111827;
  --forma-color-muted: #6b7280;
  --forma-color-link: #1d4ed8;
  --forma-color-surface: #ffffff;
  --forma-color-surface-alt: #f8fafc;
  --forma-color-surface-dark: #111827;
  --forma-color-text-on-dark: #ffffff;
  --forma-color-border: #e5e7eb;

  --forma-radius: .5rem;
  --forma-radius-lg: 1rem;
  --forma-shadow: 0 1px 2px rgba(0, 0, 0, .05);

  --forma-container: 1320px;
  --forma-gap: 1.5rem;
  --forma-header-offset: 0px;
}

/*
 * Dark surface, light text — opt in with the "forma-invert" class on any element.
 *
 * The default design is light: --forma-color-surface is white, so text must be dark
 * unless the author paints a dark background on the same element. This helper is the
 * supported way to do that without bypassing the tokens, and it supplies the pairing
 * of light text with a dark background that a bare background-color override lacks.
 */
.forma-invert {
  background-color: var(--forma-color-surface-dark);
  color: var(--forma-color-text-on-dark);
}

.forma-invert :where(h1, h2, h3, h4, h5, h6, .forma-heading) {
  color: inherit;
}

.forma-invert a:not(.btn) {
  color: inherit;
}

.forma-invert :where(.forma-site-description, .forma-info, .forma-tag, .forma-breadcrumbs ol, .forma-breadcrumbs ul, .forma-error__code) {
  color: inherit;
  opacity: .85;
}

/* ------------------------------------------------------------ structure -- */
html {
  scroll-behavior: smooth;
}

body.forma {
  margin: 0;
  font-family: var(--forma-font-body);
  font-size: var(--forma-font-size-base);
  line-height: var(--forma-line-height);
  color: var(--forma-color-text);
  background-color: var(--forma-color-surface);
  -webkit-text-size-adjust: 100%;
}

body.forma h1,
body.forma h2,
body.forma h3,
body.forma h4,
body.forma h5,
body.forma h6,
body.forma .forma-heading {
  font-family: var(--forma-font-headings);
  color: var(--forma-color-heading);
  line-height: 1.25;
  margin-block: 0 .6em;
}

body.forma a {
  color: var(--forma-color-link);
}

body.forma img {
  max-width: 100%;
  height: auto;
}

/* Containers ------------------------------------------------------------- */
.forma-section > .container,
.forma-section > .container-fluid {
  width: 100%;
  margin-inline: auto;
  padding-inline: 1rem;
}

.forma-section > .container {
  max-width: var(--forma-container);
}

.forma-full .forma-section > .container {
  max-width: none;
}

/* Skip link -------------------------------------------------------------- */
.forma-skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2000;
  padding: .75rem 1.25rem;
  background: #fff;
  color: #111;
  border: 2px solid currentColor;
  border-radius: 0 0 var(--forma-radius) 0;
  transform: translateY(-110%);
  transition: transform .15s ease-in-out;
}

.forma-skip-link:focus {
  transform: translateY(0);
}

/* ------------------------------------------------------------- elements -- */

/*
 * Static fallback for a row. The renderer emits a per-element 12-track override
 * (`#id { ... }`) whenever a row is rendered, and an id beats these class rules, so
 * this block only matters if a row's HTML ever appears without its generated style.
 *
 * It uses the same 12-track model as the renderer: a column's `span` is a share of 12,
 * and `span 6` is the default two-per-line split. Mixing a `repeat(2)` track list with
 * `span N` was the bug that made the header stack logo above menu.
 */
.forma-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  /* A 12-track grid holds 11 gaps, so a wide gutter is counted 11 times. */
  column-gap: min(var(--forma-gap), 8%);
  row-gap: var(--forma-gap);
}

.forma-column {
  grid-column: span 6;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.forma-text > :last-child,
.forma-html > :last-child {
  margin-bottom: 0;
}

.forma-image {
  margin: 0;
}

.forma-image img {
  display: block;
}

.forma-divider {
  width: 100%;
}

.forma-divider hr {
  border: 0;
  border-top: 1px solid currentColor;
}

.forma-button {
  display: inline-block;
  text-decoration: none;
}

.forma-button.btn-link {
  padding-inline: 0;
}

/* Module positions ------------------------------------------------------- */
.forma-position {
  min-width: 0;
}

.forma-position .moduletable:last-child > :last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------- header -- */
.forma-logo .forma-brand {
  display: inline-flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.forma-site-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
}

.forma-site-description {
  font-size: .875rem;
  color: var(--forma-color-muted);
}

.forma-logo img {
  display: block;
}

.forma-sticky-header .forma-section:first-child {
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* ------------------------------------------------------- menu behaviour -- */
/*
 * Joomla 6 mod_menu (_default.php layout) emits exactly this, wrapped in <nav> by
 * nothing — the module is not a <nav> element and carries no .navbar/.nav-link:
 *
 *   <ul id="mod-menuNNN" class="mod-menu mod-list nav [class_sfx]">
 *     <li class="nav-item item-NN [default|current|active|deeper|parent|divider]">
 *       <a href="...">Label</a>               (default_url.php, via HTMLHelper::_('link'))
 *       <button class="mod-menu__toggle-sub" aria-expanded="false">…</button>
 *       <ul class="mod-menu__sub list-unstyled small">…</ul>
 *     </li>
 *   </ul>
 *
 * Nothing in the template styled those classes, so the browser default (a vertical,
 * bulleted block <ul>) applied. The rules below are scoped to .mod-menu itself, so a
 * menu renders horizontally in the "menu" position whether or not a Forma element
 * wrapper (.forma-menu / .forma-position) is present.
 */
.forma-menu,
.forma-position--menu,
.forma-search {
  min-width: 0;
}

.forma-menu .mod-menu,
.mod-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mod-menu > li {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Anchors, headings and separators share one hit area. Deliberately not "span":
   the submenu toggle's chevron is a <span> and must not get the padding.
   The child combinator on the top level keeps the specificity above the base
   "body.forma a" link colour rule without needing !important. */
.mod-menu > li > a,
.mod-menu > li > .mod-menu__heading,
.mod-menu > li > .mod-menu__separator,
.mod-menu .mod-menu__sub li > a,
.mod-menu .mod-menu__sub li > .mod-menu__heading,
.mod-menu .mod-menu__sub li > .mod-menu__separator {
  display: block;
  padding: .5rem .75rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--forma-radius);
}

.mod-menu > li > a:hover,
.mod-menu > li > a:focus-visible,
.mod-menu .mod-menu__sub li > a:hover,
.mod-menu .mod-menu__sub li > a:focus-visible {
  background: var(--forma-color-surface-alt);
}

.mod-menu > li.current > a,
.mod-menu > li.active > a,
.mod-menu > li.default > a,
.mod-menu .mod-menu__sub li.current > a,
.mod-menu .mod-menu__sub li.active > a {
  font-weight: 600;
}

/* The submenu toggle Joomla prints for items that have children. Its icon is a
   <span class="icon-chevron-down">, which the rules above intentionally skip. */
.mod-menu__toggle-sub {
  display: inline-flex;
  align-items: center;
  padding: 0 .25rem;
  color: currentColor;
  background: none;
  border: 0;
  cursor: pointer;
}

.mod-menu__toggle-sub[aria-expanded="true"] .icon-chevron-down {
  transform: rotate(180deg);
}

/*
 * Nested entries: submenus are dropdowns, revealed on hover / keyboard focus
 * (CSS only, works with JS disabled) or when Joomla's own mod_menu script has
 * opened them (aria-hidden="false").
 *
 * The explicit display:block is required: Joomla ships
 *   :where(.mod-menu__sub[aria-hidden="true"]) { display: none }
 * in media/mod_menu/css/mod-menu.css, which would otherwise hide every submenu.
 */
.mod-menu .mod-menu__sub {
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  z-index: 1040;
  display: block;
  min-width: 12rem;
  margin: 0;
  padding: .35rem;
  list-style: none;
  background: var(--forma-color-surface);
  border: 1px solid var(--forma-color-border);
  border-radius: var(--forma-radius);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .15s ease-in-out;
}

/* Third level and deeper open beside their parent. */
.mod-menu .mod-menu__sub .mod-menu__sub {
  top: -.35rem;
  inset-inline-start: 100%;
}

.mod-menu li:hover > .mod-menu__sub,
.mod-menu li:focus-within > .mod-menu__sub,
.mod-menu .mod-menu__sub[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mod-menu .mod-menu__sub li {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
  position: relative;
}

/* Bootstrap .nav semantics, in case a child template or an extension adds it. */
.forma-menu .navbar-nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

/*
 * Fallback for hand-written or third-party menu markup inside .forma-menu that is not
 * mod_menu. forma.js adds .dropdown-menu + [hidden] to those lists; these rules keep
 * the same dropdown look and also open them on hover, so the menu is usable with JS
 * disabled.
 */
.forma-menu ul:not(.mod-menu):not(.mod-menu__sub):not(.dropdown-menu) {
  list-style: none;
  margin: 0;
  padding: 0;
}

.forma-menu .dropdown-menu {
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  z-index: 1040;
  display: block;
  min-width: 12rem;
  padding: .35rem;
  margin-top: .25rem;
  background: var(--forma-color-surface);
  border: 1px solid var(--forma-color-border);
  border-radius: var(--forma-radius);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1);
  list-style: none;
  opacity: 0;
  visibility: hidden;
}

.forma-menu .dropdown-menu[hidden] {
  display: none;
}

.forma-menu li:hover > .dropdown-menu:not([hidden]),
.forma-menu li:focus-within > .dropdown-menu:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.forma-menu li {
  position: relative;
}

@media (max-width: 767.98px) {
  .mod-menu {
    flex-direction: column;
    align-items: stretch;
  }

  /* Submenus stack under their parent instead of floating, so a touch user never
     has to hover to reach them. The width overrides are needed because the floating
     rules carry the same specificity but come earlier in the file. */
  .mod-menu .mod-menu__sub,
  .mod-menu .mod-menu__sub .mod-menu__sub,
  .forma-menu .dropdown-menu {
    position: static;
    inset-inline-start: auto;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    width: 100%;
    min-width: 0;
    margin-top: .25rem;
    box-shadow: none;
  }
}

/* --------------------------------------------------------- breadcrumbs --- */
.forma-breadcrumbs nav,
.forma-breadcrumbs .mod-breadcrumbs {
  width: 100%;
}

.forma-breadcrumbs ol,
.forma-breadcrumbs ul {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  font-size: .875rem;
  color: var(--forma-color-muted);
}

.forma-breadcrumbs li + li::before {
  content: "/";
  margin-right: .35rem;
  opacity: .5;
}

/* ------------------------------------------------------ component output - */
.forma-component {
  min-width: 0;
}

/* --------------------------------------------------------- blog cards ---- */
.forma-blog {
  --forma-card-gap: 1.5rem;
}

.forma-blog-items {
  display: grid;
  grid-template-columns: repeat(var(--forma-blog-columns, 2), minmax(0, 1fr));
  gap: var(--forma-card-gap);
}

.forma-blog-items--1 { --forma-blog-columns: 1; }
.forma-blog-items--2 { --forma-blog-columns: 2; }
.forma-blog-items--3 { --forma-blog-columns: 3; }
.forma-blog-items--4 { --forma-blog-columns: 4; }

.forma-blog-lead {
  display: grid;
  grid-template-columns: repeat(var(--forma-blog-lead-columns, 1), minmax(0, 1fr));
  gap: var(--forma-card-gap);
  margin-bottom: var(--forma-card-gap);
}

.forma-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--forma-color-surface);
  border: 1px solid var(--forma-color-border);
  border-radius: var(--forma-radius-lg);
  overflow: hidden;
}

.forma-card__body {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.25rem;
}

.forma-card__image {
  margin: 0;
  overflow: hidden;
}

.forma-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}

.forma-card__title {
  margin: 0;
  font-size: 1.2rem;
}

.forma-card__title a {
  text-decoration: none;
  color: inherit;
}

.forma-card__title a:hover {
  color: var(--forma-color-link);
}

.forma-card__intro > :last-child {
  margin-bottom: 0;
}

/* Info block shared by cards, featured and single article. */
.forma-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  font-size: .8125rem;
  color: var(--forma-color-muted);
}

.forma-info__item + .forma-info__item::before {
  content: "·";
  margin-right: .35rem;
  opacity: .6;
}

.forma-info a {
  color: inherit;
}

.forma-info__icon {
  margin-right: .25rem;
  opacity: .8;
}

.forma-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.forma-tag {
  display: inline-block;
  padding: .15rem .5rem;
  font-size: .75rem;
  color: var(--forma-color-muted);
  background: var(--forma-color-surface-alt);
  border: 1px solid var(--forma-color-border);
  border-radius: 999px;
  text-decoration: none;
}

/* Card variants ---------------------------------------------------------- */
.forma-card--flat {
  background: transparent;
  border-color: transparent;
  border-radius: 0;
}

.forma-card--flat .forma-card__body {
  padding-inline: 0;
}

/*
 * The card paints the dark backdrop itself rather than relying on the image: the image
 * is absolutely positioned over it, so it is invisible whenever an intro image exists,
 * but a card with the image slot disabled would otherwise be white text on the white
 * page background.
 */
.forma-card--overlay {
  position: relative;
  border: 0;
  background: var(--forma-color-surface-dark);
  color: var(--forma-color-text-on-dark);
}

.forma-card--overlay .forma-card__image {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.forma-card--overlay .forma-card__image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, .75), rgba(0, 0, 0, .15));
}

.forma-card--overlay .forma-card__body {
  position: relative;
  z-index: 1;
  margin-top: auto;
  min-height: 18rem;
  justify-content: flex-end;
  color: var(--forma-color-text-on-dark);
}

.forma-card--overlay .forma-card__title,
.forma-card--overlay .forma-card__title a,
.forma-card--overlay .forma-info {
  color: var(--forma-color-text-on-dark);
}

@media (hover: hover) {
  .forma-card:hover .forma-card__image img {
    transform: scale(1.03);
  }
}

.forma-card--horizontal {
  flex-direction: row;
}

.forma-card--horizontal .forma-card__image {
  flex: 0 0 40%;
}

@media (max-width: 767.98px) {
  .forma-card--horizontal {
    flex-direction: column;
  }

  .forma-card--horizontal .forma-card__image {
    flex-basis: auto;
  }
}

/* -------------------------------------------------------- single article - */
.forma-article__header {
  margin-bottom: 1.5rem;
}

.forma-article__title {
  margin-bottom: .5rem;
}

.forma-article__image {
  margin: 0 0 1.5rem;
}

.forma-article__image img {
  display: block;
  width: 100%;
  border-radius: var(--forma-radius-lg);
}

.forma-article__body > :last-child {
  margin-bottom: 0;
}

.forma-article__footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--forma-color-border);
}

.forma-pagination {
  margin-top: 2rem;
}

.forma-pagination .pagination {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.forma-pagination .page-link {
  display: block;
  padding: .45rem .75rem;
  border: 1px solid var(--forma-color-border);
  border-radius: var(--forma-radius);
  text-decoration: none;
}

.forma-pagination .active .page-link {
  background: var(--forma-color-link);
  border-color: var(--forma-color-link);
  color: var(--forma-color-text-on-dark);
}

/* ------------------------------------------------------------------ misc - */
.forma-back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1020;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  background: var(--forma-color-surface);
  color: var(--forma-color-text);
  border: 1px solid var(--forma-color-border);
  border-radius: 999px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1);
  text-decoration: none;
}

.forma-back-to-top.is-visible {
  display: flex;
}

.forma-error__inner,
.forma-offline__inner {
  max-width: 40rem;
  margin: 4rem auto;
  padding: 2rem;
  text-align: center;
}

.forma-error__code {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  margin: 0;
  color: var(--forma-color-muted);
}

.forma-error__debug {
  margin-top: 2rem;
  padding: 1rem;
  overflow: auto;
  text-align: left;
  background: var(--forma-color-surface-alt);
  border-radius: var(--forma-radius);
  font-size: .8125rem;
}

.forma-offline__login {
  max-width: 22rem;
  margin: 2rem auto 0;
  text-align: left;
}

.forma-messages {
  margin-bottom: 1.5rem;
}

/* ------------------------------------------------------- accessibility -- */
.forma :focus-visible {
  outline: 2px solid var(--forma-color-link);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Print ------------------------------------------------------------------ */
@media print {
  .forma-back-to-top,
  .forma-skip-link,
  .forma-menu {
    display: none !important;
  }

  body.forma {
    background: #fff;
    color: #000;
  }
}
