/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark:   #2d5a27;
  --green-mid:    #4a7c40;
  --green-light:  #7aab6e;
  --harvest-gold: #c8922a;      /* decorative / on dark green only: 2.8:1 on white, too light for text */
  --harvest-gold-deep: #8c5f14; /* text, buttons, focus on light backgrounds: 5.6:1 on white, 4.9:1 on tan (WCAG AA) */
  --harvest-tan:  #f5efe3;
  --white:        #ffffff;
  --text-dark:    #1e1e1e;
  --text-mid:     #4a4a4a;
  --text-light:   #6b6b6b;  /* 5.3:1 on white, 4.65:1 on tan (WCAG AA) */
  --border:       #ddd6c8;
  --shadow:       0 2px 12px rgba(0,0,0,0.08);
  --radius:       8px;
  --max-width:    1100px;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: var(--font-body);
  color: var(--text-dark);
  background: var(--white);
  line-height: 1.7;
  font-size: 16px;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 12px 16px;
  background: var(--harvest-gold-deep);
  color: var(--white);
  z-index: 1000;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.25;
  color: var(--green-dark);
}

a { color: var(--green-mid); text-decoration: none; }

/* ========== KEYBOARD FOCUS ==========
   One clear ring on whatever the keyboard is on (WCAG 2.4.7): deep gold on light
   backgrounds, white on the dark green ones. Mouse clicks don't show it. */
:focus-visible { outline: 3px solid var(--harvest-gold-deep); outline-offset: 2px; }
footer :focus-visible,
.hero :focus-visible,
.verse-block :focus-visible,
section[style*="background: var(--green-dark)"] :focus-visible { outline-color: var(--white); }
/* Keep whatever the keyboard lands on (and #anchor jumps) clear of the sticky header */
html { scroll-padding-top: 96px; }
a:hover { color: var(--harvest-gold-deep); }

img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  text-align: center;
}

.btn-primary {
  background: var(--harvest-gold-deep);
  color: var(--white);
  border-color: var(--harvest-gold-deep);
}
.btn-primary:hover {
  background: #6f4b0f;
  border-color: #6f4b0f;
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border-color: var(--white);
}
.btn-outline:hover {
  background: var(--white);
  color: var(--green-dark);
}

.btn-green {
  background: var(--green-dark);
  color: var(--white);
  border-color: var(--green-dark);
}
.btn-green:hover {
  background: var(--green-mid);
  border-color: var(--green-mid);
  color: var(--white);
}

/* ========== HEADER / NAV ========== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.nav-logo-text .church-name {
  font-family: var(--font-heading);
  font-size: 17px;
  color: var(--green-dark);
  font-weight: 700;
}

.nav-logo-text .church-sub {
  font-size: 11px;
  color: var(--text-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-logo-img {
  height: 48px;
  width: auto;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 4px;
  align-items: center;
}

nav ul li a {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap; /* "New Here?" used to break onto two lines below ~880px */
}

/* Tighter link spacing on narrow desktops/tablets so all nine links plus the
   Facebook icon fit on one line down to the 768px phone breakpoint. */
@media (max-width: 1000px) {
  nav ul li a { padding: 6px 8px; }
}

nav ul li a:hover,
nav ul li a.active {
  background: var(--harvest-tan);
  color: var(--green-dark);
}
nav ul li a.active { font-weight: 700; }

/* Facebook link. Sits outside the collapsible <ul> so it stays visible on
   phones, where the rest of the menu hides behind the toggle. */
.nav-inner nav { margin-left: auto; }

.nav-social {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 8px;
  border-radius: 50%;
  color: #1877F2; /* Facebook blue */
  transition: background 0.15s;
  flex-shrink: 0;
}
.nav-social:hover { background: var(--harvest-tan); color: #1877F2; }
.nav-social svg { width: 24px; height: 24px; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-dark);
  border-radius: 2px;
  transition: all 0.2s;
}

