/* ==========================================================================
   THE UNITY CHURCH — DESIGN FOUNDATION
   Shared tokens, reset, typography base, buttons, header, mobile nav,
   footer, modal, and form primitives. Every rebuilt page loads this first,
   then its own page-specific stylesheet for section layouts.
   Register: brand/boutique-hospitality. Restrained light surface with room
   for one deliberate drenched moment per page.
   ========================================================================== */

/* -------------------------------------------------------------------------
   Tokens
   ------------------------------------------------------------------------- */
:root {
  /* Brand identity */
  --ink: #0b0a09;
  --ink-soft: #2b2620;
  --cream: #faf6ee;
  --cream-deep: #f1e5d0;
  --gold: #e4c27b;
  --gold-soft: #f1d396;
  --gold-deep: #a9793d;
  --wine: #7d2235;
  --wine-deep: #4a121e;
  --wine-soft: #a84257;

  /* Neutrals tinted toward the brand's own warm hue (not a generic default) */
  --line: rgba(11, 10, 9, 0.1);
  --line-on-dark: rgba(250, 246, 238, 0.16);

  /* Type */
  --font-display: 'Cinzel', serif;
  --font-body: 'Manrope', sans-serif;

  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.3rem;
  --text-xl: clamp(1.7rem, 1.45rem + 1.1vw, 2.3rem);
  --text-2xl: clamp(2.1rem, 1.6rem + 2.2vw, 3.2rem);
  --text-hero: clamp(2.4rem, 1.7rem + 3.6vw, 4.4rem);

  /* Space (4pt base) */
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-24: 6rem;
  --sp-section: clamp(4rem, 3rem + 5vw, 8rem);

  /* Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);

  /* Radius — capped per house rule: cards 8-16px, pills for buttons/tags */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* z-index scale */
  --z-header: 40;
  --z-mobile-nav: 50;
  --z-modal: 60;
  --z-toast: 70;
}

/* -------------------------------------------------------------------------
   Reset + base
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--ink-soft);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); margin: 0; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
blockquote { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 700;
  font-size: var(--text-sm);
  text-decoration: none;
  color: var(--wine);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease-out-quint);
}
.text-link:hover { border-color: currentColor; }

/* -------------------------------------------------------------------------
   Buttons — one pill family, fill vs outline, never border+wide-shadow together
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.75rem;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform 0.35s var(--ease-out-quint), background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--cream); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--cream); border: 1.5px solid rgba(250, 246, 238, 0.55); }
.btn-dark { background: var(--ink); color: var(--cream); }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-cream { background: var(--cream); color: var(--wine-deep); }
.btn-outline-cream { background: transparent; color: var(--cream); border: 1.5px solid rgba(250, 246, 238, 0.55); }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--gold-soft); }
  .btn-ghost:hover { border-color: var(--cream); background: rgba(250, 246, 238, 0.1); }
  .btn-dark:hover { background: var(--wine-deep); }
  .btn-outline:hover { background: var(--ink); color: var(--cream); }
  .btn-cream:hover { background: var(--gold-soft); }
  .btn-outline-cream:hover { border-color: var(--cream); background: rgba(250, 246, 238, 0.12); }
  .btn:hover { transform: translateY(-2px); }
}

/* -------------------------------------------------------------------------
   Floating WhatsApp enquiry button
   ------------------------------------------------------------------------- */
.whatsapp-fab {
  position: fixed;
  right: var(--sp-6);
  bottom: var(--sp-6);
  z-index: var(--z-toast);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 10px 25px rgba(11, 10, 9, 0.3);
  transition: transform 0.3s var(--ease-out-quint), box-shadow 0.3s ease;
}
@media (hover: hover) and (pointer: fine) {
  .whatsapp-fab:hover { transform: scale(1.08); box-shadow: 0 14px 32px rgba(11, 10, 9, 0.35); }
}
.whatsapp-fab:active { transform: scale(0.95); }

@media (max-width: 480px) {
  .whatsapp-fab { right: var(--sp-4); bottom: var(--sp-4); width: 50px; height: 50px; font-size: 24px; }
}

/* -------------------------------------------------------------------------
   Header
   ------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: var(--z-header);
  padding: var(--sp-4) clamp(1.25rem, 3vw, 2.5rem);
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 10, 9, 0.45), transparent);
  z-index: -1;
  transition: opacity 0.4s ease;
}
.site-header.is-scrolled {
  background: rgba(250, 246, 238, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--line);
}
.site-header.is-scrolled::before { opacity: 0; }

/* Pages with no photographic hero start "scrolled" (solid) from the outset */
.site-header.is-solid {
  background: rgba(250, 246, 238, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--line);
}
.site-header.is-solid::before { opacity: 0; }
.site-header.is-solid .brand-name,
.site-header.is-solid .primary-nav a,
.site-header.is-solid .nav-toggle span { color: var(--ink); }
.site-header.is-solid .nav-give { color: var(--wine) !important; }

