/**
 * Eshcol Organic Farm - Cinematic Curved Cylindrical Gallery (Life at Eshcol Farm)
 * Exact 21st.dev reference architecture:
 * - Large, complete rectangular photographs (380px x 235px on desktop)
 * - 3D cylindrical perspective curvature (cards curve in from edges, flatten in center, curve away and fade)
 * - Smooth, continuous, infinite seamless loop
 * - Forest green & warm ivory Eshcol branding, fully responsive on 360px-430px mobile, tablet, and desktop
 * - Zero horizontal page overflow
 */

/* Section Wrapper */
.farm-gallery-section {
  position: relative;
  background: var(--color-bg-surface, #fcfaf7);
  padding: 3.8rem 0 4.2rem;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
  max-width: 100vw;
}

.farm-gallery-section .container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  box-sizing: border-box;
}

/* Outer Hero Card Container matching 21st.dev dark card container */
.tilted-grid-hero-card {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 480px;
  margin: 0 auto;
  padding-bottom: 2rem;
  border-radius: 28px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #18442d 0%, #0d281a 62%, #081a10 100%);
  border: 1px solid rgba(82, 183, 136, 0.28);
  box-shadow: 0 24px 60px rgba(8, 26, 16, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  contain: paint;
}

/* Atmospheric Ambient Lights */
.tilted-grid-hero-card::before {
  content: "";
  position: absolute;
  top: -20%;
  left: 20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(ellipse, rgba(149, 213, 178, 0.16) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

.tilted-grid-hero-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: linear-gradient(to top, rgba(8, 26, 16, 0.85) 0%, transparent 100%);
  pointer-events: none;
  z-index: 8;
}

/* Top Header */
.tilted-grid-header-wrap {
  position: relative;
  z-index: 10;
  padding: 2.2rem 1.25rem 0.5rem;
  text-align: center;
  pointer-events: none;
  box-sizing: border-box;
}

.tilted-grid-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(216, 243, 220, 0.12);
  border: 1px solid rgba(149, 213, 178, 0.3);
  color: #95d5b2;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 9999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-bottom: 0.65rem;
}

.tilted-grid-title {
  font-family: var(--font-heading, "Playfair Display", Georgia, serif);
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.15;
  margin: 0 0 0.4rem;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.6);
  letter-spacing: -0.01em;
}

.tilted-grid-subtitle {
  font-size: 1rem;
  color: #d8f3dc;
  margin: 0 auto;
  line-height: 1.45;
  font-weight: 400;
  max-width: 520px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* 3D Perspective Stage Container */
.tilted-grid-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 275px;
  margin: auto 0;
  overflow: hidden;
  contain: paint;
  perspective: 1200px;
  perspective-origin: 50% 50%;
  mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
  z-index: 5;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  touch-action: pan-y;
  box-sizing: border-box;
}

.tilted-grid-stage:active {
  cursor: grabbing;
}

/* Continuous 3D Cylindrical Track */
.tilted-grid-track {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  transform-style: preserve-3d;
  will-change: transform;
  pointer-events: auto;
}

/* Complete Large Rectangular Photo Tile Card */
.tilted-photo-card {
  position: absolute;
  top: 50%;
  left: 0;
  width: var(--tilted-card-w, 380px);
  height: var(--tilted-card-h, 235px);
  margin-top: calc(var(--tilted-card-h, 235px) * -0.5);
  border-radius: 18px;
  overflow: hidden;
  background: #143525;
  border: 1px solid rgba(138, 204, 163, 0.35);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.3);
  transform-style: preserve-3d;
  will-change: transform, opacity;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

.tilted-photo-card:hover {
  border-color: rgba(183, 228, 199, 0.8);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.7), 0 0 24px rgba(82, 183, 136, 0.4);
}

.tilted-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  filter: contrast(1.03) saturate(1.08);
  transition: transform 0.4s ease;
  -webkit-user-drag: none;
}

.tilted-photo-card:hover .tilted-photo-img {
  transform: scale(1.04);
}

