/* Fonts */
@font-face {
  font-family: 'ABC Otto';
  src: url('assets/ABCOttoItalicVariable-Trial.ttf') format('truetype');
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'ABC Social Variable';
  src: url('assets/ABCSocialVariable-Trial.ttf') format('truetype');
  font-display: swap;
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Custom Properties */
:root {
  --bg-color: #545454;
  --bg-color-rgb: 84, 84, 84;
  --video-width: 276px;
  --video-height: 554px;
  --video-radius: 24px;
  --transition-duration: 550ms;
  --transition-easing: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Body */
body {
  background-color: var(--bg-color);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  font-family: 'ABC Social Variable', -apple-system, sans-serif;
}

/* Animation Lock */
body.carousel-animating .carousel-item,
body.carousel-animating .carousel-arrow {
  pointer-events: none;
}

/* ===== Content Group (centered via JS) ===== */
.content-group {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== Carousel ===== */
.carousel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
}

.carousel-track {
  position: relative;
  width: var(--video-width);
  height: var(--video-height);
}

/* Carousel Item */
.carousel-item {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--video-width);
  height: var(--video-height);
  border-radius: var(--video-radius);
  overflow: hidden;
  cursor: pointer;
  transition:
    transform var(--transition-duration) var(--transition-easing),
    z-index 0ms calc(var(--transition-duration) / 2);
  will-change: transform;
}

.carousel-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: blur(6px);
  transition: filter var(--transition-duration) var(--transition-easing);
}

.carousel-item--center video {
  filter: blur(0px);
}

.carousel-item--left:hover video,
.carousel-item--right:hover video {
  filter: blur(2px);
}

/* Position Classes */
.carousel-item--center {
  transform: translateX(0) scale(1);
  z-index: 3;
  cursor: pointer;
}

.carousel-item--left {
  transform: translateX(calc(-50% - 15px)) scale(0.92);
  z-index: 1;
}

.carousel-item--left:hover {
  transform: translateX(calc(-50% - 15px)) translateY(-14px) rotate(-2.5deg) scale(0.95);
  transition: transform 300ms cubic-bezier(0.25, 0.1, 0.25, 1), z-index 0ms calc(var(--transition-duration) / 2);
}

.carousel-item--right {
  transform: translateX(calc(50% + 15px)) scale(0.92);
  z-index: 1;
}

.carousel-item--right:hover {
  transform: translateX(calc(50% + 15px)) translateY(-14px) rotate(2.5deg) scale(0.95);
  transition: transform 300ms cubic-bezier(0.25, 0.1, 0.25, 1), z-index 0ms calc(var(--transition-duration) / 2);
}

/* Leaving-center overshoot animations */
@keyframes leave-to-left {
  0%   { transform: translateX(0) scale(1); }
  50%  { transform: translateX(calc(-70% - 25px)) scale(0.86); }
  100% { transform: translateX(calc(-50% - 15px)) scale(0.92); }
}

@keyframes leave-to-right {
  0%   { transform: translateX(0) scale(1); }
  50%  { transform: translateX(calc(70% + 25px)) scale(0.86); }
  100% { transform: translateX(calc(50% + 15px)) scale(0.92); }
}

.carousel-item.incoming {
  z-index: 4 !important;
}

.carousel-item.wrapping {
  z-index: 0 !important;
}

.carousel-item.leaving-left {
  animation: leave-to-left var(--transition-duration) cubic-bezier(0.4, 0, 0.2, 1) both !important;
  transition: none !important;
  z-index: 2 !important;
}

.carousel-item.leaving-right {
  animation: leave-to-right var(--transition-duration) cubic-bezier(0.4, 0, 0.2, 1) both !important;
  transition: none !important;
  z-index: 2 !important;
}

/* ===== Overlay Effects ===== */
.video-overlay-dim,
.video-overlay-gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: var(--video-radius);
}

/* Dim overlay — visible on side cards, hidden on center */
.video-overlay-dim {
  background: rgba(var(--bg-color-rgb), 0.65);
  opacity: 1;
  transition: opacity var(--transition-duration) var(--transition-easing);
}

