/* Cross-document View Transitions for public pages (not admin, not game rooms). Unsupported browsers just navigate. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  /* Soft, subtle crossfade only: no slide, scale or morph. Nav active colour fades with the page. */
  ::view-transition-group(root) { animation-duration: .18s; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; animation-timing-function: ease-in-out; }

  .clay-nav__link, .clay-bottom-nav__item { transition: background .18s ease, transform .12s ease, color .18s ease; }
  .clay-nav__link:active, .clay-bottom-nav__item:active { transform: scale(.93); }
}
/* Nav skeleton (shown instantly on click) */
.jd-skel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; overflow: hidden; background: var(--clay-bg); opacity: 0; transition: opacity .12s ease; pointer-events: none; }
.jd-skel.is-on { opacity: 1; }
.jd-sk { display: block; border-radius: 14px; background: linear-gradient(90deg, var(--clay-surface) 0%, color-mix(in srgb, var(--clay-lavender) 55%, var(--clay-surface)) 50%, var(--clay-surface) 100%); background-size: 220% 100%; animation: jd-shimmer 1.4s ease-in-out infinite; box-shadow: var(--clay-out); }
.jd-sk-title { width: 220px; max-width: 60%; height: 34px; margin: 4px 0 20px; }
.jd-sk-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.jd-sk-grid--profile { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.jd-sk-card { padding: 14px; border-radius: 22px; background: var(--clay-surface); box-shadow: var(--clay-out); display: grid; gap: 10px; }
.jd-sk-card .jd-sk { box-shadow: none; }
.jd-sk-img { height: 150px; border-radius: 16px; }
.jd-sk-line { height: 14px; border-radius: 8px; }
.jd-sk-short { width: 55%; }
.jd-sk-row { grid-template-columns: 56px 1fr; align-items: center; }
.jd-sk-row span { display: grid; gap: 8px; }
.jd-sk-av { width: 56px; height: 56px; border-radius: 50%; }
@keyframes jd-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .jd-sk { animation: none; } .jd-skel { transition: none; } }

/* Leaving a member profile: its custom background must not linger */
.jd-leaving .pf-bg { opacity: 0 !important; transition: opacity .1s ease; }
.jd-leaving .pf--fixed, .jd-leaving .pf { background: transparent !important; }
.jd-skel .ch-list--feed { display: grid; gap: 12px; }
.jd-skel .game-grid .jd-sk-card, .jd-skel .news-grid .jd-sk-card, .jd-skel .pf-cards .jd-sk-card { margin: 0; }

/* Ghost cards: real classes, text and chrome hidden behind a shimmer so only the box size remains */
.jd-ghost { pointer-events: none; }
.jd-ghost h2, .jd-ghost p, .jd-ghost .ch-name, .jd-ghost .ch-meta, .jd-ghost .ch-body, .jd-ghost .news-date, .jd-ghost .ch-act, .jd-ghost .game-card__badge, .jd-ghost .game-card__play { color: transparent !important; background: var(--jd-sk-bg); background-size: 220% 100%; animation: jd-shimmer 1.8s ease-in-out infinite; border-radius: 8px; border-color: transparent; }
.jd-ghost .ch-body { display: block; }
.jd-ghost .ch-name, .jd-ghost .ch-meta { display: block; width: 60%; }
.jd-ghost .news-date, .jd-ghost .ch-act { display: inline-block; width: 40%; }
.jd-ghost .game-card__desc { opacity: 1; }
.jd-sk-news-img { width: 100%; aspect-ratio: 480 / 252; border-radius: var(--radius-sm); box-shadow: none; }
.jd-ghost .game-card__media, .jd-ghost .ch-av { box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .jd-ghost * { animation: none !important; } }

/* Skeleton tones come from the card's own ink colour, so they follow the surface (clay / peach) in light and dark mode */
.jd-ghost { --sk: var(--clay-ink); --jd-sk-bg: linear-gradient(90deg, color-mix(in srgb, var(--sk) 8%, transparent), color-mix(in srgb, var(--sk) 15%, transparent), color-mix(in srgb, var(--sk) 8%, transparent)); }
.jd-ghost.game-card { --sk: var(--clay-peach-ink); }
.jd-ghost .jd-sk, .jd-ghost .game-card__media, .jd-ghost .ch-av { background: var(--jd-sk-bg); background-size: 220% 100%; animation: jd-shimmer 1.8s ease-in-out infinite; box-shadow: none; }
.jd-ghost .game-card__media { border-radius: var(--radius-md); }
.jd-ghost .game-card__badge { border-radius: var(--radius-pill); }

/* Profile skeleton: real bar (Jelajahi / Edit profil / Pengaturan akun) above, content blocks below */
.jd-sk-pfhead { height: 190px; border-radius: var(--radius-lg, 24px); margin: 4px 0 16px; }
.jd-sk-pfblock { height: 120px; border-radius: var(--radius-md); margin: 0 0 16px; }

/* ghost profile card (komunitas explore) */
.jd-ghost .pf-mini__av { background: var(--jd-sk-bg); background-size: 220% 100%; animation: jd-shimmer 1.8s ease-in-out infinite; box-shadow: none; color: transparent; }
.jd-ghost .pf-mini strong, .jd-ghost .pf-mini .pf-user { display: block; width: 70%; color: transparent !important; background: var(--jd-sk-bg); background-size: 220% 100%; animation: jd-shimmer 1.8s ease-in-out infinite; border-radius: 8px; }
.jd-ghost .pf-mini__body { flex: 1; display: grid; gap: 6px; }

/* Filter/tab change (jd-filters.js): the listing turns into the same ghost cards at once; the real
   komunitas search form stays usable. Removed when the new listing is in, or put back on failure. */
[data-jd-slot="list"].jd-skel-on > :not(.jd-fskel):not(form[data-jd-form]) { display: none !important; }
.jd-fskel { animation: jd-fskel-in .12s ease-out both; }
.jd-fskel .ch-list--feed { display: grid; gap: 12px; }
.jd-fskel__bar { height: 52px; border-radius: var(--radius-pill); margin: 0 0 16px; box-shadow: var(--clay-pressed); }
@keyframes jd-fskel-in { from { opacity: .4; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .jd-fskel { animation: none; } }

/* Error toast for a failed filter load */
.jd-toast { position: fixed; z-index: 120; left: 50%; bottom: 24px; transform: translate(-50%, 16px); width: max-content; max-width: calc(100vw - 24px); display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-radius: var(--radius-pill); background: var(--clay-surface); color: var(--clay-ink); font-weight: 700; font-size: 15px; box-shadow: var(--clay-out), var(--clay-in); opacity: 0; pointer-events: none; transition: opacity .16s ease, transform .16s ease; }
.jd-toast::before { content: ""; flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--clay-danger, #B42318); }
.jd-toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.jd-toast__btn, .jd-toast__x { min-height: 40px; min-width: 40px; border: 0; border-radius: var(--radius-pill); font: inherit; font-family: var(--font-display, inherit); cursor: pointer; transition: transform .1s ease, box-shadow .1s ease; }
.jd-toast__btn { padding: 8px 16px; background: var(--clay-lavender); color: var(--clay-lavender-ink); box-shadow: var(--clay-out); }
.jd-toast__x { background: transparent; color: var(--clay-ink-2); font-size: 22px; line-height: 1; }
.jd-toast__btn:active, .jd-toast__btn.is-pressed, .jd-toast__x:active { transform: scale(.95); box-shadow: var(--clay-pressed); }
@media (max-width: 767px) { .jd-toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }
