/* =============================================================================
   SECTIONS — The Witchy Room
   Page-section-specific styles: hero, schedule.
   Depends on: design-tokens.css, base.css, components.css
   Enqueued as 'wr-sections' in functions.php after 'wr-components'.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   HERO SECTION — .hero
   Full-viewport hero with radial gradient, star pattern, and entrance animation.
   page-home.php outputs: <section class="hero section section--lg [hero--has-image|hero--gradient]">
   --------------------------------------------------------------------------- */

.hero {
  position: relative;
  height: 100vh;   /* fallback — browsers without svh support */
  height: 100svh;  /* preferred — excludes mobile browser chrome / address bar */
  display: flex;
  align-items: center;
  background-color: var(--color-bg);
  background-image: radial-gradient(
    ellipse 80% 60% at 70% 20%,
    rgba(157, 123, 255, 0.15) 0%,
    transparent 60%
  );
  overflow: hidden;
}

/* When an ACF/theme header image is set, layer it beneath the gradient.
   page-home.php sets --hero-bg-url via inline style and adds .hero--has-image. */
.hero.hero--has-image {
  background-image:
    radial-gradient(
      ellipse 80% 60% at 70% 20%,
      rgba(157, 123, 255, 0.15) 0%,
      transparent 60%
    ),
    var(--hero-bg-url, none);
  background-size: auto, cover;
  background-position: center, center;
  background-repeat: repeat, no-repeat;
}

/* ── Sparkle / star repeating pattern — purely decorative ───────────────────
   4-point star SVG (✦ shape) at very low opacity, tiled every 300px.
   The SVG polygon describes a 4-point star centered at (50,50) in a 100×100
   viewBox, with outer tips at distance 10 and inner corners at distance ~3.5. */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpolygon points='50,40 52.5,47.5 60,50 52.5,52.5 50,60 47.5,52.5 40,50 47.5,47.5' fill='white'/%3E%3C/svg%3E");
  background-size: 300px 300px;
  background-repeat: repeat;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

/* Lift all direct children above the ::before pattern layer */
.hero > * {
  position: relative;
  z-index: 1;
}

/* ── Hero content wrapper ────────────────────────────────────────────────────
   .hero__content is the inner stack (heading + subline + CTAs). */
.hero__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* ── Hero H1 ─────────────────────────────────────────────────────────────────
   Overrides the base h1 scale — keeps heading in the tighter hero range
   so it stays legible across all viewport widths without crowding the CTAs. */
.hero__heading {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  color: var(--color-text);
  line-height: 1.15;
}

/* ── Hero subline — muted supporting paragraph ───────────────────────────── */
.hero__subline {
  color: var(--color-muted);
  font-size: var(--text-lg);
  line-height: 1.6;
  max-width: 52ch;
}

/* ── Hero CTA group — column on mobile, row on md+ ──────────────────────────
   Matches the .hero__ctas wrapper used in page-home.php. */
.hero__ctas {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

@media (min-width: 768px) {
  .hero__ctas {
    flex-direction: row;
    align-items: center;
  }
}

/* ── Entrance animations ─────────────────────────────────────────────────────
   Only applied when the user hasn't requested reduced motion.
   H1 fades up over 600ms; CTAs stagger in 150ms later.
   @keyframes defined outside the query — they're only triggered when
   animation-name is applied (inside the no-preference block below). */

@keyframes wr-fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero__heading {
    animation: wr-fade-up 600ms ease-out both;
  }

  /* .hero__subline — stagger 75ms behind the heading */
  .hero__subline {
    animation: wr-fade-up 600ms ease-out 75ms both;
  }

  /* .hero__ctas — stagger 150ms behind the heading */
  .hero__ctas {
    animation: wr-fade-up 600ms ease-out 150ms both;
  }
}

/* ---------------------------------------------------------------------------
   SCHEDULE SECTION — #schedule
   Weekly schedule grid on the homepage (ACF repeater output from page-home.php).
   The section background is --color-surface so it visually separates from the
   hero. Grid rows use alternating and highlight treatments.
   --------------------------------------------------------------------------- */

#schedule {
  background-color: var(--color-surface);
}

/* ── Schedule grid container ─────────────────────────────────────────────────
   The grid is output as role="table" in page-home.php, so the CSS here
   provides visual structure while the semantics come from the HTML roles. */
.schedule-grid {
  width: 100%;
  border-top: 1px solid var(--color-border);
}

/* ── Schedule rows ───────────────────────────────────────────────────────────
   4-column grid: Day | Time | Title + description | Action (book link).
   On small screens, collapses to a 2-column header row + full-width detail. */
.schedule-grid__row {
  display: grid;
  grid-template-columns:
    minmax(5.5rem, max-content)   /* day   */
    minmax(7rem,   max-content)   /* time  */
    1fr                           /* title */
    auto;                         /* link  */
  column-gap: var(--space-lg);
  align-items: center;
  padding: var(--space-md) var(--space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  border-left: 3px solid transparent; /* reserve space so highlighted rows don't shift layout */
  transition: background var(--transition-fast);
}

/* Alternating row tint */
.schedule-grid__row:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Highlighted rows (schedule_highlight = true in ACF) ─────────────────────
   Left gold border + very faint gold wash. Applied via class and data attribute
   (both are set in the template for flexibility). */
.schedule-grid__row--highlight,
.schedule-grid__row[data-highlight="true"] {
  border-left-color: var(--color-gold);
  background: rgba(246, 216, 138, 0.06);
}

.schedule-grid__row--highlight:nth-child(even),
.schedule-grid__row[data-highlight="true"]:nth-child(even) {
  background: rgba(246, 216, 138, 0.08); /* slightly stronger on even rows */
}

/* ── Day column ──────────────────────────────────────────────────────────────
   Heading font, violet, uppercase — matches the "mystical label" aesthetic. */
.schedule-grid__day {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-violet);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ── Time column ─────────────────────────────────────────────────────────────
   Monospace so times stay numerically aligned across rows. */
.schedule-grid__time {
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
  font-size: var(--text-sm);
  color: var(--color-muted);
  white-space: nowrap;
}

/* ── Info column (title + description) ───────────────────────────────────────
   Title in body font at readable weight; description muted below.
   Template class: .schedule-grid__info */
.schedule-grid__info {
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.3;
}

.schedule-grid__desc {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-top: var(--space-xs);
  line-height: 1.5;
}

/* ── Book link — inherits .btn-ghost from components.css ─────────────────────
   No additional overrides needed; .btn-ghost already has the arrow + colour. */

/* ── Responsive collapse — below sm (480px) ──────────────────────────────────
   Collapses to 2-column for day/time, full-width for info and action. */
@media (max-width: 479px) {
  .schedule-grid__row {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    row-gap: var(--space-xs);
  }

  .schedule-grid__day {
    grid-column: 1;
    grid-row: 1;
  }

  .schedule-grid__time {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .schedule-grid__info {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .schedule-grid__book {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}
