:root {
  --cnc-opening-duration: 9600ms;
  --cnc-opening-bg: #05080d;
  --cnc-opening-gold: #d5aa4e;
  --cnc-opening-ivory: #f5efe2;
  --cnc-scale-87: 2.05;
  --cnc-scale-92: 3.05;
  --cnc-scale-96: 3.85;
  --cnc-scale-100: 4.20;
}

html.cnc-opening-pending,
html.cnc-opening-pending body,
body.cnc-opening-active {
  overflow: hidden !important;
}

.cnc-opening-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 58%, rgba(213, 170, 78, 0.08), transparent 28%),
    radial-gradient(circle at 50% 50%, #0c1420 0%, var(--cnc-opening-bg) 58%, #020305 100%);
  opacity: 1;
  visibility: visible;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  will-change: opacity, visibility;
}

.cnc-opening-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.16) 0 1px, transparent 1.4px),
    radial-gradient(circle at 72% 34%, rgba(255,255,255,.12) 0 1px, transparent 1.4px),
    radial-gradient(circle at 38% 76%, rgba(255,255,255,.12) 0 1px, transparent 1.4px),
    radial-gradient(circle at 86% 72%, rgba(213,170,78,.14) 0 1px, transparent 1.5px);
  background-size: 260px 260px, 340px 340px, 420px 420px, 510px 510px;
  opacity: .28;
  animation: cnc-particles 12s linear infinite;
}

.cnc-opening-atmosphere {
  position: absolute;
  width: min(92vw, 1200px);
  height: min(44vw, 540px);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(213,170,78,.12), rgba(9,16,25,.05) 42%, transparent 72%);
  filter: blur(34px);
  transform: translateY(9vh) scale(.9);
  opacity: .36;
}

.cnc-opening-light {
  position: absolute;
  left: 50%;
  bottom: 27%;
  width: min(62vw, 820px);
  height: 1px;
  transform: translateX(-50%) scaleX(.06);
  background: linear-gradient(90deg, transparent, rgba(213,170,78,.95), #fff8df, rgba(213,170,78,.95), transparent);
  box-shadow: 0 0 18px rgba(213,170,78,.7), 0 0 54px rgba(213,170,78,.28);
  opacity: 0;
}

.cnc-opening-title {
  position: absolute;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: .34em;
  width: min(96vw, 1280px);
  padding: 0 12px;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4.9vw, 78px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: .065em;
  opacity: 0;
  filter: blur(16px);
  transform: translateY(10px) scale(.975);
  transform-origin: 50% 52%;
  user-select: none;
  will-change: opacity, transform, filter, letter-spacing, gap;
}

.cnc-opening-word {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-start;
  white-space: nowrap;
  min-width: 0;
}

.cnc-opening-initial,
.cnc-opening-rest {
  display: inline-block;
  color: var(--cnc-opening-ivory);
  text-shadow: 0 2px 28px rgba(213,170,78,.14);
  will-change: opacity, transform, filter, color, max-width, background-position;
}

.cnc-opening-initial {
  background-image: linear-gradient(
    112deg,
    #c8102e 0%,
    #ffffff 9%,
    #0057b8 18%,
    #ffcd00 28%,
    #009b3a 38%,
    #ffffff 48%,
    #ce1126 58%,
    #0038a8 68%,
    #fcd116 78%,
    #111111 88%,
    #d5aa4e 100%
  );
  background-size: 300% 100%;
  background-repeat: no-repeat;
  background-position: var(--cnc-flag-start, 0%) 50%;
  -webkit-background-clip: text;
  background-clip: text;
}

.cnc-opening-word-1 .cnc-opening-initial {
  --cnc-flag-start: 0%;
  --cnc-flag-end: 100%;
}

.cnc-opening-word-2 .cnc-opening-initial {
  --cnc-flag-start: 38%;
  --cnc-flag-end: 138%;
}

.cnc-opening-word-3 .cnc-opening-initial {
  --cnc-flag-start: 76%;
  --cnc-flag-end: 176%;
}

.cnc-opening-rest {
  max-width: 8em;
  overflow: hidden;
  white-space: nowrap;
}

.cnc-opening-overlay.is-running .cnc-opening-title {
  animation: cnc-title var(--cnc-opening-duration) cubic-bezier(.22,.61,.36,1) both;
}

.cnc-opening-overlay.is-running .cnc-opening-initial {
  animation: cnc-initial var(--cnc-opening-duration) cubic-bezier(.22,.61,.36,1) both;
}

.cnc-opening-overlay.is-running .cnc-opening-rest {
  animation: cnc-rest var(--cnc-opening-duration) cubic-bezier(.22,.61,.36,1) both;
}

.cnc-opening-overlay.is-running .cnc-opening-light {
  animation: cnc-light var(--cnc-opening-duration) ease-in-out both;
}

.cnc-opening-overlay.is-running {
  animation: cnc-overlay var(--cnc-opening-duration) ease-in-out both;
}

.cnc-opening-overlay.is-skipping {
  transition: opacity .52s ease, visibility .52s ease;
  opacity: 0;
  visibility: hidden;
}

.cnc-brand-watermark {
  position: fixed;
  z-index: 99990;
  left: clamp(18px, 3vw, 58px);
  top: 54%;
  width: clamp(300px, 33vw, 590px);
  transform: translateY(-50%);
  opacity: .14;
  pointer-events: none;
  user-select: none;
  mix-blend-mode: multiply;
  filter: saturate(.72) contrast(1.08);
}

.cnc-brand-watermark img {
  display: block;
  width: 100%;
  height: auto;
}

body.admin-bar .cnc-opening-overlay {
  top: 0;
}

@keyframes cnc-title {
  0%, 11% {
    opacity: 0;
    filter: blur(22px);
    transform: translateY(18px) scale(.96);
    letter-spacing: .15em;
    gap: .44em;
  }
  23% {
    opacity: .24;
    filter: blur(14px);
    transform: translateY(11px) scale(.972);
    letter-spacing: .12em;
    gap: .40em;
  }
  35% {
    opacity: .72;
    filter: blur(5px);
    transform: translateY(4px) scale(.99);
    letter-spacing: .082em;
    gap: .36em;
  }
  42%, 55% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
    letter-spacing: .065em;
    gap: .34em;
  }
  64% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
    letter-spacing: .052em;
    gap: .31em;
  }
  70% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1.01);
    letter-spacing: .044em;
    gap: .25em;
  }
  75% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1.06);
    letter-spacing: .028em;
    gap: .15em;
  }
  80% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1.16);
    letter-spacing: .012em;
    gap: .06em;
  }
  87% {
    opacity: 1;
    filter: blur(.25px);
    transform: translateY(0) scale(var(--cnc-scale-87));
    letter-spacing: .018em;
    gap: .052em;
  }
  92% {
    opacity: .84;
    filter: blur(3px);
    transform: translateY(-1px) scale(var(--cnc-scale-92));
    letter-spacing: .028em;
    gap: .05em;
  }
  96% {
    opacity: .38;
    filter: blur(12px);
    transform: translateY(-2px) scale(var(--cnc-scale-96));
    letter-spacing: .05em;
    gap: .05em;
  }
  100% {
    opacity: 0;
    filter: blur(34px);
    transform: translateY(-3px) scale(var(--cnc-scale-100));
    letter-spacing: .09em;
    gap: .05em;
  }
}

