/* ==========================================================================
   Forum Hero Banner
   Full-width, fixed 100px tall dynamic banner.
   Structure: bg photo (RWD) -> animated ribbon art -> content (logo / rotating
   title stage / CTA button)
   ========================================================================== */

.fh-banner {
  position: relative;
  width: 100%;
  height: 100px;
  overflow: hidden;
  background: #04184d; /* fallback while bg image loads */
  font-family: 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  isolation: isolate;
}

/* ---------- 1. background photo, art-directed per breakpoint ---------- */
.fh-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  line-height: 0;
}
.fh-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* ---------- 2. main01.png ribbon, animated for a grand / sweeping feel ---------- */
.fh-ribbon-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.fh-ribbon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* "center 58%" targets the widest, most colorful band of the artwork
     so it reads full-bleed across the whole banner width */
  object-position: center 58%;
  opacity: 0.92;
  mix-blend-mode: screen;
  filter: saturate(1.05);
  transform-origin: center 58%;
  animation: fh-ribbon-flow 17s cubic-bezier(.45,0,.55,1) infinite alternate;
  will-change: transform;
}
@keyframes fh-ribbon-flow {
  0%   { transform: translateX(-1.5%) scale(1.05); }
  50%  { transform: translateX(0.5%)  scale(1.09); }
  100% { transform: translateX(1.5%)  scale(1.06); }
}

/* soft edge fade so the ribbon melts into the gradient instead of clipping hard */
.fh-ribbon-wrap::before,
.fh-ribbon-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12%;
  z-index: 2;
  pointer-events: none;
}
.fh-ribbon-wrap::before {
  left: 0;
  background: linear-gradient(to right, #04184d 0%, rgba(4,24,77,0) 100%);
}
.fh-ribbon-wrap::after {
  right: 0;
  background: linear-gradient(to left, #04184d 0%, rgba(4,24,77,0) 100%);
}

/* ---------- 3. content row: logo / rotating stage / CTA ---------- */
.fh-content {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 2vw, 28px);
  height: 100%;
  padding: 0 clamp(12px, 2.5vw, 32px);
  box-sizing: border-box;
}

.fh-logo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  width: clamp(150px, 9vw, 190px);
}
.fh-logo img {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- center stage: 4 rotating slides, cross-fade ---------- */
.fh-stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fh-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.7s cubic-bezier(.22,.61,.36,1), transform 0.7s cubic-bezier(.22,.61,.36,1);
  pointer-events: none;
}
.fh-slide.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.fh-slide img {
  display: block;
  width: auto;
  max-width: 100%;
}

/* slide 0: single line title */
.fh-slide[data-slide="0"] img {
  height: clamp(22px, 5.6vw, 36px);
}

/* desktop/tablet: title-main01 (large, left) + title-main02 (smaller, right)
   in the same side-by-side format as the date/add row. main01 carries more
   visual weight since it's the primary headline. Sized so the combined row
   is at least as wide as the date/add row below, since this is the event's
   actual theme line and needs to read with real presence. */
.fh-main01 { height: clamp(36px, 8.5vw, 64px); }
.fh-main02 { height: clamp(20px, 5vw, 36px); }

/* mobile: same two images, but each fills its own slide, so they can run
   larger than they would sharing a row */
.fh-main01-solo { height: clamp(34px, 8.5vw, 58px); }
.fh-main02-solo { height: clamp(24px, 6vw, 40px); }

/* slide 3: date badge + add-to-calendar pill, side by side while there's
   room; once the stage gets too narrow this switches to a stacked layout
   (see .fh-stage.is-stacked below) instead of squeezing both illegibly small */
.fh-slide-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vw, 22px);
}
.fh-date { height: clamp(32px, 7.5vw, 56px); }
.fh-add  { height: clamp(22px, 5vw, 34px); }

