/* ============================================================
   Bookshare Plus theme styles
   Buttons, header, footer, utilities, responsive — everything the
   page-content sections (which carry the design's inline styles)
   don't provide themselves.
   ============================================================ */

html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

body {
  margin: 0;
  background: #fff;
  font-family: var(--font-body);
  color: var(--text-main-primary);
}

main a { color: var(--space-explorer-600); }
main a:hover { color: var(--space-explorer-700); }

/* Global visible focus (WCAG 2.4.7 / 2.4.11) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--input-focus-outline);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Buttons ---------- */
.bsp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: var(--bg-action-default);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 13px 24px;
  min-height: 44px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.bsp-btn:hover { background: var(--bg-action-hover); color: #fff; }
.bsp-btn:active { background: var(--bg-action-active); }
.bsp-btn:focus-visible { outline: 2px solid var(--input-focus-outline); outline-offset: 2px; }

.bsp-btn--secondary {
  color: var(--secondary-button-default-label);
  background: var(--secondary-button-default-background);
  border-color: var(--secondary-button-default-outline);
}
.bsp-btn--secondary:hover {
  background: var(--secondary-button-hover-background);
  color: var(--secondary-button-hover-label);
}
.bsp-btn--secondary:active { background: var(--bg-main-active); }

.bsp-btn--lg { font-size: 17px; padding: 16px 30px; min-height: 52px; }
.bsp-btn--xl { font-size: 18px; padding: 18px 38px; min-height: 56px; }

/* ---------- Utilities ---------- */
.bsp-hover-underline:hover { text-decoration: underline !important; }
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ---------- Skip link ---------- */
.bsp-skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 100;
  background: var(--space-explorer-600);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 120ms ease;
}
.bsp-skip-link:focus,
.bsp-skip-link:focus-visible {
  top: 0;
  color: #fff;
  outline: 2px solid var(--input-focus-outline);
  outline-offset: 2px;
}

/* ---------- Announcement bar ---------- */
.bsp-topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--background-brand-highlight);
  color: var(--text-status-success-dark);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  flex-wrap: wrap;
  text-align: center;
}
.bsp-topbar a { color: var(--text-status-success-dark); font-weight: 600; margin-left: 4px; }
.bsp-topbar a:hover { text-decoration: underline; }
.bsp-topbar .fa-star { font-size: 13px; }

/* ---------- Header / nav ---------- */
.bsp-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 32px;
  background: var(--background-white);
  border-bottom: 1px solid var(--space-explorer-50);
  position: relative;
  font-family: var(--font-body);
}
.bsp-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.bsp-brand img { height: 34px; width: auto; }
.bsp-brand__text { display: flex; flex-direction: column; line-height: 1; }
.bsp-brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 25px;
  letter-spacing: -0.01em;
}
.bsp-brand__name .bs-blue { color: #1c75bc; }
.bsp-brand__name .bs-red { color: #d31b0f; }
.bsp-brand__tag {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--blue-dart-700);
  margin-top: 4px;
}

.bsp-nav__menu { display: flex; align-items: center; gap: 4px; margin-left: 16px; }
.bsp-nav__link,
.bsp-nav__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main-primary);
  background: none;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.bsp-nav__link:hover,
.bsp-nav__toggle:hover { background: var(--bg-main-hover); color: var(--text-main-primary); }
.bsp-nav__link[aria-current="page"] { color: var(--space-explorer-600); font-weight: 600; }
.bsp-nav__toggle .fa-angle-down { font-size: 12px; }

.bsp-dropdown { position: relative; }
.bsp-dropdown__panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  min-width: 240px;
  background: var(--background-white);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(17,29,41,0.1), 0 4px 6px -4px rgba(17,29,41,0.1);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 2px;
}
.bsp-dropdown.is-open .bsp-dropdown__panel { display: flex; }
.bsp-dropdown__panel a {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--dropdown-default-label);
  text-decoration: none;
}
.bsp-dropdown__panel a:hover { background: var(--dropdown-hover-background); color: var(--dropdown-hover-label); }
.bsp-dropdown__panel a[aria-current="page"] { color: var(--space-explorer-600); font-weight: 600; }

.bsp-nav__cta { display: flex; align-items: center; gap: 20px; margin-left: auto; }

.bsp-nav__hamburger {
  display: none;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 20px;
  color: var(--space-explorer-600);
  background: none;
  border: 1px solid var(--tailwind-gray-300);
  border-radius: 8px;
  cursor: pointer;
}

