/* ==========================================================================
   Leavers WA custom styles
   ========================================================================== */

/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
  --bs-focus-ring-color: rgba(112, 27, 107, 0.25);
  --bs-link-color: #701b6b;
  --bs-link-color-rgb: 112, 27, 107;
  --bs-link-hover-color: #471144;
  --bs-link-hover-color-rgb: 71, 17, 68;
  --bs-primary: #701b6b;
  --bs-primary-rgb: 112, 27, 107;
  --bs-secondary: #471144;
  --bs-secondary-rgb: 71, 17, 68;

  --card-radius: 3px;
  --content-gap: 40px;
  --content-gap-mobile: 20px;
  --section-padding-block: 40px;
  --site-max-width: 1170px;
  --site-padding-inline: 15px;

  --color-text: #2f363d;
  --color-text-accent: #5b6977;
  --color-text-description: #595959;
  --color-text-muted: #55585b;
  --color-text-secondary: #555;
  --color-text-subtle: #767676;

  --color-surface: #fff;
  --color-surface-hover: #f5f5f5;
  --color-surface-hover-strong: #f0edf0;
  --color-surface-page: #fcfcfc;
  --color-surface-sidebar: #f7f7f7;
  --color-surface-sidebar-hover: #e5e6e6;
  --color-surface-subtle: #f6f6f6;
  --color-surface-table-section: #a6bb8b;

  --color-footer-bg: #1d252e;
  --color-footer-link: #eef1f5;
  --color-footer-muted: #a5a5a5;
  --color-footer-text: #cbcbcb;

  --color-border: #e0e0e0;
  --color-border-control: #ccc;
  --color-border-divider: #eee;
  --color-border-light: #ddd;
  --color-border-subtle: #eaeaea;

  --color-contact-green: #1a9c4b;
  --color-contact-orange: #f79c2e;
  --color-contact-red: #e31818;

  --overlay-hover: rgba(0, 0, 0, 0.04);
  --overlay-hover-subtle: rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   Base
   ========================================================================== */

body {
  background-color: var(--color-surface-page);
  color: var(--color-text);
  font-family: 'Nunito Sans', "Helvetica Neue", Helvetica, sans-serif;
  font-size: 112.5%;
}

:where(h1, h2, h3, h4, h5, h6) {
  font-weight: 300;
}

.container {
  max-width: var(--site-max-width);
}

.btn {
  border-radius: 0;
}

a {
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }
}

*:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

main:focus {
  outline: none;
}

/* ==========================================================================
   Layout
   ========================================================================== */

:is(.main-container, .home-container) {
  margin-inline: auto;
  max-width: var(--site-max-width);
  padding-inline: var(--site-padding-inline);
}

.main-container {
  background: var(--color-surface);
  padding-top: 30px;
}

.main-row {
  display: grid;
  gap: var(--content-gap);
  grid-template-columns: 1fr 25%;
  margin-bottom: var(--content-gap);

  @media (max-width: 991px) {
    gap: var(--content-gap-mobile);
    grid-template-columns: 1fr;
  }
}

.main-row--full {
  grid-template-columns: 1fr;
}

.main-article h1 {
  color: var(--color-text);
  margin-bottom: 20px;
}

.lead {
  margin-bottom: 20px;

  img {
    display: block;
    height: auto;
    width: 100%;
  }
}

.content-text {
  font-size: 16px;
  line-height: 1.6;

  a {
    text-decoration: underline;
  }

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

  iframe {
    max-width: 100%;
  }

  :is(h2, h3, h4, h5, h6) {
    margin-top: 1.5em;
  }

  > :is(h2, h3, h4, h5, h6):first-child {
    margin-top: 0;
  }

  p {
    margin-bottom: 15px;
  }

  :is(ul, ol) {
    margin-bottom: 15px;
    padding-inline-start: 25px;
  }

  li {
    margin-bottom: 4px;

    p {
      margin-bottom: 4px;
    }
  }

  table {
    border-collapse: collapse;
    font-size: 14px;
    margin-bottom: 20px;
    width: 100%;

    &:not(.table) {
      border: 1px solid var(--color-border-light);
    }

    th {
      background-color: var(--color-surface-hover);
      font-weight: 600;
    }

    :is(td, th) {
      border: 1px solid var(--color-border-light);
      padding: 8px 10px;
      vertical-align: top;
    }

    @media (max-width: 767px) {
      display: block;
      overflow-x: auto;
    }
  }
}

