/* NextGP Marketing Website - Custom Styles */

:root {
  /* Brand Colors - RGB(237, 45, 45) */
  --color-brand-red: #ED2D2D;
  --color-brand-red-dark: #BE2424;
  --color-secondary: #8E44AD;
  --color-accent: #3498DB;

  /* Neutral Palette */
  --color-background: #FFFFFF;
  --color-surface: #F5F5F7;
  --color-text-primary: #1D1D1F;
  --color-text-secondary: #6E6E73;

  /* Dark Mode Colors */
  --color-dark-bg: #000000;
  --color-dark-surface: #1C1C1E;
  --color-dark-text: #F5F5F7;

  /* System Colors (iOS-inspired) */
  --color-success: #34C759;
  --color-warning: #FF9500;

  /* Spacing */
  --space-xs: 0.5rem;   /* 8px */
  --space-sm: 1rem;     /* 16px */
  --space-md: 1.5rem;   /* 24px */
  --space-lg: 2rem;     /* 32px */
  --space-xl: 3rem;     /* 48px */
  --space-2xl: 4rem;    /* 64px */
  --space-3xl: 6rem;    /* 96px */
}

/* Base Styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Ensure San Francisco font is used for all text elements */
* {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
}

/* Headings use SF Pro Display (Display variant for larger text) */
h1, h2, h3, h4, h5, h6 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  letter-spacing: -0.02em;
}

/* Body text uses SF Pro Text (Text variant optimized for smaller sizes) */
p, a, li, span, button, input, textarea {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
}

/* Header Styles */
.header {
  transition: all 0.3s ease;
  background: transparent;
  border-bottom: 1px solid transparent;
}

/* Semi-transparent black background when scrolled in hero */
.header.scrolled-dark {
  background: rgba(8, 12, 30, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(100, 120, 200, 0.2);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5),
              0 2px 4px -1px rgba(0, 0, 0, 0.4);
}

/* White background when past hero section */
.header.scrolled {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Header text colors - light when over hero */
.header a,
.header button {
  transition: color 0.3s ease;
}

/* Light text for transparent and dark backgrounds */
.header:not(.scrolled) a,
.header:not(.scrolled) button,
.header:not(.scrolled) .logo-text,
.header.scrolled-dark:not(.scrolled) a,
.header.scrolled-dark:not(.scrolled) button,
.header.scrolled-dark:not(.scrolled) .logo-text {
  color: white !important;
}

.header:not(.scrolled) .logo-subtitle,
.header.scrolled-dark:not(.scrolled) .logo-subtitle {
  color: rgba(255, 255, 255, 0.8) !important;
}

.header:not(.scrolled) .mobile-menu-btn,
.header.scrolled-dark:not(.scrolled) .mobile-menu-btn {
  color: white;
}

/* Dark/transparent header button - darker rich red gradient with Apple-style continuous corners */
.header:not(.scrolled) .btn-download,
.header.scrolled-dark:not(.scrolled) .btn-download {
  background: linear-gradient(to bottom, #ED2D2D 0%, #BE2424 50%, #9A1D1D 100%);
  color: white;
  border-radius: 14px;
  transition: all 0.3s ease;
}

.header:not(.scrolled) .btn-download:hover,
.header.scrolled-dark:not(.scrolled) .btn-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(237, 45, 45, 0.5);
}

/* White header button - red gradient with Apple-style continuous corners */
.header.scrolled .btn-download {
  background: linear-gradient(to bottom, #F44545 0%, #ED2D2D 50%, #BE2424 100%);
  color: white;
  border-radius: 14px;
  transition: all 0.3s ease;
}

.header.scrolled .btn-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(237, 45, 45, 0.4);
}

/* View Features button - white border with Apple-style continuous corners */
.view-features-btn {
  border: 2px solid white;
  border-radius: 14px;
  background: transparent;
  transition: all 0.3s ease;
}

.view-features-btn:hover {
  transform: translateY(-2px);
}

.header-icon-shadow {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Mobile Menu Animation */
#mobile-menu {
  transition: all 0.3s ease;
}

#mobile-menu:not(.hidden) {
  animation: slideDown 0.3s ease-out;
}

