:root {
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;
  --color-primary: #7b1111;
  --color-primary-dark: #3f0707;
  --color-sand: #f6f1eb;
  --color-ink: #1f1a17;
  --color-muted: #5c5148;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--color-ink);
  background-color: var(--color-sand);
}

a {
  color: inherit;
}

a:hover,
a:focus {
  color: var(--color-primary);
}

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

.container {
  width: min(1100px, 80vw);
  margin: 0 auto;
}

nav {
  background-color: white;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.brand .name {
  font-family: var(--font-heading);
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  letter-spacing: 0.04em;
  font-weight: 600;
  line-height: 1.35;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px; /* space between logo and text */
}

.brand-logo {
  height: 48px;
  width: auto;
  display: block;
}

@media (max-width: 540px) {
  .brand-logo {
    height: 36px;       /* slightly smaller on phones */
  }

  .brand .name {
    font-size: clamp(0.9rem, 4vw, 1.1rem);
    line-height: 1.2;
  }
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navlinks .cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 20px;
  text-decoration: none;
  background-color: var(--color-primary);
  color: white;
  font-weight: 600;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.navlinks .cta:hover,
.navlinks .cta:focus {
  background-color: var(--color-primary-dark);
  transform: translateY(-2px);
}

.header.rotating-hero {
  position: relative;
  background-color: black;
  overflow: hidden;
  min-height: clamp(320px, 60vh, 520px);
}

.hero-container {
  position: relative;
  height: 100%;
}

.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 1s ease, transform 1.8s ease;
}

.hero-slide.active {
  opacity: 1;
  transform: scale(1);
}

.overlay {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;        /* stack vertically */
  align-items: center;           /* center horizontally */
  justify-content: center;      /* center vertically */
  text-align: center;
  padding: clamp(40px, 8vw, 80px) 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.35));
  min-height: clamp(320px, 60vh, 520px);
}

.hero-title {
  color: white;
  text-align: center;
  font-family: var(--font-heading);
  font-size: clamp(.9rem, 2.1vw, 1.3rem);
  letter-spacing: 0.05em;
  font-weight: 700;
  margin-bottom: 20px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  max-width: 90%;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px; /* spacing between text links */
}

.hero-links a {
  display: inline-block;
  color: white;
  text-decoration: none;
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  transition: color 0.3s ease;
  padding: 0;                 /* remove button padding */
  border: none;               /* remove border */
  background: none;           /* remove background */
}

.hero-links a:hover,
.hero-links a:focus {
  color: #f1c40f;             /* gold hover color */
}

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

.hero-links a:hover,
.hero-links a:focus {
  background-color: rgba(255, 255, 255, 0.9);
  color: var(--color-primary);
  transform: translateY(-2px);
}

.section {
  padding: clamp(0px, 1vw, 15px) 0;
}

.h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  text-align: center;
  color: var(--color-primary);
  margin: 0 0 clamp(24px, 6vw, 40px);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  gap: clamp(20px, 5vw, 32px);
}

.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* 🔸 Compact, Centered Link Cards */
.card {
  display: flex;
  flex-direction: column;
  align-items: center;         /* centers content horizontally */
  text-align: center;          /* centers text */
  padding: 10px;
  font-size: 0.9rem;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

.card img {
  width: 100%;
  height: auto;
  max-height: 140px;           /* limits image height */
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 8px;
}

.card h3 {
  font-size: 1rem;
  margin: 5px 0;
}

.card p {
  font-size: 0.85rem;
  line-height: 1.3;
  margin: 0;
}

.card:hover {
  transform: translateY(-4px);
}

.footer {
  background-color: #111;
  color: #f1ede6;
  padding: clamp(40px, 8vw, 60px) 0;
}

.footer a {
  color: inherit;
  text-decoration: underline;
}

.footer .container .footer-box > div:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  align-items: center;
}

.footer .container .footer-box > div:first-child > div {
  min-width: min(260px, 100%);
}

