/* ========================================
   Social Blob - Companion Website Styles
   ======================================== */

/* --- Fonts --- */

@font-face {
  font-family: 'KG HAPPY Solid';
  src: url('../assets/fonts/KGHAPPYSolid.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* --- Reset & Base --- */

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

html, body {
  height: 100dvh;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  background: #3D1E4A;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

/* --- Main Layout --- */

.main-layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 100dvh;
  padding: 40px 24px 160px;
}

.brand-logo + .mood-prompt {
  margin-top: -8px;
}

/* --- Brand Logo --- */

.brand-logo {
  max-width: min(70vw, 55vh);
  height: auto;
  -webkit-user-drag: none;
  user-select: none;
}

/* --- Blob Container & Carousel --- */

.blob-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.blob-viewport {
  width: min(90vw, 55vh);
  height: min(90vw, 55vh);
  overflow: hidden;
}

.blob-carousel {
  display: flex;
  width: 700%; /* 7 scenes */
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.blob-scene-wrapper {
  position: relative;
  width: calc(100% / 7);
  height: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blob-scene {
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}

/* Placeholder shown when scene image fails to load */
.blob-placeholder {
  display: none;
  position: absolute;
  inset: 10%;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 24px;
  background: color-mix(in srgb, var(--placeholder-color) 60%, transparent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

/* --- Mood Area --- */

.mood-prompt {
  font-family: 'KG HAPPY Solid', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: normal;
  color: rgba(255, 255, 255, 0.5);
}

.mood-label {
  font-family: 'KG HAPPY Solid', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: normal;
  color: rgba(255, 255, 255, 0.5);
  transition: opacity 0.3s ease;
  min-height: 1.5em;
}

/* --- Battery Slider --- */

.battery-wrapper {
  width: min(70vw, 360px);
}

.battery-slider {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 52px;
  cursor: pointer;
  outline: none;
}

.battery-slider:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 4px;
  border-radius: 14px;
}

.battery-body {
  position: relative;
  flex: 1;
  height: 100%;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 0.4s ease;
}

.battery-fill {
  position: absolute;
  top: 4px;
  left: 4px;
  bottom: 4px;
  width: 75%;
  border-radius: 8px;
  transition: width 0.15s ease, background-color 0.4s ease;
}

.battery-fill-gloss {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.5) 0%,
    transparent 50%
  );
}

.battery-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 1;
}

.battery-terminal {
  width: 8px;
  height: 28px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 0.4s ease;
}

/* --- Bottom Bar (actions + info stacked) --- */

.bottom-bar {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}

.bottom-bar > * {
  pointer-events: auto;
}

.bottom-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Glass Button (Get the app) --- */

.glass-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.04);
}

.glass-btn:active {
  transform: scale(0.97);
}

/* --- Prismatic Share Button --- */

.prismatic-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease;
  overflow: visible;
  white-space: nowrap;
  z-index: 0;
}

/* Soft glow layer */
.prismatic-btn::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 999px;
  background: conic-gradient(
    from var(--prismatic-angle, 0deg),
    #ff9a80, #ffd480, #99e699, #80ccff, #bf99ff, #ff80cc, #ff9a80
  );
  animation: prismatic-rotate 4s linear infinite;
  filter: blur(6px);
  opacity: 0.25;
  z-index: -2;
}

/* Subtle rainbow ring border */
.prismatic-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: conic-gradient(
    from var(--prismatic-angle, 0deg),
    #ff9a80, #ffd480, #99e699, #80ccff, #bf99ff, #ff80cc, #ff9a80
  ) border-box;
  border: 1.5px solid transparent;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  animation: prismatic-rotate 4s linear infinite;
  opacity: 0.7;
  z-index: -1;
}

@property --prismatic-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes prismatic-rotate {
  to { --prismatic-angle: 360deg; }
}

.prismatic-btn:hover {
  transform: scale(1.04);
}

.prismatic-btn:active {
  transform: scale(0.97);
}

/* --- Info Buttons --- */

.info-buttons {
  display: flex;
  gap: 8px;
}

.info-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.info-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
}

/* --- Popovers (Glass Cards) --- */

.popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
  cursor: pointer;
}

.popover-backdrop.visible {
  opacity: 1;
}

.popover {
  position: fixed;
  z-index: 60;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 24px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.popover.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Info popovers (bottom right, above info buttons) */
.info-popover {
  bottom: 100px;
  right: 20px;
  width: min(340px, calc(100vw - 40px));
}

.info-popover h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.info-popover p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
}

.info-popover p:last-child {
  margin-bottom: 0;
}

.popover-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.popover-close:hover {
  color: rgba(255, 255, 255, 0.9);
}

.popover-cta {
  margin-top: 8px;
}

.app-store-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app-store-link:hover {
  color: #fff;
}

/* Share popover (above bottom actions) */
.share-popover {
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  width: auto;
  min-width: 180px;
  padding: 8px;
}

.share-popover.visible {
  transform: translateX(-50%) translateY(0);
}

.popover-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: #fff;
  background: none;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.popover-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* --- Toast --- */

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 100;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  font-size: 0.9rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Reduced Motion --- */

@media (prefers-reduced-motion: reduce) {
  .prismatic-btn::before,
  .prismatic-btn::after {
    animation: none;
  }

  .blob-carousel {
    transition: none;
  }

  .battery-fill {
    transition: none;
  }

  .popover,
  .popover-backdrop,
  .toast {
    transition: none;
  }
}

/* --- Responsive --- */

@media (min-width: 768px) {
  .blob-viewport {
    width: min(50vw, 50vh);
    height: min(50vw, 50vh);
  }

  .battery-wrapper {
    width: min(50vw, 400px);
  }

  /* On desktop: keep action buttons centered, break info icons out to bottom-right */
  .info-buttons {
    position: fixed;
    bottom: 32px;
    right: 32px;
  }
}

@media (min-width: 1200px) {
  .blob-viewport {
    width: min(40vw, 480px);
    height: min(40vw, 480px);
  }
}
