/**
 * ══════════════════════════════════════════════════════════════════════
 * True-3D Cylindrical Hero Slider
 * Nagar Panchayat Shergarh (nagarpanchayatshergarh.in)
 * ══════════════════════════════════════════════════════════════════════
 * Mathematically correct 3D cylinder where cards are distributed around
 * a cylindrical circumference (rotateY + translateZ) with preserve-3d,
 * real physical depth, backface visibility through front gaps,
 * dynamic ambient lighting, and inertia drag physics.
 * Enlarged visual scale (+25-45% image area) for maximum immersion.
 */

:root {
  --cyl-card-width: 550px;
  --cyl-card-height: 440px;
  --cyl-radius: 530px;
  --cyl-pitch: -2deg;
  --cyl-stage-height: 480px;
  --cyl-perspective: 1350px;
  --cyl-accent: var(--np-primary, #5D0D1A);
  --cyl-accent-deep: #3E060F;
  --cyl-gold: var(--np-secondary, #9FB2AC);
}

/* ═══ SECTION CONTAINER ═══ */
.cyl-hero-section {
  position: relative;
  width: 100%;
  background: radial-gradient(circle at 50% 35%, rgba(159, 178, 172, 0.22) 0%, rgba(244, 236, 216, 0.85) 60%, var(--np-supportive, #F4ECD8) 100%);
  padding: 2px 0 10px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  isolation: isolate;
}

/* 3D Perspective Stage */
.cyl-stage {
  position: relative;
  width: 100%;
  height: var(--cyl-stage-height);
  perspective: var(--cyl-perspective);
  perspective-origin: 50% 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default !important;
  touch-action: pan-y !important;
  outline: none;
}

.cyl-stage:active,
.cyl-stage.is-dragging {
  cursor: default !important;
}

/* ═══ 3D GROUND FLOOR SHADOW ═══ */
.cyl-ground-shadow {
  position: absolute;
  top: 62%;
  left: 50%;
  width: calc(var(--cyl-radius) * 2.4);
  height: calc(var(--cyl-radius) * 1.15);
  transform: translate(-50%, -50%) rotateX(82deg);
  background: radial-gradient(ellipse at center, rgba(93, 13, 26, 0.32) 0%, rgba(159, 178, 172, 0.18) 45%, rgba(0, 0, 0, 0) 75%);
  pointer-events: none;
  filter: blur(16px);
  z-index: 1;
}

/* ═══ 3D REVOLVING CYLINDER RING ═══ */
.cyl-ring {
  position: relative;
  width: var(--cyl-card-width);
  height: var(--cyl-card-height);
  transform-style: preserve-3d;
  will-change: transform;
  transform-origin: 50% 50% 0;
  /* Center of cylinder pushed back by -radius so front-facing card aligns at Z=0 */
  transform: translateZ(calc(-1 * var(--cyl-radius))) rotateX(var(--cyl-pitch)) rotateY(0deg);
  z-index: 2;
}

/* ═══ 3D CYLINDER CARD ═══ */
.cyl-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  /* CRITICAL: backface-visibility visible allows true 3D spatial presence through front gaps */
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  border-radius: 18px;
  transform-origin: 50% 50% 0;
  will-change: transform;
  transform: rotateY(var(--cyl-card-angle, 0deg)) translateZ(var(--cyl-radius));
  transition: box-shadow 0.25s ease;
  cursor: default !important;
  user-select: none;
  -webkit-user-drag: none;
}

/* Card inner wrapper - Professional Gallery Picture Frame Structure */
.cyl-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
  background: #140306;
  /* Authentic high-grade photographic exhibition frame */
  border: 6px solid #FFFFFF;
  outline: 1.5px solid rgba(159, 178, 172, 0.65);
  outline-offset: -3px;
  box-shadow: 0 22px 50px -10px rgba(45, 6, 12, 0.48),
              0 6px 20px rgba(0, 0, 0, 0.22),
              inset 0 0 10px rgba(0, 0, 0, 0.35);
  transform-style: preserve-3d;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Front card highlight with Bloodstone / Misty Sage illumination */
.cyl-card.is-active .cyl-card-inner {
  border: 6px solid #FFFFFF;
  outline: 2.5px solid var(--np-secondary, #9FB2AC);
  outline-offset: -3px;
  box-shadow: 0 28px 65px -10px rgba(93, 13, 26, 0.55),
              0 10px 28px rgba(0, 0, 0, 0.3),
              0 0 40px rgba(159, 178, 172, 0.42),
              inset 0 0 12px rgba(0, 0, 0, 0.25);
}

/* Photo Frame Container */
.cyl-photo-frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 11px;
  border: 2px solid #FAF7F2;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
}

/* Card Image - Professional Fit */
.cyl-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 36%;
  display: block;
  pointer-events: none;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Soft, natural gradient vignette (preserves 75% natural image brightness) */
.cyl-card-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.25) 70%, rgba(14, 5, 0, 0.88) 100%);
  pointer-events: none;
  border-radius: 11px;
}

/* Lighting / Depth Shader layer */
.cyl-card-lighting {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: var(--cyl-depth-shadow, 0);
  pointer-events: none;
  transition: opacity 0.15s linear;
  border-radius: 11px;
}

/* Dynamic rim highlight */
.cyl-card-rimlight {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(159, 178, 172, 0.12) 50%, rgba(0, 0, 0, 0) 100%);
}

