/*
Theme Name: Table Ministries
Theme URI: https://tableministries.co.uk
Author: Table Ministries
Author URI: https://tableministries.co.uk
Description: Custom theme for Table Ministries — Feasting for Freedom. Single-page design with image-based handwritten headings and editable content via the Customizer.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: table-ministries
*/

:root {
  --green: #2ecc71;
  --orange: #ee7b2b;
  --ink: #111;
  --body: #1a1a1a;
  --muted: #444;
  --max: 1280px;

  --h-feasting: 520px;
  --h-pillar: 280px;
  --h-events: 360px;
  --h-contact: 200px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #f3f3f3;
  color: var(--body);
  font-family: "Caladea", Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* Green frame */
.frame {
  background: #fff;
  border: 4px solid var(--green);
  max-width: var(--max);
  margin: 0 auto;
  min-height: 100vh;
}

.breadcrumb {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 24px 8px;
  color: #666;
  font-size: 14px;
}

/* Header / nav */
header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 60px;
  gap: 16px;
  position: relative;
}
.logo img { height: 90px; width: auto; display: block; }

nav.primary ul {
  list-style: none;
  display: flex;
  gap: 56px;
  margin: 0;
  padding: 0;
}
nav.primary a {
  font-family: "Caladea", serif;
  font-size: 19px;
  color: var(--ink);
}
nav.primary a:hover { color: var(--orange); }

/* Hamburger toggle (mobile only) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  width: 44px;
  height: 44px;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .25s, opacity .2s;
}
body.nav-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
body.nav-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
body.nav-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Announcement banner */
.tm-banner {
  position: relative;
  background: var(--orange);
  color: #fff;
  font-family: "Caladea", serif;
  font-size: 15px;
  text-align: center;
}
.tm-banner-inner {
  display: block;
  padding: 10px 48px;
  color: #fff;
  text-decoration: none;
}
a.tm-banner-inner:hover { text-decoration: underline; }
.tm-banner-close {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  opacity: .85;
}
.tm-banner-close:hover { opacity: 1; }

/* Hero */
.hero {
  width: 100%;
  aspect-ratio: 16 / 6;
  background-color: #222;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.hero-placeholder {
  background:
    repeating-linear-gradient(
      45deg,
      #1f1f1f,
      #1f1f1f 12px,
      #2a2a2a 12px,
      #2a2a2a 24px
    );
}

.site-name {
  font-family: "Caladea", serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

/* Heading images */
.heading-img {
  display: block;
  width: 100%;
  height: auto;
}
.heading-img.feasting { max-width: var(--h-feasting); }
.heading-img.pillar    { max-width: var(--h-pillar); margin: 0 auto 24px; }
.heading-img.events    { max-width: var(--h-events); }
.heading-img.contact   { max-width: var(--h-contact); margin-left: auto; }

/* Intro */
.intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  padding: 80px 100px;
}
.intro > * { min-width: 0; }
.intro .heading-img.feasting { margin-bottom: 28px; }
.intro-body { margin-bottom: 28px; max-width: 540px; }
.intro-body p { margin: 0 0 16px; }
.intro-body p:last-child { margin-bottom: 0; }
.intro .illus img { width: 100%; max-width: 520px; margin-left: auto; }

/* Logo — beat any inline width/height attributes WordPress may inject */
header.site .logo,
footer.site .logo {
  display: inline-flex;
  align-items: center;
}
header.site .logo img,
header.site .logo .site-logo-img,
header.site .logo .custom-logo {
  height: 90px !important;
  width: auto !important;
  max-width: 320px;
  display: block;
  object-fit: contain;
}
footer.site .logo img,
footer.site .logo .site-logo-img,
footer.site .logo .custom-logo {
  height: 110px !important;
  width: auto !important;
  max-width: 320px;
  display: block;
  object-fit: contain;
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-family: "Caladea", serif;
  font-size: 17px;
  cursor: pointer;
  transition: background .2s, color .2s;
  min-height: 44px;
}
.btn:hover { background: var(--ink); color: #fff; }

/* Pillars */
.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
  padding: 40px 100px 100px;
  text-align: center;
}
.pillars p { margin: 0 auto 14px; max-width: 340px; }
.pillars p:last-child { margin-bottom: 0; }
.pillar-body { max-width: 340px; margin: 0 auto; }
.pillar-body p { margin: 0 auto 14px; }
.pillar-body p:last-child { margin-bottom: 0; }

/* Events */
.events { padding: 40px 100px 60px; }
.events .heading-img.events { margin-bottom: 16px; }
.events .lede { margin: 0 0 48px; font-size: 17px; }

