/* ===== PixelZero Design System ===== */
:root {
  --bg-deep: #050508;
  --bg-base: #0a0a12;
  --bg-elevated: #12121c;
  --bg-card: #161622;
  --border: #2a2a3e;
  --border-glow: #00f0ff33;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --accent-cyan: #00f0ff;
  --accent-magenta: #ff00aa;
  --accent-purple: #7b61ff;
  --accent-green: #00ff88;
  --gradient-hero: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 50%, var(--accent-magenta) 100%);
  --font-display: 'Press Start 2P', monospace;
  --font-body: 'Inter', system-ui, sans-serif;
  --pixel-size: 4px;
  --header-h: 80px;
  --text-base: 1.125rem;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: min(1120px, 92vw);
  margin-inline: auto;
}

/* ===== Background Layers ===== */
#pixel-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* ===== Pixel Border Utility ===== */
.pixel-border {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--border);
  box-shadow:
    0 0 0 1px var(--bg-deep),
    inset 0 0 20px rgba(0, 240, 255, 0.03);
}

.pixel-border::before,
.pixel-border::after {
  content: '';
  position: absolute;
  width: var(--pixel-size);
  height: var(--pixel-size);
  background: var(--accent-cyan);
  opacity: 0.6;
}

.pixel-border::before { top: -2px; left: -2px; }
.pixel-border::after { bottom: -2px; right: -2px; }

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(5, 5, 8, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.header.scrolled {
  background: rgba(5, 5, 8, 0.95);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-img {
  display: block;
  object-fit: contain;
}

.logo-img--steel {
  height: 46px;
  width: auto;
  max-width: min(280px, 52vw);
}

.logo-img--nav {
  height: 52px;
  width: auto;
  max-width: min(160px, 36vw);
  filter: drop-shadow(0 0 12px rgba(0, 210, 255, 0.25));
  animation: none;
}

.logo-img--contact {
  height: auto;
  width: min(520px, 88vw);
  max-width: 100%;
  opacity: 0.92;
}

.logo-img--color {
  width: min(380px, 80vw);
  height: auto;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 24px rgba(0, 210, 255, 0.35))
          drop-shadow(0 0 48px rgba(123, 97, 255, 0.2));
  animation: logoGlow 5s ease-in-out infinite;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-cyan);
  transition: var(--transition);
}

.nav-links a:hover {
  color: var(--accent-cyan);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: var(--transition);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--gradient-hero);
  color: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 240, 255, 0.3);
}

.pixel-btn {
  clip-path: polygon(
    0 4px, 4px 4px, 4px 0,
    calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px,
    100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px),
    calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px)
  );
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.full-width { width: 100%; }

/* ===== Hero ===== */
.hero {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 3rem;
  padding: calc(var(--header-h) + 4rem) 0 4rem;
}

.hero-inner {
  padding-left: max(4vw, calc((100vw - 1120px) / 2));
}

.hero-badge {
  display: inline-block;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 0.6rem;
  color: var(--accent-cyan);
  letter-spacing: 0.1em;
  margin-bottom: 2rem;
}

.blink {
  animation: blink 1.2s step-end infinite;
}

.hero-title {
  font-size: clamp(3rem, 6.5vw, 5rem);
  font-weight: 700;
  line-height: 1.12;
  margin-bottom: 1.5rem;
}

.hero-line {
  display: block;
}

.hero-accent {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 0.55em;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 0.25em;
}

.hero-desc {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 2rem;
}

.hero-desc strong {
  color: var(--accent-cyan);
  font-weight: 600;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent-cyan);
  margin-bottom: 0.35rem;
}

.stat-label {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: 4vw;
}

.pixel-zero-anim {
  position: relative;
  width: min(400px, 85vw);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(10, 10, 18, 0.6);
  box-shadow:
    0 0 60px rgba(0, 210, 255, 0.08),
    inset 0 0 40px rgba(0, 0, 0, 0.4);
}

#pixel-zero-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.pixel-zero-label {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 0.45rem;
  color: var(--accent-cyan);
  letter-spacing: 0.12em;
  opacity: 0.7;
  pointer-events: none;
  white-space: nowrap;
}