.secondary-menu {
  background-color: var(--color-surface-sidebar);
  border: 1px solid var(--color-border-subtle);
  padding-top: 15px;

  h2 {
    color: var(--color-text-muted);
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.3;
    padding-inline: 20px 15px;
  }

  .nav > li > a {
    border-inline-start: 1px solid transparent;
    color: var(--color-text-muted);
    display: block;
    padding: 8px 15px 8px 19px;
    text-decoration: none;

    &:is(:hover, :focus) {
      background-color: var(--color-surface-sidebar-hover);
      color: var(--color-footer-bg);
      text-decoration: none;
    }
  }

  .nav > li.active > a {
    &, &:hover, &:focus {
      background-color: var(--color-surface);
      border-inline-start-color: var(--bs-primary);
      color: var(--bs-primary);
      font-weight: 400;
    }
  }
}

.search-stats {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-stats > li {
  color: var(--color-text-muted);
  font-size: 14px;
  padding: 8px 15px 8px 19px;
}

.content-image-center {
  margin: 0 0 20px;
  text-align: center;

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

.vimeo-embed {
  aspect-ratio: 16 / 9;
  margin-bottom: 20px;

  iframe {
    height: 100%;
    width: 100%;
  }
}

.map-embed {
  margin-bottom: 20px;

  iframe {
    border: 0;
    min-height: 400px;
    width: 100%;
  }
}

.table-section-heading {
  background-color: var(--color-surface-table-section);
  font-weight: 600;
  text-align: center;
}

/* ==========================================================================
   Header and navigation
   ========================================================================== */

#site-header {
  background: var(--color-surface-subtle);
  border-bottom: 1px solid var(--color-border);

  @media (min-width: 992px) {
    border-bottom: none;
  }
}

.site-logo {
  max-height: 74px;
  max-width: 100%;
  width: auto;
}

.skip-link {
  inset: 0 auto auto 0;
  position: absolute;
  z-index: 1030;
}

.utility-links a {
  color: var(--color-text-muted);
  font-size: 12px;

  &:hover {
    color: var(--bs-primary);
  }
}

.navbar {
  --bs-navbar-nav-link-padding-x: 15px;

  background: var(--color-surface);
  border-block: 1px solid var(--color-border);
  padding: 0;

  @media (max-width: 991px) {
    border: none;
    padding: 8px 0;
  }

  .btn-mobile-nav {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 15px;
    padding: 8px 12px;

    &:is(:hover, :focus) {
      background: var(--overlay-hover);
      color: var(--bs-primary);
    }
  }
}

#mobile-search {
  border-top: 1px solid var(--color-border-divider);
  margin-top: 8px;

  .btn-outline-secondary {
    border-color: var(--color-border-control);
  }
}

.navbar-nav {
  margin-top: -1px;

  .nav-link {
    border-top: 1px solid transparent;
    color: var(--color-text-secondary);
    font-size: 16px;
    line-height: 1.5;
    padding-block: 13px;
  }

  button.nav-link {
    background: none;
    border-bottom: none;
    border-inline: none;
  }

  :is(.nav-link:hover, .nav-item.show .nav-link) {
    background: var(--overlay-hover-subtle);
    color: var(--color-text);
    text-decoration: none;
  }

  .nav-item.active .nav-link {
    border-top-color: var(--bs-primary);
    color: var(--bs-primary);
  }
}

.dropdown-menu {
  border: 1px solid var(--color-border-light);
  border-radius: 0;
  border-top: 5px solid var(--bs-primary);
  margin-top: 0;
  padding: 0;
}

.dropdown-item {
  color: var(--color-text-secondary);
  font-size: 16px;
  padding: 8px 14px;

  &:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
    text-decoration: none;
  }

  &.active {
    background: var(--color-surface-hover);
    color: var(--bs-primary);
    font-weight: 600;
  }
}

@media (min-width: 992px) {
  .dropdown:hover .dropdown-menu {
    display: block;
  }
}

/* ==========================================================================
   Shared card patterns
   ========================================================================== */

