/* Indie Authors Canada Home: one story, top to bottom.

   Spotlight carousel → who we are → ways in → newsletter → upcoming workshops
   → TIAC → what authors say → the people behind IAC → footer.

   Content stays editable in WordPress (core blocks plus [iac_next_workshop],
   [iac_workshop_calendar] and [iac_newsletter_form]). The tokens, chapters and
   components are in iac-components.css; this module holds what only Home has:
   the spotlight and the layout of Home's own chapters. Rules that compete with
   organization.css (which loads later) are scoped with .iac-site .iac-home-page. */

/* ------------------------------------------------------------------------
   1. Spotlight: three full-width slides (workshop, TIAC, newsletter).
   rotations.js turns them into a tabbed carousel; .iac-js (set in <head>)
   stacks them from the first frame. Without JavaScript they stay stacked.
   ------------------------------------------------------------------------ */
.iac-site .iac-home-page .iac-home-spotlight {
  --iac-spotlight-controls: 4rem;
  padding: 0;
  color: var(--iac-paper);
  background: var(--iac-ink);
  isolation: isolate;
}

.iac-home-spotlight-track {
  display: grid;
}

.iac-home-spotlight-track > * {
  min-width: 0;
}

.iac-js .iac-home-spotlight-track > * {
  grid-area: 1 / 1;
}

.iac-js .iac-home-spotlight:not(.iac-spotlight--carousel) .iac-home-spotlight-track > :not(:first-child),
.iac-spotlight--carousel .iac-spotlight-slide:not(.is-active) {
  visibility: hidden;
}

.iac-home-page .iac-home-spotlight-track > * {
  margin-block: 0;
}

.iac-spotlight-slide {
  display: grid;
}

.iac-home-slide {
  position: relative;
  display: flex;
  align-items: center;
  min-height: clamp(30rem, 72vh, 42rem);
  padding-block: clamp(2.5rem, 5vw, 4rem) calc(var(--iac-arc) + clamp(2.5rem, 5vw, 4rem));
  overflow: hidden;
  color: var(--iac-paper);
  background: var(--iac-ink);
}

.iac-js .iac-home-slide {
  padding-bottom: calc(var(--iac-arc) + var(--iac-spotlight-controls) + clamp(1rem, 3vw, 2rem) + 1rem);
}

.iac-home-slide > .iac-shell {
  z-index: 1;
}

.iac-home-slide-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
}

.iac-home-slide-copy {
  max-width: 46rem;
}

.iac-site .iac-home-page .iac-home-slide h2 {
  max-width: 22ch;
  font-size: clamp(2.25rem, 4.6vw, 4rem);
  line-height: 1.02;
  letter-spacing: -.04em;
}

.iac-home-slide h2 a {
  color: inherit;
  text-decoration: none;
}

.iac-home-slide h2 a:hover {
  text-decoration: underline;
  text-decoration-thickness: .06em;
  text-underline-offset: .1em;
}

.iac-site .iac-home-page .iac-home-slide .iac-eyebrow {
  color: var(--iac-paper);
  border-inline-start-color: var(--iac-accent);
}

.iac-home-page .iac-home-slide .iac-lead {
  color: #ffffffe0;
}

.iac-home-slide-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

/* Light buttons on dark and red slides. */
.iac-home-page .iac-home-slide .iac-actions .wp-block-button:not(.is-style-outline) a,
.iac-home-slide .iac-marketplace-button,
.iac-home-slide .iac-button {
  border-color: var(--iac-paper);
  color: var(--iac-ink);
  background: var(--iac-paper);
}

.iac-home-page .iac-home-slide .iac-actions .wp-block-button:not(.is-style-outline) a:hover,
.iac-home-slide .iac-marketplace-button:hover,
.iac-home-slide .iac-button:hover {
  border-color: var(--iac-accent);
  color: var(--iac-paper);
  background: var(--iac-accent);
}

.iac-site .iac-home-page .iac-home-slide .iac-actions .is-style-outline a.wp-element-button {
  border-color: #ffffffcc;
  color: var(--iac-paper);
}

.iac-site .iac-home-page .iac-home-slide .iac-actions .is-style-outline a.wp-element-button:hover {
  border-color: var(--iac-paper);
  color: var(--iac-ink);
  background: var(--iac-paper);
}

.iac-home-slide .iac-marketplace-button {
  border-width: 2px;
  font-weight: 700;
}

.iac-home-slide-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--iac-paper);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .3em;
}

/* Astra's a:hover and a:focus would drop the underline and turn the text dark red. */
.iac-home-slide-link:is(:hover, :focus) {
  color: var(--iac-paper);
  text-decoration: underline 2px var(--iac-accent);
}

.iac-home-slide-visual {
  position: relative;
  justify-self: center;
}