/* Card Caption Gradient Overlay */
.tilted-photo-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2.2rem 1rem 0.85rem;
  background: linear-gradient(to top, rgba(8, 26, 16, 0.94) 0%, rgba(8, 26, 16, 0.65) 60%, transparent 100%);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 2;
  box-sizing: border-box;
}

.tilted-photo-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 65%;
}

.tilted-photo-tag {
  font-size: 0.66rem;
  font-weight: 600;
  color: #95d5b2;
  background: rgba(13, 40, 26, 0.8);
  border: 1px solid rgba(82, 183, 136, 0.35);
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Bottom Footer Caption Strip */
.tilted-grid-footer-wrap {
  position: relative;
  z-index: 10;
  padding: 0 1.25rem 1.5rem;
  text-align: center;
  pointer-events: none;
  box-sizing: border-box;
}

.tilted-grid-footer-text {
  font-size: 0.84rem;
  color: #95d5b2;
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.9;
}

/* Accessibility: Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .tilted-photo-card {
    transition: none !important;
  }
}

/* Responsive: Tablet Breakpoints (992px & 768px) */
@media (max-width: 992px) {
  .tilted-grid-hero-card {
    min-height: 430px;
    padding-bottom: 1.5rem;
    border-radius: 24px;
  }

  .tilted-grid-stage {
    height: 240px;
  }

  .tilted-grid-title {
    font-size: 2.15rem;
  }

  .tilted-grid-subtitle {
    font-size: 0.94rem;
  }
}

@media (max-width: 768px) {
  .farm-gallery-section {
    padding: 2.8rem 0 3.2rem;
  }

  .farm-gallery-section .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .tilted-grid-hero-card {
    min-height: 380px;
    padding-bottom: 1.25rem;
    border-radius: 20px;
  }

  .tilted-grid-stage {
    height: 215px;
    mask-image: linear-gradient(90deg, transparent 0%, #000 8%, #000 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 8%, #000 92%, transparent 100%);
  }

  .tilted-photo-card {
    border-radius: 14px;
  }

  .tilted-grid-header-wrap {
    padding: 1.6rem 0.85rem 0.25rem;
  }

  .tilted-grid-title {
    font-size: 1.85rem;
  }

  .tilted-grid-subtitle {
    font-size: 0.88rem;
    max-width: 340px;
  }
}

/* Mobile Screens: 430px, 390px, 375px, 360px */
@media (max-width: 430px) {
  .farm-gallery-section {
    padding: 2rem 0 2.4rem;
  }

  .farm-gallery-section .container {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .tilted-grid-hero-card {
    min-height: 335px;
    padding-bottom: 0.9rem;
    border-radius: 16px;
  }

  .tilted-grid-stage {
    height: 185px;
    mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
  }

  .tilted-photo-card {
    border-radius: 12px;
  }

  .tilted-grid-header-wrap {
    padding: 1.25rem 0.5rem 0.15rem;
  }

  .tilted-grid-badge {
    font-size: 0.68rem;
    padding: 3px 10px;
    margin-bottom: 0.4rem;
  }

  .tilted-grid-title {
    font-size: 1.45rem;
    margin-bottom: 0.25rem;
  }

  .tilted-grid-subtitle {
    font-size: 0.8rem;
    max-width: 275px;
    line-height: 1.35;
  }

  .tilted-photo-info {
    padding: 2rem 0.75rem 0.65rem;
  }

  .tilted-photo-title {
    font-size: 0.76rem;
  }

  .tilted-photo-tag {
    font-size: 0.58rem;
    padding: 1px 5px;
  }
}

@media (max-width: 375px) {
  .tilted-grid-hero-card {
    min-height: 320px;
  }

  .tilted-grid-stage {
    height: 175px;
  }

  .tilted-grid-title {
    font-size: 1.32rem;
  }

  .tilted-grid-subtitle {
    font-size: 0.75rem;
    max-width: 250px;
  }

  .tilted-photo-title {
    font-size: 0.72rem;
  }
}

@media (max-width: 360px) {
  .tilted-grid-hero-card {
    min-height: 305px;
  }

  .tilted-grid-stage {
    height: 168px;
  }

  .tilted-grid-title {
    font-size: 1.22rem;
  }

  .tilted-photo-title {
    font-size: 0.68rem;
  }
}
