/*
  Bisley Camping - Global Styles
  - Clean, minimal aesthetic with generous white space
  - Elegant serif headings, modern sans-serif body copy
  - Muted natural palette
  Customize colors, spacing, and typography via CSS variables below.
*/

:root {
  /* Cotswolds-inspired color palette */
  --color-bg: #f8f7f5; /* timberwolf 900 */
  --color-surface: #ffffff;
  --color-text: #344e41; /* brunswick green */
  --color-muted: #588157; /* fern green */
  --color-accent: #3a5a40; /* hunter green */
  --color-accent-2: #a3b18a; /* sage */
  --color-accent-3: #dad7cd; /* timberwolf */
  --color-border: #e2dfd7; /* timberwolf 600 */
  --color-warm: #b6b09c; /* timberwolf 400 */
  --color-soft: #e9e7e1; /* timberwolf 700 */

  /* Typography */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  --font-serif: "Playfair Display", Georgia, Cambria, "Times New Roman", Times, serif;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;

  /* Layout */
  --max-w: 1200px;
  --radius: 12px;
  --shadow-soft: 0 10px 30px rgba(0,0,0,0.06);
  --shadow-subtle: 0 2px 8px rgba(0,0,0,0.05);
}

/* Loading animation */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-radius: 50%;
  border-top-color: var(--color-accent);
  animation: spin 1s ease-in-out infinite;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Form loading states */
.form-loading {
  position: relative;
  pointer-events: none;
}

.form-loading .btn {
  opacity: 0.7;
  cursor: not-allowed;
}

.form-loading .btn .loading-spinner {
  display: inline-block;
}

/* Page overlay for form submissions */
.page-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(248, 247, 245, 0.8);
  backdrop-filter: blur(2px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-4);
}

.page-loading-overlay.active {
  display: flex;
}

.page-loading-content {
  background: var(--color-surface);
  padding: var(--space-6);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  text-align: center;
  max-width: 300px;
}

.page-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-radius: 50%;
  border-top-color: var(--color-accent);
  animation: spin 1s ease-in-out infinite;
  margin: 0 auto var(--space-4);
}

.page-loading-text {
  color: var(--color-text);
  font-weight: 500;
  margin: 0;
}

.page-loading-subtext {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin: var(--space-2) 0 0;
}

/* CSS Reset (light) */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-sans); color: var(--color-text); background: var(--color-bg); line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { padding-left: 1.1rem; }

/* Image loading optimizations */
img {
  max-width: 100%;
  display: block;
  height: auto;
  transition: opacity 0.3s ease;
}

img[loading="lazy"] {
  opacity: 0;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Preload critical images */
.hero-image .hero-bg {
  will-change: transform;
  backface-visibility: hidden;
}

/* Typography */
h1, h2, h3, h4 { font-family: var(--font-serif); color: var(--color-text); line-height: 1.25; margin: 0 0 var(--space-4); }
p { margin: 0 0 var(--space-4); color: var(--color-muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; color: var(--color-accent); }

/* Layout helpers */
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 var(--space-5); }
.section { padding: var(--space-10) 0; }
.surface { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,0.8); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--color-border); }
.site-header .inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-family: var(--font-serif); font-size: 1.25rem; letter-spacing: 0.02em; }
.nav { display: flex; gap: var(--space-5); align-items: center; }
.nav a { color: var(--color-text); opacity: 0.9; }
.nav a:hover { color: var(--color-accent); }
.nav .cta { padding: 0.55rem 1rem; background: var(--color-accent); color: #fff; border-radius: 999px; box-shadow: var(--shadow-subtle); }
.nav .cta:hover { background: var(--color-accent-2); }
.menu-toggle { display: none; }

@media (max-width: 900px) {
  .menu-toggle { display: block; background: none; border: none; font-size: 1.25rem; }
  .nav { position: absolute; right: var(--space-5); top: 64px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-4); display: none; flex-direction: column; align-items: flex-start; }
  .nav.open { display: flex; }
}

