/* ==========================================================================
   Kubicum site styles layered on top of the compiled Tailwind bundle.
   Only what Tailwind utilities can't express: rich-text prose + logo swap.
   ========================================================================== */

html {
  scroll-behavior: smooth;
  /* Keep anchor targets clear of the fixed sticky header */
  scroll-padding-top: 90px;
}

/* --- Sticky header: solid background instead of translucent + backdrop-blur.
   backdrop-filter on a fixed element re-blurs the page every scroll frame,
   which causes visible scroll jank (worst under DevTools/automation). A solid
   bar looks near-identical, reads better, and composites cheaply. --- */
.ud-header.sticky {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background-color: #ffffff;
}
html.dark .ud-header.sticky {
  background-color: #111928;
}

/* --- Header logo swap (CSS-driven so it survives hashed static filenames) ---
   Two <img> live in the header; we toggle which is visible.
   - Over the hero (home top): white logo.
   - Sticky / inner light pages: blue logo.
   - Dark mode: always white. */
.header-logo-white {
  display: none;
}
.header-logo-blue {
  display: block;
}
.ud-header--hero:not(.sticky) .header-logo-white {
  display: block;
}
.ud-header--hero:not(.sticky) .header-logo-blue {
  display: none;
}
html.dark .header-logo-white {
  display: block;
}
html.dark .header-logo-blue {
  display: none;
}

/* --- Rich text (Wagtail RichText output has no Tailwind classes) --- */
.rich-text {
  color: #637381;
}
html.dark .rich-text {
  color: #9ca3af;
}
.rich-text > * + * {
  margin-top: 1.15rem;
}
.rich-text h1,
.rich-text h2,
.rich-text h3,
.rich-text h4,
.rich-text h5,
.rich-text h6 {
  font-weight: 700;
  line-height: 1.3;
  color: #111928;
}
.rich-text h1 {
  font-size: 2rem;
  margin-top: 2.25rem;
}
.rich-text h2 {
  font-size: 1.6rem;
  margin-top: 2rem;
}
.rich-text h3 {
  font-size: 1.3rem;
  margin-top: 1.75rem;
}
.rich-text h4 {
  font-size: 1.125rem;
  margin-top: 1.5rem;
}
.rich-text p,
.rich-text li {
  font-size: 1rem;
  line-height: 1.75;
  color: #556170;
}
.rich-text a {
  color: #002b74;
  text-decoration: underline;
}
.rich-text a:hover {
  color: #4a58a9;
}
.rich-text ul {
  list-style: disc;
  padding-left: 1.5rem;
}
.rich-text ol {
  list-style: decimal;
  padding-left: 1.5rem;
}
.rich-text li + li {
  margin-top: 0.4rem;
}
.rich-text blockquote {
  border-left: 4px solid #002b74;
  padding: 0.25rem 0 0.25rem 1.25rem;
  font-style: italic;
  color: #111928;
}
.rich-text b,
.rich-text strong {
  font-weight: 700;
  color: #111928;
}
.rich-text img {
  border-radius: 8px;
  max-width: 100%;
  height: auto;
}
.rich-text hr {
  border: 0;
  border-top: 1px solid #dfe4ea;
}

/* Dark-mode rich text */
html.dark .rich-text h1,
html.dark .rich-text h2,
html.dark .rich-text h3,
html.dark .rich-text h4,
html.dark .rich-text h5,
html.dark .rich-text h6,
html.dark .rich-text b,
html.dark .rich-text strong,
html.dark .rich-text blockquote {
  color: #ffffff;
}
html.dark .rich-text p,
html.dark .rich-text li {
  color: #9ca3af;
}
html.dark .rich-text hr {
  border-top-color: #374151;
}

/* --- Dark-mode accent: the navy primary is invisible as text on dark
   surfaces, so lift primary-coloured text/icons/links/hovers to a light
   periwinkle. Backgrounds (bg-primary buttons, hero) keep the navy. --- */
html.dark .text-primary,
html.dark .hover\:text-primary:hover,
html.dark .group:hover .group-hover\:text-primary,
html.dark .dark\:hover\:text-primary:hover,
html.dark .rich-text a {
  color: #8aa0e8;
}


/* --- Consent-gated analytics --- */
.analytics-consent {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1000;
  max-width: min(420px, calc(100vw - 2rem));
}
.analytics-consent__body {
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(17, 25, 40, 0.16);
  padding: 1rem;
}
.analytics-consent__body p {
  margin: 0;
  color: #374151;
  font-size: 0.95rem;
  line-height: 1.55;
}
.analytics-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}
.analytics-consent__actions button {
  border-radius: 6px;
  border: 1px solid #002b74;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.analytics-consent__actions button:first-child {
  background: #002b74;
  color: #ffffff;
}
.analytics-consent__actions button:last-child {
  background: transparent;
  color: #002b74;
}
html.dark .analytics-consent__body {
  border-color: #374151;
  background: #111928;
}
html.dark .analytics-consent__body p {
  color: #d1d5db;
}
html.dark .analytics-consent__actions button:last-child {
  color: #8aa0e8;
  border-color: #8aa0e8;
}
