/* Home page — hero slideshow, Classes (groupings/strip/carousel), Studio/Miracle
   Dancers features, Events, Information. Ported verbatim from the mockup
   (dead/unused rules from earlier mockup iterations — .splash-veil, the
   unused desktop .class-grid layout, and the 900px .class-grid override —
   were dropped since nothing in the shipped markup ever used them). */

/* ================================================================
   IMAGE FADE-IN — every below-the-fold <img> gets this class (see
   class-styles/studio-features/home-events render.php). initImageFade()
   in page-home.js adds .is-loaded once the image has actually finished
   downloading (or immediately, if it was already cached/complete), so a
   lazy-loaded image never snaps into an .rv card's scroll-reveal — it
   fades in on its own the moment it's ready, whether that's before or
   after the reveal animation already ran. The hero slideshow has its own
   version of this (.splash-img.is-active.is-loaded, in the SPLASH section
   below) since it's gated on the active slide, not just on load.
================================================================ */
.img-fade { opacity: 0; transition: opacity 0.5s ease; }
.img-fade.is-loaded { opacity: 1; }

/* ================================================================
   SHARED LAYOUT (Home-only — .section/.container aren't used by the
   interior "sc-card" pages, which use .page-hero/.sc-wrap instead)
================================================================ */
.section { padding: 5rem 1.5rem; }
.container { max-width: 1200px; margin: 0 auto; }

.s-head { text-align: center; margin-bottom: 2.5rem; }

.s-head h2 {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 3rem);
  font-weight: 600; line-height: 1.1;
  margin-bottom: 0.5rem;
}

.s-head p {
  font-size: 1rem; color: var(--t1);
  max-width: 600px; margin: 0 auto 2rem;
  line-height: 1.7;
}

/* ================================================================
   CLASS GROUPINGS
================================================================ */
.groupings-block { text-align: center; margin: 0 auto 3rem; }

.groupings-subtitle {
  font-size: 1rem; font-weight: 700; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--t2);
  margin-bottom: 1rem;
}

.groupings-list {
  display: inline-flex; gap: 4rem; justify-content: center;
  flex-wrap: nowrap;
  max-width: 100%;
}

.groupings-item {
  background: none; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 1rem; font-weight: 600;
  color: var(--t1); padding: 0.4rem 0.1rem 0.6rem;
  position: relative; white-space: nowrap;
  transition: color var(--ease);
}
.groupings-item::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--grad-bt);
  transform: scaleX(0); transform-origin: center;
  transition: transform var(--ease);
}
.groupings-item:not(:first-child)::before {
  content: '';
  position: absolute; left: -2rem; top: 50%; transform: translateY(-50%);
  width: 1px; height: 1.3rem;
  background: var(--t3);
}
.groupings-item:hover { color: var(--blue); }
.groupings-item.is-active { color: var(--blue); }
.groupings-item.is-active::after { transform: scaleX(1); }

@media (max-width: 768px) {
  .groupings-list { gap: 1.5rem; }
  .groupings-item:not(:first-child)::before { left: -0.8rem; }
}
@media (max-width: 480px) {
  .groupings-list { gap: 1rem; }
  .groupings-item { font-size: 1rem; padding: 0.4rem 0 0.6rem; }
  .groupings-item:not(:first-child)::before { left: -0.5rem; height: 1.1rem; }
}

.groupings-panel-wrap {
  margin: 0 auto;
  width: 600px; max-width: 100%;
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.32s cubic-bezier(0.4,0,0.2,1);
}
.groupings-panel-wrap.is-open { grid-template-rows: 1fr; }
.groupings-panel-inner { overflow: hidden; }

.groupings-desc {
  padding-top: 1rem;
  font-size: 1rem; color: var(--t1); line-height: 1.7;
  text-align: center;
  opacity: 1;
  transition: opacity 0.18s ease;
}
.groupings-desc.is-fading { opacity: 0; }

