/* Coro das Ovelhas, o segredo da Serra (página /piano) */

.page--piano main { padding: 0 var(--gutter); }
.coro { max-width: 1180px; margin: 0 auto; text-align: center; }
.coro__head { max-width: 780px; margin: 4px auto 6px; }
.title--coro { font-size: clamp(2.7rem, 10vw, 5.6rem); margin: .08em 0 .16em; }
.coro__lead { max-width: 620px; margin: 0 auto; font-size: clamp(1.02rem, 2.8vw, 1.2rem); text-shadow: 0 2px 10px rgba(10, 5, 40, .9); }

/* ------------------------------------------------------------------ palco */

.coro__stage {
  position: relative; margin: clamp(10px, 3vh, 26px) auto 0;
  display: grid; grid-template-columns: minmax(0, 1fr); align-items: end; gap: 6px;
}
.coro__maestra { position: relative; display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: flex-end; gap: 10px; justify-self: start; z-index: 3; }
.maestra { position: relative; width: 92px; flex: none; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.maestra .estrela { width: 100%; }
.maestra__baton {
  position: absolute; right: 2%; bottom: 13%; width: 46%; height: 4px; border-radius: 3px;
  background: linear-gradient(90deg, #6b3d2a 0 26%, #fff6e3 26%); box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  transform-origin: 6% 50%; transform: rotate(-38deg); transition: transform .12s var(--ease-out);
}
.maestra__baton::after { content: ""; position: absolute; right: -3px; top: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px 3px rgba(255, 200, 61, .7); }
.coro.is-beat .maestra__baton { transform: rotate(-4deg); }
.bubble--maestra { flex: 0 1 auto; max-width: 260px; margin-bottom: 52px; font-size: 1.1rem; transform: rotate(-1.5deg); text-align: left; }
.bubble--maestra::after { left: -14px; bottom: 14px; clip-path: polygon(100% 0, 100% 100%, 0 70%); }

/* o rebanho: uma fila no computador, duas filas (como um coro de verdade) no telemóvel */
.coro__flock { position: relative; width: 100%; max-width: 860px; justify-self: center; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; padding: 0 2px; touch-action: none; }
.coro__flock .sheep { grid-column: span 2; padding: 0 2px 6px; display: flex; flex-direction: column; align-items: center; touch-action: none; }
.coro__flock .sheep:nth-child(-n+6) { grid-row: 2; }
.coro__flock .sheep:nth-child(n+7) { grid-row: 1; margin-bottom: -8px; }
.coro__flock .sheep:nth-child(7) { grid-column: 2 / span 2; }
.coro__flock .sheep:nth-child(8) { grid-column: 4 / span 2; }
.coro__flock .sheep:nth-child(9) { grid-column: 6 / span 2; }
.coro__flock .sheep:nth-child(10) { grid-column: 8 / span 2; }
.coro__flock .sheep:nth-child(11) { grid-column: 10 / span 2; }
.coro__flock .sheep__svg { width: calc(var(--s) * 116%); margin: 0 -8% -6%; }
/* um monte de neve debaixo de cada ovelha: juntos fazem a bancada do coro */
.coro__flock .sheep::before {
  content: ""; position: absolute; left: -14%; right: -14%; bottom: 0; height: 46px; z-index: -1;
  background: radial-gradient(ellipse at 50% 30%, var(--snow) 55%, #c9d8f6 100%);
  border-radius: 50% 50% 14px 14px / 70% 70% 14px 14px;
}
.sheep__name {
  position: relative; display: inline-block; margin-top: 4px; padding: .32em .7em .36em; border-radius: 999px;
  font: 400 clamp(.82rem, 2.6vw, 1.05rem)/1 var(--display); color: #fff; background: var(--c);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .3); box-shadow: 0 3px 0 rgba(12, 6, 48, .25);
}
.sheep__key { display: none; }
.sheep__cue { position: absolute; left: 50%; top: -6px; width: 26px; height: 26px; margin-left: -13px; opacity: 0; pointer-events: none; z-index: 2; }
.sheep__cue::before {
  content: ""; position: absolute; inset: 0; background: var(--gold);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  filter: drop-shadow(0 0 6px rgba(255, 200, 61, .9));
}
.sheep:focus-visible { outline-offset: -2px; border-radius: 18px; }

/* aprender: a próxima ovelha brilha e tem uma estrela a saltar por cima */
.sheep.is-next .sheep__cue { opacity: 1; animation: cue 0.8s ease-in-out infinite alternate; }
.sheep.is-next::after {
  content: ""; position: absolute; left: 4%; right: 4%; bottom: 0; height: 30px; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 216, 92, .95), rgba(255, 200, 61, 0)); animation: glow 0.8s ease-in-out infinite alternate;
}
.sheep.is-nudge .sheep__svg { animation: nudge .45s ease-in-out; }
@keyframes cue { from { transform: translateY(0) rotate(-10deg) scale(1); } to { transform: translateY(-10px) rotate(10deg) scale(1.12); } }
@keyframes glow { from { opacity: .55; transform: scaleX(.9); } to { opacity: 1; transform: scaleX(1.08); } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6%); } 50% { transform: translateX(6%); } 75% { transform: translateX(-3%); } }

