/* Countries slider -----------------------------------------------------------
 *
 * eurowiza-html/src/index.html, "COUNTRIES SECTION (SLIDER)": the heading with
 * the arrows beside it, then a row of tall photo cards that starts at the
 * container's edge and runs off the right edge of the screen. Distances,
 * radii and timings are the prototype's; small labels are 11px rather than
 * its 10px, like the site's other small labels.
 */

/* The track reaches the edge of the screen, and 100vw counts the scrollbar:
   the section keeps that from giving the page a sideways scroll. */
.eurowiza-section--countries {
  overflow-x: clip;
}

.eurowiza-countries__head {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 3rem;
}

@media (min-width: 48rem) {

  .eurowiza-countries__head {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
}

/* Outside a group the eyebrow has no layout of its own; the title's bottom
   margin belongs to the head here. */
.eurowiza-countries .eurowiza-eyebrow {
  display: flex;
}

.eurowiza-countries .eurowiza-section__title {
  margin: 0;
}

/* Arrows ------------------------------------------------------------------ */

.eurowiza-countries__nav {
  display: flex;
  flex: none;
  gap: 1rem;
}

/* The arrows need the script; without it the track is scrolled by hand. */
.eurowiza-countries:not(.is-ready) .eurowiza-countries__nav {
  display: none;
}

.eurowiza-countries__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  border: 2px solid color-mix(in oklab, var(--wp--preset--color--primary) 10%, transparent);
  border-radius: 1rem;
  background: transparent;
  color: var(--wp--preset--color--primary);
  cursor: pointer;
  transition:
    background-color 0.5s ease,
    border-color 0.5s ease,
    color 0.5s ease,
    box-shadow 0.5s ease,
    opacity 0.5s ease,
    transform 0.5s ease;
}

.eurowiza-countries__arrow span,
.eurowiza-countries__arrow svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

/* At either end the arrow that still leads somewhere is the filled one. */
.eurowiza-countries__arrow:hover,
.eurowiza-countries__arrow:focus-visible,
.eurowiza-countries__arrow.is-lead {
  border-color: var(--wp--preset--color--primary);
  background: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--default);
}

.eurowiza-countries__arrow.is-lead {
  box-shadow: 0 20px 25px -5px color-mix(in oklab, var(--wp--preset--color--primary) 20%, transparent);
  transform: scale(1.05);
}

.eurowiza-countries__arrow:active {
  transform: scale(0.95);
}

.eurowiza-countries__arrow:focus-visible {
  outline: 2px solid var(--wp--preset--color--accent);
  outline-offset: 3px;
}

/* Last, so an arrow at its end reads as off even when it would be the lead. */
.eurowiza-countries__arrow:disabled {
  border-color: color-mix(in oklab, var(--wp--preset--color--primary) 10%, transparent);
  background: transparent;
  color: var(--wp--preset--color--primary);
  box-shadow: none;
  opacity: 0.2;
  transform: none;
  cursor: not-allowed;
}

/* Track ------------------------------------------------------------------- */

.eurowiza-countries__track {
  display: flex;
  gap: 1.5rem;

  /* From the container's left edge out to the right edge of the screen.
     The 3rem underneath is room for the cards' shadow, which a scrolling box
     would otherwise clip; the negative margin gives it back, so the section
     ends the site's usual --spacing--section below the cards, like every
     other section, rather than 3rem further down. */
  margin: 0 calc(50% - 50vw) -3rem 0;
  padding: 0 0 3rem;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
}

/* Room after the last card, so it can come clear of the screen's edge. */
.eurowiza-countries__track::after {
  content: '';
  flex: 0 0 var(--container-px);
}

.eurowiza-countries.is-ready .eurowiza-countries__track {
  scrollbar-width: none;
}

.eurowiza-countries.is-ready .eurowiza-countries__track::-webkit-scrollbar {
  display: none;
}

/* Card -------------------------------------------------------------------- */

.eurowiza-country {
  position: relative;
  display: flex;
  flex: 0 0 85vw;
  flex-direction: column;

  /* The design's 32.5rem is the least a card is: one with many services grows
     to fit their chips, and the row's cards stretch to the tallest. */
  min-height: 32.5rem;
  margin: 0;
  overflow: hidden;
  border-radius: 2.5rem;
  background: var(--wp--preset--color--primary);
  box-shadow: 0 10px 15px -3px color-mix(in oklab, var(--wp--preset--color--primary) 15%, transparent);
  scroll-snap-align: start;
  isolation: isolate;
  transition: box-shadow 0.5s ease;
}

