/* Shared responsive vertical rhythm for all StarGid pages. */
:root {
  --rhythm-section: clamp(30px, 4vw, 52px);
  --rhythm-block: clamp(18px, 2.2vw, 24px);
  --rhythm-inner: clamp(12px, 1.6vw, 18px);
}

/* Main content sections use one fluid spacing scale on every viewport. */
main > .section {
  padding-top: var(--rhythm-section) !important;
  padding-bottom: var(--rhythm-section) !important;
}
main > .section + .section {
  padding-top: 0 !important;
}
main > .page-head {
  padding-top: clamp(28px, 4vw, 48px) !important;
  padding-bottom: var(--rhythm-section) !important;
}
main > .page-head + .section {
  padding-top: 0 !important;
  margin-top: clamp(28px, 3.5vw, 44px) !important;
}

/* Homepage hero follows the same distance to the next content block. */
main > .hero {
  padding-bottom: var(--rhythm-section) !important;
}
main > .hero + .section {
  padding-top: 0 !important;
}

/* Common vertical gaps between cards and content panels. */
.content-card + .content-card,
.horoscope-card + .content-card,
.content-card + .horoscope-card,
.horoscope-card + .horoscope-card,
.empty-state + .content-card,
.content-card + .empty-state {
  margin-top: 0 !important;
}
.personal-container { gap: var(--rhythm-block) !important; }
.ball-section .ball-result {
  margin-top: 0 !important;
  gap: var(--rhythm-block) !important;
}
.ball-section .ball-description {
  margin-top: 0 !important;
}

/* Remove legacy offsets that made compatibility spacing differ by device. */
.compatibility-seo-section {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
.compat-picker { transform: none !important; }
.compatibility-seo-section .compatibility-seo,
body .compatibility-seo-section article.content-card.compatibility-seo {
  position: static !important;
  top: auto !important;
  transform: none !important;
}

/* Tarot: preserve the responsive three-card layout, but stop using negative
   margins and large transforms to control the distance to the text blocks. */
.taro-section .taro-carousel {
  top: auto !important;
  transform: none !important;
  margin-top: 0 !important;
  margin-bottom: var(--rhythm-block) !important;
}
.taro-section .taro-info {
  margin-top: 0 !important;
  margin-bottom: var(--rhythm-block) !important;
}
.taro-section .taro-description { margin-top: 0 !important; }

/* Keep section headings and the content that follows them consistently spaced. */
.section-heading { margin-bottom: var(--rhythm-block) !important; }
.compat-picker-head { margin-bottom: var(--rhythm-block) !important; }

@media (max-width: 560px) {
  main > .page-head + .section {
    margin-top: clamp(22px, 6vw, 30px) !important;
  }
  :root {
    --rhythm-section: clamp(24px, 6vw, 32px);
    --rhythm-block: clamp(16px, 4.5vw, 20px);
    --rhythm-inner: 12px;
  }
}

/* Restore shared card gaps after the compatibility-specific reset. */
.content-card + .content-card,
.horoscope-card + .content-card,
.content-card + .horoscope-card,
.horoscope-card + .horoscope-card,
.empty-state + .content-card,
.content-card + .empty-state {
  margin-top: var(--rhythm-block) !important;
}
.ball-section .ball-result { margin-top: var(--rhythm-block) !important; }
.ball-section .ball-result:has(> .ball-prediction:not([hidden])) ~ .ball-description,
.ball-section .ball-result:has(> .ball-limit:not([hidden])) ~ .ball-description {
  margin-top: var(--rhythm-block) !important;
}


/* Requested spacing adjustments for Tarot and the prediction ball. */
.taro-section .taro-carousel {
  margin-bottom: calc(var(--rhythm-block) + 20px) !important;
}
/* Keep a visible Tarot timeout notice separated from the result/content panel. */
.taro-section .ball-limit:not([hidden]) ~ .taro-info:not([hidden]) {
  margin-top: var(--rhythm-block) !important;
}
@media (max-width: 560px) {
  .ball-section .ball-result {
    margin-top: calc(var(--rhythm-block) + 20px) !important;
  }
}


/* Increase spacing between desktop header navigation items by 20px. */
@media (min-width: 821px) {
  .header-inner > nav.desktop-nav[data-desktop-nav] {
    column-gap: calc(clamp(8px, .85vw, 14px) + 20px) !important;
  }
}


/* Align the introductory panels on Personal Horoscope and Tests with the
   shared page-head design used by Compatibility and daily horoscope pages. */
main > .page-head.personal-page-head,
main > .page-head.tests-page-head {
  padding-top: clamp(28px, 4vw, 48px) !important;
  padding-bottom: var(--rhythm-section) !important;
}
main > .page-head.personal-page-head + .section {
  padding-top: 0 !important;
  margin-top: clamp(28px, 3.5vw, 44px) !important;
}
main > .page-head.tests-page-head + .tests-layout-section {
  padding-top: 0 !important;
  margin-top: clamp(28px, 3.5vw, 44px) !important;
}
.tests-page-head p + p { margin-top: 10px; }
@media (max-width: 560px) {
  main > .page-head.personal-page-head + .section {
    margin-top: clamp(22px, 6vw, 30px) !important;
  }
}