/* Mobile menu border color transitions */
.header:not(.scrolled) #mobile-menu,
.header.scrolled-dark:not(.scrolled) #mobile-menu {
  border-top-color: rgba(255, 255, 255, 0.2);
}

.header.scrolled #mobile-menu {
  border-top-color: rgb(226, 232, 240);
}

/* Mobile menu link colors when header has dark background */
.header:not(.scrolled) #mobile-menu a,
.header.scrolled-dark:not(.scrolled) #mobile-menu a {
  color: white !important;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Brand Red Utility */
.text-brand-red {
  color: var(--color-brand-red);
}

.bg-brand-red {
  background-color: var(--color-brand-red);
}

.border-brand-red {
  border-color: var(--color-brand-red);
}

/* Smooth Scroll */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-shape,
  .racing-stripe {
    animation: none !important;
  }
}

/* Feature Cards */
.feature-card {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover {
  transform: translateY(-2px);
}

/* Footer */
.footer-dark {
  background: linear-gradient(160deg, #050810 0%, #0a0f1e 30%, #0f1428 60%, #141930 100%);
  border-top: 1px solid rgba(237, 45, 45, 0.1);
}

/* Glass Morphism Effect */
.glass-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Shadow Utilities */
.shadow-soft {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04),
              0 8px 24px rgba(0, 0, 0, 0.08);
}

.shadow-strong {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12),
              0 24px 64px rgba(0, 0, 0, 0.16);
}

/* Hero Section - Bold & Stunning */
.hero-section {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #050810 0%, #0a0f1e 30%, #0f1428 60%, #141930 100%);
}

/* Season Pass Section - Same rich gradient */
#season-pass {
  background: linear-gradient(160deg, #050810 0%, #0a0f1e 30%, #0f1428 60%, #141930 100%);
}

/* Season Pass Background Container */
.season-pass-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Season Pass - Reverse the racing stripe animation direction */
.season-pass-bg .racing-stripe {
  animation-direction: reverse;
}

/* Bold Background Container */
.hero-bold-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Add noise texture to reduce banding */
.hero-bold-bg::after,
.season-pass-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 100;
}

/* Dynamic Aerodynamic Shapes */
.hero-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  mix-blend-mode: screen;
  opacity: 0.3;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

.hero-shape-1 {
  width: 800px;
  height: 800px;
  top: -20%;
  right: -10%;
  background: radial-gradient(circle, rgba(237, 45, 45, 0.6) 0%, rgba(237, 45, 45, 0) 70%);
  animation: flow-1 20s ease-in-out infinite;
}

.hero-shape-2 {
  width: 600px;
  height: 600px;
  bottom: -15%;
  left: -5%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.45) 0%, rgba(59, 130, 246, 0) 70%);
  animation: flow-2 18s ease-in-out infinite;
}

.hero-shape-3 {
  width: 700px;
  height: 700px;
  top: 30%;
  left: 40%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.4) 0%, rgba(168, 85, 247, 0) 70%);
  animation: flow-3 22s ease-in-out infinite;
}

@keyframes flow-1 {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-100px, 80px) scale(1.2);
  }
}

@keyframes flow-2 {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(120px, -60px) scale(1.15);
  }
}

@keyframes flow-3 {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-80px, 100px) scale(1.1);
  }
}

/* Racing Stripes - JS Generated with dynamic properties */
.racing-stripe {
  position: absolute;
  height: 100%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 20%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.12) 80%,
    transparent 100%
  );
  mix-blend-mode: overlay;
  will-change: transform, opacity, width;
  pointer-events: none;
}

/* Logarithmic-style flow animation - width and opacity synchronized */
@keyframes stripe-flow {
  0% {
    width: 1px;
    opacity: 0.15;
  }
  15% {
    width: 3px;
    opacity: 0.35;
  }
  30% {
    width: 4px;
    opacity: 0.55;
  }
  45% {
    width: 5px;
    opacity: 0.7;
  }
  50% {
    width: 6px;
    opacity: 0.8;
  }
  55% {
    width: 5px;
    opacity: 0.7;
  }
  70% {
    width: 4px;
    opacity: 0.55;
  }
  85% {
    width: 3px;
    opacity: 0.35;
  }
  100% {
    width: 1px;
    opacity: 0.15;
  }
}