.bsp-mobile-menu {
  display: none;
  background: var(--background-white);
  border-bottom: 1px solid var(--space-explorer-50);
  padding: 12px 20px 20px;
  flex-direction: column;
  gap: 2px;
}
.bsp-mobile-menu.is-open { display: flex; }
.bsp-mobile-menu__label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-main-tertiary);
  padding: 10px 12px 4px;
}
.bsp-mobile-menu a {
  padding: 12px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main-primary);
  text-decoration: none;
}
.bsp-mobile-menu a:hover { background: var(--bg-main-hover); }
.bsp-mobile-menu a[aria-current="page"] { color: var(--space-explorer-600); font-weight: 600; }
.bsp-mobile-menu__divider { border-top: 1px solid var(--space-explorer-50); margin: 8px 0; }
.bsp-mobile-menu__cta { padding: 12px 12px 0; }
/* The generic `.bsp-mobile-menu a` rule (0,1,1) outweighs `.bsp-btn` (0,1,0) and
   would paint the CTA's label dark navy on the dark-blue fill. And on the demo
   page itself, `.bsp-mobile-menu a[aria-current="page"]` (0,2,1) repaints it
   space-explorer-600 on the space-explorer-500 fill. Force white text (and the
   button's own hover fill) with specificity that beats both. */
.bsp-mobile-menu__cta .bsp-btn,
.bsp-mobile-menu__cta .bsp-btn[aria-current="page"],
.bsp-mobile-menu__cta .bsp-btn:hover,
.bsp-mobile-menu__cta .bsp-btn:focus { color: #fff; }
.bsp-mobile-menu__cta .bsp-btn:hover { background: var(--bg-action-hover); }

@media (max-width: 900px) {
  .bsp-nav__menu, .bsp-nav__cta { display: none; }
  .bsp-nav__hamburger { display: inline-flex; }
}

/* ---------- Footer ---------- */
.bsp-footer {
  font-family: var(--font-body);
  background: var(--background-white);
  border-top: 1px solid var(--space-explorer-50);
  padding: 48px 64px 40px;
}
.bsp-footer__cols {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  justify-content: space-between;
}
.bsp-footer__brand { display: flex; flex-direction: column; gap: 14px; max-width: 320px; }
.bsp-footer__brand .bsp-brand img { height: 30px; }
.bsp-footer__brand .bsp-brand__name { font-size: 22px; }
.bsp-footer__brand .bsp-brand__tag { font-size: 8.5px; }
.bsp-footer__tagline { font-size: 14px; line-height: 1.6; color: var(--text-main-secondary); margin: 0; }
.bsp-footer__col { display: flex; flex-direction: column; gap: 10px; min-width: 160px; }
.bsp-footer__heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-main-tertiary);
}
.bsp-footer__col a { font-size: 14px; color: var(--text-main-secondary); text-decoration: none; }
.bsp-footer__col a:hover { color: var(--space-explorer-600); text-decoration: underline; }
.bsp-footer__col a[aria-current="page"] { color: var(--space-explorer-600); font-weight: 600; }
.bsp-footer__legal {
  max-width: 1200px;
  margin: 36px auto 0;
  border-top: 1px solid var(--space-explorer-50);
  padding-top: 20px;
  text-align: center;
}
.bsp-footer__legal p { font-size: 13px; line-height: 1.6; color: var(--text-main-tertiary); margin: 0; }

@media (max-width: 620px) {
  .bsp-footer { padding: 40px 16px 32px; }
}

/* ---------- Demo form (plugin renders .bsp-form) ---------- */
.bsp-form { display: flex; flex-direction: column; gap: 20px; }
.bsp-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.bsp-form__field { display: flex; flex-direction: column; gap: 6px; }
.bsp-form__field label { font-size: 15px; font-weight: 600; color: var(--text-main-primary); }
.bsp-form__req { color: var(--vivid-vermilion-600); }
.bsp-form__optional { font-weight: 400; color: var(--text-main-tertiary); }
.bsp-form__field input,
.bsp-form__field select {
  font-family: var(--font-body);
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid var(--tailwind-gray-300);
  border-radius: 8px;
  color: var(--text-main-primary);
  background: #fff;
}
.bsp-form__field input:focus,
.bsp-form__field select:focus {
  outline: 2px solid var(--input-focus-outline);
  outline-offset: 1px;
  border-color: var(--space-explorer-500);
}
.bsp-form__field input[aria-invalid="true"],
.bsp-form__field select[aria-invalid="true"] { border-color: var(--tailwind-red-700); }
.bsp-form__hint { font-size: 14px; color: var(--text-main-tertiary); }
.bsp-form__error { font-size: 14px; color: var(--tailwind-red-700); }
.bsp-form__errors-summary {
  background: var(--tailwind-red-50);
  border: 1px solid var(--tailwind-red-300);
  border-radius: 12px;
  padding: 16px 20px;
  color: var(--tailwind-red-800);
}
.bsp-form__errors-summary h2 { font-size: 17px; margin: 0 0 8px; }
.bsp-form__errors-summary ul { margin: 0; padding-left: 20px; font-size: 15px; }
/* WCAG 2.2 SC 2.5.8 Target Size (Minimum): each error jump-link must present a
   >=24px-tall target and >=24px vertical separation from the next one. */
