/* Contrast overrides to ensure text/buttons remain visible across mixed theme pages.
  Loaded LAST. Intentionally limited to main content areas. */

main .card:not(.callout-muted), main .panel, main .box, main .sheet, main .content, main .paper, main .section,
.card:not(.callout-muted), .panel, .box {
  background: rgba(18,24,38,.85) !important;
  color: var(--text, #e7edf7) !important;
  border-color: var(--line, rgba(255,255,255,.12)) !important;
}

main .card *, main .panel *, main .box * {
  color: inherit;
}

/* Callout cards should be dark too (site is fully dark themed) */
.card.callout-muted{
  background: rgba(18,24,38,.85) !important;
  color: var(--text, #e7edf7) !important;
  border-color: var(--line, rgba(255,255,255,.12)) !important;
}
.card.callout-muted .muted,
.card.callout-muted .small{
  color: var(--muted, rgba(231,237,247,.72)) !important;
}

/* Light pages can still use this: if a page defines --card and uses it, prefer that. */
:root{
  --card: rgba(18,24,38,.85);
}

/* Notices / callouts / footnotes */
.notice, .callout, .note, .tip, .warning, .legal-note, .keytakeaway {
  background: rgba(99,179,237,.12) !important;
  border-color: rgba(99,179,237,.35) !important;
  color: var(--text, #e7edf7) !important;
}

/* Muted helper text */
.muted, .subtle, .helper, .fineprint, .small.muted {
  color: var(--muted, rgba(231,237,247,.72)) !important;
}

/* Buttons */
a.btn, button.btn, .btn, .navcta, input[type="submit"], input[type="button"], button {
  background: linear-gradient(180deg, rgba(79,143,192,.95), rgba(47,111,159,.92)) !important;
  color: #07121f !important;
  border-color: rgba(255,255,255,.18) !important;
}
a.btn:hover, button.btn:hover, .btn:hover, .navcta:hover, button:hover {
  filter: brightness(1.05);
}

/* Ensure links readable inside cards */
main .card a:not(.btn), main .panel a:not(.btn), main .box a:not(.btn){
  color: #8ec5ff !important;
}
main .card a:not(.btn):hover, main .panel a:not(.btn):hover, main .box a:not(.btn):hover{
  color: #b6dcff !important;
  text-decoration: underline;
}


/* Email button top line should match CTA text color (dark) */
.email-stacked .email-note{
  color: #07121f !important;
}

/* === iPhone / small-screen optimization (loaded last) === */
@media (max-width: 430px){
  /* Prevent accidental horizontal scrolling from long strings */
  body{ overflow-x: hidden; }
  main, p, li, a, code, .wrap{ overflow-wrap: anywhere; word-break: break-word; }

  /* Slightly tighter side padding for iPhone widths */
  .wrap{ padding-left: 16px !important; padding-right: 16px !important; }

  /* Header typography: avoid wrapping / crowding */
  header .brand .name{ font-size: 1.35rem !important; line-height: 1.1 !important; }
  header .brand .tag{ font-size: 0.85rem !important; line-height: 1.2 !important; white-space: normal !important; }

  /* Tap targets (Apple HIG: ~44px) */
  .menu-panel .navlink, .navcta, a.btn, button.btn, .btn{
  min-height: 44px !important;
  display: inline-flex;
  align-items: center;
  }

  /* Tables: scroll horizontally instead of overflowing the layout */
  .service-matrix, .table-wrap, .table-scroll{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  }
  .service-matrix table, table{
  max-width: 100%;
  }

  /* Media should never overflow */
  img, svg, video{ max-width: 100% !important; height: auto !important; }
}

/* Ultra-small devices: allow the "one-line" email CTA to wrap rather than overflow */
@media (max-width: 360px){
  #mobile-button-stack .email-compact{ white-space: normal !important; }
}