@keyframes stripe-move {
  0% {
    transform: translateY(0) rotate(-15deg);
  }
  100% {
    transform: translateY(200%) rotate(-15deg);
  }
}

/* Hero iPhone Frame */
.hero-iphone-frame {
  position: relative;
  height: 65vh;
  max-height: 650px;
  min-height: 400px;
  aspect-ratio: 1350 / 2760;
  margin: 0 auto;
  overflow: visible;
}

@media (min-width: 1024px) {
  .hero-iphone-frame {
    height: 70vh;
    max-height: 780px;
    min-height: 500px;
  }
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 1350 / 2760) {
  .hero-iphone-frame {
    width: calc(65vh * 1350 / 2760);
    max-width: calc(650px * 1350 / 2760);
  }

  @media (min-width: 1024px) {
    .hero-iphone-frame {
      width: calc(70vh * 1350 / 2760);
      max-width: calc(780px * 1350 / 2760);
    }
  }
}

.hero-iphone-screen {
  position: absolute;
  top: 2%;
  left: 2.8%;
  right: 2.8%;
  bottom: 2%;
  border-radius: 3.6rem;
  overflow: hidden;
  background: #000;
}

.hero-iphone-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  opacity: 1;
  border: none;
  outline: none;
  display: block;
}

/* Prose Styles for About Section */
.prose {
  max-width: 65ch;
}

.prose p {
  margin-bottom: 1.25rem;
  line-height: 1.75;
}

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

.prose a {
  color: var(--color-brand-red);
  text-decoration: none;
  transition: opacity 0.2s;
}

.prose a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Loading state for images */
img {
  max-width: 100%;
  height: auto;
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Focus Styles for Accessibility */
a:focus,
button:focus {
  outline: 2px solid var(--color-brand-red);
  outline-offset: 2px;
}

/* Button Styles */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  background-color: var(--color-brand-red);
  color: white;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px rgba(237, 45, 45, 0.2);
}

