*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --black: #0a0a0a;
  --black-soft: #111111;
  --gray-950: #171717;
  --gray-900: #262626;
  --gray-800: #404040;
  --gray-700: #525252;
  --gray-600: #737373;
  --gray-500: #a3a3a3;
  --gray-400: #d4d4d4;
  --gray-300: #e5e5e5;
  --white: #ffffff;
  --white-soft: #f5f5f5;

  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-display: "Fredoka", system-ui, sans-serif;
  --font-brand: "Syne", system-ui, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--white-soft);
  background: var(--black);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255, 255, 255, 0.06), transparent),
    radial-gradient(ellipse 50% 40% at 80% 100%, rgba(255, 255, 255, 0.03), transparent),
    linear-gradient(180deg, var(--black) 0%, var(--black-soft) 50%, var(--black) 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  color-scheme: dark;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 100;
}

/* Hero */

.hero {
  text-align: center;
  padding: max(3rem, calc(2rem + env(safe-area-inset-top))) 1rem 2.5rem;
  animation: fade-up 0.8s var(--ease-out) both;
  width: 100%;
}

.hero__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.35em 0.4em;
  font-family: var(--font-brand);
  font-size: clamp(1.5rem, 5.5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.hero__mark {
  color: var(--white);
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.25);
}

.hero__name {
  color: var(--gray-500);
}

/* Main layout */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding:
    2rem
    max(1.5rem, env(safe-area-inset-right))
    4rem
    max(1.5rem, env(safe-area-inset-left));
  max-width: 72rem;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
}

/* Featured card */

.featured {
  width: 100%;
  max-width: 32rem;
  min-width: 0;
  animation: fade-up 0.8s 0.15s var(--ease-out) both;
}

.featured__card {
  position: relative;
  padding: clamp(1.75rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2.5rem);
  text-align: center;
  background: linear-gradient(
    145deg,
    rgba(38, 38, 38, 0.6) 0%,
    rgba(17, 17, 17, 0.9) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.25rem;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 48px -12px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.featured__card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
}

.featured__badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray-400);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.375rem 1rem;
  border-radius: 100px;
  margin-bottom: 1.25rem;
}

.featured__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 6vw, 3rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--white);
  margin-bottom: 1rem;
}

.featured__description {
  font-size: clamp(0.875rem, 2.5vw, 0.9375rem);
  color: var(--gray-500);
  line-height: 1.75;
  max-width: 26rem;
  margin: 0 auto 2rem;
  padding: 0 0.25rem;
}

/* Word tiles */

.featured__tiles {
  display: flex;
  justify-content: center;
  gap: clamp(0.2rem, 1.2vw, 0.375rem);
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
}

.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  max-width: 2.5rem;
  aspect-ratio: 1;
  font-size: clamp(0.75rem, 3.2vw, 1.125rem);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--gray-500);
  background: var(--gray-950);
  border: 2px solid var(--gray-800);
  border-radius: 0.375rem;
  transition: transform 0.3s var(--ease-out);
}

.tile--correct {
  background: var(--white);
  border-color: var(--white);
  color: var(--black);
}

.tile--present {
  background: var(--gray-700);
  border-color: var(--gray-700);
  color: var(--white);
}

@media (hover: hover) {
  .featured__card:hover .tile {
    transform: translateY(-2px);
  }

  .featured__card:hover .tile:nth-child(1) { transition-delay: 0ms; }
  .featured__card:hover .tile:nth-child(2) { transition-delay: 40ms; }
  .featured__card:hover .tile:nth-child(3) { transition-delay: 80ms; }
  .featured__card:hover .tile:nth-child(4) { transition-delay: 120ms; }
  .featured__card:hover .tile:nth-child(5) { transition-delay: 160ms; }
  .featured__card:hover .tile:nth-child(6) { transition-delay: 200ms; }
  .featured__card:hover .tile:nth-child(7) { transition-delay: 240ms; }
}

/* About */

.about {
  text-align: center;
  padding: clamp(2.5rem, 8vw, 4rem) 0.5rem 1rem;
  max-width: 28rem;
  width: 100%;
  animation: fade-up 0.8s 0.3s var(--ease-out) both;
}

.about__text {
  font-size: clamp(0.875rem, 2.5vw, 0.9375rem);
  color: var(--gray-600);
  line-height: 1.7;
}

/* Footer */

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding:
    2rem
    max(1.5rem, env(safe-area-inset-right))
    max(2.5rem, calc(1.5rem + env(safe-area-inset-bottom)))
    max(1.5rem, env(safe-area-inset-left));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer__copy {
  font-size: 0.8125rem;
  color: var(--gray-600);
  text-align: center;
  line-height: 1.5;
  max-width: 20rem;
}

/* Animation */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */

@media (max-width: 480px) {
  main {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
  }

  .hero {
    padding-bottom: 2rem;
  }

  .hero__title {
    letter-spacing: 0.04em;
  }
}

@media (max-width: 320px) {
  .hero__title {
    letter-spacing: 0.03em;
    gap: 0.25em 0.35em;
  }

  .featured__badge {
    letter-spacing: 0.12em;
    padding: 0.375rem 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
