/*
 * Agencies local navigation + scroll-led selected work.
 *
 * The global navigation remains the site navigation. This compact local bar
 * names the current audience and keeps the booking action available. The
 * showcase below pins the project copy beside one persistent 16:9 display;
 * a brief screen cover marks each chapter change inside that frame, with sound
 * available only through the TV's own opt-in control.
 */

.site-shell--agencies:not(.site-shell--service-detail) {
  --agency-global-header-height: 48px;
  --agency-local-nav-height: 52px;
  --agency-header-stack: var(--agency-global-header-height);
}

.agency-local-nav {
  position: absolute;
  top: var(--agency-global-header-height);
  z-index: 19;
  display: flex;
  align-items: center;
  width: 100%;
  height: var(--agency-local-nav-height);
  margin-top: 0;
  border-bottom: 1px solid rgba(5, 5, 5, 0.1);
  background: #fff;
  color: #050505;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.agency-local-nav__inner {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 clamp(20px, 3vw, 40px);
}

.agency-local-nav__title,
.agency-local-nav__work,
.agency-local-nav__contact {
  text-decoration: none;
}

.agency-local-nav__title {
  color: #050505;
  font-family: var(--mp-font-display, Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif);
  font-size: 1.22rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.9;
  text-transform: uppercase;
}

.agency-local-nav__actions {
  display: flex;
  align-items: center;
  gap: var(--mp-compact-button-gap, 8px);
}

