/* ============================================
   Leaf & Lute — Handcrafted Woodwork
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #FAF7F2;
  --text: #3B2F2F;
  --accent: #4A6741;
  --accent-hover: #3d5736;
  --terracotta: #C07850;
  --border: #D4C5B2;
  --bg-subtle: #F3EDE4;
  --white: #FFFFFF;
  --shadow: rgba(59, 47, 47, 0.08);
  --shadow-md: rgba(59, 47, 47, 0.12);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Lora', 'Georgia', serif;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-weight: 700;
  line-height: 1.25;
}

h1 { font-size: 3rem; }
h2 { font-size: 2rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.35rem; margin-bottom: 0.5rem; }

p {
  margin-bottom: 1rem;
}

/* --- Layout --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Header --- */
.site-header {
  padding: 2.5rem 0 0;
  text-align: center;
}

.site-title {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}

.site-title a {
  color: inherit;
  text-decoration: none;
}

.site-tagline {
  font-size: 1.05rem;
  color: var(--terracotta);
  font-style: italic;
  letter-spacing: 0.01em;
  margin-bottom: 0;
}

/* --- Navigation --- */
.site-nav {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
  margin-top: 1.5rem;
}

.site-nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 2.5rem;
}

.site-nav a {
  font-family: 'Lora', 'Georgia', serif;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* --- Hero (Gallery page) --- */
.hero {
  text-align: center;
  padding: 4rem 1.5rem 3rem;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.hero .site-tagline {
  font-size: 1.2rem;
}

/* --- Gallery Grid --- */
.gallery-section {
  padding: 2rem 0 4rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.gallery-item {
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  background-color: var(--bg-subtle);
  aspect-ratio: 4 / 3;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, opacity 0.4s ease;
  opacity: 0;
}

.gallery-item img.loaded {
  opacity: 1;
}

.gallery-item:hover img {
  transform: scale(1.03);
}

/* --- Lightbox --- */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(30, 24, 24, 0.92);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--bg);
  font-size: 2rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  line-height: 1;
  padding: 0.5rem;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--bg);
  font-size: 2.5rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  padding: 1rem;
  line-height: 1;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* --- Workshop Page --- */
.workshop-intro {
  padding: 3rem 0 2rem;
  text-align: center;
}

.workshop-intro p {
  font-size: 1.1rem;
  max-width: 640px;
  margin: 0 auto;
  color: var(--text);
}

.panorama-section {
  padding: 1.5rem 0;
}

.panorama-section h2 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.panorama-viewer {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  border-radius: 4px;
  margin-bottom: 2rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background-color: var(--bg-subtle);
  position: relative;
}

.panorama-viewer::-webkit-scrollbar {
  display: none;
}

.panorama-viewer:active {
  cursor: grabbing;
}

.panorama-viewer img {
  height: 420px;
  width: auto;
  max-width: none;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.panorama-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--border);
  font-style: italic;
  margin-top: -1.5rem;
  margin-bottom: 2rem;
}

.details-section {
  padding: 2rem 0 4rem;
}

.details-section h2 {
  text-align: center;
  margin-bottom: 2rem;
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.detail-card {
  background: var(--white);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 12px var(--shadow);
  transition: box-shadow 0.3s ease;
}

.detail-card:hover {
  box-shadow: 0 4px 20px var(--shadow-md);
}

.detail-card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.detail-card-text {
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
  line-height: 1.65;
}

/* --- Request Form Page --- */
.request-intro {
  padding: 3rem 0 1.5rem;
  text-align: center;
}

.request-intro h2 {
  margin-bottom: 0.75rem;
}

.request-intro p {
  font-size: 1.1rem;
  max-width: 540px;
  margin: 0 auto;
}

.request-form-section {
  padding: 1rem 0 4rem;
}

.request-form {
  max-width: 600px;
  margin: 0 auto;
  background: var(--white);
  padding: 2.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 16px var(--shadow);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.form-group label .optional {
  font-weight: 400;
  font-style: italic;
  color: var(--border);
  font-size: 0.85rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  font-family: 'Lora', 'Georgia', serif;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.5;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 103, 65, 0.12);
}

.form-group textarea {
  min-height: 160px;
  resize: vertical;
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%233B2F2F' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* Honeypot */
.form-group--hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Lora', 'Georgia', serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.85rem 2.5rem;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn-submit:hover {
  background: var(--accent-hover);
}

.btn-submit:active {
  transform: scale(0.98);
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-submit .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

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

.form-message {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: 4px;
  font-size: 0.95rem;
  display: none;
}

.form-message.success {
  display: block;
  background: rgba(74, 103, 65, 0.1);
  color: var(--accent);
  border: 1px solid rgba(74, 103, 65, 0.2);
}

.form-message.error {
  display: block;
  background: rgba(192, 120, 80, 0.1);
  color: var(--terracotta);
  border: 1px solid rgba(192, 120, 80, 0.2);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--border);
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .details-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .panorama-viewer img {
    height: 320px;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .site-title {
    font-size: 2.2rem;
  }

  .hero h1 {
    font-size: 2.4rem;
  }

  .site-nav ul {
    gap: 1.5rem;
  }

  .site-nav a {
    font-size: 0.85rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .gallery-item {
    aspect-ratio: 1 / 1;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }

  .panorama-viewer img {
    height: 240px;
  }

  .request-form {
    padding: 1.5rem;
  }

  .lightbox-prev { left: 0.25rem; font-size: 2rem; }
  .lightbox-next { right: 0.25rem; font-size: 2rem; }
}

/* --- Accessibility --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
