/* ============================================================
   Marlborough Art Society — Custom CSS
   Supplements Tailwind CDN with design tokens and gallery styles
   ============================================================ */

/* ── 1. Design Tokens ────────────────────────────────────────── */
:root {
  --walnut:        #4A3728;
  --sage:          #6B7B3C;
  --terracotta:    #C67B5C;
  --cream:         #F5F0E1;
  --gallery-white: #FAF8F3;
  --deep-earth:    #2C2420;
  --stone-gray:    #78716C;
  --sand:          #D4C4A8;

  /* Typography scale */
  --font-heading: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Lora', Georgia, serif;
  --font-ui:      'Inter', system-ui, sans-serif;
}

/* ── 2. Grain Texture Overlay ────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23grain)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 300px 300px;
}

/* ── 3. Animations ───────────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-label {
  opacity: 0;
  animation: fadeUp 600ms ease-out 200ms forwards;
}

.hero-title {
  opacity: 0;
  animation: fadeUp 600ms ease-out 400ms forwards;
}

.hero-tagline {
  opacity: 0;
  animation: fadeUp 600ms ease-out 600ms forwards;
}

.hero-divider {
  opacity: 0;
  animation: fadeUp 600ms ease-out 800ms forwards;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── 4. Homepage Content ─────────────────────────────────────── */
.homepage-content h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 600;
  color: var(--walnut);
  margin-top: 80px;
  margin-bottom: 24px;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.homepage-content h2 + p {
  color: var(--stone-gray);
  max-width: 600px;
  margin-bottom: 32px;
}

/* Card grid from unordered lists */
.homepage-content ul {
  list-style: none;
  padding: 0;
  margin: 0 0 48px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.homepage-content ul li {
  background: var(--gallery-white);
  border: 1px solid var(--sand);
  border-radius: 2px;
  padding: 32px 28px;
  transition: box-shadow 250ms ease, transform 250ms ease;
}

.homepage-content ul li:hover {
  box-shadow: 0 4px 20px rgba(74, 55, 40, 0.1);
  transform: translateY(-2px);
}

.homepage-content ul li strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--walnut);
  margin-bottom: 8px;
}

.homepage-content > p {
  max-width: 720px;
  margin-bottom: 20px;
}

.homepage-content a {
  color: var(--terracotta);
  text-decoration: none;
  border-bottom: 1px solid rgba(198, 123, 92, 0.3);
  transition: border-color 200ms ease;
}

.homepage-content a:hover {
  border-bottom-color: var(--terracotta);
}

/* ── 5. Blockquotes / Pull Quotes ────────────────────────────── */
blockquote {
  border-left: 2px solid var(--terracotta);
  padding-left: 24px;
  margin: 48px 0;
}

blockquote p {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-style: italic;
  color: var(--walnut);
  line-height: 1.5;
  margin: 0;
}

/* ── 6. Inner Page Content ───────────────────────────────────── */
.page-content h2 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--walnut);
  margin-top: 48px;
  margin-bottom: 16px;
  line-height: 1.2;
}

.page-content h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--walnut);
  margin-top: 32px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.page-content p {
  color: var(--deep-earth);
  margin-bottom: 16px;
  line-height: 1.7;
}

.page-content a {
  color: var(--terracotta);
  text-decoration: none;
  border-bottom: 1px solid rgba(198, 123, 92, 0.3);
  transition: border-color 200ms ease;
}

.page-content a:hover {
  border-bottom-color: var(--terracotta);
}

.page-content ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin-bottom: 20px;
}

.page-content ul li {
  margin-bottom: 8px;
  color: var(--deep-earth);
  line-height: 1.6;
}

.page-content strong {
  font-weight: 600;
  color: var(--walnut);
}

/* ── 7. Gallery Image Styles ──────────────────────────────────── */

/* Hero background image */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.12;
  filter: saturate(0.4);
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--cream) 0%, transparent 30%, transparent 70%, var(--cream) 100%);
}

/* Page header image — cinematic band */
.page-header-image {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 48px;
  overflow: hidden;
  border-radius: 2px;
  position: relative;
}