/* ================================================================
   SPLASH
================================================================ */
.splash {
  position: relative; height: 84vh; min-height: 520px; overflow: hidden;
}

.splash-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 30%;
  opacity: 0;
  transition: opacity 1.4s ease;
}
/* Requires .is-loaded (added by JS once the image has actually finished
   downloading — see initImageFade() in page-home.js) in addition to
   .is-active, so a slide never snaps into view mid-download — it only
   ever fades in once it's ready, whether that's before or after the
   crossfade timer selects it. .splash-ph's gradient shows through until
   then instead of a blank/broken image. */
.splash-img.is-active.is-loaded { opacity: 1; }

.splash-ph {
  position: absolute; inset: 0;
  background: linear-gradient(155deg, #0D1520 0%, #090C10 55%, #0A1018 100%);
}

/* Splash content stacks vertically, top-biased */
.splash-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: 15vh 1.5rem 2rem;
  gap: 1.75rem;
}

.splash-box {
  background: rgba(0,0,0,0.7);
  padding: 2rem 3rem 2.5rem 3rem;
  max-width: 600px; width: 100%; text-align: center;
  animation: splashIn 0.9s ease both;
}

@keyframes splashIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.splash-box h1 {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 3rem);
  font-weight: 700; line-height: 1.08;
  color: #fff; margin-bottom: 0.85rem;
}

.splash-box p {
  font-size: 1rem; color: var(--t1);
  line-height: 1.7; margin-bottom: 1.5rem;
}

/* Scroll cue — flows inside .splash-center, below the box */
.scroll-cue {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  animation: cueFloat 2.4s ease-in-out infinite;
}
.scroll-cue span {
  display: block; width: 8px; height: 8px;
  border-right: 2px solid rgba(255,255,255,0.45);
  border-bottom: 2px solid rgba(255,255,255,0.45);
  transform: rotate(45deg); margin-top: -4px;
}
@keyframes cueFloat {
  0%,100% { transform: translateY(0);   opacity: 0.55; }
  50%      { transform: translateY(7px); opacity: 1;    }
}

/* ================================================================
   CLASSES SECTION
================================================================ */
.s-classes { background: var(--bg-raised); }

/* Shared card base — used by the mobile carousel's .class-card cells */
.class-card {
  background: var(--bg-card);
  overflow: hidden;
  text-decoration: none; color: inherit; cursor: pointer;
  position: relative;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.class-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}

.cc-img { position: absolute; inset: 0; background: var(--bg-elevated); }
.cc-img img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--ease-slow); }
.class-card:hover .cc-img img { transform: scale(1.07); }

.cc-body {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(to top,
    rgba(0,0,0,0.6) 0%,
    rgba(0,0,0,0.4) 20%,
    rgba(0,0,0,0.0) 40%);
}
.cc-body h3 {
  font-family: var(--serif); font-size: 1.5rem; font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0,0,0,0.75);
  text-align: center; padding: 0 0.5rem; line-height: 1.2;
  position: absolute;
  bottom: 20px;
}

/* ================================================================
   CLASS STRIP — desktop only
================================================================ */
.class-strip {
  position: relative;
  display: flex;
  gap: 3px;
  height: 450px;
  margin-top: 4.5rem;
  margin-bottom: 6.5rem;
}

.strip-card {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--ease);
  z-index: 1;
}
.strip-card:hover { transform: scale(1.1); z-index: 2; box-shadow: 0px 2px 10px 2px rgba(0,0,0,0.6); }
.class-strip.panel-open .strip-card:hover { transform: none; z-index: 1; }

.sc-img { position: absolute; inset: 0; background: var(--bg-elevated); }
.sc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Readability gradient */
.sc-grad {
  position: absolute; inset: 0;
  background: linear-gradient(to top,
    rgba(0,0,0,0.6) 0%,
    rgba(0,0,0,0.2) 20%,
    rgba(0,0,0,0.0) 40%);
  pointer-events: none;
}

