/* Cookie consent banner.

   Kept in its own file so that 404.html can use it too: that page deliberately
   avoids main.css, whose loading overlay would strand visitors on a black
   screen, but it can safely pull in this one on its own.

   z-index sits just under #loadingPage (9999) so the banner stays hidden
   behind the overlay on the home page until the slideshow has finished
   loading, rather than floating over it. */

#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  box-sizing: border-box;
  padding: 1.25rem 1.5rem;
  background-color: #1b1f22;
  border-top: solid 2px #288548;
  color: rgba(255, 255, 255, 0.85);
  font-family: 'Source Sans Pro', Helvetica, sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.5rem;
}

#cookie-banner p {
  margin: 0;
  max-width: 46rem;
  color: inherit;
}

#cookie-banner a {
  color: #ffffff;
  text-decoration: underline;
}

#cookie-banner .cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* main.css styles every bare <button> for the site's own look, and those rules
   reach in here on the home page but not on 404.html, which does not load it.
   Three of them have to be undone explicitly or the two pages disagree:
   height and line-height (2.75rem each) leave the label sitting near the
   bottom of the box, the inset ring draws a second border inside ours, and
   color is set with !important, which plain specificity cannot beat and which
   would otherwise leave white text on the white hover background. */
#cookie-banner button {
  cursor: pointer;
  border: solid 2px #ffffff;
  border-radius: 4px;
  box-shadow: none;
  background-color: transparent;
  height: auto;
  line-height: 1;
  /* The extra 0.1rem on the left offsets the letter-spacing that trails the
     final letter, which would otherwise pull the label off centre. */
  padding: 0.7rem 1.5rem 0.7rem 1.6rem;
  color: #ffffff !important;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out,
    border-color 0.2s ease-in-out;
}

#cookie-banner button:hover {
  background-color: #ffffff;
  color: #1b1f22 !important;
}

#cookie-banner button.accept {
  border-color: #288548;
  background-color: #288548;
}

#cookie-banner button.accept:hover {
  background-color: #ffffff;
  border-color: #ffffff;
  color: #1b1f22 !important;
}

/* consent.js measures the banner and publishes its height here. Both pages
   centre their content in the full viewport, so without this the banner simply
   sits on top of whatever that centring put at the bottom of a short screen --
   on a 320x568 phone, the register button. */
/* min-height alone only helps while the content fits. On a small phone the
   page runs several screens long, so it also needs room to scroll clear of the
   banner -- otherwise the footer can never be read. This sits on <body> rather
   than #wrapper because #footer is a sibling of #wrapper, not a child. */
body.has-cookie-banner {
  padding-bottom: var(--cookie-banner-height, 0px);
}

body.has-cookie-banner #wrapper {
  min-height: calc(100vh - var(--cookie-banner-height, 0px));
}

/* 404.html has no #wrapper; its <body> is the centred box, and carries 2rem of
   padding of its own that this must not drop. */
body.has-cookie-banner.error-page {
  padding-bottom: calc(2rem + var(--cookie-banner-height, 0px));
}

@media screen and (max-width: 736px) {
  #cookie-banner {
    padding: 1rem;
    text-align: center;
  }

  #cookie-banner .cookie-actions {
    width: 100%;
    justify-content: center;
  }
}

/* Every line here is a line of hero the visitor cannot see, so keep the
   notice tight on small screens. */
@media screen and (max-width: 480px) {
  #cookie-banner {
    padding: 0.85rem 0.75rem;
    font-size: 0.8rem;
    line-height: 1.45;
    gap: 0.7rem 1rem;
  }

  #cookie-banner button {
    /* Keeps the same left-side letter-spacing offset as the base rule; plain
       symmetric padding here would put the label back off centre. */
    padding: 0.55rem 1.1rem 0.55rem 1.2rem;
  }
}

/* The accept/decline pair sits just under 44px at the mobile font size. */
@media (pointer: coarse) {
  #cookie-banner button {
    min-height: 44px;
  }

  /* Grow the policy link's hit area over the inert space around its line
     rather than padding it, which would add a band of banner across the
     hero. The gap below is widened to keep that area clear of the buttons. */
  #cookie-banner {
    gap: 1.15rem 1.5rem;
  }

  #cookie-banner a {
    position: relative;
  }

  #cookie-banner a::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 44px;
    transform: translateY(-50%);
  }
}