/* A click anywhere on a slide opens its main link, the one marked
   iac-home-slide-target (on the link or its Button block): as on the feature
   cards, the link's ::before covers the slide, which clips it. Hovering the
   slide therefore shows that link's hover state. The copy sits above the
   visual so the cover reaches the portrait and the letter, and the slide's
   other links and buttons sit above the cover. */
.iac-home-slide-copy {
  position: relative;
  z-index: 1;
}

.iac-home-slide :is(a.iac-home-slide-target, .iac-home-slide-target a)::before {
  content: '';
  position: absolute;
  z-index: 1;
  inset: -100vmax;
}

.iac-home-slide-copy :is(a, button):not(.iac-home-slide-target, .iac-home-slide-target a) {
  position: relative;
  z-index: 2;
}

/* Workshop slide: the night notebook page and the chips are shared
   (.iac-notebook-night, .iac-workshop-chips in iac-components.css). */

.iac-site .iac-home-page .iac-home-slide .iac-workshop-price {
  color: var(--iac-paper);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.iac-home-slide .iac-workshop-price > span:not(.woocommerce-Price-amount) {
  font: 600 1rem/1.5 var(--iac-site-font);
}

.iac-home-slide .iac-workshop-card-buy {
  margin: 0;
}

/* The presenter's circular portrait in a red ring, with a calendar tile. */
.iac-home-slide .iac-next-workshop-portrait {
  width: clamp(13rem, 25vw, 21rem);
  margin: 0;
  box-shadow: 0 0 0 .5rem var(--iac-ink), 0 0 0 .8rem var(--iac-accent), 0 2rem 4rem #00000080;
}

.iac-home-slide-visual .iac-date-tile {
  position: absolute;
  inset-inline-start: -.75rem;
  bottom: 1rem;
  rotate: -6deg;
}

.iac-home-page .iac-home-slide-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .25rem .6rem;
  padding: .6rem 1rem;
  border-inline-start: 4px solid var(--iac-accent);
  background: #ffffff1a;
  font-size: 1.125rem;
}

/* Newsletter slide: red, with a letter on airmail paper. */
.iac-home-slide-newsletter {
  background:
    radial-gradient(44rem 30rem at 78% 45%, #ffffff24, transparent 62%),
    var(--iac-accent);
}

.iac-site .iac-home-page .iac-home-slide-newsletter .iac-eyebrow {
  border-inline-start-color: var(--iac-paper);
}

.iac-home-page .iac-home-slide-newsletter .iac-actions .wp-block-button:not(.is-style-outline) a:hover {
  border-color: var(--iac-ink);
  background: var(--iac-ink);
}

/* Tabs and Pause, laid over the foot of every slide. */
.iac-home-spotlight > .iac-rotation-controls {
  position: absolute;
  z-index: 2;
  inset-inline: 0;
  bottom: calc(var(--iac-arc) + clamp(1rem, 3vw, 2rem));
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: clamp(1rem, 3vw, 2.5rem);
  width: calc(100% - var(--iac-site-gutter) * 2);
  max-width: 1200px;
  margin: 0 auto;
}

/* White tabs over every slide; the shared mechanics are in rotation-controls.css. */
.iac-home-spotlight {
  --iac-rotation-tab-ink: #ffffffe6;
  --iac-rotation-tab-active: var(--iac-paper);
  --iac-rotation-track: #ffffff4d;
  --iac-rotation-track-hover: #ffffff80;
}

.iac-home-spotlight .iac-rotation-tabs {
  flex: 1;
  gap: clamp(.75rem, 2.5vw, 2rem);
}

.iac-home-spotlight .iac-rotation-tab {
  font: 700 1rem/1.35 var(--iac-site-font);
}

.iac-home-page .iac-home-spotlight .iac-rotation-controls .iac-rotation-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  min-height: 44px;
  margin-top: .35rem;
  padding: .45rem 1rem .45rem .8rem;
  border: 1px solid #ffffffb3;
  border-radius: 999px;
  color: var(--iac-paper);
  background: #11111166;
  font: 700 .9375rem/1.3 var(--iac-site-font);
}

.iac-home-page .iac-home-spotlight .iac-rotation-controls .iac-rotation-toggle::before {
  content: '';
  width: .75rem;
  height: .75rem;
  border-inline: .25rem solid currentColor;
  box-sizing: border-box;
}

.iac-home-page .iac-home-spotlight[data-rotation="stopped"] .iac-rotation-controls .iac-rotation-toggle::before {
  border: 0;
  border-block: .375rem solid transparent;
  border-inline-start: .65rem solid currentColor;
}

.iac-home-page .iac-home-spotlight .iac-rotation-controls .iac-rotation-toggle:hover {
  color: var(--iac-ink);
  background: var(--iac-paper);
}

