/* ============================================
   THE REBORN SIGNAL — COMPONENTS
   Nav / Footer / Fracture / Waveform / Cards
   ============================================ */

/* ── NAVIGATION ── */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: var(--z-nav);
  padding: 1.2rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.4s ease, backdrop-filter 0.4s ease;
  background: transparent;
}

.site-nav.scrolled {
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
}

.nav-logo {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--canon-amber);
  transition: color 0.4s ease;
}

.page-cipher .nav-logo {
  color: var(--cipher-cyan);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-links a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5rem 1.2rem;
  position: relative;
  color: #999;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: #fff;
}

.nav-links a.active {
  color: #fff;
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1.2rem;
  right: 1.2rem;
  height: 1px;
  background: currentColor;
}

.nav-links .nav-canon {
  color: var(--canon-amber);
}

.nav-links .nav-canon:hover {
  color: var(--canon-warm-white);
}

.nav-links .nav-cipher {
  color: var(--cipher-cyan);
}

.nav-links .nav-cipher:hover {
  color: var(--cipher-cold-white);
}

.nav-fracture {
  width: 1px;
  height: 24px;
  background: var(--fracture-color);
  box-shadow: var(--fracture-glow);
  animation: fracture-pulse 4s ease-in-out infinite;
  margin: 0 0.3rem;
}

/* Mobile hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  z-index: calc(var(--z-nav) + 2);
  padding: 8px;
}

.nav-hamburger span {
  display: block;
  width: 24px;
  height: 1px;
  background: #fff;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-hamburger.open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
  opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile menu */
.nav-mobile {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.98);
  z-index: calc(var(--z-nav) + 1);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  clip-path: polygon(0 0, 0 0, 0 50%, 0 100%, 0 100%);
}

.nav-mobile.open {
  display: flex;
  animation: menu-tear 0.5s ease forwards;
}

.nav-mobile.closing {
  display: flex;
  animation: menu-tear-close 0.4s ease forwards;
}

.nav-mobile a {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #999;
  transition: color 0.3s ease;
}

.nav-mobile a:hover {
  color: #fff;
}

.nav-mobile .nav-canon {
  color: var(--canon-amber);
}

.nav-mobile .nav-cipher {
  color: var(--cipher-cyan);
}

.nav-mobile .mobile-fracture {
  width: 60px;
  height: 1px;
  background: var(--fracture-color);
  box-shadow: var(--fracture-glow);
  animation: fracture-pulse 4s ease-in-out infinite;
}

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

  .nav-hamburger {
    display: flex;
  }
}

/* ── FRACTURE LINE ── */

.fracture-line {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--fracture-width);
  height: 100%;
  background: var(--fracture-color);
  box-shadow: var(--fracture-glow);
  z-index: var(--z-fracture);
  animation: fracture-pulse 4s ease-in-out infinite;
  transform: translateX(calc(-50% + var(--fracture-offset)));
  pointer-events: none;
}

.fracture-line::before,
.fracture-line::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  background: inherit;
  box-shadow: inherit;
}

.fracture-line::before {
  top: 15%;
  height: 8px;
  transform: translateX(-50%) skewY(25deg);
}

.fracture-line::after {
  top: 55%;
  height: 12px;
  transform: translateX(-50%) skewY(-18deg);
}

.fracture-line.fracture-subtle {
  opacity: 0.4;
  left: 15%;
}

.fracture-line.fracture-aggressive {
  animation: fracture-pulse 2s ease-in-out infinite, fracture-tremble 0.3s ease-in-out infinite;
}

/* Hover-triggered tremble */
.split-block:hover ~ .fracture-line,
.split-layout:hover > .fracture-line {
  animation: fracture-pulse 4s ease-in-out infinite, fracture-tremble 0.2s ease-in-out 3;
}

/* ── WAVEFORM ── */

.waveform-container {
  width: 100%;
  overflow: hidden;
  position: relative;
  height: 100px;
}

.waveform-container svg {
  width: 100%;
  height: 100%;
}

.waveform-path {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.waveform-path.wave-canon {
  stroke: var(--canon-amber);
}

.waveform-path.wave-cipher {
  stroke: var(--cipher-cyan);
}

/* ── HERO ── */

.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-color: #111;
}

