@layer reset, tokens, base, layout, components, motion;

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

  html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 1rem);
  }

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

  body,
  h1,
  h2,
  p,
  dl,
  dt,
  dd,
  figure {
    margin: 0;
  }

  button,
  a {
    font: inherit;
    -webkit-tap-highlight-color: transparent;
  }

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

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

  ul {
    padding: 0;
    list-style: none;
    margin: 0;
  }
}

@layer tokens {
  :root {
    --canvas: #070b16;
    --canvas-2: #0b1222;
    --ink: #e8eef8;
    --muted: #9aa8c4;
    --accent: #7cff4a;
    --accent-ink: #07140a;
    --ring: #3ec8ff;
    --hairline: rgb(232 238 248 / 0.12);
    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --font: "Outfit", system-ui, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
    --max: 1180px;
    --gutter: clamp(1.25rem, 4vw, 2.5rem);
    --shell: calc(var(--max) - var(--gutter) * 2);
    --section: clamp(4rem, 8vw, 6.5rem);
    --nav-h: 4.5rem;
  }

  @font-face {
    font-family: "Outfit";
    src: url("/fonts/outfit-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
  }

  @font-face {
    font-family: "Outfit";
    src: url("/fonts/outfit-700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
  }

  @font-face {
    font-family: "Outfit";
    src: url("/fonts/outfit-800.woff2") format("woff2");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
  }

  @font-face {
    font-family: "IBM Plex Mono";
    src: url("/fonts/plex-mono-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
  }

  @font-face {
    font-family: "IBM Plex Mono";
    src: url("/fonts/plex-mono-500.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
  }
}

@layer base {
  html {
    background: var(--canvas);
    color: var(--ink);
  }

  body {
    font-family: var(--font);
    font-weight: 400;
    line-height: 1.5;
    min-height: 100dvh;
    background: var(--canvas);
    overflow-x: hidden;
  }

  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }

  ::selection {
    background: var(--accent);
    color: var(--accent-ink);
  }
}

@layer layout {
  .skip {
    position: absolute;
    left: 1rem;
    top: 0;
    transform: translateY(-120%);
    background: var(--accent);
    color: var(--accent-ink);
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    z-index: 40;
    font-weight: 700;
  }

  .skip:focus {
    transform: translateY(1rem);
  }

  .grain,
  .grid-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
  }

  .grid-bg {
    z-index: 0;
    background-image:
      linear-gradient(rgb(62 200 255 / 0.045) 1px, transparent 1px),
      linear-gradient(90deg, rgb(62 200 255 / 0.045) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(ellipse 85% 75% at 70% 34%, black 0%, transparent 74%);
    animation: grid-shift 48s linear infinite;
  }

  .grain {
    z-index: 30;
    opacity: 0.045;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  }

  .nav-wrap {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    padding: 1rem var(--gutter) 0;
    pointer-events: none;
  }

  .nav {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    width: 100%;
    max-width: var(--shell);
    padding: 0.35rem 0.35rem 0.35rem 1.15rem;
    border-radius: 999px;
    border: 1px solid rgb(232 238 248 / 0.1);
    background:
      linear-gradient(135deg, rgb(232 238 248 / 0.07), rgb(232 238 248 / 0.02)),
      rgb(7 11 22 / 0.62);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.1),
      0 14px 36px rgb(0 0 0 / 0.24);
  }

  @media (prefers-reduced-transparency: reduce) {
    .nav {
      background: #12182a;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }
  }

  .mark {
    font-weight: 800;
    letter-spacing: -0.04em;
    font-size: 1.1rem;
    white-space: nowrap;
  }

  .mark b {
    color: var(--accent);
    font-weight: 800;
  }

  main {
    position: relative;
    z-index: 1;
  }

  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 2.5rem 4.5rem;
    align-items: center;
    max-width: var(--max);
    margin-inline: auto;
    padding: calc(var(--nav-h) + 2.5rem) var(--gutter) var(--section);
  }

  .hero-copy {
    max-width: 36rem;
  }

  h1 {
    font-size: clamp(3.1rem, 7.4vw, 6rem);
    font-weight: 800;
    letter-spacing: -0.055em;
    line-height: 0.95;
    text-wrap: balance;
  }

  h1 em {
    font-style: italic;
    color: var(--accent);
    font-weight: 800;
    display: inline-block;
  }

  .lede {
    margin-top: 1.1rem;
    font-size: 1.12rem;
    color: var(--muted);
    max-width: 22ch;
    line-height: 1.5;
    text-wrap: pretty;
  }

  .hero-copy .btn {
    margin-top: 2rem;
  }

  .hero-art {
    position: relative;
    justify-self: end;
    width: 100%;
    max-width: 27rem;
  }

  .motes {
    position: absolute;
    inset: 18% 22% 28%;
    pointer-events: none;
    z-index: 2;
  }

  .motes i {
    position: absolute;
    left: var(--x);
    bottom: 8%;
    width: 5px;
    height: 5px;
    background: var(--accent);
    box-shadow: 0 0 8px rgb(124 255 74 / 0.8);
    animation: mote-up var(--t) var(--ease) var(--d) infinite;
    opacity: 0;
  }

  .hero-art::after {
    content: "";
    position: absolute;
    inset: 18%;
    background: radial-gradient(circle, rgb(124 255 74 / 0.38), transparent 68%);
    z-index: -1;
    pointer-events: none;
    animation: glow-breathe 4.8s var(--ease) infinite alternate;
  }

  .strip {
    max-width: var(--max);
    margin-inline: auto;
    padding: var(--section) var(--gutter);
    scroll-margin-top: calc(var(--nav-h) + 1rem);
  }

  .strip > p {
    font-size: clamp(1.7rem, 3vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.15;
    max-width: 24ch;
    text-wrap: balance;
  }

  .facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.25rem 2.5rem;
    margin-top: 2.75rem;
    padding-top: 2.25rem;
    border-top: 1px solid var(--hairline);
  }

  .facts > div {
    opacity: 0;
    transform: translateY(14px);
  }

  .strip.is-in .facts > div {
    opacity: 1;
    transform: none;
    transition:
      opacity 0.7s var(--ease),
      transform 0.7s var(--ease);
  }

  .strip.is-in .facts > div:nth-child(2) {
    transition-delay: 90ms;
  }

  .strip.is-in .facts > div:nth-child(3) {
    transition-delay: 180ms;
  }

  .facts dt {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.55rem;
  }

  .facts dd {
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.5;
    text-wrap: pretty;
  }

  .site-foot {
    position: relative;
    max-width: var(--max);
    margin-inline: auto;
    padding: 1.75rem var(--gutter) 2.25rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.78rem;
  }

  .site-foot::before {
    content: "";
    position: absolute;
    top: 0;
    left: var(--gutter);
    right: var(--gutter);
    height: 1px;
    background: var(--hairline);
  }

  .error-page main {
    min-height: 100dvh;
    display: grid;
    align-content: center;
    justify-content: start;
    justify-items: start;
    padding: calc(var(--nav-h) + 3rem) var(--gutter) var(--section);
    max-width: var(--max);
    margin-inline: auto;
  }

  .error-code {
    font-family: var(--mono);
    color: var(--accent);
    font-size: 0.72rem;
    letter-spacing: 0.09em;
    margin-bottom: 0.9rem;
  }

  .error-page h1 {
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    max-width: 18ch;
  }

  .error-page .lede {
    margin-top: 1.1rem;
  }

  .error-page .btn-lg {
    margin-top: 2rem;
  }

  @media (max-width: 767px) {
    .nav {
      gap: 0.75rem;
      padding-left: 1rem;
    }

    .hero {
      grid-template-columns: 1fr;
      padding-top: calc(var(--nav-h) + 1rem);
      gap: 2rem;
    }

    .hero-art {
      justify-self: stretch;
      max-width: none;
      order: 2;
    }

    .hero-copy {
      order: 1;
    }

    .facts {
      grid-template-columns: 1fr;
      gap: 1.75rem;
    }

    h1 {
      font-size: clamp(2.6rem, 12vw, 3.6rem);
    }
  }
}

@layer components {
  .bezel {
    padding: 0.4rem;
    border-radius: 999px;
    background: rgb(232 238 248 / 0.04);
    border: 1px solid rgb(62 200 255 / 0.35);
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.14),
      0 0 0 1px rgb(7 11 22 / 0.6);
  }

  .bezel-core {
    position: relative;
    border-radius: 999px;
    overflow: hidden;
    background: #050814;
    box-shadow: inset 0 1px 1px rgb(255 255 255 / 0.12);
  }

  .bezel-core::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
      115deg,
      transparent 38%,
      rgb(124 255 74 / 0.28) 50%,
      transparent 62%
    );
    transform: translateX(-130%);
    animation: glint 6.5s var(--ease) 1.4s infinite;
    pointer-events: none;
  }

  .bezel-core img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.3rem 0.3rem 0.3rem 1.2rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    transition: transform 0.55s var(--ease), background 0.55s var(--ease);
  }

  .btn:hover {
    background: #b6ff7a;
    transform: scale(1.02);
  }

  .btn:active {
    transform: scale(0.98);
  }

  .btn-ico {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 999px;
    background: rgb(7 20 10 / 0.16);
    display: grid;
    place-items: center;
    transition: transform 0.55s var(--ease);
  }

  .btn-ico svg {
    width: 0.95rem;
    height: 0.95rem;
  }

  .btn:hover .btn-ico {
    transform: translate(2px, -1px) scale(1.06);
  }

  .btn-lg {
    font-size: 1.04rem;
    padding: 0.4rem 0.4rem 0.4rem 1.4rem;
  }

  .btn-lg .btn-ico {
    width: 2.45rem;
    height: 2.45rem;
  }
}