/* ========== HERO ========== */
.hero {
  /* Middle stop darkened and pushed right so white text stays above 4.5:1 (WCAG AA)
     while keeping the gold glow in the far corner. */
  background: linear-gradient(135deg, var(--green-dark) 0%, #3f6e36 76%, var(--harvest-gold) 100%);
  color: var(--white);
  padding: 100px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../images/pexels-zozz-544555.jpg') center/cover;
  opacity: 0.12;
}

.hero-content { position: relative; z-index: 1; }

/* The church logo, large and in white, above the homepage welcome */
.hero-logo {
  width: min(460px, 78%);
  height: auto;
  margin: 0 auto 28px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  color: var(--white);
  margin-bottom: 16px;
}

.hero p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  max-width: 580px;
  margin: 0 auto 32px;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ========== SERVICE TIMES STRIP ========== */
.service-strip {
  background: var(--harvest-tan);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  text-align: center;
}

.service-strip .strip-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 48px;
  flex-wrap: wrap;
}

/* Five items (Sunday School, Worship, Youth Group, address, phone): tighter
   spacing keeps them on one row down to ~1000px, and on tablets a 3-column
   grid gives a balanced 3+2 instead of 4 with one stranded below. Phones keep
   the wrapping layout (2+2+1). */
@media (max-width: 1200px) {
  .service-strip .strip-inner { gap: 28px; }
}
@media (max-width: 980px) and (min-width: 601px) {
  .service-strip .strip-inner {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 210px));
    justify-content: center;
    gap: 16px 24px;
  }
}

.service-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.service-item .icon {
  font-size: 20px;
}

.service-item strong {
  display: block;
  font-size: 15px;
  color: var(--green-dark);
}

.service-item span {
  font-size: 13px;
  color: var(--text-mid);
}

/* ========== SECTION DEFAULTS ========== */
section {
  padding: 72px 0;
}

.section-label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  font-weight: 700;
  color: var(--harvest-gold-deep);
  margin-bottom: 8px;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 16px;
}

.section-intro {
  color: var(--text-mid);
  max-width: 580px;
  margin-bottom: 40px;
}

/* ========== CARDS ========== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--harvest-tan);
}

.card-icon {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--harvest-tan);
  font-size: 2.5rem;
}

.card-body { padding: 20px; }
.card-body h3 { font-size: 1.1rem; margin-bottom: 8px; }
.card-body p { font-size: 14px; color: var(--text-mid); }

/* ========== SPLIT SECTION ========== */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}

.split.reverse { direction: rtl; }
.split.reverse > * { direction: ltr; }

/* New Here: "We're in Filer" text beside the map; stacked on phones and at high zoom */
.location-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  margin-top: 32px;
}
@media (max-width: 760px) {
  .location-layout { grid-template-columns: minmax(0, 1fr); }
}

