/* 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;
  touch-action: manipulation;
}

/* 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;
  transition: none !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: 56px;
  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: 350;
  font-size: 34px;
  color: white;
  line-height: 0.9;
  margin-bottom: 18px;
}

.subtitle {
  font-family: 'ABC Social Variable', -apple-system, sans-serif;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 18px;
  letter-spacing: 0.3px;
  max-width: 260px;
  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;
}

/* QR Toast */
.qr-toast {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}

.qr-container:hover .qr-toast {
  opacity: 1;
  transform: translateY(0);
}

/* QR Click Bounce */
@keyframes qr-bounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.qr-container.bounce {
  animation: qr-bounce 300ms 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) translateY(var(--expand-y, 0px)) 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;
}

/* ===== Mobile Elements (hidden by default) ===== */
.mobile-focus-bar,
.mobile-bottom-buttons {
  display: none;
}

/* ===== Mobile Mode ===== */
body.mobile-mode {
  --video-width: 300px;
  --video-height: 602px;
}

body.mobile-mode .carousel-arrow,
body.mobile-mode .qr-container,
body.mobile-mode .flags-badge,
body.mobile-mode .expand-backdrop {
  display: none;
}

/* Mobile layout: content-group becomes flex column, title on top */
body.mobile-mode .content-group {
  position: static;
  transform: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100vh;
  padding-top: env(safe-area-inset-top);
}

body.mobile-mode .title-section {
  order: -1;
  flex: 1;
  z-index: 5;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 32px 0;
  min-height: 0;
}

body.mobile-mode .title {
  font-size: 32px;
}

body.mobile-mode .subtitle {
  font-size: 16px;
  max-width: 320px;
}

/* Mobile carousel: fixed to video height, no extra centering space */
body.mobile-mode .carousel {
  flex: none;
  height: var(--video-height);
  width: 100%;
}

body.mobile-mode .carousel-track {
  width: var(--video-width);
  height: var(--video-height);
}

/* Remove blur/overlays on mobile — only one card visible */
body.mobile-mode .carousel-item video {
  filter: blur(0px);
}

body.mobile-mode .video-overlay-dim {
  opacity: 0;
}

/* ===== Mobile Vertical Position Classes ===== */
body.mobile-mode .carousel-item {
  transition:
    transform 480ms var(--transition-easing),
    opacity 480ms var(--transition-easing);
}

body.mobile-mode .mobile-center {
  transform: translateY(0) scale(1);
  opacity: 1;
  z-index: 3;
}

body.mobile-mode .mobile-above {
  transform: translateY(calc(-100% - 40px)) scale(1.15);
  opacity: 0;
  z-index: 1;
}

body.mobile-mode .mobile-below {
  transform: translateY(calc(100% + 40px)) scale(1.15);
  opacity: 0;
  z-index: 1;
}

body.mobile-mode .mobile-wrapping {
  transition: none !important;
}

/* Disable desktop hover effects on mobile */
body.mobile-mode .carousel-item--left:hover,
body.mobile-mode .carousel-item--right:hover {
  transform: none;
}

body.mobile-mode .carousel-item--left:hover video,
body.mobile-mode .carousel-item--right:hover video {
  filter: blur(0px);
}

/* ===== Mobile Focus Bar ===== */
body.mobile-mode .mobile-focus-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 150px;
  background: black;
  border-radius: 10px 0 0 10px;
  padding: 5px;
  z-index: 20;
}

.mobile-focus-pill {
  flex: 1;
  width: 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 300ms ease;
}

.mobile-focus-pill.active {
  background: white;
}

/* ===== Mobile Bottom Buttons ===== */
body.mobile-mode .mobile-bottom-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 302px;
  z-index: 20;
}

.mobile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 60px;
  border-radius: 20px;
  font-family: 'ABC Social Variable', -apple-system, sans-serif;
  font-size: 22px;
  font-weight: 462;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border: none;
  letter-spacing: -3%;
}

.mobile-btn--next {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid #747474;
  color: #f5f5f5;
}

.mobile-btn--download {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid white;
  color: black;
}

/* ===== Mobile Gradient Overlays ===== */
.mobile-gradient-top { display: none; }
.mobile-gradient-bottom { display: none; }

body.mobile-mode .mobile-gradient-top {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--mobile-video-top, 70vh) - 16px);
  background: linear-gradient(to bottom,
    rgba(var(--bg-color-rgb), 1) 0%,
    rgba(var(--bg-color-rgb), 1) 55%,
    rgba(var(--bg-color-rgb), 0) 100%
  );
  pointer-events: none;
  z-index: 4;
}

body.mobile-mode .mobile-gradient-bottom {
  display: block;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50vh;
  background: linear-gradient(to top, rgba(var(--bg-color-rgb), 1) 0%, rgba(var(--bg-color-rgb), 0) 100%);
  pointer-events: none;
  z-index: 10;
}