.btn-primary:hover {
  background-color: var(--color-brand-red-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(237, 45, 45, 0.3);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  background-color: white;
  color: var(--color-text-primary);
  border: 2px solid #E5E7EB;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
  background-color: #F9FAFB;
  border-color: #D1D5DB;
}

/* Responsive Typography */
@media (max-width: 640px) {
  h1 {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }

  h2 {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
}

/* Container Max Width */
.container {
  max-width: 1200px;
}

/* Section Spacing */
section {
  scroll-margin-top: 2rem;
}

section + section {
  margin-top: 0;
}

/* Unified Container: Nav + iPhone + Settings */
.unified-container {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 95%;
  max-width: 1600px;
  margin: 0 auto;
  background: white;
  border-radius: 2rem;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Section Header - Now in left column */
.section-header {
  text-align: left;
  margin-bottom: 1.25rem;
  padding: 0;
}

.section-header h2 {
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.section-header p {
  line-height: 1.5;
}

/* Content Wrapper: Nav + iPhone side by side */
.content-wrapper {
  display: flex;
  gap: 2rem;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

/* Navigation Section */
.nav-section {
  flex-shrink: 0;
  width: 620px;
  display: flex;
  flex-direction: column;
}

/* Phone Section */
.phone-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* iPhone Device Frame - Sized to fit viewport */
.iphone-device-frame {
  position: relative;
  width: auto;
  height: min(70vh, 700px);
  margin: 0 auto;
  aspect-ratio: 1350 / 2760;
  background: transparent;
}

/* Settings Toggle Button - Top Right Icon */
.settings-toggle-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: white;
  border: 2px solid rgba(237, 45, 45, 0.15);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--color-brand-red);
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.settings-toggle-btn:hover {
  background: rgba(237, 45, 45, 0.05);
  border-color: var(--color-brand-red);
  box-shadow: 0 4px 12px rgba(237, 45, 45, 0.15);
}

.settings-toggle-btn.active {
  background: var(--color-brand-red);
  color: white;
  border-color: var(--color-brand-red);
  box-shadow: 0 4px 16px rgba(237, 45, 45, 0.3);
}

.settings-icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Settings Overlay - Dropdown */
.settings-overlay {
  position: absolute;
  top: 5rem;
  right: 1.5rem;
  display: none;
  flex-direction: column;
  gap: 1rem;
  width: 280px;
  background: white;
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 15;
  animation: slideDown 0.2s ease-out;
}

.settings-overlay.visible {
  display: flex;
}

.iphone-screen-content {
  position: absolute;
  top: 2%;
  left: 2.8%;
  right: 2.8%;
  bottom: 2%;
  border-radius: 3.6rem;
  overflow: hidden;
  background: #000;
}

.iphone-bezel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  user-select: none;
  -webkit-user-drag: none;
}

/* Track Map Styles - now fills the iPhone screen */
.track-map {
  width: 100%;
  height: 100%;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  background: #f0f0f0;
}

/* Circuit Navigation - 3 Column Grid */
.circuit-nav {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.375rem;
  padding: 0.5rem;
  background: rgba(237, 45, 45, 0.03);
  border-radius: 1rem;
  flex: 1;
  overflow: hidden;
  height: 100%;
  align-content: start;
}


.circuit-nav-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  background: white;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--color-text-secondary);
  border-radius: 0.75rem;
  text-align: left;
  width: 100%;
}

.circuit-nav-btn:hover {
  color: var(--color-text-primary);
  background: white;
  border-color: rgba(237, 45, 45, 0.2);
}

.circuit-nav-btn.active {
  color: var(--color-brand-red);
  background: white;
  border-color: var(--color-brand-red);
  box-shadow: 0 2px 8px rgba(237, 45, 45, 0.15);
}

.circuit-nav-flag {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.circuit-nav-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  flex: 1;
  min-width: 0;
}

.circuit-nav-title {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: normal;
  word-wrap: break-word;
}

.circuit-nav-location {
  font-size: 0.6875rem;
  font-weight: 400;
  opacity: 0.7;
  line-height: 1.2;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.control-group {
  background: rgba(237, 45, 45, 0.03);
  border-radius: 0.75rem;
  padding: 1rem;
}

.control-group-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
}

.control-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background-color 0.2s;
  background: white;
}

.layer-toggle:hover {
  background: rgba(237, 45, 45, 0.05);
}

.layer-toggle input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  accent-color: var(--color-brand-red);
  flex-shrink: 0;
}

.layer-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
  user-select: none;
}

.map-type-btn {
  padding: 0.625rem 1rem;
  background: white;
  border: 2px solid transparent;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--color-text-primary);
  width: 100%;
  text-align: center;
}

.map-type-btn:hover {
  border-color: rgba(237, 45, 45, 0.3);
  background: rgba(237, 45, 45, 0.05);
}

.map-type-btn.active {
  border-color: var(--color-brand-red);
  background: var(--color-brand-red);
  color: white;
}

/* Loading state for map */
.track-map.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* App Icons Showcase Section */
#app-icons {
  background: white;
  transition: background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

#app-icons.dark-mode {
  background: linear-gradient(160deg, #141930 0%, #0f1428 40%, #0a0f1e 70%, #050810 100%);
}

/* Star field */
.stars-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

#app-icons .container {
  position: relative;
  z-index: 1;
}

#app-icons h2,
#app-icons p,
#app-icons .text-slate-600,
#app-icons .bg-pink-100 {
  transition: color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#app-icons.dark-mode h2,
#app-icons.dark-mode p,
#app-icons.dark-mode .text-slate-600 {
  color: white;
}

#app-icons.dark-mode .bg-pink-100 {
  background-color: rgba(236, 72, 153, 0.2);
  color: #fce7f3;
}

.app-icon-card {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
}

.app-icon-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  /* iOS app icon corner radius - 22.37% approximation for continuous corners */
  border-radius: 22.37%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
              0 1px 3px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-icon-image.active {
  opacity: 1;
  visibility: visible;
}

