/*
Theme Name: Sudbury Meadow
Theme URI: https://www.sudburymeadow.org.uk/
Author: Sudbury Meadow Conservation Group
Description: Custom theme for Sudbury Meadow Conservation Group, Eaton Ford, St Neots.
Version: 1.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: sudbury-meadow
*/

:root {
  --bg: oklch(0.975 0.012 95);
  --ink: oklch(0.28 0.025 140);
  --ink-soft: oklch(0.4 0.03 140);
  --ink-softer: oklch(0.42 0.03 140);
  --ink-light: oklch(0.5 0.03 140);
  --green: oklch(0.42 0.09 145);
  --green-strong: oklch(0.5 0.09 145);
  --green-tint: oklch(0.9 0.05 145);
  --green-tint-text: oklch(0.32 0.08 145);
  --tan-tint: oklch(0.9 0.04 90);
  --blue-tint: oklch(0.9 0.05 200);
  --cream: oklch(0.94 0.015 100);
  --cream-card: oklch(0.99 0.008 95);
  --border: oklch(0.88 0.015 100);
  --border-strong: oklch(0.85 0.02 100);
  --white-ish: oklch(0.98 0.01 100);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'Newsreader', Georgia, serif; margin: 0; }

a { text-decoration: none; color: inherit; }

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

.wrap { max-width: 1240px; margin: 0 auto; padding-left: 48px; padding-right: 48px; }

