/**
 * Rhyddid Joomla core frontend presentation layer.
 * Release 0.13.0.
 *
 * This file provides deliberate presentation for Joomla core components and
 * modules without changing their data, permissions, routing, or behavior.
 */

/* --------------------------------------------------------------------------
   Shared Joomla component structure
   -------------------------------------------------------------------------- */

:where(
  .com-content-archive,
  .com-content-category,
  .com-content-category-blog,
  .com-content-featured,
  .com-contact,
  .com-contact-category,
  .com-finder,
  .com-search,
  .com-tags-tag,
  .com-tags-tags,
  .com-newsfeeds-category,
  .com-newsfeeds-newsfeed,
  .com-users-login,
  .com-users-registration,
  .com-users-profile,
  .com-users-profile-edit,
  .com-users-remind,
  .com-users-reset,
  .com-users-methods-list,
  .com-users-method-edit,
  .com-users-captive,
  .com-privacy-request,
  .com-privacy-confirm,
  .com-privacy-remind,
  .com-wrapper
) {
  min-width: 0;
}

:where(
  .com-content-archive__title,
  .com-content-category__title,
  .com-content-category-blog__title,
  .com-content-featured__title,
  .com-contact__title,
  .com-contact-category__title,
  .com-finder__title,
  .com-search__title,
  .com-tags-tag__title,
  .com-tags-tags__title,
  .com-newsfeeds-category__title,
  .com-newsfeeds-newsfeed__title,
  .com-users-login__title,
  .com-users-registration__title,
  .com-users-profile__title,
  .com-users-profile-edit__title,
  .com-users-remind__title,
  .com-users-reset__title,
  .com-privacy-request__title,
  .page-header
) {
  min-width: 0;
  overflow-wrap: anywhere;
}

:where(.page-header, .component-header, .com-component__header) {
  margin-block-end: var(--space-4);
}

:where(.page-header, .component-header, .com-component__header) > :first-child {
  margin-block-start: 0;
}

:where(.page-header, .component-header, .com-component__header) > :last-child {
  margin-block-end: 0;
}

:where(.component-intro, .component-description, .page-description) {
  margin-block-end: var(--space-4);
  padding: 1rem 1.1rem;
  background: var(--surface-soft);
  border-inline-start: 4px solid var(--accent);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Content archive, featured, category blog, and article-list views
   -------------------------------------------------------------------------- */

:where(.com-content-archive__form, .archive-form) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 0.8rem;
  align-items: end;
  margin-block-end: var(--space-5);
  padding: 1rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.com-content-archive__items, .archive-items, .blog-items, .items-leading) {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

:where(
  .com-content-archive__item,
  .archive-item,
  .blog-item,
  .items-leading > div,
  .com-content-featured__item
) {
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.35rem);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(
  .com-content-archive__item,
  .archive-item,
  .blog-item,
  .items-leading > div,
  .com-content-featured__item
) > :first-child {
  margin-block-start: 0;
}

:where(
  .com-content-archive__item,
  .archive-item,
  .blog-item,
  .items-leading > div,
  .com-content-featured__item
) > :last-child {
  margin-block-end: 0;
}

:where(.blog-items.items-leading, .items-leading) {
  grid-template-columns: 1fr;
}

:where(.blog-items.columns-2, .blog-items.cols-2, .items-row.cols-2) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

:where(.blog-items.columns-3, .blog-items.cols-3, .items-row.cols-3) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

:where(.blog-items.columns-4, .blog-items.cols-4, .items-row.cols-4) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

:where(.com-content-category__children, .categories-list) .category-desc {
  margin-block: 0.4rem 1rem;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text-muted);
}

:where(.category-count, .badge.bg-info, .badge.bg-secondary) {
  color: var(--text-strong);
}

/* --------------------------------------------------------------------------
   Smart Search and legacy search
   -------------------------------------------------------------------------- */

:where(.com-finder__search, .com-search__form, .search-form, .mod-finder__search) {
  min-width: 0;
}

