/* Scoped reset: do not override the whole landing page */
#cards,
#cards *,
.card-overlay,
.card-overlay * {
  box-sizing: border-box;
}

#cards *,
.card-overlay * {
  margin: 0;
  padding: 0;
}

/* Scoped variables (avoid leaking into the whole page) */
#cards,
.card-overlay {
  --bg-dark: transparent;
  /* Brand palette (requested)
     #713600 #FFCA99 #D69456 #3D240C */
  --brand-900: #3D240C;
  --brand-800: #713600;
  --brand-300: #D69456;
  --brand-100: #FFCA99;

  --text-light: var(--brand-900);
  --text-muted: rgba(61, 36, 12, 0.72);
}

/* Important: don't style `body` here (index.html controls page-level visuals) */

/* Hero Section (scoped) */
#cards.hero-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 30px 20px;
  position: relative;
}

#cards .hero-content {
  text-align: center;
  margin-bottom: 20px;
}

#cards .hero-line {
  width: 50px;
  height: 2px;
  background: var(--text-muted);
  margin: 0 auto 20px;
}

#cards .hero-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(28px, 6vw, 56px);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

#cards .hero-subtitle {
  font-size: clamp(12px, 1.8vw, 16px);
  color: var(--text-muted);
  line-height: 1.5;
  font-style: italic;
}

/* Cards Container - Using Flexbox (scoped) */
#cards .cards-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 20px;
  margin-bottom: 40px;
  min-height: 336px;
}

#cards .cards-fan {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  position: relative;
  height: 372px;
}

/* Fan Card Base Styles (scoped) */
#cards .fan-card {
  width: 203px;
  height: 281px;
  border-radius: 20px;
  padding: 19px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  box-shadow:
    0 15px 35px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  flex-shrink: 0;
  margin: 0 14px;
  position: relative;
  transform-origin: center bottom;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

#cards .fan-card::before {
  content: "";
  position: absolute;
  inset: -16px;
}

/* Card Positions - Fan Layout (scoped) */
#cards .fan-card:nth-child(1) {
  transform: rotate(-12deg) translateY(10px);
  z-index: 1;
}

#cards .fan-card:nth-child(2) {
  transform: rotate(-6deg) translateY(-5px);
  z-index: 2;
}

#cards .fan-card:nth-child(3) {
  transform: rotate(0deg) translateY(-5px);
  z-index: 3;
}

#cards .fan-card:nth-child(4) {
  transform: rotate(6deg) translateY(-5px);
  z-index: 4;
}

#cards .fan-card:nth-child(5) {
  transform: rotate(12deg) translateY(10px);
  z-index: 5;
}

/* Hover Effects (scoped) */
#cards .fan-card:hover {
  transform: translateY(-36px) scale(1.1) rotate(0deg) !important;
  z-index: 10 !important;
  box-shadow: 
    0 40px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

#cards .fan-card.dimmed {
  opacity: 0.5;
  filter: brightness(0.7);
}

/* Card Colors (scoped) */
#cards .card-orange {
  background: linear-gradient(145deg, #D69456 0%, #713600 100%);
  color: #FFCA99;
}

#cards .card-cream {
  background: linear-gradient(145deg, #FFCA99 0%, rgba(214, 148, 86, 0.55) 100%);
  color: #3D240C;
}

#cards .card-blue {
  background: linear-gradient(145deg, #713600 0%, #3D240C 100%);
  color: #FFCA99;
}

#cards .card-green {
  background: linear-gradient(145deg, #D69456 0%, #3D240C 100%);
  color: #FFCA99;
}

#cards .card-dark {
  background: linear-gradient(145deg, #3D240C 0%, #713600 100%);
  color: #FFCA99;
}

#cards .card-image-wrap {
  width: 100%;
  height: 150px;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

#cards .card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Card Content (scoped) */
#cards .card-content {
  margin-top: auto;
}

#cards .card-content h3 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.3;
  margin: 0;
}