.agency-local-nav__work,
.agency-local-nav__contact {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: var(--mp-compact-button-height, 40px);
  min-height: var(--mp-compact-button-height, 40px);
  padding: 0 var(--mp-compact-button-padding, 22px);
  border: 1px solid transparent;
  border-radius: var(--mp-button-radius, 4px);
  font-family: var(--mp-font-body, "Helvetica Neue", Helvetica, Arial, sans-serif);
  font-size: var(--mp-compact-button-font-size, 0.72rem);
  font-weight: 800;
  letter-spacing: 0.075em;
  line-height: 1;
  text-transform: uppercase;
  appearance: none;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.agency-local-nav__work {
  border-color: rgba(5, 5, 5, 0.28);
  background: transparent;
  color: rgba(5, 5, 5, 0.82);
}

.agency-local-nav__contact {
  border-color: #050505;
  background: #050505;
  color: #fff;
}

.agency-local-nav__work::before,
.agency-local-nav__contact::before {
  content: "";
  position: absolute;
  inset: -2px;
}

.agency-local-nav__work:hover,
.agency-local-nav__work:focus-visible,
.agency-local-nav__contact:hover,
.agency-local-nav__contact:focus-visible {
  transform: translateY(-1px);
}

.agency-local-nav__work:hover,
.agency-local-nav__work:focus-visible {
  border-color: rgba(5, 5, 5, 0.72);
  color: #050505;
}

.agency-local-nav__contact:hover,
.agency-local-nav__contact:focus-visible {
  border-color: #1b1b1d;
  background: #1b1b1d;
}

.agency-local-nav :is(a, button):focus-visible {
  outline: 2px solid #050505;
  outline-offset: 3px;
}

.agency-page-title-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.site-shell--agencies:not(.site-shell--service-detail)
  .agency-campaign-hero {
  margin-top: var(--agency-global-header-height) !important;
  min-height: calc(100vh - var(--agency-header-stack)) !important;
  min-height: calc(100svh - var(--agency-header-stack)) !important;
}

.site-shell--agencies:not(.site-shell--service-detail)
  .agency-campaign-wall__primary[data-agency-campaign-key="roku-howdy"]
  .agency-campaign-wall__video {
  object-fit: cover !important;
  object-position: 50% 100% !important;
}

.agency-scroll-showcase {
  position: relative;
  z-index: 2;
  color: #050505;
  background: #f5f5f7;
  isolation: isolate;
}

.agency-scroll-showcase__eyebrow {
  margin: 0;
  color: rgba(5, 5, 5, 0.52);
  font-family: var(--mp-font-body, "Helvetica Neue", Helvetica, Arial, sans-serif);
  font-size: 0.68rem;
  font-weight: 720;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.agency-scroll-showcase__experience {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(250px, 0.34fr) minmax(0, 0.66fr);
  gap: clamp(42px, 6vw, 112px);
  align-items: start;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: clamp(40px, 5vw, 76px) clamp(24px, 4vw, 64px)
    clamp(120px, 22svh, 220px);
}

/* Without the controller, preserve the original readable two-column layout. */
.agency-scroll-showcase__pin {
  display: contents;
}

.agency-scroll-showcase__steps,
.agency-scroll-showcase__stage {
  grid-row: 1;
}

.agency-scroll-showcase__steps {
  grid-column: 1;
}

.agency-scroll-showcase__step {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* Give each project its original reading distance without intercepting scroll. */
  min-height: 112svh;
  padding: clamp(44px, 6vh, 76px) 0;
  opacity: 0.58;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity 420ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.agency-scroll-showcase__step.is-active {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.agency-scroll-showcase__step h3 {
  max-width: 12ch;
  margin: 16px 0 0;
  color: #050505;
  font-family: var(--mp-font-display, Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif);
  font-size: clamp(1.8rem, 2.55vw, 3.2rem);
  font-weight: 900;
  letter-spacing: var(--mp-title-tracking, -0.022em);
  line-height: 0.94;
  text-transform: uppercase;
  text-wrap: balance;
}

.agency-scroll-showcase__client {
  margin: 15px 0 0;
  color: rgba(5, 5, 5, 0.72);
  font-family: var(--mp-font-body, "Helvetica Neue", Helvetica, Arial, sans-serif);
  font-size: clamp(0.88rem, 1.05vw, 1.08rem);
  font-weight: 700;
  line-height: 1.2;
}

.agency-scroll-showcase__description {
  max-width: 29ch;
  margin: 12px 0 0;
  color: rgba(5, 5, 5, 0.58);
  font-family: var(--mp-font-body, "Helvetica Neue", Helvetica, Arial, sans-serif);
  font-size: clamp(0.94rem, 1.08vw, 1.08rem);
  font-weight: 500;
  line-height: 1.45;
}

.agency-scroll-showcase__step > a {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 40px;
  margin-top: 20px;
  border-bottom: 1px solid rgba(5, 5, 5, 0.42);
  color: #050505;
  font-family: var(--mp-font-body, "Helvetica Neue", Helvetica, Arial, sans-serif);
  font-size: 0.76rem;
  font-weight: 720;
  letter-spacing: 0.02em;
  line-height: 1;
  text-decoration: none;
  transition: border-color 180ms ease;
}

.agency-scroll-showcase__step > a:hover,
.agency-scroll-showcase__step > a:focus-visible {
  border-color: #050505;
}

.agency-scroll-showcase__step > a:focus-visible {
  outline: 2px solid #050505;
  outline-offset: 4px;
}

.agency-scroll-showcase__stage {
  position: sticky;
  top: calc(var(--agency-header-stack) + clamp(30px, 5vh, 64px));
  grid-column: 2;
  display: grid;
  align-items: center;
  height: calc(100svh - var(--agency-header-stack) - clamp(60px, 10vh, 128px));
  min-height: 0;
}

.agency-scroll-showcase__television {
  position: relative;
  box-sizing: border-box;
  justify-self: center;
  width: min(100%, calc((100svh - var(--agency-header-stack) - clamp(60px, 10vh, 128px)) * 16 / 9));
  margin: 0;
  padding: clamp(5px, 0.55vw, 9px);
  border-radius: clamp(10px, 1vw, 18px);
  background: #1d1d1f;
  box-shadow:
    0 34px 90px rgba(5, 5, 5, 0.2),
    0 3px 12px rgba(5, 5, 5, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.agency-scroll-showcase__television::after {
  content: "";
  position: absolute;
  top: calc(100% + clamp(7px, 0.7vw, 11px));
  left: 50%;
  width: min(32%, 270px);
  height: clamp(5px, 0.5vw, 8px);
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.9);
  box-shadow: 0 12px 24px rgba(5, 5, 5, 0.14);
  transform: translateX(-50%);
}

.agency-scroll-showcase__screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: clamp(5px, 0.55vw, 10px);
  background: #050505;
  isolation: isolate;
}

.agency-scroll-showcase__screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #050505;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--agency-screen-cover-duration, 180ms) ease;
}

.agency-scroll-showcase.is-switching .agency-scroll-showcase__screen::after {
  opacity: 1;
}

.agency-scroll-showcase__scene,
.agency-scroll-showcase__video,
.agency-scroll-showcase__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.agency-scroll-showcase__scene {
  z-index: 1;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: none;
}

.agency-scroll-showcase__scene.is-active {
  z-index: 3;
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.agency-scroll-showcase__video,
.agency-scroll-showcase__poster {
  object-fit: cover;
  object-position: 50% 50%;
  filter: none;
  transform: none;
}

.agency-scroll-showcase__video {
  z-index: 1;
  opacity: 0;
  transition: none;
}

.agency-scroll-showcase__poster {
  z-index: 2;
  opacity: 1;
  transition: none;
  pointer-events: none;
}

.agency-scroll-showcase__scene.is-video-ready
  .agency-scroll-showcase__video {
  opacity: 1;
}

.agency-scroll-showcase__scene.is-video-ready
  .agency-scroll-showcase__poster {
  visibility: hidden;
  opacity: 0;
}

.agency-scroll-showcase__scene-label,
.agency-scroll-showcase__announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.agency-scroll-showcase__counter {
  position: absolute;
  top: clamp(16px, 2vw, 24px);
  left: clamp(16px, 2vw, 24px);
  z-index: 5;
  display: flex;
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--mp-font-body, "Helvetica Neue", Helvetica, Arial, sans-serif);
  font-size: 0.65rem;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  line-height: 1;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
}

.agency-scroll-showcase__playback {
  position: absolute;
  right: clamp(14px, 1.7vw, 22px);
  top: clamp(14px, 1.7vw, 22px);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-shell--agencies:not(.site-shell--service-detail)
  .agency-scroll-showcase__playback
  > :is(.agency-scroll-showcase__sound, .agency-scroll-showcase__play) {
  --mp-media-control-size: 40px;
  --mp-media-transparent-control-size: 40px;
  --mp-media-icon-size: 20.8px;
  position: relative;
  inset: auto;
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  margin: 0;
}

@media (min-width: 781px) {
  .agency-scroll-showcase__experience {
    overflow: visible;
  }

  .agency-scroll-showcase__stage {
    z-index: 6;
    /* Native sticky positioning gives the TV a quiet arrival and natural exit. */
  }

  .agency-scroll-showcase__steps {
    position: relative;
    z-index: 2;
  }
}

@media (max-width: 780px) {
  .site-shell--agencies:not(.site-shell--service-detail) {
    --agency-global-header-height: 48px;
    --agency-local-nav-height: 50px;
  }

  .agency-local-nav__inner {
    gap: 8px;
    padding-inline: 12px;
  }

  .agency-local-nav__title {
    font-size: 0.88rem;
  }

  .agency-local-nav__actions {
    gap: 6px;
  }

  .agency-local-nav__work,
  .agency-local-nav__contact {
    height: 40px;
    min-height: 40px;
    padding-inline: 10px;
    font-size: 0.66rem;
    letter-spacing: 0.055em;
  }

  .agency-scroll-showcase__experience {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 28px 0 88px;
  }

  .site-shell--agencies:not(.site-shell--service-detail)
    .agency-campaign-hero {
    position: relative;
    height: calc(100vh - var(--agency-global-header-height)) !important;
    height: calc(100svh - var(--agency-global-header-height)) !important;
    min-height: calc(100vh - var(--agency-global-header-height)) !important;
    min-height: calc(100svh - var(--agency-global-header-height)) !important;
    padding: 0 !important;
    overflow: hidden;
    background: #050505 !important;
  }

  .site-shell--agencies:not(.site-shell--service-detail)
    .agency-campaign-wall {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
  }

  .site-shell--agencies:not(.site-shell--service-detail)
    .agency-campaign-wall__primary,
  .site-shell--agencies.agency-depth-v1:not(.site-shell--service-detail)
    .agency-campaign-wall:hover
    .agency-campaign-wall__primary {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
  }

  .site-shell--agencies:not(.site-shell--service-detail)
    .agency-campaign-wall__primary[data-agency-campaign-key="roku-howdy"]
  {
    background: #050505 !important;
  }

  .agency-scroll-showcase__stage {
    top: calc(var(--agency-header-stack) + 12px);
    z-index: 6;
    order: -1;
    align-self: stretch;
    box-sizing: border-box;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 12px 16px 24px;
    background: linear-gradient(
      180deg,
      #f5f5f7 0%,
      #f5f5f7 calc(100% - 18px),
      rgba(245, 245, 247, 0) 100%
    );
  }

  .agency-scroll-showcase__television {
    box-sizing: border-box;
    width: 100%;
    max-width: calc((100svh - var(--agency-header-stack) - 80px) * 16 / 9);
    margin-inline: auto;
    padding: 5px;
    border-radius: 10px;
  }

  .agency-scroll-showcase__screen {
    border-radius: 5px;
  }

  .agency-scroll-showcase__steps {
    position: relative;
    z-index: 2;
    order: 1;
    padding-inline: 18px;
  }

  .agency-scroll-showcase__step {
    justify-content: flex-end;
    min-height: 96svh;
    padding: clamp(250px, 70vw, 310px) 0 54px;
  }

  .agency-scroll-showcase__step:first-child {
    justify-content: flex-start;
    min-height: 60svh;
    padding-top: 24px;
  }

  .agency-scroll-showcase__step h3 {
    max-width: 13ch;
    font-size: clamp(1.75rem, 8vw, 2.45rem);
  }

  .agency-scroll-showcase__description {
    font-size: 1rem;
  }

  .agency-scroll-showcase__playback {
    right: 12px;
    top: 12px;
  }

  .agency-scroll-showcase__counter {
    display: flex;
    top: 14px;
    left: 14px;
  }

  .site-shell--agencies .agency-scroll-showcase__counter,
  .site-shell--agencies .agency-scroll-showcase__counter span {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agency-scroll-showcase__steps {
    opacity: 1;
  }

  .agency-scroll-showcase__stage {
    transform: none;
    transition: none;
  }

  .agency-local-nav__contact,
  .agency-scroll-showcase__step,
  .agency-scroll-showcase__scene,
  .agency-scroll-showcase__video,
  .agency-scroll-showcase__poster {
    transition: none !important;
    transform: none !important;
  }

  .agency-scroll-showcase__video {
    display: none;
  }

  .agency-scroll-showcase__playback {
    display: none;
  }

  .agency-scroll-showcase__scene.is-active
    .agency-scroll-showcase__poster {
    visibility: visible;
    opacity: 1;
  }

  .agency-scroll-showcase__scene.is-active {
    opacity: 1;
    visibility: visible;
  }

  .agency-scroll-showcase__scene:not(.is-active) {
    opacity: 0;
    visibility: hidden;
  }

  .agency-scroll-showcase__screen::after {
    transition: none;
  }
}

/*
 * The initialized experience is one pinned composition. The controller owns
 * chapter selection; CSS only supplies the quiet holding distance.
 */
.agency-scroll-showcase[data-initialized="true"] .agency-scroll-showcase__experience {
  display: block;
}

.agency-scroll-showcase[data-initialized="true"]
  .agency-scroll-showcase__experience::after {
  content: "";
  display: block;
  height: calc(var(--agency-chapter-count, 5) * 96svh);
  pointer-events: none;
}

.agency-scroll-showcase[data-initialized="true"] .agency-scroll-showcase__pin {
  position: sticky;
  top: min(
    calc(var(--agency-header-stack) + clamp(30px, 5vh, 64px)),
    var(--agency-pin-bottom-limit, 100vh)
  );
  z-index: 2;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(250px, 0.34fr) minmax(0, 0.66fr);
  gap: clamp(42px, 6vw, 112px);
  align-items: center;
  min-height: calc(100svh - var(--agency-header-stack) - clamp(60px, 10vh, 128px));
}

.agency-scroll-showcase[data-initialized="true"] .agency-scroll-showcase__steps {
  position: relative;
  z-index: 2;
  grid-column: 1;
  grid-row: 1;
  display: grid;
  align-items: start;
  padding: 0;
}

.agency-scroll-showcase[data-initialized="true"] .agency-scroll-showcase__step {
  grid-area: 1 / 1;
  min-height: 0;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: none;
  transition: none;
}

.agency-scroll-showcase[data-initialized="true"]
  .agency-scroll-showcase__step.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.agency-scroll-showcase[data-initialized="true"] .agency-scroll-showcase__stage {
  position: static;
  top: auto;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  display: grid;
  align-items: center;
  order: initial;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  background: none;
}

@media (max-width: 780px) {
  .agency-scroll-showcase[data-initialized="true"] .agency-scroll-showcase__experience {
    padding: 28px 16px 0;
  }

  .agency-scroll-showcase[data-initialized="true"] .agency-scroll-showcase__pin {
    top: min(
      calc(var(--agency-header-stack) + 12px),
      var(--agency-pin-bottom-limit, 100vh)
    );
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 24px;
    min-height: calc(100svh - var(--agency-header-stack) - 24px);
    padding: 0 0 24px;
  }

  .agency-scroll-showcase[data-initialized="true"] .agency-scroll-showcase__stage {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
  }

  .agency-scroll-showcase[data-initialized="true"] .agency-scroll-showcase__steps {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    padding: 0 2px;
  }

  .agency-scroll-showcase[data-initialized="true"] .agency-scroll-showcase__step,
  .agency-scroll-showcase[data-initialized="true"]
    .agency-scroll-showcase__step:first-child {
    justify-content: flex-start;
    min-height: 0;
    padding: 0;
  }
}
