/*
 * Reusable interactive components
 *
 * Spotify release card, video dialog, newsletter request states, and the
 * first-party consent interface. JavaScript addresses these components via
 * data attributes; visual state is expressed with `.is-visible`.
 */

/* Spotify release card */

.music-spotify-card {
  position: relative;
  display: block;
  height: 472px;
  isolation: isolate;
  overflow: hidden;
  border-radius: 12px;
  color: #fff;
  background: #0c0c0d;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.34);
  text-align: center;
  text-decoration: none;
}

.music-spotify-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: inherit;
  pointer-events: none;
  transition: border-color 520ms ease, box-shadow 520ms ease;
}

.music-spotify-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.82) contrast(1.05) brightness(0.78);
  transform: scale(1.015);
  transition: transform 1200ms var(--ease-cinematic), filter 900ms ease;
}

.music-spotify-card-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04) 26%, rgba(0, 0, 0, 0.92) 100%),
    radial-gradient(circle at 15% 12%, rgba(var(--bb-red-rgb), 0.2), transparent 42%);
}

.music-spotify-card-content {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(26px, 4vw, 42px);
}

.music-spotify-card-eyebrow {
  margin-bottom: 9px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.music-spotify-card-content strong {
  max-width: 12ch;
  color: #fff;
  font-family: var(--font-body);
  font-size: clamp(1.65rem, 3.1vw, 2.75rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.music-spotify-card-action {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.music-spotify-card-action svg {
  width: 19px;
  height: 19px;
}

.music-spotify-card-action > span {
  color: var(--bb-red);
  transition: transform 420ms var(--ease-cinematic);
}

.music-spotify-card:hover .music-spotify-cover,
.music-spotify-card:focus-visible .music-spotify-cover {
  filter: saturate(0.98) contrast(1.06) brightness(0.86);
  transform: scale(1.055);
}

.music-spotify-card:hover::after,
.music-spotify-card:focus-visible::after {
  border-color: rgba(var(--bb-red-rgb), 0.52);
  box-shadow: inset 0 0 56px rgba(var(--bb-red-rgb), 0.1);
}

.music-spotify-card:hover .music-spotify-card-action > span,
.music-spotify-card:focus-visible .music-spotify-card-action > span {
  transform: translate(3px, -3px);
}

.music-spotify-card:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

/* Video dialog */

.video-dialog {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: clamp(18px, 4vw, 64px);
  overflow: hidden;
  border: 0;
  color: #fff;
  background: transparent;
}

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

.video-dialog[open] {
  display: grid;
  place-items: center;
}

.video-dialog::backdrop {
  background: transparent;
}

.video-dialog-backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  cursor: default;
}

.video-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  background: #080808;
  box-shadow: 0 42px 120px rgba(0, 0, 0, 0.76);
  animation: video-dialog-in 620ms var(--ease-cinematic) both;
}

.video-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 17px 20px 17px 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.video-dialog-header h2 {
  margin: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.86);
  font-family: var(--font-body);
  font-size: clamp(0.84rem, 1.5vw, 1.05rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-dialog-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.04);
  font-size: 1.7rem;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
  transition: color 300ms ease, border-color 300ms ease, transform 300ms ease;
}

.video-dialog-close:hover {
  color: var(--bb-red);
  border-color: rgba(var(--bb-red-rgb), 0.5);
  transform: rotate(4deg);
}

.video-dialog-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.video-dialog-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-dialog-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@keyframes video-dialog-in {
  from { opacity: 0; transform: translateY(18px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Newsletter async states */

.mailing-list-message[data-newsletter-success]:not([hidden]),
.mailing-list-message[data-newsletter-error]:not([hidden]) {
  display: block;
}

[data-newsletter-form][aria-busy="true"] input,
[data-newsletter-form][aria-busy="true"] button {
  opacity: 0.7;
  cursor: wait;
}

/* Consent interface */

.consent-banner,
.consent-dialog,
.consent-manager {
  --consent-accent: #ff5c5c;
  display: none;
}

.consent-banner {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 998;
  padding: 1.5rem 2rem;
  border: 0;
  color: #fff;
  background: #171717;
  font-family: var(--font-body);
  font-size: 14px;
}

.consent-banner.is-visible {
  display: flex;
  animation: consent-banner-in 500ms var(--ease-cinematic) both;
}

.consent-banner__inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 940px;
  margin-right: auto;
  margin-left: auto;
  color: #fff;
}

.consent-banner__text {
  margin: 0 1.5rem 10px 0;
  color: #fff;
}

.consent-banner__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
}

.consent-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid var(--consent-accent);
  border-radius: 0;
  color: var(--consent-accent);
  background: transparent;
  font-weight: 400;
  text-decoration: none;
}

.consent-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bb-red);
  border-radius: 999rem;
  color: #fff;
  background: var(--bb-red);
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.consent-button--secondary {
  border-color: var(--consent-accent);
  color: var(--consent-accent);
  background: #171717;
}