:where(.com-finder__search, .com-search__form, .search-form) {
  margin-block-end: var(--space-5);
  padding: clamp(1rem, 2vw, 1.35rem);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.com-finder__search, .com-search__form, .search-form) .input-group {
  width: 100%;
}

:where(.com-finder__advanced, .finder-advanced, .search-advanced) {
  margin-block-start: 1rem;
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--border);
}

:where(.filter-branch, .finder-selects, .search-filters) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 0.8rem;
  min-width: 0;
}

:where(.com-finder__results, .com-search__results, .search-results) {
  min-width: 0;
}

:where(.com-finder__results-list, .com-search__results-list, .search-results) {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.com-finder__result, .com-search__result, .search-results .result) {
  min-width: 0;
  padding: 1rem 1.1rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.result__title, .com-finder__result-title, .result-title) {
  margin-block: 0 0.45rem;
  overflow-wrap: anywhere;
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  line-height: 1.2;
}

:where(.result__taxonomy, .result__date, .result__url, .result__meta) {
  margin-block: 0.35rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

:where(.result__description, .com-finder__result-description) {
  margin-block: 0.6rem 0;
}

:where(.searchintro, .com-finder__total, .com-search__counter) {
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Contacts and contact categories
   -------------------------------------------------------------------------- */

:where(.com-contact__container, .contact-container) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.42fr);
  gap: var(--space-5);
  align-items: start;
}

:where(.com-contact__info, .contact-info, .contact-details) {
  min-width: 0;
}

:where(.com-contact__form, .contact-form) {
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.35rem);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.contact-address, .contact-miscinfo, .contact-links, .contact-profile) {
  min-width: 0;
  padding: 1rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.contact-address, .contact-miscinfo, .contact-links, .contact-profile) + :where(.contact-address, .contact-miscinfo, .contact-links, .contact-profile) {
  margin-block-start: 1rem;
}

:where(.contact-address dl, .contact-profile dl) {
  display: grid;
  grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr);
  gap: 0.45rem 1rem;
  margin: 0;
}

:where(.contact-address dt, .contact-profile dt) {
  color: var(--text-strong);
  font-weight: 700;
}

:where(.contact-address dd, .contact-profile dd) {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

:where(.contact-image, .com-contact__image) {
  margin-block-end: 1rem;
}

:where(.contact-image img, .com-contact__image img) {
  width: min(100%, 30rem);
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.contact-links ul, ul.contact-links) {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.contact-category, .com-contact-category__items) {
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Tags and tag index views
   -------------------------------------------------------------------------- */

:where(.com-tags-tags__items, .tags-list, .tag-category) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.com-tags-tags__item, .tags-list__item, .tag-category > li) {
  min-width: 0;
  padding: 1rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.com-tags-tag__items, .tag-items) {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.com-tags-tag__item, .tag-item) {
  min-width: 0;
  padding: 1rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.tag-count, .com-tags-tags__item-count) {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Newsfeeds
   -------------------------------------------------------------------------- */

:where(.com-newsfeeds-category__items, .newsfeed-category, .newsfeed-items) {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.com-newsfeeds-category__item, .newsfeed-category > li, .newsfeed-item) {
  min-width: 0;
  padding: 1rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.com-newsfeeds-newsfeed__items, .newsfeed) {
  display: grid;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.com-newsfeeds-newsfeed__item, .newsfeed > li) {
  min-width: 0;
  padding-block-end: var(--space-4);
  border-block-end: 1px solid var(--border);
}

:where(.feed-item-description, .newsfeed-item-description) {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   User accounts, profile, reset, and multifactor authentication
   -------------------------------------------------------------------------- */

:where(
  .com-users-login,
  .com-users-registration,
  .com-users-remind,
  .com-users-reset,
  .com-users-methods-list,
  .com-users-method-edit,
  .com-users-captive
) {
  width: min(100%, 48rem);
  margin-inline: auto;
}

:where(
  .com-users-login__form,
  .com-users-registration__form,
  .com-users-remind__form,
  .com-users-reset__form,
  .com-users-method-edit__form,
  .com-users-captive__form
) {
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.4rem);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.com-users-login__options, .com-users-registration__options, .login-options) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-block-start: 1rem;
  padding: 0;
  list-style: none;
}

:where(.com-users-profile__core, .com-users-profile__params, .profile-core, .profile-params) {
  min-width: 0;
  margin-block-end: var(--space-4);
  padding: 1rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.com-users-profile dl, .profile dl) {
  display: grid;
  grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr);
  gap: 0.55rem 1rem;
  margin: 0;
}