/* notas a voar */
.coro__fx { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: visible; }
.fly {
  position: absolute; left: 0; top: 0; width: 26px; height: 30px; margin: -15px 0 0 -13px; color: var(--c);
  filter: drop-shadow(0 2px 0 rgba(12, 6, 48, .35)); animation: fly 1.15s var(--ease-out) forwards;
}
.fly svg { width: 100%; height: 100%; }
@keyframes fly {
  0% { transform: translate(0, 0) scale(.4) rotate(0); opacity: 0; }
  15% { opacity: 1; transform: translate(calc(var(--dx) * .2), -14px) scale(1.1) rotate(calc(var(--r) * .3)); }
  100% { transform: translate(var(--dx), -90px) scale(.8) rotate(var(--r)); opacity: 0; }
}

/* a dormir: olhos fechados, cabeça caída e uns "z" no ar */
.coro.is-asleep .sheep__eyes--open { display: none; }
.coro.is-asleep .sheep__eyes--sleep { display: inline; }
.coro.is-asleep .sheep__head { transform: rotate(7deg) translateY(3px); }
.coro.is-asleep .sheep__body { animation-duration: 4.6s; }
.coro.is-asleep .sheep:nth-child(3n+1) .sheep__cue::after {
  content: "z"; position: absolute; left: 70%; top: -4px; font: 400 1.3rem/1 var(--display); color: #fff; opacity: 0;
  animation: zzz 2.6s ease-out infinite; animation-delay: var(--d);
}
.coro.is-asleep .sheep__cue { opacity: 1; }
.coro.is-asleep .sheep__cue::before { display: none; }
@keyframes zzz { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(18px, -40px) scale(1.3); opacity: 0; } }
.coro.is-waking .sheep__svg { animation: startle .6s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes startle { 0% { transform: translateY(0); } 30% { transform: translateY(-18%) scale(1.05, .95); } 100% { transform: translateY(0); } }

/* véu por cima do coro (acordar / serenata recebida) */
.coro__veil {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; align-content: center; gap: 6px; padding: 12px;
}
.coro__veil[hidden] { display: none; }
@media (max-width: 999px) { .coro.has-gift .bubble--maestra { visibility: hidden; } }

/* ------------------------------------------------------------------ postal (quem envia e quem recebe a serenata) */

/* moldura de correio aéreo, às riscas de Natal (a borda é o fundo às riscas; o papel fica por dentro) */
.postal {
  position: relative; padding: 20px 20px 18px; border: 9px solid transparent; border-radius: 18px; text-align: left; color: var(--ink);
  background: linear-gradient(#fffdf6, #fffdf6) padding-box,
    repeating-linear-gradient(-45deg, #e5333f 0 13px, #fffdf6 13px 22px, #1e9a68 22px 35px, #fffdf6 35px 44px) border-box;
  box-shadow: 0 14px 30px rgba(12, 6, 48, .3);
}
.postal__side { position: relative; float: right; width: 86px; margin: -6px -6px 6px 16px; }
@media (max-width: 420px) { .postal__side { width: 70px; margin-left: 10px; } .postmark { width: 110px; left: -48px; top: 42px; } }
.stamp { position: relative; display: block; width: 100%; transform: rotate(4deg); filter: drop-shadow(0 2px 2px rgba(43, 27, 61, .25)); }
.stamp__frame { display: block; width: 100%; height: auto; }
.stamp__art { position: absolute; left: 17%; right: 17%; top: 13%; }
.stamp__text { font: 400 11px var(--display); fill: var(--red); letter-spacing: .14em; }
.postmark { position: absolute; left: -58px; top: 50px; width: 132px; height: auto; color: rgba(43, 27, 61, .48); transform: rotate(-12deg); pointer-events: none; }
.postmark__ring { font: 700 6.6px var(--body); letter-spacing: .06em; fill: currentColor; }
.postmark__year { font: 400 12px var(--display); fill: currentColor; }
.postal__title { margin: 0 0 4px; font: 400 1.4rem/1.15 var(--display); color: var(--red); }
.postal__meta { margin: 0 0 6px; font-size: .95rem; color: var(--ink-2); }
.postal__wish { margin: 0 0 14px 4px; font: 400 1.45rem/1.6 var(--sign); color: var(--pen); transform: rotate(-4deg); transform-origin: 0 50%; }
.postal__line { clear: right; display: flex; align-items: baseline; gap: 12px; padding: 8px 0 2px; border-bottom: 2px dotted #c9b48a; }
.postal__line + .postal__line { margin-top: 4px; }
.postal__line:focus-within { border-bottom-color: var(--pen); }
.postal__line span { flex: none; width: 2.6em; font: 400 1.05rem var(--display); color: var(--ink-2); }
.postal__line input { flex: 1; min-width: 0; padding: 0 0 2px; border: 0; background: transparent; font: 400 1.5rem/1.2 var(--hand); color: var(--pen); }
.postal__line input:focus { outline: none; }
.postal__line input::placeholder { color: #b8a785; }
.postal__hint { margin: 10px 0 0; font-size: .86rem; color: var(--ink-2); }
.postal__hint.is-bad { color: var(--bad); font-weight: 700; }

/* quem recebe: o postal por cima do coro a dormir */
.coro__veil--gift { background: radial-gradient(closest-side, rgba(12, 15, 51, .6), rgba(12, 15, 51, 0)); }
.postal--gift { width: min(440px, calc(100% - 24px)); }
.postal--gift .postal__title { font-size: clamp(1.45rem, 5vw, 1.85rem); }
.postal--gift .postal__text { margin: 4px 0 16px; color: #3a2b4d; }
.postal--gift .btn { clear: both; width: 100%; }
.postal__tip { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0 0; font-size: .92rem; color: var(--ink-2); }
.postal__tip .i { width: 1.1em; height: 1.1em; color: var(--gold-dk); }

/* janela de envio */
.share {
  width: min(540px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain;
  margin: auto; padding: 26px 22px 22px; border: 0; border-radius: 22px; background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 80px rgba(8, 6, 30, .6);
}
.share[open] { animation: share-in .45s var(--ease-spring); }
.share::backdrop { background: rgba(8, 6, 30, .64); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.share__top { display: flex; justify-content: flex-end; height: 0; margin: -14px -8px 0 0; position: relative; z-index: 3; }
.share__top .share__x { flex: none; }
.share__x { width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer; font: 400 1.7rem/1 var(--display); color: var(--ink); background: #f1e6cf; }
.share__x:hover { background: #ead9b8; }
.share .postal { margin: 34px 0 0; }
.share__label { margin: 26px 0 12px; text-align: center; font: 400 1.05rem var(--display); color: var(--ink-2); }
.share__ways { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 8px; }
.way {
  width: 82px; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--ink); font: 700 .84rem/1.2 var(--body); text-decoration: none; text-align: center; -webkit-tap-highlight-color: transparent;
}
.way[hidden] { display: none; }
.way__icon {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--w);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .2), inset 0 2px 0 rgba(255, 255, 255, .25); transition: transform .2s var(--ease-spring), background-color .2s;
}
.way__icon .i { width: 28px; height: 28px; }
.way:hover .way__icon, .way:focus-visible .way__icon { transform: translateY(-3px) rotate(-6deg); }
.way:active .way__icon { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
.way:focus-visible { outline: none; }
.way:focus-visible .way__icon { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--gold); }
.way--wa { --w: #1faa53; }
.way--fb { --w: #1877f2; }
.way--mail { --w: var(--red); }
.way--sms { --w: var(--green); }
.way--copy { --w: var(--ink); }
.way--more { --w: var(--gold-dk); }
.way.is-done .way__icon { --w: var(--green); }
.share__link { margin: 20px 0 0; text-align: center; }
.share__url { display: inline-block; max-width: 100%; padding: .45em .9em; border-radius: 10px; background: #f3ead7; color: var(--ink-2); font: 700 .9rem/1.4 var(--body); word-break: break-all; }
@keyframes share-in { from { opacity: 0; transform: translateY(24px) scale(.94); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ barra da canção */

.coro__songbar {
  margin: 14px auto 0; max-width: 760px; display: grid; gap: 10px; justify-items: center;
  background: rgba(14, 10, 52, .66); border-radius: 18px; padding: 12px 14px; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.coro__songbar[hidden] { display: none; }
.coro__songname { margin: 0; font: 400 1.25rem/1.2 var(--display); }
.coro__count { font: 700 .95rem var(--body); opacity: .85; margin-left: .3em; }
.coro__tape { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 34px; }
.coro__tape li {
  font: 400 1rem/1 var(--display); padding: .42em .7em .46em; border-radius: 999px; color: #fff; background: var(--c);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .25); opacity: .55; transform: scale(.9);
}
.coro__tape li:first-child { opacity: 1; transform: scale(1.12); box-shadow: 0 3px 0 rgba(0, 0, 0, .25), 0 0 0 3px var(--gold); }
.coro__songbtns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ------------------------------------------------------------------ painel */

.coro__panel { display: grid; gap: 34px 24px; margin: 40px auto 0; max-width: 980px; text-align: left; }
.coro__box { display: flex; flex-direction: column; gap: 12px; }
.coro__h { font: 400 1.5rem/1.15 var(--display); color: var(--red); }
.coro__note { margin: 0; color: #3a2b4d; font-size: 1.02rem; }
.songs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.song { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 14px; padding: 12px 0; border-top: 2px dashed #ead9b8; }
.song__name { font: 400 1.12rem/1.2 var(--display); color: var(--ink); }
.song__btns { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 480px) {
  .song { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .song__btns { justify-content: flex-start; }
}
.coro__box .btn--small { min-height: 46px; font-size: 1rem; padding: .55em 1.1em .6em; }
.coro__box .btn::after { display: none; }
.coro__box .btn--ghost { color: var(--ink); background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 2.5px var(--ink), 0 .3em 0 rgba(43, 27, 61, .35); }
.rec { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rec__dot { width: .7em; height: .7em; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
.rec.is-rec .rec__dot { border-radius: 3px; animation: rec 1s ease-in-out infinite; }
@keyframes rec { 50% { opacity: .35; } }
.rec__time { font: 700 1.15rem var(--mono); color: var(--red); min-width: 3.2em; }
.rec__msg { margin: 0; min-height: 1.4em; color: var(--green-dk); font-weight: 700; }
.coro__foot { display: flex; flex-direction: column; align-items: center; gap: 16px; margin: 34px auto 0; }
.coro__keys {
  display: none; margin: 0; max-width: 560px; font-size: .98rem; padding: .55em 1.1em; border-radius: 16px; color: #fff;
  background: rgba(14, 10, 52, .62); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .12); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.coro__keys kbd { font: 700 .85em var(--mono); background: rgba(255, 255, 255, .16); border-radius: 6px; padding: .1em .45em; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .3); }
.coro__veil .btn { width: auto; }

/* ------------------------------------------------------------------ ecrãs largos: uma fila só */

/* telemóvel: o coro ocupa a largura toda e as ovelhas pequenas não encolhem tanto */
@media (max-width: 759px) {
  .coro__stage { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }
  .coro__maestra { padding: 0 var(--gutter); }
  .coro__flock { padding: 0; }
  .coro__flock .sheep__svg { width: calc((.4 + var(--s) * .6) * 126%); margin: 0 -13% -7%; }
}
@media (min-width: 760px) {
  .maestra { width: 118px; }
  .coro__panel { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .coro__flock .sheep:nth-child(n+7) { margin-bottom: -14px; }
}
@media (min-width: 1000px) {
  .coro__stage { grid-template-columns: 170px minmax(0, 1fr) 170px; }
  .coro__maestra { flex-direction: column-reverse; align-items: flex-start; gap: 4px; align-self: end; }
  .maestra { width: 140px; margin-bottom: 18px; }
  .bubble--maestra { position: absolute; left: 0; bottom: 100%; width: 166px; max-width: none; margin: 0 0 8px; font-size: 1.02rem; }
  .bubble--maestra::after { left: 40px; bottom: -16px; clip-path: polygon(0 0, 100% 0, 30% 100%); }
}
/* telemóvel deitado: a maestrina vai para o lado e o coro inteiro cabe no ecrã */
@media (orientation: landscape) and (max-height: 520px) {
  .coro__stage { grid-template-columns: 150px minmax(0, 1fr); margin-left: 0; margin-right: 0; }
  .coro__maestra { flex-direction: column; align-items: flex-start; gap: 10px; padding: 0; }
  .maestra { width: 96px; }
  .bubble--maestra { margin: 0; max-width: 150px; font-size: .95rem; }
  .bubble--maestra::after { left: 26px; bottom: -16px; clip-path: polygon(0 0, 100% 0, 30% 100%); }
  .coro__flock { max-width: 500px; }
  .coro__flock .sheep__svg { width: calc(var(--s) * 116%); margin: 0 -8% -6%; }
}
@media (hover: hover) and (min-width: 760px) {
  .sheep__key { display: block; margin-top: 6px; font: 700 .78rem/1 var(--mono); color: rgba(255, 255, 255, .8); background: rgba(14, 10, 52, .5); border-radius: 6px; padding: .28em .5em; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .35); }
  .coro__keys { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .fly { display: none; }
}
.lite .coro__keys, .lite .coro__songbar { backdrop-filter: none; -webkit-backdrop-filter: none; background-color: rgba(14, 10, 52, .82); }