/* Color overlay — low opacity, visible on hover */
.sc-overlay {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity var(--ease);
  pointer-events: none;
}
.strip-card:hover .sc-overlay { opacity: 0.2; }
.class-strip.panel-open .strip-card:hover .sc-overlay { opacity: 0; }
.strip-card[data-color="blue"]    .sc-overlay { background: var(--blue); }
.strip-card[data-color="teal"]   .sc-overlay { background: var(--teal); }
.strip-card[data-color="berry"]  .sc-overlay { background: var(--berry); }
.strip-card[data-color="purple"] .sc-overlay { background: var(--purple); }

/* Title centered at bottom */
.sc-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  text-align: center;
  padding: 0.6rem 0.4rem 0.8rem;
}
.sc-label h3 {
  font-family: var(--serif);
  font-size: 1.5rem; font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8);
  line-height: 1.2;
}

/* ── Expanded panel ── */
.strip-panel {
  position: absolute; inset: 0;
  z-index: 10;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scaleX(0.08);
  transition: opacity 0.38s ease, transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}
.strip-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: scaleX(1);
  box-shadow: 0px 2px 10px 2px rgba(0,0,0,0.6);
}

.sp-img { position: absolute; inset: 0; background: #000; }
.sp-img img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain; display: block;
  opacity: 0;
  transition: opacity 1s ease;
}
.sp-img img.is-active { opacity: 1; }

.sp-veil {
  position: absolute; inset: 0;
  background: linear-gradient(to top,
    rgba(0,0,0,0.6) 0%,
    rgba(0,0,0,0.4) 20%,
    rgba(0,0,0,0.0) 40%);
}

.sp-body {
  position: absolute;
  left: 2.5rem; top: 85%;
  transform: translateY(-50%) translateY(12px);
  max-width: 540px;
  opacity: 0;
  transition: opacity 0.3s ease 0.22s, transform 0.3s ease 0.22s;
}
.strip-panel.is-open .sp-body {
  opacity: 1;
  transform: translateY(-50%) translateY(0);
}

.sp-body h3 {
  font-family: var(--serif);
  font-size: 2.5rem; font-weight: 600;
  color: #fff; margin-bottom: 0.5rem;
  line-height: 1.2;
}
.sp-body p {
  font-size: 1rem; color: rgba(255,255,255,0.85);
  line-height: 1.7; margin-bottom: 1.5rem;
}
.sp-body .btn { min-width: 0; }

.sp-close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  border: 2px solid rgba(255,255,255,0.25);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease 0.22s, background var(--ease), color var(--ease), border-color var(--ease);
}
.strip-panel.is-open .sp-close { opacity: .9; }
.sp-close:hover { background: rgba(255,255,255,0.15); color: var(--blue); border-color: var(--b-blue); }

/* Keyboard focus indicators */
.strip-card:focus-visible { outline: 2px solid var(--blue); z-index: 2; }
.sp-close:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

@media (max-width: 768px) { .class-strip { display: none; } }

/* ================================================================
   CLASS CAROUSEL — mobile only
================================================================ */
.class-carousel { display: none; margin-top: 4rem; margin-bottom: 6rem; position: relative; }

.c-track {
  display: flex; gap: 3px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab; user-select: none;
}
.c-track::-webkit-scrollbar { display: none; }
.c-track.is-dragging { cursor: grabbing; }

.class-carousel .c-track { scroll-snap-type: none; scroll-behavior: auto; }

/* Mobile carousel cards — tall narrow strip style */
.c-cell { flex: 0 0 115px; max-width: 115px; }
.class-carousel .class-card { height: 450px; display: block; position: relative; overflow: hidden; }
.class-carousel .cc-img { position: absolute; inset: 0; }
.class-carousel .cc-img img { width: 100%; height: 100%; object-fit: cover; }
.class-carousel .cc-body {
  position: absolute; inset: 0;
  background: linear-gradient(to top,
    rgba(0,0,0,0.6) 0%,
    rgba(0,0,0,0.4) 20%,
    rgba(0,0,0,0.0) 40%);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 0.75rem;
}
.class-carousel .cc-body h3 {
  font-family: var(--serif); font-size: 1.3rem; font-weight: 600;
  color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,0.8);
  text-align: center; line-height: 1.25;
}

