/* ============================================================
   ETOUCH SOLUTIONS — cinematic.css
   Cinematic motion layer. Loads AFTER style.css and never edits it.
   Uses the independent CSS `translate`, `rotate` and `scale`
   properties so existing `transform` hover effects keep working.

   01 Tokens
   02 Title-card curtain (page open / page change)
   03 Header + menu motion
   04 Scroll reveals (cinematic "shots")
   05 3D / Ken Burns background layers
   06 Film grain
   07 HUD: progress bar, scene rail, lower-third caption
   08 Sound dock
   09 Click ring + press feedback
   10 Responsive
   11 Reduced motion
============================================================ */


/* ------------------------------------------------------------
   01 · TOKENS
------------------------------------------------------------ */
:root {
    --cin-ink: #04170f;
    --cin-green: #0AAE60;
    --cin-gold: #F4B400;
    --cin-ease: cubic-bezier(.16, 1, .3, 1);
    --cin-ease-io: cubic-bezier(.76, 0, .24, 1);
    --cin-p: 0;
}


/* ------------------------------------------------------------
   02 · TITLE-CARD CURTAIN
   Two letterbox bars (html::before / ::after). They sit closed
   while the page loads, show the scene title, then part like a
   cinema screen. On internal navigation they close again.
------------------------------------------------------------ */
html.cin-js::before,
html.cin-js::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    height: 50.3vh;
    z-index: 99990;
    pointer-events: none;
    overflow: hidden;
    box-sizing: border-box;
    background: radial-gradient(120% 140% at 50% 100%, #0b3a24 0%, var(--cin-ink) 62%);
    color: #fff;
    display: flex;
    justify-content: center;
    text-align: center;
    visibility: visible;
    transition: height .95s var(--cin-ease-io) .3s, color .35s ease, visibility 0s linear 1.3s;
}