.footer .container .footer-box div:last-child {
  margin-top: 18px;
  opacity: 0.8;
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  nav {
    position: static;
  }

  .navlinks {
  gap: 8px;
  font-size: 0.85rem;
}
  
  .navbar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .navlinks {
    width: 100%;
    justify-content: center;
  }

  .overlay {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.6));
    padding-block: clamp(60px, 18vw, 80px);
  }

  .hero-links {
    gap: 10px;
  }

  .hero-links a {
    padding: 10px 16px;
    font-size: 0.95rem;
  }
}

@media (max-width: 540px) {
  .brand .name {
    font-size: clamp(1rem, 4.6vw, 1.1rem);
  }

  .overlay {
    padding-inline: 16px;
  }

  .hero-links {
    flex-direction: column;
  }

  .hero-links a {
    width: 100%;
    max-width: 280px;
  }

  .footer .container .footer-box > div:first-child {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-height: 580px) and (orientation: landscape) {
  .header.rotating-hero,
  .overlay {
    min-height: 360px;
  }

  .hero-links a {
    font-size: 0.85rem;
    padding: 8px 14px;
  }
}

/* ——— HERO overlay/link fixes ——— */
.header.rotating-hero .overlay {
  background: transparent !important;   /* no white panel */
  box-shadow: none !important;
}

.hero-links {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 12px;
  display: flex;
  gap: 14px;
  justify-content: center;
}

.hero-links a {
  color: #ffffff !important;            /* visible on banner */
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.hero-links a:hover {
  color: #f1c40f !important;            /* soft gold hover */
}

/* ——— Hero sizing/position ——— */
.hero-slide {
  background-size: cover;
  background-position: 50% 35%; /* show a bit more top on desktop */
  height: 70vh;
  min-height: 480px;
}

/* Phones (portrait) */
@media (max-width: 430px) {
  .header.rotating-hero,
  .hero-container,
  .hero-slide {
    height: 58vh;              /* shorter = less zoom, more width visible */
    min-height: 380px;
  }
  .hero-slide {
    background-position: center top;  /* keep key text near top in view */
  }

  /* make sure page doesn’t scroll sideways */
  html, body { overflow-x: hidden; }
}

/* Mobile hero: show full banner image (no cropping) */
@media (max-width: 480px) {
  /* Shorter hero so the image isn’t zoomed-in */
  .header.rotating-hero,
  .hero-container,
  .hero-slide {
    height: 52vh;
    min-height: 340px;
  }

  /* Key change: fit the whole banner on screen */
  .hero-slide {
    background-size: contain !important;   /* show entire image */
    background-repeat: no-repeat !important;
    background-position: center top !important; /* keep title area visible */
    background-color: #000;                /* fill letterbox with black */
  }

  /* Keep overlay transparent and links visible */
  .overlay {
    background: transparent !important;
    padding: 24px 12px;
  }

  .hero-links {
    gap: 10px;
  }
  .hero-links a {
    color: #fff !important;
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,.6);
  }

  /* Prevent sideways scroll on small screens */
  html, body { overflow-x: hidden; }
}

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

.brand-logo {
  max-height: clamp(42px, 8vh, 80px); /* increased min & max */
  width: auto;
  display: block;
}

/* 📱 Tablet adjustments */
@media (max-width: 768px) {
  .brand-logo {
    max-height: 52px;   /* larger on tablets */
  }
}

/* 📱 Phone adjustments */
@media (max-width: 540px) {
  .brand-logo {
    max-height: 40px;   /* slightly larger than before */
  }

  .brand .name {
    font-size: clamp(0.95rem, 4.5vw, 1.25rem);
    line-height: 1.2;
  }
}

/* phones: even narrower & smaller */
@media (max-width: 540px) {
  .hero-title {
    max-width: 90vw;
    font-size: clamp(1rem, 5vw, 1.4rem);
    line-height: 1.25;
    margin-bottom: 14px;
    padding: 0 8px;
  }
}

/* Mobile fixes: hero title + links (override) */
@media (max-width: 540px) {
  /* Narrower, smaller title so it doesn't run into side images */
  .hero-title {
    max-width: 84vw;
    font-size: clamp(1rem, 4.2vw, 1.3rem);
    line-height: 1.25;
    margin: 0 auto 12px;
    padding: 0 6px;
  }

  /* Lay links out in a row, allow wrapping to a 2nd line if needed */
  .hero-links {
    display: flex;
    flex-direction: row;          /* not stacked */
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  /* Force links to be plain text (no button styling) */
  .hero-links a {
    display: inline !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff !important;
    text-decoration: none;
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 6px rgba(0,0,0,.7);
  }

  .hero-links a:hover,
  .hero-links a:focus {
    color: #f1c40f !important;
    text-shadow: 0 2px 8px rgba(0,0,0,.85);
  }
}

/* === Mobile fixes: hero title + links (override) === */
@media (max-width: 540px) {
  /* Narrower, smaller title so it doesn't run into side images */
  .hero-title {
    max-width: 84vw;
    font-size: clamp(1rem, 4.2vw, 1.3rem);
    line-height: 1.25;
    margin: 0 auto 12px;
    padding: 0 6px;
  }

  /* Lay links out in a row, allow wrapping to a 2nd line if needed */
  .hero-links {
    display: flex;
    flex-direction: row;          /* not stacked */
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  /* Force links to be plain text (no button styling) */
  .hero-links a {
    display: inline !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff !important;
    text-decoration: none;
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 6px rgba(0,0,0,.7);
  }

  .hero-links a:hover,
  .hero-links a:focus {
    color: #f1c40f !important;
    text-shadow: 0 2px 8px rgba(0,0,0,.85);
  }
}

/* === Mobile: single-line hero links (no buttons) === */
@media (max-width: 540px) {
  /* keep title tighter so it stays in the safe center area */
  .hero-title {
    max-width: 80vw;
    font-size: clamp(0.95rem, 4vw, 1.2rem);
    line-height: 1.2;
    margin: 0 auto 10px;
    padding: 0 4px;
  }

  /* one line, horizontally scrollable if needed */
  .hero-links {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;                /* single line */
    justify-content: center;
    gap: 12px;
    overflow-x: auto;                 /* allow sideways scroll if needed */
    -webkit-overflow-scrolling: touch;
    padding: 2px 6px;
    scrollbar-width: none;            /* hide scrollbar (Firefox) */
  }
  .hero-links::-webkit-scrollbar { display: none; } /* hide scrollbar (WebKit) */

  /* plain text links (no button styles) */
  .hero-links a {
    display: inline-block !important;
    white-space: nowrap;              /* keep each link unbroken */
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff !important;
    text-decoration: none;
    font-size: 12.5px;                /* tighter to fit one line */
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 6px rgba(0,0,0,.7);
  }

  .hero-links a:hover,
  .hero-links a:focus {
    color: #f1c40f !important;
    text-shadow: 0 2px 8px rgba(0,0,0,.85);
  }
}

/* === Nudge hero title + links down slightly === */
.hero-content {
  position: relative;
  top: 1.2em;  /* adjust this value to move it down — try 1em, 1.5em, etc. */
}

@media (max-width: 540px) {
  .story-section img[style*="float"] {
    float: none !important;
    max-width: 100% !important;
    margin: 12px auto !important;
    display: block !important;
  }
}

@media (max-width: 540px) {
  .story-section img[style*="float"] {
    float: none !important;
    max-width: 100% !important;
    margin: 12px auto !important;
    display: block !important;
  }
}

/* Mobile tweaks */
@media (max-width: 540px) {
  .header.rotating-hero .overlay { gap: .55rem; padding: .7rem; padding-top: 54px; }  /* Added padding-top to move down 0.5 inch */
  .header.rotating-hero .hero-title { font-size: 1.15rem; line-height: 1.15; transform: none; display: none; }
  #daily-devotion-link a.devotion-link { padding: .35rem .6rem; font-size: .95rem; }
}

/* === Mobile photo carousel (for story sections) === */
.mobile-carousel { display: none; }

@media (max-width: 540px) {
  /* Hide stacked photos on small screens, show carousel */
  .stacked-photos { display: none !important; }
  .mobile-carousel {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    margin-top: 10px;
  }
  .mobile-carousel img {
    flex: 0 0 100%;
    width: 100%;
    height: 250px;              /* ✅ fixed height to keep everything consistent */
    object-fit: cover;          /* ✅ keeps the photo’s natural proportions */
    object-position: center;    /* ✅ centers the crop nicely */
    border-radius: 10px;
    scroll-snap-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }

  /* Revert: disable mobile carousel and show stacked images */
  .mobile-carousel { display: none !important; }
  .stacked-photos { display: block !important; }

  .text-link {
  text-decoration: none;
  color: var(--color-primary);
  font-weight: 600;
  }

  .text-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
  }
}

@media (max-width: 768px) {
  figure {
    float: none !important;
    margin: 16px auto !important;
    max-width: 90% !important;
    display: block;
  }
}

.story-section { padding: 44px 0; }
.story-section .container { max-width: 1000px; }
.story-section + .story-section { padding-top: 20px; }

.story-section { scroll-margin-top: 90px; } /* keeps headings below sticky nav */

}

.story-section {
  scroll-margin-top: 100px;  /* ensures anchor stops below navbar */
  margin-top: 80px;
  margin-bottom: 80px;
  padding-top: 20px;  /* optional, just adds breathing room inside */
}

/* 🌐 3x3 Responsive Grid Layout */
.grid.cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 columns on desktop */
  gap: 20px; /* space between the cards */
}

