/* ==========================================================================
   Pixlune Landing Page - Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* Background Colors */
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: #1a1a3a;

  /* Accent Colors */
  --accent-cyan: #00ffff;
  --accent-magenta: #ff00ff;
  --accent-green: #00ff88;
  --accent-yellow: #ffff00;

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #b0b0c0;
  --text-muted: #6060a0;

  /* Border & Decoration */
  --border-pixel: #4040a0;

  /* Fonts */
  --font-pixel: 'Press Start 2P', cursive;
  --font-body: 'Noto Sans JP', sans-serif;

  /* Spacing */
  --section-padding: 80px 20px;
  --container-max: 1200px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.8;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

.section {
  padding: var(--section-padding);
  position: relative;
}

.section:nth-child(even) {
  background-color: var(--bg-secondary);
}

.section-title {
  font-family: var(--font-pixel);
  font-size: clamp(1rem, 4vw, 1.5rem);
  text-align: center;
  margin-bottom: 60px;
  color: var(--accent-cyan);
  text-shadow: 0 0 10px var(--accent-cyan),
               0 0 20px var(--accent-cyan),
               0 0 40px var(--accent-cyan);
  letter-spacing: 0.1em;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-top: -40px;
  margin-bottom: 40px;
}

/* --------------------------------------------------------------------------
   Pixel Particles Background
   -------------------------------------------------------------------------- */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent-cyan);
  opacity: 0.6;
  animation: float-up linear infinite;
}

@keyframes float-up {
  0% {
    transform: translateY(100vh) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-100px) scale(0.5);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
  max-width: 900px;
}

/* Logo */
.logo {
  margin-bottom: 40px;
  animation: logo-bounce 0.8s ease-out;
}

.logo-img {
  max-width: 400px;
  width: 80vw;
  height: auto;
  margin: 0 auto;
  display: block;
  filter: drop-shadow(0 0 20px var(--accent-cyan)) drop-shadow(0 0 40px var(--accent-magenta));
}

@keyframes logo-bounce {
  0% {
    opacity: 0;
    transform: translateY(-30px);
  }
  60% {
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hero Title with Typewriter */
.hero-title {
  font-family: var(--font-body);
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-weight: 700;
  margin-bottom: 24px;
  min-height: 2em;
}

.typewriter {
  display: inline;
  border-right: 3px solid var(--accent-cyan);
  animation: blink-caret 0.75s step-end infinite;
}

.typewriter.done {
  border-right-color: transparent;
  animation: none;
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent-cyan); }
}

/* Glitch Effect */
.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.glitch::before {
  color: var(--accent-magenta);
  animation: glitch-1 3s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch::after {
  color: var(--accent-cyan);
  animation: glitch-2 2s infinite linear alternate-reverse;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
  0%, 90%, 100% {
    transform: translate(0);
    opacity: 0;
  }
  92% {
    transform: translate(-5px, 2px);
    opacity: 0.8;
  }
  94% {
    transform: translate(5px, -2px);
    opacity: 0.8;
  }
  96% {
    transform: translate(-3px, 1px);
    opacity: 0.8;
  }
  98% {
    transform: translate(3px, -1px);
    opacity: 0.8;
  }
}

@keyframes glitch-2 {
  0%, 90%, 100% {
    transform: translate(0);
    opacity: 0;
  }
  91% {
    transform: translate(3px, -1px);
    opacity: 0.8;
  }
  93% {
    transform: translate(-3px, 1px);
    opacity: 0.8;
  }
  95% {
    transform: translate(5px, -2px);
    opacity: 0.8;
  }
  97% {
    transform: translate(-5px, 2px);
    opacity: 0.8;
  }
}

/* Hero Subtitle */
.hero-subtitle {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 2;
  opacity: 0;
  animation: fade-in 0.8s ease-out forwards;
  animation-delay: 2.5s;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-pixel);
  font-size: clamp(0.6rem, 2vw, 0.8rem);
  padding: 20px 32px;
  border: 4px solid;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background: transparent;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-primary {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3),
              inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.btn-primary:hover {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(0, 255, 255, 0.6);
}

.btn-download {
  color: var(--accent-green);
  border-color: var(--accent-green);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.3),
              inset 0 0 20px rgba(0, 255, 136, 0.1);
  font-size: clamp(0.7rem, 2.5vw, 1rem);
  padding: 24px 48px;
}

.btn-download:hover {
  background: var(--accent-green);
  color: var(--bg-primary);
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(0, 255, 136, 0.6);
}

