/* ========== FOOTER ========== */
footer {
  background: var(--navy-deep);
  padding: 3rem 2rem 2rem;
  padding-left: max(2rem, env(safe-area-inset-left));
  padding-right: max(2rem, env(safe-area-inset-right));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  position: relative;
}
footer::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.footer-inner { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: row; align-items: center; gap: 2rem; }
.footer-content { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; }
.footer-arms { width: 240px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.footer-brand h3 { font-family: 'Cinzel', serif; font-size: 1.5rem; color: var(--gold); margin-bottom: 0.5rem; font-weight: 600; }
.footer-brand p { font-size: 1rem; color: rgba(255,255,255,0.7); line-height: 1.7; font-weight: 500; }
/* footer address line (footer.php) */
.footer-address { margin-top: 0.75rem; font-size: 0.95rem; color: rgba(255,255,255,0.7); }
.footer-monastery { margin-top: 1.5rem; }
.footer-monastery h4 { font-family: 'Cinzel', serif; font-size: 1rem; color: var(--gold); margin-bottom: 0.4rem; font-weight: 600; }
.footer-monastery p { font-size: 0.95rem; color: rgba(255,255,255,0.7); line-height: 1.7; font-weight: 500; }
.footer-monastery a { color: rgba(255,255,255,0.75); text-decoration: underline; }
.footer-monastery a:hover { color: var(--gold); }
.footer-bottom { max-width: 1100px; margin: 2rem auto 0; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.08); text-align: center; font-size: 0.85rem; color: rgba(255,255,255,0.75); }
.footer-nav { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 1rem; justify-content: center; }
.footer-nav a { color: var(--gold-light); text-decoration: none; font-family: 'Cinzel', serif; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; transition: color 0.3s; min-height: 44px; display: inline-flex; align-items: center; }
.footer-nav a:hover,
.footer-nav a:focus-visible { color: var(--gold); outline: none; }
.footer-social { display: inline-flex; align-items: center; margin-top: 0.75rem; color: var(--gold); text-decoration: none; font-family: 'Cinzel', serif; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; border: 1px solid rgba(201,168,76,0.3); padding: 0.65rem 1.2rem; min-height: 44px; border-radius: 2px; transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease; }
.footer-social:hover,
.footer-social:focus-visible { background: rgba(201,168,76,0.12); border-color: var(--gold); outline: none; }

/* Clear keyboard focus treatment for interactive elements that use custom hover states. */
.nav-links a:focus-visible,
.nav-hamburger:focus-visible,
.lang-opt:focus-visible,
.hero-cta:focus-visible,
.services-link:focus-visible,
.page-hero__back:focus-visible,
.fest-cta:focus-visible,
.footer-nav a:focus-visible,
.footer-social:focus-visible {
  outline: var(--focus-ring-dark);
  outline-offset: 3px;
  border-radius: 3px;
}

.info-card a:focus-visible,
.contact-btn:focus-visible,
.grove-cta:focus-visible,
.picnic-contact-link:focus-visible,
.news-body a:focus-visible,
.news-card__link:focus-visible,
.latest-news-more-link:focus-visible,
.article-back__link:focus-visible,
.accordion-toggle:focus-visible,
.faith-item__header:focus-visible,
.picnic-section a:focus-visible {
  outline: var(--focus-ring-light);
  outline-offset: 3px;
  border-radius: 3px;
}

.picnic-form-field input:focus-visible,
.picnic-form-field textarea:focus-visible {
  outline: var(--focus-ring-light);
  outline-offset: 2px;
}

/* ========== SUB-PAGE HERO ========== */
.page-hero {
  padding: 1.75rem 2rem 1.5rem; min-height: 22vh;
  display: flex; align-items: center; justify-content: center;
  padding-top: calc(var(--nav-height) + 1.75rem);
  position: relative;
}
.page-hero--dark {
  background: var(--navy-deep); text-align: center; overflow: hidden;
}
/* Slim variant used by article pages: breadcrumb only, no big H1 */
.page-hero.page-hero--breadcrumb {
  min-height: 0;
  padding: 0.9rem 2rem;
  padding-top: calc(var(--nav-height) + 0.9rem);
}
.page-hero--breadcrumb .section-label { margin: 0; }
.page-hero__overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(107,28,42,0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(201,168,76,0.1) 0%, transparent 50%);
}
.page-hero__content { position: relative; }
.page-hero__title {
  font-family: 'Cinzel', serif; font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 700;
  color: var(--white); letter-spacing: 0.05em; margin-bottom: 0.5rem;
  overflow-wrap: break-word;
}
.page-hero__line { width: 80px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); margin: 0 auto; }