/* ---------- Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(0.975 0.012 95 / 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 48px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.site-logo .mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green-strong);
  flex-shrink: 0;
}

.site-logo .name {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--ink);
}

.primary-menu {
  display: flex;
  gap: 8px;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.primary-menu li a {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink-soft);
  background: transparent;
}

.primary-menu li.current-menu-item a,
.primary-menu li.current_page_item a,
.primary-menu li.current-menu-parent a {
  color: var(--white-ish);
  background: var(--green);
}

/* ---------- Page shell ---------- */
.page-anim { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.page-copy { max-width: 900px; margin: 0 auto; padding: 72px 48px; }
.page-copy.narrow { max-width: 700px; }
.page-copy.wide { max-width: 1100px; }

.page-copy h1 {
  font-size: 44px;
  font-weight: 500;
  margin: 0 0 24px;
}

.page-copy .lede,
.entry-content p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

.entry-content p:last-child { margin-bottom: 0; }

/* ---------- Placeholder photos ---------- */
.placeholder-photo {
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: monospace;
  font-size: 13px;
  text-align: center;
  padding: 20px;
}
.placeholder-photo.ratio-4-3 { aspect-ratio: 4/3; }
.placeholder-photo.ratio-16-7 { aspect-ratio: 16/7; }
.placeholder-photo.ratio-1-1 { aspect-ratio: 1/1; }
.placeholder-photo.tint-green {
  background: repeating-linear-gradient(135deg, oklch(0.88 0.05 145), oklch(0.88 0.05 145) 14px, oklch(0.84 0.05 145) 14px, oklch(0.84 0.05 145) 28px);
  color: oklch(0.32 0.04 145);
}
.placeholder-photo.tint-tan {
  background: repeating-linear-gradient(45deg, oklch(0.87 0.03 90), oklch(0.87 0.03 90) 14px, oklch(0.83 0.03 90) 14px, oklch(0.83 0.03 90) 28px);
  color: oklch(0.32 0.04 90);
}
.placeholder-photo.tint-gray {
  background: repeating-linear-gradient(90deg, oklch(0.88 0.02 100), oklch(0.88 0.02 100) 16px, oklch(0.83 0.02 100) 16px, oklch(0.83 0.02 100) 32px);
  color: oklch(0.32 0.03 100);
}

/* ---------- Real photos ---------- */
.photo-frame { border-radius: 16px; overflow: hidden; }
.photo-frame.ratio-4-3 { aspect-ratio: 4/3; }
.photo-frame.ratio-16-7 { aspect-ratio: 16/7; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Home ---------- */
.home-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 56px;
  align-items: center;
  padding: 72px 48px 64px;
  max-width: 1240px;
  margin: 0 auto;
}

.home-badge {
  display: inline-block;
  background: var(--green-tint);
  color: var(--green-tint-text);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.home-hero h1 {
  font-size: 56px;
  line-height: 1.08;
  font-weight: 500;
  margin: 0 0 22px;
}

.home-hero .lede {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 480px;
  margin: 0 0 32px;
}

.home-hero .actions { display: flex; gap: 14px; }

.btn {
  padding: 14px 26px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: inline-block;
  border: none;
}
.btn-primary { background: var(--green); color: var(--white-ish); }
.btn-secondary { background: transparent; color: var(--ink-softer); border: 1.5px solid var(--border-strong); }

.home-cards-band { background: var(--cream); padding: 56px 48px; }
.home-cards {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.home-card {
  background: var(--cream-card);
  border-radius: 12px;
  padding: 28px;
  border: 1px solid var(--border);
}
.home-card .tint {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  margin-bottom: 18px;
}
.home-card h3 { font-size: 20px; font-weight: 600; margin: 0 0 8px; }
.home-card p { font-size: 14.5px; line-height: 1.55; color: var(--ink-softer); margin: 0; }

.home-split {
  max-width: 1240px;
  margin: 0 auto;
  padding: 72px 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}
.home-split h2 { font-size: 32px; font-weight: 500; margin: 0 0 16px; }
.home-split p { font-size: 16.5px; line-height: 1.65; color: var(--ink-soft); margin: 0 0 20px; }
.text-link {
  display: inline-block;
  color: var(--green);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border-bottom: 1.5px solid var(--green);
  padding-bottom: 2px;
}

.home-events { padding: 72px 48px 0; }
.home-events-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.home-events-head h2 { font-size: 32px; font-weight: 500; margin: 0; }

/* ---------- Visiting ---------- */
.visiting-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.visiting-grid h3 { font-size: 22px; font-weight: 600; margin: 0 0 14px; }
.visiting-grid p { font-size: 15.5px; line-height: 1.65; color: var(--ink-soft); margin: 0 0 22px; }
.visiting-grid ul { font-size: 15.5px; line-height: 1.8; color: var(--ink-soft); margin: 0; padding-left: 20px; }

/* ---------- Activities ---------- */
.event-row {
  display: flex;
  gap: 24px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
}
.event-row .date {
  width: 76px;
  flex-shrink: 0;
  text-align: center;
}
.event-row .date .day {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--green);
  line-height: 1;
}
.event-row .date .month {
  font-size: 13px;
  color: var(--ink-light);
  margin-top: 4px;
}
.event-row h3 { font-size: 20px; font-weight: 600; margin: 0 0 6px; }
.event-row p { font-size: 15px; line-height: 1.6; color: var(--ink-softer); margin: 0; }

/* ---------- Info box (Activities work-party essentials) ---------- */
.info-box {
  background: var(--cream);
  border-radius: 16px;
  padding: 28px 32px;
  margin-top: 40px;
}
.info-box h3 { font-size: 20px; font-weight: 600; margin: 0 0 14px; }
.info-box ul { font-size: 15px; line-height: 1.8; color: var(--ink-softer); margin: 0; padding-left: 20px; }
.info-box li { margin-bottom: 4px; }
.info-box li:last-child { margin-bottom: 0; }

/* ---------- Get Involved ---------- */
.involved-cards {
  background: var(--cream);
  border-radius: 16px;
  padding: 36px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 30px;
}
.involved-cards h3 { font-size: 20px; font-weight: 600; margin: 0 0 10px; }
.involved-cards p { font-size: 15px; line-height: 1.6; color: var(--ink-softer); margin: 0; }

/* ---------- Contact ---------- */
.contact-list { display: flex; flex-direction: column; gap: 18px; font-size: 16px; }
.contact-list p { margin: 0; }

/* ---------- Gallery (native WP Gallery block) ---------- */
.entry-content .wp-block-gallery {
  margin-top: 20px;
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px !important;
}
.entry-content .wp-block-gallery .wp-block-image {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 4/3;
  background: var(--cream);
  width: 100% !important;
  height: auto !important;
}
.entry-content .wp-block-gallery .wp-block-image a,
.entry-content .wp-block-gallery .wp-block-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
}
.entry-content .wp-block-gallery .wp-block-image figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--white-ish);
  background: linear-gradient(to top, oklch(0.2 0.03 140 / 0.75), transparent);
  text-align: left;
}
@media (max-width: 860px) {
  .entry-content .wp-block-gallery { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: oklch(0.15 0.02 140 / 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none; }
.lightbox-figure {
  margin: 0;
  max-width: min(90vw, 1100px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
  object-fit: contain;
}
.lightbox-caption {
  color: var(--white-ish);
  font-size: 14px;
  margin-top: 14px;
  text-align: center;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  background: none;
  border: none;
  color: var(--white-ish);
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: oklch(1 0 0 / 0.12);
  border: none;
  color: var(--white-ish);
  font-size: 22px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
}
.lightbox-nav:hover { background: oklch(1 0 0 / 0.22); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
@media (max-width: 640px) {
  .lightbox-close { top: 10px; right: 14px; }
  .lightbox-prev { left: 6px; }
  .lightbox-next { right: 6px; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1240px;
  margin: 0 auto;
  font-size: 14px;
  color: var(--ink-light);
}

@media (max-width: 860px) {
  .home-hero, .home-cards, .home-split, .visiting-grid, .involved-cards {
    grid-template-columns: 1fr;
  }
  .site-header { flex-direction: column; gap: 12px; padding: 16px 24px; }
  .primary-menu { flex-wrap: wrap; justify-content: center; }
  .wrap, .page-copy, .home-hero, .home-cards-band, .home-split, .site-footer { padding-left: 24px; padding-right: 24px; }
}