/* Color overlay on mobile cards */
.class-carousel .class-card::after {
  content: '';
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity var(--ease);
  pointer-events: none;
}
.class-carousel .class-card[data-color="blue"]::after    { background: var(--blue); }
.class-carousel .class-card[data-color="teal"]::after   { background: var(--teal); }
.class-carousel .class-card[data-color="berry"]::after  { background: var(--berry); }
.class-carousel .class-card[data-color="purple"]::after { background: var(--purple); }
.class-carousel .class-card:hover::after { opacity: 0.2; }

@media (max-width: 768px) { .class-carousel { display: block; } }

/* ================================================================
   MOBILE CARD MODAL
================================================================ */
.card-modal {
  position: absolute; inset: 0;
  z-index: 10;
  overflow: hidden;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.card-modal.is-open { opacity: 1; visibility: visible; box-shadow: 0px 2px 20px 2px rgba(0,0,0,0.6); }

.cm-img { position: absolute; inset: 0; background: var(--bg-base); }
.cm-img img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0;
  transition: opacity 1s ease;
}
.cm-img img.is-active { opacity: 1; }

.cm-veil {
  position: absolute; inset: 0;
  background: linear-gradient(to top,
    rgba(0,0,0,0.6) 0%,
    rgba(0,0,0,0.4) 20%,
    rgba(0,0,0,0.0) 40%);
}

.cm-body {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 1rem 1.25rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.28s ease 0.18s, transform 0.28s ease 0.18s;
}
.card-modal.is-open .cm-body { opacity: 1; transform: translateY(0); }

.cm-body h3 {
  font-family: var(--serif);
  font-size: 1.5rem; font-weight: 600;
  color: #fff; margin-bottom: 0.35rem; line-height: 1.1;
}
.cm-body p {
  font-size: 0.9rem; color: rgba(255,255,255,0.82);
  line-height: 1.6; margin-bottom: 0.85rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cm-body .btn { min-width: 0; padding: 0.5rem 1.25rem; font-size: 0.78rem; }

.cm-close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.25);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.28s ease 0.18s, background var(--ease), color var(--ease);
}
.card-modal.is-open .cm-close { opacity: 1; }
.cm-close:hover { background: rgba(255,255,255,0.15); color: var(--blue); }

/* Three-col row — no borders (also used by the Information section) */
.tri-row { display: flex; align-items: stretch; }

.tri-item {
  flex: 1; padding: 2rem 3rem;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
  gap: 2rem;
}

.col-icon { font-size: 4rem; line-height: 1; margin-bottom: 0.25rem; }

.tri-item p { font-size: 1rem; color: var(--t1); line-height: 1.7; flex: 1; }

/* ================================================================
   STUDIO / MIRACLE DANCERS SECTION
================================================================ */
.s-studio { background: var(--bg-raised); padding: 4rem 1.5rem; }

.studio-wrap { max-width: 1200px; margin: 0 auto; }

/* Both blocks: same vertical offset, same padding-bottom */
.studio-block {
  position: relative;
  padding-bottom: 95px;
  margin-bottom: 7rem;
}
.studio-block:last-child { margin-bottom: 0; }

.sb-img-col { width: 63%; box-shadow: 0px 2px 20px 0px rgba(0,0,0,0.6); background: var(--bg-elevated); }
.sb-img-col img { width: 100%; height: 430px; object-fit: cover; display: block; }

