/*!
 * Prayer Dome — universal text containment and phone reflow
 * ===========================================================================
 * Loaded last on every page (after its inline <style>) so it can neutralise
 * legacy nowrap labels, fixed widths and hover-only panels without fighting
 * the design system:
 *
 *   • no word leaves its tab, pill, button, card, header or table cell
 *   • long names, roles and bios wrap instead of being clipped
 *   • filter rows wrap, and scroll sideways when there are many options
 *   • cards grow with their content and clip only their own decoration
 *   • a 360 px phone never scrolls sideways
 */

/* ---------------------------------------------------------------- 1. roots */
html,
body {
  max-width: 100%;
  min-width: 0;
  margin: 0;          /* pages without their own reset must not sit 8 px right */
  padding: 0;
  overflow-x: clip; /* guard only; the rules below stop the overflow */
}

/* The document itself must always scroll vertically.
   `!important` is deliberate: a single stray `overflow: hidden` that reaches
   the root element — a component class, a page style, a browser extension —
   otherwise stops EVERY page from scrolling and makes any field below the
   fold impossible to reach or tap on a phone (Android cannot scroll an input
   into view, so the tap does nothing and the keyboard never opens).
   The navigation drawer still locks scrolling, but it does that on <body>
   (`body.pd-nav-open`), which this rule does not touch. */
html {
  overflow-y: auto !important;
}

@supports not (overflow: clip) {
  html,
  body {
    overflow-x: hidden;
  }
}

/* Smooth scrolling for anchor links and in-page movement; visitors who asked
   for reduced motion get instant scrolling (brand stylesheet overrides this
   under prefers-reduced-motion: reduce). */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

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

/* Flex/grid children default to min-width:auto, the usual reason a long word
   pushes a card wider than the screen. */
* {
  min-width: 0;
}

img,
video,
canvas,
iframe,
embed,
object {
  max-width: 100%;
  height: auto;
}

svg {
  max-width: 100%;
}

/* Oversized decorative glows are clipped to the viewport.
   The selector list is wrapped in :where() on purpose. A bare
   `[class*="aurora"]` also matches the <html> element, because pd-motion.js
   marks the root element `pd-has-aurora`. With normal specificity that
   handed the whole document `overflow: hidden`, so no page could scroll and
   fields below the fold could not be tapped on a phone. :where() keeps this
   decoration rule at zero specificity so it can never outrank the document
   rules above. */
:where(.pd-aurora, [class*="aurora"], [class*="glow-orb"], [class*="bg-orb"]) {
  max-width: 100vw;
  overflow: hidden;
}

/* --------------------------------------------------------- 2. text wrapping */
h1, h2, h3, h4, h5, h6,
p, li, dt, dd, blockquote, figcaption,
label, legend, summary,
td, th,
strong, em, small, b, i, u, s,
a, button, span {
  overflow-wrap: break-word;
  /* Words break between words by default; only a single token wider than the
     line is split (overflow-wrap above). `word-break: break-word` here used to
     make short words break mid-word inside narrow cards. */
  word-break: normal;
  max-width: 100%;
}

h1, h2, h3, h4, h5, h6,
p, li, label, blockquote, figcaption {
  white-space: normal;
  text-wrap: pretty;
  hyphens: auto;
  text-overflow: clip;
}

/* ------------------------------------------------------ 3. buttons and pills */
button,
.btn,
.pd-btn,
.pd-acad-btn,
.btn-sm,
.action-chip,
.filter-chip,
.filter-btn,
.tab-btn,
.tab-item,
.app-tab,
.main-tab,
.cr-tab,
.category-btn,
.version-btn,
.pill,
.badge,
.team-badge,
.pd-acad-chip,
.news-cat,
.pd-news-cat,
.pd-news-cat-pill,
.online-pill,
.live-pill,
.draft-pill,
.duration-pill,
.connection-pill,
.lang-pill,
.amt-chip,
.cr-chip,
.cr-pill,
.suggestion-chip,
.topic-chip {
  max-width: 100%;
  min-width: 0;
  height: auto;
  white-space: normal;
  /* Words wrap between words. `word-break: break-word` used to split
     "Dashboard" into "Dashbo/ard" (and worse, one letter per line) whenever a
     button's label column was squeezed by an icon and 28 px of padding. */
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  line-height: 1.3;
  text-overflow: clip;
}

/* An icon is never the element that gets squeezed: it keeps its box, and the
   label keeps enough room for at least one whole word. */
