/*
Theme Name: CMV Stream
Theme URI: https://elevate.co.il/
Author: Elevate Digital Studio
Author URI: https://elevate.co.il/
Description: CMV Stream (Kamada) — event landing with three states: Registration, Live and On-Demand. Elevate Starter engine: ACF flexible content + General Settings. Template: Tools → CMV content imports the design.
Version: 1.0.0
Text Domain: elevate-starter
*/

/* =========================================================
   WP-only glue on top of assets/css/main.min.css (the
   compiled design) and assets/css/modes.css (the three
   event states). Design changes belong in those files.
   ========================================================= */

/* ---------------------------------------------------------------------------
   One page, two modes: <html data-mode> (set in <head> by inc/event.php,
   flipped by event.js at the start time) shows only the current mode's
   [data-modes] elements. Sections get data-modes from "Show in".
   --------------------------------------------------------------------------- */
html[data-mode="registration"] [data-modes]:not([data-modes~="registration"]),
html[data-mode="ondemand"] [data-modes]:not([data-modes~="ondemand"]) {
  display: none !important;
}

/* Menu during the live broadcast: "● Watch Live" instead of "Watch / Listen"
   (html.isOnAir — set in <head>, kept in step by event.js). */
html:not(.isOnAir) [data-onair="show"],
html.isOnAir [data-onair="hide"] {
  display: none !important;
}

html.isOnAir .main-menu__live-dot {
  display: block;
}

/* Sections with "Hide during the live broadcast" (Previous Editions — the
   client, 18.10), and the menu links to them (event.js). */
html.isOnAir [data-hide-onair] {
  display: none !important;
}

.main-menu li.isTargetHidden {
  display: none;
}

/* Floating card: bottom RIGHT on desktop (the client: on the left it covers
   content). On phones it is a full-width bar stuck to the bottom: text +
   button (header-footer.php elv_floating_bar()). Both appear only after
   scrolling past the form / the video (event.js). */
@media (orientation: landscape), (min-width: 769px) and (orientation: portrait) {
  .register {
    bottom: calc(var(--isi-h, 0px) + 1.5rem);
    inset-inline-start: auto;
    inset-inline-end: 1.0625rem;
  }
}

/* phones: the bar sits on top of the sticky ISI bar */
@media (max-width: 768px) and (orientation: portrait) {
  .register {
    bottom: var(--isi-h, 0px);
    inset-inline: 0;
  }

  .register.isHidden {
    transform: translateY(100%);
  }

  .register__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fff;
    box-shadow: 0 -0.25rem 1.5rem rgba(0, 0, 0, 0.15);
  }

  .register__bar-text {
    font-family: Montserrat, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #000065;
  }

  .register__bar-btn {
    flex-shrink: 0;
    height: 2.75rem;
    padding-inline: 1.125rem;
    font-size: 0.9375rem;
    font-weight: 700;
    white-space: nowrap;
  }

  /* the bar must not cover the end of the footer */
  .footer {
    padding-bottom: 6rem;
  }
}

/* ---------------------------------------------------------------------------
   Scientific Program cards (content/sections/program.php) — the
   Registration design in both modes; On-Demand adds the start time and a
   play button, and the card jumps the video (event.js).
   --------------------------------------------------------------------------- */
.program__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-width: 0;
}

.program__time {
  display: inline-flex;
  align-items: center;
  height: 1.375rem;
  padding-inline: 0.5rem;
  border-radius: 6.25rem;
  background: rgba(15, 78, 187, 0.1);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  color: #000065;
}

.program__play {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 0.125rem rgba(0, 0, 101, 0.08);
  transition: background-color 0.25s ease;
}

.program__play img {
  width: 0.875rem;
}

.program__play img.--pause,
.program__item.isPlaying .program__play img.--play {
  display: none;
}

.program__item.isPlaying .program__play img.--pause {
  display: block;
}

/* On-Demand: the card is the button */
html[data-mode="ondemand"] .program__item.--jump {
  cursor: pointer;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

html[data-mode="ondemand"] .program__item.--jump:focus-visible {
  outline: 2px solid #000065;
  outline-offset: 2px;
}

@media (any-hover: hover) {
  html[data-mode="ondemand"] .program__item.--jump:hover {
    background: rgba(15, 78, 187, 0.1);
  }

  html[data-mode="ondemand"] .program__item.--jump:hover .program__play {
    background: #e7edf8;
  }
}

/* the part of the recording that is playing */
.program__item.isActive {
  background: rgba(15, 78, 187, 0.12);
  box-shadow: inset 0 0 0 0.125rem #000065;
}

.program__item.isActive .program__play {
  background: #000065;
}

.program__item.isActive .program__play img {
  filter: brightness(0) invert(1);
}

/* During the live stream the times stay (the client wants the agenda with its
   times); a card then takes the visitor to the stream instead of jumping. */

@media (orientation: landscape), (min-width: 769px) and (orientation: portrait) {
  .program__time {
    height: 1.75rem;
    padding-inline: 0.625rem;
    font-size: 1rem;
  }

  .program__play {
    width: 3.25rem;
    height: 3.25rem;
  }

  .program__play img {
    width: 1.125rem;
  }
}

/* Mobile: the first 4 cards, "Read more" opens the rest (event.js). */
@media (max-width: 768px) and (orientation: portrait) {
  .program__list:not(.isOpen) .program__item:nth-child(n + 5) {
    display: none;
  }

  .program__more {
    margin-inline: auto;
    margin-top: 1rem;
  }

  .program__list.isOpen + .program__more {
    display: none;
  }
}

/* The first screen's usable height under the fixed header: what the heroes
   and players size to (modes.css). Minus the WP admin bar when a logged-in
   editor views the page (WP sets --wp-admin--admin-bar--height then), minus
   a sticky ISI bar if there is one (--isi-h, event.js), minus a small gap. */
:root {
  --elv-screen-h: calc(100svh - var(--header-height) - var(--wp-admin--admin-bar--height, 0px) - var(--isi-h, 0px) - 2rem);
}

/* General Settings → Event → Test is on (logged-in editors only). */
.elv-test-badge {
  position: fixed;
  bottom: calc(var(--isi-h, 0px) + 1rem);
  left: 50%;
  z-index: 10000;
  padding: 0.5rem 1rem;
  border-radius: 6.25rem;
  background: #d92d20;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.25);
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  transform: translateX(-50%);
}

/* Skip link — hidden until focused with the keyboard. */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 10000;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  background: #000065;
  color: #fff;
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------------------------------------------------------------------------
   Product information (ISI): a bar stuck to the bottom of the screen at all
   times (the client, 18.10) — label + product title + "Read full
   information", which opens the text above it (scrolls inside when long).
   inc/header-footer.php elv_info_bar(), toggle in event.js; --isi-h = its
   closed height (event.js): the page keeps that much room at the bottom and
   the first-screen heroes / floating cards sit above it.
   --------------------------------------------------------------------------- */
body {
  padding-bottom: var(--isi-h, 0px);
}

.isi {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 95;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  border-radius: 1.25rem 1.25rem 0 0;
  background: #eff3fa;
  box-shadow: 0 -0.25rem 1.5rem rgba(0, 0, 101, 0.12);
  color: #0c0d0c;
}

.isi__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.isi__heading {
  min-width: 0;
}

.isi__eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #000065;
}