/* Hero Text (scoped) */
#cards .hero-text {
  max-width: 600px;
  text-align: center;
  padding: 0 20px;
}

#cards .hero-text p {
  font-size: clamp(14px, 2vw, 16px);
  color: var(--text-muted);
  line-height: 1.8;
}

#cards .hero-text-small {
  max-width: 500px;
  text-align: center;
  padding: 0 20px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 20px;
}

/* Card Overlay */
.card-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
}

.card-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Expanded Card */
.expanded-card {
  width: min(400px, 90vw);
  max-height: 80vh;
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: translateY(100px) scale(0.8);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

.card-overlay.active .expanded-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.expanded-pattern {
  display: none;
}

.expanded-media {
  width: 350px;
  height: 350px;
  border-radius: 18px;
  overflow: hidden;
  margin: 0 auto 20px;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.expanded-media.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.expanded-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.expanded-pattern {
  width: 100%;
  height: 180px;
  border-radius: 16px;
  margin-bottom: 20px;
  overflow: hidden;
}

.expanded-content {
  flex: 1;
}

.expanded-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 16px 0;
  line-height: 1.2;
  color: #fff7ee;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.expanded-description {
  font-size: 15px;
  line-height: 1.7;
  margin: 0;
  opacity: 0.9;
}

/* Expanded Card Colors */
.expanded-card.card-orange {
  background: linear-gradient(145deg, #D69456 0%, #713600 100%);
  color: #FFCA99;
}

.expanded-card.card-cream {
  background: linear-gradient(145deg, #FFCA99 0%, rgba(214, 148, 86, 0.55) 100%);
  color: #3D240C;
}

.expanded-card.card-blue {
  background: linear-gradient(145deg, #713600 0%, #3D240C 100%);
  color: #FFCA99;
}

.expanded-card.card-green {
  background: linear-gradient(145deg, #D69456 0%, #3D240C 100%);
  color: #FFCA99;
}

.expanded-card.card-dark {
  background: linear-gradient(145deg, #3D240C 0%, #713600 100%);
  color: #FFCA99;
}

/* Cards fan when card is expanded (scoped) */
#cards .cards-fan.card-expanded .fan-card {
  opacity: 0.3;
  filter: blur(2px);
  pointer-events: none;
}

#cards .cards-fan.card-expanded .fan-card.active {
  opacity: 0;
}

/* Shine Effect on Hover (scoped) */
#cards .fan-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  transition: left 0.5s ease;
  pointer-events: none;
  z-index: 10;
}

#cards .fan-card:hover::before {
  left: 100%;
}

/* ========================================
   Responsive Design - Мобильная адаптация
   ======================================== */

/* Планшеты */
@media (max-width: 1024px) {
  #cards .fan-card {
    width: 180px;
    height: 250px;
    padding: 16px;
    margin: 0 10px;
  }
  
  #cards .card-image-wrap {
    height: 130px;
    margin-bottom: 12px;
  }
  
  #cards .card-content h3 {
    font-size: 18px;
  }
}

/* Маленькие планшеты */
@media (max-width: 860px) {
  #cards.hero-section {
    min-height: auto;
    padding: 20px 16px;
  }
  
  #cards .hero-content {
    margin-bottom: 16px;
  }
  
  #cards .hero-title {
    font-size: clamp(24px, 5vw, 40px);
    margin-bottom: 10px;
  }
  
  #cards .hero-subtitle {
    font-size: 14px;
    padding: 0 10px;
  }
  
  #cards .cards-container {
    padding: 10px 0;
    min-height: auto;
  }
  
  #cards .cards-fan {
    height: auto;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    padding: 10px;
  }
  
  #cards .fan-card {
    width: 160px;
    height: 220px;
    padding: 14px;
    margin: 0;
    transform: none !important;
  }
  
  #cards .fan-card:nth-child(1),
  #cards .fan-card:nth-child(2),
  #cards .fan-card:nth-child(3),
  #cards .fan-card:nth-child(4),
  #cards .fan-card:nth-child(5) {
    transform: none !important;
  }
  
  #cards .fan-card:hover {
    transform: translateY(-8px) scale(1.02) !important;
  }
  
  #cards .card-image-wrap {
    height: 110px;
    margin-bottom: 10px;
  }
  
  #cards .card-content h3 {
    font-size: 15px;
  }
  
  .expanded-card {
    width: min(360px, 92vw);
    padding: 20px;
  }
  
  .expanded-media {
    width: 100%;
    height: 280px;
    margin-bottom: 16px;
  }
  
  .expanded-title {
    font-size: 24px;
  }
  
  .expanded-description {
    font-size: 14px;
  }
}