button > i,
button > .pd-i,
.btn > i,
.btn > .pd-i,
.pd-btn > i,
.pd-btn > .pd-i,
.action-chip > i,
.filter-chip > i,
.filter-btn > i,
.tab-btn > i,
.category-btn > i {
  flex: 0 0 auto;
  max-width: none;
}

button,
.btn,
.pd-btn,
.action-chip,
.filter-chip,
.filter-btn,
.tab-btn,
.app-tab,
.main-tab,
.category-btn,
.version-btn {
  text-align: center;
}

/* ------------------------------------------------- 4. tabs and filter rows */
.category-tabs,
.filter-bar,
.filter-row,
.filters,
.filter-buttons,
.filter-chips,
.tabs,
.app-tabs,
.main-tabs,
.cr-tabs,
.cr-cat-chips,
.tab-container,
.tab-wrapper,
.pd-acad-filters,
.pd-reaction-bar,
.team-badges,
.hero-cta,
.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

.category-tabs,
.filter-bar,
.filter-row,
.filters,
.filter-buttons,
.filter-chips,
.cr-tabs,
.cr-cat-chips,
.pd-acad-filters,
.version-selector {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 4px 10px 2px; /* room for focus rings and the last pill */
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.category-tabs > *,
.filter-bar > *,
.filter-row > *,
.filters > *,
.filter-buttons > *,
.filter-chips > *,
.cr-tabs > *,
.cr-cat-chips > *,
.pd-acad-filters > *,
.version-selector > * {
  flex: 0 1 auto;
}

.category-tabs {
  flex-wrap: wrap;
}

.category-btn {
  flex: 1 1 auto;
  justify-content: center;
  text-align: center;
  padding-inline: clamp(12px, 4vw, 24px);
}

/* --------------------------------------------------------------- 5. cards */
[class*="card"],
[class*="panel"],
[class*="tile"] {
  max-width: 100%;
  min-width: 0;
}

:is(.team-card, .event-card, .event-item, .prayer-card, .news-card,
    .pd-news-card, .sermon-card, .gallery-item, .archive-card, .upcoming-card,
    .branch-card, .review-card, .book-progress-card, .setup-card, .stat-card,
    .panel-card, .content-card, .glass-card, .pd-acad-card, .pd-card,
    .kpi-card, .portal-item, .pdm-lounge-card, .digital-id-card) {
  overflow: hidden;
  height: auto;
  max-width: 100%;
  min-width: 0;
}

:is(.team-card, .event-card, .event-item, .prayer-card, .news-card,
    .pd-news-card, .sermon-card, .gallery-item, .archive-card, .upcoming-card,
    .branch-card, .review-card, .book-progress-card, .setup-card, .stat-card,
    .panel-card, .content-card, .glass-card, .pd-acad-card, .pd-card,
    .kpi-card, .portal-item, .pdm-lounge-card) :is(h1, h2, h3, h4, h5, h6,
    p, li, label, small, strong, span) {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: break-word;
  word-break: normal;
}

/* Page headers built from .logo-area + .header-actions: keep control labels
   on one line and let the brand take the remaining width. */
.logo-area {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.brand-text {
  min-width: 0;
}

.header-actions {
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
}

.theme-btn,
.back-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  max-width: 100%;
}

/* ------------------------------------------------- 6. team page layout */
/* The bio is the reason the card exists, so it is never a hover-only layer:
   the portrait is a normal block and the bio flows underneath it. The card
   grows; nothing is clipped or left outside. */
.team-image {
  height: auto;
  display: flex;
  flex-direction: column;
}

.team-image > img {
  width: 100%;
  height: 320px;
  flex: 0 0 auto;
  object-fit: cover;
}

.team-overlay {
  position: static;
  transform: none !important;
  width: 100%;
  max-width: 100%;
  padding: 14px 18px;
  background: linear-gradient(180deg, #07244d, #07244def);
}

.team-overlay:has(p:empty) {
  display: none;
}

.team-overlay p {
  margin: 0;
  color: #fff;
  font-size: .84rem;
  line-height: 1.6;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.team-card:hover {
  transform: none;
}

.team-card:hover .team-image img {
  transform: none;
}

.team-header {
  gap: 10px;
  flex-wrap: nowrap;
}

.team-header .logo-area {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.team-header .brand-text {
  min-width: 0;
}

.team-header .brand-text h1,
.team-header .brand-text p {
  overflow-wrap: break-word;
  word-break: normal;
}

.team-header .header-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.team-header .back-btn,
.team-header .theme-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.team-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  max-width: 100%;
  min-width: 0;
}

.team-card {
  min-width: 0;
  max-width: 100%;
}

.team-name,
.team-title,
.team-memorial,
.team-overlay p {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  text-overflow: clip;
  overflow: visible;
}

.team-badges {
  justify-content: center;
}

.team-badge {
  max-width: 100%;
}

.team-image {
  min-width: 0;
}

/* Card media frames are flex children of a <button> card and the UA centres
   them; stretch them so an unloaded image cannot collapse the frame and push
   its duration badge off-screen. */
.sermon-card,
.news-card,
.pd-news-card,
.event-card,
.team-card {
  align-items: stretch;
}

:is(.card-media, .card-image, .card-thumb, .card-cover, .news-image,
    .event-image, .team-image) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Chat header room name and description were inline nowrap + ellipsis. */
#currentRoomName,
#currentRoomDesc {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
}

.chat-area-header {
  flex-wrap: wrap;
  gap: 8px;
}

.chat-area-title,
.chat-area-title h2,
.chat-area-title p {
  min-width: 0;
  max-width: 100%;
}

.chat-actions {
  flex-shrink: 0;
}

/* ---------------------------------------------- 7. the 360 px phone layout */
@media (max-width: 600px) {
  :is(.main-container, .container, .content, .page-container, .main-content,
      .pd-page, .pd-section, .wrapper) {
    padding-left: 16px;
    padding-right: 16px;
    max-width: 100%;
  }

  :is(.team-grid, .gallery-grid, .reviews-grid, .pod-grid, .sermons-grid,
      .news-grid, .pd-news-grid, .events-grid, .facebook-posts-grid,
      .pd-acad-grid-3, .pd-acad-grid-4, .testimonies-grid, .services-grid,
      .values-grid, .teaching-docs-grid, .prayer-grid, .radio-grid,
      .video-grid, .list) {
    grid-template-columns: minmax(0, 1fr) !important;
    max-width: 100%;
  }

  .stats-grid,
  .portal-grid,
  .kpi-grid,
  .profile-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .portal-item,
  .stat-card,
  .kpi-card {
    padding: 14px 10px;
  }

  .stat-number {
    font-size: clamp(1.4rem, 8vw, 2.1rem);
  }

  .stat-label {
    font-size: .7rem;
    letter-spacing: 0;
    line-height: 1.3;
  }

  /* Legacy inline min-widths on form rows and cards. */
  [style*="min-width: 2"],
  [style*="min-width:2"],
  [style*="min-width: 3"],
  [style*="min-width:3"] {
    min-width: 0 !important;
  }

  .founder-featured {
    padding: 26px 18px;
    border-radius: 24px;
  }

  .founder-featured h1 {
    font-size: clamp(1.55rem, 8vw, 2.2rem);
  }

  .founder-featured h3 {
    font-size: clamp(1rem, 5.4vw, 1.25rem);
  }

  .founder-featured p {
    font-size: .95rem;
    line-height: 1.65;
  }

  .founder-image {
    width: 132px;
    height: 132px;
  }

  .team-image > img {
    height: clamp(220px, 72vw, 300px);
  }

  .team-overlay {
    padding: 13px 16px;
  }

  .team-overlay p {
    font-size: .82rem;
    line-height: 1.55;
  }

  .team-header {
    padding: 10px 14px;
    gap: 8px;
  }

  .team-header .logo-ring {
    width: 40px;
    height: 40px;
  }

  .team-header .brand-text h1 {
    font-size: .98rem;
    letter-spacing: .4px;
    line-height: 1.15;
  }

  .team-header .brand-text p {
    font-size: .55rem;
    letter-spacing: .6px;
  }

  .team-header .back-btn,
  .team-header .theme-btn {
    padding: 8px 11px;
    font-size: .78rem;
    gap: 6px;
  }

  /* Filter rows stay reachable: wrap where they fit, scroll inside their own
     row where there are many options, never sideways on the page. */
  :is(.filter-bar, .filter-row, .filters, .filter-buttons, .filter-chips,
      .cr-tabs, .cr-cat-chips, .pd-acad-filters, .version-selector) {
    flex-wrap: wrap;
    overflow-x: auto;
    padding-inline-end: 18px;
    scroll-padding-inline: 8px;
  }

  .category-btn,
  .filter-chip,
  .filter-btn,
  .tab-btn,
  .app-tab,
  .main-tab,
  .version-btn {
    flex: 1 1 auto;
    max-width: 100%;
  }

  .app-tabs {
    flex-wrap: wrap;
    border-radius: 20px;
  }

  .app-tab {
    flex: 1 1 calc(50% - 10px);
  }

  .calendar-header {
    gap: 8px;
  }

  .current-month {
    font-size: clamp(1.05rem, 6vw, 1.4rem);
    overflow-wrap: break-word;
    word-break: normal;
  }

  .calendar-container {
    padding: 14px;
    border-radius: 20px;
  }

  .calendar-nav button {
    padding: 8px 12px;
  }

  .calendar-day {
    padding: 4px;
    border-radius: 10px;
  }

  .action-chip {
    max-width: 100%;
    flex: 0 1 auto;
    justify-content: center;
  }

  .chat-area-header {
    padding-inline: 12px;
  }

  .chat-area-title h2 {
    font-size: 1rem;
  }

  .chat-area-title p {
    font-size: .72rem;
    line-height: 1.4;
  }

  .archive-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .share-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .live-layout {
    max-width: 100%;
    overflow-x: hidden;
  }

  input,
  select,
  textarea {
    max-width: 100%;
  }

  table {
    max-width: 100%;
  }

  td,
  th {
    overflow-wrap: break-word;
    word-break: normal;
  }

  .modal-card,
  .modal-content,
  .event-modal-content {
    width: min(100% - 20px, 640px) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
  }

  .toast,
  .pd-toast {
    max-width: calc(100vw - 24px);
    white-space: normal;
  }
}

/* Tiny phones (iPhone SE / 320 px) get one step tighter. */
@media (max-width: 380px) {
  .category-tabs,
  .filter-bar,
  .filter-row,
  .filters,
  .filter-buttons,
  .filter-chips {
    gap: 6px;
  }

  .category-btn {
    padding-inline: 10px;
    font-size: .78rem;
  }

  .app-tab {
    flex-basis: 100%;
  }

  .portal-grid,
  .stats-grid,
  .kpi-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* ------------------------------------------------ 8. horizontal filter rails
   The ministry asked for one predictable gesture on a phone: filter/tab rows
   stay on one line and swipe sideways, rather than stacking into a tall wall
   of buttons. These rules come last so they win over page-level `flex-wrap`
   and the earlier "wrap where they fit" mobile rule. */
@media (max-width: 760px) {
  :is(.category-tabs, .filter-bar, .filter-row, .filters, .filter-buttons,
      .filter-chips, .cr-tabs, .cr-cat-chips, .pd-acad-filters,
      .version-selector, .tab-container, .tabs, .tab-wrapper, .main-tabs,
      .app-tabs, .calls-tab-header, .ai-filter, .pd-news-filters,
      .news-filters, .resource-filters, .prayer-filters, .gallery-filters,
      .event-filters) {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    max-width: 100%;
    padding-inline: 4px;
    padding-bottom: 9px;
    gap: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 8px;
    overscroll-behavior-x: contain;
  }
  :is(.category-tabs, .filter-bar, .filter-row, .filters, .filter-buttons,
      .filter-chips, .cr-tabs, .cr-cat-chips, .pd-acad-filters,
      .version-selector, .tab-container, .tabs, .tab-wrapper, .main-tabs,
      .app-tabs, .calls-tab-header, .ai-filter, .pd-news-filters,
      .news-filters, .resource-filters, .prayer-filters, .gallery-filters,
      .event-filters)::-webkit-scrollbar {
    display: none;
    height: 0;
  }
  :is(.category-tabs, .filter-bar, .filter-row, .filters, .filter-buttons,
      .filter-chips, .cr-tabs, .cr-cat-chips, .pd-acad-filters,
      .version-selector, .tab-container, .tabs, .tab-wrapper, .main-tabs,
      .app-tabs, .calls-tab-header, .ai-filter) > * {
    flex: 0 0 auto !important;
    max-width: min(86vw, 320px);
    scroll-snap-align: start;
    white-space: normal;
  }
  :is(.tab-container, .tabs, .tab-wrapper, .main-tabs) > :is(button, a, .tab, .tab-btn, .main-tab) {
    min-width: max-content;
    flex-basis: auto !important;
  }
  .app-tab { flex-basis: auto !important; }
}

/* ==========================================================================
   5. PROFESSIONALISATION PASS — global typography, geometry and controls
   --------------------------------------------------------------------------
   The application grew several card systems (24 px, 20 px and 32 px radii,
   15 px/28 px buttons, 40 px card padding). On a phone that read as oversized
   bubbles with labels squeezed between an icon and a lot of padding. These
   late rules bring every page onto one scale without touching the bespoke
   full-screen shells (chat, live, admin) that deliberately set their own.
   ========================================================================== */

/* ---- root typography ---------------------------------------------------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.24;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

p, li {
  line-height: 1.62;
}

/* Names, positions and titles always read left-to-right. A container may be
   narrow; a person's name must never stack one letter per line. */
h1, h2, h3, h4, h5, h6,
[class*="name"], [class*="title"], [class*="heading"],
.founder-name, .card-name, .team-name, .cr80-name, .idc-org {
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  word-break: normal !important;
  overflow-wrap: break-word;
}

/* ---- one card geometry -------------------------------------------------- */
 .glass-card, .content-card, .branch-card, .portal-item, .game-stat-card,
  .review-card, .pd-acad-card, .auth-card, .team-card, .panel-card, .modal-card,
  .stat-card, .settings-block, .spiritual-card, .notif-card, .care-form-card,
  .req-card, .benefit-card, .contact-form-card, .contact-info-card,
  .video-card, .event-card, .news-card, .sermon-card, .resource-card {
  border-radius: 16px;
}

/* Padding that grows with the viewport instead of staying at 40 px on a
   360 px phone (where 80 px of the width was gone before any content). */
 .auth-card, .glass-card, .content-card, .contact-form-card,
  .contact-info-card, .care-form-card, .settings-block {
  padding: clamp(16px, 4.4vw, 26px);
}

/* ---- compact, readable buttons ------------------------------------------ */
.btn,
.btn-submit,
.btn-primary,
.btn-outline,
.btn-secondary,
.pd-acad-btn,
.pd-btn,
.upload-btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: clamp(10px, 2.2vw, 12px) clamp(14px, 3.4vw, 20px);
  border-radius: 10px;
  font-size: clamp(0.82rem, 2.6vw, 0.95rem);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

/* Full-width buttons keep their width; a side-by-side pair still fits,
   because the label no longer needs 56 px of horizontal padding. */
.btn[style*="width: auto"] { width: auto; }

.btn > i,
.btn > .pd-i,
.btn-submit > i,
.pd-acad-btn > i,
.pd-btn > i,
.upload-btn-small > i {
  flex: 0 0 auto;
  margin: 0;
}

/* Icon-only buttons stay square and tappable. */
.btn[aria-label]:not(:has(span)):not(:has(strong)) {
  min-width: 44px;
}

/* A pair of action buttons must never squeeze a two-word label into a
   vertical stack on a small phone: they wrap to their own rows instead. */
 .profile-actions, .card-actions, .admin-actions-row, .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

 .profile-actions > .btn, .card-actions > .btn, .admin-actions-row > .btn {
  flex: 1 1 150px;
  min-width: 0;
}

/* ---- consistent, accessible interaction -------------------------------- */
a,
button,
input,
select,
textarea,
[tabindex] {
  -webkit-tap-highlight-color: rgba(10, 77, 155, 0.12);
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent-gold, #d4af37);
  outline-offset: 2px;
}

/* iOS zooms the whole page when a focused field is under 16 px. */
@media (max-width: 820px) {
  input,
  select,
  textarea {
    font-size: max(16px, 1rem);
  }
}


/* ---- keep decoration from becoming a layout bug ------------------------- */
 .branch-card > *, .content-card > *, .glass-card > *, .pd-acad-card > *,
  .team-card > *, .news-card > *, .event-card > *, .review-card > * {
  min-width: 0;
}

/* ==========================================================================
   9. DATA TABLES — readable columns, sideways scroll, never vertical text
   --------------------------------------------------------------------------
   A wide table keeps its column geometry and scrolls inside this wrapper.
   PDApp.tables (assets/pd-app.js) wraps every table that is not already inside
   .table-responsive/.report-table and sets --pd-table-min from the real column
   count. The rules below are last in the cascade so page-level `th`/`td`
   styles cannot re-introduce one-letter columns.
   ========================================================================== */
.pd-table-scroll,
.table-responsive,
.report-table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(10, 77, 155, .35) transparent;
}

.pd-table-scroll > table,
.table-responsive > table,
.report-table > table {
  width: 100%;
  max-width: none;
  min-width: var(--pd-table-min, 720px);
  table-layout: auto;
  border-collapse: collapse;
}

.pd-table-scroll > table > caption,
.table-responsive > table > caption,
.report-table > table > caption {
  text-align: left;
  padding: 0 0 10px;
  color: inherit;
  font-weight: 700;
}

/* Headings stay on one line and read left-to-right. A long heading widens its
   column and the wrapper scrolls; it is never broken into letters. */
.pd-table-scroll th,
.table-responsive th,
.report-table th {
  min-width: 104px;
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  hyphens: manual !important;
}

/* Data may wrap between words, and only a single over-wide token (a URL or a
   long email) may break. The 96 px floor keeps every column wide enough for
   real words before that fallback is needed. */
.pd-table-scroll td,
.table-responsive td,
.report-table td {
  min-width: 96px;
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
  white-space: normal;
  word-break: normal !important;
  overflow-wrap: break-word;
  hyphens: manual !important;
}

.pd-table-scroll :is(p, span, strong, em, small, a),
.table-responsive :is(p, span, strong, em, small, a),
.report-table :is(p, span, strong, em, small, a) {
  overflow-wrap: break-word;
  word-break: normal;
}

/* A deliberately long token (stream key, verification URL, QR payload) opts
   into character breaking. It is the only place where that is desirable. */
.pd-table-scroll .pd-break-token,
.pd-table-scroll .rtmp-box,
.pd-table-scroll .cr80-qr-fallback {
  overflow-wrap: anywhere;
  word-break: break-all;
}

.pd-table-scroll:focus-visible,
.table-responsive:focus-visible,
.report-table:focus-visible {
  outline: 3px solid var(--accent-gold, #d4af37);
  outline-offset: 2px;
  border-radius: 8px;
}

@media (max-width: 720px) {
  .pd-table-scroll th,
  .table-responsive th,
  .report-table th,
  .pd-table-scroll td,
  .table-responsive td,
  .report-table td {
    padding: 11px 13px;
  }
}

/* Printing a receipt or a report should not create a sideways-scrolling page. */
@media print {
  .pd-table-scroll,
  .table-responsive,
  .report-table {
    overflow: visible !important;
  }
  .pd-table-scroll > table,
  .table-responsive > table,
  .report-table > table {
    min-width: 0 !important;
    width: 100% !important;
  }
  .pd-table-scroll th,
  .pd-table-scroll td,
  .table-responsive th,
  .table-responsive td,
  .report-table th,
  .report-table td {
    white-space: normal !important;
    overflow-wrap: break-word;
  }
}

/* ------------------------------------------------------ 10. Explore grid
   The home-page Explore destinations are a four-column grid at every width —
   phone, tablet and desktop. Older rules in this file and in pd-brand.css
   collapsed the grid to three, two or one column; those overrides are
   intentionally superseded here so all 23 destinations keep the same
   predictable shape and every tile stays tappable. Labels wrap between words
   only: no vertical letter stacking and no horizontal scrolling rail. */
.portal-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
  align-items: start;
  overflow: visible;
}
.portal-grid > .portal-item {
  min-width: 0 !important;
  max-width: 100%;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
}
.portal-grid > .portal-item > span {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
  line-height: 1.25;
}
@media (max-width: 600px) {
  .portal-grid {
    gap: 8px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .pd-home .portal-grid .portal-item {
    padding: 8px 2px;
    border-radius: 14px;
  }
  .pd-home .portal-grid .portal-icon {
    width: min(44px, 100%);
    height: auto;
    aspect-ratio: 1;
    font-size: 1.1rem;
    margin-bottom: 6px;
  }
  .pd-home .portal-grid .portal-item span,
  .portal-grid > .portal-item > span {
    font-size: .6rem;
    letter-spacing: 0;
    line-height: 1.2;
    margin-top: 4px;
  }
}
@media (max-width: 380px) {
  .portal-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  .pd-home .portal-grid .portal-icon {
    width: min(38px, 100%);
    border-radius: 12px;
  }
  .portal-grid > .portal-item > span {
    font-size: .56rem;
  }
}

/* ------------------------------------------------------ 11. Desktop spacing
   Keep stacked cards, branch badges and fixed-bottom footers from colliding
   on wider desktop viewports so words never sit on top of other words. */
@media (min-width: 721px) {
  .pd-home .founder-card,
  .ask-card {
    margin-top: 24px;
  }
  .pd-home .dc-wrap {
    margin-bottom: 12px;
  }
  .pd-bottom-nav-page footer {
    scroll-margin-bottom: 120px;
  }
  .hero h1,
  .hero > p,
  .pd-hero-headline,
  .pd-hero-subtext {
    line-height: 1.32;
  }
}

