/* Accordion progress — when every visible required field of a group is filled,
   the right/down arrow turns into a light-teal checkmark.
   Toggled by js/group-progress.js (adds .is-complete to .group).
   Load AFTER style.css and light.css. */

:root {
  --gc-check: #8FE3D7;
  --gc-bg: rgba(95, 192, 180, .16);
  --gc-border: rgba(95, 192, 180, .55);
  --gc-glow: 95, 192, 180;
}
html[data-theme="light"] {
  --gc-check: #2BA597;
  --gc-bg: rgba(31, 143, 130, .12);
  --gc-border: rgba(31, 143, 130, .45);
  --gc-glow: 31, 143, 130;
}

.group-chevron-wrap { position: relative; }

/* the check, drawn left-to-right with a clip-path wipe */
.group-chevron-wrap::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  background: var(--gc-check);
  -webkit-mask: var(--gc-mask) center / contain no-repeat;
  mask: var(--gc-mask) center / contain no-repeat;
  --gc-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.4 8.7l3 3 6.2-6.6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  clip-path: inset(0 100% 0 0);
  transition: clip-path .2s ease;
  pointer-events: none;
}

.group-chevron { transition: transform .35s var(--ease), color .2s var(--ease), opacity .25s var(--ease); }

/* complete state (doubled class beats the open-state and light-theme rules) */
html:root .group.is-complete.is-complete > .group-title .group-chevron-wrap {
  background: var(--gc-bg);
  border-color: var(--gc-border);
  box-shadow: 0 3px 10px -3px rgba(var(--gc-glow), .55);
  animation: cgTick .6s cubic-bezier(.34, 1.4, .5, 1) both;
}
html:root .group.is-complete.is-complete > .group-title .group-chevron {
  opacity: 0;
  transform: rotate(90deg) scale(.3);
}
html:root .group.is-complete.is-complete > .group-title .group-chevron-wrap::after {
  clip-path: inset(0 0 0 0);
  transition: clip-path .45s cubic-bezier(.65, 0, .35, 1) .15s;
}
html:root .group.is-complete.is-complete > .group-title:hover .group-chevron-wrap {
  border-color: var(--gc-check);
}

@keyframes cgTick {
  0%   { transform: scale(.78); box-shadow: 0 0 0 0 rgba(var(--gc-glow), .45); }
  55%  { transform: scale(1.12); }
  100% { transform: scale(1);   box-shadow: 0 0 0 7px rgba(var(--gc-glow), 0), 0 3px 10px -3px rgba(var(--gc-glow), .55); }
}

/* first paint / restored data: no animation */
.group.cg-quiet .group-chevron-wrap,
.group.cg-quiet .group-chevron-wrap::after,
.group.cg-quiet .group-chevron { animation: none !important; transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  html:root .group.is-complete.is-complete > .group-title .group-chevron-wrap { animation: none; }
  .group-chevron-wrap::after,
  html:root .group.is-complete.is-complete > .group-title .group-chevron-wrap::after { transition: none; }
}

/* light theme: flat, no glow */
html:root[data-theme="light"] .group.is-complete.is-complete > .group-title .group-chevron-wrap {
  box-shadow: 0 1px 2px rgba(20, 28, 48, .12);
  animation-name: cgTickFlat;
}
@keyframes cgTickFlat {
  0%   { transform: scale(.8); }
  55%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}