/* ==========================================================================
   Accessibility support.

   Two things live here:
     1. the skip link and keyboard focus styles (screen reader / keyboard use)
     2. the "Listen to this page" control (js/listen.js)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Skip link
   The first thing a keyboard or screen-reader user meets on every page. It is
   off-screen until focused, then drops into view.
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10000;
  display: inline-block;
  padding: 12px 22px;
  background: #08c2ff;
  color: #0b0d12;
  font-family: "Oswald", sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.2s ease;
}

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

/* <main> is focused when the skip link is used; it should not draw a box */
main:focus {
  outline: none;
}

/* --------------------------------------------------------------------------
   2. Visible keyboard focus
   The theme leaves focus almost invisible, which makes the site impossible to
   navigate by keyboard. :focus-visible only shows for keyboard users, so mouse
   users see no change.
   -------------------------------------------------------------------------- */
/* !important is deliberate. The theme switches focus outlines off in several
   places (a:focus, button:focus, .btn--styleOne:focus, the newsletter input,
   the search overlay), some with more specific selectors than these. A visible
   focus indicator is the difference between a usable and an unusable site for
   anyone navigating by keyboard, so it has to win. :focus-visible means mouse
   users still see nothing. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #08c2ff !important;
  outline-offset: 3px !important;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   3. Text for screen readers only
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   4. "Listen to this page"
   A visible, labelled control - not an icon-only circle. Many of the people it
   helps most (low literacy, limited sight, no screen reader set up on a shared
   phone) will not recognise a speaker glyph on its own.
   -------------------------------------------------------------------------- */
.listen {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 997;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e4e6ec;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.16);
  font-family: "Barlow", sans-serif;
}

html[data-theme="dark"] .listen {
  background: #37373d;
  border-color: #4c4c53;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
}

.listen[hidden] {
  display: none;
}

.listen__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;             /* a comfortable touch target */
  padding: 0 18px 0 14px;
  border: 0;
  border-radius: 999px;
  background: #08c2ff;
  color: #06222c;
  font-family: "Oswald", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}

.listen__btn:hover {
  background: #21cdff;
}

.listen__btn--ghost {
  background: transparent;
  color: #20212b;
  padding: 0 16px;
  border: 1px solid #e4e6ec;
}

html[data-theme="dark"] .listen__btn--ghost {
  color: #dfe2ea;
  border-color: #4c4c53;
}

.listen__btn--ghost:hover {
  background: #f1f1f1;
}

html[data-theme="dark"] .listen__btn--ghost:hover {
  background: #262a35;
}

.listen__icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* the sentence being spoken, highlighted so people can follow along */
.listen-current {
  background: rgba(8, 194, 255, 0.28);
  box-shadow: 0 0 0 3px rgba(8, 194, 255, 0.28);
  border-radius: 3px;
}

@media (max-width: 575px) {
  .listen {
    left: 12px;
    bottom: 12px;
  }
  .listen__btn {
    font-size: 14px;
    padding: 0 14px 0 11px;
  }
}

/* someone who has asked their system to reduce motion gets no transitions */
@media (prefers-reduced-motion: reduce) {
  .skip-link,
  .listen__btn {
    transition: none;
  }
}