/* 📱 Tablet view (medium screens) */
@media (max-width: 1024px) {
  .grid.cols-3 {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on tablets */
  }
}

/* 📱 Mobile view (small screens) */
@media (max-width: 600px) {
  .grid.cols-3 {
    grid-template-columns: 1fr; /* 1 column on mobile */
  }
}

/* --- WHAT WE DO: compact top section so all 6 cards fit above the fold --- */

/* 1) Tighten top section padding (safe even if body doesn't have .whatwedo) */
.whatwedo .section:first-of-type,
.section:first-of-type {
  padding-top: clamp(0px, 1vw, 12px);
  padding-bottom: 0;
}

/* 2) Make the heading + intro more compact */
.whatwedo .section:first-of-type h1,
.section:first-of-type h1 {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  margin: 4px 0 6px;
}

.whatwedo .section:first-of-type > .container > p,
.section:first-of-type > .container > p {
  margin: 0 0 10px;
  font-size: 0.95rem;
  line-height: 1.35;
}

/* 3) Make the grid/cards smaller specifically in the first section */
.whatwedo .section:first-of-type .grid.cols-3,
.section:first-of-type .grid.cols-3 {
  gap: 10px; /* tighter rows */
}

.whatwedo .section:first-of-type .card,
.section:first-of-type .card {
  padding: 8px;
}

/* Adjust link card box size while keeping the images intact */
.section .card {
  max-width: 280px;       /* smaller card width */
  padding: 8px;           /* compact padding inside */
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Keep images fully visible but make them smaller */
.section .card img {
  width: 100%;
  height: auto;           /* keeps original aspect ratio */
  max-height: 160px;      /* controls how tall they can get */
  object-fit: contain;    /* ensures full image fits inside */
  border-radius: 8px;
  margin-bottom: 8px;
}

.whatwedo .section:first-of-type .card h3,
.section:first-of-type .card h3 {
  font-size: 0.95rem;
  margin: 4px 0 2px;
}

.whatwedo .section:first-of-type .card p,
.section:first-of-type .card p {
  font-size: 0.82rem;
  line-height: 1.25;
  margin: 0;
}

/* 4) Ensure the anchor jump doesn't hide under sticky nav anywhere */
.story-section { scroll-margin-top: 90px; }

/* Reduce hero height by ~48px (~0.5 inches) on mobile only */
@media (max-width: 480px) {
  .header.rotating-hero,
  .hero-container,
  .hero-slide {
    height: 292px !important;  /* Reduced from 340px min-height */
    min-height: 292px !important;
  }

}