@media (min-width: 48rem) {

  .eurowiza-country {
    flex-basis: 26.25rem;
  }
}

.eurowiza-country:hover {
  box-shadow: 0 25px 50px -12px color-mix(in oklab, var(--wp--preset--color--primary) 35%, transparent);
}

/* The photo and its gradient, the whole card's link underneath the rest. */
.eurowiza-country__cover {
  position: absolute;
  inset: 0;
}

.eurowiza-country__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
  transition: transform 0.7s ease;
}

.eurowiza-country:hover .eurowiza-country__image {
  transform: scale(1.1);
}

.eurowiza-country__cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--wp--preset--color--primary), transparent 55%, rgb(0 0 0 / 20%));
}

/* More room between the rows than across them: the chips stack more often than
   they share a row, and a longer name wraps inside its chip, so 0.5rem each
   way ran them together. */
.eurowiza-country__tags {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 0.5rem;
  padding: 2rem;
}

/* Two classes in every state: theme.json's link colours are printed as
   `:root :where(a…)`. */
.eurowiza-country .eurowiza-country__chip {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border: 1px solid color-mix(in oklab, var(--wp--preset--color--default) 20%, transparent);
  border-radius: 0.75rem;
  background: color-mix(in oklab, var(--wp--preset--color--default) 10%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
  color: var(--wp--preset--color--default);
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.eurowiza-country a.eurowiza-country__chip:hover,
.eurowiza-country a.eurowiza-country__chip:focus-visible {
  border-color: var(--wp--preset--color--accent);
  background: var(--wp--preset--color--accent);
  color: var(--wp--preset--color--default);
}

/* Clicks through the foot reach the card's link beneath; the name and the
   arrow are links of their own. */
.eurowiza-country__foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding: 2.5rem;
  background: linear-gradient(to top, var(--wp--preset--color--primary), color-mix(in oklab, var(--wp--preset--color--primary) 80%, transparent), transparent);
  pointer-events: none;
}

.eurowiza-country__kicker {
  margin: 0 0 0.25rem;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--eurowiza-accent-on-dark);
}

/* Sizes set here: theme.json styles h3 unlayered. */
.eurowiza-country .eurowiza-country__name {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.05em;
  text-transform: uppercase;
  color: var(--wp--preset--color--default);
}

/* The name stays still on hover. */
.eurowiza-country .eurowiza-country__link,
.eurowiza-country .eurowiza-country__link:hover {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}

.eurowiza-country .eurowiza-country__link:focus-visible {
  outline: 2px solid var(--wp--preset--color--highlight);
  outline-offset: 4px;
  border-radius: 0.25rem;
}

/* The arrow lights up only under the pointer itself, not with the card. Two
   classes: it is a link, and theme.json prints link colours as
   `:root :where(a…)`. */
.eurowiza-country .eurowiza-country__arrow {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border: 1px solid color-mix(in oklab, var(--wp--preset--color--default) 10%, transparent);
  border-radius: 1rem;
  background: color-mix(in oklab, var(--wp--preset--color--default) 5%, transparent);
  color: var(--wp--preset--color--accent);
  pointer-events: auto;
  transition: background-color 0.5s ease, color 0.5s ease, box-shadow 0.5s ease, transform 0.5s ease;
}

.eurowiza-country__arrow svg {
  width: 1.75rem;
  height: 1.75rem;
}

.eurowiza-country .eurowiza-country__arrow:hover {
  background: var(--wp--preset--color--accent);
  color: var(--wp--preset--color--default);
  box-shadow: 0 20px 40px color-mix(in oklab, var(--wp--preset--color--accent) 30%, transparent);
  transform: scale(1.1);
}

@media (prefers-reduced-motion: reduce) {

  .eurowiza-countries__arrow,
  .eurowiza-country,
  .eurowiza-country__image,
  .eurowiza-country .eurowiza-country__chip,
  .eurowiza-country .eurowiza-country__arrow {
    transition: none;
  }

  .eurowiza-countries__arrow.is-lead,
  .eurowiza-countries__arrow:active,
  .eurowiza-country:hover .eurowiza-country__image,
  .eurowiza-country .eurowiza-country__arrow:hover {
    transform: none;
  }
}