.iac-home-spotlight .iac-rotation-controls button:focus-visible {
  outline: 3px solid var(--iac-paper);
  outline-offset: 3px;
}

@keyframes iac-spotlight-arrive {
  from { opacity: 0; translate: 0 1rem; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes iac-spotlight-fade {
  from { opacity: .35; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  .iac-spotlight-slide.is-active .iac-home-slide {
    animation: iac-spotlight-fade 700ms ease-out;
  }

  .iac-spotlight-slide.is-active :is(.iac-home-slide-copy, .iac-home-slide-visual) {
    animation: iac-spotlight-arrive 700ms cubic-bezier(.2, .7, .2, 1) both;
  }

  .iac-spotlight-slide.is-active .iac-home-slide-visual {
    animation-delay: 120ms;
  }
}

/* The TIAC slide's caption shows while the slide is hovered: its photo sits behind the copy. */
@media (hover: hover) {
  .iac-home-page .iac-home-slide-conference:hover .iac-photo-fill figcaption {
    opacity: 1;
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .iac-home-page .iac-home-slide-conference:hover .iac-photo-fill figcaption {
    translate: none;
  }
}

/* ------------------------------------------------------------------------
   2. Who we are: the page's H1, a framed photograph and a note card.
   ------------------------------------------------------------------------ */
.iac-home-page .iac-home-welcome {
  padding-top: clamp(2.5rem, 5vw, 4.5rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}

.iac-home-welcome-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2.5rem, 5vw, 5rem);
}

.iac-home-welcome-copy > p:not([class]) {
  max-width: 52ch;
}

.iac-home-welcome-art {
  position: relative;
  padding: 1.25rem 0 3.5rem clamp(1.5rem, 4vw, 3rem);
}

/* ------------------------------------------------------------------------
   3. Ways in: three distinct cards (black, grey, red), each a whole-card
   link with an icon, a large faint emblem and a round arrow.
   ------------------------------------------------------------------------ */
.iac-home-page .iac-home-start {
  padding-top: clamp(2.5rem, 5vw, 4rem);
}

/* ------------------------------------------------------------------------
   4. Newsletter: a red chapter with the signup card beside its copy; the
   next chapter curves up into it.
   ------------------------------------------------------------------------ */
.iac-home-newsletter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
}

/* The copy is taller than the card, so a card hanging past the chapter's
   edge sat beside the list, well below the heading. Here it stays inside. */
.iac-home-page .iac-home-newsletter-grid > .iac-newsletter-inline {
  align-self: center;
  translate: none;
}

.iac-home-newsletter-topics {
  display: grid;
  gap: .65rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 1.125rem;
  font-weight: 600;
}

.iac-home-newsletter-topics li {
  position: relative;
  padding-inline-start: 2.25rem;
}

.iac-home-newsletter-topics li::before {
  content: '';
  position: absolute;
  top: .2em;
  inset-inline-start: 0;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--iac-tick-on-white) center / contain no-repeat;
}

.iac-home-newsletter-copy :is(a, summary):focus-visible {
  outline-color: var(--iac-paper);
}

/* ------------------------------------------------------------------------
   5. What's coming up ([iac_workshop_calendar]): workshops and the
   conference in date order, the conference as a black card.
   ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------
   6. TIAC: a night-time chapter. A ticket-stub date card, and "A look back"
   running to the screen's edge with its title over the photo, small dots,
   and a mouse over the photo holding the rotation.
   ------------------------------------------------------------------------ */
.iac-home-conference-grid {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(2.5rem, 5vw, 5rem);
}

.iac-home-page .iac-home-conference-copy > p:not([class]) {
  color: #ffffffd9;
  font-size: 1rem;
}

/* ------------------------------------------------------------------------
   8. The people behind IAC, curving into the black footer.
   ------------------------------------------------------------------------ */
.iac-home-community-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2.5rem, 6vw, 6rem);
}

/* The photograph leads on wide screens, mirroring the welcome chapter. */
.iac-home-page .iac-home-community .iac-photo {
  order: -1;
}

/* ------------------------------------------------------------------------
   9. Arrival: on wide screens, the pieces laid over others settle into place
   as their stage scrolls into view, then stay put. Each framed photograph
   starts over its frame and slides off it; the note card and the signup
   card start a little higher and come down.

   CSS scroll-driven animations: no script, and the compositor runs them.
   Each stage declares the --iac-arrive timeline; its pieces set where they
   start from. Their transform composes after the translate and rotate they
   already have. Narrow screens, reduced motion and browsers without
   scroll-driven animations keep the still layout.
   ------------------------------------------------------------------------ */
@keyframes iac-home-arrive {
  from { transform: translate3d(var(--iac-arrive-x, 0), var(--iac-arrive-y, 0), 0); }
}

