/* Notch do /bio — o do app Notchly, preso ao topo da página (notch.js).
   Fechado: seção atual e anel de leitura; com música, capa e efeito na cor dela. Aberto: Nook (player) e Menu. */

.nt {
  --w: 224px; --h: 34px; --r: 14px;
  --cor: #9db1ff;
  --capa: linear-gradient(140deg, #2a1b8f, #8f7bff 55%, #f5b6ff);
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 60;
  view-transition-name: nt; /* na troca de página, o notch fica parado enquanto o resto muda */
  width: var(--w);
  height: var(--h);
  transform: translateX(calc(-50% + var(--puxa, 0px)));
  border-radius: 0 0 var(--r) var(--r);
  color: #fff;
  font-family: var(--sans);
  /* fica escondido até o JS medir; depois anima com mola, como no app */
  opacity: 0;
}
.nt.pronto {
  opacity: 1;
  transition:
    width 0.46s cubic-bezier(0.25, 1.15, 0.4, 1),
    height 0.46s cubic-bezier(0.25, 1.15, 0.4, 1),
    border-radius 0.42s cubic-bezier(0.2, 0.9, 0.2, 1),
    transform 0.3s cubic-bezier(0.2, 0.9, 0.2, 1),
    box-shadow 0.4s, opacity 0.3s;
}
/* orelhas côncavas ligando o notch à borda da tela */
.nt::before, .nt::after { content: ""; position: absolute; top: 0; width: 10px; height: 10px; pointer-events: none; }
.nt::before { left: -10px; background: radial-gradient(circle at 0 100%, transparent 9.5px, #000 10px); }
.nt::after { right: -10px; background: radial-gradient(circle at 100% 100%, transparent 9.5px, #000 10px); }
/* sobre o fundo escuro, uma borda fina mostra onde o notch termina */
/* o preto fica no recorte: o brilho (z-index -1) passa por baixo dele, não por cima */
.nt-clip {
  position: absolute; inset: 0; overflow: hidden; border-radius: inherit; background: #000;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.14), inset 1px 0 0 rgba(255, 255, 255, 0.06), inset -1px 0 0 rgba(255, 255, 255, 0.06);
}
.nt[data-state="open"] { --r: 28px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6); }
.nt[data-state="aviso"] { --r: 18px; }
.nt[data-state="musica"] { --r: 16px; }

/* brilho embaixo do notch, na cor da capa, pulsando com a música */
.nt-glow {
  position: absolute; left: 12%; right: 12%; top: 40%; height: 70%;
  border-radius: 50%;
  background: var(--cor);
  filter: blur(22px);
  opacity: 0;
  transition: opacity 0.6s, background 0.8s;
  pointer-events: none;
  z-index: -1;
}
.nt.tocando .nt-glow { opacity: calc(var(--pulso, 0.6) * 0.55); }
.nt[data-state="open"] .nt-glow { opacity: 0.18; }

/* ---------- Fechado ---------- */
.nt-body {
  position: absolute; inset: 0 0 auto 0; height: var(--h);
  cursor: pointer; outline: none;
  -webkit-tap-highlight-color: transparent;
}
.nt-body:focus-visible { box-shadow: inset 0 0 0 2px #9db1ff; border-radius: 0 0 var(--r) var(--r); }
.nt[data-state="open"] .nt-body { pointer-events: none; }
.nt-closed {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; gap: 6px;
  padding: 0 10px;
  transition: opacity 0.2s;
}
.nt[data-state="open"] .nt-closed { opacity: 0; }
.nt-l, .nt-r { display: flex; align-items: center; justify-content: center; height: 100%; }
.nt-c { min-width: 0; text-align: center; overflow: hidden; }
.nt-label {
  display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font: 600 12px/1 var(--sans); letter-spacing: 0.01em; color: rgba(255, 255, 255, 0.86);
}
.nt-label.faixa { color: #fff; font-weight: 600; }
.nt-label.faixa::before { content: "♪ "; color: var(--cor); }
.mini-foto { width: 20px; height: 20px; border-radius: 50%; background: url("icons/avatar-foto.jpg") center / cover, #222; }
.mini-capa { width: 20px; height: 20px; border-radius: 5px; background: var(--capa) center / cover; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08); }
.nt-r canvas { width: 30px; height: 16px; display: block; }
.anel { width: 17px; height: 17px; transform: rotate(-90deg); }
.anel circle { fill: none; stroke: rgba(255, 255, 255, 0.18); stroke-width: 2.4; }
.anel .fill { stroke: #fff; stroke-linecap: round; stroke-dasharray: 47.1; stroke-dashoffset: calc(47.1 * (1 - var(--lido, 0))); }
.nt-closed .in { animation: nt-in 0.38s cubic-bezier(0.2, 0.9, 0.2, 1); }
@keyframes nt-in { from { opacity: 0; transform: scale(0.75); filter: blur(4px); } }

/* ---------- Aberto ---------- */
.nt-open {
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  padding: 0 16px 16px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.12s, visibility 0s linear 0.12s;
}
.nt[data-state="open"] .nt-open { opacity: 1; visibility: visible; transition: opacity 0.3s 0.1s, visibility 0s; }
.nt-tabs { height: 40px; display: flex; align-items: center; gap: 4px; }
.nt-tabs button {
  all: unset; cursor: pointer;
  padding: 4px 11px; border-radius: 999px;
  font: 600 12px/1.2 var(--sans); color: rgba(255, 255, 255, 0.55);
  transition: background 0.2s, color 0.2s;
}
.nt-tabs button[aria-selected="true"] { background: rgba(255, 255, 255, 0.13); color: #fff; }
.nt-tabs button:hover, .nt-tabs button:focus-visible { color: #fff; }
.nt-page { display: flex; gap: 10px; animation: nt-page 0.32s cubic-bezier(0.2, 0.9, 0.2, 1); }
.nt-page[hidden] { display: none; }
@keyframes nt-page { from { opacity: 0; transform: translateY(6px); } }

.nw { border-radius: 18px; background: rgba(255, 255, 255, 0.07); padding: 12px; display: flex; gap: 12px; min-width: 0; }
.nt[data-state="open"] .nw { animation: nt-w 0.45s cubic-bezier(0.2, 0.9, 0.2, 1) both; }
.nt[data-state="open"] .nw + .nw { animation-delay: 0.06s; }
@keyframes nt-w { from { opacity: 0; transform: translateY(14px) scale(0.95); } }

.nw-media { flex: 1; align-items: center; }
.nt-art {
  position: relative; flex: none;
  width: 76px; height: 76px; border-radius: 14px; overflow: hidden;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.nt-art i { position: absolute; inset: 0; background: var(--capa) center / cover; transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.2, 1); }
.nt.tocando .nt-art i { transform: scale(1.06); }
.nt-track { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; font-size: 12px; }
.nt-track b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nt-track [data-artist] { color: rgba(255, 255, 255, 0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nt-scrub { position: relative; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); margin-top: 9px; cursor: pointer; }
.nt-scrub::after { content: ""; position: absolute; inset: -8px 0; } /* área de toque maior que a barra */
.nt-scrub i { display: block; height: 100%; width: 0; background: #fff; border-radius: inherit; }
.nt-times { display: flex; justify-content: space-between; margin-top: 4px; font: 500 10px/1 var(--mono); color: rgba(255, 255, 255, 0.45); font-variant-numeric: tabular-nums; }
.nt-ctrl { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 6px; }
.nt-ctrl button {
  all: unset; cursor: pointer;
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%;
  transition: background 0.2s, transform 0.15s;
}
.nt-ctrl button.big { width: 34px; height: 34px; }
.nt-ctrl button:hover, .nt-ctrl button:focus-visible { background: rgba(255, 255, 255, 0.12); }
.nt-ctrl button:active { transform: scale(0.86); }
.nt-ctrl svg { width: 13px; height: 13px; fill: #fff; }
.nt-ctrl .big svg { width: 16px; height: 16px; }
.nt-ctrl svg[hidden] { display: none; }
.nt.carregando [data-cmd="play"] { animation: nt-carrega 0.9s ease-in-out infinite alternate; }
@keyframes nt-carrega { to { background: rgba(255, 255, 255, 0.2); } }

.nw-fx { width: 132px; flex: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.nw-fx b { font-size: 12px; color: rgba(255, 255, 255, 0.7); font-weight: 600; }
.nt-fx {
  all: unset; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 12px;
  font: 600 12px/1 var(--sans); color: #fff;
  transition: background 0.2s, transform 0.15s;
}
.nt-fx:hover, .nt-fx:focus-visible { background: rgba(255, 255, 255, 0.1); }
.nt-fx:active { transform: scale(0.94); }
.nt-fx canvas { width: 44px; height: 22px; display: block; }
.nt-keys { font-size: 10px; line-height: 1.35; color: rgba(255, 255, 255, 0.4); }

.nt-menu { flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; padding: 2px 0 4px; }
.nt-menu a {
  padding: 8px 13px; border-radius: 999px;
  font-size: 14px; color: rgba(255, 255, 255, 0.72); text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.nt-menu a:hover, .nt-menu a:focus-visible { color: #fff; background: rgba(255, 255, 255, 0.1); }
.nt-sep { flex-basis: 100%; height: 0; }

/* o botão de compartilhar some enquanto o notch largo passa por cima dele */
/* o que fica nos cantos do topo (compartilhar, voltar): data-notch-desvia sai de cena quando o notch largo passa */
[data-notch-desvia] { transition: opacity 0.25s; }
/* só opacidade: mudar o tamanho mudaria a medida que decide se ele sai */
.nt-desviado { opacity: 0 !important; pointer-events: none; }

/* sem som: a cada poucos segundos o notch "cai" um pouco e volta, como um aviso do app */
.nt.mudo:not([data-state="open"]) .nt-clip { animation: nt-chama 5s cubic-bezier(0.2, 0.9, 0.2, 1) 1.5s infinite; transform-origin: top center; }
.nt.mudo:not([data-state="open"]) .nt-glow { animation: nt-brilha 5s ease-out 1.5s infinite; }
@keyframes nt-chama {
  0%, 84%, 100% { transform: none; }
  88% { transform: scaleY(1.32); }
  92% { transform: scaleY(0.94); }
  96% { transform: scaleY(1.06); }
}
@keyframes nt-brilha {
  0%, 84%, 100% { opacity: 0.15; }
  89% { opacity: 0.75; }
}

/* pílula "toque para ouvir": sobe do pé da tela quando a pessoa rola com a música sem som */
.som-pill {
  all: unset; box-sizing: border-box; cursor: pointer;
  position: fixed; z-index: 55; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  max-width: min(92vw, 360px); padding: 10px 16px 10px 12px; border-radius: 999px;
  background: rgba(12, 12, 18, 0.82); border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px color-mix(in srgb, var(--cor, #9db1ff) 25%, transparent);
  color: #fff; font: 600 14px/1.2 var(--sans);
  translate: -50% 140%; opacity: 0;
  transition: translate 0.5s cubic-bezier(0.25, 1.15, 0.4, 1), opacity 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.som-pill.on { translate: -50% 0; opacity: 1; }
.som-pill:active { scale: 0.96; }
.som-pill > span:nth-child(2) { flex: none; white-space: nowrap; }
.som-pill small { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; font-size: 12px; color: rgba(255, 255, 255, 0.55); }
.som-bars { display: flex; align-items: center; gap: 2px; height: 16px; flex: none; }
.som-bars i { width: 3px; height: 100%; border-radius: 2px; background: var(--cor, #9db1ff); animation: som-eq 0.8s ease-in-out infinite alternate; }
.som-bars i:nth-child(2) { animation-duration: 0.55s; animation-delay: -0.2s; }
.som-bars i:nth-child(3) { animation-duration: 0.7s; animation-delay: -0.4s; }
@keyframes som-eq { from { transform: scaleY(0.25); } to { transform: scaleY(1); } }

/* player do YouTube: fora da tela, o notch é o controle */
.yt-host { position: fixed; left: -10000px; top: 0; width: 200px; height: 200px; opacity: 0; pointer-events: none; }

/* celular: o Nook empilha e o efeito vira uma linha */
@media (max-width: 559px) {
  .nt-page[data-page="nook"] { flex-direction: column; }
  .nw-fx { width: auto; flex-direction: row; justify-content: space-between; padding: 8px 12px; }
  .nt-fx { flex-direction: row; padding: 6px 10px; }
  .nt-art { width: 68px; height: 68px; }
  .nt-keys .fino { display: none; }
}
@media (hover: none) { .nt-keys .fino { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .nt.pronto { transition: opacity 0.2s; }
  .nt-glow { display: none; }
  .nt.mudo .nt-clip { animation: none; }
  .som-pill { transition: opacity 0.2s; }
}
