/*
 * Cadogan Cemeteries Society
 * Premium NPO Design System
 */

:root {
  --primary: #1B4332; /* Deep forest green */
  --accent: #C9A84C; /* Warm gold */
  --bg-color: #F5F0E8; /* Off-white / parchment */
  --text-dark: #2C2C2C; /* Charcoal */
  --text-light: #F5F0E8;
  --footer-bg: #1A1A1A; /* Deep Charcoal */
  
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Inter', sans-serif;
  
  --container-max: 1200px;
  --radius: 6px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --transition: 0.3s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  color: var(--text-dark);
  background-color: var(--bg-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--primary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--accent);
}

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

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

/* Typography Helpers */
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.py-5 { padding-top: 5rem; padding-bottom: 5rem; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary);
  color: var(--text-light);
  border-radius: var(--radius);
  font-weight: 500;
  border: 1px solid var(--primary);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.btn:hover {
  background-color: transparent;
  color: var(--primary);
}
.btn-accent {
  background-color: var(--accent);
  color: var(--text-dark);
  border-color: var(--accent);
}
.btn-accent:hover {
  background-color: transparent;
  color: var(--accent);
}

/* Header & Nav */
.site-header {
  background-color: var(--bg-color);
  border-bottom: 1px solid rgba(27, 67, 50, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: padding var(--transition), box-shadow var(--transition), background-color var(--transition);
  padding: 1.5rem 0;
}
.site-header.scrolled {
  padding: 0.5rem 0;
  box-shadow: var(--shadow);
  background-color: rgba(245, 240, 232, 0.98);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo-block {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo-svg {
  width: 48px;
  height: 48px;
  fill: var(--primary);
}
.logo-text {
  display: flex;
  flex-direction: column;
}
.logo-text .name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.2;
}
.logo-text .tagline {
  font-size: 0.85rem;
  color: #555;
  font-style: italic;
  font-family: var(--font-heading);
}

.main-nav {
  display: flex;
  align-items: center;
}
.nav-list {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  overflow: visible;
}
.nav-list li a {
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding-bottom: 4px;
}
.nav-list li a::after {
  content: '';
  position: absolute;
  width: 0%;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--accent);
  transition: width var(--transition);
}
.nav-list li a:hover::after,
.nav-list li a.active::after {
  width: 100%;
}
.nav-list li a.active {
  color: var(--primary);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}
.menu-toggle span {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--primary);
  margin-bottom: 5px;
  transition: var(--transition);
}

/* Footer */
.site-footer {
  background-color: var(--footer-bg);
  color: var(--text-light);
  padding: 4rem 0 0;
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
}
.footer-col h3 {
  color: var(--accent);
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  position: relative;
  padding-bottom: 0.5rem;
}
.footer-col h3::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 30px;
  height: 2px;
  background-color: var(--accent);
}
.footer-col p {
  color: #ccc;
  margin-bottom: 1rem;
}
.footer-col .logo-block {
  margin-bottom: 1rem;
}
.footer-logo-svg {
  width: 48px;
  height: 48px;
  fill: var(--text-light);
}
.footer-logo-svg .accent {
  fill: var(--accent);
}
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-links li {
  margin-bottom: 0.75rem;
}
.footer-links a {
  color: #ccc;
}
.footer-links a:hover {
  color: var(--accent);
}
.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: #ccc;
}
.contact-icon {
  width: 20px;
  height: 20px;
  fill: var(--accent);
  flex-shrink: 0;
  margin-top: 3px;
}
.footer-bottom {
  text-align: center;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: #888;
  font-size: 0.85rem;
}

/* Back to Top */
#back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 45px;
  height: 45px;
  background-color: var(--primary);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
  z-index: 999;
}
#back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
#back-to-top svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
#back-to-top:hover {
  background-color: var(--accent);
  color: var(--text-dark);
}

/* Sections & Cards */
.section {
  padding: 5rem 0;
}
.section-alt {
  background-color: rgba(27, 67, 50, 0.05); /* very light primary variant */
}
.section-heading {
  text-align: center;
  margin-bottom: 3rem;
  font-family: var(--font-heading);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  border-bottom: 3px solid var(--accent);
  transition: transform var(--transition);
}
.card:hover {
  transform: translateY(-5px);
}
.card h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

/* Hero Section */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  background-size: cover;
  background-position: center;
  background-color: var(--primary);
  color: var(--text-light);
  text-align: center;
}
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(27, 67, 50, 0.6);
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.hero-title {
  color: var(--text-light);
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
.hero-text {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

/* Animations */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}
.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: var(--font-body);
  transition: border-color var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
}
textarea.form-control {
  resize: vertical;
  min-height: 150px;
}

/* Event List */
.event-item {
  display: flex;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.event-date {
  background-color: var(--primary);
  color: var(--text-light);
  padding: 1.5rem;
  text-align: center;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.event-date .month { font-weight: 600; text-transform: uppercase; font-size: 0.9rem; }
.event-date .day { font-size: 2rem; font-family: var(--font-heading); font-weight: bold; line-height: 1; }
.event-details {
  padding: 1.5rem;
  flex-grow: 1;
}

/* Gallery & Lightbox */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.gallery-item {
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.gallery-item:hover img {
  transform: scale(1.05);
}
.gallery-caption-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 1rem;
  font-size: 0.9rem;
  transform: translateY(100%);
  transition: transform var(--transition);
}
.gallery-item:hover .gallery-caption-overlay {
  transform: translateY(0);
}

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition);
}
.lightbox.active {
  opacity: 1;
  visibility: visible;
}
.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90vh;
}
.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}
.lightbox-caption {
  color: #fff;
  text-align: center;
  padding-top: 1rem;
  font-style: italic;
}
.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 2rem;
  padding: 1rem;
  cursor: pointer;
  border-radius: 5px;
  transition: background var(--transition);
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* Timeline components */
.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}
.timeline::after {
  content: '';
  position: absolute;
  width: 2px;
  background-color: var(--accent);
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -1px;
}
.timeline-item {
  padding: 10px 40px;
  position: relative;
  background-color: inherit;
  width: 50%;
}
.timeline-item::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  right: -8px;
  background-color: var(--bg-color);
  border: 3px solid var(--primary);
  top: 15px;
  border-radius: 50%;
  z-index: 1;
}
.left-tc {
  left: 0;
}
.right-tc {
  left: 50%;
}
.right-tc::after {
  left: -8px;
}
.timeline-content {
  padding: 20px;
  background-color: white;
  position: relative;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.timeline-date {
  font-family: var(--font-heading);
  color: var(--primary);
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

/* Responsive Styles */
@media (max-width: 992px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .hero-title { font-size: 2.5rem; }
  
  .menu-toggle { display: block; }
  .nav-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg-color);
    flex-direction: column;
    gap: 0;
    padding: 1rem 0;
    box-shadow: var(--shadow);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    white-space: normal;
  }
  .nav-list.open {
    max-height: 400px;
  }
  .nav-list li a {
    display: block;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
  }
  
  .timeline::after { left: 31px; }
  .timeline-item { width: 100%; padding-left: 70px; padding-right: 25px; }
  .timeline-item::after { left: 23px; }
  .right-tc { left: 0%; }
  
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