/* Swiper carousel — centered, with scaled side slides */
.gallery-swiper {
  width: 100%;
  padding: 30px 0;
  overflow: visible;
}
.gallery-swiper .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  width: 60%;
  max-width: 700px;
  opacity: 0.45;
  transform: scale(0.78);
  transition: opacity .45s ease, transform .45s ease;
  filter: saturate(0.7);
}
.gallery-swiper .swiper-slide-active {
  opacity: 1;
  transform: scale(1);
  filter: none;
  z-index: 2;
}
.gallery-swiper .swiper-slide img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.carousel-controls {
  display: flex;
  justify-content: space-between;
  padding: 24px 0 0;
}
.carousel-controls button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 28px;
  font-family: inherit;
  padding: 12px;
  min-width: 44px;
  min-height: 44px;
  color: var(--ink);
  transition: color .2s;
}
.carousel-controls button:hover { color: var(--orange); }

/* Decorative line — spans full width inside the frame */
.deco { padding: 60px 0 30px; }
.deco img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0;
}

/* Footer */
footer.site {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 20px 100px 60px;
  align-items: end;
}
footer.site .logo img { height: 110px; }
footer.site .copy { font-size: 14px; color: #555; margin-top: 18px; }
footer.site .contact { text-align: right; }
footer.site .contact .heading-img.contact { margin-bottom: 12px; }
footer.site .contact p { margin: 4px 0; }

/* Tablet */
@media (max-width: 1024px) {
  header.site { padding: 20px 32px; }
  .intro,
  .pillars,
  .events,
  footer.site { padding-left: 40px; padding-right: 40px; }
  .pillars { gap: 32px; }
  nav.primary ul { gap: 32px; }
}

/* Mobile */
@media (max-width: 720px) {
  :root {
    --h-feasting: 320px;
    --h-pillar: 240px;
    --h-events: 260px;
    --h-contact: 160px;
  }
  .frame { border-width: 3px; }
  .breadcrumb { padding: 10px 16px 4px; }

  header.site {
    padding: 14px 20px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
  }
  .logo img { height: 60px; }
  .nav-toggle { display: flex; }

  nav.primary {
    flex-basis: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
  }
  body.nav-open nav.primary {
    max-height: 400px;
  }
  nav.primary ul {
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    padding: 8px 0 4px;
  }
  nav.primary li {
    border-top: 1px solid #eee;
  }
  nav.primary li:first-child { border-top: none; }
  nav.primary a {
    display: block;
    padding: 14px 4px;
    font-size: 18px;
  }

  .hero { aspect-ratio: 4 / 3; }

  .intro,
  .pillars,
  .events,
  footer.site { padding-left: 20px; padding-right: 20px; }

  .intro {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 50px;
    padding-bottom: 50px;
    text-align: center;
  }
  .intro .heading-img.feasting { margin-left: auto; margin-right: auto; }
  .intro p { margin-left: auto; margin-right: auto; }
  .intro .illus img { margin: 0 auto; }

  .pillars {
    grid-template-columns: 1fr;
    gap: 48px;
    padding-top: 20px;
    padding-bottom: 70px;
  }

  .events { padding-top: 20px; }
  .gallery-swiper { padding: 16px 0; }
  .gallery-swiper .swiper-slide { width: 80%; transform: scale(0.85); }
  .gallery-swiper .swiper-slide img { height: 280px; }

  .deco { padding: 30px 0 20px; }

  footer.site {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-bottom: 40px;
    text-align: center;
  }
  footer.site .logo img { height: 90px; margin: 0 auto; }
  footer.site .contact { text-align: center; }
  footer.site .contact .heading-img.contact { margin: 0 auto 12px; }
}

@media (max-width: 380px) {
  :root {
    --h-feasting: 260px;
    --h-events: 220px;
  }
  nav.primary ul { gap: 14px; }
}

/* ==============================================
   Podcasts + Events page templates
   ============================================== */

.page-intro {
  padding: 70px 100px 30px;
  text-align: center;
}
.page-intro .heading-img {
  margin-left: auto;
  margin-right: auto;
}
.page-intro .lede {
  max-width: 640px;
  margin: 16px auto 0;
  font-size: 18px;
}

/* Episodes (Podcasts page) */
.episodes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 56px;
  padding: 30px 100px 100px;
  max-width: 1040px;
  margin: 0 auto;
}
.episode {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  align-items: start;
}
.episode + .episode {
  padding-top: 56px;
  border-top: 1px solid #eee;
}
.episode-thumb img {
  width: 100%;
  border-radius: 6px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}