.carousel-item--center .video-overlay-dim {
  opacity: 0;
}

/* Bottom gradient — visible on ALL cards */
.video-overlay-gradient {
  top: auto;
  bottom: 0;
  height: 60%;
  background: linear-gradient(
    to top,
    rgba(var(--bg-color-rgb), 1) 0%,
    rgba(var(--bg-color-rgb), 0) 100%
  );
}

/* ===== Navigation Arrows ===== */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 0.3px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 200ms ease;
}

.carousel-arrow:hover {
  background: rgba(255, 255, 255, 0.2);
}

.carousel:has(.carousel-item--left:hover) .carousel-arrow--left,
.carousel:has(.carousel-item--right:hover) .carousel-arrow--right {
  background: rgba(255, 255, 255, 0.2);
}

.carousel-arrow--left {
  left: calc(50% - var(--video-width) / 2 - 15px - 32px - 16px);
}

.carousel-arrow--right {
  right: calc(50% - var(--video-width) / 2 - 15px - 32px - 16px);
}

/* ===== Title Section ===== */
.title-section {
  text-align: center;
  margin-top: 32px;
  z-index: 5;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.title-inner {
  transition: transform 250ms cubic-bezier(0.25, 0.1, 0.25, 1), opacity 200ms ease;
}

/* Slide-out to left */
.title-inner.slide-out {
  transform: translateX(-30px);
  opacity: 0;
}

/* Slide-in from right (starting position, set via JS before removing the class) */
.title-inner.slide-in-start {
  transform: translateX(30px);
  opacity: 0;
  transition: none;
}

/* Slide-in uses a slightly longer, softer ease */
.title-inner.slide-in {
  transition: transform 300ms cubic-bezier(0.25, 0.1, 0.25, 1), opacity 300ms ease;
}

.title {
  font-family: 'ABC Otto', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 28px;
  color: white;
  line-height: 0.9;
  margin-bottom: 10px;
}

.subtitle {
  font-family: 'ABC Social Variable', -apple-system, sans-serif;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 16px;
  letter-spacing: -0.14px;
  max-width: 230px;
  margin: 0 auto;
  text-align: center;
}

/* ===== Flags Badge ===== */
.flags-badge {
  position: absolute;
  bottom: 27px;
  left: 27px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.flags-badge-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.flags-badge-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.flags-badge-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

/* ===== QR Container ===== */
.qr-container {
  position: absolute;
  bottom: 13px;
  right: 14px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  padding: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 10;
  transition: gap 300ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.qr-container:hover {
  gap: 28px;
}

.qr-header {
  width: 120px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.qr-label-left {
  font-size: 14px;
  color: white;
}

.qr-label-right {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
}

.qr-image {
  width: 120px;
  height: 120px;
  border-radius: 8px;
}

/* QR Shake Animation */
@keyframes qr-shake {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(-3deg); }
  20% { transform: rotate(3deg); }
  30% { transform: rotate(-3deg); }
  40% { transform: rotate(2deg); }
  50% { transform: rotate(-1deg); }
  60% { transform: rotate(0deg); }
}

.qr-container.shake {
  animation: qr-shake 0.6s ease-in-out;
}

/* ===== Expand Mode ===== */
.expand-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
}

body.video-expanded .expand-backdrop {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

body.video-expanded .content-group {
  z-index: 55;
}

body.video-expanded .carousel-item--center {
  transform: translateX(0) scale(1.35);
  z-index: 60;
  transition: transform 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

body.video-expanded .carousel-item--center .video-overlay-gradient {
  opacity: 0;
  transition: opacity 400ms ease;
}

body.video-expanded .carousel-item--left,
body.video-expanded .carousel-item--right {
  opacity: 0;
  transition: opacity 300ms ease, transform var(--transition-duration) var(--transition-easing);
}

body.video-expanded .carousel-arrow,
body.video-expanded .title-section,
body.video-expanded .flags-badge,
body.video-expanded .qr-container {
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}
