/* ============================================================
   Spheria Hub — Orbital Slider  v2
   ============================================================ */

/* ------------------------------------------------------------------
   Reset de contexto
------------------------------------------------------------------ */
.spheria-slider *,
.spheria-slider *::before,
.spheria-slider *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ------------------------------------------------------------------
   Custom properties
------------------------------------------------------------------ */
.spheria-slider {
    --sph-bg:       #08080f;
    --sph-text:     #ffffff;
    --sph-muted:    #9896b0;
    --sph-accent:   #3FA9F5;
    --sph-pad-x:    clamp(32px, 7vw, 100px);
    --sph-ease:     cubic-bezier(.4, 0, .2, 1);
    --sph-dur:      .7s;
}

/* ------------------------------------------------------------------
   Wrapper
------------------------------------------------------------------ */
.spheria-slider {
    position:         relative;
    width:            100%;
    min-height:       620px;
    height:           68vh;
    max-height:       820px;
    background:       var(--sph-bg);
    overflow:         hidden;
    font-family:      'Plus Jakarta Sans', 'DM Sans', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    user-select:      none;
}

/* grain */
.sph-grain {
    position:   absolute;
    inset:      0;
    z-index:    1;
    pointer-events: none;
    opacity:    .04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='250' height='250' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 250px 250px;
}

/* faint grid lines */
.spheria-slider::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 80px 80px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
}

/* ------------------------------------------------------------------
   Track + Slides
------------------------------------------------------------------ */
.sph-track {
    position: relative;
    width:    100%;
    height:   100%;
    z-index:  2;
}

.sph-slide {
    position:   absolute;
    inset:      0;
    display:    flex;
    align-items: center;
    padding:    0 var(--sph-pad-x);
    gap:        clamp(40px, 6vw, 80px);
    opacity:    0;
    pointer-events: none;
    transition: opacity var(--sph-dur) var(--sph-ease);
    will-change: opacity;
}

.sph-slide--active {
    opacity: 1;
    pointer-events: auto;
}

/* ------------------------------------------------------------------
   LEFT — Conteúdo
------------------------------------------------------------------ */
.sph-slide__content {
    flex:         1;
    min-width:    0;
    max-width:    560px;
    display:      flex;
    flex-direction: column;
    gap:          28px;
    padding-bottom: 48px; /* espaço da progress bar */
}

/* animações stagger — reset ao sair */
.sph-slide__label,
.sph-slide__title,
.sph-slide__desc,
.sph-slide__cta {
    opacity:   0;
    transform: translateY(22px);
    animation: none;
}

.sph-slide--active .sph-slide__label { animation: sph-up .55s var(--sph-ease) .08s forwards; }
.sph-slide--active .sph-slide__title  { animation: sph-up .6s  var(--sph-ease) .2s  forwards; }
.sph-slide--active .sph-slide__desc   { animation: sph-up .55s var(--sph-ease) .34s forwards; }
.sph-slide--active .sph-slide__cta    { animation: sph-up .5s  var(--sph-ease) .48s forwards; }

@keyframes sph-up {
    to { opacity: 1; transform: translateY(0); }
}

/* Label */
.sph-slide__label {
    display:        inline-flex;
    align-self:     flex-start;
    padding:        6px 16px;
    border:         1px solid currentColor;
    border-radius:  2px;
    font-family:    'DM Sans', sans-serif;
    font-size:      11px;
    font-weight:    600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
}

/* Title */
.sph-slide__title {
    font-family:  'Plus Jakarta Sans', sans-serif;
    font-size:    clamp(2.2rem, 4.2vw, 4.4rem);
    font-weight:  800;
    line-height:  1.06;
    color:        var(--sph-text);
    letter-spacing: -.02em;
}

/* Desc */
.sph-slide__desc {
    font-family: 'DM Sans', sans-serif;
    font-size:   clamp(14px, 1.1vw, 17px);
    line-height: 1.7;
    color:       var(--sph-muted);
    max-width:   460px;
}

/* CTA */
.sph-slide__cta {
    display:         inline-flex;
    align-self:      flex-start;
    align-items:     center;
    gap:             12px;
    padding:         14px 30px;
    border:          1.5px solid currentColor;
    border-radius:   3px;
    font-family:     'DM Sans', sans-serif;
    font-size:       14px;
    font-weight:     600;
    letter-spacing:  .4px;
    text-decoration: none;
    position:        relative;
    overflow:        hidden;
    transition:      color .3s var(--sph-ease), box-shadow .3s var(--sph-ease);
    z-index:         0;
}

