/* =============================================
   CALMARLAND - Skeleton Loading
   Add to: /wp-content/themes/your-theme/css/
   ============================================= */

/* Shimmer animation */
@keyframes shimmer {
  0%   { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

@keyframes fadeOut {
  0%   { opacity: 1; visibility: visible; }
  100% { opacity: 0; visibility: hidden; }
}

/* ── Overlay that covers the whole page ── */
#calmarland-skeleton-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #f5f5f5;
  overflow: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#calmarland-skeleton-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── Skeleton base block ── */
.sk-block {
  background: linear-gradient(
    90deg,
    #e0e0e0 25%,
    #efefef 50%,
    #e0e0e0 75%
  );
  background-size: 1000px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: 6px;
}

/* ── Skeleton layout wrapper ── */
.sk-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ================================================
   NAVBAR skeleton
   ================================================ */
.sk-nav {
  height: 72px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid #e8e8e8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.sk-nav-logo {
  width: 140px;
  height: 36px;
}

.sk-nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.sk-nav-link {
  width: 72px;
  height: 14px;
}

.sk-nav-btn {
  width: 100px;
  height: 36px;
  border-radius: 20px;
}

/* ================================================
   HERO skeleton
   ================================================ */
.sk-hero {
  height: 520px;
  background: #ddd;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sk-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(200,200,200,0.6) 25%,
    rgba(220,220,220,0.9) 50%,
    rgba(200,200,200,0.6) 75%
  );
  background-size: 1000px 100%;
  animation: shimmer 1.6s infinite linear;
}

.sk-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  width: 100%;
  max-width: 600px;
  padding: 0 24px;
}

.sk-hero-title {
  height: 52px;
  width: 80%;
  margin: 0 auto 16px;
  border-radius: 8px;
}

.sk-hero-subtitle {
  height: 22px;
  width: 60%;
  margin: 0 auto 12px;
  border-radius: 6px;
}

.sk-hero-subtitle.short {
  width: 40%;
}

.sk-hero-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 28px;
}

.sk-hero-btn {
  width: 130px;
  height: 44px;
  border-radius: 24px;
}

/* ================================================
   SECTION TITLE skeleton
   ================================================ */
.sk-section {
  padding: 64px 0;
}

.sk-section-title {
  height: 32px;
  width: 260px;
  margin: 0 auto 8px;
}

.sk-section-sub {
  height: 16px;
  width: 180px;
  margin: 0 auto 40px;
}

/* ================================================
   PROPERTY CARDS skeleton (Marketplace)
   ================================================ */
.sk-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 900px) {
  .sk-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .sk-grid { grid-template-columns: 1fr; }
}

.sk-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.sk-card-img {
  width: 100%;
  height: 200px;
  border-radius: 0;
}

.sk-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sk-card-tag {
  width: 70px;
  height: 22px;
  border-radius: 20px;
}

.sk-card-title {
  width: 85%;
  height: 18px;
}

.sk-card-meta {
  width: 55%;
  height: 14px;
}

.sk-card-price {
  width: 40%;
  height: 22px;
  margin-top: 4px;
}

/* ================================================
   CALCULATOR skeleton
   ================================================ */
.sk-calc {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 32px rgba(0,0,0,0.08);
  border-top: 4px solid #c0c0c0;
  border-bottom: 4px solid #c0c0c0;
}

@media (max-width: 700px) {
  .sk-calc { grid-template-columns: 1fr; }
}

.sk-calc-left {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sk-calc-heading {
  width: 55%;
  height: 26px;
}

.sk-calc-label {
  width: 40%;
  height: 14px;
}

.sk-calc-input {
  width: 100%;
  height: 44px;
  border-radius: 8px;
}

.sk-calc-right {
  background: #efefef;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sk-calc-result-label {
  width: 60%;
  height: 14px;
}

.sk-calc-result-value {
  width: 80%;
  height: 36px;
}

.sk-calc-divider {
  width: 100%;
  height: 1px;
  background: #ddd;
  border-radius: 0;
  animation: none;
}

/* ================================================
   TEXT SECTION skeleton (About, etc.)
   ================================================ */
.sk-text-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

@media (max-width: 700px) {
  .sk-text-section { grid-template-columns: 1fr; }
}

.sk-text-img {
  width: 100%;
  height: 320px;
  border-radius: 12px;
}

.sk-text-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sk-text-line {
  height: 14px;
  width: 100%;
}

.sk-text-line.w80 { width: 80%; }
.sk-text-line.w60 { width: 60%; }

/* ================================================
   FOOTER skeleton
   ================================================ */
.sk-footer {
  background: #2a2a2a;
  padding: 48px 32px 24px;
}

.sk-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-bottom: 40px;
}

@media (max-width: 700px) {
  .sk-footer-grid { grid-template-columns: repeat(2, 1fr); }
}

.sk-footer-block {
  width: 80%;
  height: 16px;
  background: linear-gradient(90deg, #444 25%, #555 50%, #444 75%);
  background-size: 1000px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: 4px;
  margin-bottom: 12px;
}

.sk-footer-block.sm {
  width: 60%;
  height: 12px;
}

.sk-footer-divider {
  width: 100%;
  height: 1px;
  background: #444;
  margin-bottom: 16px;
  animation: none;
}

.sk-footer-copy {
  width: 200px;
  height: 12px;
  margin: 0 auto;
  background: linear-gradient(90deg, #444 25%, #555 50%, #444 75%);
  background-size: 1000px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: 4px;
}

/* ================================================
   CSS AUTO-HIDE FALLBACK
   Even if JS fails completely, this forces the
   skeleton to fade out after 3.5 seconds
   ================================================ */
@keyframes skeletonAutoHide {
  0%   { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; pointer-events: none; visibility: hidden; }
}

#calmarland-skeleton-overlay {
  animation: skeletonAutoHide 4s ease forwards;
}