/* Мобильные устройства */
@media (max-width: 600px) {
  #cards.hero-section {
    padding: 16px 12px;
  }
  
  #cards .hero-line {
    width: 40px;
    margin-bottom: 16px;
  }
  
  #cards .hero-title {
    font-size: 22px;
    margin-bottom: 8px;
  }
  
  #cards .hero-subtitle {
    font-size: 13px;
    line-height: 1.5;
  }
  
  #cards .cards-container {
    padding: 8px 0 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  #cards .cards-container::-webkit-scrollbar {
    display: none;
  }

  #cards .cards-fan {
    height: auto;
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 8px 16px 12px;
    scroll-snap-type: x mandatory;
    justify-content: flex-start;
  }

  #cards .cards-fan-compact {
    margin: 0;
  }

  #cards .fan-card {
    width: 140px;
    height: 190px;
    padding: 12px;
    margin: 0;
    flex-shrink: 0;
    transform: none !important;
    scroll-snap-align: center;
  }

  #cards .fan-card:hover {
    transform: none !important;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  }

  #cards .card-image-wrap {
    height: 92px;
    margin-bottom: 8px;
    border-radius: 10px;
  }
  
  #cards .card-content h3 {
    font-size: 12px;
    line-height: 1.3;
  }
  
  .expanded-card {
    width: min(320px, 90vw);
    max-height: 85vh;
    padding: 16px;
    border-radius: 20px;
  }
  
  .expanded-media {
    width: 100%;
    height: 220px;
    border-radius: 14px;
    margin-bottom: 14px;
  }
  
  .expanded-title {
    font-size: 20px;
    margin-bottom: 12px;
  }
  
  .expanded-description {
    font-size: 13px;
    line-height: 1.6;
  }
  
  .close-btn {
    width: 32px;
    height: 32px;
    font-size: 20px;
    top: 12px;
    right: 12px;
  }
}

/* Маленькие мобильные устройства */
@media (max-width: 420px) {
  #cards .hero-title {
    font-size: 20px;
  }
  
  #cards .hero-subtitle {
    font-size: 12px;
  }
  
  #cards .cards-fan {
    gap: 10px;
    padding: 8px 12px 12px;
  }
  
  #cards .fan-card {
    width: 125px;
    height: 175px;
    padding: 10px;
    border-radius: 16px;
  }
  
  #cards .card-image-wrap {
    height: 85px;
    margin-bottom: 6px;
    border-radius: 8px;
  }
  
  #cards .card-content h3 {
    font-size: 11px;
  }
  
  .expanded-card {
    width: 94vw;
    padding: 14px;
  }
  
  .expanded-media {
    height: 200px;
  }
  
  .expanded-title {
    font-size: 18px;
  }
  
  .expanded-description {
    font-size: 12px;
  }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
  #cards .hero-title {
    font-size: 18px;
  }
  
  #cards .fan-card {
    width: 115px;
    height: 165px;
    padding: 8px;
  }
  
  #cards .card-image-wrap {
    height: 80px;
  }
  
  #cards .card-content h3 {
    font-size: 10px;
  }
  
  .expanded-media {
    height: 180px;
  }
  
  .expanded-title {
    font-size: 16px;
  }
}
