/* ===================================
   SPATIAL DESIGN - FLOATING ISLANDS
   =================================== */

* {
  cursor: none; /* Hide default cursor for custom one */
}

body {
  font-family: Futura, sans-serif;
  background: #f5f5f5; /* Light mode default */
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: relative;
  width: 100vw;
  height: 100vh;
}

/* Dark mode background */
body:not(.light-mode) {
  background: #131313;
}

/* Three.js Canvas Background */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Floating Container */
.floating-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

/* Floating Buttons (Islands) - Matching playlist nav buttons */
.floating-button {
  position: absolute;
  /* Glass panel style - very transparent */
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 25px;
  padding: 20px 50px;
  text-align: center;
  text-decoration: none;
  font-family: Futura, sans-serif;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--color-text, #c8c8c8);
  /* Smooth, slow transition for all properties */
  transition:
    transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
    background 0.5s ease,
    border-color 0.5s ease,
    color 0.5s ease,
    box-shadow 0.6s ease;
  pointer-events: auto;
  will-change: transform, box-shadow;
  /* Start with invisible shadow for smooth transition */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0);
}

/* Individual button positions (will be animated) */
#sheets-btn {
  top: 30%;
  left: 35%;
}

#playlists-btn {
  top: 38%;
  left: 50%;
}

#writing-btn {
  top: 50%;
  left: 40%;
}

/* Hover State - smooth scale up with gradual shadow */
.floating-button:hover {
  transform: translateY(-5px) scale(1.08);
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--color-text-active, #ffffff);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

/* Active State - slight deflate on click */
.floating-button:active {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Light mode base styles defined later in file */

/* Name Container - Centered, Subtle */
.name-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  text-align: center;
  opacity: 0.4;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.name-container:hover {
  opacity: 0.7;
}

.name {
  font-size: 3rem;
  font-weight: 300;
  color: #c8c8c8;
  margin: 0;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Custom Cursor - Just the dot */
.custom-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
}

.cursor-inner {
  position: fixed;
  width: 6px;
  height: 6px;
  background: #ffffff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}

.cursor-outer {
  display: none;
}

/* Social Icons - Liquid Glass Style */
.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  padding: 8px;
  box-sizing: border-box;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.02) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 4px 15px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.08),
    inset 0 -1px 1px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.3s ease,
    box-shadow 0.4s ease,
    background 0.3s ease,
    border-color 0.3s ease;
  pointer-events: auto;
}

.social-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease, filter 0.3s ease;
}

/* Invert LinkedIn and Instagram to white in dark mode */
#linkedin-logo img,
#instagram-logo img {
  filter: invert(1) brightness(1);
}

/* Size adjustments for each logo */
#linkedin-logo img {
  width: 70%;
  height: 70%;
}

#instagram-logo img {
  width: 110%;
  height: 110%;
}

#substack-logo img {
  width: 110%;
  height: 110%;
  filter: none;
}

/* Hover effects for LinkedIn and Instagram */
#linkedin-logo:hover img,
#instagram-logo:hover img {
  transform: scale(1.1);
  filter: invert(1) brightness(1.2);
}

#linkedin-logo:active img,
#instagram-logo:active img {
  transform: scale(0.95);
  filter: invert(1) brightness(0.8);
}

/* Hover effects for Substack (no invert) */
#substack-logo:hover img {
  transform: scale(1.1);
  filter: brightness(1.2);
}

#substack-logo:active img {
  transform: scale(0.95);
  filter: brightness(0.8);
}

.social-icon:hover {
  transform: scale(1.1);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.04) 50%,
    rgba(255, 255, 255, 0.08) 100%
  );
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.12),
    inset 0 -1px 1px rgba(0, 0, 0, 0.2);
}

.social-icon:active {
  transform: scale(0.95);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.03) 50%,
    rgba(255, 255, 255, 0.06) 100%
  );
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.08),
    inset 0 -1px 1px rgba(0, 0, 0, 0.15);
}

/* Social Icons Wrapper - Stacked Layout */
.social-icons-wrapper {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: calc(20px + env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Align CE button and social icons to left edge */
  gap: var(--space-4, 8px);
  z-index: 15; /* Below section-content (50) so sections naturally cover social icons */
  pointer-events: none;
}

.social-icons-container {
  display: flex;
  gap: 15px;
  pointer-events: none;
}

/* CE Button - Just the vector, no background */
.ce-button {
  width: 180px; /* Slightly wider to accommodate script flourishes */
  height: auto;
  padding: 10px 0;
  margin-left: -18px; /* Offset to align visual start of text with social icons */
  border: none;
  background: transparent;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  pointer-events: auto;
  cursor: none;
}

.ce-button img {
  height: auto;
  width: 100%;
  filter: invert(1); /* White in dark mode */
  opacity: 0.6; /* Slightly dimmed */
  transition: opacity 0.3s ease;
}

.ce-button:hover img {
  opacity: 1; /* Full brightness on hover */
}

.ce-button:active img {
  opacity: 0.4; /* Dimmer on click */
}

/* CE "Coming Soon" Popup */
.ce-popup {
  position: fixed;
  bottom: calc(140px + env(safe-area-inset-bottom, 0px));
  left: calc(20px + env(safe-area-inset-left, 0px));
  padding: 12px 20px;
  font-family: Futura, sans-serif;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: #c8c8c8;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.04) 50%,
    rgba(255, 255, 255, 0.07) 100%
  );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.08),
    inset 0 -1px 1px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
  z-index: 16; /* Above social icons (15) but below section-content (50) */
}

