/* Case-study section language (pilot: Chance AI · 06 Input & recovery).
   No grey panels, no decorative chips. Screens lead; labels appear on hover
   (always shown on touch). Disclosures are black pill buttons. */

:root {
  --cs-line: #e4e7eb;
  --cs-frame: #e7eaee;
  --cs-text: #202124;
  --cs-muted: #5f6670;
  --cs-accent: #075eae;
}

.cs-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Groups: no background, separated by space + hairline ---------- */
body .chance-page #interaction :is(.cp-input-group, .cp-recovery-group) {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0;
  padding: 0;
  margin: 0;
}
body .chance-page #interaction .cp-input-group { margin-top: 40px; }
body .chance-page #interaction .cp-input-group > .cp-shared { margin: 0; padding: 0; }
body .chance-page #interaction .cp-recovery-group {
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--cs-line) !important;
}
body .chance-page #interaction .cp-recovery-group > .cp-shared { text-align: left; margin: 0 0 24px; padding: 0; }
body .chance-page #interaction .cp-shared h3 {
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: var(--cs-text);
  margin: 0;
}

/* ---------- Screens: light outlined frames, equal height ---------- */
body .chance-page #interaction .cp-state-grid { gap: 24px; margin: 0; }

body .chance-page #interaction .cp-state-grid figure { margin: 0; }

body .chance-page #interaction .cp-state-grid .cp-image {
  height: auto;
  aspect-ratio: 1 / 1.08;
  max-height: none;
  border: 1px solid var(--cs-frame);
  border-radius: 18px;
  background: #fafbfc;
  box-shadow: none;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
body .chance-page #interaction .cp-state-grid .cp-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 0;
}
body .chance-page #interaction #boundaries figure:first-child .cp-image img { object-position: bottom center; }
body .chance-page #interaction #boundaries figure:nth-child(3) .cp-image img { object-position: center 11%; }
/* Recovery screens are short dialogs: center them in the frame */
body .chance-page #interaction .cp-recovery-group .cp-image {
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
body .chance-page #interaction .cp-recovery-group .cp-image img {
  height: auto;
  max-height: 100%;
  object-fit: contain;
  border-radius: 14px;
}
body .chance-page #interaction .cp-state-grid .cp-image:hover {
  border-color: #cfd5dc;
  box-shadow: 0 14px 30px -22px rgba(32, 33, 36, .35);
  transform: translateY(-2px);
}

/* ---------- Labels: hidden until hover, shown as a dark pill on the screen ---------- */
body .chance-page #interaction .cp-state-grid figure { position: relative; }
body .chance-page #interaction .cp-state-grid figcaption {
  position: absolute;
  left: 14px;
  bottom: 14px;
  max-width: calc(100% - 28px);
  margin: 0;
  padding: 8px 14px;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  border-radius: 999px;
  background: rgba(17, 17, 17, .88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 13px;
  line-height: 1.3;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
}
body .chance-page #interaction .cp-state-grid figcaption strong {
  display: inline;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
}
body .chance-page #interaction .cp-state-grid figcaption .cs-step {
  font-weight: 600;
  color: rgba(255, 255, 255, .6);
}
body .chance-page #interaction .cp-state-grid figure:is(:hover, :focus-within) figcaption {
  opacity: 1;
  transform: none;
}
/* Touch screens have no hover: keep the label visible below the screen */
@media (hover: none) {
  body .chance-page #interaction .cp-state-grid figcaption {
    position: static;
    opacity: 1;
    transform: none;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    padding: 12px 2px 0;
    color: var(--cs-text);
  }
  body .chance-page #interaction .cp-state-grid figcaption strong { color: var(--cs-text); font-size: 15px; font-weight: 600; }
  body .chance-page #interaction .cp-state-grid figcaption .cs-step { color: var(--cs-muted); font-size: 13px; }
}

/* ---------- Disclosure: pill button with a rotating chevron ---------- */
body .chance-page #interaction .cp-input-group > .cp-details {
  margin-top: 28px;
  padding: 0;
  border: 0 !important;
}
body .chance-page #interaction .cp-details > summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-height: 40px;
  padding: 9px 16px 9px 18px;
  border: 1px solid #111;
  border-radius: 999px;
  background: #111;
  color: #fff !important;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  list-style: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
body .chance-page #interaction .cp-details > summary::-webkit-details-marker { display: none; }
body .chance-page #interaction .cp-details > summary::marker { content: ""; }
body .chance-page #interaction .cp-details > summary::after {
  content: "";
  width: 12px;
  height: 12px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.25 6 7.75l3.5-3.5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.25 6 7.75l3.5-3.5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .2s ease;
}
body .chance-page #interaction .cp-details[open] > summary::after { transform: rotate(180deg); }
body .chance-page #interaction .cp-details > summary:hover { background: #2b2d31; border-color: #2b2d31; }
body .chance-page #interaction .cp-details > summary:active { background: #000; transform: scale(.98); }
body .chance-page #interaction .cp-details > summary:focus-visible {
  outline: 2px solid var(--cs-accent) !important;
  outline-offset: 3px;
  border-radius: 999px;
}
body .chance-page #interaction .cp-details[open] { padding-bottom: 0; }
body .chance-page #interaction .cp-details[open] > summary { background: #fff; border-color: #111; color: #111 !important; }

/* Expanded flow: same frame language, smaller */
body .chance-page #interaction .cp-gallery { margin-top: 24px; gap: 20px; }
body .chance-page #interaction .cp-gallery a {
  border: 1px solid var(--cs-frame);
  border-radius: 14px;
  overflow: hidden;
  background: #fafbfc;
}
body .chance-page #interaction .cp-gallery figcaption { margin-top: 10px; font-size: 13px; color: var(--cs-muted); }

@media (max-width: 700px) {
  body .chance-page #interaction .cp-recovery-group { margin-top: 52px; padding-top: 28px; }
  body .chance-page #interaction .cp-shared h3 { font-size: 21px; }
  body .chance-page #interaction .cp-state-grid { gap: 32px; }
  body .chance-page #interaction .cp-state-grid .cp-image { max-width: 320px; margin: 0 auto; }
}