.split-img {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.split-img img { width: 100%; height: 380px; object-fit: cover; }

/* ========== QUOTE / VERSE ========== */
.verse-block {
  background: var(--green-dark);
  color: var(--white);
  padding: 64px 0;
  text-align: center;
}

.verse-block blockquote {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  font-style: italic;
  max-width: 720px;
  margin: 0 auto 16px;
  line-height: 1.5;
}

.verse-block cite {
  font-size: 14px;
  opacity: 0.75;
  font-style: normal;
  letter-spacing: 0.05em;
}

/* ========== FOOTER ========== */
footer {
  background: var(--green-dark);
  color: rgba(255,255,255,0.85);
  padding: 56px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .church-name {
  font-family: var(--font-heading);
  font-size: 20px;
  color: var(--white);
  margin-bottom: 8px;
}

.footer-brand p {
  font-size: 14px;
  line-height: 1.6;
  max-width: 260px;
}

footer h2 {
  color: var(--white);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

footer ul { list-style: none; }
footer ul li { margin-bottom: 8px; }
footer ul li a {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  transition: color 0.15s;
}
footer ul li a:hover { color: var(--harvest-gold); }

.footer-bottom a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer-bottom a:hover { color: var(--white); }
.form-privacy-note { margin-top: 14px; font-size: 13px; color: var(--text-mid); }
.form-privacy-note a { text-decoration: underline; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  flex-wrap: wrap;
  gap: 8px;
}

/* ========== PAGE BANNER ========== */
.page-banner {
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  color: var(--white);
  padding: 56px 0;
  text-align: center;
}
.page-banner h1 { color: var(--white); font-size: clamp(1.8rem, 4vw, 2.8rem); }
.page-banner p { margin-top: 10px; font-size: 1.05rem; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  nav ul { display: none; flex-direction: column; }
  nav ul.open {
    display: flex;
    position: absolute;
    top: 68px;
    left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px 20px;
    box-shadow: var(--shadow);
  }
  .nav-toggle { display: flex; }
  /* Phone header reads: logo ... [Facebook] [menu] */
  .nav-social { order: 2; margin-left: auto; margin-right: 6px; }
  .nav-toggle { order: 3; }
  .nav-inner nav { order: 4; margin-left: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 580px) {
  .split { grid-template-columns: 1fr; gap: 28px; }
  .split.reverse { direction: ltr; }
  /* Photos stay on phones, as a shorter banner (they used to be hidden) */
  .split-img img { height: 220px; }
}

/* ========== NEWSLETTER FORM ========== */
.newsletter-section {
  background: var(--harvest-tan);
  padding: 64px 0;
  text-align: center;
}

.newsletter-form {
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
  padding: 32px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-dark);
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: 3px solid var(--harvest-gold-deep);
  outline-offset: 1px;
  border-color: var(--green-mid);
}

.form-group input::placeholder {
  color: var(--text-light);
}

.form-group.required label::after {
  content: ' *';
  color: #c94c4c;
}

/* Status box above each form. It is always in the page (just empty and
   invisible until there's a message) so screen readers reliably announce it. */
.form-message {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
}
.form-message:empty { margin: 0; padding: 0; border: 0; }

.form-message--success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.form-message--error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.newsletter-form button {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .service-strip .strip-inner { gap: 24px; }
  .newsletter-form { padding: 24px; }
}

/* ========== CLICK-TO-VIEW PHOTOS ========== */
a.photo-zoom { display: block; cursor: zoom-in; }
/* Drawn inside the photo (its frame clips anything outside): gold ring with a white inner line */
a.photo-zoom:focus-visible { outline: 4px solid var(--harvest-gold-deep); outline-offset: -4px; }
a.photo-zoom:focus-visible img { outline: 2px solid var(--white); outline-offset: -6px; }

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.photo-viewer[hidden] { display: none; }
.photo-viewer figure { margin: 0; max-width: 100%; display: flex; flex-direction: column; align-items: center; }
.photo-viewer img { max-width: 100%; max-height: calc(100vh - 110px); width: auto; height: auto; border-radius: 6px; }
.photo-viewer figcaption { color: rgba(255, 255, 255, 0.8); font-size: 13px; margin-top: 10px; }
.photo-viewer-close {
  position: absolute;
  top: 10px;
  right: 16px;
  background: none;
  border: 0;
  color: var(--white);
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
}

/* Links inside sentences are underlined so they don't rely on colour alone
   (WCAG 1.4.1). Buttons and stand-alone links keep their own styling. */
main p a:not(.btn), main li a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; }

/* ========== CLICK-TO-PLAY SERMON VIDEO ========== */
/* Fills the 16:9 video box. The thumbnail comes from /api/latest-sermon. */
.yt-facade {
  position: absolute; inset: 0; display: block; overflow: hidden;
  background: var(--green-dark); color: var(--white); text-decoration: none;
}
.yt-facade:hover { color: var(--white); }
.yt-facade-thumb { width: 100%; height: 100%; object-fit: cover; }
/* Dark fade at the bottom keeps the white title readable over any thumbnail */
.yt-facade::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.45) 22%, rgba(0,0,0,0) 50%);
}
.yt-facade-play {
  position: absolute; top: 50%; left: 50%; z-index: 1;
  width: 76px; height: 76px; transform: translate(-50%, -50%);
  border-radius: 50%; background: rgba(0,0,0,0.7); transition: background 0.15s;
}
.yt-facade-play::before {
  content: ''; position: absolute; left: 30px; top: 22px;
  border-style: solid; border-width: 16px 0 16px 27px;
  border-color: transparent transparent transparent var(--white);
}
.yt-facade:hover .yt-facade-play, .yt-facade:focus-visible .yt-facade-play { background: #c4302b; }
.yt-facade-label {
  position: absolute; left: 18px; right: 18px; bottom: 14px; z-index: 1;
  font-weight: 600; font-size: 16px; line-height: 1.35;
}
/* Drawn inside the box (its rounded frame clips anything outside) */
.yt-facade:focus-visible { outline: 3px solid var(--white); outline-offset: -7px; box-shadow: inset 0 0 0 7px var(--harvest-gold-deep); }
.yt-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
