/* « Défi couple 30 jours » (static/js/couple-parents/defi.js): the version, the challenge of the day on its
   card, then the calendar, one tile per day in the colour of its kind (--kind, from the cp-idea--<kind>
   classes of couple-parents.css). The card keeps the height of the longest challenge (hidden sizer):
   nothing jumps from one day to the next. */

.cp-defi__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 16px;
}

.cp-defi__modes {
  display: flex;
  gap: 8px;
}

.cp-defi__modes .cp-time {
  padding: 0 18px;
}

.cp-section .cp-defi__progress,
.cp-defi__progress {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--cp-muted);
  font-size: .92rem;
  font-weight: 850;
}

.cp-defi__meter {
  position: relative;
  overflow: hidden;
  width: 120px;
  height: 8px;
  border-radius: 999px;
  background: #f1e4ef;
}

.cp-defi__meter span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cp-lamp), var(--cp-hot) 60%, var(--cp-violet));
  transition: width .5s var(--cp-ease);
}

/* ---- The challenge of the day ---- */
.cp-defi__card {
  position: relative;
  overflow: hidden;
  padding: 20px 20px 18px 24px;
  border: 1px solid var(--cp-line);
  border-radius: 22px;
  background: linear-gradient(160deg, #fff 0%, #fff6fb 100%);
}

.cp-defi__card::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 0;
  width: 5px;
  border-radius: 0 6px 6px 0;
  background: var(--kind);
  transition: background .3s ease;
}

.cp-defi__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
}

.cp-defi__day {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #2a0f33;
  color: #fff;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .03em;
}

.cp-defi__body {
  display: grid;
  margin-bottom: 16px;
}

.cp-defi__copy {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity .28s ease, transform .34s var(--cp-ease);
}

.cp-defi__copy.is-leaving {
  opacity: 0;
  transform: translateY(-8px);
  transition-duration: .18s;
}

.cp-defi__copy.is-entering {
  opacity: 0;
  transform: translateY(10px);
  transition: none;
}

.cp-defi__sizer {
  visibility: hidden;
}

.cp-defi__title {
  margin: 0;
  color: var(--cp-ink);
  font-size: clamp(1.4rem, 4.4vw, 1.75rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.cp-defi__text {
  margin: 0;
  color: #4d3a50;
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.55;
}

.cp-defi__nav {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
}

.cp-defi__arrow {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid var(--cp-line);
  border-radius: 50%;
  background: #fff;
  color: var(--cp-ink);
  font-size: 20px;
  cursor: pointer;
  transition: border-color .2s ease, transform .2s var(--cp-ease), opacity .2s ease;
}

.cp-defi__arrow:hover:not(:disabled) {
  border-color: rgba(233, 30, 117, .4);
  transform: translateY(-1px);
}

.cp-defi__arrow:disabled {
  opacity: .35;
  cursor: default;
}

.cp-defi__back {
  transform: rotate(180deg);
}

.cp-defi__done .cp-icon {
  opacity: .55;
  transition: opacity .2s ease, transform .3s var(--cp-ease);
}

.cp-defi__done[aria-pressed="true"] {
  background: linear-gradient(135deg, #0f9f8f, #14b8a6);
  box-shadow: 0 14px 30px rgba(15, 159, 143, .3);
}

.cp-defi__done[aria-pressed="true"] .cp-icon {
  opacity: 1;
  transform: scale(1.15);
}

/* ---- The calendar: one tile per day, ticked in the colour of its kind ---- */
.cp-defi__days {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
}

.cp-defi__days li {
  list-style: none;
}

.cp-defi__tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid var(--cp-line);
  border-radius: 14px;
  background: #fff;
  color: var(--cp-ink);
  font-size: .98rem;
  font-weight: 900;
  cursor: pointer;
  transition: border-color .2s ease, background .25s ease, transform .2s var(--cp-ease), box-shadow .2s ease;
}

.cp-defi__tile:hover {
  border-color: color-mix(in srgb, var(--kind) 50%, #fff);
  transform: translateY(-2px);
}

.cp-defi__tile > * {
  grid-area: 1 / 1;
}

.cp-defi__tick {
  opacity: 0;
  font-size: 1.15rem;
}

.cp-defi__tile.is-done {
  border-color: transparent;
  background: var(--kind);
  color: #fff;
}

.cp-defi__tile.is-done span {
  opacity: 0;
}

.cp-defi__tile.is-done .cp-defi__tick {
  opacity: 1;
}

.cp-defi__tile.is-current {
  border-color: var(--kind);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--kind) 22%, transparent), 0 10px 20px rgba(72, 22, 64, .12);
}

.cp-defi__tile.is-done.is-current {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--kind);
}

.cp-defi__tile.is-popping {
  animation: cp-defi-pop .55s var(--cp-ease);
}

/* ---- The end of the challenge ---- */
.cp-defi__finished {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff4e6 0%, #ffe8f2 100%);
  animation: cp-rise .6s var(--cp-ease) both;
}

.cp-defi__finished[hidden] {
  display: none;
}

.cp-section .cp-defi__finished p,
.cp-defi__finished p {
  margin: 0 0 12px;
  color: #4d3a50;
  font-weight: 650;
  line-height: 1.55;
}

.cp-defi__finished .cp-defi__finished-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--cp-ink);
  font-size: 1.3rem;
  font-weight: 900;
}

.cp-defi__finished-title .cp-icon {
  color: var(--cp-hot);
}

@keyframes cp-defi-pop {
  0% { transform: scale(.8); }
  55% { transform: scale(1.12); }
  100% { transform: none; }
}

@media (max-width: 600px) {
  .cp-defi__top {
    flex-direction: column;
    align-items: stretch;
  }

  .cp-defi__modes .cp-time {
    flex: 1 1 0;
    padding: 0 10px;
  }

  .cp-defi__progress {
    justify-content: space-between;
  }

  .cp-defi__meter {
    flex: 1 1 auto;
  }

  .cp-defi__days {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .cp-defi__nav {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
  }

  .cp-defi__arrow {
    width: 46px;
    height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cp-defi__meter span,
  .cp-defi__copy,
  .cp-defi__arrow,
  .cp-defi__tile,
  .cp-defi__done .cp-icon {
    transition: none;
  }

  .cp-defi__tile.is-popping,
  .cp-defi__finished {
    animation: none;
  }
}