.hero-overlay-canon {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(135deg, rgba(200, 135, 58, 0.35) 0%, rgba(139, 58, 30, 0.2) 100%);
  clip-path: polygon(0 0, 100% 0, 97% 25%, 100% 50%, 96% 75%, 100% 100%, 0 100%);
}

.hero-overlay-cipher {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(225deg, rgba(0, 255, 225, 0.15) 0%, rgba(6, 11, 20, 0.6) 100%);
  clip-path: polygon(3% 0, 100% 0, 100% 100%, 0 100%, 4% 75%, 0 50%, 3% 25%);
}

.hero-content {
  position: relative;
  z-index: 5;
  text-align: center;
}

.hero-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: clamp(4rem, 10vw, 9rem);
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 0.95;
  text-transform: uppercase;
}

.hero-signal {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  color: var(--cipher-cyan);
  margin-top: 1.5rem;
  overflow: hidden;
  white-space: nowrap;
  display: inline-block;
  border-right: 2px solid var(--cipher-cyan);
  animation: typewriter 2.5s steps(35) 1s forwards, typewriter-cursor 0.8s step-end infinite;
  width: 0;
}

.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  animation: scroll-drift 2s ease-in-out infinite;
  z-index: 5;
}

.scroll-indicator svg {
  width: 24px;
  height: 40px;
}

/* ── DUALITY SECTION ── */

.duality {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 60vh;
}

.duality-canon {
  background: var(--canon-concrete);
  padding: 6rem 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.duality-canon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  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");
  background-size: 256px;
  pointer-events: none;
}

.duality-canon h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3.5rem);
  color: var(--canon-amber);
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.duality-canon p {
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--canon-warm-white);
  max-width: 40ch;
  opacity: 0.85;
}

.duality-canon .duality-link {
  display: inline-block;
  margin-top: 2rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--canon-amber);
  border-bottom: 1px solid var(--canon-amber);
  padding-bottom: 0.2rem;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.duality-canon .duality-link:hover {
  color: var(--canon-warm-white);
  border-color: var(--canon-warm-white);
}

.duality-cipher {
  background: var(--cipher-night);
  padding: 6rem 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.duality-cipher h2 {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  color: var(--cipher-cyan);
  margin-bottom: 1.5rem;
}

.duality-cipher p {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95rem;
  line-height: 1.9;
  color: var(--cipher-cold-white);
  max-width: 40ch;
  opacity: 0.75;
}

.duality-cipher .duality-link {
  display: inline-block;
  margin-top: 2rem;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cipher-cyan);
  border-bottom: 1px solid var(--cipher-cyan);
  padding-bottom: 0.2rem;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.duality-cipher .duality-link:hover {
  color: var(--cipher-cold-white);
  border-color: var(--cipher-cold-white);
}

/* Glitch on hover opponent */
.duality-canon:hover ~ .duality-cipher,
.duality:hover .duality-cipher:not(:hover) {
  animation: glitch-right 0.4s ease;
}

.duality-cipher:hover ~ .duality-canon,
.duality:hover .duality-canon:not(:hover) {
  animation: glitch-left 0.4s ease;
}

@media (max-width: 1024px) {
  .duality {
    grid-template-columns: 1fr;
  }

  .duality-canon,
  .duality-cipher {
    padding: 4rem 2rem;
    min-height: 50vh;
  }
}

/* ── SIGNAL SECTION ── */

.signal-section {
  background: #000;
  padding: 8rem 2rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}

.signal-section .signal-text {
  position: relative;
  z-index: 2;
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  color: #999;
  text-align: center;
  max-width: 50ch;
  line-height: 1.8;
}

.signal-section .waveform-container {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 100%;
  opacity: 0.6;
}

/* ── BATTLE CARDS ── */

.battles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  gap: 2px;
  padding: 6rem 0;
}

.battle-card {
  position: relative;
  overflow: hidden;
  min-height: 350px;
  cursor: none;
  background: #000;
}

.battle-card:nth-child(1) {
  min-height: 450px;
}

.battle-card:nth-child(2) {
  min-height: 450px;
}

.battle-card-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  filter: grayscale(60%) contrast(1.3);
  transition: filter 0.4s ease;
  clip-path: polygon(0 0, 100% 0, 100% 95%, 97% 100%, 0 100%);
}