.episode-title {
  font-family: "Caladea", serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 10px;
  color: var(--ink);
}
.episode-excerpt {
  color: #333;
  margin-bottom: 20px;
}
.episode-excerpt p { margin: 0 0 12px; }
.episode-excerpt p:last-child { margin-bottom: 0; }
.listen-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.listen-links .btn {
  font-size: 14px;
  padding: 9px 18px;
  min-height: 0;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* Events list */
.events-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 30px 100px 80px;
  max-width: 1040px;
  margin: 0 auto;
}
.event-card {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 40px;
  align-items: center;
  padding: 32px 0;
  background: transparent;
  border-radius: 0;
  border-top: 1px solid #eee;
}
.event-card:first-child { border-top: none; padding-top: 16px; }
.event-thumb img {
  width: 100%;
  border-radius: 6px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}
.event-title {
  font-family: "Caladea", serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--ink);
}
.event-meta {
  margin: 0 0 16px;
  color: var(--orange);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.event-desc p { margin: 0 0 14px; }

.events-gallery {
  padding: 40px 100px 60px;
}
.gallery-subtitle {
  font-family: "Caladea", serif;
  font-weight: 400;
  font-style: italic;
  font-size: 22px;
  text-align: center;
  margin: 0 0 24px;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  color: #777;
  padding: 60px 20px;
  font-style: italic;
}

/* Page templates — tablet */
@media (max-width: 1024px) {
  .page-intro,
  .episodes,
  .events-list,
  .events-gallery { padding-left: 40px; padding-right: 40px; }
}

/* Page templates — mobile */
@media (max-width: 720px) {
  .page-intro {
    padding: 50px 20px 20px;
  }
  .episodes,
  .events-list,
  .events-gallery {
    padding-left: 20px;
    padding-right: 20px;
  }
  .episodes { padding-bottom: 70px; gap: 36px; }
  .episode {
    grid-template-columns: 1fr;
    gap: 20px;
    text-align: center;
    padding-bottom: 36px;
  }
  .episode-thumb img {
    max-width: 240px;
    margin: 0 auto;
  }
  .listen-links { justify-content: center; }

  .event-card {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
    text-align: center;
  }
  .event-thumb img { max-width: 100%; }
}

/* ==============================================
   Event card — clickable + modal
   ============================================== */
.event-card {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.event-card:hover,
.event-card:focus-visible {
  background: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  outline: none;
}
.event-card:focus-visible {
  box-shadow: 0 0 0 2px var(--orange), 0 6px 20px rgba(0,0,0,0.08);
}
.event-card-cta {
  display: inline-block;
  margin-top: 8px;
  color: var(--orange);
  font-weight: 700;
  font-size: 15px;
}

/* Modal */
.event-modal[hidden] { display: none; }
.event-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.event-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  cursor: pointer;
}
.event-modal-card {
  position: relative;
  background: #fff;
  max-width: 640px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.event-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  padding: 6px 12px;
}
.event-modal-thumb {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 20px;
}
.event-modal-title {
  font-family: "Caladea", serif;
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--ink);
}
.event-modal-desc { margin: 16px 0 24px; }
.event-modal-desc p { margin: 0 0 12px; }

body.modal-open { overflow: hidden; }

/* ==============================================
   Generic page (page.php / single.php / 404 / search)
   ============================================== */
.generic-page {
  padding: 70px 100px 100px;
  max-width: 880px;
  margin: 0 auto;
}
.generic-page-title {
  font-family: "Caladea", serif;
  font-size: 38px;
  font-weight: 700;
  margin: 0 0 20px;
  color: var(--ink);
}
.generic-page-body p { margin: 0 0 16px; }
.generic-page-body h2 { font-size: 24px; margin: 32px 0 12px; }
.generic-page-body h3 { font-size: 20px; margin: 28px 0 10px; }
.generic-page-body img { border-radius: 4px; }
.generic-page-body ul, .generic-page-body ol { margin: 0 0 16px 24px; }

.single-thumb { margin-bottom: 24px; }
.single-thumb img { width: 100%; border-radius: 4px; }
.single-meta { color: var(--orange); font-weight: 700; margin: 0 0 20px; }

.post-list { list-style: none; padding: 0; margin: 0; }
.post-list-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid #eee;
}
.post-list-item:last-child { border-bottom: none; }
.post-list-thumb img { width: 100%; border-radius: 4px; }
.post-list-item h2 { margin: 0 0 8px; font-size: 22px; }
.post-list-item h2 a { color: var(--ink); }
.post-list-item h2 a:hover { color: var(--orange); }

.search-results { list-style: none; padding: 0; margin: 0 0 32px; }
.search-results li { padding: 16px 0; border-bottom: 1px solid #eee; }

@media (max-width: 1024px) {
  .generic-page { padding-left: 40px; padding-right: 40px; }
}
@media (max-width: 720px) {
  .generic-page { padding: 50px 20px 70px; }
  .generic-page-title { font-size: 28px; }
  .event-modal-card { padding: 24px 20px; }
  .event-modal-thumb { height: 180px; }
  .post-list-item { grid-template-columns: 1fr; }
}