.page-header-image img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  object-position: center;
  display: block;
  filter: saturate(0.85);
  transition: filter 600ms ease;
}

.page-header-image:hover img {
  filter: saturate(1);
}

.page-header-image::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(transparent, var(--cream));
  pointer-events: none;
}

/* Content images — artwork on wall */
.gallery-frame {
  margin: 48px 0;
}

.gallery-frame img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  box-shadow: 0 2px 16px rgba(44, 36, 32, 0.08), 0 0 0 1px var(--sand);
  transition: box-shadow 400ms ease, transform 400ms ease;
}

.gallery-frame:hover img {
  box-shadow: 0 8px 32px rgba(44, 36, 32, 0.12), 0 0 0 1px var(--sand);
  transform: translateY(-2px);
}

.gallery-frame figcaption {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone-gray);
  margin-top: 12px;
  text-align: center;
}

/* Homepage focus card images */
.homepage-content ul li img {
  width: calc(100% + 56px);
  height: 160px;
  object-fit: cover;
  object-position: center;
  border-radius: 2px 2px 0 0;
  margin: -32px -28px 20px -28px;
  display: block;
  filter: saturate(0.85);
  transition: filter 400ms ease;
}

.homepage-content ul li:hover img {
  filter: saturate(1);
}

/* Gallery masonry grid */
.gallery-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  grid-template-rows: auto auto;
  gap: 16px;
  margin: 48px 0;
}

.gallery-grid .gallery-item {
  overflow: hidden;
  border-radius: 2px;
  position: relative;
  box-shadow: 0 2px 12px rgba(44, 36, 32, 0.06);
  transition: box-shadow 400ms ease, transform 400ms ease;
}

.gallery-grid .gallery-item:hover {
  box-shadow: 0 8px 32px rgba(44, 36, 32, 0.12);
  transform: translateY(-3px);
}

.gallery-grid .gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.85);
  transition: filter 600ms ease;
}

.gallery-grid .gallery-item:hover img {
  filter: saturate(1);
}

.gallery-grid .gallery-item--tall {
  grid-row: span 2;
}

.gallery-grid .gallery-item .gallery-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 16px 12px;
  background: linear-gradient(transparent, rgba(44, 36, 32, 0.5));
  font-family: var(--font-heading);
  font-size: 1rem;
  color: #fff;
  letter-spacing: 0.02em;
}

/* Contact panoramic */
.contact-panoramic {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 48px;
  height: 200px;
  overflow: hidden;
  border-radius: 2px;
}

.contact-panoramic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
  filter: saturate(0.7);
}

/* ── 7b. Responsive Images ────────────────────────────────────── */
@media (max-width: 768px) {
  .page-header-image img { height: 180px; }
  .contact-panoramic { height: 140px; }
  .gallery-grid { grid-template-columns: 1fr; }
  .gallery-grid .gallery-item--tall { grid-row: span 1; }
  .homepage-content ul li img {
    height: 120px;
    margin: -24px -20px 16px -20px;
    width: calc(100% + 40px);
  }
}

/* ── 8. Separator ────────────────────────────────────────────── */
.sep {
  height: 1px;
  background: var(--sand);
  max-width: 1200px;
  margin: 0 auto;
  border: none;
}

/* ── 8. Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Nav responsive */
  nav.fixed {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  nav.fixed ul {
    gap: 0.5rem;
    row-gap: 0.25rem;
  }

  nav.fixed ul a {
    font-size: 0.6rem;
    letter-spacing: 0.04em;
  }

  /* Homepage */
  .homepage-content ul {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .homepage-content h2 {
    font-size: 1.6rem;
    margin-top: 56px;
  }

  .homepage-content ul li {
    padding: 24px 20px;
  }

  blockquote p {
    font-size: 1.2rem;
  }
}

/* ── 9. Focus States (Accessibility) ──────────────────────────── */
a:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── 10. Reduced Motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hero-label,
  .hero-title,
  .hero-tagline,
  .hero-divider {
    opacity: 1;
    animation: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
