/* Base layout */
:root {
  --bg: #000000;
  --fg: #ffffff;
  --accent: #00e5ff;
  --accent-2: #8a2be2;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

#app {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: clamp(12px, 4vmin, 28px);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  flex: 1 0 auto;
  width: 100%;
}

.scene {
  width: min(90vmin, 720px);
  height: min(90vmin, 720px);
  display: grid;
  place-items: center;
  perspective: 1200px;
}

.track {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
}

.no-motion .track {
  animation: none !important;
}

.fallback {
  color: var(--fg);
  font-size: 8vw;
  letter-spacing: 0.08em;
  text-align: center;
}

/* Individual text rings */
.ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-style: preserve-3d;
  will-change: transform;
}

.glyph {
  position: absolute;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
  color: var(--fg);
  font-weight: 800;
  text-shadow:
    0 0 12px rgba(0, 229, 255, 0.35),
    0 0 24px rgba(138, 43, 226, 0.25);
  /* Responsive type sizing via clamp */
  font-size: clamp(14px, 4.2vmin, 36px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: pre;
  user-select: none;
}

/* Subtle glow plane under the loop */
.glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 65%;
  height: 65%;
  transform: translate(-50%, -50%) rotateX(90deg) translateZ(-120px);
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 229, 255, 0.35) 0%, rgba(0,0,0,0) 70%);
  filter: blur(12px) saturate(140%);
  opacity: 0.5;
}

@media (max-width: 640px) {
  .glow { width: 90%; height: 90%; transform: translate(-50%, -50%) rotateX(90deg) translateZ(-90px); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  body { overflow: auto; }
  .glyph { text-shadow: none; }
}

/* Tagline */
.tagline {
  margin: 0;
  color: #bdbdbd;
  font-size: clamp(12px, 2.8vmin, 18px);
  letter-spacing: 0.02em;
}

/* On-page SEO/content block */
.onpage {
  max-width: min(95vw, 880px);
  color: #cfcfcf;
  font-size: clamp(12px, 2.4vmin, 16px);
  line-height: 1.75;
  text-align: left;
  align-self: stretch;
  padding: 0 16px;
  margin-left: auto;
  margin-right: auto;
}

.onpage p {
  margin: 0.8em 0;
  text-align: justify;
  text-justify: inter-word;
  text-indent: 1.5em;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Collapsible on-page */
.onpage-content { position: relative; display: block; }
.onpage.collapsed .onpage-content {
  max-height: 14rem;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 70%, rgba(0,0,0,0));
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 70%, rgba(0,0,0,0));
}

.onpage-toggle {
  margin: 10px auto 0 auto;
  display: inline-block;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid #2a2a2a;
  background: #0f0f0f;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 14px;
}
.onpage-toggle:hover {
  background: #151515;
}

/* Footer */
.site-footer {
  width: 100%;
  padding: 18px 16px 28px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
}

.copyright {
  margin: 0;
  color: #7d7d7d;
  font-size: 12px;
}

.footer-links { display: flex; gap: 16px; }
.footer-link { color: #9ad1ff; text-decoration: none; font-size: 14px; }
.footer-link:hover { text-decoration: underline; }

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal[aria-hidden="false"] { display: flex; }
.modal-body {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 960px;
  max-height: 100vh;
  padding: 24px 18px 28px 18px;
  color: var(--fg);
  overflow: auto;
}
.modal-close {
  position: fixed;
  top: 10px;
  right: 10px;
  background: transparent;
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
}
.onpage strong { color: var(--fg); }


/* ===================== */
/* Sequential pulse line */
/* ===================== */
.line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.01em, 0.5vmin, 0.12em);
  transform-style: preserve-3d;
  flex-wrap: wrap;
  row-gap: clamp(4px, 2vmin, 10px);
}

.word {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.01em, 0.5vmin, 0.12em);
  white-space: nowrap;
}

.char {
  display: inline-block;
  color: var(--fg);
  font-weight: 900;
  font-size: clamp(24px, 10vmin, 96px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  will-change: transform, filter;
  transform-origin: 50% 55%;
  text-shadow:
    0 0 10px rgba(0, 229, 255, 0.25),
    0 0 22px rgba(138, 43, 226, 0.2);
}

.char.space { width: 0.4em; }

.char.active { animation: pulse 1s ease-in-out; }
.char.neighbor { animation: pulse-neighbor 1s ease-in-out; }

@keyframes pulse {
  0%, 100% {
    transform: translateZ(0) scale3d(1, 1, 1);
    filter: drop-shadow(0 0 0 rgba(0, 229, 255, 0));
  }
  40% {
    transform: translateZ(0) translateY(-2px) scale3d(1.26, 1.26, 1.26);
    filter: drop-shadow(0 0 26px rgba(0, 229, 255, 0.4));
  }
}

@keyframes pulse-neighbor {
  0%, 100% { transform: translateZ(0) scale3d(1, 1, 1); opacity: 0.9; }
  40% { transform: translateZ(0) scale3d(1.08, 1.08, 1.08); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .char.active { animation: pulse-soft 1s ease-in-out; }
}

@keyframes pulse-soft {
  0%, 100% { transform: translateZ(0) scale3d(1, 1, 1); }
  40% { transform: translateZ(0) scale3d(1.08, 1.08, 1.08); }
}

@media (max-width: 640px) {
  #app { gap: clamp(8px, 3vmin, 16px); }
  .scene { width: min(72vmin, 520px); height: min(72vmin, 520px); }
  .glow { width: 88%; height: 88%; transform: translate(-50%, -50%) rotateX(90deg) translateZ(-80px); }
  .word { flex-basis: 100%; }
  .onpage-toggle {
    position: sticky;
    bottom: 12px;
    z-index: 5;
    width: calc(100% - 32px);
    max-width: 420px;
    text-align: center;
    background: #141414;
    border-color: #3a3a3a;
  }
}


