/* Composition 4: the check-in, moment by moment. */
.v3-checkin-section {
  --ci-bg: #eff1f6;
  --ci-blue: #2540b0;
  --ci-green: #2f8f6b;
  --ci-green-bg: #dcefe6;
  margin: 0;
}

.v3-checkin-section .ci-defs {
  position: absolute;
}

.ci-lead {
  max-width: 62ch;
  margin: 12px 0 0;
  color: var(--v3-copy);
  font-size: 16px;
  line-height: 1.6;
}

.ci {
  position: relative;
  margin-top: 28px;
  padding: clamp(16px, 2.4vw, 28px);
  border-radius: 24px;
  background: var(--ci-bg);
}

.ci-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.8vw, 22px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ci-step {
  display: grid;
  gap: 14px;
  align-content: start;
}

.ci-step:nth-child(1) { --at: 0s; }
.ci-step:nth-child(2) { --at: 1.3s; }
.ci-step:nth-child(3) { --at: 3.4s; }
.ci-step:nth-child(4) { --at: 4.9s; }

.ci-frame {
  position: relative;
  aspect-ratio: 9 / 15.5;
  overflow: hidden;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(11, 40, 57, 0.12), 0 2px 6px rgba(11, 40, 57, 0.06);
}

.ci-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
}

.ci-cap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  color: var(--v3-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.ci-cap b {
  display: grid;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--ci-blue);
  color: #fff;
  font-family: var(--v3-mono);
  font-size: 11px;
}

.ci-progress {
  position: absolute;
  right: clamp(16px, 2.4vw, 28px);
  bottom: 8px;
  left: clamp(16px, 2.4vw, 28px);
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe3ec;
}

.ci-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ci-blue);
}

/* ---- 1. Intro ---- */
.ci-frame--intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12% 9% 9%;
  background: #f1f2f7;
  text-align: center;
}

.ci-badge {
  display: grid;
  width: 34%;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: #e2e6f3;
}

.ci-badge svg {
  width: 50%;
  height: 50%;
  fill: none;
  stroke: var(--ci-blue);
  stroke-width: 1.700;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ci-frame--intro strong {
  margin-top: 9%;
  color: var(--v3-ink);
  font-size: clamp(12px, 1.25vw, 15px);
  font-weight: 700;
}

.ci-frame--intro ul {
  display: grid;
  gap: 8px;
  width: 100%;
  margin: 9% 0 0;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  list-style: none;
  text-align: left;
}

.ci-frame--intro li {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--v3-ink);
  font-size: clamp(9px, 0.9vw, 11px);
  line-height: 1.25;
}

.ci-frame--intro li b {
  display: grid;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 50%;
  background: #e2e6f3;
  color: var(--ci-blue);
  font-size: 9px;
}

.ci-button {
  width: 100%;
  margin-top: auto;
  padding: 9px 6px;
  border-radius: 9px;
  background: var(--ci-blue);
  color: #fff;
  font-size: clamp(10px, 1vw, 12px);
  font-weight: 650;
}

/* ---- 2. Liveness ---- */
.ci-frame--live {
  display: grid;
  place-items: center;
  background: #0d0f14;
}

.ci-oval {
  position: relative;
  display: block;
  width: 68%;
  aspect-ratio: 1 / 1.34;
  border-radius: 50%;
}

.ci-oval img {
  border-radius: 50%;
  filter: grayscale(1) contrast(1.15) brightness(1.05);
}

.ci-ring,
.ci-ring::before {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
}

.ci-ring {
  z-index: 1;
  border: 4px solid #5fe36c;
}

.ci-ring::before {
  content: "";
  inset: -4px;
  padding: 4px;
  background: conic-gradient(#8cff3b, #c13bff, #3b5bff, #8cff3b);
  opacity: 0;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

.ci-tip {
  position: absolute;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 9px;
  font-size: clamp(9px, 0.95vw, 11.500px);
  font-weight: 650;
  transform: translateX(-50%);
  white-space: nowrap;
}

.ci-tip--ask {
  top: 22%;
  background: rgba(40, 42, 50, 0.92);
  color: #fff;
  opacity: 0;
}

.ci-tip--ok {
  bottom: 7%;
  background: var(--ci-green-bg);
  color: #1d6f52;
}

.ci-tip--ok svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.400;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- 3. Selfie camera ---- */
.ci-frame--cam {
  background: #1b1d22;
}

.ci-brackets {
  position: absolute;
  inset: 16% 16% 30%;
  border: 1.500px solid rgba(255, 255, 255, 0.85);
  border-radius: 12px;
}

.ci-shutter {
  position: absolute;
  bottom: 6%;
  left: 50%;
  width: 20%;
  aspect-ratio: 1;
  margin-left: -10%;
  border: 3px solid #fff;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 2px #1b1d22;
}

.ci-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
}

/* ---- 4. Sealed record ---- */
.ci-frame--done {
  display: flex;
  flex-direction: column;
}

.ci-done-photo {
  flex: 1;
  min-height: 0;
}

.ci-done-place {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -16px 8px 0;
  padding: 9px 10px;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(11, 40, 57, 0.14);
}

.ci-done-place .country-flag-v3 {
  flex: 0 0 auto;
  width: 20px;
  height: 14px;
  border-radius: 2px;
}

.ci-done-place > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.ci-done-place strong {
  overflow: hidden;
  color: var(--v3-ink);
  font-size: clamp(10px, 1vw, 12px);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ci-done-place time {
  color: var(--v3-tertiary);
  font-size: clamp(8.500px, 0.82vw, 10px);
}

.ci-seals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin: 0;
  padding: 12px 4px 8px;
  list-style: none;
  text-align: center;
}

.ci-seals li {
  display: grid;
  justify-items: center;
  gap: 5px;
  color: var(--v3-copy);
  font-size: clamp(8px, 0.78vw, 9.500px);
}

.ci-seals i {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--ci-green-bg);
}

