/* =========================================================
   CODEX — THE OATH (RITUAL PASS v2)
   Layout: REGISTRY (left) / MARK (center) / OATH+CTA (right)
   Contrast: LEFT = Ember Red / RIGHT = Frozen Light
   ========================================================= */

.iv-codex {
    position: relative;
    padding: 64px 0 64px;

    background:
        radial-gradient(1000px 520px at 18% 28%, rgba(255, 77, 46, 0.10), transparent 62%),
        radial-gradient(1200px 720px at 70% 50%, rgba(127, 166, 201, 0.08), transparent 65%),
        linear-gradient(180deg, rgba(6, 8, 11, 0.92), rgba(10, 12, 16, 0.98));

    --ritual: 0;
}


/* =========================================================
   GRID / WRAPPER
   ========================================================= */

.iv-codex__inner {
    position: relative;
    z-index: 2;
    width: min(1200px, calc(100% - 64px));
    margin: 0 auto;

    display: grid;
    grid-template-columns: minmax(320px, 420px) auto minmax(520px, 1fr);
    gap: 64px;
    align-items: start;
}

.iv-codex__whisper {
    position: absolute;
    left: 0;
    right: 0;
    top: -10px;
    pointer-events: none;
    overflow: hidden;
    z-index: 3;

    mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
}

.iv-codex__whisperTrack {
    display: flex;
    width: max-content;
    will-change: transform;
  
    --whisper-duration: 55s;            /* повільніше */
    --whisper-shift: -800px;            /* JS перезапише */
    animation: iv-whisper-loop var(--whisper-duration) linear infinite;
  
    /* Хочеш зліва -> направо: просто reverse */
    animation-direction: reverse;
  }

/* дві однакові групи */
.iv-codex__whisperGroup {
    display: flex;
    flex: 0 0 auto;
    white-space: nowrap;
}

.iv-codex__whisperItem {
    display: inline-block;
    font-size: 0.62rem;
    letter-spacing: 0.38em;
    text-transform: uppercase;
    color: rgba(230, 230, 230, 0.22);
    opacity: calc(0.10 + (var(--ritual) * 0.14));
    padding-right: 56px;
}