.bsp-form__errors-summary li { margin: 4px 0; }
.bsp-form__errors-summary a {
  color: var(--tailwind-red-800);
  display: inline-block;
  min-height: 24px;
  padding: 4px 0;
  line-height: 1.5;
}
.bsp-form__success {
  background: var(--tailwind-green-50);
  border: 1px solid var(--tailwind-green-300);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.bsp-form__success .fa-circle-check { font-size: 24px; color: var(--text-status-success-dark); margin-top: 2px; }
.bsp-form__success h2 { font-size: 18px; font-weight: 700; margin: 0 0 4px; color: var(--text-status-success-dark); }
.bsp-form__success p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--text-main-primary); }
.bsp-form__submit { align-self: flex-start; }
.bsp-form__hp { position: absolute !important; left: -9999px; }

@media (max-width: 620px) {
  .bsp-form__row { grid-template-columns: 1fr; }
}

/* ---------- Responsive overrides for page sections (inline styles need !important) ---------- */
@media (max-width: 900px) {
  main section[style] { padding-left: 20px !important; padding-right: 20px !important; }
  section[aria-label="Introduction"] { min-height: 480px !important; }
  section[aria-label="The problem we solve"] img,
  section[aria-label="Meet the Reading Companion"] img { width: 100% !important; min-width: 0 !important; max-width: 560px !important; }
  section[aria-label="The problem we solve"] div[style],
  section[aria-label="Meet the Reading Companion"] div[style] { min-width: 0 !important; }
  main ul[style*="repeat(7"] { grid-template-columns: repeat(4, 1fr) !important; }
  main ul[style*="repeat(5"] { grid-template-columns: repeat(3, 1fr) !important; }
  main ul[style*="repeat(4"], main ol[style*="repeat(4"], main dl[style*="repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }
  main div[style*="repeat(3, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
  main i.fa-arrow-right-long { display: none !important; }
  main section[aria-label="Request a demo"] { padding-top: 40px !important; padding-bottom: 40px !important; }
}
@media (max-width: 620px) {
  main h1 { font-size: clamp(32px, 9vw, 40px) !important; }
  main h2 { font-size: clamp(24px, 7vw, 32px) !important; }
  main ul[style*="repeat(7"], main ul[style*="repeat(5"] { grid-template-columns: repeat(2, 1fr) !important; }
  main div[style*="repeat(3, 1fr)"], main div[style*="repeat(2, 1fr)"] { grid-template-columns: 1fr !important; }
  main div[style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
  main ol[style*="repeat(4"] { grid-template-columns: 1fr !important; }
  main section[style] { padding-left: 16px !important; padding-right: 16px !important; }
  section[aria-label="Introduction"] div[aria-hidden="true"] { background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(255,255,255,0.85) 100%) !important; }
  main div[style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* Hero fallback while photography is pending: keep text readable on plain background */
section[aria-label="Introduction"] { background: var(--space-explorer-50); }

/* Mockup's signature red rule under every hero */
main section[aria-label="Introduction"] { border-bottom: 4px solid #ed232d; }

/* ---------- Fully clickable solution cards (stretched link) ----------
   The card's "Learn more about X" link keeps its descriptive accessible name
   and single tab stop; a ::after overlay makes the whole card the hit area. */
.bsp-card { position: relative; transition: box-shadow 120ms ease; }
.bsp-card:hover { box-shadow: 0 10px 15px -3px rgba(17,29,41,0.12), 0 4px 6px -4px rgba(17,29,41,0.1) !important; }
.bsp-card-link::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.bsp-card:focus-within { outline: 2px solid var(--input-focus-outline); outline-offset: 2px; }

/* WCAG 1.4.3: vermilion-600 measures 4.43:1 on the space-explorer-50 tint (needs 4.5).
   Step small vermilion text down to 700 (6.7:1) on tinted sections only. */
section[aria-label="Meet the Reading Companion"] p[style*="vivid-vermilion-600"],
section[aria-label="The Bookshare Plus solution"] p[style*="vivid-vermilion-600"] {
  color: var(--vivid-vermilion-700) !important;
}

/* ---------- Block editor niceties ---------- */
.editor-styles-wrapper .bsp-btn { pointer-events: none; }