.ci-seals svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--ci-green);
  stroke-width: 1.800;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ci-done-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 10px;
  padding: 8px 0 10px;
  border-top: 1px solid #edeff3;
}

.ci-done-status span {
  color: var(--v3-tertiary);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ci-done-status b {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--ci-green-bg);
  color: #1d6f52;
  font-size: 10px;
  font-weight: 650;
}

/* ---- Sequence: plays once. Without these classes the resting state shows. ---- */
.ci.is-armed .ci-frame { opacity: 0.38; }
.ci.is-armed .ci-cap { opacity: 0.45; }
.ci.is-armed .ci-progress span { width: 0; }
.ci.is-armed .ci-ring { border-color: #3a3d46; }
.ci.is-armed .ci-tip--ok,
.ci.is-armed .ci-seals li,
.ci.is-armed .ci-done-status b { opacity: 0; }

.ci.is-playing .ci-frame,
.ci.is-playing .ci-cap {
  animation: ci-on 0.45s ease both;
  animation-delay: var(--at);
}

.ci.is-playing .ci-progress span {
  animation: ci-fill 5.9s linear both;
}

.ci.is-playing .ci-ring {
  animation: ci-ring-ok 0.4s ease 3.1s both;
}

.ci.is-playing .ci-ring::before {
  animation: ci-scan 1.8s linear 1.3s both;
}

.ci.is-playing .ci-oval img {
  animation: ci-closer 1.6s ease-in-out 1.5s both;
}

.ci.is-playing .ci-tip--ask {
  animation: ci-blip 1.3s ease 1.5s both;
}

.ci.is-playing .ci-tip--ok {
  animation: ci-pop 0.4s ease 3.1s both;
}

.ci.is-playing .ci-shutter {
  animation: ci-press 0.35s ease 4.25s both;
}

.ci.is-playing .ci-flash {
  animation: ci-flash 0.5s ease 4.4s both;
}

.ci.is-playing .ci-seals li {
  animation: ci-pop 0.4s cubic-bezier(0.3, 1.4, 0.5, 1) both;
  animation-delay: calc(5.3s + var(--seal) * 0.2s);
}

.ci.is-playing .ci-done-status b {
  animation: ci-pop 0.4s ease 6.1s both;
}

@keyframes ci-on { from { opacity: 0.38; } to { opacity: 1; } }
@keyframes ci-fill { from { width: 0; } to { width: 100%; } }
@keyframes ci-ring-ok { from { border-color: #3a3d46; } to { border-color: #5fe36c; } }
@keyframes ci-scan {
  0% { opacity: 0; transform: rotate(0); }
  12%, 88% { opacity: 1; }
  100% { opacity: 0; transform: rotate(340deg); }
}
@keyframes ci-closer { 0%, 100% { transform: scale(1); } 55% { transform: scale(1.13); } }
@keyframes ci-blip { 0%, 100% { opacity: 0; } 18%, 80% { opacity: 1; } }
@keyframes ci-pop { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }
@keyframes ci-press { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.86); } }
@keyframes ci-flash { 0%, 100% { opacity: 0; } 25% { opacity: 0.85; } }

/* The "passed" tip is centred with a transform, so its pop must keep it. */
.ci.is-playing .ci-tip--ok { animation-name: ci-pop-centre; }
@keyframes ci-pop-centre {
  from { opacity: 0; transform: translateX(-50%) scale(0.7); }
  to { opacity: 1; transform: translateX(-50%); }
}

@media (max-width: 820px) {
  .ci-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 26px;
  }

  .ci-frame--intro li { font-size: 11px; }
  .ci-frame--intro strong { font-size: 14px; }
  .ci-button { font-size: 12px; }
  .ci-tip { font-size: 10px; }
  .ci-tip--ok {
    max-width: 88%;
    padding: 5px 8px;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }
  .ci-done-place strong { font-size: 10.500px; }
  .ci-done-place time { font-size: 8.500px; white-space: nowrap; }
  .ci-seals li { font-size: 9px; }
}

@media (max-width: 420px) {
  .ci { padding: 12px 12px 22px; border-radius: 18px; }
  .ci-cap { font-size: 12.500px; }
  .ci-frame--intro li { font-size: 9.500px; }
  .ci-frame--intro ul { padding: 8px; gap: 6px; }
  .ci-seals i { width: 24px; height: 24px; }
  .ci-seals svg { width: 13px; height: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .ci * { animation: none !important; }
}