:where(.com-users-profile dt, .profile dt) {
  color: var(--text-strong);
  font-weight: 700;
}

:where(.com-users-profile dd, .profile dd) {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

:where(.com-users-methods-list__methods, .mfa-methods-list, .com-users-captive__methods) {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.com-users-methods-list__method, .mfa-method, .com-users-captive__method) {
  min-width: 0;
  padding: 1rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.com-users-methods-list__actions, .mfa-method__actions) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-block-start: 0.8rem;
}

/* --------------------------------------------------------------------------
   Privacy request and confirmation screens
   -------------------------------------------------------------------------- */

:where(.com-privacy-request, .com-privacy-confirm, .com-privacy-remind) {
  width: min(100%, 52rem);
  margin-inline: auto;
}

:where(.com-privacy-request form, .com-privacy-confirm form, .com-privacy-remind form) {
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.4rem);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:where(.privacy-request-note, .privacy-consent-note, .privacy-confirm-note) {
  margin-block: 1rem;
  padding: 1rem;
  background: var(--surface-soft);
  border-inline-start: 4px solid var(--accent);
}

/* --------------------------------------------------------------------------
   Wrapper component and external pages
   -------------------------------------------------------------------------- */

:where(.com-wrapper, .wrapper) {
  min-width: 0;
}

:where(.com-wrapper iframe, .wrapper iframe, iframe.wrapper) {
  display: block;
  width: 100%;
  min-height: min(75vh, 56rem);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}

/* --------------------------------------------------------------------------
   Core module output
   -------------------------------------------------------------------------- */

:where(
  .mod-articleslatest,
  .mod-articlespopular,
  .mod-articlesnews,
  .mod-articles-category,
  .mod-relateditems,
  .mod-tags-popular,
  .mod-tags-similar,
  .mod-feed,
  .mod-languages,
  .mod-whosonline,
  .mod-login,
  .mod-finder,
  .mod-search,
  .mod-randomimage,
  .mod-syndicate
) {
  min-width: 0;
}

:where(
  .mod-articleslatest,
  .mod-articlespopular,
  .mod-relateditems,
  .mod-tags-similar,
  .mod-feed
) ul {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(
  .mod-articleslatest,
  .mod-articlespopular,
  .mod-relateditems,
  .mod-tags-similar,
  .mod-feed
) li {
  min-width: 0;
  padding-block-end: 0.6rem;
  border-block-end: 1px solid var(--border);
}

:where(
  .mod-articleslatest,
  .mod-articlespopular,
  .mod-relateditems,
  .mod-tags-similar,
  .mod-feed
) li:last-child {
  padding-block-end: 0;
  border-block-end: 0;
}

:where(.mod-articles-category, .mod-articlesnews) {
  display: grid;
  gap: 1rem;
}

:where(.mod-articles-category__item, .mod-articlesnews__item, .newsflash-item) {
  min-width: 0;
  padding-block-end: 1rem;
  border-block-end: 1px solid var(--border);
}

:where(.mod-articles-category__item:last-child, .mod-articlesnews__item:last-child, .newsflash-item:last-child) {
  padding-block-end: 0;
  border-block-end: 0;
}

:where(.mod-tags-popular, .tagspopular) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.mod-tags-popular a, .tagspopular a) {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.55rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}

