/* Client 1005: distinct answer sections and clear interactive affordances. */
.inline-answer-grid {
  grid-template-columns: 1fr;
  gap: 44px;
  padding-block: 34px 18px;
}
.inline-answer-grid > div + div {
  border-top: 1px solid #f2e3df;
  padding-top: 36px;
}
.inline-answer-grid h3 { margin-bottom: 22px; }
.result-dialog h2 { margin-bottom: 30px; }
.result-dialog #result-image { margin-top: 18px; }

.habit-card {
  position: relative;
  border: 3px solid transparent;
  padding-bottom: 72px;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.habit-card:hover,
.habit-card:focus-visible,
.habit-card:active {
  border-color: var(--red);
  box-shadow: 0 8px 24px #bd30251a;
}
.habit-card.red-card:hover,
.habit-card.red-card:focus-visible,
.habit-card.red-card:active { border-color: #f4a5ac; }
.habit-card:active { transform: translateY(-1px); }
.habit-card-arrow {
  position: absolute;
  right: 24px;
  bottom: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--red);
  mask: url("assets/habit-arrow.webp?v=12.0.4") center / contain no-repeat;
  -webkit-mask: url("assets/habit-arrow.webp?v=12.0.4") center / contain no-repeat;
  opacity: .65;
  transition: opacity .2s ease;
}
.habit-card.red-card .habit-card-arrow {
  background: #fff;
}
.habit-card:hover .habit-card-arrow,
.habit-card:focus-visible .habit-card-arrow,
.habit-card:active .habit-card-arrow { opacity: 1; }

/* A single white circle sits inside the red disk. Keyboard focus emphasizes the X. */
dialog.content-dialog .dialog-close {
  color: #fff;
  background: var(--red);
  border: 0;
  box-shadow: none;
  outline: none;
}
dialog.content-dialog .dialog-close::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid #fff;
  border-radius: 50%;
  pointer-events: none;
}
dialog.content-dialog .dialog-close .icon { transition: transform .2s ease; }
dialog.content-dialog .dialog-close:hover { background: var(--red-dark); }
dialog.content-dialog .dialog-close:focus-visible {
  background: #76221b;
  outline: none;
}
dialog.content-dialog .dialog-close:focus-visible .icon { transform: scale(1.2); }

/* Recreated habit content replays this brief reading sequence on every opening. */
#habit-dialog[open] .habit-modal-photo,
#habit-dialog[open] .habit-modal-layout h2,
#habit-dialog[open] .habit-modal-layout p,
#habit-dialog[open] .habit-modal-layout ul {
  animation: habit-content-enter .3s ease both;
}
#habit-dialog[open] .habit-modal-layout h2 { animation-delay: .06s; }
#habit-dialog[open] .habit-modal-layout p { animation-delay: .12s; }
#habit-dialog[open] .habit-modal-layout ul { animation-delay: .18s; }
@keyframes habit-content-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 767px) {
  .inline-answer-grid { gap: 34px; padding-block: 26px 10px; }
  .inline-answer-grid > div + div { padding-top: 28px; }
  .inline-answer-grid h3 { margin-bottom: 16px; }
  .result-dialog h2 { margin-bottom: 26px; }
  .habit-card { padding-bottom: 56px; }
  .habit-card-arrow { right: 15px; bottom: 14px; width: 30px; height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .habit-card, .habit-card-arrow, dialog.content-dialog .dialog-close .icon { transition: none; }
  #habit-dialog[open] .habit-modal-photo,
  #habit-dialog[open] .habit-modal-layout h2,
  #habit-dialog[open] .habit-modal-layout p,
  #habit-dialog[open] .habit-modal-layout ul {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
