/* CodeConvergence | Tokens → base → components → responsive rules */
:root {
  --color-background: #f6f5f1;
  --color-text: #252a2b;
  --font-identity: system-ui, sans-serif;
  --space-identity: 1.25rem;
  --particle-color-1: #727d7b;
  --particle-color-2: #87928a;
  --particle-color-3: #aaa18e;
}

* { box-sizing: border-box; }

body {
  isolation: isolate;
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-identity);
}

.particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.identity {
  position: relative;
  text-align: center;
  max-width: 60rem;
}

.identity__title {
  margin: 0;
  font-size: clamp(1.4rem, 4.5vw, 3rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-wrap: balance;
}

.identity__logo-frame {
  position: relative;
  width: clamp(8rem, 17vw, 12rem);
  aspect-ratio: 184.187 / 121.578;
  margin: 0 auto clamp(2rem, 5vh, 3rem);
}

.identity__logo {
  display: block;
  width: 100%;
  height: auto;
}

/* The colour is clipped to the exported mark, never its transparent background. */
.identity__logo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(to bottom,
    transparent 0 5px,
    rgb(105 158 170 / 45%) 5px 6px,
    transparent 6px 11px,
    rgb(171 129 153 / 35%) 11px 12px);
  -webkit-mask: url('../objects/aoc-logo.svg') center / contain no-repeat;
  mask: url('../objects/aoc-logo.svg') center / contain no-repeat;
}

/* Compare logo-crt with logo-settle below; each runs only once per load. */
@media (prefers-reduced-motion: no-preference) {
  .identity__logo-frame {
    animation: logo-crt 1900ms linear both;
  }
  .identity__logo-frame::after {
    animation: logo-scan-color 1900ms linear both;
  }
}

html[data-motion-paused="true"] .identity__logo-frame,
html[data-motion-paused="true"] .identity__logo-frame::after {
  animation-play-state: paused;
}

@keyframes logo-scan-color {
  0%, 65% { opacity: 0.65; }
  78% { opacity: 0.35; }
  100% { opacity: 0; }
}

@keyframes logo-crt {
  0% {
    opacity: 0.25;
    transform: translateX(-3px) scaleY(0.97) skewX(-2deg);
    filter: blur(0.8px) drop-shadow(2px 0 #699eaa) drop-shadow(-2px 0 #ab8199);
    mask-image: repeating-linear-gradient(to bottom, #000 0 2px, #0007 2px 3px);
  }
  14%, 30% {
    opacity: 0.9;
    transform: none;
    filter: drop-shadow(1px 0 #699eaa) drop-shadow(-1px 0 #ab8199);
  }
  32%, 37% {
    opacity: 0.38;
    transform: translateX(4px) skewX(3deg);
    filter: blur(0.6px) drop-shadow(-3px 0 #699eaa);
  }
  40%, 65% {
    opacity: 0.95;
    transform: none;
    filter: blur(0.2px);
  }
  67%, 72% {
    opacity: 0.5;
    transform: translateX(-2px) scaleY(1.015);
    filter: drop-shadow(2px 0 #ab8199);
  }
  78% {
    opacity: 1;
    transform: none;
    filter: none;
    mask-image: repeating-linear-gradient(to bottom, #000 0 2px, #0007 2px 3px);
  }
  100% {
    opacity: 1;
    transform: none;
    filter: none;
    mask-image: none;
  }
}

@keyframes logo-settle {
  0% {
    opacity: 0.55;
    filter: blur(1px);
    transform: translateX(-1px);
  }
  22% {
    opacity: 0.72;
    filter: blur(0.5px);
    transform: translateX(1px);
  }
  38% {
    opacity: 0.82;
    filter: blur(0.35px);
    transform: translateX(-0.5px);
  }
  56%, 100% {
    opacity: 1;
    filter: none;
    transform: none;
  }
}

.identity__tagline {
  margin: var(--space-identity) 0 0;
  font-size: clamp(0.65rem, 2vw, 0.875rem);
  letter-spacing: 0.16em;
  line-height: 1.8;
}

.identity__tagline span { margin-inline: 0.35em; }

.motion-toggle {
  position: fixed;
  z-index: 2;
  right: 0;
  bottom: 0;
  width: calc(4.5rem + env(safe-area-inset-right));
  height: calc(4.5rem + env(safe-area-inset-bottom));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-background);
  cursor: pointer;
}

.motion-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-text);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.motion-toggle__icon {
  position: absolute;
  right: calc(0.65rem + env(safe-area-inset-right));
  bottom: calc(0.65rem + env(safe-area-inset-bottom));
  width: 1.25rem;
  height: 1.25rem;
}

.motion-toggle[data-paused="true"]::before { background: #626967; }
.motion-toggle:hover::before { opacity: 0.85; }

.motion-toggle:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: -3px;
}