/* ЗЛІВА -> НАПРАВО: стартуємо з -50% і йдемо до 0 */
@keyframes iv-whisper-loop {
    from {
        transform: translate3d(-50%, 0, 0);
    }

    to {
        transform: translate3d(0%, 0, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .iv-codex__whisperTrack {
        animation: none;
        transform: none;
    }
}




/* =========================================================
   LEFT: REGISTRY (Ember Red field)
   ========================================================= */

.iv-codex__registry {
    position: relative;
    padding-top: 22px;
    isolation: isolate;
}

/* Ember field behind whole left side */
.iv-codex__registry::before {
    content: "";
    position: absolute;
    inset: -26px -26px -26px -18px;
    border-radius: 22px;
    pointer-events: none;
    z-index: 0;

    background:
        radial-gradient(closest-side at 24% 26%,
            rgba(255, 77, 46, 0.24),
            transparent 68%),
        radial-gradient(closest-side at 66% 72%,
            rgba(255, 77, 46, 0.12),
            transparent 72%),
        repeating-linear-gradient(120deg,
            rgba(255, 77, 46, 0.08) 0 1px,
            transparent 1px 18px);

    mix-blend-mode: screen;
    filter: blur(14px);
    opacity: calc(0.26 + (var(--ritual) * 0.22));

    transform: translate3d(0, 0, 0);
    animation: codex-emberfield 16s ease-in-out infinite alternate;
}

@keyframes codex-emberfield {
    from {
        transform: translate3d(-1.2%, -0.6%, 0) scale(1.02);
    }

    to {
        transform: translate3d(1.2%, 0.8%, 0) scale(1.05);
    }
}

/* keep registry content above overlay */
.iv-codex__registry>* {
    position: relative;
    z-index: 1;
}

/* =========================================================
   RIGHT: OATH (Frozen Light shimmer)
   ========================================================= */

.iv-codex__oath {
    position: relative;
    padding-top: 22px;
    max-width: 760px;
    isolation: isolate;
}

/* Frozen “beam” behind right side */
.iv-codex__oath::after {
    content: "";
    position: absolute;
    inset: -28px -26px -28px -26px;
    border-radius: 24px;
    pointer-events: none;
    z-index: 0;

    background:
        linear-gradient(115deg,
            transparent 0%,
            rgba(150, 205, 255, 0.00) 34%,
            rgba(150, 205, 255, 0.10) 46%,
            rgba(230, 248, 255, 0.18) 50%,
            rgba(150, 205, 255, 0.10) 54%,
            rgba(150, 205, 255, 0.00) 66%,
            transparent 100%),
        repeating-linear-gradient(0deg,
            rgba(220, 245, 255, 0.05) 0 1px,
            transparent 1px 4px);

    mix-blend-mode: screen;
    filter: blur(10px);
    opacity: calc(0.14 + (var(--ritual) * 0.18));

    transform: translateX(-40%) translateY(0) rotate(0.0001deg);
    animation: codex-frozenbeam 12.5s ease-in-out infinite;
}

@keyframes codex-frozenbeam {
    0% {
        transform: translateX(-55%) translateY(-2%) skewX(-6deg);
        opacity: 0.10;
    }

    25% {
        opacity: 0.18;
    }

    50% {
        transform: translateX(10%) translateY(1%) skewX(-6deg);
        opacity: 0.26;
    }

    75% {
        opacity: 0.16;
    }

    100% {
        transform: translateX(75%) translateY(2%) skewX(-6deg);
        opacity: 0.10;
    }
}

/* keep oath content above overlay */
.iv-codex__oath>* {
    position: relative;
    z-index: 1;
}


/* slight cool tint on right text for contrast */
.iv-codex__oath .iv-codex__body p {
    color: rgba(230, 240, 248, 0.90);
}

/* =========================================================
   TEXT (shared)
   ========================================================= */

.iv-codex__kicker {
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    color: var(--ash-gray);
    opacity: 0.85;
    margin-bottom: 18px;
}

.iv-codex__title {
    font-size: clamp(1.9rem, 3.2vw, 2.8rem);
    line-height: 1.1;
    margin-bottom: 30px;

    text-shadow:
        0 0 10px rgba(0, 0, 0, 0.7),
        0 0 26px rgba(255, 77, 46, 0.12);
}

.iv-codex__body {
    margin-top: 6px;
}

.iv-codex__body p {
    opacity: 0.84;
    font-size: 0.98rem;
    line-height: 1.75;
    margin-bottom: 18px;
    color: var(--bone-white);
}

.iv-codex__body p:first-child {
    padding-left: 16px;
    border-left: 1px solid rgba(255, 77, 46, 0.18);
}

/* CTA (keep warm) */
.iv-codex__cta {
    display: inline-block;
    margin-top: 30px;
    padding: 12px 22px;
    border-radius: 999px;

    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-decoration: none;

    color: var(--bone-white);
    background: rgba(255, 77, 46, 0.08);
    border: 1px solid rgba(255, 77, 46, 0.35);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        background-color 0.25s ease;
}

.iv-codex__cta:hover {
    transform: translateY(-1px);
    background: rgba(255, 77, 46, 0.14);
    box-shadow: 0 0 18px rgba(255, 77, 46, 0.18);
}

/* =========================================================
   CENTER: RITUAL MARK (vertical cut)
   ========================================================= */

.iv-codex__mark {
    position: relative;
    width: 1px;
    height: 280px;
    opacity: 0.75;
    overflow: hidden;
    isolation: isolate;

    background: linear-gradient(180deg,
            transparent,
            rgba(255, 77, 46, 0.22),
            transparent);
}

.iv-codex__mark::before {
    content: "";
    position: absolute;
    inset: -30% -22px;
    pointer-events: none;

    background: radial-gradient(closest-side,
            rgba(255, 77, 46, 0.10),
            transparent 70%);

    filter: blur(10px);
    opacity: calc(0.18 + (var(--ritual) * 0.22));
}

.iv-codex__mark span {
    position: absolute;
    inset: -40% 0;
    width: 100%;

    background: linear-gradient(180deg,
            transparent 0%,
            rgba(255, 77, 46, 0.26) 42%,
            rgba(255, 77, 46, 0.55) 50%,
            rgba(255, 77, 46, 0.26) 58%,
            transparent 100%);

    filter: blur(6px);
    opacity: 0.35;

    transform: translateY(100%);
    animation: codex-pulse 7.5s ease-in-out infinite;
}

.iv-codex__mark::after {
    content: "";
    position: absolute;
    left: 50%;
    top: -18px;
    width: 10px;
    height: 10px;
    border-radius: 999px;

    background: radial-gradient(circle,
            rgba(255, 77, 46, 0.55),
            rgba(255, 77, 46, 0.0) 70%);

    transform: translateX(-50%);
    filter: blur(0.4px);
    opacity: calc(0.10 + (var(--ritual) * 0.18));

    animation: codex-ember 9s ease-in-out infinite;
}

@keyframes codex-ember {
    0% {
        transform: translateX(-50%) translateY(-10%);
        opacity: 0.0;
    }

    15% {
        opacity: 0.25;
    }

    50% {
        transform: translateX(-50%) translateY(140px);
        opacity: 0.35;
    }

    85% {
        opacity: 0.18;
    }

    100% {
        transform: translateX(-50%) translateY(320px);
        opacity: 0.0;
    }
}

@keyframes codex-pulse {
    0% {
        transform: translateY(120%);
        opacity: 0;
    }

    25% {
        opacity: 0.25;
    }

    50% {
        transform: translateY(0%);
        opacity: 0.45;
    }

    75% {
        opacity: 0.25;
    }

    100% {
        transform: translateY(-120%);
        opacity: 0;
    }
}

/* =========================================================
   REGISTRY CARD (no white pulsing blob)
   ========================================================= */

.iv-metaCard {
    position: relative;
    padding: 18px 18px 16px;
    border-radius: 16px;
    overflow: hidden;

    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.22));
    border: 1px solid rgba(255, 77, 46, 0.14);

    box-shadow:
        0 0 24px rgba(255, 77, 46, 0.06);
}

