@import './fonts.css';

:root {
  --bg: #050508;
  --bg-elevated: #0e0e14;
  --bg-card: #12121a;
  --text: #f2f2f8;
  --text-muted: #8b8b9e;
  --text-dim: #5a5a6e;
  --accent: #8b7cf8;
  --accent-soft: #a89cf9;
  --accent-glow: rgb(139 124 248 / 35%);
  --border: rgb(255 255 255 / 8%);
  --react: #61dafb;
  --vue: #42b883;
  --svelte: #ff3e00;
  --font: var(--font-sans);
  --header-h: 64px;
  --max-w: 1080px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  background: rgb(255 255 255 / 6%);
  color: var(--accent-soft);
}

/* ── Ambient glow ── */
.glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(100px);
}

.glow--top {
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 60vw;
  height: 40vh;
  background: radial-gradient(ellipse, rgb(99 102 241 / 18%) 0%, transparent 70%);
}

.glow--bottom {
  bottom: -10%;
  right: -10%;
  width: 50vw;
  height: 40vh;
  background: radial-gradient(ellipse, rgb(139 92 246 / 12%) 0%, transparent 70%);
}

/* ── Header ── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: rgb(5 5 8 / 72%);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
}

.header__logo {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.header__name {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.header__nav a {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.2s;
}

.header__nav a:hover,
.header__nav a.is-active {
  color: var(--text);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgb(255 255 255 / 3%);
}

.lang-switch__btn {
  padding: 0.3rem 0.65rem;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  background: transparent;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.lang-switch__btn:hover {
  color: var(--text-muted);
}

.lang-switch__btn.is-active {
  color: var(--text);
  background: rgb(139 124 248 / 18%);
}

.header__version {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.header__menu {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.header__menu span {
  display: block;
  width: 18px;
  height: 1.5px;
  margin: 0 auto;
  background: var(--text);
  transition: transform 0.25s var(--ease), opacity 0.25s;
}

.header__menu[aria-expanded='true'] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.header__menu[aria-expanded='true'] span:nth-child(2) {
  opacity: 0;
}

.header__menu[aria-expanded='true'] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ── Hero ── */
.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 3rem;
  min-height: 100vh;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: calc(var(--header-h) + 3rem) clamp(1.5rem, 5vw, 3rem) 5rem;
}

.hero__eyebrow {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.hero__title {
  margin: 0 0 1.25rem;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero__title-accent {
  background: linear-gradient(135deg, var(--accent-soft) 0%, #6366f1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero__desc {
  margin: 0 0 2rem;
  max-width: 28rem;
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.75;
}

.hero__desc strong {
  color: var(--text);
  font-weight: 500;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  box-shadow: 0 4px 24px var(--accent-glow);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-glow);
}

.btn--ghost {
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: rgb(255 255 255 / 3%);
}

.btn--ghost:hover {
  color: var(--text);
  border-color: rgb(255 255 255 / 16%);
  background: rgb(255 255 255 / 6%);
}

.hero__visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero__sprite-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#hero-sprite {
  position: relative;
  z-index: 1;
  image-rendering: pixelated;
  border-radius: 16px;
}

.hero__sprite-glow {
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 65%);
  pointer-events: none;
}

.hero__sprite-label {
  margin: 1.25rem 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-decoration: none;
  animation: bob 2.5s ease-in-out infinite;
}

.hero__scroll svg {
  width: 20px;
  height: 20px;
}

@keyframes bob {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(6px);
  }
}

/* ── Features ── */
.features {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 6rem clamp(1.5rem, 5vw, 3rem);
}

.feature {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 1.5rem 2rem;
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--border);
}

.feature:first-child {
  border-top: 1px solid var(--border);
}

.feature__num {
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: rgb(255 255 255 / 6%);
  user-select: none;
}

.feature__body h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.feature__body p {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.8;
  max-width: 52rem;
}

.feature__body strong {
  color: var(--text);
  font-weight: 500;
}

.feature__tag {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-soft);
  border: 1px solid rgb(139 124 248 / 25%);
  background: rgb(139 124 248 / 8%);
}

/* ── Size compare (GIF vs WebP) ── */
.size-compare {
  margin: 0 0 1.5rem;
  padding: 1.5rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgb(255 255 255 / 2%);
}

.size-compare__title {
  margin: 0 0 1.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.size-compare__previews {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.size-compare__preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.size-compare__frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  border-radius: 12px;
  background: #000;
  overflow: hidden;
}

.size-compare__frame img,
.size-compare__frame canvas {
  display: block;
  image-rendering: pixelated;
}

.size-compare__format {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.size-compare__bytes {
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.size-compare__preview--gif .size-compare__bytes {
  color: #f87171;
}

.size-compare__preview--webp .size-compare__bytes {
  color: #4ade80;
}

.size-compare__arrow {
  flex-shrink: 0;
  font-size: 1.25rem;
  color: var(--text-dim);
}

.size-compare__bars {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.size-compare__bar-row {
  display: grid;
  grid-template-columns: 3.5rem 1fr 3.5rem;
  align-items: center;
  gap: 0.75rem;
}

.size-compare__bar-label,
.size-compare__bar-value {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.size-compare__bar-value {
  text-align: right;
  color: var(--text-muted);
}

.size-compare__bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgb(255 255 255 / 6%);
  overflow: hidden;
}

.size-compare__bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 1s var(--ease);
}

.size-compare__bar-fill--gif {
  width: 100%;
  background: linear-gradient(90deg, #f87171 0%, #ef4444 100%);
}

.size-compare__bar-fill--webp {
  width: 41%;
  background: linear-gradient(90deg, #4ade80 0%, #22c55e 100%);
}

.size-compare__savings {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--accent-soft);
  line-height: 1.6;
}

.size-compare__savings strong {
  color: #4ade80;
  font-weight: 600;
}

/* ── Demos ── */
.demos {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 6rem clamp(1.5rem, 5vw, 3rem) 8rem;
}

.demos__header {
  text-align: center;
  margin-bottom: 3rem;
}

.demos__eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--accent-soft);
}

.demos__header h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.demos__header p {
  margin: 0 auto;
  max-width: 36rem;
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.75;
}

.demos__grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, 1fr);
}