.fh-stage.is-stacked .fh-slide-row {
  flex-direction: column;
  gap: 4px;
}
.fh-stage.is-stacked .fh-date { height: clamp(26px, 10vw, 40px); }
.fh-stage.is-stacked .fh-add  { height: clamp(18px, 7vw, 28px); }
.fh-stage.is-stacked .fh-main01 { height: clamp(28px, 12vw, 44px); }
.fh-stage.is-stacked .fh-main02 { height: clamp(17px, 7vw, 26px); }

/* slide 4: plain tagline text */
.fh-tagline {
  margin: 0;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  font-weight: 600;
  font-size: clamp(15px, 3.2vw, 24px);
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

/* mobile-only slides: logo and CTA join the rotation instead of sitting in
   fixed side columns. Hidden on desktop/tablet by default (see media query
   below for how they're revealed and the static ones hidden instead). The
   solo main01/main02 slides follow the same pattern: mobile-only. */
.fh-slide-logo,
.fh-slide-cta,
.fh-slide-mobile-solo {
  display: none;
}
.fh-slide-logo img {
  height: clamp(30px, 9vw, 40px);
  width: auto;
}
.fh-cta-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: clamp(30px, 9vw, 38px);
  padding: 0 clamp(16px, 5vw, 26px);
  border-radius: 999px;
  background: linear-gradient(90deg, #BF8A3B 7.37%, #FCFAD4 49.96%, #BF8A3B 94.19%, #BF8A3B 126.13%, #FCFAD4 152.34%, #BF8A3B 170.36%);
  color: #10245c;
  font-size: clamp(13px, 4vw, 16px);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

/* ---------- CTA button ---------- */
.fh-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: clamp(26px, 5.5vw, 38px);
  padding: 0 clamp(12px, 2.6vw, 26px);
  border-radius: 999px;
  background: linear-gradient(90deg, #BF8A3B 7.37%, #FCFAD4 49.96%, #BF8A3B 94.19%, #BF8A3B 126.13%, #FCFAD4 152.34%, #BF8A3B 170.36%);
  color: #10245c;
  font-size: clamp(12px, 2.2vw, 15px);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}
.fh-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.32);
  filter: brightness(1.05);
}
.fh-cta:active {
  transform: translateY(0);
}

/* ---------- small-screen refinements ---------- */
/* Below this width, 3 side-by-side columns (logo / stage / CTA) get too
   cramped. Instead of stacking them vertically (which would change the
   banner's height), the logo and CTA fold INTO the rotation: the same
   center stage cycles LOGO -> title slides -> CTA button -> loop. The
   banner stays a fixed 100px at every breakpoint. */
@media (max-width: 640px) {
  .fh-content {
    justify-content: center;
    padding: 0 clamp(12px, 4vw, 20px);
  }
  .fh-logo,
  .fh-cta {
    display: none;
  }
  .fh-slide-logo,
  .fh-slide-cta,
  .fh-slide-mobile-solo {
    display: flex;
  }
  .fh-slide-combo {
    display: none;
  }
  .fh-stage {
    flex: 1 1 100%;
  }

  /* Every rotating element gets as big as it can while staying inside an
     80px-tall, 80%-wide box — except the CTA slide, which keeps its normal
     button size (it's an <a>, not an <img>, so this rule doesn't touch it). */
  .fh-stage .fh-slide img {
    max-height: 55px;
    max-width: 90%;
    width: auto;
    height: auto;
  }

  /* the tagline is plain text rather than an svg, so it needs its own rule:
     same 80px / 80% box, allowed to wrap onto a second line instead of
     forcing a single nowrap line that would blow past the width cap. */
  .fh-tagline {
    max-width: 80%;
    max-height: 80px;
    overflow: hidden;
    white-space: normal;
    line-height: 1.2;
    font-size: clamp(20px, 7.5vw, 32px);
  }
}


/* respect users who don't want motion */
@media (prefers-reduced-motion: reduce) {
  .fh-ribbon { animation: none; }
  .fh-slide { transition: opacity 0.4s linear; transform: none !important; }
}