.site-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
}
.brand-mark { height: 38px; width: auto; }
.brand-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  line-height: 1.15;
  letter-spacing: 0.06em;
  color: var(--cream);
  transition: color 0.4s ease;
}
.site-header.is-scrolled .brand-name { color: var(--ink); }

.primary-nav ul { display: flex; gap: var(--sp-8); }
.primary-nav a {
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  color: var(--cream);
  padding: var(--sp-2) 0;
  position: relative;
  transition: color 0.4s ease;
}
.site-header.is-scrolled .primary-nav a { color: var(--ink-soft); }
.primary-nav a.is-active { border-bottom-color: currentColor; }
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease-out-quint);
}
.primary-nav a.is-active::after { transform: scaleX(1); }
@media (hover: hover) and (pointer: fine) {
  .primary-nav a:hover::after { transform: scaleX(1); transform-origin: left; }
}
.nav-give { color: var(--gold-soft) !important; }
.site-header.is-scrolled .nav-give { color: var(--wine) !important; }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--cream);
  transition: background-color 0.4s ease, transform 0.3s var(--ease-out-quint);
}
.site-header.is-scrolled .nav-toggle span { background: var(--ink); }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: var(--z-mobile-nav);
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.35s var(--ease-out-quint), transform 0.35s var(--ease-out-quint), visibility 0.35s;
}
.mobile-nav[data-open="true"] { opacity: 1; visibility: visible; transform: translateY(0); }
.mobile-nav ul { display: flex; flex-direction: column; gap: var(--sp-6); text-align: center; }
.mobile-nav a {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--cream);
  text-decoration: none;
}

@media (max-width: 860px) {
  .primary-nav { display: none; }
  .nav-toggle { display: inline-flex; }
}

/* -------------------------------------------------------------------------
   Page hero banner (non-homepage pages: shorter, title-only hero)
   ------------------------------------------------------------------------- */
.page-hero {
  position: relative;
  min-height: 52vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.page-hero-media { position: absolute; inset: 0; }
.page-hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.06);
  animation: heroPhotoSettle 2.2s var(--ease-out-expo) forwards;
}
.page-hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(11, 10, 9, 0.92) 0%, rgba(11, 10, 9, 0.75) 45%, rgba(11, 10, 9, 0.3) 100%);
}
.page-hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem) clamp(2.5rem, 6vw, 4rem);
  color: var(--cream);
}
.page-hero-eyebrow,
.page-hero-title {
  opacity: 0;
  transform: translateY(16px);
  animation: heroRise 0.9s var(--ease-out-quint) forwards;
}
.page-hero-eyebrow { animation-delay: 0.35s; }
.page-hero-title { animation-delay: 0.5s; }

.page-hero-eyebrow {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: var(--sp-3);
}
.page-hero-title {
  font-size: clamp(2.2rem, 1.7rem + 2.6vw, 3.6rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 22ch;
  color: var(--cream);
  text-shadow: 0 2px 24px rgba(11, 10, 9, 0.4);
}

@keyframes heroPhotoSettle { to { transform: scale(1); } }
@keyframes heroRise { to { opacity: 1; transform: translateY(0); } }

/* -------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */
.site-footer { background: var(--ink); color: rgba(250, 246, 238, 0.72); }
.footer-top {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--sp-16) clamp(1.25rem, 4vw, 3rem) var(--sp-12);
  display: flex;
  justify-content: space-between;
  gap: var(--sp-16);
  flex-wrap: wrap;
}
.brand-footer .brand-name { color: var(--cream); }
.footer-cols { display: flex; gap: var(--sp-16); flex-wrap: wrap; }
.footer-col h3 {
  font-family: var(--font-body);
  color: var(--gold-soft);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--sp-4);
}
.footer-col ul { display: flex; flex-direction: column; gap: var(--sp-3); }
.footer-col a { text-decoration: none; transition: color 0.25s ease; }
@media (hover: hover) and (pointer: fine) {
  .footer-col a:hover { color: var(--cream); }
}
.footer-socials { display: flex; gap: var(--sp-4); margin-top: var(--sp-6); font-size: 1.1rem; }
.footer-socials a { transition: color 0.25s ease; }
@media (hover: hover) and (pointer: fine) {
  .footer-socials a:hover { color: var(--gold-soft); }
}
.footer-bottom {
  border-top: 1px solid var(--line-on-dark);
  padding: var(--sp-6) clamp(1.25rem, 4vw, 3rem);
  text-align: center;
  font-size: var(--text-xs);
}