/* fill animado no hover */
.sph-slide__cta::before {
    content:    '';
    position:   absolute;
    inset:      0;
    background: currentColor;
    transform:  scaleX(0);
    transform-origin: left;
    transition: transform .32s var(--sph-ease);
    z-index:    -1;
}

.sph-slide__cta:hover::before { transform: scaleX(1); }
.sph-slide__cta:hover {
    color:      #000 !important;
    box-shadow: 0 0 24px color-mix(in srgb, currentColor 30%, transparent);
}

/* ------------------------------------------------------------------
   RIGHT — Orb / Visual
------------------------------------------------------------------ */
.sph-slide__visual {
    flex-shrink: 0;
    width:       clamp(280px, 38vw, 500px);
    aspect-ratio: 1;
    display:     flex;
    align-items: center;
    justify-content: center;
    position:    relative;
}

/* container que recebe o mouse-tracking transform */
.sph-slide__orb-wrap {
    width:     100%;
    height:    100%;
    position:  relative;
    will-change: transform;
    transition: transform .08s linear; /* suavização mínima p/ tracking */
}

/* orb shape */
.sph-slide__orb {
    width:     100%;
    height:    100%;
    position:  relative;
    border-radius: 62% 38% 55% 45% / 48% 60% 40% 52%;
    overflow:  hidden;
    transition:
        clip-path var(--sph-dur) var(--sph-ease),
        border-radius .8s var(--sph-ease),
        box-shadow .4s var(--sph-ease);
    will-change: clip-path;
}

/* entrada com clip-path */
.sph-slide--active .sph-slide__orb {
    animation: sph-orb-in var(--sph-dur) var(--sph-ease) .05s both;
}

.sph-slide:not(.sph-slide--active) .sph-slide__orb {
    clip-path: circle(0% at 50% 50%);
}

@keyframes sph-orb-in {
    from { clip-path: circle(0% at 50% 50%); }
    to   { clip-path: circle(50% at 50% 50%); }
}

.sph-slide__orb img {
    width:      100%;
    height:     100%;
    object-fit: cover;
    display:    block;
    transition: transform .6s var(--sph-ease);
}

/* hover na imagem — leve zoom */
.sph-slide--active .sph-slide__visual:hover .sph-slide__orb img {
    transform: scale(1.06);
}