/* inner ritual scan — softened & never bright */
.iv-metaCard::before {
    content: "";
    position: absolute;
    inset: -40% -20%;
    pointer-events: none;

    background:
        radial-gradient(closest-side at 20% 35%, rgba(255, 77, 46, 0.10), transparent 65%),
        repeating-linear-gradient(110deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 22px);

    mix-blend-mode: soft-light;
    opacity: calc(0.06 + (var(--ritual) * 0.12));
    filter: blur(16px);

    transform: translate3d(-2%, 0, 0) rotate(-2deg);
    animation: meta-drift 24s ease-in-out infinite alternate;
}

@keyframes meta-drift {
    from {
        transform: translate3d(-3%, -1%, 0) rotate(-3deg);
    }

    to {
        transform: translate3d(3%, 2%, 0) rotate(2deg);
    }
}

.iv-metaCard__kicker {
    font-size: 0.65rem;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: rgba(230, 230, 230, 0.55);
    margin-bottom: 12px;
    opacity: 0.9;
}

.iv-metaList {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.iv-metaList li {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 12px;
    align-items: baseline;
}

.iv-metaKey {
    font-size: 0.68rem;
    letter-spacing: 0.20em;
    text-transform: uppercase;
    color: rgba(157, 163, 174, 0.75);
}

.iv-metaVal {
    font-size: 0.92rem;
    color: rgba(230, 230, 230, 0.86);
}

/* “Active” pulse — ember only */
.iv-metaPulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    margin-left: 10px;
    vertical-align: middle;

    background: rgba(255, 77, 46, 0.50);
    box-shadow:
        0 0 0 0 rgba(255, 77, 46, 0.18),
        0 0 14px rgba(255, 77, 46, 0.14);

    opacity: calc(0.55 + (var(--ritual) * 0.22));
    animation: meta-pulse 3.4s ease-in-out infinite;
}

@keyframes meta-pulse {

    0%,
    100% {
        transform: scale(0.92);
        filter: blur(0px);
    }

    50% {
        transform: scale(1.18);
        filter: blur(0.15px);
    }
}

.iv-metaSeals {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    opacity: 0.75;
}