:where(.mod-tags-popular a:hover, .mod-tags-popular a:focus-visible, .tagspopular a:hover, .tagspopular a:focus-visible) {
  border-color: var(--accent);
  color: var(--accent-strong);
}

:where(.mod-login, .login-form) .mod-login__userdata {
  display: grid;
  gap: 0.75rem;
}

:where(.mod-login__options, .login-form .unstyled) {
  display: grid;
  gap: 0.35rem;
  margin-block-start: 0.8rem;
  padding: 0;
  list-style: none;
}

:where(.mod-languages ul, .mod-languages__list) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.mod-languages a) {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
}

:where(.mod-randomimage img, .random-image img) {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

:where(.mod-syndicate a, .syndicate-module a) {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  min-height: 2.4rem;
}

/* --------------------------------------------------------------------------
   Empty, restricted, and completion states in Joomla core views
   -------------------------------------------------------------------------- */

:where(
  .com-content-archive__empty,
  .com-contact-category__empty,
  .com-finder__empty,
  .com-search__empty,
  .com-tags-tag__empty,
  .com-tags-tags__empty,
  .com-newsfeeds-category__empty,
  .com-users-methods-list__empty,
  .joomla-empty-state
) {
  padding: clamp(1.25rem, 4vw, 2.25rem);
  background: var(--surface-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}

:where(.joomla-empty-state) > :first-child {
  margin-block-start: 0;
}

:where(.joomla-empty-state) > :last-child {
  margin-block-end: 0;
}

/* --------------------------------------------------------------------------
   Responsive and print behavior
   -------------------------------------------------------------------------- */

@media (max-width: 62rem) {
  :where(.com-contact__container, .contact-container) {
    grid-template-columns: 1fr;
  }

  :where(.blog-items.columns-4, .blog-items.cols-4, .items-row.cols-4) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 44rem) {
  :where(
    .blog-items.columns-2,
    .blog-items.cols-2,
    .items-row.cols-2,
    .blog-items.columns-3,
    .blog-items.cols-3,
    .items-row.cols-3,
    .blog-items.columns-4,
    .blog-items.cols-4,
    .items-row.cols-4
  ) {
    grid-template-columns: 1fr;
  }

  :where(.contact-address dl, .contact-profile dl, .com-users-profile dl, .profile dl) {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  :where(.contact-address dd, .contact-profile dd, .com-users-profile dd, .profile dd) {
    margin-block-end: 0.65rem;
  }

  :where(.com-wrapper iframe, .wrapper iframe, iframe.wrapper) {
    min-height: 65vh;
  }
}

@media (forced-colors: active) {
  :where(
    .com-content-archive__item,
    .archive-item,
    .blog-item,
    .com-content-featured__item,
    .com-finder__result,
    .com-search__result,
    .com-contact__form,
    .contact-address,
    .contact-miscinfo,
    .contact-links,
    .contact-profile,
    .com-tags-tags__item,
    .com-tags-tag__item,
    .com-newsfeeds-category__item,
    .com-users-profile__core,
    .com-users-profile__params,
    .com-users-methods-list__method,
    .mfa-method
  ) {
    border-color: CanvasText;
  }
}

@media print {
  :where(.com-content-archive__form, .com-finder__search, .com-search__form, .search-form) {
    padding: 0;
    border: 0;
    background: transparent;
  }

  :where(
    .com-content-archive__item,
    .archive-item,
    .blog-item,
    .com-content-featured__item,
    .com-finder__result,
    .com-search__result,
    .com-contact__form,
    .contact-address,
    .contact-miscinfo,
    .contact-links,
    .contact-profile,
    .com-tags-tags__item,
    .com-tags-tag__item,
    .com-newsfeeds-category__item,
    .com-users-profile__core,
    .com-users-profile__params,
    .com-users-methods-list__method,
    .mfa-method
  ) {
    break-inside: avoid;
    box-shadow: none;
  }

  :where(.com-wrapper iframe, .wrapper iframe, iframe.wrapper) {
    display: none;
  }
}