html.cin-js::before {
    top: 0;
    align-items: flex-end;
    padding-bottom: 1.6vh;
    content: var(--cin-title, "");
    font: 600 clamp(1.15rem, 4.2vw, 2.7rem)/1.1 "Poppins", system-ui, sans-serif;
    letter-spacing: .3em;
    text-transform: uppercase;
    text-indent: .3em;
    background: radial-gradient(120% 140% at 50% 100%, #0b3a24 0%, var(--cin-ink) 62%);
}

html.cin-js::after {
    bottom: 0;
    align-items: flex-start;
    padding-top: 1.8vh;
    content: var(--cin-sub, "");
    font: 500 clamp(.62rem, 1.6vw, .85rem)/1.2 "Poppins", system-ui, sans-serif;
    letter-spacing: .42em;
    text-transform: uppercase;
    text-indent: .42em;
    color: var(--cin-gold);
}

/* Title card text rises in while bars are closed */
html.cin-js:not(.cin-ready)::before {
    animation: cinTitleIn 1.1s var(--cin-ease) .1s both, cinFailsafe .6s 4s forwards;
}

html.cin-js:not(.cin-ready)::after {
    animation: cinSubIn 1.1s var(--cin-ease) .5s both, cinFailsafe .6s 4s forwards;
}

/* Bars part: text fades first, then the screen opens */
html.cin-js.cin-ready::before,
html.cin-js.cin-ready::after {
    height: 0;
    color: transparent;
    visibility: hidden;
}

/* Leaving: bars close again and show the destination name */
html.cin-js.cin-ready.cin-leaving::before,
html.cin-js.cin-ready.cin-leaving::after {
    height: 50.3vh;
    color: #fff;
    visibility: visible;
    transition: height .62s var(--cin-ease-io), color .3s ease .25s, visibility 0s;
}

html.cin-js.cin-ready.cin-leaving::after {
    color: var(--cin-gold);
}

/* Only the lettering animates — the bars stay fully opaque so the
   page never flashes through while loading */
@keyframes cinTitleIn {
    from {
        letter-spacing: .62em;
        color: transparent;
    }
    to {
        letter-spacing: .3em;
        color: #fff;
    }
}

@keyframes cinSubIn {
    from {
        letter-spacing: .8em;
        color: transparent;
    }
    to {
        letter-spacing: .42em;
        color: var(--cin-gold);
    }
}

@keyframes cinFailsafe {
    to {
        height: 0;
        visibility: hidden;
    }
}


/* ------------------------------------------------------------
   03 · HEADER + MENU MOTION
------------------------------------------------------------ */
html.cin-js.cin-ready .site-header {
    animation: cinHeaderIn 1.1s var(--cin-ease) .55s both;
}

@keyframes cinHeaderIn {
    from {
        translate: 0 -36px;
        opacity: 0;
    }
    to {
        translate: none;
        opacity: 1;
    }
}

/* Mobile menu: items arrive one after another */
.navbar-collapse.show .navbar-nav > li,
.navbar-collapse.collapsing .navbar-nav > li {
    animation: cinNavIn .6s var(--cin-ease) both;
}

.navbar-collapse.show .navbar-nav > li:nth-child(1) { animation-delay: .04s; }
.navbar-collapse.show .navbar-nav > li:nth-child(2) { animation-delay: .08s; }
.navbar-collapse.show .navbar-nav > li:nth-child(3) { animation-delay: .12s; }
.navbar-collapse.show .navbar-nav > li:nth-child(4) { animation-delay: .16s; }
.navbar-collapse.show .navbar-nav > li:nth-child(5) { animation-delay: .20s; }
.navbar-collapse.show .navbar-nav > li:nth-child(6) { animation-delay: .24s; }
.navbar-collapse.show .navbar-nav > li:nth-child(7) { animation-delay: .28s; }
.navbar-collapse.show .navbar-nav > li:nth-child(8) { animation-delay: .32s; }
.navbar-collapse.show .navbar-nav > li:nth-child(n+9) { animation-delay: .36s; }

@keyframes cinNavIn {
    from {
        opacity: 0;
        translate: -22px 0;
        rotate: y -24deg;
    }
    to {
        opacity: 1;
        translate: none;
        rotate: none;
    }
}

.dropdown-menu.show {
    animation: cinDrop .38s var(--cin-ease) both;
    transform-origin: 50% 0;
}

@keyframes cinDrop {
    from {
        opacity: 0;
        translate: 0 -10px;
        scale: .96;
    }
    to {
        opacity: 1;
        translate: none;
        scale: none;
    }
}


/* ------------------------------------------------------------
   04 · SCROLL REVEALS — each block enters like a camera shot
   JS adds .cin-r (+ a direction) and later .cin-in.
   After the shot finishes JS removes every class, so the
   element's original styling is fully restored.
------------------------------------------------------------ */
.cin-persp {
    perspective: 1400px;
}

.cin-sec {
    overflow-x: clip;
}

.cin-r {
    opacity: 0;
    transition:
        opacity 1s var(--cin-ease) var(--cin-d, 0ms),
        translate 1.15s var(--cin-ease) var(--cin-d, 0ms),
        rotate 1.15s var(--cin-ease) var(--cin-d, 0ms),
        scale 1.15s var(--cin-ease) var(--cin-d, 0ms),
        filter .95s var(--cin-ease) var(--cin-d, 0ms),
        clip-path 1.3s var(--cin-ease) var(--cin-d, 0ms);
    will-change: opacity, translate;
}

/* Directions */
.cin-up    { translate: 0 54px;  rotate: x 16deg; scale: .97; }
.cin-left  { translate: -64px 0; rotate: y 12deg; }
.cin-right { translate: 64px 0;  rotate: y -12deg; }
.cin-zoom  { scale: .88; filter: blur(6px); }

/* Headings: rack-focus pull from blur to sharp */
.cin-blur  { translate: 0 28px; scale: 1.03; filter: blur(12px); }

/* Images: curtain-wipe reveal */
.cin-img {
    clip-path: inset(0 0 100% 0);
    scale: 1.14;
}

/* Revealed */
.cin-r.cin-in {
    opacity: 1;
    translate: 0 0;
    rotate: none;
    scale: none;
    filter: none;
}

/* Only images use the wipe, so card shadows are never clipped */
.cin-img.cin-in {
    clip-path: inset(0 0 0 0);
}


/* ------------------------------------------------------------
   05 · 3D + KEN BURNS BACKGROUND LAYERS
------------------------------------------------------------ */
.cin-sec-fx {
    position: relative;
    isolation: isolate;
}

/* Live 3D scene: particles, glass wireframes, depth-of-field glow */
.cin-canvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    display: block;
}