.isi__title {
  margin-top: 0.125rem;
  font-family: Montserrat, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

.isi__toggle {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.625rem;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #000065;
  cursor: pointer;
}

.isi__toggle-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 101, 0.08);
  transition: transform 0.3s ease;
}

/* the chevron is drawn small inside a 24px canvas — show the canvas whole */
.isi__toggle-icon img {
  width: 1.5rem;
}

.isi__toggle[aria-expanded="true"] .isi__toggle-icon {
  transform: rotate(180deg);
}

.isi__toggle:focus-visible {
  outline: 2px solid #000065;
  outline-offset: 4px;
  border-radius: 6.25rem;
}

.isi__body {
  order: -1; /* opens above the label row, which stays at the bottom */
  max-height: 55svh;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(12, 13, 12, 0.7);
}

.isi__body[hidden] {
  display: none;
}

.isi__label {
  margin-top: 0.75rem;
  font-weight: 700;
  color: #0c0d0c;
}

/* phones: only the round button — the label would squeeze the title */
@media (max-width: 768px) and (orientation: portrait) {
  .isi__toggle-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
}

@media (orientation: landscape), (min-width: 769px) and (orientation: portrait) {
  .isi {
    padding: 0.875rem 3.75rem;
    border-radius: 1.75rem 1.75rem 0 0;
  }

  .isi__eyebrow {
    font-size: 0.8125rem;
  }

  .isi__title {
    font-size: 1.125rem;
  }

  .isi__toggle {
    font-size: 1rem;
  }

  .isi__toggle-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .isi__body {
    max-height: 45vh;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    font-size: 1rem;
  }
}

/* Previous Editions: the image opens the recording too. */
.edition__media[data-popup-video] {
  cursor: pointer;
}

.edition__media[data-popup-video]:focus-visible {
  outline: 2px solid #000065;
  outline-offset: 2px;
}

/* The fixed header sits under the WP admin bar when logged in. */
.admin-bar .header {
  top: var(--wp-admin--admin-bar--height, 32px);
}

/* ---------------------------------------------------------------------------
   Registration form = Contact Form 7, printed in the design's markup.
   CF7 wraps every control in a span and adds its own tip / spinner /
   response box — fit those into the design.
   --------------------------------------------------------------------------- */
.reg-card .wpcf7-form-control-wrap {
  display: block;
}

/* Server-side errors (fallback — the design's .form__error texts show first). */
.reg-card .form__control.wpcf7-not-valid {
  border-color: #d92d20;
}

.reg-card .wpcf7-not-valid-tip {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  line-height: 1.3;
  color: #d92d20;
}

.reg-card .form__item.isError .wpcf7-not-valid-tip {
  display: none;
}

/* Sending: the design's button dims instead of CF7's spinner. */
.reg-card .wpcf7-spinner {
  display: none;
}

.reg-card .wpcf7-form.submitting .reg-card__btn {
  opacity: 0.6;
  pointer-events: none;
}

/* Only a failure is worth a message here — success opens the thank-you popup. */
.reg-card .wpcf7 form .wpcf7-response-output {
  margin: 0.75rem 0 0;
  padding: 0;
  border: 0;
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: center;
  color: #d92d20;
}

.reg-card .wpcf7 form.init .wpcf7-response-output,
.reg-card .wpcf7 form.sent .wpcf7-response-output,
.reg-card .wpcf7 form.invalid .wpcf7-response-output,
.reg-card .wpcf7 form.unaccepted .wpcf7-response-output,
.reg-card .wpcf7 form.submitting .wpcf7-response-output {
  display: none;
}

/* An uploaded MP4 in the click-to-play player fills the box like the iframe. */
video.watch__frame {
  object-fit: contain;
  background: #000;
}

/* Inline SVG icons from the media library keep the design's line weight. */
.event-facts__icon,
.benefit__icon svg,
.live-chip svg {
  overflow: visible;
}