/* Hero */
.hero { padding: var(--space-10) 0; }
.hero-header { text-align: center; margin-bottom: var(--space-8); }
.hero-header .eyebrow { color: var(--color-accent); font-size: 0.9rem; font-weight: 600; letter-spacing: 0.1em; margin-bottom: var(--space-3); }
.hero-header h1 { color: var(--color-text); font-size: clamp(2.5rem, 7vw, 4rem); margin-bottom: var(--space-3); }
.hero-tagline { color: var(--color-muted); font-size: 1.1rem; font-weight: 500; margin: 0; font-family: var(--font-serif); }
.hero-image { position: relative; height: 80vh; margin-bottom: var(--space-8); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-soft); }
.hero-image .hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: saturate(110%) contrast(1.1); }
.hero-content { text-align: center; max-width: 800px; margin: 0 auto; }
.hero-content p { color: var(--color-text); font-size: clamp(1.1rem, 2.5vw, 1.3rem); line-height: 1.6; }

/* Cards & media */
.card { overflow: hidden; border-radius: var(--radius); background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-soft); }
.card .image { aspect-ratio: 4/3; background: #ddd; }
.card .body { padding: var(--space-5); }
.media { border-radius: var(--radius); overflow: hidden; }
.media img { width: 100%; height: 100%; object-fit: cover; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 1.25rem; border-radius: 999px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); transition: all .2s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-subtle); }
.btn.primary { background: var(--color-accent); color: #fff; border-color: transparent; }
.btn.primary:hover { background: var(--color-accent-2); }

/* Footer */
.site-footer { background: var(--color-surface); border-top: 1px solid var(--color-border); padding: var(--space-8) 0; }
.site-footer .cols { display: grid; gap: var(--space-6); grid-template-columns: 2fr 1fr 1fr; }
.site-footer p, .site-footer a { color: var(--color-muted); }
.site-footer .brand { font-size: 1.1rem; }
@media (max-width: 900px) {
  .site-footer .cols { grid-template-columns: 1fr; }
}

/* Forms */
form { width: 100%; }
.field { margin-bottom: var(--space-5); }
.field label { display: block; margin-bottom: 0.4rem; font-weight: 500; color: var(--color-text); }
.field input, .field select, .field textarea { width: 100%; padding: 0.8rem 0.9rem; border-radius: 10px; border: 1px solid var(--color-border); background: #fff; font: inherit; color: var(--color-text); }
.field textarea { min-height: 120px; resize: vertical; }
.help { font-size: 0.85rem; color: var(--color-muted); margin-top: 0.35rem; }
.error { color: #9b2c2c; font-size: 0.85rem; margin-top: 0.25rem; }
.invalid input, .invalid select, .invalid textarea { border-color: #e08a8a; background: #fff7f7; }

/* Booking form */
.steps { display: flex; gap: var(--space-4); margin-bottom: var(--space-6); align-items: center; }
.step { display: flex; align-items: center; gap: 0.6rem; color: var(--color-muted); }
.step .dot { width: 28px; height: 28px; border-radius: 50%; background: #eee; display: grid; place-items: center; font-weight: 600; color: #777; }
.step.active { color: var(--color-text); }
.step.active .dot { background: var(--color-accent); color: #fff; }
.step.done .dot { background: var(--color-accent-2); color: #fff; }
.form-step { display: none; }
.form-step.active { display: block; }

/* Gallery grids */
.gallery { display: grid; gap: var(--space-5); grid-template-columns: repeat(12, 1fr); }
.gallery .item { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-subtle); grid-column: span 4; }
.gallery .item.tall { grid-row: span 2; }
.gallery .item img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 900px) { .gallery .item { grid-column: span 6; } }
@media (max-width: 600px) { .gallery { grid-template-columns: 1fr 1fr; } .gallery .item { grid-column: auto; } }

/* Dynamic Availability Calendar */
.calendar { 
  border: 1px solid var(--color-border); 
  border-radius: var(--radius); 
  background: var(--color-surface); 
  padding: var(--space-5); 
  box-shadow: var(--shadow-subtle); 
}

.cal-head { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  margin-bottom: var(--space-3); 
}

.cal-nav {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--color-text);
  transition: all 0.2s ease;
}

.cal-nav:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
}

.cal-subtitle {
  margin-bottom: var(--space-4);
  text-align: center;
}

.cal-grid { 
  display: grid;
  grid-template-columns: repeat(7, 1fr); 
  text-align: center; 
  gap: 2px;
  margin-bottom: var(--space-4);
}

.cal-day-header {
  font-weight: 600;
  color: var(--color-muted);
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.cal-day { 
  padding: 0.6rem 0; 
  border-radius: 6px; 
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-day.empty {
  cursor: default;
  background: transparent;
}

.cal-day.past {
  color: var(--color-muted);
  cursor: default;
}

.cal-day.available {
  background: #e8f5e8;
  color: #2d5a2d;
  border: 1px solid #c3e6c3;
}

.cal-day.available:hover {
  background: #d4edda;
  border-color: #28a745;
}

.cal-day.pending {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.cal-day.pending:hover {
  background: #ffeaa7;
  border-color: #ffc107;
}

.cal-day.confirmed {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  cursor: not-allowed;
}

.cal-legend {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid;
}

.legend-dot.available {
  background: #e8f5e8;
  border-color: #c3e6c3;
}

.legend-dot.pending {
  background: #fff3cd;
  border-color: #ffeaa7;
}

.legend-dot.confirmed {
  background: #f8d7da;
  border-color: #f5c6cb;
}

.cal-loading {
  text-align: center;
  color: var(--color-muted);
  font-style: italic;
  padding: var(--space-3);
}

/* Animations */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Utilities */
.center { text-align: center; }
.lead { font-size: 1.25rem; color: var(--color-text); line-height: 1.7; }
.muted { color: var(--color-muted); }
.stack-lg > * + * { margin-top: var(--space-6); }

/* New section styles */
.section-alt { background: var(--color-soft); }
.testimonials-container { margin-top: var(--space-6); }
.testimonial { background: var(--color-surface); border-left: 4px solid var(--color-accent-2); padding: var(--space-6); border-radius: var(--radius); box-shadow: var(--shadow-subtle); margin-bottom: var(--space-5); }
.testimonial p { font-style: italic; margin-bottom: var(--space-4); font-size: 1rem; line-height: 1.6; }
.testimonial .author { font-weight: 600; color: var(--color-accent); }
.testimonials-controls { text-align: center; margin-top: var(--space-6); }
.feature-card { background: var(--color-surface); padding: var(--space-6); border-radius: var(--radius); box-shadow: var(--shadow-subtle); border: 1px solid var(--color-border); text-align: center; }

/* Image Gallery */
.image-gallery { position: relative; }
.main-image { position: relative; aspect-ratio: 4/3; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.main-image img { width: 100%; height: 100%; object-fit: cover; }
.gallery-controls { position: absolute; top: 50%; transform: translateY(-50%); width: 100%; display: flex; justify-content: space-between; padding: 0 var(--space-4); pointer-events: none; }
.gallery-btn { background: rgba(0,0,0,0.6); color: white; border: none; width: 40px; height: 40px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; pointer-events: all; transition: background 0.2s; }
.gallery-btn:hover { background: rgba(0,0,0,0.8); }
.thumbnail-container { display: flex; gap: var(--space-2); padding: var(--space-3); background: var(--color-soft); border-radius: 0 0 var(--radius) var(--radius); overflow-x: auto; }
.thumbnail { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; cursor: pointer; opacity: 0.7; transition: opacity 0.2s, transform 0.2s; flex-shrink: 0; }
.thumbnail:hover { opacity: 1; transform: scale(1.05); }
.thumbnail.active { opacity: 1; border: 2px solid var(--color-accent); }

.feature-card h3 { color: var(--color-accent); margin-bottom: var(--space-3); }
.feature-card p { color: var(--color-muted); }

/* Video container */
.video-container { position: relative; width: 100%; height: 0; padding-bottom: 56.25%; /* 16:9 aspect ratio */ }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: var(--radius); }

/* Gallery video item */
.video-item { position: relative; cursor: pointer; overflow: hidden; }
.video-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; transition: background 0.3s; }
.video-overlay:hover { background: rgba(0,0,0,0.7); }
.play-button { font-size: 3rem; margin-bottom: var(--space-2); text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.video-overlay p { margin: 0; font-size: 0.9rem; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.9rem 0.75rem; border-bottom: 1px solid var(--color-border); }
thead th { font-family: var(--font-serif); font-weight: 600; }

/* Hero spacing on top to compensate sticky header when jumping via anchors */
.anchor-offset { scroll-margin-top: 80px; }

/* End of global styles */


