/* CLIK.ma - the status window (#modal-clik-alert in _js_templates.tpl, clik-alert.js): the core's error / success /
   info windows and its "Error" message. The CLIK cube tells what happened (it shakes and cracks on an error,
   assembles and jumps on a success, floats for an info), the rings and the badge carry the colour. One 8 px grid. */

#modal .modal-dialog:has(.clik-al) { max-width: 440px; }
#modal .modal-content:has(.clik-al) { overflow: hidden; border: 0; border-radius: 20px; box-shadow: 0 24px 64px rgba(0, 0, 0, .28), 0 2px 8px rgba(0, 0, 0, .12); }

.clik-al {
  --al-a: #ff3b5c; --al-b: #ff8a00; --al-soft: rgba(255, 59, 92, .09); --al-ink: #c8102e; --al-mute: #65676b; --al-line: rgba(0, 0, 0, .08); --al-ghost: #e4e6eb; --al-ghost-ink: #1c1e21;
  position: relative; text-align: center;
}
.clik-al.is-success { --al-a: #22c55e; --al-b: #10b981; --al-soft: rgba(34, 197, 94, .1); --al-ink: #15803d; }
.clik-al.is-info { --al-a: #0866ff; --al-b: #36a3ff; --al-soft: rgba(8, 102, 255, .08); --al-ink: #0654cc; }
.clik-al.is-offline { --al-a: #64748b; --al-b: #94a3b8; --al-soft: rgba(100, 116, 139, .1); --al-ink: #475569; }
.clik-al.is-back { --al-a: #22c55e; --al-b: #10b981; --al-soft: rgba(34, 197, 94, .1); --al-ink: #15803d; }
body.night-mode .clik-al { --al-mute: #b0b3b8; --al-line: rgba(255, 255, 255, .1); --al-ghost: #3a3b3c; --al-ghost-ink: #e4e6eb; --al-soft: rgba(255, 59, 92, .14); --al-ink: #ff8a9b; }
body.night-mode .clik-al.is-success, body.night-mode .clik-al.is-back { --al-soft: rgba(34, 197, 94, .15); --al-ink: #4ade80; }
body.night-mode .clik-al.is-info { --al-soft: rgba(77, 155, 255, .14); --al-ink: #7db5ff; }
body.night-mode .clik-al.is-offline { --al-soft: rgba(148, 163, 184, .14); --al-ink: #cbd5e1; }

/* a light at the top of the window, in the kind's colours */
.clik-al::before { content: ""; position: absolute; top: 0; left: 24px; right: 24px; z-index: 1; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--al-a), var(--al-b), var(--al-a)); background-size: 200% 100%; }

.clik-al .clik-al-head { border-bottom: 0; text-align: start; }
.clik-al .clik-al-head .modal-title { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.clik-al .clik-al-body { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 24px 24px; }

/* the picture: the cube, its rings, its glow, a badge */
.clik-al-art { position: relative; display: grid; place-items: center; width: 136px; height: 120px; margin-bottom: 8px; }
.clik-al-art > * { grid-area: 1 / 1; }
.clik-al-glow { width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, var(--al-a) 0, transparent 68%); opacity: .22; filter: blur(6px); }
.clik-al-ring { width: 96px; height: 96px; border: 2px solid var(--al-a); border-radius: 50%; opacity: 0; }
.clik-al-cube { position: relative; z-index: 1; overflow: visible; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .18)); }
.clik-al-cube g { transform-box: fill-box; transform-origin: center; }
.clik-al-badge { position: relative; z-index: 2; display: grid; place-items: center; width: 36px; height: 36px; translate: 30px 30px; border-radius: 50%; background: linear-gradient(135deg, var(--al-a), var(--al-b)); color: #fff; box-shadow: 0 0 0 4px #fff, 0 6px 14px rgba(0, 0, 0, .2); transition: background .4s; }
body.night-mode .clik-al-badge { box-shadow: 0 0 0 4px #212121, 0 6px 14px rgba(0, 0, 0, .4); }
.clik-al-g { display: none; stroke-dasharray: 32; stroke-dashoffset: 0; }
.clik-al.is-error .clik-al-g.is-error, .clik-al.is-success .clik-al-g.is-success, .clik-al.is-info .clik-al-g.is-info { display: inline; }
.clik-al.is-offline .clik-al-g.is-error { display: none; }
.clik-al.is-offline .clik-al-g.is-offline { display: inline; }
.clik-al.is-back .clik-al-g.is-error { display: none; }
.clik-al.is-back .clik-al-g.is-success { display: inline; }
.clik-al-spark { width: 7px; height: 7px; border-radius: 50%; background: var(--al-a); opacity: 0; }
.clik-al-spark:nth-of-type(even) { width: 5px; height: 5px; background: var(--al-b); }

/* the words */
.clik-al-h { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.2; }
.clik-al-msg { max-width: 340px; font-size: 16px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.clik-al-msg p { margin: 0; }
.clik-al-hint { width: 100%; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--al-soft); color: var(--al-ink); font-size: 14px; line-height: 1.4; transition: background .4s, color .4s; }
.clik-al-meta { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--al-mute); font-size: 12px; }
.clik-al-code { padding: 2px 8px; border: 1px solid var(--al-line); border-radius: 999px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .02em; }
.clik-al-meta[hidden], .clik-al-hint[hidden], .clik-al-more[hidden], .clik-al-btn[hidden], .clik-al-bar[hidden] { display: none; }

/* the buttons: the main one in the kind's colours, the other plain */
.clik-al-acts { display: flex; gap: 8px; width: 100%; margin-top: 8px; }
.clik-al-btn { position: relative; display: inline-flex; flex: 1 1 0; align-items: center; justify-content: center; gap: 8px; min-width: 0; height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: linear-gradient(135deg, var(--al-a), var(--al-b)); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 16px -6px var(--al-a); transition: transform .15s, box-shadow .2s, filter .2s, opacity .2s; }
.clik-al-btn:hover { filter: brightness(1.06); box-shadow: 0 10px 22px -8px var(--al-a); }
.clik-al-btn:active { transform: scale(.97); }
.clik-al-btn:focus { outline: 0; }
.clik-al-btn:focus-visible { box-shadow: 0 0 0 3px rgba(8, 102, 255, .45); }
.clik-al-btn:disabled { opacity: .6; cursor: default; filter: none; }
.clik-al-btn > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.clik-al.has-retry .js_clik-al-ok { background: var(--al-ghost); color: var(--al-ghost-ink); box-shadow: none; }
.clik-al-btn[data-tries]::after { content: attr(data-tries); position: absolute; top: -6px; inset-inline-end: 8px; padding: 1px 6px; border-radius: 999px; background: #fff; color: var(--al-ink); font-size: 11px; font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }

/* the little links under them */
.clik-al-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; padding-top: 8px; border-top: 1px solid var(--al-line); width: 100%; }
.clik-al-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; border: 0; background: none; color: var(--al-mute); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; transition: color .2s; }
.clik-al-link:hover, .clik-al-link:focus-visible { color: var(--al-ink); text-decoration: none; outline: 0; }
.clik-al-link.is-strong { color: var(--al-ink); }
.clik-al-link.is-done { color: #15803d; }
body.night-mode .clik-al-link.is-done { color: #4ade80; }

/* a success closes itself: the time left */
.clik-al-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: var(--al-line); }
.clik-al-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--al-a), var(--al-b)); transform-origin: left center; }
[dir="rtl"] .clik-al-bar i { transform-origin: right center; }

@media (max-width: 575px) {
  .clik-al .clik-al-body { padding: 0 16px 16px; }
  .clik-al-acts { flex-direction: column-reverse; }
  .clik-al-btn { flex: none; width: 100%; }
}

/* motion - nothing moves with "less motion" */
@media (prefers-reduced-motion: no-preference) {
  .clik-al::before { animation: clik-al-shine 2.6s linear infinite; }
  .clik-al-art { animation: clik-al-pop .6s cubic-bezier(.34, 1.56, .64, 1) both; }
  .clik-al-ring { animation: clik-al-ring 2.4s cubic-bezier(.2, .6, .3, 1) .5s infinite; }
  .clik-al-ring.is-2 { animation-delay: 1.7s; }
  .clik-al-glow { animation: clik-al-breathe 3.2s ease-in-out infinite; }
  .clik-al-badge { animation: clik-al-badge .5s cubic-bezier(.34, 1.56, .64, 1) .38s both; }
  .clik-al-g { animation: clik-al-draw .6s ease-out .55s both; }
  .clik-al-head, .clik-al-h, .clik-al-msg, .clik-al-hint, .clik-al-meta, .clik-al-acts, .clik-al-more { animation: clik-al-up .5s cubic-bezier(.2, .8, .2, 1) both; }
  .clik-al-h { animation-delay: .12s; } .clik-al-msg { animation-delay: .18s; } .clik-al-hint { animation-delay: .24s; } .clik-al-meta { animation-delay: .28s; } .clik-al-acts { animation-delay: .32s; } .clik-al-more { animation-delay: .38s; }

  /* an error: the cube says "no", its faces crack apart and snap back, then it hovers */
  .clik-al.is-error .clik-al-cube { animation: clik-al-no .75s ease-in-out .45s both, clik-al-float 3.2s ease-in-out 1.3s infinite; }
  .clik-al.is-error .clik-al-cube-top { animation: clik-al-crack-t .9s cubic-bezier(.3, 1.4, .5, 1) .4s both; }
  /* model A (13 Nov): the lines over and under the seams step aside while the faces crack open or fly in */
  .clik-al.is-error .clik-al-cube :is(.clik-cj, .clik-cu) { animation: clik-al-seam-crack .9s .4s both; }
  .clik-al.is-error .clik-al-cube-left { animation: clik-al-crack-l .9s cubic-bezier(.3, 1.4, .5, 1) .4s both; }
  .clik-al.is-error .clik-al-cube-right { animation: clik-al-crack-r .9s cubic-bezier(.3, 1.4, .5, 1) .4s both; }
  .clik-al.is-error .clik-al-badge { animation: clik-al-badge .5s cubic-bezier(.34, 1.56, .64, 1) .38s both, clik-al-blink 2.4s ease-in-out 1.4s infinite; }
  .clik-al.is-offline .clik-al-badge { animation: clik-al-badge .5s cubic-bezier(.34, 1.56, .64, 1) .38s both, clik-al-wait 1.6s ease-in-out 1s infinite; }
  .clik-al.is-offline .clik-al-ring { animation-duration: 3.6s; }
  .clik-al.is-back .clik-al-badge { animation: clik-al-badge .5s cubic-bezier(.34, 1.56, .64, 1) both; }

  /* a success: the faces fly together, the cube jumps, sparkles burst */
  .clik-al.is-success .clik-al-cube-top { animation: clik-al-in-t .6s cubic-bezier(.2, .9, .3, 1.2) .1s both; }
  .clik-al.is-success .clik-al-cube :is(.clik-cj, .clik-cu) { animation: clik-al-seam-in .8s both; }
  .clik-al.is-success .clik-al-cube-left { animation: clik-al-in-l .6s cubic-bezier(.2, .9, .3, 1.2) .16s both; }
  .clik-al.is-success .clik-al-cube-right { animation: clik-al-in-r .6s cubic-bezier(.2, .9, .3, 1.2) .22s both; }
  .clik-al.is-success .clik-al-cube { animation: clik-al-jump .7s cubic-bezier(.3, 1.5, .5, 1) .75s both, clik-al-float 3.2s ease-in-out 1.6s infinite; }
  .clik-al.is-success .clik-al-spark, .clik-al.is-back .clik-al-spark { animation: clik-al-burst .9s cubic-bezier(.1, .8, .3, 1) .8s both; }
  .clik-al.is-back .clik-al-spark { animation-delay: .1s; }

  /* an info: it floats and twinkles */
  .clik-al.is-info .clik-al-cube { animation: clik-al-float 3.2s ease-in-out .6s infinite; }
  .clik-al.is-info .clik-al-spark { animation: clik-al-twinkle 2.8s ease-in-out .8s infinite; }

  .clik-al-btn.is-busy svg { animation: clik-al-spin .8s linear infinite; }
}

.clik-al-spark:nth-of-type(1) { --x: -58px; --y: -34px; }
.clik-al-spark:nth-of-type(2) { --x: 60px; --y: -30px; }
.clik-al-spark:nth-of-type(3) { --x: -64px; --y: 18px; }
.clik-al-spark:nth-of-type(4) { --x: 62px; --y: 22px; }
.clik-al-spark:nth-of-type(5) { --x: -20px; --y: -56px; }
.clik-al-spark:nth-of-type(6) { --x: 26px; --y: -54px; }
.clik-al.is-info .clik-al-spark:nth-of-type(n) { translate: var(--x) var(--y); }
.clik-al.is-info .clik-al-spark:nth-of-type(2) { animation-delay: 1.4s; } .clik-al.is-info .clik-al-spark:nth-of-type(3) { animation-delay: 2s; }
.clik-al.is-info .clik-al-spark:nth-of-type(4) { animation-delay: 1.1s; } .clik-al.is-info .clik-al-spark:nth-of-type(5) { animation-delay: 1.7s; }

@keyframes clik-al-shine { to { background-position: -200% 0; } }
@keyframes clik-al-pop { 0% { scale: .4; opacity: 0; translate: 0 16px; } 60% { scale: 1.08; opacity: 1; translate: 0 0; } 100% { scale: 1; } }
@keyframes clik-al-ring { 0% { scale: .7; opacity: .55; } 100% { scale: 1.65; opacity: 0; } }
@keyframes clik-al-breathe { 0%, 100% { scale: .92; opacity: .18; } 50% { scale: 1.06; opacity: .3; } }
@keyframes clik-al-badge { 0% { scale: 0; rotate: -90deg; } 100% { scale: 1; rotate: 0deg; } }
@keyframes clik-al-draw { from { stroke-dashoffset: 32; } to { stroke-dashoffset: 0; } }
@keyframes clik-al-up { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
@keyframes clik-al-no { 0%, 100% { rotate: 0deg; } 15% { rotate: -13deg; } 30% { rotate: 11deg; } 45% { rotate: -8deg; } 60% { rotate: 5deg; } 75% { rotate: -2deg; } }
@keyframes clik-al-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes clik-al-seam-crack { 0%, 100% { opacity: 1; } 12%, 70% { opacity: 0; } }
@keyframes clik-al-seam-in { 0%, 80% { opacity: 0; } 100% { opacity: 1; } }
@keyframes clik-al-crack-t { 0%, 100% { translate: 0 0; } 35% { translate: 0 -9px; rotate: -4deg; } }
@keyframes clik-al-crack-l { 0%, 100% { translate: 0 0; } 35% { translate: -8px 5px; rotate: -6deg; } }
@keyframes clik-al-crack-r { 0%, 100% { translate: 0 0; } 35% { translate: 8px 5px; rotate: 6deg; } }
@keyframes clik-al-blink { 0%, 100% { scale: 1; } 50% { scale: 1.12; } }
@keyframes clik-al-wait { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes clik-al-in-t { from { translate: 0 -40px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
@keyframes clik-al-in-l { from { translate: -40px 24px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
@keyframes clik-al-in-r { from { translate: 40px 24px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
@keyframes clik-al-jump { 0%, 100% { translate: 0 0; scale: 1 1; } 30% { translate: 0 2px; scale: 1.08 .9; } 60% { translate: 0 -16px; scale: .95 1.06; } 85% { translate: 0 0; scale: 1.04 .96; } }
@keyframes clik-al-burst { 0% { opacity: 0; translate: 0 0; scale: .4; } 25% { opacity: 1; } 100% { opacity: 0; translate: var(--x) var(--y); scale: 1; } }
@keyframes clik-al-twinkle { 0%, 100% { opacity: 0; scale: .4; } 50% { opacity: .9; scale: 1; } }
@keyframes clik-al-spin { to { rotate: 360deg; } }

/* 27 Oct: the code chip can name the check that refused ("HTTP 403 · posts/reaction · comment-post-page"): it wraps on its own words, the time stays whole beside or under it */
.clik-al-meta { flex-wrap: wrap; justify-content: center; row-gap: 4px; }
.clik-al-meta > .clik-al-code { max-width: 100%; overflow-wrap: anywhere; text-align: center; }
.clik-al-meta > span:not(.clik-al-code) { white-space: nowrap; }
