/* « Qui pense à quoi » (static/js/couple-parents/charge.js): an evening card in the reading page. The
   things to think of come one at a time, then who carries the list and a table to share it out again.
   Colours of the shares: me = pink, both = the lamp, the other = violet. */

.cp-charge {
  --share-me: #ff5c8a;
  --share-both: #ffb070;
  --share-other: #a46bff;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 20px;
  padding: clamp(20px, 4vw, 30px);
  border-radius: 26px;
  color: #fff;
  background:
    radial-gradient(80% 70% at 100% 0%, rgba(247, 37, 133, .32), transparent 62%),
    radial-gradient(70% 60% at 0% 100%, rgba(139, 44, 246, .3), transparent 65%),
    linear-gradient(160deg, #2a0f33 0%, #3b163f 52%, #4a1d6e 100%);
  box-shadow: 0 26px 60px rgba(42, 12, 48, .26);
}

.cp-charge.is-resizing {
  transition: height .38s var(--cp-ease);
}

.cp-charge__panel {
  transition: opacity .32s ease, transform .4s var(--cp-ease);
}

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

.cp-charge__panel.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
  transition-duration: .2s;
}

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

/* ---- Before starting: three of the things to think of, fanned out ---- */
.cp-charge__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.cp-charge__fan {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 190px;
  margin: 4px 0 18px;
  padding: 0;
}

/* Three cards of the game, the middle one on top. */
.cp-charge__fan li {
  --side: calc(var(--i) - 1);
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 210px;
  min-height: 138px;
  padding: 18px 16px;
  border-radius: 18px;
  background: linear-gradient(160deg, #fff 0%, #fff3f9 100%);
  color: var(--cp-ink);
  text-align: left;
  list-style: none;
  box-shadow: 0 18px 36px rgba(16, 4, 24, .38);
  rotate: calc(var(--side) * 8deg);
  translate: calc(var(--side) * 150px) calc(var(--side) * var(--side) * 14px);
}

.cp-charge__fan li:nth-child(1) { z-index: 1; }
.cp-charge__fan li:nth-child(2) { z-index: 3; }
.cp-charge__fan li:nth-child(3) { z-index: 2; }

.cp-charge__fan strong {
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1.2;
}

.cp-charge__fan span {
  color: var(--cp-muted);
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.4;
}

.cp-section .cp-charge__note {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, .7);
  font-size: .92rem;
  font-weight: 700;
}

.cp-section .cp-charge__noscript {
  margin: 14px 0 0;
  color: #ffd98a;
  font-weight: 800;
}

/* ---- One thing at a time ---- */
.cp-charge__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cp-charge__back,
.cp-charge__skip {
  padding: 6px 2px;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, .72);
  font-size: .92rem;
  font-weight: 800;
  cursor: pointer;
}

.cp-charge__back::before {
  content: "← ";
}

.cp-charge__back:hover,
.cp-charge__skip:hover {
  color: #fff;
}

.cp-section .cp-charge__count {
  margin: 0;
  color: #ffd98a;
  font-size: .85rem;
  font-weight: 900;
  letter-spacing: .04em;
}

.cp-charge__bar {
  overflow: hidden;
  height: 6px;
  margin-bottom: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
}

.cp-charge__bar-fill {
  display: block;
  width: calc(var(--p, 0) * 100%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cp-lamp), var(--cp-hot) 60%, var(--cp-violet));
  transition: width .45s var(--cp-ease);
}

.cp-charge__viewport {
  position: relative;
  display: grid;
}

.cp-charge__viewport.is-moving {
  overflow: hidden;
}

.cp-charge__card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: opacity .3s ease, transform .34s var(--cp-ease);
}

.cp-charge__card.is-leaving { opacity: 0; transform: translateX(-26px); transition-duration: .2s; }
.cp-charge__card.is-leaving-back { opacity: 0; transform: translateX(26px); transition-duration: .2s; }
.cp-charge__card.is-entering { opacity: 0; transform: translateX(26px); transition: none; }
.cp-charge__card.is-entering-back { opacity: 0; transform: translateX(-26px); transition: none; }

/* Invisible copy where every task is measured (lockHeight in charge.js). */
.cp-charge__probe {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  visibility: hidden;
  pointer-events: none;
}

.cp-section .cp-charge__task {
  margin: 0 0 8px;
  color: #fff;
  font-size: clamp(1.45rem, 4.6vw, 1.9rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -.02em;
  outline: none;
}

.cp-section .cp-charge__hint {
  margin: 0 0 22px;
  color: rgba(255, 255, 255, .78);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
}

.cp-section .cp-charge__question {
  margin: auto 0 10px;
  color: #ffd98a;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.cp-charge__choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-bottom: 8px;
}

.cp-charge__choice {
  --share: var(--share-me);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 16px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 1.02rem;
  font-weight: 900;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, opacity .25s ease, transform .25s var(--cp-ease);
}

.cp-charge__choice::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--share);
  box-shadow: 0 0 10px var(--share);
}