/* Ken Burns: slow push-in on photographic backgrounds */
.cin-kbw {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: -2;
    pointer-events: none;
}

.cin-kb {
    position: absolute;
    inset: 0;
    background-repeat: no-repeat;
    animation: cinKB 28s ease-in-out infinite alternate;
    will-change: scale, translate;
}

@keyframes cinKB {
    from {
        scale: 1;
        translate: 0 0;
    }
    to {
        scale: 1.12;
        translate: -1.8% -1.2%;
    }
}

/* Floating depth objects (hero artwork) */
.cin-float {
    will-change: translate;
}

.cin-tilt {
    will-change: rotate;
}


/* ------------------------------------------------------------
   06 · FILM GRAIN
------------------------------------------------------------ */
.cin-grain {
    position: fixed;
    inset: -60px;
    z-index: 9980;
    pointer-events: none;
    opacity: .055;
    background-image: var(--cin-grain);
    background-size: 160px 160px;
    animation: cinGrain .9s steps(6) infinite;
}

@keyframes cinGrain {
    0%   { translate: 0 0; }
    20%  { translate: -28px 14px; }
    40%  { translate: 18px -30px; }
    60%  { translate: -12px 26px; }
    80%  { translate: 30px 10px; }
    100% { translate: 0 0; }
}


/* ------------------------------------------------------------
   07 · HUD — progress, scene rail, lower-third
------------------------------------------------------------ */
.cin-prog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1100;
    pointer-events: none;
    background: linear-gradient(90deg, var(--cin-green), var(--cin-gold));
    transform-origin: 0 50%;
    transform: scaleX(var(--cin-p));
    box-shadow: 0 0 12px rgba(244, 180, 0, .55);
}

.cin-rail {
    position: fixed;
    right: 14px;
    top: 50%;
    translate: 0 -50%;
    z-index: 1050;
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 12px 8px;
    border-radius: 20px;
    background: rgba(4, 23, 15, .38);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity .6s ease .8s;
}

html.cin-ready .cin-rail {
    opacity: 1;
}

.cin-rail button {
    position: relative;
    width: 10px;
    height: 10px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .55);
    cursor: pointer;
    transition: scale .35s var(--cin-ease), background .35s ease, box-shadow .35s ease;
}

.cin-rail button:hover {
    scale: 1.35;
    background: #fff;
}

.cin-rail button.is-on {
    background: var(--cin-gold);
    scale: 1.45;
    box-shadow: 0 0 0 4px rgba(244, 180, 0, .28);
}

.cin-rail button::after {
    content: attr(data-title);
    position: absolute;
    right: 22px;
    top: 50%;
    translate: 8px -50%;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--cin-ink);
    color: #fff;
    font: 500 .72rem/1 "Poppins", system-ui, sans-serif;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, translate .25s var(--cin-ease);
}

.cin-rail button:hover::after,
.cin-rail button:focus-visible::after {
    opacity: 1;
    translate: 0 -50%;
}

/* Lower-third: names each scene as it begins */
.cin-cap {
    position: fixed;
    left: 14px;
    bottom: 70px;
    z-index: 1050;
    max-width: min(78vw, 360px);
    padding: 10px 16px 11px 14px;
    border-left: 3px solid var(--cin-gold);
    border-radius: 0 12px 12px 0;
    background: linear-gradient(90deg, rgba(4, 23, 15, .88), rgba(4, 23, 15, .62));
    color: #fff;
    pointer-events: none;
    opacity: 0;
    translate: -24px 0;
    clip-path: inset(0 100% 0 0);
    transition: opacity .5s ease, translate .7s var(--cin-ease), clip-path .8s var(--cin-ease);
}

.cin-cap.is-on {
    opacity: 1;
    translate: 0 0;
    clip-path: inset(0 0 0 0);
}

