/* Resources: a looping carousel of cards over a slower-moving moon panorama.
   Rewritten from the Gatsby site's resources.tsx; sizes and colours unchanged.
   resources.js positions the cards; without it they form a scrollable row. */

.resources-page { overflow: hidden; }

.hub {
  position: relative; overflow: hidden;
  height: 100vh; height: 100dvh; width: 100vw;
  padding: 50px 0 100px;
  display: flex; flex-flow: column nowrap; align-items: center; justify-content: center;
  user-select: none;
}

.hub__panorama {
  position: absolute; inset: 0;
  background: url(/assets/img/moon-panorama.jpg) repeat-x 0 center / auto 100%;
  opacity: 0.6; pointer-events: none;
}

/* Track: cards in a row. Once resources.js runs it sets .is-carousel and
   moves each card itself. */
.hub__track {
  --card-width: 600px;
  position: relative; z-index: 1;
  width: 100%; height: 350px; margin: 50px 0 20px;
  display: flex; gap: 0; overflow-x: auto; touch-action: pan-y;
}
.hub__track.is-carousel { overflow: visible; display: block; cursor: grab; }
.hub__track.is-dragging { cursor: grabbing; }
.is-carousel .hub-card { position: absolute; top: 0; left: 0; will-change: transform; }

.hub-card {
  flex: none; position: relative; isolation: isolate;
  width: var(--card-width); height: 350px;
  border-left: 20px solid transparent; border-right: 20px solid transparent;  /* gap between cards */
  background-clip: padding-box;
  display: flex; justify-content: center; align-items: center;
  padding: 3rem 3rem;
  font-size: 1.5rem; text-transform: uppercase; text-align: center;
  transition: opacity 0.3s;
}
/* The visible white frame, inside the gap. */
.hub-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border: 2px solid white;
  background: transparent;
}
/* The animated image, shown only on the centred card. */
.hub-card::after {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: center / cover no-repeat;
  opacity: 0.7;
}
.hub-card h2 { margin: 0; font-size: 2.5rem; font-weight: normal; }
.hub-card:visited { color: #bfbfbf; }
.hub-card__type {
  display: none; position: absolute; bottom: 0; left: 0;
  width: 110px; padding: 7px 20px;
  font-family: var(--font-header); font-size: 15px; text-transform: uppercase;
  background-color: var(--highlight); color: black;
}

.hub-card.is-current { color: white; }
.hub-card.is-current::before { border: 5px solid var(--highlight); background-color: rgb(0 0 0 / 0.3); }
.hub-card.is-current::after { background-image: var(--image); }
.hub-card.is-current .hub-card__type { display: block; }
.hub-card.is-hidden { opacity: 0; }

/* The welcome card (first in the loop) */
.hub-card--welcome { cursor: default; padding: 0; }
.hub-card--welcome::before { border: none; background: none; }
.hub-card--welcome.is-current::before { border: none; background: none; }
.hub-welcome {
  width: 100%; height: 350px; padding: 4rem;
  background-color: var(--highlight); color: black;
  font-family: var(--font-header); font-size: 1.5rem; text-align: center;
}
.hub-welcome h1 { font-size: 4rem; margin: 0 0 2rem; }
.hub-welcome p { font-size: 1.2rem; line-height: 1.7rem; text-transform: none; margin: 0; }
.hub-welcome h2 { font-size: 1.5rem; margin: 2rem 0 1.5rem; }
.hint-touch { display: none; }
@media (hover: none) {
  .hint-pointer { display: none; }
  .hint-touch { display: inline; }
}

/* Arrows and position */
.hub__controls {
  position: relative; z-index: 1;
  display: grid; grid-template-areas: "prev position next"; align-items: center;
  padding: 1rem 0;
}
.hub__arrow {
  width: 35px; height: 35px; margin: 0 2rem;
  background: url(/assets/img/arrow-left.png) no-repeat center / contain;
  /* the arrow image is black; these filters turn it white, and green on hover */
  filter: invert(100%) sepia(0%) saturate(7500%) hue-rotate(353deg) brightness(112%) contrast(104%);
}
.hub__arrow:hover { filter: invert(93%) sepia(5%) saturate(2399%) hue-rotate(55deg) brightness(94%) contrast(110%); }
.hub__arrow--prev { grid-area: prev; }
.hub__arrow--next { grid-area: next; transform: rotate(180deg); }
.hub__position { grid-area: position; width: 65px; height: 26px; text-align: center; font-family: var(--font-header); font-size: 1.5rem; }

.hub__footer { position: absolute; bottom: 0; width: 100%; z-index: 1; }

@media (max-width: 767px) {
  .hub { padding-bottom: 50px; }
  .hub__track { --card-width: 300px; }
  .hub-card h2 { font-size: 2rem; padding: 2rem; }
  .hub-welcome { padding: 2rem; }
  .hub-welcome h1 { font-size: 2.5rem; }
  .hub-welcome p { font-size: 1rem; }
  .hub-welcome h2 { font-size: 1rem; }
  .hub__controls { padding: 0 0 1rem; }
  .hub__arrow { display: none; }
}