@keyframes cnc-initial {
  0%, 48% {
    color: var(--cnc-opening-ivory);
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
    background-position: var(--cnc-flag-start, 0%) 50%;
    text-shadow: 0 2px 28px rgba(213,170,78,.14);
  }
  55% {
    color: #eed18d;
    opacity: 1;
    text-shadow: 0 0 24px rgba(213,170,78,.28), 0 0 48px rgba(213,170,78,.12);
  }
  70%, 76% {
    color: var(--cnc-opening-gold);
    opacity: 1;
    filter: blur(0);
    background-position: var(--cnc-flag-start, 0%) 50%;
    text-shadow: 0 0 28px rgba(213,170,78,.40), 0 0 58px rgba(213,170,78,.16);
  }
  78% {
    color: transparent;
    -webkit-text-fill-color: transparent;
    opacity: 1;
    filter: blur(0);
    background-position: var(--cnc-flag-start, 0%) 50%;
    text-shadow: 0 0 22px rgba(255,255,255,.22), 0 0 48px rgba(213,170,78,.22);
  }
  90% {
    color: transparent;
    -webkit-text-fill-color: transparent;
    opacity: .94;
    filter: blur(1px);
    background-position: var(--cnc-flag-end, 100%) 50%;
    text-shadow: 0 0 30px rgba(255,255,255,.18), 0 0 70px rgba(213,170,78,.18);
  }
  100% {
    color: transparent;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    filter: blur(18px);
    background-position: var(--cnc-flag-end, 100%) 50%;
    text-shadow: 0 0 38px rgba(255,255,255,.08);
  }
}

@keyframes cnc-rest {
  0%, 55% {
    max-width: 8em;
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
  60% {
    max-width: 7.2em;
    opacity: .72;
    filter: blur(1.5px);
    transform: translateY(0) scale(.985);
  }
  64% {
    max-width: 4.8em;
    opacity: .34;
    filter: blur(4px);
    transform: translateY(0) scale(.94);
  }
  68% {
    max-width: 1.2em;
    opacity: .08;
    filter: blur(7px);
    transform: translateY(0) scale(.84);
  }
  70%, 100% {
    max-width: 0;
    opacity: 0;
    filter: blur(10px);
    transform: translateY(0) scale(.72);
  }
}

@keyframes cnc-light {
  0%, 28% { opacity: 0; transform: translateX(-50%) scaleX(.06); }
  41%, 72% { opacity: .88; transform: translateX(-50%) scaleX(1); }
  82% { opacity: .34; transform: translateX(-50%) scaleX(.72); }
  90%, 100% { opacity: 0; transform: translateX(-50%) scaleX(.18); }
}

@keyframes cnc-overlay {
  0%, 86% { opacity: 1; visibility: visible; }
  92% { opacity: .86; visibility: visible; }
  96% { opacity: .46; visibility: visible; }
  100% { opacity: 0; visibility: hidden; }
}

@keyframes cnc-particles {
  from { transform: translate3d(0,0,0); }
  to { transform: translate3d(-24px,18px,0); }
}

@media (max-width: 782px) {
  .cnc-opening-title {
    font-size: clamp(23px, 7.4vw, 42px);
    line-height: 1.2;
    letter-spacing: .035em;
    gap: .20em;
  }

  .cnc-opening-light {
    bottom: 31%;
    width: 82vw;
  }

  .cnc-brand-watermark {
    left: 50%;
    top: 61%;
    width: min(76vw, 430px);
    transform: translate(-50%, -50%);
    opacity: .075;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cnc-opening-overlay,
  .cnc-opening-overlay * {
    animation-duration: 1400ms !important;
    animation-iteration-count: 1 !important;
  }
}