/* Sticky title bar: fixed-positioned (out of flow) so showing/hiding causes no reflow */
.page-hero-bar {
  position: fixed; top: var(--nav-height); left: 0; right: 0;
  z-index: 40;
  background: rgba(10,18,32,0.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(201,168,76,0.15);
  padding: 0.55rem 2rem;
  text-align: center;
  opacity: 0; pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.page-hero-bar.show {
  opacity: 1; pointer-events: auto;
  transform: translateY(0);
}
.page-hero-bar__title {
  font-family: 'Cinzel', serif; font-size: clamp(0.9rem, 1.6vw, 1.1rem);
  font-weight: 600; color: var(--gold); letter-spacing: 0.1em;
  text-transform: uppercase; margin: 0; line-height: 1.4;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ========== GRB CORNER ========== */
.grb-corner {
  width: 200px;
  height: auto;
  opacity: 0.88;
  pointer-events: none;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,0.45));
}

/* ========== RESPONSIVE ========== */

/* --- Nav collapses to hamburger on tablet/mobile (≤1100px) --- */
@media (max-width: 1100px) {
  .nav-inner { display: flex; justify-content: space-between; padding-right: 1.25rem; }
  .nav-hamburger { display: flex; margin-left: 1rem; }
  .lang-toggle { justify-self: unset; margin-left: auto; }
  .nav-links {
    display: none !important; flex-direction: column; gap: 0;
    position: absolute; top: var(--nav-height); left: 0; right: 0;
    background: var(--navy-deep); border-top: 1px solid rgba(201,168,76,0.15);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    max-height: 0; overflow: hidden;
    visibility: hidden; pointer-events: none;
    transition: max-height 0.35s ease;
  }
  .nav-links.open { display: flex !important; max-height: calc(100vh - var(--nav-height)); visibility: visible; pointer-events: auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .nav-links a {
    padding: 16px 2rem;
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  .nav-links a::after { display: none; }
}

/* --- Tablet & small desktop (≤ 900px) --- */
@media (max-width: 900px) {
  .page-hero-bar { padding: 0.5rem 1rem; }
  .about-seraph { display: none; }
  .picnic-map--bare .picnic-map-embed { padding-bottom: 56.25%; }
  .picnic-layout { grid-template-columns: 1fr; gap: 2rem; }
  .picnic-amen-grid { grid-template-columns: repeat(3, 1fr); }
  .fest-altar .picnic-amen-grid { grid-template-columns: repeat(2, 1fr); }
  .fest-altar .picnic-amen:last-child { grid-column: 1 / -1; }
  .fest-hero-inner { display: block; max-width: 760px; text-align: center; }
  .fest-hero-text { text-align: center; }
  .fest-cta-row { align-items: center; }
  .fest-hero-flyer { margin-top: 2rem; }
  .fest-hero-flyer img { max-width: 320px; transform: rotate(0deg); }
  .info-grid { grid-template-columns: 1fr; }
  .news-image { float: none; max-width: 100%; margin: 1rem 0; }
  .news-image--portrait { float: none; max-width: 100%; margin: 0 auto 1.5rem; display: flex; justify-content: center; }
  .news-image--portrait img { width: auto; max-height: 480px; }

  /* News preview image: become a full-width card banner on tablets */
  .news-image--preview {
    width: 100%; max-width: 100%;
    margin: 0 0 1rem;
    border-radius: 6px; overflow: hidden;
  }
  .news-image--preview img {
    width: 100%; height: 220px; max-height: 220px;
    border-radius: 6px;
  }

  /* Class-based sections that override the generic `section` padding rule */
  .article-section { padding: 4rem 1.5rem; }
  .latest-news,
  .about,
  .info-section { padding: 4rem 1.5rem; }

  /* Timeline: single-column on tablet */
  .timeline::before { left: 1rem; transform: none; }
  .timeline-item,
  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) {
    width: 100%; left: 0; text-align: left;
    padding-left: 3rem; padding-right: 0;
    margin-top: 0;
  }
  .timeline-item:nth-child(odd) .timeline-marker,
  .timeline-item:nth-child(even) .timeline-marker {
    left: calc(1rem - 6.5px); right: auto;
  }
  /* connectors are a two-column flourish — drop them once cards stack */
  .timeline-content::before { display: none; }
  /* hairline stays left-aligned once items stack */
  .timeline-item:nth-child(odd) .timeline-title::after { margin-left: 0; }

  /* Reduce section padding on tablets */
  section { padding: 4rem 1.5rem; }
  .services-altar { padding: 4rem 1.5rem; }

  /* Hero: collapse triptych to single column, hide side panels */
  .hero { padding: calc(var(--nav-height) + 2rem) 1.5rem 3rem; }
  .hero-trip { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero-panel--side { display: none; }
  .hero-cross { width: 98px; height: 98px; }

  /* Sub-page hero: less top padding */
  .page-hero { padding: 1.25rem 1.5rem; padding-top: calc(var(--nav-height) + 1.25rem); }

  /* Latest news: 2-col on tablets */
  .latest-news-grid { grid-template-columns: repeat(2, 1fr); }

  /* Footer tighter */
  footer { padding: 3rem 1.5rem 1.5rem; }
  .footer-bottom { margin-top: 2rem; }
  .footer-inner { flex-direction: column; }
  .footer-arms { width: auto; }
  .grb-corner { width: 140px; }
}

/* --- Phone (≤ 600px) --- */
@media (max-width: 600px) {
  /* Nav: tighter padding on phone (with safe-area for notched devices) */
  .nav-inner {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    gap: 0.5rem;
  }

  .nav-brand-text { font-size: 0.85rem; letter-spacing: 0.12em; }
  .nav-links a { font-size: 0.9rem; }
  .lang-opt { padding: 0 8px; min-height: 44px; font-size: 0.75rem; }

  /* Faith accordion */
  .faith-section { padding: 1.5rem 1rem 2rem; }
  .faith-item__header { padding: 1rem 1.1rem; gap: 0.7rem; }
  .faith-item__title { font-size: 0.95rem; }
  .faith-item__tag { font-size: 0.65rem; padding: 0.15rem 0.4rem; }
  .faith-item__content { margin: 0 1.1rem; padding: 1rem 0 1.25rem; }

  /* Info cards: hide extra sentences */
  .mobile-hide { display: none; }

  /* Timeline: tighter on phone */
  .timeline { padding: 0.5rem 0 0; }
  .timeline-item,
  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) {
    padding-left: 2.5rem; padding-bottom: 1.25rem;
  }
  .timeline-body { font-size: 1rem; }

  /* Grids go single-column */
  .grove-hero { padding: calc(var(--nav-height) + 1.5rem) 1rem 3rem; }
  .grove-stats { flex-direction: column; align-items: center; gap: 0.45rem; }
  .grove-stat { padding: 0; }
  .grove-stat:not(:last-child) { border-right: none; }
  .picnic-section { padding: 2.5rem 1rem 3rem; }
  .picnic-contact-prompt { font-size: 1rem; }
  .picnic-contact-line { font-size: 1.02rem; }
  .picnic-gallery { padding: 0.5rem 1rem 2rem; }
  .picnic-gallery-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .picnic-form-grid { grid-template-columns: 1fr; }

  /* Sections: tighter padding */
  section { padding: 3rem 1rem; }
  .services-altar { padding: 3rem 1rem; }
  .section-label { font-size: 0.85rem; letter-spacing: 0.18em; }
  .section-title { font-size: 2.15rem; line-height: 1.15; }
  .latest-news .section-title { font-size: 1.78rem; line-height: 1.18; }
  .services-grid { flex-direction: column; gap: 1.75rem; }
  .services-door { flex: 1 1 auto; max-width: 300px; margin: 0 auto; padding: 2.8rem 1.5rem 1.8rem; }
  .services-door-divider { display: none; }
  .services-door-time { font-size: 1.8rem; }
  .services-coda { font-size: 1.08rem; }
  .picnic-altar { padding: 3rem 1rem; }
  .picnic-amen-grid { grid-template-columns: repeat(2, 1fr); }
  /* Festival has 5 cards: center the lone 5th across the full width on phones. */
  .fest-altar .picnic-amen:last-child { grid-column: 1 / -1; }
  .picnic-uses { padding: 2.5rem 1rem 3rem; }
  .picnic-uses-list li { border-right: none; padding: 0.35rem 0.5rem; }

  /* Hero: stacked on phones, side panels already hidden at 900px */
  .hero { padding: calc(var(--nav-height) + 1.5rem) 1rem 2.5rem; }
  .hero-trip { gap: 1rem; }
  .hero-cross { width: 90px; height: 90px; margin-bottom: 1rem; }
  .hero-title { font-size: 2.4rem; }
  .hero-title-sub { font-size: 0.82rem; letter-spacing: 0.22em; }
  .hero-address { font-size: 0.72rem; }
  .hero-cta { font-size: 0.78rem; padding: 0.9rem 1.75rem; min-height: 44px; }
  .about-text-full h3 { font-size: 1.5rem; line-height: 1.25; }
  .about-text-full .about-lead { font-size: 1.2rem; }
  .about-text-full p,
  .info-card p,
  .news-body {
    font-size: 1.15rem;
    line-height: 1.78;
  }

  /* Info cards: less padding */
  .info-card { padding: 2rem 1.5rem; }
  .info-card h3 { font-size: 1.2rem; }

  /* Contact buttons: full-width stack on phones so each is a comfortable tap target */
  .contact-buttons { flex-direction: column; gap: 0.6rem; }
  .contact-btn { width: 100%; font-size: 0.78rem; padding: 0.85rem 1.25rem; }

  /* Footer */
  footer { padding: 2.5rem 1rem 1.5rem; }
  .footer-arms--stamp { display: none; }
  .footer-monastery { display: none; }
  .footer-brand h3 { font-size: 1.05rem; }
  .footer-brand p,
  .footer-monastery p { font-size: 1.05rem; }
  .footer-bottom { margin-top: 1.5rem; font-size: 0.95rem; }
  .footer-nav { gap: 0 1.25rem; justify-content: center; }
  .footer-nav a { font-size: 0.8rem; padding: 0.5rem 0; min-height: 44px; display: inline-flex; align-items: center; }


  /* News body max-width: don't constrain on phone */
  .news-body { max-width: 100%; }

  /* News preview image: tighter banner height on phones */
  .news-image--preview img { height: 200px; max-height: 200px; }

  /* Class-based sections that override the generic `section` padding rule */
  .article-section { padding: 3rem 1rem; }
  .latest-news,
  .about,
  .info-section { padding: 3rem 1rem; }

  /* Latest news grid: force single column on phones */
  .latest-news-grid { grid-template-columns: 1fr; gap: 1.25rem; margin-top: 2rem; }

  /* Tables: allow horizontal scroll, shrink text */
  .news-card table,
  .article-full table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    font-size: 0.9rem;
    -webkit-overflow-scrolling: touch;
  }
  .news-card td,
  .news-card th,
  .article-full td,
  .article-full th { padding: 0.6rem 0.7rem; }

  /* Sub-page hero: compact on phone */
  .page-hero { padding: 1rem; padding-top: calc(var(--nav-height) + 1rem); }

  /* Accordion toggle: allow wrapping */
  .accordion-toggle { font-size: 0.82rem; gap: 0.5rem; }

  /* Honor safe-area-inset-left/right on every horizontally-padded layout block so notched
     phones in landscape don't clip content under the camera cutout. Placed at the end of
     the 600px breakpoint so it wins source-order over class-based padding overrides above. */
  section,
  .services-altar,
  .article-section,
  .latest-news,
  .picnic-section,
  .grove-hero,
  .picnic-uses,
  .picnic-gallery,
  .faith-section,
  footer {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  /* Honor safe-area-inset-bottom for the page footer */
  footer { padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }
}

/* --- Small phone (≤ 380px) --- */
@media (max-width: 380px) {
  :root { --nav-height: 56px; }
  #mainNav { height: 56px; }
  .nav-brand-text { font-size: 0.72rem; letter-spacing: 0.06em; }
  .lang-opt { padding: 0 6px; min-height: 44px; font-size: 0.7rem; }
  .hero { padding: calc(var(--nav-height) + 1rem) 1rem 2rem; }
  .hero-cross { width: 80px; height: 80px; }
  .hero-title { font-size: 2rem; }
  section { padding: 2.5rem 1rem; }
}

/* ========== ANIMATIONS ========== */
.fade-up { opacity: 1; transform: translateY(0); transition: opacity 0.7s ease, transform 0.7s ease; }
.js-fade .fade-up { opacity: 0; transform: translateY(24px); }
.js-fade .fade-up.visible { opacity: 1; transform: translateY(0); }

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
  .hero-trip { animation: none; }
  .fade-up,
  .js-fade .fade-up,
  .js-fade .fade-up.visible {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .info-card,
  .info-card:active,
  .info-card:hover,
  .hero-cta:hover,
  .grove-cta:hover,
  .fest-cta:hover,
  .donate-btn:hover,
  .latest-news-card:hover,
  .fest-altar .picnic-amen:hover,
  .fest-hero-flyer img,
  .fest-hero-flyer img:hover { transform: none !important; }
}

