/*
  Tela de carregamento global — a logo com um anel girando, a página atrás
  borrada e escurecida.

  Marcação: templates/components/loading.html
  Comportamento: static/js/loading.js
*/

.oi-loading {
    position: fixed;
    inset: 0;
    /* Acima de tudo: o modal de feedback é z-400, e ele também dispara pedidos. */
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    /* Só a saída é transição. A entrada é a animação abaixo: o elemento sai de
       `display: none` e não tem estado anterior de onde uma transição partiria. */
    transition: opacity .2s ease;
}

/* Precisa vencer o `display: flex` de cima — por isso o seletor com o atributo. */
.oi-loading[hidden] { display: none; }

.oi-loading.is-ativo {
    opacity: 1;
    animation: oiLoadingEntrar .16s ease-out;
}

.oi-loading__veu {
    position: absolute;
    inset: 0;
    background: rgba(39, 39, 42, .45);
    backdrop-filter: blur(6px) saturate(.85);
    -webkit-backdrop-filter: blur(6px) saturate(.85);
}

.dark .oi-loading__veu { background: rgba(9, 9, 11, .64); }

.oi-loading__caixa {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.oi-loading__marca {
    position: relative;
    width: 132px;
    height: 132px;
    display: grid;
    place-items: center;
}

.oi-loading__anel {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.oi-loading__trilho {
    fill: none;
    stroke: rgba(255, 255, 255, .2);
    stroke-width: 4;
}

/* Presentation attribute perde para qualquer regra CSS — o anel de dentro
   precisa da sua própria classe para ser mais fino. */
.oi-loading__trilho--interno { stroke-width: 2.5; }

.oi-loading__arco {
    fill: none;
    stroke: #f97316;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 85 255;
    /* O SVG não tem caixa de layout própria: a origem vai no centro do viewBox. */
    transform-origin: 60px 60px;
    animation: oiLoadingGirar 1.1s linear infinite;
}

/* O segundo anel gira ao contrário e mais devagar — é o que dá profundidade. */
.oi-loading__arco--interno {
    stroke: #fdba74;
    stroke-width: 2.5;
    stroke-dasharray: 42 235;
    animation-duration: 2.4s;
    animation-direction: reverse;
}

.oi-loading__logo {
    width: 76px;
    height: 76px;
    object-fit: contain;
    /*
      A logo é transparente e o telhado dela é escuro, do tom do véu. O halo
      recorta a silhueta contra o fundo — é o que separa os dois sem inventar
      uma placa branca por trás.
    */
    filter: drop-shadow(0 0 16px rgba(255, 255, 255, .5))
            drop-shadow(0 10px 26px rgba(0, 0, 0, .45));
    animation: oiLoadingPulso 2.4s ease-in-out infinite;
}

.oi-loading__texto {
    margin-top: 20px;
    max-width: 15rem;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-size: .875rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: #fafafa;
    text-shadow: 0 1px 14px rgba(0, 0, 0, .45);
    animation: oiLoadingRespirar 2.4s ease-in-out infinite;
}

@keyframes oiLoadingEntrar {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes oiLoadingGirar {
    to { transform: rotate(360deg); }
}

@keyframes oiLoadingPulso {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

@keyframes oiLoadingRespirar {
    0%, 100% { opacity: .72; }
    50%      { opacity: 1; }
}

/* Quem pediu menos movimento continua vendo que algo carrega — só mais calmo. */
@media (prefers-reduced-motion: reduce) {
    .oi-loading__arco { animation-duration: 2.6s; }
    .oi-loading__arco--interno { animation-duration: 4.2s; }
    .oi-loading__logo,
    .oi-loading__texto { animation: none; }
}