:is(.child-links, .related-links, .sitemap-links, .sitemap-sublinks, .home-links) {
  a {
    align-items: flex-start;
    background: var(--color-surface-subtle);
    border-radius: var(--card-radius);
    color: var(--color-text);
    display: flex;
    gap: 12px;
    padding: 12px 15px;

    &:hover {
      background: var(--color-border-subtle);
      text-decoration: none;
    }

    > svg {
      color: var(--bs-primary);
      flex-shrink: 0;
      margin-top: 2px;
    }
  }

  strong {
    color: var(--bs-primary);
    display: block;
    font-size: 15px;
  }

  p {
    color: var(--color-text-description);
    font-size: 13px;
    margin: 2px 0 0;
  }
}

:is(.child-menu, .related-content) {
  border-top: 1px solid var(--color-border);
  margin-top: 30px;
  padding-top: 30px;
}

.related-content h2 {
  color: var(--color-text-muted);
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 15px;
}

:is(.child-links, .related-links) li {
  margin-bottom: 10px;
}

.related-links {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);

  li {
    margin-bottom: 0;
  }

  @media (max-width: 767px) {
    grid-template-columns: 1fr;
  }
}

.related-section {
  color: var(--color-text-subtle);
  display: inline;
  font-size: 12px;
  font-weight: 400;
}

/* ==========================================================================
   Home page
   ========================================================================== */

.home-section {
  background-color: var(--color-surface-subtle);
  padding-block: var(--section-padding-block);
}

.event-date {
  background: var(--color-surface-subtle);
  border-inline-start: 4px solid var(--bs-primary);
  color: var(--color-text);
  display: inline-block;
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 24px;
  padding: 12px 18px;
}

.home-links {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, 1fr);

  li {
    margin-bottom: 0;
  }

  a {
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    gap: 14px;
    min-height: 100%;
    padding: 20px 24px;

    &:hover {
      background: var(--color-surface-hover-strong);
      border-color: var(--bs-primary);
    }

    > svg {
      font-size: 1.2em;
      margin-top: 5px;
    }
  }

  strong {
    font-size: 18px;
    margin-bottom: 6px;
  }

  p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
  }

  @media (max-width: 767px) {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  background-color: var(--color-footer-bg);
  color: var(--color-footer-text);
  padding: 30px 0;
}

.footer-secondary .row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
}

:is(.footer-utilities, .social-links, .wagov-link) {
  margin-bottom: 15px;
}

.footer-utilities {
  font-size: 0.875em;
  line-height: 1.25;

  ul {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    margin-bottom: 8px;
    padding: 0;
  }

  a {
    color: var(--color-footer-link);
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }

  p {
    color: var(--color-footer-text);
    font-size: 0.857em;
    margin-bottom: 0;
  }
}

.social-links {
  font-size: 2.5em;
  line-height: 1;

  ul {
    display: flex;
    gap: 10px;
    list-style: none;
    margin-bottom: 0;
    padding: 0;
  }

  a {
    color: var(--color-footer-muted);
    display: inline-block;
    text-decoration: none;
    transition: color 0.2s;

    &:hover {
      color: var(--color-surface);
      text-decoration: none;
    }
  }
}

.wagov-link a {
  color: var(--color-footer-muted);
  font-size: 2em;
  font-weight: 600;
  text-decoration: none;

  &:hover {
    color: var(--color-surface);
    text-decoration: none;
  }
}

@media (max-width: 991px) {
  :is(.footer-utilities, .social-links, .wagov-link) {
    text-align: center;
  }

  :is(.footer-utilities, .social-links) ul {
    justify-content: center;
  }
}

@media (min-width: 992px) {
  .footer-secondary .wagov-link {
    order: 1;
  }

  .footer-secondary .footer-utilities {
    order: 2;
    text-align: center;
  }

  .footer-secondary .social-links {
    order: 3;
    text-align: right;
  }

  .social-links ul {
    justify-content: flex-end;
  }
}

/* ==========================================================================
   Contact page
   ========================================================================== */

.contact-alert {
  color: var(--color-text-accent);
  font-size: 1.375em;
  font-weight: 300;
  line-height: 1.27;

  strong {
    font-weight: 500;
  }
}

.contact-grid {
  color: var(--color-surface);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;

  a {
    color: inherit;
    text-decoration: none;

    &:hover {
      opacity: 0.9;
      text-decoration: underline !important;
    }
  }

  .cell {
    align-items: center;
    border: 1px solid var(--color-surface);
    display: flex;
    justify-content: center;
    padding: 1rem;
  }

  .cell-bullets {
    align-items: flex-start;
    padding: 1.5rem;
    text-align: left;
  }

  .green {
    background-color: var(--color-contact-green);
  }

  .orange {
    background-color: var(--color-contact-orange);
  }

  .red {
    background-color: var(--color-contact-red);
  }
}