.cin-cap small {
    display: block;
    margin-bottom: 3px;
    font: 600 .62rem/1 "Poppins", system-ui, sans-serif;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--cin-gold);
}

.cin-cap span {
    display: block;
    font: 600 .92rem/1.25 "Poppins", system-ui, sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ------------------------------------------------------------
   08 · SOUND DOCK
------------------------------------------------------------ */
.cin-dock {
    position: fixed;
    left: 14px;
    bottom: 14px;
    z-index: 1050;
    display: flex;
    gap: 8px;
    opacity: 0;
    translate: 0 16px;
    transition: opacity .7s ease 1s, translate .8s var(--cin-ease) 1s;
}

html.cin-ready .cin-dock,
html:not(.cin-js) .cin-dock {
    opacity: 1;
    translate: 0 0;
}

.cin-btn {
    position: relative;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    background: var(--cin-ink);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(4, 23, 15, .3);
    transition: scale .3s var(--cin-ease), background .3s ease, color .3s ease;
}

.cin-btn:hover {
    scale: 1.08;
}

.cin-btn:active {
    scale: .92;
}

.cin-btn:focus-visible {
    outline: 2px solid var(--cin-gold);
    outline-offset: 3px;
}

.cin-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cin-btn[aria-pressed="true"] {
    color: var(--cin-gold);
}

/* Slash through the icon when muted */
.cin-btn[aria-pressed="false"]::after {
    content: "";
    position: absolute;
    width: 24px;
    height: 2px;
    border-radius: 2px;
    background: #ff7a7a;
    rotate: -45deg;
}

/* Little equaliser pulse while the score plays */
.cin-btn[data-cin="music"][aria-pressed="true"] svg {
    animation: cinPulse 1.6s ease-in-out infinite;
}

@keyframes cinPulse {
    0%, 100% { scale: 1; }
    50%      { scale: 1.18; }
}


/* ------------------------------------------------------------
   09 · CLICK RING + PRESS FEEDBACK
------------------------------------------------------------ */
.cin-ring {
    position: fixed;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid var(--cin-gold);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99980;
    animation: cinRing .75s var(--cin-ease) forwards;
}

@keyframes cinRing {
    from {
        scale: 1;
        opacity: .95;
    }
    to {
        scale: 7;
        opacity: 0;
    }
}

a.btn:active,
button.btn:active,
.btn:active,
.nav-link:active,
.dropdown-item:active,
.slider-btn:active,
.testimonial-slider-btn:active {
    scale: .96;
}


/* ------------------------------------------------------------
   10 · RESPONSIVE
------------------------------------------------------------ */
@media (min-width: 992px) {
    .cin-rail {
        display: flex;
    }
}

@media (max-width: 767.98px) {
    .cin-up    { translate: 0 34px;  rotate: none; scale: .98; }
    .cin-left  { translate: -24px 0; rotate: none; }
    .cin-right { translate: 24px 0;  rotate: none; }
    .cin-blur  { filter: blur(7px); translate: 0 20px; }

    .cin-btn {
        width: 38px;
        height: 38px;
    }

    .cin-dock {
        left: 10px;
        bottom: 12px;
    }

    .cin-cap {
        left: 10px;
        bottom: 60px;
        padding: 8px 12px 9px 11px;
    }

    .cin-cap span {
        font-size: .8rem;
    }

    .cin-grain {
        opacity: .04;
    }

    html.cin-js::before {
        letter-spacing: .2em;
        text-indent: .2em;
    }
}

@media (max-width: 575.98px) {
    .cin-prog {
        height: 2px;
    }
}

/* Short landscape phones: keep the HUD out of the way */
@media (max-height: 460px) {
    .cin-cap {
        display: none;
    }
}


/* ------------------------------------------------------------
   11 · REDUCED MOTION
------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .cin-grain,
    .cin-canvas,
    .cin-kbw,
    .cin-ring,
    .cin-cap {
        display: none !important;
    }

    .cin-r {
        opacity: 1 !important;
        translate: none !important;
        rotate: none !important;
        scale: none !important;
        filter: none !important;
        clip-path: none !important;
        transition: none !important;
    }

    .cin-dock {
        opacity: 1;
        translate: 0 0;
        transition: none;
    }
}
