/* Higher specificity than the existing :root system-dark variables. Manual
   light/dark choices win without replacing the native global stylesheet. */
html[data-theme="light"] {
  color-scheme: light;
  --tcc-paper: #fbf8f1;
  --tcc-ink: #26172e;
  --tcc-purple: #511b61;
  --tcc-muted: #776d7b;
  --tcc-line: #ded4c5;
  --tcc-cream: #eee0bf;
  --wp--preset--color--theme-1: #fbf8f1;
  --wp--preset--color--theme-5: #26172e;
  --wp--preset--color--paper: #fbf8f1;
  --wp--preset--color--ink: #26172e;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --tcc-paper: #170f20;
  --tcc-ink: #f4eddf;
  --tcc-purple: #ead08b;
  --tcc-muted: #d4c8d4;
  --tcc-line: #53385d;
  --tcc-cream: #30213b;
  --wp--preset--color--theme-1: #170f20;
  --wp--preset--color--theme-5: #f4eddf;
  --wp--preset--color--paper: #170f20;
  --wp--preset--color--ink: #f4eddf;
}
html[data-theme] body {
  background-color: var(--tcc-paper);
  color: var(--tcc-ink);
}
.tcc-companion-button,
.tcc-theme-toggle,
.tcc-legal-quiz button,
.tcc-contributor-filters button,
.tcc-modal-close {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 44px;
  padding: .65rem 1rem;
  border: 1px solid var(--tcc-line, #ded4c5);
  border-radius: 0;
  color: var(--tcc-ink, #26172e);
  background: var(--tcc-paper, #fbf8f1);
  font: inherit;
  line-height: 1.45;
  text-decoration: none;
  cursor: pointer;
}
.tcc-theme-state {
  min-width: 2em;
  font-size: .85em;
  font-weight: 600;
}
.tcc-theme-toggle[aria-checked="true"],
.tcc-contributor-filters button[aria-pressed="true"],
.tcc-quiz-choices button[aria-pressed="true"] {
  border-color: var(--tcc-purple, #511b61);
  background: var(--tcc-cream, #eee0bf);
}
.tcc-legal-quiz button:disabled,
.tcc-contributor-filters button:disabled {
  cursor: default;
}
.tcc-companion-button:focus-visible,
.tcc-theme-toggle:focus-visible,
.tcc-legal-quiz :focus-visible,
.tcc-contributor-filters :focus-visible,
.tcc-newsletter-modal :focus-visible {
  outline: 3px solid var(--tcc-gold, #d4ac34);
  outline-offset: 4px;
}
.tcc-legal-quiz,
.tcc-contributor-filters {
  margin-block: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--tcc-line, #ded4c5);
  color: var(--tcc-ink, #26172e);
  background: var(--tcc-paper, #fbf8f1);
}
.tcc-legal-quiz h2,
.tcc-legal-quiz h3 {
  margin-block: 0 1rem;
}
.tcc-legal-quiz h3 {
  font-size: clamp(1.3rem, 2vw, 1.75rem);
  line-height: 1.35;
}
.tcc-quiz-choices {
  display: grid;
  gap: .75rem;
}
.tcc-quiz-choices button {
  justify-content: flex-start;
  text-align: start;
}
.tcc-quiz-choices button:disabled {
  opacity: 1;
}
.tcc-quiz-progress,
.tcc-latest-article time {
  color: var(--tcc-muted, #776d7b);
  font-size: .85em;
}
.tcc-quiz-feedback:not(:empty) {
  margin-block: 1.25rem;
  padding: 1rem;
  border-inline-start: 3px solid var(--tcc-gold, #d4ac34);
  background: var(--tcc-cream, #eee0bf);
}
.tcc-quiz-actions,
.tcc-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}
.tcc-filter-pills button {
  border-radius: 999px;
}
.tcc-share-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
  padding: 1rem;
  border: 1px dashed var(--tcc-line, #ded4c5);
}
.tcc-latest-articles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1.5rem;
  margin-block: 1.5rem;
}
.tcc-latest-article {
  min-width: 0;
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--tcc-line, #ded4c5);
}
.tcc-latest-article img {
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
}
.tcc-latest-article h3 {
  font-size: 1.6rem;
  margin-block: .8rem .5rem;
}
.tcc-latest-article h3 a,
.tcc-byline a {
  color: var(--tcc-purple, #511b61);
}
.tcc-byline .wp-block-post-author__name {
  margin: 0;
}
.tcc-byline .wp-block-post-author__byline {
  margin: 0 0 .2rem;
}
.tcc-newsletter-modal {
  box-sizing: border-box;
  width: min(38rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--tcc-line, #ded4c5);
  border-block-start: 3px solid var(--tcc-gold, #d4ac34);
  background: var(--tcc-paper, #fbf8f1);
  color: var(--tcc-ink, #26172e);
  overscroll-behavior: contain;
}
.tcc-newsletter-modal::backdrop {
  background: rgb(20 10 26 / 75%);
}
.tcc-newsletter-dialog-body {
  padding: clamp(1.25rem, 4vw, 2.5rem);
}
.tcc-newsletter-dialog-body h2 {
  color: var(--tcc-ink, #26172e);
  margin-block: 1rem;
}
.tcc-modal-close {
  display: flex;
  margin-inline-start: auto;
}
.tcc-newsletter-modal a {
  color: var(--tcc-purple, #511b61);
}
.tcc-newsletter-modal .wp-block-jetpack-subscriptions {
  margin-block: 1.25rem;
}
.tcc-newsletter-modal .wp-block-jetpack-subscriptions input[type="email"] {
  box-sizing: border-box;
  max-width: 100%;
  background: var(--tcc-paper, #fbf8f1);
  color: var(--tcc-ink, #26172e);
  border-color: var(--tcc-line, #ded4c5);
}
.tcc-newsletter-modal .wp-block-jetpack-subscriptions button[type="submit"] {
  background: var(--tcc-gold, #d4ac34);
  color: #210d2b;
}
/* Explicit hidden overrides prevent card layout classes from defeating filtering. */
.tcc-contributor-card[hidden],
.tcc-legal-quiz [hidden],
.tcc-contributor-filters [hidden] {
  display: none !important;
}
@media (max-width: 480px) {
  .tcc-legal-quiz,
  .tcc-contributor-filters { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .tcc-companion-button,
  .tcc-theme-toggle,
  .tcc-legal-quiz *,
  .tcc-newsletter-modal * { scroll-behavior: auto; transition: none; }
}
@media print {
  .tcc-theme-toggle,
  .tcc-newsletter-modal,
  .tcc-contributor-filters,
  .tcc-quiz-actions { display: none !important; }
}

/* Native migrated pages retain editor-authored color attributes. Resolve them
   through the chosen palette in either system scheme; never invert artwork. */
html[data-theme] .tcc-page-shell[style*="background-color:#fbf8f1"],
html[data-theme] .tcc-page-shell[style*="background-color: #fbf8f1"] {
  background-color: var(--tcc-paper) !important;
  color: var(--tcc-ink) !important;
}
html[data-theme] .tcc-page-shell :is(h1,h2,h3,h4,p,li,span,a)[style*="color:#26172e"],
html[data-theme] .tcc-page-shell :is(h1,h2,h3,h4,p,li,span,a)[style*="color: #26172e"] {
  color: var(--tcc-ink) !important;
}
html[data-theme] .tcc-page-shell :is(h1,h2,h3,h4,p,li,span,a)[style*="color:#511b61"],
html[data-theme] .tcc-page-shell :is(h1,h2,h3,h4,p,li,span,a)[style*="color: #511b61"] {
  color: var(--tcc-purple) !important;
}
.tcc-parity-navbar .tcc-theme-toggle { margin-left:auto; padding:9px 11px; font-size:11px; }
.tcc-parity-navbar .tcc-theme-toggle .tcc-theme-state { min-width:0; }
.tcc-parity-inline { padding-right:112px; }
.tcc-parity-navbar .tcc-parity-inline > ul > .wp-block-navigation-submenu { right:116px; }
@media(max-width:650px) { .tcc-parity-navbar .tcc-theme-toggle { margin-left:auto; } }