.consent-button:hover,
.consent-button:focus-visible {
  filter: brightness(1.08);
}

.consent-banner .consent-button {
  min-width: 8.75rem;
  margin-left: 1rem;
  padding: 0.625rem 1.25rem;
  font-size: 1rem;
  font-weight: 400;
}

.consent-banner__close {
  display: block;
  margin-left: 0.75rem;
  padding: 0.625rem;
  border: 0;
  border-radius: 999rem;
  color: #fff;
  background: #171717;
  box-shadow: 1px 1px 12px rgba(0, 0, 0, 0.1);
}

.consent-icon {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

.consent-dialog {
  position: fixed;
  inset: 0;
  z-index: 997;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 2rem;
  overflow: visible;
  border: 0;
  color: inherit;
  background: transparent;
}

.consent-dialog::backdrop {
  background: transparent;
}

.consent-dialog.is-visible {
  display: flex;
  animation: consent-dialog-fade-in 300ms ease both;
}

.consent-dialog__panel {
  position: relative;
  width: 100%;
  max-width: 36rem;
  height: 100%;
  max-height: 70vh;
  margin: 0;
  border-radius: 1rem;
  color: #fff;
  background: #171717;
}

.consent-dialog.is-visible .consent-dialog__panel {
  animation: consent-dialog-in 500ms var(--ease-cinematic) both;
}

.consent-dialog__close {
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 100%;
  color: #000;
  background: #fff;
  box-shadow: -1px 1px 12px rgba(51, 51, 51, 0.1);
}

.consent-dialog__close .consent-icon {
  width: 1rem;
  height: 1rem;
}

.consent-dialog__content {
  height: 100%;
  padding: 2.5rem 2rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.consent-space-small {
  margin-bottom: 0.75rem;
}

.consent-space-large,
.consent-dialog__quick-actions {
  margin-bottom: 2.5rem;
}

.consent-title {
  margin: 0;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

#consent-dialog-title {
  margin-top: 20px;
  margin-bottom: 10px;
}

.consent-copy {
  margin: 0;
  color: #fff;
  font-size: 0.75rem;
  line-height: 20px;
}

.consent-dialog__quick-actions .consent-button,
.consent-dialog__actions .consent-button {
  margin-right: 0.5rem;
  padding: 0.625rem 1.5rem;
  font-size: 0.875rem;
}

.consent-option {
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(51, 51, 51, 0.15);
}

.consent-option__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.consent-option__label {
  margin: 0 2rem 0 0;
  color: var(--consent-accent);
  font-size: 1rem;
  font-weight: 700;
}

.consent-toggle {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  width: 2.75rem;
  height: 1.5rem;
  margin: 0;
  padding: 0.125rem;
  border: 0;
  border-radius: 999rem;
  background: #777;
  transition: background-color 250ms ease, box-shadow 250ms ease;
}

.consent-toggle:has(.consent-toggle__input:checked) {
  background: var(--bb-red);
}

.consent-toggle:focus-within {
  box-shadow: 0 0 0 3px rgba(var(--bb-red-rgb), 0.28);
}

.consent-toggle__input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.consent-toggle__knob {
  display: block;
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: #fff;
  transition: transform 250ms var(--ease-cinematic);
}

.consent-toggle__input:checked ~ .consent-toggle__knob {
  transform: translateX(1.25rem);
}

.consent-sr-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.consent-dialog__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2rem;
  margin-right: -0.5rem;
}

.consent-dialog__backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(23, 23, 23, 0.4);
}

.consent-manager {
  position: fixed;
  bottom: calc(1.25rem + var(--safe-area-bottom));
  left: max(1.25rem, var(--safe-area-left));
  z-index: 996;
}

.consent-manager.is-visible {
  display: block;
}

.consent-manager__button {
  display: flex;
  flex-direction: column;
  padding: 0.625rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999rem;
  color: rgba(255, 255, 255, 0.62);
  background: #171717;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.34);
  transition: color 200ms ease;
}

.consent-manager__button:hover {
  color: var(--bb-red);
}

.consent-manager__icon {
  width: 2rem;
  height: 2rem;
}