/* Ensure only one variant is visible at a time */
.light-icon {
  z-index: 1;
}

.dark-icon {
  z-index: 2;
}

.dark-icon.active {
  z-index: 3;
}

/* Icon Mode Toggle Button */
.icon-mode-toggle {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.toggle-track {
  position: relative;
  width: 64px;
  height: 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3),
              inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.icon-mode-toggle.dark-mode .toggle-track {
  background: #e5e7eb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
              inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.icon-mode-toggle.dark-mode .toggle-thumb {
  transform: translateX(32px);
}

.toggle-icons {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.toggle-icon {
  width: 14px;
  height: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.sun-icon {
  opacity: 0;
  color: #f97316;
  left: 8px;
}

.moon-icon {
  opacity: 1;
  color: white;
  right: 8px;
}

.icon-mode-toggle.dark-mode .sun-icon {
  opacity: 1;
  color: #f97316;
}

.icon-mode-toggle.dark-mode .moon-icon {
  opacity: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .icon-mode-toggle {
    position: relative;
    margin: 1rem auto 0;
  }
}

/* Tablet and mobile - Stacked layout with horizontal scroll */
@media (max-width: 1200px) {
  #explore-tracks {
    min-height: auto;
  }

  .unified-container {
    padding: 1.5rem;
    width: 95%;
  }

  .section-header {
    padding: 0;
    margin-bottom: 1.25rem;
  }

  .content-wrapper {
    flex-direction: column;
    gap: 1.5rem;
  }

  .nav-section {
    width: 100%;
  }

  .circuit-nav {
    display: flex;
    flex-direction: row;
    gap: 0.875rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1rem 0.5rem;
    max-height: none;
    align-content: unset;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
  }

  .circuit-nav-btn {
    flex-direction: column;
    width: calc((100% - 2 * 0.875rem) / 3);
    min-width: calc(33% - 0.583rem);
    padding: 0.875rem 0.625rem;
    text-align: center;
    flex-shrink: 0;
    gap: 0.5rem;
    scroll-snap-align: center;
  }

  .circuit-nav-flag {
    font-size: 1.5rem;
  }

  .circuit-nav-info {
    align-items: center;
  }

  .circuit-nav-title {
    font-size: 0.8125rem;
    text-align: center;
    line-height: 1.3;
  }

  .circuit-nav-location {
    font-size: 0.75rem;
    text-align: center;
  }

  .phone-section {
    width: 100%;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .iphone-device-frame {
    height: min(60vh, 600px);
  }

  .settings-overlay {
    width: 280px;
    right: 1.25rem;
  }
}

/* Mobile - Smaller adjustments */
@media (max-width: 640px) {
  .unified-container {
    padding: 1.25rem;
    width: 98%;
  }

  .section-header h2 {
    font-size: 1.875rem;
  }

  .section-header p {
    font-size: 0.9375rem;
  }

  .circuit-nav {
    gap: 0.75rem;
    padding: 0.875rem 0.5rem;
  }

  .circuit-nav-btn {
    width: calc((100% - 2 * 0.75rem) / 3);
    min-width: calc(33% - 0.5rem);
    padding: 0.75rem 0.5rem;
    scroll-snap-align: center;
  }

  .circuit-nav-title {
    font-size: 0.75rem;
  }

  .circuit-nav-location {
    font-size: 0.7rem;
  }

  .phone-section {
    min-height: 450px;
  }

  .iphone-device-frame {
    height: min(50vh, 500px);
  }

  .settings-toggle-btn {
    top: 1rem;
    right: 1rem;
    width: 2.25rem;
    height: 2.25rem;
  }

  .settings-icon {
    width: 1.125rem;
    height: 1.125rem;
  }

  .settings-overlay {
    top: 4rem;
    right: 1rem;
    width: calc(100% - 2rem);
    max-width: 320px;
  }
}

/* Widgets Showcase Section */
#widgets {
  background: linear-gradient(160deg, #050810 0%, #0a0f1e 30%, #0f1428 60%, #141930 100%);
}

.widgets-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Add noise texture like hero */
.widgets-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 100;
}