.demo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 2rem 1.5rem;
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}

.demo-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0.8;
}

.demo-card--react::before {
  background: var(--react);
}

.demo-card--vue::before {
  background: var(--vue);
}

.demo-card--svelte::before {
  background: var(--svelte);
}

.demo-card:hover {
  transform: translateY(-4px);
  border-color: rgb(255 255 255 / 14%);
  box-shadow: 0 16px 48px rgb(0 0 0 / 40%);
}

.demo-card__icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.demo-card--react .demo-card__icon {
  color: var(--react);
}

.demo-card--vue .demo-card__icon {
  color: var(--vue);
}

.demo-card--svelte .demo-card__icon {
  color: var(--svelte);
}

.demo-card__label {
  font-size: 1.35rem;
  font-weight: 600;
}

.demo-card__pkg {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.demo-card__arrow {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 1.1rem;
  color: var(--text-dim);
  transition: transform 0.25s var(--ease), color 0.25s;
}

.demo-card:hover .demo-card__arrow {
  transform: translateX(4px);
  color: var(--text);
}

.demos__install {
  margin-top: 2.5rem;
  text-align: center;
}

.demos__install code {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  font-size: 0.95rem;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ── Brand site (Mason Effect) ── */
.brand-site {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 6rem clamp(1.5rem, 5vw, 3rem) 4rem;
  text-align: center;
}

.brand-site__eyebrow {
  margin: 0 0 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--accent-soft);
}

.brand-site__title {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: rgb(255 255 255 / 80%);
}

.brand-site__desc {
  margin: 0 auto 2.5rem;
  max-width: 32rem;
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.75;
}

.brand-site__card {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: min(100%, 20rem);
  padding: 2rem 2.5rem;
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}

.brand-site__card:hover {
  transform: translateY(-4px);
  border-color: rgb(255 255 255 / 14%);
  box-shadow: 0 16px 48px rgb(0 0 0 / 40%);
}

.brand-site__card-name {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.brand-site__card-url {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent-soft);
}

.brand-site__card-arrow {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  font-size: 1.1rem;
  color: var(--text-dim);
  transition: transform 0.25s var(--ease), color 0.25s;
}

.brand-site__card:hover .brand-site__card-arrow {
  transform: translateX(4px);
  color: var(--accent-soft);
}

/* ── Contact Us ── */
.contact {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem clamp(1.5rem, 5vw, 3rem) 6rem;
  text-align: center;
}

.contact__title {
  margin: 0 0 3rem;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: rgb(255 255 255 / 80%);
}

.contact__grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3rem;
}

.contact__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  min-width: 12rem;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.25s var(--ease);
}

.contact__card:hover {
  transform: translateY(-4px);
}

.contact__icon {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.contact__card:hover .contact__icon {
  color: var(--accent-soft);
}

.contact__label {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.contact__url {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  transition: color 0.2s;
}

.contact__card:hover .contact__url {
  color: var(--text-muted);
}

/* ── Footer ── */
.footer {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 2rem clamp(1.5rem, 5vw, 3rem);
  text-align: center;
  border-top: 1px solid rgb(255 255 255 / 3%);
}

.footer__copy {
  margin: 0;
  font-size: 0.85rem;
  color: rgb(255 255 255 / 20%);
}

/* ── FAB ── */
.fab {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-decoration: none;
  color: var(--accent-soft);
  background: rgb(14 14 20 / 88%);
  border: 1px solid rgb(139 124 248 / 30%);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgb(0 0 0 / 50%);
  transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
}

.fab svg {
  width: 16px;
  height: 16px;
}

.fab:hover {
  transform: translateY(-2px);
  border-color: rgb(139 124 248 / 50%);
  box-shadow: 0 12px 40px rgb(139 124 248 / 15%);
}

/* ── Scroll reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}

.reveal.is-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__desc {
    margin-left: auto;
    margin-right: auto;
  }

  .hero__actions {
    justify-content: center;
  }

  .hero__visual {
    order: -1;
  }

  .hero__scroll {
    display: none;
  }

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

  .feature {
    grid-template-columns: 3rem 1fr;
    gap: 1rem;
  }

  .feature__num {
    font-size: 2.5rem;
  }

  .size-compare__previews {
    flex-direction: column;
    gap: 1rem;
  }

  .size-compare__arrow {
    transform: rotate(90deg);
  }

  .contact__grid {
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .header__version {
    display: none;
  }

  .header__nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 1rem 0;
    background: rgb(5 5 8 / 96%);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    transform: translateY(-110%);
    opacity: 0;
    pointer-events: none;
    transition:
      transform 0.3s var(--ease),
      opacity 0.3s;
  }

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

  .header__nav a {
    padding: 0.85rem 2rem;
    width: 100%;
  }

  .header__menu {
    display: flex;
  }
}