.ce-popup.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Dark Mode Button Overrides (when toggled from light default) */
body:not(.light-mode) .floating-button {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  color: #c8c8c8;
  transition:
    transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
    background 0.5s ease,
    border-color 0.5s ease,
    color 0.5s ease,
    box-shadow 0.6s ease;
}

body:not(.light-mode) .floating-button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  color: #ffffff;
}

body:not(.light-mode) .floating-button:active {
  transform: translateY(-2px) scale(1.03);
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Light Mode Overrides */
body.light-mode {
  background: #f5f5f5;
}

body.light-mode .social-icon {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.25) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow:
    0 4px 15px rgba(0, 0, 0, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.7),
    inset 0 -1px 1px rgba(0, 0, 0, 0.03);
}

body.light-mode .social-icon:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0.35) 100%
  );
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.1),
    inset 0 1px 2px rgba(255, 255, 255, 0.8),
    inset 0 -1px 1px rgba(0, 0, 0, 0.04);
}

body.light-mode .social-icon:active {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.3) 100%
  );
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.06),
    inset 0 1px 1px rgba(255, 255, 255, 0.7),
    inset 0 -1px 1px rgba(0, 0, 0, 0.03);
}

/* Light mode social icon filters handled in global.css to avoid duplication */

/* Light mode - CE Button */
body.light-mode .ce-button img {
  filter: none; /* No inversion - SVG is already black */
  opacity: 0.6;
}

body.light-mode .ce-button:hover img {
  opacity: 1;
}

body.light-mode .ce-button:active img {
  opacity: 0.4;
}

/* Light mode - CE Popup */
body.light-mode .ce-popup {
  color: #2a2a2a;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.25) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.7),
    inset 0 -1px 1px rgba(0, 0, 0, 0.03);
}

/* Light mode - transparent glass with smooth shadow transition */
body.light-mode .floating-button {
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  color: #2a2a2a;
  transition:
    transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
    background 0.5s ease,
    border-color 0.5s ease,
    color 0.5s ease,
    box-shadow 0.6s ease;
}

body.light-mode .floating-button:hover {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  color: #000000;
}

body.light-mode .floating-button:active {
  transform: translateY(-2px) scale(1.03);
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

body.light-mode .name {
  color: #2a2a2a;
}

body.light-mode .cursor-inner {
  background: #000000;
}

body.light-mode .cursor-outer {
  border-color: rgba(0, 0, 0, 0.3);
}

/* Section Content Overlays */
.section-content {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  pointer-events: auto;
  padding: 80px 40px 40px;
  overflow-y: auto;
  box-sizing: border-box;
}

.section-inner {
  max-width: 1200px;
  margin: 0 auto;
  color: #c8c8c8;
}

.section-inner h1 {
  font-size: 3rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  margin-bottom: 2rem;
  text-transform: uppercase;
}

.section-content .back-button {
  position: fixed;
  top: 30px;
  left: 30px;
  z-index: 100;
}

/* Light mode section content */
body.light-mode .section-inner {
  color: #2a2a2a;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  .floating-button {
    font-size: 18px;
    padding: 15px 30px;
  }

  .name {
    font-size: 2rem;
  }

  /* Stack buttons vertically on mobile */
  #sheets-btn {
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
  }

  #playlists-btn {
    top: 45%;
    left: 50%;
    transform: translateX(-50%);
  }

  #writing-btn {
    top: 65%;
    left: 50%;
    transform: translateX(-50%);
  }

  /* Section content - reduce padding on mobile */
  .section-content {
    padding: 80px 20px 40px;
    overflow-x: hidden;
    overscroll-behavior: contain;
  }

  /* Disable custom cursor on mobile */
  * {
    cursor: auto !important;
  }

  .custom-cursor {
    display: none;
  }

  /* Disable floating animations on mobile for better positioning */
  .floating-button {
    animation: none !important;
  }

  /* Social icons and CE button mobile adjustments */
  .social-icons-wrapper {
    left: calc(15px + env(safe-area-inset-left, 0px));
    bottom: calc(15px + env(safe-area-inset-bottom, 0px));
  }

  .ce-button {
    width: 140px; /* Smaller on mobile */
    margin-left: -10px; /* Reduce offset on mobile to prevent overflow */
  }
}