.btn-icon {
  font-size: 1.2em;
}

.btn-icon-svg {
  width: 24px;
  height: 24px;
}

/* Pulse Animation */
.pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3),
                inset 0 0 20px rgba(0, 255, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.6),
                inset 0 0 30px rgba(0, 255, 255, 0.2);
  }
}

.btn-download.pulse {
  animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3),
                inset 0 0 20px rgba(0, 255, 136, 0.1);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 255, 136, 0.6),
                inset 0 0 30px rgba(0, 255, 136, 0.2);
  }
}

/* --------------------------------------------------------------------------
   Features Section
   -------------------------------------------------------------------------- */
.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

@media (min-width: 768px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.feature-card {
  background: var(--bg-card);
  border: 2px solid var(--border-pixel);
  padding: 30px 20px;
  text-align: center;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(30px);
}

.feature-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.feature-card:hover {
  transform: translateY(-10px);
  border-color: var(--accent-cyan);
  box-shadow: 0 10px 40px rgba(0, 255, 255, 0.2),
              0 0 0 1px var(--accent-cyan);
}

.feature-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  color: var(--accent-cyan);
}

.pixel-icon {
  width: 100%;
  height: 100%;
}

.feature-title {
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  margin-bottom: 16px;
  color: var(--accent-yellow);
}

.feature-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* --------------------------------------------------------------------------
   Gallery Section
   -------------------------------------------------------------------------- */
.gallery-carousel {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

.gallery-item {
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.gallery-item.active {
  display: block;
  opacity: 1;
}

.gallery-nav {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.gallery-nav-btn {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 2px solid var(--accent-cyan);
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
}

.gallery-nav-btn:hover {
  background: rgba(0, 255, 255, 0.3);
  box-shadow: 0 0 10px var(--accent-cyan);
}

.gallery-nav-btn[aria-pressed="true"] {
  background: var(--accent-cyan);
  box-shadow: 0 0 15px var(--accent-cyan);
}

/* Comparison Slider */
.comparison-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  border: 4px solid var(--border-pixel);
  cursor: ew-resize;
  background: var(--bg-card);
}

.comparison-before,
.comparison-after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.comparison-before img,
.comparison-after img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.comparison-after {
  clip-path: inset(0 50% 0 0);
}

.comparison-handle {
  position: absolute;
  top: 0;
  left: 50%;
  width: 4px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
}

.handle-line {
  flex: 1;
  width: 4px;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

.handle-circle {
  width: 48px;
  height: 48px;
  background: var(--bg-primary);
  border: 4px solid var(--accent-cyan);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--accent-cyan);
  pointer-events: auto;
}

.handle-arrows {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--accent-cyan);
}

/* --------------------------------------------------------------------------
   Placeholder Images
   -------------------------------------------------------------------------- */
.placeholder-image {
  width: 100%;
  height: 100%;
  min-height: 200px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
  border: 2px dashed var(--border-pixel);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.placeholder-image::after {
  content: attr(data-label);
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

.placeholder-image.large {
  min-height: 300px;
}

/* --------------------------------------------------------------------------
   Palette Section
   -------------------------------------------------------------------------- */
.palette-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}

@media (min-width: 768px) {
  .palette-content {
    grid-template-columns: 1fr 1fr;
  }
}

.palette-text {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.6s ease;
}

.palette-text.visible {
  opacity: 1;
  transform: translateX(0);
}

.palette-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 2;
  margin-bottom: 30px;
}

.palette-desc strong {
  color: var(--accent-magenta);
}

.palette-samples {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.palette-sample {
  width: 80px;
  height: 24px;
  display: flex;
  border: 2px solid var(--border-pixel);
}

.palette-sample::before {
  content: '';
  flex: 1;
  background: var(--c1);
}

.palette-sample::after {
  content: '';
  flex: 3;
  background: linear-gradient(90deg, var(--c2) 0%, var(--c2) 33%, var(--c3) 33%, var(--c3) 66%, var(--c4) 66%);
}

.palette-image {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.6s ease;
}

.palette-image.visible {
  opacity: 1;
  transform: translateX(0);
}

.palette-image img {
  max-width: 100%;
  height: auto;
  border: 4px solid var(--border-pixel);
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   How To Section
   -------------------------------------------------------------------------- */
.steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

@media (min-width: 768px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.step {
  text-align: center;
  padding: 30px 20px;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.step.visible {
  opacity: 1;
  transform: translateY(0);
}

.step-number {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--accent-magenta);
  margin-bottom: 20px;
  text-shadow: 0 0 10px var(--accent-magenta);
}

.step-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  color: var(--accent-cyan);
  padding: 16px;
  border: 3px solid var(--border-pixel);
  background: var(--bg-card);
}

.step-title {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.step-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* --------------------------------------------------------------------------
   Specs Section
   -------------------------------------------------------------------------- */
.specs-tables {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  max-width: 1000px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .specs-tables {
    grid-template-columns: 1fr 1fr;
  }
}

.specs-table-wrapper {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.specs-table-wrapper.visible {
  opacity: 1;
  transform: translateY(0);
}

.specs-heading {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--accent-magenta);
  margin-bottom: 16px;
  text-shadow: 0 0 10px var(--accent-magenta);
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  border: 3px solid var(--border-pixel);
}

.specs-table th,
.specs-table td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 2px solid var(--border-pixel);
}

.specs-table th {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--accent-cyan);
  background: var(--bg-card);
  width: 45%;
}

.specs-table td {
  color: var(--text-secondary);
  background: var(--bg-secondary);
}

.specs-table tr:last-child th,
.specs-table tr:last-child td {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   Free Assets Section
   -------------------------------------------------------------------------- */
.assets-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .assets-content {
    grid-template-columns: 1fr 1fr;
  }
}

.assets-image {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.6s ease;
}

.assets-image.visible {
  opacity: 1;
  transform: translateX(0);
}

.assets-image img {
  max-width: 100%;
  height: auto;
  border: 4px solid var(--border-pixel);
  border-radius: 4px;
}

.assets-text {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.6s ease;
}

.assets-text.visible {
  opacity: 1;
  transform: translateX(0);
}

.assets-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 2;
  margin-bottom: 30px;
}

.assets-desc strong {
  color: var(--accent-green);
}

.btn-assets {
  color: var(--accent-magenta);
  border-color: var(--accent-magenta);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.3),
              inset 0 0 20px rgba(255, 0, 255, 0.1);
}