.contact-grid-number {
  font-size: clamp(1.75rem, 2.4vw, 2rem);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 0;
}

@media (max-width: 767px) {
  .contact-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;

    .cell {
      grid-column: 1;
    }

    .green-header { grid-row: 1; }
    .green-desc { grid-row: 2; }
    .green-bullets { grid-row: 3; }
    .orange-header { grid-row: 4; }
    .orange-desc { grid-row: 5; }
    .orange-bullets { grid-row: 6; }
    .red-header { grid-row: 7; }
    .red-desc { grid-row: 8; }
    .red-bullets { grid-row: 9; }
  }
}

/* ==========================================================================
   Search and Pagefind
   ========================================================================== */

mark,
.pagefind-ui mark {
  background-color: rgba(var(--bs-primary-rgb), 0.15);
  border-bottom: 2px solid var(--bs-primary);
  border-radius: 2px;
  color: inherit;
  padding: 0.1em 0.2em;
}

.pagefind-ui {
  --pagefind-ui-background: var(--color-surface);
  --pagefind-ui-border: var(--color-border-light);
  --pagefind-ui-border-radius: 0;
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-font: inherit;
  --pagefind-ui-primary: var(--bs-primary);
  --pagefind-ui-tag: var(--color-surface-subtle);
  --pagefind-ui-text: var(--color-text);
}

.pagefind-ui .pagefind-ui__search-input {
  border-color: var(--color-border-control);
  font-weight: 400;

  &:focus {
    border-color: var(--bs-primary);
    outline: 2px solid var(--bs-focus-ring-color);
    outline-offset: 1px;
  }
}

.pagefind-ui .pagefind-ui__search-clear {
  background: none;
  color: var(--color-text-muted);
  font-weight: 600;

  &:hover {
    color: var(--bs-primary);
  }
}

.pagefind-ui .pagefind-ui__message {
  color: var(--color-text-muted);
  font-weight: 600;
}

.pagefind-ui .pagefind-ui__result {
  border-color: var(--color-border-subtle);
  padding-block: 20px;
}

.pagefind-ui .pagefind-ui__result-link {
  color: var(--bs-primary) !important;
  font-weight: 600;

  &:hover {
    color: var(--bs-secondary) !important;
  }
}

.pagefind-ui .pagefind-ui__result-excerpt {
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.pagefind-ui .pagefind-ui__result-nested .pagefind-ui__result-link {
  font-weight: 400;
}

.pagefind-ui .pagefind-ui__button {
  background-color: var(--bs-primary);
  border: none;
  color: var(--color-surface);
  font-weight: 600;
  transition: background-color 0.2s;

  &:hover {
    background-color: var(--bs-secondary);
    border: none;
    color: var(--color-surface);
  }
}

/* ==========================================================================
   Sitemap page
   ========================================================================== */

.sitemap-intro {
  font-size: 16px;
  margin-bottom: 30px;
}

.sitemap-sections {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.sitemap-section {
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--card-radius);
  padding: 24px;

  h2 {
    font-size: 1.3em;
    font-weight: 600;
    margin: 0 0 4px;

    a {
      color: var(--bs-primary);

      &:hover {
        color: var(--bs-secondary);
      }
    }
  }
}

.sitemap-section-desc {
  color: var(--color-text-muted);
  font-size: 14px;
  margin: 0 0 16px;
}

.sitemap-section-desc + .sitemap-links,
.sitemap-section h2 + .sitemap-links {
  margin-top: 16px;
}

.sitemap-links {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, 1fr);

  li {
    margin-bottom: 0;
  }

  a {
    background: var(--color-surface);
  }

  @media (max-width: 767px) {
    grid-template-columns: 1fr;
  }
}

.sitemap-sublinks {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, 1fr);
  padding-inline-start: 28px;

  a {
    background: var(--color-surface);
    border-inline-start: 3px solid var(--bs-primary);
    padding: 10px 14px;
  }

  strong {
    font-size: 14px;
  }

  @media (max-width: 767px) {
    grid-template-columns: 1fr;
    padding-inline-start: 0;
  }
}