/* Our Studio — card at bottom-right of image */
.sb-text {
  position: absolute;
  top: 115px; right: 0;
  width: 52%;
  background: var(--bg-elevated);
  border: 1px solid var(--b-dim);
  padding: 1.5rem 2.5rem 2.5rem 2.5rem;
  z-index: 2;
  opacity: 95%;
}

.sb-text h2 {
  font-family: var(--serif);
  font-size: clamp(2rem, 3vw, 2.5rem);
  font-weight: 600; margin-bottom: 1rem;
}
.sb-text p { font-size: 1rem; color: var(--t1); line-height: 1.7; margin-bottom: 1.75rem; }

.btn-row { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Miracle Dancers — image right, card at top-left (same offset: top 115px) */
.studio-block.flip .sb-img-col { margin-left: auto; }
.studio-block.flip .sb-text    { top: 115px; right: auto; left: 0; }

/* ================================================================
   EVENTS SECTION
================================================================ */
.s-events { background: var(--bg-raised); }

.event-card {
  display: block; width: 100%;
  background: var(--b-blue);
  border: 1px solid var(--b-dim);
  overflow: hidden;
  text-decoration: none; color: inherit; cursor: pointer;
  /* opacity 0.65s ease matches .rv's own transition (site.css) — without
     it here, this shorthand fully replaces .rv's list on desktop (where
     .rv sits directly on .event-card, unlike mobile's .event-carousel
     wrapper) and opacity jumps instantly instead of fading with the rest
     of the reveal. */
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease), opacity 0.65s ease;
}
.event-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 44px rgba(0,0,0,0.45);
  /* var(--blue), not var(--b-blue) — the card's own background is
     already the latter (a faint blue tint), so using it here again made
     the "hover" border blend into the background instead of standing out. */
  border-color: var(--blue);
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
  padding: 2rem 0;
}

.ec-img { height: 235px; overflow: hidden; background: var(--bg-elevated); }
.ec-img img { width: 100%; height: 100%; object-fit: cover; }

.ec-body { padding: 1.5rem; text-align: center; }

.ec-title {
  font-family: var(--serif);
  font-size: 2rem; font-weight: 600;
  color: var(--t1); margin-bottom: 1.25rem;
  line-height: 1.2;
}
.ec-body p { font-size: 1rem; color: var(--t1); line-height: 1.7; }

/* Mobile event carousel */
.event-carousel { display: none; }
.event-carousel .c-track { gap: 1.25rem; }
.event-carousel .ec-img { height: 180px; }
.ec-cell { flex: 0 0 80vw; max-width: 320px; scroll-snap-align: start; }

/* ================================================================
   INFORMATION SECTION
================================================================ */
.s-info { background: var(--b-purple); }

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 920px) {
  .sb-text { top: 65px; padding: 1rem 1.5rem 2rem 1.5rem; }
  .studio-block.flip .sb-text { top: 65px; }
  .s-studio .btn-bt { margin: auto; }
  .s-studio .btn-ghost { margin: auto; }
  .tri-item .btn { min-width: 180px; }
}

@media (max-width: 768px) {
  .section { padding: 3.5rem 1.25rem; }

  .tri-row { flex-direction: column; }
  .tri-item { padding: 1.75rem 1.25rem; }
  .tri-item .btn { min-width: 200px; }

  .s-studio { padding: 3.5rem 1.25rem 2rem; }
  .studio-block, .studio-block.flip { padding-bottom: 0; margin-bottom: 3rem; }
  .sb-img-col { width: 100%; }
  .sb-img-col img { height: 260px; }
  .sb-text { position: static; width: 100%; margin-top: 1rem; padding: 1rem 1.5rem 2rem 1.5rem; }
  .studio-block.flip .sb-img-col { margin-left: 0; }

  .event-grid { display: none; }
  .event-carousel { display: block; }
}

@media (max-width: 480px) {
  .splash-box { padding: 1.25rem 1.25rem 1.5rem 1.25rem; }
  .splash-box h1 { font-size: 1.75rem; }
}