.battle-card:hover .battle-card-bg {
  filter: grayscale(0%) contrast(1.1);
}

.battle-card-content {
  position: relative;
  z-index: 2;
  padding: 2rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
}

.battle-badge {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--cipher-cyan);
  text-transform: uppercase;
}

.battle-date {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--canon-amber);
  letter-spacing: 0.05em;
}

.battle-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.battle-subtitle {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: #777;
  margin-top: 0.5rem;
}

.battle-card .fracture-line {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.battle-card:hover .fracture-line {
  opacity: 1;
  animation: fracture-tremble 0.3s ease-in-out infinite;
}

@media (max-width: 1024px) {
  .battles-grid {
    grid-template-columns: 1fr;
    padding: 4rem 1rem;
  }

  .battle-card:nth-child(1),
  .battle-card:nth-child(2) {
    min-height: 350px;
  }

  .battle-card {
    min-height: 280px;
    cursor: pointer;
  }
}

/* ── FLOATING PLAY CURSOR ── */

.play-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 80px;
  height: 80px;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
  mix-blend-mode: difference;
}

.play-cursor.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.play-cursor-ring {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.play-cursor.visible .play-cursor-ring {
  animation: play-cursor-breathe 2s ease-in-out infinite;
}

.play-cursor-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent #fff;
  margin-left: 3px;
  transition: border-color 0.3s ease;
}

.play-cursor-text {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  text-transform: uppercase;
}

@keyframes play-cursor-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Modal playing state — cursor becomes CLOSE */

.play-cursor.modal-active .play-cursor-icon {
  border-width: 0;
  width: 14px;
  height: 14px;
  margin-left: 0;
  position: relative;
  background: transparent;
}

.play-cursor.modal-active .play-cursor-icon::before,
.play-cursor.modal-active .play-cursor-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 1px;
  background: #fff;
}

.play-cursor.modal-active .play-cursor-icon::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.play-cursor.modal-active .play-cursor-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Battle card description (expanded info) */

.battle-description {
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #888;
  margin-top: 1rem;
  max-width: 50ch;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s ease, opacity 0.4s ease, margin-top 0.3s ease;
}

.battle-card:hover .battle-description {
  max-height: 200px;
  opacity: 1;
}

.battle-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.battle-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: #555;
  border: 1px solid #222;
  padding: 0.2rem 0.6rem;
  text-transform: uppercase;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.battle-card:hover .battle-tag {
  border-color: #333;
  color: #777;
}

/* ── BATTLE PROGRESS BAR ── */

.battles-progress {
  width: 100%;
  height: 2px;
  background: #111;
  position: relative;
  margin-top: 2rem;
}

.battles-progress-fill {
  height: 100%;
  background: linear-gradient(to right, var(--canon-amber), var(--cipher-cyan));
  width: 35%;
  position: relative;
}

.battles-progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--cipher-cyan);
  border-radius: 50%;
}

/* ── VIDEO MODAL ── */

.video-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.97);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.video-modal.active {
  display: flex;
}

.video-modal-content {
  width: 80%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  position: relative;
}

.video-modal-content iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.video-modal-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: #666;
  cursor: pointer;
  z-index: calc(var(--z-modal) + 1);
  transition: color 0.3s ease;
}

.video-modal-close:hover {
  color: #fff;
}

/* ── FOOTER ── */

.site-footer {
  background: #000;
  padding: 3rem 2rem;
  position: relative;
  overflow: hidden;
  border-top: 1px solid #111;
}

.footer-wave {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.15;
  pointer-events: none;
}

.footer-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-content);
  margin: 0 auto;
}

.footer-canon {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--canon-amber);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-canon span {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.65rem;
  color: #555;
  margin-top: 0.3rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.footer-signal {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: #555;
  animation: signal-blink 3s ease-in-out infinite;
  text-align: center;
}

.footer-cipher {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--cipher-cyan);
  text-align: right;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer-cipher a {
  display: block;
  font-weight: 400;
  font-size: 0.65rem;
  color: #555;
  margin-top: 0.3rem;
  letter-spacing: 0.02em;
  text-transform: none;
  transition: color 0.3s ease;
}

.footer-cipher a:hover {
  color: var(--cipher-cyan);
}

@media (max-width: 640px) {
  .footer-content {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }

  .footer-cipher {
    text-align: center;
  }
}