.btn-assets:hover {
  background: var(--accent-magenta);
  color: var(--bg-primary);
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(255, 0, 255, 0.6);
}

.btn-assets svg {
  margin-left: 8px;
}

/* --------------------------------------------------------------------------
   Download Section
   -------------------------------------------------------------------------- */
.download {
  text-align: center;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.download-content {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.download-content.visible {
  opacity: 1;
  transform: translateY(0);
}

.download-version {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 20px;
}

.download-note {
  color: var(--text-secondary);
  margin-top: 12px;
  font-size: 0.9rem;
}

.download-warning {
  margin-top: 40px;
  padding: 20px 24px;
  background: rgba(255, 255, 0, 0.05);
  border: 2px solid var(--accent-yellow);
  border-radius: 4px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.warning-title {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--accent-yellow);
  margin-bottom: 12px;
}

.warning-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 8px;
}

.warning-text:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  background: var(--bg-primary);
  padding: 40px 20px;
  text-align: center;
  border-top: 2px solid var(--border-pixel);
}

.footer-content {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--border-pixel);
  transition: all 0.3s ease;
}

.social-link:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.social-icon {
  width: 24px;
  height: 24px;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.social-link:hover .social-icon {
  color: var(--accent-cyan);
}

.copyright {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Scroll Animations
   -------------------------------------------------------------------------- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .particle {
    display: none;
  }

  .typewriter {
    border-right: none;
  }

  .glitch::before,
  .glitch::after {
    display: none;
  }

  .pulse {
    animation: none;
  }

  .hero-subtitle {
    opacity: 1;
    animation: none;
  }

  .logo {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   Focus States (Accessibility)
   -------------------------------------------------------------------------- */
.btn:focus,
.social-link:focus {
  outline: 3px solid var(--accent-yellow);
  outline-offset: 4px;
}

.btn:focus:not(:focus-visible),
.social-link:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   Additional Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  :root {
    --section-padding: 60px 16px;
  }

  .section-title {
    margin-bottom: 40px;
  }

  .btn {
    padding: 16px 24px;
  }

  .btn-download {
    padding: 20px 32px;
  }

  .comparison-slider {
    aspect-ratio: 1/1;
  }

  .handle-circle {
    width: 40px;
    height: 40px;
  }

  .handle-arrows {
    font-size: 0.5rem;
  }
}

@media (min-width: 1440px) {
  :root {
    --container-max: 1400px;
  }
}