/* -------------------------------------------------------------------------
   Modal (testimony, forms, any dialog)
   ------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  background: rgba(11, 10, 9, 0.6);
  backdrop-filter: blur(6px);
}
.modal[hidden] { display: none; }
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: min(90vh, 720px);
  overflow-y: auto;
  background: var(--cream);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
}
.modal-panel h3 { font-size: var(--text-xl); margin-bottom: var(--sp-2); }
.modal-panel > div > p { margin-bottom: var(--sp-6); color: var(--ink-soft); }
.modal-panel form { display: flex; flex-direction: column; gap: var(--sp-4); margin-top: var(--sp-6); }
.modal-close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-soft);
  border-radius: 50%;
}
@media (hover: hover) and (pointer: fine) {
  .modal-close:hover { background: var(--line); }
}

/* -------------------------------------------------------------------------
   Form fields (shared by any page: newsletter, testimony, contact, booking)
   ------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field label { font-size: var(--text-sm); font-weight: 700; color: var(--ink); }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.8rem 1rem;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.25s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--wine);
}
.field-error, .field-success { font-size: var(--text-xs); margin: 0; display: none; }
.field-error { color: var(--wine); }
.field-error.is-visible { display: block; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--wine); }
.field-success { color: #3f6b46; }
.field-success.is-visible { display: block; }

/* -------------------------------------------------------------------------
   PWA install prompt — rich bottom sheet on mobile, compact toast on desktop
   ------------------------------------------------------------------------- */
.install-banner {
  position: fixed;
  inset: auto 0 0 0;
  z-index: var(--z-toast);
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -12px 45px rgba(11, 10, 9, 0.35);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s var(--ease-out-quint), transform 0.5s var(--ease-out-quint);
  overflow: hidden;
}
.install-banner[hidden] { display: none; }
.install-banner.is-visible { opacity: 1; transform: translateY(0); }

.install-banner-media { position: relative; height: 170px; }
.install-banner-media img { width: 100%; height: 100%; object-fit: cover; }
.install-banner-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 10, 9, 0.55) 0%, rgba(11, 10, 9, 0.15) 45%, rgba(11, 10, 9, 0.85) 100%);
}
.install-banner-stats {
  position: absolute;
  top: var(--sp-4);
  left: var(--sp-6);
  right: var(--sp-6);
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
}
.install-banner-stat strong { display: block; font-family: var(--font-display); font-size: var(--text-lg); color: var(--gold-soft); line-height: 1.1; }
.install-banner-stat span { font-size: var(--text-xs); color: rgba(250, 246, 238, 0.8); }

.install-banner-bar { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-6); }
.install-banner-icon { width: 44px; height: 44px; border-radius: var(--r-md); flex-shrink: 0; }
.install-banner-body { flex: 1; min-width: 0; }
.install-banner-title { font-family: var(--font-display); font-size: var(--text-base); margin-bottom: var(--sp-1); }
.install-banner-text { font-size: var(--text-xs); color: rgba(250, 246, 238, 0.75); line-height: 1.4; }
.install-banner-actions { display: flex; flex-direction: column; gap: var(--sp-2); flex-shrink: 0; }
.install-banner .btn { min-height: 38px; padding: 0 var(--sp-6); font-size: var(--text-xs); }
.btn-gold { background: var(--gold); color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .btn-gold:hover { background: var(--gold-deep); }
}
.install-banner-close {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  z-index: 2;
  width: 28px;
  height: 28px;
  color: var(--cream);
  font-size: 1.2rem;
  line-height: 1;
}

@media (min-width: 641px) {
  .install-banner {
    inset: auto auto var(--sp-6) var(--sp-6);
    max-width: 380px;
    border-radius: var(--r-lg);
  }
  .install-banner-media { display: none; }
  .install-banner-bar { align-items: flex-start; padding: var(--sp-6); }
  .install-banner-text { font-size: var(--text-sm); }
  .install-banner-close { color: rgba(250, 246, 238, 0.7); }
}

/* -------------------------------------------------------------------------
   Reduced motion (base). Page stylesheets add their own hero-specific rules.
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .page-hero-photo, .page-hero-eyebrow, .page-hero-title {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
  }
  * { transition-duration: 0.01ms !important; }
}