/* glow dinâmico — cor vem do JS via --accent no .sph-slide */
.sph-slide__orb::after {
    content:  '';
    position: absolute;
    inset:    -1px;
    border-radius: inherit;
    border:   1px solid color-mix(in srgb, var(--accent, #3FA9F5) 35%, transparent);
    pointer-events: none;
}

/* halo externo */
.sph-slide__visual::before {
    content:       '';
    position:      absolute;
    inset:         -12%;
    border-radius: 50%;
    background:    radial-gradient(
        circle,
        color-mix(in srgb, var(--accent, #3FA9F5) 14%, transparent) 0%,
        transparent 70%
    );
    pointer-events: none;
    transition:    background .5s var(--sph-ease);
    z-index:       -1;
}

/* hover state — halo intensifica */
.sph-slide--active .sph-slide__visual:hover::before {
    background: radial-gradient(
        circle,
        color-mix(in srgb, var(--accent, #3FA9F5) 22%, transparent) 0%,
        transparent 70%
    );
}

/* anel giratório decorativo */
.sph-slide__ring {
    position:       absolute;
    inset:          -8%;
    border-radius:  50%;
    border:         1px solid color-mix(in srgb, var(--accent, #3FA9F5) 18%, transparent);
    animation:      sph-ring 8s linear infinite;
    pointer-events: none;
}

.sph-slide__ring:nth-child(2) {
    inset:  -18%;
    border-color: color-mix(in srgb, var(--accent, #3FA9F5) 10%, transparent);
    animation-duration: 14s;
    animation-direction: reverse;
}

@keyframes sph-ring {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------
   Arrows — minimalistas, SEM caixa
------------------------------------------------------------------ */
.sph-arrow {
    position:    absolute;
    top:         50%;
    transform:   translateY(-50%);
    z-index:     20;
    background:  transparent;
    border:      none;
    color:       rgba(255, 255, 255, .35);
    cursor:      pointer;
    padding:     0;
    line-height: 0;
    transition:  color .25s var(--sph-ease), transform .25s var(--sph-ease);
}

.sph-arrow svg {
    display: block;
    width:   32px;
    height:  32px;
    stroke-width: 1.2;
}

.sph-arrow--prev { left:  clamp(12px, 2vw, 28px); }
.sph-arrow--next { right: clamp(12px, 2vw, 28px); }

.sph-arrow:hover {
    color: rgba(255, 255, 255, .9);
}

.sph-arrow--prev:hover { transform: translateY(-50%) translateX(-3px); }
.sph-arrow--next:hover { transform: translateY(-50%) translateX(3px); }

/* ------------------------------------------------------------------
   Dots — traço ativo vs ponto inativo
------------------------------------------------------------------ */
.sph-dots {
    position:   absolute;
    bottom:     28px;
    left:       var(--sph-pad-x);
    z-index:    20;
    display:    flex;
    align-items: center;
    gap:        8px;
}

.sph-dot {
    display:    block;
    height:     2px;
    width:      8px;
    background: rgba(255, 255, 255, .25);
    border:     none;
    border-radius: 2px;
    cursor:     pointer;
    padding:    0;
    transition: width .35s var(--sph-ease), background .35s var(--sph-ease), opacity .35s;
}

.sph-dot--active {
    width:      32px;
    background: #fff;
}

/* ------------------------------------------------------------------
   Progress bar — base
------------------------------------------------------------------ */
.sph-progress {
    position:   absolute;
    bottom:     0;
    left:       0;
    right:      0;
    height:     2px;
    background: rgba(255,255,255,.05);
    z-index:    20;
    overflow:   hidden;
}

.sph-progress__bar {
    height:           100%;
    width:            0%;
    background:       var(--sph-accent);
    animation:        sph-prog linear forwards paused;
    transform-origin: left;
}

.spheria-slider[data-playing="true"] .sph-progress__bar {
    animation-play-state: running;
}

@keyframes sph-prog {
    from { width: 0%; }
    to   { width: 100%; }
}

/* ------------------------------------------------------------------
   Slide number (decorativo, canto inferior direito)
------------------------------------------------------------------ */
.sph-counter {
    position:    absolute;
    bottom:      22px;
    right:       var(--sph-pad-x);
    z-index:     20;
    font-family: 'DM Sans', sans-serif;
    font-size:   12px;
    font-weight: 500;
    color:       rgba(255,255,255,.2);
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------
   No results
------------------------------------------------------------------ */
.spheria-no-results {
    padding:     60px 40px;
    text-align:  center;
    color:       #666;
    font-family: 'DM Sans', sans-serif;
}

/* ------------------------------------------------------------------
   Scroll reveal — usado em todas as seções do site via JS
------------------------------------------------------------------ */
.sph-scroll-reveal {
    opacity:    0;
    transition: opacity .7s var(--sph-ease), transform .7s var(--sph-ease);
}

.sph-scroll-reveal[data-dir="up"]   { transform: translateY(40px); }
.sph-scroll-reveal[data-dir="down"] { transform: translateY(-40px); }
.sph-scroll-reveal[data-dir="left"] { transform: translateX(40px); }
.sph-scroll-reveal[data-dir="right"]{ transform: translateX(-40px); }
.sph-scroll-reveal[data-dir="scale"]{ transform: scale(.94); }

.sph-scroll-reveal.sph-revealed {
    opacity:   1;
    transform: none;
}

/* ------------------------------------------------------------------
   Responsive — Tablet ≤ 960px
------------------------------------------------------------------ */
@media (max-width: 960px) {
    .spheria-slider {
        height:     auto;
        min-height: 0;
        max-height: none;
    }

    .sph-track { position: static; }

    /* Oculta todos, mostra só o ativo */
    .sph-slide {
        display: none;
        position: static;
        flex-direction: column-reverse;
        align-items: center;
        padding: 56px var(--sph-pad-x) 80px;
        gap: 40px;
    }

    .sph-slide--active { display: flex; }

    .sph-slide__content {
        max-width:    100%;
        text-align:   center;
        align-items:  center;
        padding-bottom: 0;
    }

    .sph-slide__desc { max-width: 520px; }

    .sph-slide__visual {
        width:       clamp(220px, 60vw, 360px);
    }
}

/* ------------------------------------------------------------------
   Responsive — Mobile ≤ 580px
------------------------------------------------------------------ */
@media (max-width: 580px) {
    .spheria-slider { --sph-pad-x: 24px; }

    .sph-slide {
        padding: 40px var(--sph-pad-x) 72px;
        gap:     28px;
    }

    .sph-slide__visual {
        width:       100%;
        max-width:   280px;
    }

    .sph-slide__ring { display: none; }

    .sph-arrow { display: none; }

    .sph-dots {
        left:      50%;
        transform: translateX(-50%);
    }

    .sph-counter { display: none; }
}