/* Card Caption / Content */
.cyl-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 22px;
  color: #fff;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

.cyl-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  background: var(--np-gradient-badge, linear-gradient(135deg, #5D0D1A 0%, #761423 100%));
  color: var(--np-supportive, #F4ECD8);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2.5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(159, 178, 172, 0.4);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.cyl-card-title {
  margin: 0;
  font-family: 'Eczar', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #FFFFFF;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cyl-card-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(255, 240, 225, 0.9);
  font-weight: 500;
}

/* ═══ REVERSE-SIDE / BACKFACE PHYSICAL STYLING (Hidden for clean presentation) ═══ */
.cyl-card-backside {
  display: none !important;
}

/* ═══ CONTROLS & NAVIGATION ═══ */
.cyl-controls-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: calc(var(--cyl-card-width) + 120px);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  z-index: 10;
}

.cyl-nav-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(244, 236, 216, 0.94);
  border: 1.5px solid rgba(93, 13, 26, 0.35);
  color: var(--np-primary, #5D0D1A);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(93, 13, 26, 0.16),
              0 2px 6px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cyl-nav-btn:hover {
  background: var(--np-gradient-btn, linear-gradient(135deg, #741221 0%, #5D0D1A 45%, #3E060F 100%));
  color: var(--np-supportive, #F4ECD8);
  border-color: #3E060F;
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(93, 13, 26, 0.38);
}

.cyl-nav-btn:active {
  transform: scale(0.96);
}

.cyl-nav-btn:focus-visible {
  outline: 3px solid var(--np-primary, #5D0D1A);
  outline-offset: 3px;
}

/* ═══ PAGINATION & STATUS DOCK ═══ */
.cyl-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 4px;
  z-index: 10;
  position: relative;
}

.cyl-dots {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 249, 235, 0.85);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(159, 178, 172, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cyl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(93, 13, 26, 0.25);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cyl-dot:hover {
  background: rgba(93, 13, 26, 0.55);
}

.cyl-dot.is-active {
  width: 26px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--np-primary, #5D0D1A), #3E060F);
  box-shadow: 0 2px 8px rgba(93, 13, 26, 0.35);
}

.cyl-dot:focus-visible {
  outline: 2px solid var(--np-primary, #5D0D1A);
  outline-offset: 2px;
}

/* Play/Pause control (Removed per user request) */
.cyl-toggle-btn {
  display: none !important;
}

/* ═══ RESPONSIVE BREAKPOINTS ═══ */

/* Large Tablets & Medium Desktops (992px - 1199px) */
@media (max-width: 1199px) {
  :root {
    --cyl-card-width: 440px;
    --cyl-card-height: 330px;
    --cyl-radius: 430px;
    --cyl-stage-height: 500px;
    --cyl-perspective: 1200px;
  }
  .cyl-nav-btn {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }
}

/* Tablets (768px - 991px) */
@media (max-width: 991px) {
  :root {
    --cyl-card-width: 360px;
    --cyl-card-height: 270px;
    --cyl-radius: 360px;
    --cyl-pitch: -2deg;
    --cyl-stage-height: 440px;
    --cyl-perspective: 1050px;
  }
  .cyl-card-title {
    font-size: 1.15rem;
  }
  .cyl-card-content {
    padding: 12px 16px;
  }
  .cyl-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
}

/* Mobile Screens (576px - 767px) */
@media (max-width: 767px) {
  :root {
    --cyl-card-width: 320px;
    --cyl-card-height: 225px;
    --cyl-radius: 310px;
    --cyl-pitch: -1.5deg;
    --cyl-stage-height: 385px;
    --cyl-perspective: 900px;
  }
  .cyl-hero-section {
    padding: 14px 0 14px;
  }
  .cyl-card-title {
    font-size: 1.08rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .cyl-card-subtitle {
    display: block;
    font-size: 0.78rem;
    opacity: 0.9;
  }
  .cyl-card-badge {
    font-size: 0.72rem;
    padding: 2.5px 8px;
  }
  .cyl-card-content {
    padding: 12px 14px;
  }
  .cyl-nav-btn {
    width: 38px;
    height: 38px;
    font-size: 1.05rem;
  }
  .cyl-controls-wrap {
    padding: 0 6px;
  }
}

/* Small Mobile Screens (< 576px) */
@media (max-width: 575px) {
  :root {
    --cyl-card-width: 290px;
    --cyl-card-height: 205px;
    --cyl-radius: 265px;
    --cyl-pitch: -1deg;
    --cyl-stage-height: 355px;
    --cyl-perspective: 800px;
  }
  .cyl-hero-section {
    padding: 10px 0 10px;
  }
  .cyl-card-inner {
    border-radius: 14px;
  }
  .cyl-card {
    border-radius: 14px;
  }
  .cyl-card-title {
    font-size: 0.98rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .cyl-card-subtitle {
    display: block;
    font-size: 0.74rem;
    opacity: 0.88;
  }
  .cyl-card-content {
    padding: 10px 12px;
  }
  .cyl-nav-btn {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }
  .cyl-dot {
    width: 9px;
    height: 9px;
  }
  .cyl-dot.is-active {
    width: 22px;
  }
}

/* ═══ REDUCED MOTION PREFERENCE ═══ */
@media (prefers-reduced-motion: reduce) {
  .cyl-ring {
    transition: transform 0.4s ease-out !important;
  }
  .cyl-card {
    transition: none !important;
  }
}
