/* =========================================
   THE MANITOBAN — HORRORSCOPE
   WORDPRESS / TAGDIV VERSION
   ========================================= */

/* FONTS */

@font-face {
  font-family: "Tiempos Headline";
  src: url("fonts/TiemposHeadline-RegularItalic.woff") format("woff");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Tiempos Text";
  src: url("fonts/TiemposText-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* =========================================
   SCOPED RESET
   Does not affect the rest of WordPress
   ========================================= */

.horrorscope,
.horrorscope *,
.horrorscope *::before,
.horrorscope *::after {
  box-sizing: border-box;
}

.horrorscope {
  font-family: "Tiempos Text", Georgia, serif;
}

/* =========================================
   BACKGROUND
   ========================================= */

.horrorscope {
  position: relative;
  display: block;
  width: 100%;
  min-height: 100vh;

  margin: 0;
  padding: 0;

  background-color: #080d27;
  background-image: url("images/Background.png");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;

  color: #ffffff;
  overflow: visible;
}

/* =========================================
   PAGE HEADER
   ========================================= */

.horrorscope .horrorscope-header {
  position: relative;
  z-index: 1;

  width: 100%;
  padding: 80px 20px 30px;

  text-align: center;
  color: #ffffff;
}

.horrorscope .horrorscope-header h1 {
  margin: 0;
  padding: 0;

  font-family: "Tiempos Headline", Georgia, serif;
  font-size: clamp(32px, 5vw, 64px);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -1px;
  line-height: 1.2;
  text-transform: none;

  color: #ffffff;
}

.horrorscope .horrorscope-header p {
  margin: 18px 0 0;
  padding: 0;

  font-family: "Tiempos Text", Georgia, serif;
  font-size: clamp(14px, 1.5vw, 18px);
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;

  color: #c2c9e9;
}

.horrorscope .horrorscope-header .horrorscope-week {
  margin-top: 12px;
  font-size: 14px;
  color: #c2c9e9;
}

/* =========================================
   ZODIAC GRID — DESKTOP
   3 CONSTELLATIONS PER ROW
   ========================================= */

.horrorscope .zodiac-sky {
  position: relative;
  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  column-gap: 60px;
  row-gap: 150px;

  width: 100%;
  max-width: 1400px;

  margin: 0 auto;
  padding: 120px 50px 200px;

  background: transparent;
}

/* =========================================
   INDIVIDUAL ZODIAC
   ========================================= */

.horrorscope .zodiac {
  position: relative;

  width: 100%;
  max-width: 280px;

  aspect-ratio: 1 / 1;

  margin: 0 auto;
  padding: 0;

  cursor: pointer;
  outline-offset: 8px;

  transition: transform 0.3s ease;
}

/* Active constellation above others */

.horrorscope .zodiac:hover,
.horrorscope .zodiac:focus,
.horrorscope .zodiac:focus-within,
.horrorscope .zodiac.active {
  z-index: 10;
}

/* =========================================
   CONSTELLATION IMAGE
   ALWAYS VISIBLE
   ========================================= */

.horrorscope .constellation {
  position: absolute;

  top: 0;
  left: 0;

  display: block;
  width: 100%;
  height: 100%;
  max-width: none;

  object-fit: contain;

  z-index: 1;

  transition: filter 0.4s ease;
}

.horrorscope .zodiac:hover .constellation,
.horrorscope .zodiac:focus .constellation,
.horrorscope .zodiac.active .constellation {
  filter: brightness(1.15);
}

/* =========================================
   ZODIAC ANIMAL ILLUSTRATION
   HIDDEN UNTIL HOVER
   ========================================= */

.horrorscope .zodiac-art {
  position: absolute;

  top: 0;
  left: 0;

  display: block;
  width: 100%;
  height: 100%;
  max-width: none;

  object-fit: contain;

  z-index: 2;

  opacity: 0;
  visibility: hidden;

  pointer-events: none;

  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
}

/* Show animal illustration */

.horrorscope .zodiac:hover .zodiac-art,
.horrorscope .zodiac:focus .zodiac-art,
.horrorscope .zodiac.active .zodiac-art {
  opacity: 0.85;
  visibility: visible;
}

/* =========================================
   HORRORSCOPE POPUP CARD
   ========================================= */

.horrorscope .horrorscope-card {
  position: absolute;

  top: 15%;
  left: 105%;

  width: 280px;
  max-width: 85vw;

  margin: 0;
  padding: 24px;

  background: rgba(10, 15, 40, 0.96);

  color: #ffffff;

  border: 1px solid #aab8ff;
  border-radius: 12px;

  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);

  z-index: 20;

  opacity: 0;
  visibility: hidden;

  pointer-events: none;

  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

/* CARD TEXT */

.horrorscope .horrorscope-card h2 {
  margin: 0 0 16px;
  padding: 0;

  font-family: "Tiempos Headline", Georgia, serif;
  font-size: 26px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.2;
  text-transform: none;

  color: #ffffff;
}

.horrorscope .horrorscope-card p {
  margin: 0;
  padding: 0;

  font-family: "Tiempos Text", Georgia, serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.6;
  white-space: pre-line;

  color: #f0f0ff;
}

/* SHOW CARD */

.horrorscope .zodiac:hover .horrorscope-card,
.horrorscope .zodiac:focus .horrorscope-card,
.horrorscope .zodiac.active .horrorscope-card {
  opacity: 1;
  visibility: visible;
}

/* =========================================
   DESKTOP CARD POSITIONING
   ========================================= */

/* Column 1 — popup opens right */

.horrorscope .zodiac:nth-child(3n + 1) .horrorscope-card {
  top: 15%;
  left: 105%;
  right: auto;
  transform: none;
}

/* Column 2 — popup opens below */

.horrorscope .zodiac:nth-child(3n + 2) .horrorscope-card {
  top: 105%;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

/* Column 3 — popup opens left */

.horrorscope .zodiac:nth-child(3n) .horrorscope-card {
  top: 15%;
  left: auto;
  right: 105%;
  transform: none;
}

/* =========================================
   TABLET / IPAD
   2 CONSTELLATIONS PER ROW
   ========================================= */

@media (max-width: 1024px) {
  .horrorscope .horrorscope-header {
    padding: 65px 20px 25px;
  }

  .horrorscope .zodiac-sky {
    grid-template-columns: repeat(2, minmax(0, 1fr));

    column-gap: 50px;
    row-gap: 170px;

    padding: 90px 35px 200px;
  }

  .horrorscope .zodiac {
    max-width: 250px;
  }

  /* All cards below constellation */

  .horrorscope .zodiac:nth-child(n) .horrorscope-card {
    top: 105%;
    left: 50%;
    right: auto;

    transform: translateX(-50%);

    width: min(300px, 85vw);
  }
}

/* =========================================
   MOBILE PHONE
   1 CONSTELLATION PER ROW
   ========================================= */

@media (max-width: 600px) {
  .horrorscope {
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    background-attachment: scroll;
  }

  .horrorscope .horrorscope-header {
    padding: 50px 15px 20px;
  }

  .horrorscope .horrorscope-header h1 {
    font-size: clamp(28px, 8vw, 42px);
    letter-spacing: 3px;
  }

  .horrorscope .horrorscope-header p {
    font-size: 14px;
    line-height: 1.5;
  }

  .horrorscope .zodiac-sky {
    grid-template-columns: 1fr;

    column-gap: 0;
    row-gap: 190px;

    padding: 70px 20px 220px;
  }

  .horrorscope .zodiac {
    width: min(70vw, 280px);
    max-width: none;

    margin: 0 auto;
  }

  .horrorscope .constellation,
  .horrorscope .zodiac-art {
    width: 100%;
    height: 100%;
  }

  /* Mobile popup positioning */

  .horrorscope .zodiac:nth-child(n) .horrorscope-card {
    top: 110%;
    left: 50%;
    right: auto;

    transform: translateX(-50%);

    width: min(320px, 85vw);

    padding: 22px;
  }

  .horrorscope .horrorscope-card h2 {
    font-size: 23px;
  }

  .horrorscope .horrorscope-card p {
    font-size: 15px;
    line-height: 1.6;
  }
}

/* =========================================
   SMALL PHONES
   ========================================= */

@media (max-width: 380px) {
  .horrorscope .horrorscope-header h1 {
    font-size: 27px;
    letter-spacing: 2px;
  }

  .horrorscope .zodiac {
    width: 75vw;
  }

  .horrorscope .zodiac-sky {
    row-gap: 200px;
    padding-left: 15px;
    padding-right: 15px;
  }
}

/* =========================================
   REDUCED MOTION ACCESSIBILITY
   ========================================= */

@media (prefers-reduced-motion: reduce) {
  .horrorscope .zodiac,
  .horrorscope .constellation,
  .horrorscope .zodiac-art,
  .horrorscope .horrorscope-card {
    transition: none;
  }
}


/* =========================================
   HORRORSCOPE — FOOTER OVERLAP FIX
   ========================================= */

/* Raise the entire Horrorscope above the footer */
.horrorscope {
  position: relative;
  z-index: 50;
  isolation: isolate;
  overflow: visible !important;
}

/* Allow popup cards to extend outside the grid */
.horrorscope .zodiac-sky,
.horrorscope .zodiac {
  overflow: visible !important;
}

/* Raise active zodiac */
.horrorscope .zodiac.active,
.horrorscope .zodiac:hover,
.horrorscope .zodiac:focus {
  position: relative;
  z-index: 100;
}

/* Raise popup */
.horrorscope .horrorscope-card {
  z-index: 999;
}

/* On tablet and mobile, show popup above the constellation */
@media (max-width: 1024px) {
  .horrorscope .zodiac:nth-child(n) .horrorscope-card {
    top: auto;
    bottom: 110%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}


/* Popup displayed above WordPress / TagDiv */
.horrorscope-floating-card {
  position: fixed !important;
  z-index: 2147483647 !important;

  box-sizing: border-box;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;

  padding: 24px;

  background: rgba(10, 15, 40, 0.98);
  border: 1px solid #aab8ff;
  border-radius: 12px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.45);

  color: #ffffff;
  visibility: visible;
  opacity: 1;
}

.horrorscope-floating-card h2 {
  margin: 0 0 16px;
  font-family: "Tiempos Headline", Georgia, serif;
  font-size: 26px;
  font-style: italic;
  font-weight: 400;
  color: #ffffff;
}

.horrorscope-floating-card p {
  margin: 0;
  font-family: "Tiempos Text", Georgia, serif;
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-line;
  color: #f0f0ff;
}


/* =========================================
   FLOATING HORRORSCOPE POPUP
   ABOVE TAGDIV HEADER / FOOTER
   ========================================= */

.horrorscope-floating-card {
  position: fixed !important;
  z-index: 2147483647 !important;

  box-sizing: border-box;

  width: min(360px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);

  overflow-y: auto;
  overscroll-behavior: contain;

  margin: 0;
  padding: 24px;

  background: rgba(10, 15, 40, 0.98);

  border: 1px solid #aab8ff;
  border-radius: 12px;

  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.45);

  color: #ffffff;
  opacity: 1;
  visibility: visible;

  pointer-events: auto;
}

.horrorscope-floating-card h2 {
  margin: 0 0 16px;
  padding: 0;

  font-family: "Tiempos Headline", Georgia, serif;
  font-size: 26px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.2;

  color: #ffffff;
}

.horrorscope-floating-card p {
  margin: 0;
  padding: 0;

  font-family: "Tiempos Text", Georgia, serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;

  white-space: pre-line;
  overflow-wrap: anywhere;

  color: #f0f0ff;
}

@media (max-width: 600px) {
  .horrorscope-floating-card {
    padding: 22px;
  }

  .horrorscope-floating-card h2 {
    font-size: 23px;
  }

  .horrorscope-floating-card p {
    font-size: 15px;
  }
}

/* Prevent original card from appearing
   underneath the floating popup */

.horrorscope .horrorscope-card {
  display: none !important;
}


