/* St Mary's — mobile phone optimisation layer — 2026-09-07
   Desktop design is intentionally untouched. */

@media (max-width: 760px) {
  :root { --mobile-gutter: 14px; }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 84px;
  }

  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  img, picture, video, iframe, svg {
    max-width: 100%;
  }

  img, video { height: auto; }

  .content-shell,
  .footer-shell,
  .header-shell {
    width: calc(100% - (var(--mobile-gutter) * 2)) !important;
    max-width: 100% !important;
  }

  /* Keep all grid children shrinkable instead of forcing horizontal scroll. */
  .wow-path-grid > *,
  .image-path-grid > *,
  .wow-event-grid > *,
  .info-card-grid > *,
  .service-card-grid > *,
  .event-grid > *,
  .gallery-grid > *,
  .home-action-grid > *,
  .giving-grid > *,
  .visit-grid > *,
  .form-layout > *,
  .field-row > *,
  .split-section > *,
  .footer-grid > * { min-width: 0 !important; }

  /* Homepage pathway cards: one strong, readable card per row on phones. */
  .wow-path-grid.image-path-grid,
  .image-path-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .image-path-card {
    min-height: 390px !important;
    height: auto !important;
    border-radius: 20px !important;
  }

  .image-path-card > img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .image-path-content {
    padding: 22px !important;
  }

  .image-path-content h3 {
    font-size: clamp(2rem, 10vw, 2.7rem) !important;
    line-height: .98 !important;
  }

  .image-path-content p {
    max-width: 34rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
  }

  .image-path-card .card-text-link {
    white-space: normal !important;
    min-height: 44px !important;
    align-items: center !important;
  }

  /* Generic page cards and content stacks. */
  .home-action-grid,
  .info-card-grid,
  .service-card-grid,
  .event-grid,
  .gallery-grid,
  .giving-grid,
  .visit-grid,
  .whatson-links {
    grid-template-columns: 1fr !important;
  }

  .home-action-card {
    display: block !important;
  }

  .home-action-card > img {
    width: 100% !important;
    height: 190px !important;
    min-height: 0 !important;
    object-fit: cover !important;
  }

  /* Text sizing and line lengths tuned for small screens. */
  p, li { overflow-wrap: break-word; }
  .section-heading,
  .section-heading.narrow,
  .wow-section-head,
  .pathways-intro { max-width: 100% !important; }

  /* Forms: avoid iOS auto-zoom and make controls easy to tap. */
  input,
  select,
  textarea,
  button {
    font-size: 16px !important;
  }

  input,
  select,
  textarea {
    width: 100%;
    max-width: 100%;
    min-height: 46px;
  }

  textarea { min-height: 120px; }

  .button,
  .btn,
  .text-link,
  .primary-nav a,
  .primary-nav button,
  .menu-toggle,
  .menu-close {
    min-height: 44px;
    touch-action: manipulation;
  }

  /* Long emails, URLs and generated content should never spill off-screen. */
  a,
  .person-email-address,
  .contact-methods strong,
  .contact-methods a {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  /* Content media and maps. */
  .split-image,
  .gallery-item,
  .map-frame,
  .content-module-video {
    width: 100% !important;
    max-width: 100% !important;
  }

  .split-image img,
  .gallery-item img {
    width: 100% !important;
    height: auto !important;
  }

  .map-frame,
  .map-frame iframe {
    min-height: 330px !important;
    height: 54vh !important;
    max-height: 480px !important;
  }

  /* Tables remain usable rather than stretching the entire page. */
  .admin-table-wrap,
  .table-wrap,
  .responsive-table,
  main table {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  main table {
    display: block;
    width: 100%;
  }

  /* Better phone spacing, without altering desktop proportions. */
  .content-section,
  .wow-pathways,
  .wow-events {
    padding-top: 52px !important;
    padding-bottom: 52px !important;
  }

  .person-card,
  .public-form,
  .giving-card,
  .service-card-large,
  .event-card,
  .info-card {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  /* Fixed UI respects iPhone safe areas. */
  .mobile-actions {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .cookie-banner {
    max-width: calc(100% - 20px) !important;
  }
}

@media (max-width: 430px) {
  :root { --mobile-gutter: 12px; }

  .image-path-card { min-height: 350px !important; }
  .image-path-content { padding: 19px !important; }
  .image-path-content p { font-size: .96rem !important; }

  .sermon-card,
  .news-article {
    grid-template-columns: 1fr !important;
  }

  .sermon-date,
  .news-meta {
    width: 64px !important;
    height: 64px !important;
  }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 900px) {
  .page-hero,
  .home-hero,
  .wow-hero {
    min-height: 480px !important;
  }
}

/* Mobile header + Ask St Mary's refinements — 2026-09-07 */
@media (max-width: 760px) {
  /* Remove the floating Ask St Mary's launcher on phones only. */
  .chat-launch {
    display: none !important;
  }

  /* Restore the mobile menu/header panel to solid white. */
  .header-shell {
    background: #ffffff !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* 2026-09-07 — Homepage restoration appeal: mobile-only refinement */
@media (max-width: 760px) {
  .wow-appeal {
    padding: 52px 0 58px;
  }

  .wow-appeal .content-shell {
    width: min(100% - 30px, 1180px);
  }

  .wow-appeal-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 26px 22px 22px;
    border-radius: 20px;
    overflow: hidden;
  }

  .wow-appeal-card > div:first-child {
    min-width: 0;
  }

  .wow-appeal-card .eyebrow {
    margin-bottom: 10px;
    font-size: .72rem;
    line-height: 1.2;
    letter-spacing: .14em;
  }

  .wow-appeal-card h2 {
    margin: 0 0 14px;
    font-size: clamp(2rem, 9vw, 2.7rem);
    line-height: 1.02;
    letter-spacing: -.025em;
  }

  .wow-appeal-card h2 br {
    display: none;
  }

  /* Keep “1,000 years” as the main statement, with the remainder as a quieter mobile tagline. */
  .wow-appeal-card h2 .appeal-main-line {
    display: block;
    font: inherit;
    line-height: inherit;
  }

  .wow-appeal-card h2 .appeal-tagline {
    display: block;
    margin-top: .5rem;
    font-size: clamp(.95rem, 4.2vw, 1.12rem);
    line-height: 1.28;
    letter-spacing: .01em;
    font-weight: 600;
  }

  .wow-appeal-card > div:first-child > p:not(.eyebrow) {
    margin: 0 0 20px;
    font-size: .98rem;
    line-height: 1.62;
  }

  .wow-appeal-card .button.primary {
    width: 100%;
    min-height: 50px;
    justify-content: center;
    padding: 13px 18px;
    border-radius: 12px;
    text-align: center;
  }

  .wow-progress {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 4px 12px;
    min-width: 0;
    padding: 20px;
    border-radius: 16px;
  }

  .wow-progress > span {
    grid-column: 1 / -1;
    margin-bottom: 3px;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
  }

  .wow-progress > strong {
    margin: 0;
    font-size: clamp(2rem, 10vw, 2.7rem);
    line-height: 1;
    letter-spacing: -.025em;
  }

  .wow-progress > small {
    margin: 0 0 3px;
    font-size: .76rem;
    line-height: 1.25;
    text-align: right;
  }

  .wow-progress > div {
    grid-column: 1 / -1;
    height: 10px;
    margin-top: 12px;
    overflow: hidden;
    border-radius: 999px;
  }

  .wow-progress > div > i {
    display: block;
    height: 100%;
    border-radius: inherit;
  }

  .wow-progress > b {
    grid-column: 1 / -1;
    margin-top: 6px;
    font-size: .76rem;
    line-height: 1.3;
  }
}

@media (max-width: 420px) {
  .wow-appeal-card {
    padding: 23px 18px 18px;
    border-radius: 17px;
  }

  .wow-progress {
    padding: 17px;
    border-radius: 14px;
  }

  .wow-progress > small {
    max-width: 110px;
  }
}

/* =========================================================
   MOBILE: clean Services / Notices cards — 2026-09-07
   Remove decorative card icons on phones only so the text
   can use the full card width. Desktop/tablet remains intact.
   ========================================================= */
@media (max-width: 680px) {
  /* Featured notices */
  .featured-notices header h2 > .icon,
  .featured-notices .notice-icon,
  .featured-notices .notice-row article > .notice-icon {
    display: none !important;
  }

  .featured-notices .notice-row article {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
  }

  .featured-notices .notice-row article > div {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Services / gatherings cards */
  .events-section .event-card > .event-icon,
  .event-card > .event-icon {
    display: none !important;
  }

  /* Remove the small location glyph but retain the location text. */
  .events-section .event-card small > .icon,
  .event-card small > .icon {
    display: none !important;
  }

  .events-section .event-card small,
  .event-card small {
    gap: 0 !important;
  }
}

/* =========================================================
   MOBILE: homepage Featured Notices icon cleanup (correct selector)
   The homepage uses .wow-notice-grid rather than .featured-notices.
   ========================================================= */
@media (max-width: 680px) {
  .wow-notice-grid article > span:first-child {
    display: none !important;
  }

  .wow-notice-grid article {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
  }

  .wow-notice-grid article > div {
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* =========================================================
   MOBILE: Services & Gatherings cleanup
   Remove date tile and give event text the full card width.
   Desktop remains unchanged.
   ========================================================= */
@media (max-width: 680px) {
  .wow-events .wow-event-grid article {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
    align-items: start !important;
    padding: 22px 20px !important;
  }

  .wow-events .wow-event-grid .wow-event-date {
    display: none !important;
  }

  .wow-events .wow-event-grid article > div:last-child {
    width: 100% !important;
    min-width: 0 !important;
  }

  .wow-events .wow-event-grid article small {
    display: block !important;
    margin: 0 0 6px !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
  }

  .wow-events .wow-event-grid article h3 {
    margin: 0 0 10px !important;
    font-size: clamp(29px, 8vw, 36px) !important;
    line-height: 0.98 !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }

  .wow-events .wow-event-grid article p {
    margin: 0 0 14px !important;
    font-size: 17px !important;
    line-height: 1.55 !important;
  }

  .wow-events .wow-event-grid .wow-place {
    display: block !important;
    margin-top: 10px !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
  }

  .wow-events .wow-event-grid .wow-place > svg,
  .wow-events .wow-event-grid .wow-place > .icon {
    display: none !important;
  }
}

/* Mobile quick-action bar — Gold Ring styling (Option 3) — 2026-09-07 */
@media (max-width: 720px) {
  .mobile-actions {
    min-height: 78px !important;
    padding-top: 8px !important;
    padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    background: rgba(255,255,255,.98) !important;
    border-top: 1px solid rgba(3,21,43,.10) !important;
    box-shadow: 0 -6px 22px rgba(3,21,43,.10) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .mobile-actions > a,
  .mobile-actions > button {
    min-width: 0;
    min-height: 62px;
    gap: 5px !important;
    padding: 0 4px;
    color: var(--blue-deep) !important;
    font-size: .72rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-align: center;
    border: 0 !important;
    background: transparent !important;
    appearance: none;
    -webkit-appearance: none;
  }

  .mobile-actions .icon {
    width: 44px !important;
    height: 44px !important;
    padding: 10px;
    box-sizing: border-box;
    border: 2px solid var(--gold) !important;
    border-radius: 50%;
    color: var(--blue-deep) !important;
    background: #fff;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
  }

  .mobile-actions > *:active .icon,
  .mobile-actions > *:focus-visible .icon {
    background: var(--blue-deep) !important;
    color: var(--gold) !important;
    border-color: var(--gold) !important;
    transform: translateY(-1px);
  }

  .mobile-actions > *:focus-visible {
    outline: none !important;
  }

  .mobile-actions > *:focus-visible span {
    color: var(--blue-deep);
    text-decoration: underline;
    text-decoration-color: var(--gold);
    text-underline-offset: 3px;
  }
}


/* Exact Gold Ring icon treatment — matches approved mobile mock-up — 2026-09-07 */
@media (max-width: 720px) {
  .mobile-actions .icon {
    width: 44px !important;
    height: 44px !important;
    padding: 9px !important;
    stroke-width: 1.65 !important;
  }
  .mobile-actions > a:nth-child(1) .icon { padding: 9px !important; }
  .mobile-actions > button:nth-child(2) .icon { padding: 9px !important; }
  .mobile-actions > a:nth-child(3) .icon { padding: 8px !important; }
  .mobile-actions > a:nth-child(4) .icon { padding: 9px !important; }
}

/* Option 3 – Modern Premium: exact approved mobile quick-action icon family */
@media (max-width: 720px) {
  .mobile-actions .mobile-premium-icon {
    width: 44px !important;
    height: 44px !important;
    padding: 9px !important;
    box-sizing: border-box;
    border: 2px solid var(--gold) !important;
    border-radius: 50%;
    color: var(--blue-deep) !important;
    background: #fff !important;
    overflow: visible;
    stroke-width: initial !important;
  }
  .mobile-actions > a:nth-child(1) .mobile-premium-icon { padding: 10px !important; }
  .mobile-actions > button:nth-child(2) .mobile-premium-icon { padding: 9px !important; }
  .mobile-actions > a:nth-child(3) .mobile-premium-icon { padding: 8px !important; }
  .mobile-actions > a:nth-child(4) .mobile-premium-icon { padding: 10px !important; }
  .mobile-actions > *:active .mobile-premium-icon,
  .mobile-actions > *:focus-visible .mobile-premium-icon {
    background: #fff !important;
    color: var(--blue-deep) !important;
    border-color: var(--gold) !important;
    transform: none !important;
  }
}
