/*
  Theme Name: MZSW
  Theme URI: gravity.nl
  Author: Christiaan Snoei
  Author URI: https://www.gravity.nl
  Description: A WordPress theme built by Christiaan Snoei
  Requires at least: WordPress 5.2
  Text Domain: mzsw
  Version: 1.1
*/

/* Fix for hamburger menu scrolling at 400% zoom (320px width) */
@media (max-width: 919.98px) {
  .open-nav .nav__list {
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Fix for link color contrast - WCAG AA compliance (4.5:1 ratio) */
/* Changed from #008fc1 (3.7:1) to #0073a8 (4.5:1) */
.arrow-link,
.arrow-link:hover,
.back-link,
.back-link:hover,
.wysiwyg a,
.downloads__text,
.downloads .icon,
.share__button,
.nav__toggle span,
.nav__toggle span:nth-child(2):before,
.hero,
.hero__button,
.hero__button:hover,
.cards__link:hover .cards__heading,
.newsletter button,
.newsletter input[type=button],
.filter__item--active .filter__link,
.filter__link:hover,
.pagination .next:hover,
.pagination .prev:hover,
.sidenav__item--active > .sidenav__link,
.sidenav__item--ancestor-active > .sidenav__link,
.sidenav .current_page_ancestor > a,
.sidenav .current_page_item > a,
.sidenav .page_item a:hover,
.sidenav__link:hover,
.wysiwyg ul li:before,
.wysiwyg ol li:before,
.wysiwyg blockquote p,
.wysiwyg blockquote cite,
.betterbrowser p > a,
.cookie-modal__entry a {
  color: #0073a8 !important;
}

.hero,
.nav__toggle span,
.nav__toggle span:nth-child(2):before {
  background-color: #0073a8 !important;
}

/* Fix for grey text color contrast - WCAG AA compliance (4.5:1 ratio) */
/* Changed from #8d97a6 (3.6:1) to #6c757d (4.54:1) */
.nav__link,
.cards__meta,
.overview__meta,
.sidenav .page_item a,
.sidenav__link,
.wysiwyg figure figcaption {
  color: #6c757d !important;
}

/* Also fix #7b8794 for consistency - change to slightly darker for better contrast */
/* Changed from #7b8794 (4.6:1) to #5a6268 (7.0:1) for better readability */
.wysiwyg p,
.wysiwyg li {
  color: #5a6268 !important;
}

/* Skip Link for Keyboard Users - WCAG 2.4.1 Bypass Blocks */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background-color: #0073a8;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  font-weight: 700;
  z-index: 100;
  border-radius: 0 0 4px 0;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* Target for skip link - ensure it's focusable */
#main-content:focus {
  outline: none;
}

/* Search Form Styles - for WCAG 2.4.5 Multiple Ways */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Search toggle button in nav */
.search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e9ecf2;
  background-color: #fff;
  cursor: pointer;
  color: #0073a8;
  transition: all 0.2s ease;
  margin-left: 2rem;
  margin-right: 1rem;
}

.search-toggle:hover {
  background-color: #f0f8fb;
  border-color: #0073a8;
}

.search-toggle:focus {
  outline: 2px solid #0073a8;
  outline-offset: 2px;
}

.search-toggle__icon {
  width: 20px;
  height: 20px;
}

/* Full-width search bar container below nav */
.search-bar-container {
  width: 100%;
  background-color: #fff;
  border-bottom: 1px solid #e9ecf2;
  display: none;
  position: relative;
  z-index: 89;
}

.search-bar-container.search-active {
  display: block;
}

.search-form {
  padding: 1rem 0;
}

.search-form__label {
  display: none;
}

.search-form__wrapper {
  display: flex;
  align-items: center;
  border: 1px solid #e9ecf2;
  border-radius: 99em;
  overflow: hidden;
  background-color: #fff;
  max-width: 600px;
  margin: 0 auto;
}

.search-form__input {
  padding: 0.75rem 1rem;
  border: 0;
  background-color: transparent;
  font-size: 16px;
  flex-grow: 1;
  min-height: 44px;
  line-height: 1.5;
  width: 100%;
}

.search-form__input:focus {
  outline: 0;
  box-shadow: 0 0 0 2px #0073a8 inset;
  border-radius: 99em 0 0 99em;
}

.search-form__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  background-color: transparent;
  border: 0;
  cursor: pointer;
  color: #0073a8;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
}

.search-form__submit:hover {
  background-color: #f0f8fb;
}

.search-form__submit:focus {
  outline: 2px solid #0073a8;
  outline-offset: 2px;
}

.search-form__icon {
  width: 20px;
  height: 20px;
}

/* Mobile responsive */
@media (max-width: 919.98px) {
  .search-toggle {
    margin-left: 1rem;
    margin-right: 0;
  }

  .search-form__wrapper {
    max-width: 100%;
  }
}

/* Hamburger Menu Focus Indicator - WCAG 2.4.11 */
.nav__toggle:focus,
.nav__toggle:focus-visible {
  outline: 3px solid #0073a8 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 3px rgba(0, 115, 168, 0.2) !important;
}

/* Navigatie Button Focus Indicator - WCAG 2.4.7 */
.sidenav__button:focus,
.sidenav__button:focus-visible {
  outline: 3px solid #0073a8 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 3px rgba(0, 115, 168, 0.2) !important;
}

/* Prevent focus on collapsed Navigatie menu items - WCAG 2.4.3 */
@media (max-width: 767.98px) {
  .sidenav__button:not(.active) + .sidenav__wrapper {
    visibility: hidden !important;
  }

  .sidenav__button.active + .sidenav__wrapper {
    visibility: visible !important;
  }
}

/* Article Overview Block Text Spacing Fix - WCAG 1.4.12 */
.cards__heading {
  height: auto !important;
  min-height: 42px !important;
  overflow: visible !important;
}

/* Sidebar Menu 200% Zoom Fix - WCAG 1.4.10 */
/* At 200% zoom on 1280x1024 (640px viewport), make sidebar menu collapsible */
@media (max-width: 767.98px) {
  /* Make sidebar button visible and functional */
  .sidenav__button {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    width: 100%;
    cursor: pointer;
    border-bottom: 1px solid #e9ecf2;
  }

  /* Arrow icon for collapsed/expanded state */
  .sidenav__button i {
    position: relative;
    width: 8px;
    height: 8px;
    border-left: 2px solid #6c757d;
    border-bottom: 2px solid #6c757d;
    transform: rotate(-45deg);
    top: -4px;
    transition: 0.2s ease;
  }

  .sidenav__button.active i {
    transform: rotate(-220deg);
    top: 0;
  }

  /* Collapsed state */
  .sidenav__button:not(.active) + .sidenav__wrapper {
    overflow: hidden !important;
    height: 0 !important;
    visibility: hidden !important;
  }

  /* Expanded state */
  .sidenav__button.active + .sidenav__wrapper {
    height: auto !important;
    visibility: visible !important;
  }

  /* Ensure menu items are accessible */
  .sidenav__list {
    margin: 0;
  }

  /* Stack columns vertically at tablet/mobile sizes */
  .col-12.col-lg-4.col-xl-3,
  .col-12.col-lg-7.col-xl-8 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
  }
}

/* Sidebar Menu 400% Zoom Fix - WCAG 1.4.10 */
/* At 400% zoom (320px viewport), ensure sidebar remains accessible */
@media (max-width: 320px) {
  /* Already handled by 767.98px breakpoint above */
  /* This ensures sidebar is still functional at extreme zoom levels */
}