/* STATUS "Active" green */
.iv-metaVal--active {
    color: rgba(170, 255, 195, 0.92);
  }
  
  /* Pulse dot green */
  .iv-metaPulse {
    background: rgba(120, 255, 170, 0.70);
    box-shadow:
      0 0 0 0 rgba(120, 255, 170, 0.22),
      0 0 14px rgba(120, 255, 170, 0.18);
  }
  

.iv-seal {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 77, 46, 0.25);
    background: rgba(255, 77, 46, 0.06);
    box-shadow: 0 0 14px rgba(255, 77, 46, 0.10);
    animation: seal-float 2.2s ease-in-out infinite;
}

.iv-seal:nth-child(2) {
    animation-delay: 0.6s;
    opacity: 0.65;
}

.iv-seal:nth-child(3) {
    animation-delay: 1.2s;
    opacity: 0.55;
}

@keyframes seal-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* =========================================================
   RITUAL SCROLL REVEAL
   ========================================================= */

.iv-reveal {
    --reveal-delay: 0ms;
}

.iv-reveal__item {
    opacity: 0;
    transform: translateY(26px);
    filter: blur(1.2px);

    transition:
        opacity 2.8s cubic-bezier(0.22, 1, 0.36, 1),
        transform 2.8s cubic-bezier(0.22, 1, 0.36, 1),
        filter 3.2s ease;

    transition-delay: var(--reveal-delay);
}

.iv-reveal__mark {
    opacity: 0;
    transform: scaleY(0.6);

    transition:
        opacity 3s ease,
        transform 3.6s ease;
}

.iv-reveal.is-visible .iv-reveal__item {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.iv-reveal.is-visible .iv-reveal__mark {
    opacity: 0.75;
    transform: scaleY(1);
}

.iv-reveal__mark span {
    animation-play-state: paused;
}

.iv-reveal.is-visible .iv-reveal__mark span {
    animation-play-state: running;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 980px) {
    .iv-codex {
        padding: 64px 0 64px;
    }

    .iv-codex__inner {
        grid-template-columns: 1fr;
        gap: 42px;
    }

    .iv-codex__mark {
        height: 1px;
        width: 200px;
        justify-self: start;
    }

    .iv-codex__mark span {
        inset: 0 -40%;
        background: linear-gradient(90deg,
                transparent 0%,
                rgba(255, 77, 46, 0.26) 42%,
                rgba(255, 77, 46, 0.55) 50%,
                rgba(255, 77, 46, 0.26) 58%,
                transparent 100%);
        transform: translateX(100%);
        animation: codex-pulse-x 7.5s ease-in-out infinite;
    }

    @keyframes codex-pulse-x {
        0% {
            transform: translateX(120%);
            opacity: 0;
        }

        25% {
            opacity: 0.25;
        }

        50% {
            transform: translateX(0%);
            opacity: 0.45;
        }

        75% {
            opacity: 0.25;
        }

        100% {
            transform: translateX(-120%);
            opacity: 0;
        }
    }

    .iv-codex__mark::after {
        top: 50%;
        left: -18px;
        transform: translateY(-50%);
        animation: codex-ember-x 9s ease-in-out infinite;
    }

    @keyframes codex-ember-x {
        0% {
            transform: translateY(-50%) translateX(-10%);
            opacity: 0;
        }

        15% {
            opacity: 0.25;
        }

        50% {
            transform: translateY(-50%) translateX(140px);
            opacity: 0.35;
        }

        85% {
            opacity: 0.18;
        }

        100% {
            transform: translateY(-50%) translateX(320px);
            opacity: 0;
        }
    }
}

@media (max-width: 520px) {
    .iv-metaList li {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .iv-reveal__item,
    .iv-reveal__mark {
        transition: none;
        opacity: 1;
        transform: none;
        filter: none;
    }

    .iv-codex__inner::before,
    .iv-codex__registry::before,
    .iv-codex__oath::after,
    .iv-codex__mark span,
    .iv-codex__mark::after,
    .iv-metaCard::before,
    .iv-metaPulse,
    .iv-seal {
        animation: none;
        filter: none;
        opacity: 0.14;
    }
}