/* ============================================================
   CSP Fixes — readability patches for legacy content
   Loaded after the theme and after the palette, so it wins.
   ============================================================ */

/* ------------------------------------------------------------------
   1. Colours baked into old content

   Content written under the old light theme carries inline styles
   like style="color:#000" and editor colour classes. On a dark
   background that is black text on near-black.

   An !important declaration in a stylesheet beats an inline style,
   so these neutralise the baked-in values and let text inherit the
   theme palette.
   ------------------------------------------------------------------ */
.entry [style*="color"],
.entry [style*="colour"],
.entry font[color],
.entry span[style],
.entry p[style],
.entry div[style],
.entry td[style],
.entry th[style],
.entry li[style],
.entry strong[style],
.entry em[style]{
  color: inherit !important;
}

.entry [style*="background"]{ background-color: transparent !important; }

/* WordPress editor colour classes */
.entry [class*="has-"][class*="-color"]{ color: inherit !important; }
.entry [class*="has-"][class*="-background-color"]{ background-color: transparent !important; }

/* Headings keep full contrast whatever the old markup said */
.entry h1[style], .entry h2[style], .entry h3[style],
.entry h4[style], .entry h5[style], .entry h6[style],
.entry h1 span[style], .entry h2 span[style], .entry h3 span[style],
.entry h4 span[style], .entry h5 span[style], .entry h6 span[style],
.entry h2 strong, .entry h3 strong, .entry h4 strong,
.entry h2 a, .entry h3 a, .entry h4 a{
  color: var(--bone) !important;
  background: none !important;
}

.entry a[style], .entry a[style] span{ color: var(--signal) !important; }

/* ------------------------------------------------------------------
   2. FAQ and accordion blocks

   Covers the three shapes these usually take: plain h3 + paragraph,
   native <details>, and the div-based accordions most plugins output.
   ------------------------------------------------------------------ */
.entry h3 + p,
.entry h4 + p{
  color: var(--adr-body) !important;
}

/* Native details/summary */
.entry details{
  border: 1px solid var(--line) !important;
  border-radius: 12px;
  background: var(--ink-2) !important;
  margin-top: 12px;
  padding: 0;
}
.entry details summary{
  cursor: pointer;
  padding: 15px 18px;
  font-family: var(--display);
  font-weight: 600;
  color: var(--bone) !important;
  background: none !important;
}
.entry details > *:not(summary){
  padding: 0 18px 16px;
  color: var(--adr-body) !important;
}

/* Generic plugin accordions, matched by common class names */
.entry [class*="accordion"],
.entry [class*="faq"],
.entry [class*="toggle"]{
  background: transparent !important;
  color: inherit !important;
  border-color: var(--line) !important;
}
.entry [class*="accordion"] [class*="title"],
.entry [class*="accordion"] [class*="header"],
.entry [class*="faq"] [class*="question"],
.entry [class*="toggle"] [class*="title"]{
  color: var(--bone) !important;
  background: var(--ink-2) !important;
  border-color: var(--line) !important;
}
.entry [class*="accordion"] [class*="content"],
.entry [class*="accordion"] [class*="panel"],
.entry [class*="faq"] [class*="answer"],
.entry [class*="toggle"] [class*="content"]{
  color: var(--adr-body) !important;
  background: transparent !important;
}

/* ------------------------------------------------------------------
   3. Body copy contrast
   ------------------------------------------------------------------ */
.entry, .entry p, .entry li, .entry td, .entry dd{ color: var(--adr-body); }
.entry strong, .entry b{ color: var(--bone); font-weight: 600; }

/* ------------------------------------------------------------------
   4. Old-theme leftovers
   ------------------------------------------------------------------ */
.entry table, .entry table[style]{
  background: transparent !important;
  border-collapse: collapse;
  width: 100%;
}
.entry table td, .entry table th{
  border: 1px solid var(--line) !important;
  padding: 10px 12px;
  color: var(--adr-body) !important;
}
.entry table th{
  background: var(--adr-line-soft) !important;
  color: var(--bone) !important;
}
.entry img[style], .entry figure[style]{ background: none !important; border-radius: 12px; }
.entry hr{ border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }
.entry blockquote, .entry blockquote p{ color: var(--adr-quote) !important; }
.entry p:empty{ display: none; }

/* ------------------------------------------------------------------
   5. Jetpack sharing
   ------------------------------------------------------------------ */
.sharedaddy, .sharedaddy .sd-content, div.sharedaddy h3.sd-title{
  color: var(--muted) !important;
  background: none !important;
}
div.sharedaddy h3.sd-title{
  font-family: var(--display);
  font-size: 14px !important;
  padding-left: 0 !important;
  margin-top: 30px !important;
}
div.sharedaddy h3.sd-title::before{ display: none !important; }
.sharedaddy ul{ padding-left: 0 !important; }
.sharedaddy .sd-content ul li a.sd-button{
  background: var(--ink-2) !important;
  border: 1px solid var(--line) !important;
  color: var(--bone) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}
.sharedaddy .sd-content ul li a.sd-button:hover{ border-color: var(--signal) !important; }

/* ------------------------------------------------------------------
   6. Comments
   ------------------------------------------------------------------ */
#comments input[type=text], #comments input[type=email],
#comments input[type=url], #comments textarea{
  background: var(--ink) !important;
  border: 1px solid var(--line) !important;
  color: var(--bone) !important;
  border-radius: 10px !important;
  padding: 12px 15px !important;
}
#comments label, #comments .comment-notes,
#comments .comment-form-cookies-consent label{ color: var(--muted) !important; }
#comments .comment-author, #comments .comment-meta,
#comments .comment-meta a{ color: var(--muted) !important; }
#comments .comment-body{ color: var(--adr-body) !important; }

/* ------------------------------------------------------------------
   7. Cookie notice
   ------------------------------------------------------------------ */
#cookie-notice, .cookie-notice-container{
  background: var(--ink-2) !important;
  color: var(--bone) !important;
  border-top: 1px solid var(--line);
}
#cookie-notice .cn-button, #cookie-notice .cn-set-cookie{
  background: var(--signal) !important;
  color: var(--adr-on-signal) !important;
  border-radius: 100px !important;
  font-weight: 600;
}

/* ------------------------------------------------------------------
   8. Trust badges never invisible
   ------------------------------------------------------------------ */
.ftr .trust{ display: flex !important; }
.ftr .trust a{ text-decoration: none; }

@media (max-width: 600px){
  .entry h3{ font-size: 18px; }
  .entry h3 + p{ padding: 14px; }
}
