/* Loading skeletons.
 *
 * 1. Lazy images show a shimmer until they finish loading (gf-skeleton.js adds
 *    .gf-img-loaded on load/error).
 * 2. Utility classes for blocks that are filled in asynchronously:
 *      <div class="gf-skeleton gf-skeleton-text"></div>
 *      <div class="gf-skeleton gf-skeleton-circle" style="width:40px;height:40px"></div>
 *      <div class="gf-skeleton gf-skeleton-block" style="height:120px"></div>
 */
:root {
  --gf-skel-base: #e2e8f0;
  --gf-skel-shine: #f3f6fa;
}

@keyframes gf-skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.gf-skeleton,
img[loading="lazy"]:not(.gf-img-loaded) {
  background-color: var(--gf-skel-base);
  background-image: linear-gradient(
    90deg,
    var(--gf-skel-base) 0%,
    var(--gf-skel-shine) 50%,
    var(--gf-skel-base) 100%
  );
  background-size: 200% 100%;
  animation: gf-skeleton-shimmer 1.4s ease-in-out infinite;
}

/* The alt text of a still-loading image must not flash over the shimmer. */
img[loading="lazy"]:not(.gf-img-loaded) {
  color: transparent;
}

.gf-skeleton { display: block; border-radius: 6px; }
.gf-skeleton-text { height: 1em; width: 100%; margin: .35em 0; }
.gf-skeleton-text.short { width: 55%; }
.gf-skeleton-circle { border-radius: 50%; }
.gf-skeleton-block { width: 100%; min-height: 1rem; }

@media (prefers-reduced-motion: reduce) {
  .gf-skeleton,
  img[loading="lazy"]:not(.gf-img-loaded) { animation: none; }
}

/* ── Splash: only on the first load of a session (class set in <head>) ── */
html:not(.gf-splash) #overlayer,
html:not(.gf-splash) .loader { display: none !important; }
.gf-splash-logo { animation: gf-splash-pulse 1.2s ease-in-out infinite; }
@keyframes gf-splash-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* ── Per-view skeletons (markup: templates/core/_nav_skeletons.html) ── */
[class*="gf-sv-"] {
  background-color: var(--gf-skel-base);
  background-image: linear-gradient(90deg, var(--gf-skel-base) 0%, var(--gf-skel-shine) 50%, var(--gf-skel-base) 100%);
  background-size: 200% 100%;
  animation: gf-skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}
.gf-skel-view { display: none; padding: 24px 0 48px; }
html:not([data-gf-skel]) .gf-skel-view[data-skel="default"],
html[data-gf-skel="default"] .gf-skel-view[data-skel="default"],
html[data-gf-skel="landing"] .gf-skel-view[data-skel="landing"],
html[data-gf-skel="profile"] .gf-skel-view[data-skel="profile"],
html[data-gf-skel="table"] .gf-skel-view[data-skel="table"],
html[data-gf-skel="dashboard"] .gf-skel-view[data-skel="dashboard"],
html[data-gf-skel="inbox"] .gf-skel-view[data-skel="inbox"],
html[data-gf-skel="map"] .gf-skel-view[data-skel="map"],
html[data-gf-skel="form"] .gf-skel-view[data-skel="form"],
html[data-gf-skel="calendar"] .gf-skel-view[data-skel="calendar"],
html[data-gf-skel="board"] .gf-skel-view[data-skel="board"] { display: block; }

.gf-sv-title  { height: 32px; width: 35%; margin: 4px 0 22px; }
.gf-sv-text   { height: 14px; margin: 8px 0; }
.gf-sv-text.short { width: 55%; }
.gf-sv-bar    { height: 46px; margin-bottom: 18px; }
.gf-sv-card   { height: 180px; margin-bottom: 12px; }
.gf-sv-tile   { height: 96px; }
.gf-sv-chart  { height: 280px; margin-bottom: 20px; }
.gf-sv-row    { height: 64px; margin-bottom: 12px; }
.gf-sv-row.sm { height: 44px; }
.gf-sv-hero   { height: 200px; margin-bottom: 20px; }
.gf-sv-hero.tall { height: 60vh; }
.gf-sv-avatar { width: 88px; height: 88px; border-radius: 50%; flex: none; }
.gf-sv-avatar.sm { width: 44px; height: 44px; }
.gf-sv-pill   { width: 80px; height: 28px; border-radius: 14px; flex: none; }
.gf-sv-label  { height: 12px; width: 22%; margin-bottom: 8px; }
.gf-sv-field  { height: 44px; }
.gf-sv-button { height: 44px; width: 160px; margin-top: 8px; }
.gf-sv-map    { height: 62vh; min-height: 320px; }
.gf-sv-pane   { height: 60vh; min-height: 320px; }
.gf-sv-cell   { height: 84px; border-radius: 6px; }
.gf-sv-pitch  { aspect-ratio: 3 / 4; max-height: 70vh; width: 100%; }

.gf-svc-grid  { display: grid; gap: 16px; margin-bottom: 20px; }
.gf-svc-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gf-svc-cols-3 { grid-template-columns: repeat(3, 1fr); }
.gf-svc-cols-4 { grid-template-columns: repeat(4, 1fr); }
.gf-svc-cols-7 { grid-template-columns: repeat(7, 1fr); gap: 6px; }
.gf-svc-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 20px; }
.gf-svc-row   { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.gf-svc-grow  { flex: 1; min-width: 0; }
.gf-svc-field { margin-bottom: 18px; }
.gf-svc-profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
@media (max-width: 767.98px) {
  .gf-svc-cols-3, .gf-svc-cols-4, .gf-svc-cols-2, .gf-svc-split { grid-template-columns: 1fr; }
  .gf-svc-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .gf-sv-title { width: 60%; }
}
@media (prefers-reduced-motion: reduce) { [class*="gf-sv-"] { animation: none; } }

/* ── Instant feedback on internal link clicks (gf-skeleton.js) ── */
#gf-main { display: contents; }
#gf-nav-skeleton { display: none; min-height: 75vh; }
html.gf-navigating #gf-main > * { display: none !important; }
html.gf-navigating #gf-nav-skeleton { display: block; }

#gf-nav-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: #1e4976; z-index: 8000; opacity: 0; pointer-events: none;
}
html.gf-navigating #gf-nav-progress {
  opacity: 1; width: 85%;
  transition: width 8s cubic-bezier(.1, .8, .2, 1);
}
@media (prefers-reduced-motion: reduce) {
  .gf-splash-logo { animation: none; }
  html.gf-navigating #gf-nav-progress { transition: none; }
}