.cp-charge__choice--both { --share: var(--share-both); }
.cp-charge__choice--other { --share: var(--share-other); }

.cp-charge__choice:hover {
  border-color: var(--share);
  background: rgba(255, 255, 255, .16);
  transform: translateY(-2px);
}

.cp-charge__choices.has-pick .cp-charge__choice:not(.is-picked) {
  opacity: .45;
}

.cp-charge__choice.is-picked,
.cp-charge__choice[aria-pressed="true"] {
  border-color: transparent;
  background: var(--share);
  color: #2a0f33;
  transform: scale(1.04);
}

.cp-charge__choice.is-picked::before,
.cp-charge__choice[aria-pressed="true"]::before {
  background: #fff;
  box-shadow: none;
}

.cp-charge__skip {
  align-self: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- The result: who holds the list, then the table to share it out again ---- */
.cp-section .cp-charge__kicker {
  margin: 0 0 6px;
  color: #ffd98a;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.cp-section .cp-charge__title {
  margin: 0 0 10px;
  color: #fff;
  font-size: clamp(1.4rem, 4.2vw, 1.8rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -.02em;
  outline: none;
}

.cp-section .cp-charge__text {
  margin: 0 0 18px;
  color: rgba(255, 255, 255, .86);
  font-size: 1.03rem;
  font-weight: 600;
  line-height: 1.6;
}

.cp-charge__shares {
  margin-bottom: 24px;
}

.cp-charge__share-bar {
  display: flex;
  gap: 3px;
  overflow: hidden;
  height: 14px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
}

.cp-charge__share {
  flex: var(--w) 1 0;
  min-width: 0;
  animation: cp-charge-grow .9s var(--cp-ease) both;
}

.cp-charge__share--me { background: var(--share-me); }
.cp-charge__share--both { background: var(--share-both); animation-delay: .1s; }
.cp-charge__share--other { background: var(--share-other); animation-delay: .2s; }

.cp-charge__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
}

.cp-charge__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .95rem;
  font-weight: 800;
}

.cp-charge__legend-item::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--share-me);
}

.cp-charge__legend-item--both::before { background: var(--share-both); }
.cp-charge__legend-item--other::before { background: var(--share-other); }

.cp-charge__legend dt {
  color: rgba(255, 255, 255, .8);
}

.cp-charge__legend dd {
  margin: 0;
  color: #fff;
}

.cp-charge__replan {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 20px;
  background: rgba(255, 255, 255, .06);
}

.cp-section .cp-charge__plan-title {
  margin: 0 0 4px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 900;
}

.cp-section .cp-charge__plan-hint {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, .72);
  font-size: .93rem;
  line-height: 1.5;
}

.cp-charge__plan {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cp-section .cp-charge__col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--share-me);
  color: #fff;
  font-size: .9rem;
  font-weight: 900;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.cp-charge__col--both .cp-charge__col-head { border-color: var(--share-both); }
.cp-charge__col--other .cp-charge__col-head { border-color: var(--share-other); }

.cp-charge__col-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  font-size: .8rem;
}

.cp-charge__lines {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
}

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

.cp-charge__line {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: .9rem;
  font-weight: 750;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}

.cp-charge__line:hover {
  border-color: rgba(255, 255, 255, .4);
  background: rgba(255, 255, 255, .14);
}

.cp-charge__line.is-moved {
  animation: cp-charge-pop .45s var(--cp-ease);
}

.cp-charge__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.cp-charge__actions .cp-btn {
  min-height: 46px;
}

@keyframes cp-charge-grow {
  from { flex-grow: 0; }
}

@keyframes cp-charge-pop {
  0% { transform: scale(.94); background: rgba(255, 255, 255, .3); }
  100% { transform: none; }
}

@media (max-width: 600px) {
  .cp-charge {
    border-radius: 22px;
  }

  .cp-charge__fan {
    min-height: 170px;
  }

  .cp-charge__fan li {
    width: 150px;
    min-height: 124px;
    padding: 14px 12px;
    translate: calc(var(--side) * 84px) calc(var(--side) * var(--side) * 12px);
  }

  .cp-charge__fan span {
    display: none;
  }

  .cp-charge__choice {
    flex-direction: column;
    gap: 6px;
    min-height: 64px;
    font-size: .98rem;
  }

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

  .cp-charge__actions .cp-btn {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cp-charge.is-resizing,
  .cp-charge__panel,
  .cp-charge__card,
  .cp-charge__bar-fill,
  .cp-charge__choice {
    transition: none;
  }

  .cp-charge__share,
  .cp-charge__line.is-moved {
    animation: none;
  }
}