@supports (animation-timeline: view()) {
  @media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
    .iac-home-page :is(.iac-home-welcome-art, .iac-home-newsletter-grid, .iac-home-community .iac-photo) {
      view-timeline: --iac-arrive block;
    }

    .iac-home-welcome-art .iac-photo img,
    .iac-home-welcome-art .iac-note-card,
    .iac-home-newsletter-grid > .iac-newsletter-inline,
    .iac-home-community .iac-photo img {
      animation: iac-home-arrive ease-out both;
      animation-timeline: --iac-arrive;
      animation-range: entry 10% cover 45%;
      /* Moving pieces never serve as scroll anchors (see iac-motion.js). */
      overflow-anchor: none;
    }

    /* The red block sits above and to the right of the photo. */
    .iac-home-welcome-art .iac-photo img {
      --iac-arrive-x: 1.25rem;
      --iac-arrive-y: -1.25rem;
    }

    /* The note card lands just after the photo. */
    .iac-home-welcome-art .iac-note-card {
      --iac-arrive-y: -2.5rem;
      animation-range: entry 30% cover 50%;
    }

    .iac-home-newsletter-grid > .iac-newsletter-inline {
      --iac-arrive-y: -2.5rem;
    }

    /* The outline frame sits below and to the left of the photo. */
    .iac-home-community .iac-photo img {
      --iac-arrive-x: -1.25rem;
      --iac-arrive-y: 1.25rem;
    }
  }
}

/* ------------------------------------------------------------------------
   Narrower screens.
   ------------------------------------------------------------------------ */
@media (max-width: 900px) {
  .iac-home-slide-grid,
  .iac-home-welcome-grid,
  .iac-home-newsletter-grid,
  .iac-home-conference-grid,
  .iac-home-community-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .iac-home-slide {
    align-items: flex-start;
    min-height: 0;
  }

  /* The presenter's portrait leads the workshop slide, small. */
  .iac-home-slide-visual {
    grid-row: 1;
    justify-self: start;
  }

  .iac-home-slide .iac-next-workshop-portrait {
    width: clamp(6.5rem, 22vw, 9rem);
    margin-inline-start: .55rem;
    box-shadow: 0 0 0 .35rem var(--iac-ink), 0 0 0 .55rem var(--iac-accent);
  }

  .iac-home-slide-visual .iac-date-tile {
    inset-inline-start: auto;
    left: calc(100% + 1.25rem);
    bottom: auto;
    top: 50%;
    translate: 0 -50%;
    rotate: -4deg;
  }

  .iac-home-slide-workshop::before {
    display: none;
  }

  /* The letter follows the copy; the workshop slide is taller, so it costs no height. */
  .iac-home-slide-newsletter .iac-home-slide-visual {
    grid-row: auto;
    justify-self: center;
  }

  .iac-home-welcome-art {
    max-width: 40rem;
  }

}

@media (max-width: 600px) {
  .iac-site .iac-home-page .iac-home-spotlight {
    --iac-spotlight-controls: 5rem;
  }

  .iac-home-page .iac-home-slide-copy > * + * {
    margin-top: 1rem;
  }

  .iac-home-slide .iac-next-workshop-portrait {
    width: 5rem;
    box-shadow: 0 0 0 .25rem var(--iac-ink), 0 0 0 .45rem var(--iac-accent);
  }

  .iac-home-slide-visual .iac-date-tile {
    left: calc(100% + 1rem);
    scale: .8;
    transform-origin: left center;
  }

  .iac-home-page .iac-home-slide .iac-lead {
    font-size: 1.0625rem;
  }

  .iac-site .iac-home-page .iac-home-slide h2 {
    font-size: clamp(2rem, 9vw, 2.5rem);
  }

  /* A round icon-only Pause (its label stays in aria-label) beside the tabs. */
  .iac-home-spotlight > .iac-rotation-controls {
    gap: .75rem;
  }

  .iac-home-spotlight .iac-rotation-tabs {
    gap: .625rem;
  }

  .iac-home-page .iac-home-spotlight .iac-rotation-controls .iac-rotation-toggle {
    justify-content: center;
    width: 44px;
    padding: 0;
    font-size: 0;
  }

  .iac-home-spotlight .iac-rotation-tab {
    flex-direction: column;
    gap: 0;
    font-size: .875rem;
  }

  .iac-home-welcome-art {
    padding-inline-start: 1rem;
  }

  .iac-home-welcome-art {
    padding-bottom: 0;
  }

}

@media print {
  .iac-home-spotlight-track > * {
    grid-area: auto;
    visibility: visible !important;
  }

  .iac-home-spotlight > .iac-rotation-controls {
    display: none;
  }
}

/* Focus inside the spotlight, on its dark and red slides. */
.iac-home-page .iac-home-slide a:focus-visible {
  outline-color: var(--iac-paper);
}