.consent-link-button:focus-visible,
.consent-button:focus-visible,
.consent-banner__close:focus-visible,
.consent-dialog__close:focus-visible,
.consent-manager__button:focus-visible,
.consent-toggle__input:focus-visible + .consent-sr-label + .consent-toggle__knob {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@keyframes consent-banner-in {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes consent-dialog-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes consent-dialog-in {
  from { opacity: 0; transform: translateY(20px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media screen and (min-width: 1440px) {
  .consent-banner__inner {
    max-width: 1200px;
  }
}

@media screen and (max-width: 1100px) {
  .music-spotify-card {
    height: 430px;
  }
}

@media screen and (max-width: 991px) {
  .music-spotify-card {
    height: 420px;
  }

  .consent-banner__inner {
    flex-direction: column;
    align-items: center;
  }

  .consent-banner__text {
    margin-right: 0;
  }

  .consent-banner__actions {
    margin-top: 1rem;
  }
}

@media screen and (max-width: 600px) {
  .music-spotify-card {
    height: auto;
    aspect-ratio: 1 / 1.08;
  }

  .video-dialog {
    padding: 10px;
  }

  .video-dialog-panel {
    border-radius: 10px;
  }

  .video-dialog-header {
    min-height: 58px;
    padding: 12px 12px 12px 17px;
  }

  .consent-banner {
    max-height: 80vh;
    padding-bottom: calc(1rem + var(--safe-area-bottom));
    overflow-y: auto;
  }

  .consent-dialog {
    padding: max(1rem, var(--safe-area-top)) max(1rem, var(--safe-area-right)) max(1rem, var(--safe-area-bottom)) max(1rem, var(--safe-area-left));
  }

  .consent-dialog__panel {
    max-height: 86vh;
  }

  .consent-dialog__close {
    top: 8px;
    right: 8px;
  }
}

@media screen and (max-width: 600px) {
  .consent-banner {
    padding: 16px max(14px, var(--safe-area-right)) calc(14px + var(--safe-area-bottom)) max(14px, var(--safe-area-left));
  }

  .consent-banner__inner {
    align-items: stretch;
  }

  .consent-banner__text {
    margin: 0;
    padding-right: 42px;
    font-size: 0.78rem;
    line-height: 1.55;
  }

  .consent-banner__actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
    width: 100%;
    margin-top: 12px;
    text-align: center;
  }

  .consent-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    font-size: 0.74rem;
  }

  .consent-banner .consent-button {
    width: auto;
    min-width: 0;
    min-height: 44px;
    margin-bottom: 0;
    margin-left: 0;
    padding: 8px 10px;
    font-size: 0.74rem;
    line-height: 1.25;
  }

  .consent-banner__close {
    position: absolute;
    top: 8px;
    right: max(8px, var(--safe-area-right));
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
  }

  .consent-dialog__content {
    padding: 1.5rem;
  }

  .consent-dialog__quick-actions .consent-button,
  .consent-dialog__actions .consent-button {
    margin-bottom: 0.5rem;
  }

  .consent-manager.is-visible {
    display: none;
  }
}

@media screen and (max-height: 600px) and (orientation: landscape) {
  .video-dialog {
    padding: 8px max(8px, var(--safe-area-right)) 8px max(8px, var(--safe-area-left));
  }

  .video-dialog-panel {
    width: min(66vw, 760px);
    max-height: calc(100dvh - 16px);
  }

  .video-dialog-header {
    min-height: 48px;
    padding: 5px 8px 5px 15px;
  }

  .video-dialog-close {
    width: 44px;
    height: 44px;
  }

  .consent-dialog {
    padding-top: max(8px, var(--safe-area-top));
    padding-bottom: max(8px, var(--safe-area-bottom));
  }

  .consent-dialog__panel {
    max-height: calc(100dvh - 16px - var(--safe-area-top) - var(--safe-area-bottom));
  }

  .consent-dialog__close {
    top: 8px;
    right: 8px;
  }

  .consent-dialog__content {
    padding: 52px 20px 18px;
  }

  .consent-banner {
    padding: 7px max(10px, var(--safe-area-right)) calc(7px + var(--safe-area-bottom)) max(10px, var(--safe-area-left));
  }

  .consent-banner__inner {
    flex-direction: row;
    align-items: center;
    max-width: none;
  }

  .consent-banner__text {
    flex: 1 1 auto;
    margin: 0 12px 0 0;
    padding: 0;
    font-size: 0.7rem;
    line-height: 1.3;
  }

  .consent-banner__actions {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
    align-items: center;
    width: auto;
    margin: 0;
  }

  .consent-link-button {
    min-height: 44px;
    padding: 0 7px;
    font-size: 0.7rem;
  }

  .consent-banner .consent-button {
    width: auto;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 6px 9px;
    font-size: 0.7rem;
    line-height: 1.15;
  }

  .consent-banner__close {
    position: static;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 10px;
  }

  .consent-manager.is-visible {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .music-spotify-cover,
  .music-spotify-card::after,
  .music-spotify-card-action > span,
  .consent-toggle__knob {
    transition-duration: 0.01ms;
  }

  .video-dialog-panel,
  .consent-banner.is-visible,
  .consent-dialog.is-visible,
  .consent-dialog.is-visible .consent-dialog__panel {
    animation: none;
  }
}