/* ===== Sections ===== */
.section {
  position: relative;
  z-index: 2;
  padding: 6rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-tag {
  display: inline-block;
  padding: 8px 16px;
  font-family: var(--font-display);
  font-size: 0.55rem;
  color: var(--accent-magenta);
  letter-spacing: 0.08em;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.section-desc {
  color: var(--text-secondary);
  font-size: 1.2rem;
}

/* ===== About ===== */
.about {
  background: linear-gradient(180deg, transparent, rgba(18, 18, 28, 0.5) 50%, transparent);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.about-lead {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.about-content p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

.about-content strong {
  color: var(--accent-cyan);
}

.about-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.about-features li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.feature-icon {
  color: var(--accent-magenta);
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.about-features strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
  font-size: 1.05rem;
}

.about-features span {
  font-size: 1rem;
  color: var(--text-secondary);
}

.about-visual {
  position: relative;
}

.code-block {
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.code-filename {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}

.code-body {
  padding: 1.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.7;
  overflow-x: auto;
}

.code-body .kw { color: var(--accent-magenta); }
.code-body .cls { color: var(--accent-cyan); }
.code-body .fn { color: var(--accent-green); }
.code-body .cm { color: var(--text-muted); }

.floating-pixels {
  position: absolute;
  inset: -20px;
  pointer-events: none;
}

.fp {
  position: absolute;
  width: var(--pixel-size);
  height: var(--pixel-size);
  background: var(--accent-cyan);
  opacity: 0.7;
}

.fp-1 { top: 10%; right: -8px; animation: floatPixel 3s ease-in-out infinite; }
.fp-2 { bottom: 20%; left: -12px; animation: floatPixel 4s ease-in-out infinite 0.5s; background: var(--accent-magenta); }
.fp-3 { top: 50%; right: -16px; animation: floatPixel 3.5s ease-in-out infinite 1s; background: var(--accent-purple); }
.fp-4 { bottom: 10%; right: 20%; animation: floatPixel 2.8s ease-in-out infinite 1.5s; }

/* ===== Algorithms ===== */
.algo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.algo-card {
  padding: 2rem;
  transition: var(--transition);
  cursor: default;
}

.algo-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-4px);
  box-shadow:
    0 12px 40px rgba(0, 240, 255, 0.12),
    inset 0 0 30px rgba(0, 240, 255, 0.04);
}

.algo-card:hover .algo-icon {
  color: var(--accent-cyan);
  transform: scale(1.05);
}

.algo-icon {
  width: 48px;
  height: 48px;
  color: var(--accent-purple);
  margin-bottom: 1.25rem;
  transition: var(--transition);
}

.algo-card h3 {
  font-family: var(--font-display);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
  letter-spacing: 0.03em;
}

.algo-card p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.65;
}

.algo-metrics {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.algo-metrics span {
  font-family: var(--font-display);
  font-size: 0.52rem;
  color: var(--accent-green);
  padding: 4px 8px;
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.algo-bar {
  height: 4px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.algo-bar-fill {
  height: 100%;
  width: 0;
  background: var(--gradient-hero);
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.algo-card.visible .algo-bar-fill {
  width: var(--fill);
}

/* ===== Contact ===== */
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.contact-form {
  padding: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.05rem;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-status {
  margin-top: 1rem;
  font-size: 0.9rem;
  text-align: center;
  min-height: 1.4em;
}

.form-status.success { color: var(--accent-green); }
.form-status.error { color: #ff5577; }

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-card {
  padding: 1.25rem 1.5rem;
}

.info-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.info-card p {
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1.6;
}

.info-card a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.2rem;
  transition: var(--transition);
}

.info-card a:hover {
  color: var(--accent-cyan);
}

.social-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-family: var(--font-display);
  font-size: 0.45rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

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

.contact-brand {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}

/* ===== Footer ===== */
.footer {
  position: relative;
  z-index: 2;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  background: rgba(5, 5, 8, 0.9);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-copy {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  font-size: 0.95rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--accent-cyan);
}

/* ===== Animations ===== */
@keyframes logoGlow {
  0%, 100% {
    filter: drop-shadow(0 0 24px rgba(0, 210, 255, 0.35))
            drop-shadow(0 0 48px rgba(123, 97, 255, 0.2));
  }
  50% {
    filter: drop-shadow(0 0 36px rgba(181, 55, 242, 0.4))
            drop-shadow(0 0 64px rgba(0, 210, 255, 0.25));
  }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes pixelPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

@keyframes floatPixel {
  0%, 100% { transform: translate(0, 0); opacity: 0.7; }
  50% { transform: translate(4px, -8px); opacity: 1; }
}

/* ===== Scroll Reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding-top: calc(var(--header-h) + 2rem);
  }

  .hero-inner {
    padding-left: 4vw;
    padding-right: 4vw;
  }

  .hero-desc {
    margin-inline: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-stats {
    justify-content: center;
  }

  .hero-visual {
    padding-right: 0;
    order: -1;
    margin-bottom: 1rem;
  }

  .pixel-zero-anim {
    width: min(320px, 80vw);
  }

  .logo-img--nav {
    height: 44px;
    max-width: min(130px, 32vw);
  }

  .logo-img--steel {
    height: 38px;
    max-width: min(220px, 48vw);
  }

  .logo-img--contact {
    width: min(400px, 92vw);
  }

  .about-grid,
  .algo-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(5, 5, 8, 0.98);
    padding: 2rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border);
    transform: translateY(-120%);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero-stats {
    flex-direction: column;
    gap: 1rem;
  }

  .algo-grid {
    grid-template-columns: 1fr;
  }
}
