.ow-reels {
  display: none;
}

@media (max-width: 960px) {
  .search-widget-area {
    display: flow-root;
  }

  .ow-reels-mobile {
    display: block;
    padding-block: 13px 1px;
  }

  .ow-reels-mobile + .main-content {
    padding-top: 8px;
  }
}

@media (min-width: 961px) {
  .ow-reels-desktop {
    display: block;
  }

  .ow-reels-desktop .ow-reels-list {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }

  .ow-reels-desktop .ow-reels-ring {
    width: min(80px, 100%);
  }
}

.ow-blog-index .blog-main > .ow-reels {
  margin-bottom: 16px;
}

.ow-blog-index .blog-main > .ow-reels-mobile {
  width: 100%;
  padding-block: 0;
}

.ow-reels-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  margin: 0;
  padding: 4px 3px;
  list-style: none;
  scrollbar-width: thin;
}

.ow-reels-item {
  flex: 0 0 104px;
  min-width: 0;
  scroll-snap-align: start;
}

.ow-reels-tile {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: start;
  gap: 6px;
  height: 100%;
  padding: 2px;
  border-radius: 8px;
  color: var(--color-ink);
  text-align: center;
}

.ow-reels-ring {
  display: block;
  width: 92px;
  aspect-ratio: 1;
  padding: 3px;
  border: 2px solid #d5c9ef;
  border-radius: 50%;
  background: var(--color-surface);
}

.ow-reels-ring img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: #ede6fc;
}

.ow-reels-thumbnail {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
}

.ow-reels-thumbnail img {
  border-radius: 0;
  /* Crop the side padding in the wide thumbnails used for vertical Shorts. */
  transform: scale(1.84);
}

.ow-reels-mascot .ow-reels-ring {
  position: relative;
  background: #f1eaff;
}

.ow-reels-mascot .ow-reels-ring img {
  position: absolute;
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  padding: 2px;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
  transform-origin: center 75%;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .ow-reels-mascot .ow-reels-ring img {
    transition: transform 200ms ease-out;
  }

  .ow-reels-mascot .ow-reels-ring:hover img {
    transform: translateY(-2px) rotate(-6deg);
  }
}

.ow-reels-mascot-speech {
  position: relative;
  width: max-content;
  max-width: 100%;
  padding: 2px 5px;
  border-radius: 6px;
  background: var(--color-primary-700);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ow-reels-mascot-speech::before {
  position: absolute;
  inset-block-end: 100%;
  inset-inline-start: calc(50% - 4px);
  border: 4px solid transparent;
  border-block-start: 0;
  border-block-end-color: var(--color-primary-700);
  content: "";
}

.ow-reels-item.is-newest .ow-reels-ring,
.ow-reels-link:hover .ow-reels-ring {
  border-color: var(--color-primary);
}

@supports (mask-image: radial-gradient(#000, transparent)) {
  @media (prefers-reduced-motion: no-preference) {
    .ow-reels-item.is-newest .ow-reels-ring {
      position: relative;
    }

    .ow-reels-item.is-newest .ow-reels-ring::after {
      position: absolute;
      inset: -2px;
      border-radius: inherit;
      background: conic-gradient(var(--color-primary) 0 55%, #946df8 74%, #d9c9ff 84%, var(--color-primary) 97%);
      mask-image: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
      animation: ow-reels-ring-orbit 4.6s linear infinite;
      pointer-events: none;
      content: "";
    }
  }
}

@keyframes ow-reels-ring-orbit {
  to { transform: rotate(1turn); }
}

.ow-reels-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ow-reels-dialog:not([open]) {
  display: none;
}

.ow-reels-dialog {
  width: min(380px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-ink);
  overscroll-behavior: contain;
}

.ow-reels-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(200px, 1fr) auto;
  gap: 10px;
  height: min(750px, calc(100dvh - 24px));
}

.ow-reels-dialog::backdrop {
  background: rgb(15 23 42 / 70%);
}

.ow-reels-dialog-header,
.ow-reels-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ow-reels-dialog-header h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.ow-reels-control {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-ink);
  cursor: pointer;
}

.ow-reels-control:disabled {
  opacity: 0.4;
  cursor: default;
}

.ow-reels-control:not(:disabled):hover {
  background: #f1edff;
}

.ow-reels-player {
  background: #0f172a;
}

.ow-reels-player iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (any-pointer: coarse) {
  .ow-reels-dialog {
    touch-action: pan-y pinch-zoom;
  }

  .ow-reels-player {
    position: relative;
  }

  /* The embedded player cannot pass touches back to the page. Keep only its edges available for swipes. */
  .ow-reels-player::before,
  .ow-reels-player::after {
    position: absolute;
    z-index: 1;
    inset-block: 20% 22%;
    inline-size: min(54px, 18%);
    content: "";
  }

  .ow-reels-player::before {
    inset-inline-start: 0;
  }

  .ow-reels-player::after {
    inset-inline-end: 0;
  }
}

.ow-reels-cta {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 48px;
  padding: 8px;
  border: 1px solid #eab308;
  border-radius: 7px;
  background: #ffd226;
  color: #271b06;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.ow-reels-cta:hover {
  background: #ffde58;
  color: #271b06;
}

.ow-reels-cta svg {
  flex: none;
  width: 16px;
  height: 16px;
}

@media (prefers-reduced-motion: no-preference) {
  .ow-reels-dialog[open] .ow-reels-cta {
    animation: ow-reels-cta-pulse 1.9s ease-out 2;
  }
}

@keyframes ow-reels-cta-pulse {
  from { box-shadow: 0 0 0 0 rgb(234 179 8 / 58%); }
  to { box-shadow: 0 0 0 5px rgb(234 179 8 / 0%); }
}

.ow-reels :is(a, button):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .ow-reels-item {
    flex-basis: 83px;
  }

  .ow-reels-ring {
    width: 77px;
  }
}