@layer motion {
  [data-reveal] {
    opacity: 0;
    transform: translateY(1.4rem);
    filter: blur(8px);
    transition:
      opacity 0.85s var(--ease),
      transform 0.85s var(--ease),
      filter 0.85s var(--ease);
  }

  [data-reveal].is-in {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .hero-copy h1,
  .hero-copy .lede,
  .hero-copy .btn {
    animation: rise 0.9s var(--ease) both;
  }

  .hero-copy .lede {
    animation-delay: 120ms;
  }

  .hero-copy .btn {
    animation-delay: 220ms;
  }

  .hero-art {
    animation: rise 1s var(--ease) 160ms both;
  }

  h1 em {
    animation: glitch-tick 5.2s var(--ease) 1.1s infinite;
  }

  .crew-float {
    animation: crew-float 5.5s var(--ease) infinite alternate;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(1.4rem);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes crew-float {
    from {
      transform: translateY(0);
    }
    to {
      transform: translateY(-10px);
    }
  }

  @keyframes glint {
    0%,
    72% {
      transform: translateX(-130%);
    }
    88%,
    100% {
      transform: translateX(130%);
    }
  }

  @keyframes mote-up {
    0% {
      opacity: 0;
      transform: translateY(12px) scale(1);
    }
    12% {
      opacity: 0.95;
    }
    100% {
      opacity: 0;
      transform: translateY(-210px) scale(0.35);
    }
  }

  @keyframes glow-breathe {
    from {
      opacity: 0.5;
      transform: scale(1.08);
    }
    to {
      opacity: 1;
      transform: scale(1.24);
    }
  }

  @keyframes grid-shift {
    to {
      background-position: 28px 28px;
    }
  }

  @keyframes glitch-tick {
    0%,
    86%,
    100% {
      transform: none;
    }
    88% {
      transform: translate(3px, -1px);
    }
    90% {
      transform: translate(-2px, 1px);
    }
    92% {
      transform: translate(1px, 0);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    [data-reveal],
    .hero-copy h1,
    .hero-copy .lede,
    .hero-copy .btn,
    .hero-art,
    .facts > div {
      opacity: 1;
      transform: none;
      filter: none;
      animation: none;
      transition: none;
    }

    .grid-bg,
    .crew-float,
    .bezel-core::after,
    .hero-art::after,
    .motes i,
    h1 em,
    .btn,
    .btn-ico {
      animation: none;
      transition: none;
    }

    .motes {
      display: none;
    }
  }
}
