/* Survivor portal — interactive, animated, accessible.
 * These styles/animations are scoped to the survivor experience only. */

/* To-do indicator dot on the tab */
.sv-todo-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: var(--warning); margin-left: 6px; vertical-align: middle; }

/* Overall progress overview */
.sv-overview { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.sv-overview .nums { flex: 1; min-width: 220px; }
.sv-overview h3 { font-size: 18px; }
.sv-overview .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.sv-ring { position: relative; width: 96px; height: 96px; flex-shrink: 0; }
.sv-ring svg { transform: rotate(-90deg); }
.sv-ring .track { stroke: var(--primary-tint-2); }
.sv-ring .fill { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.22,.61,.36,1); }
.sv-ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: var(--primary-dark); }

.sv-bar { height: 10px; border-radius: 999px; background: var(--primary-tint-2); overflow: hidden; }
.sv-bar > span { display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 1s cubic-bezier(.22,.61,.36,1); }

/* Goal disclosure cards */
.sv-goal { margin-bottom: 14px; opacity: 0; transform: translateY(10px); animation: svFadeUp .5s ease forwards; }
@keyframes svFadeUp { to { opacity: 1; transform: none; } }

.sv-goal__head {
  width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, box-shadow .15s, transform .06s;
}
.sv-goal__head:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.sv-goal__head:focus-visible { outline: 3px solid var(--primary-tint-2); outline-offset: 2px; border-color: var(--primary); }
.sv-goal__head:active { transform: translateY(1px); }
.sv-goal__head[aria-expanded="true"] { border-color: var(--primary); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sv-goal__titlerow { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sv-goal__titlerow h3 { font-size: 16px; }
.sv-goal__meta { display: flex; align-items: center; gap: 10px; }
.sv-goal__count { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sv-caret { width: 11px; height: 11px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .25s ease; flex-shrink: 0; }
.sv-goal__head[aria-expanded="true"] .sv-caret { transform: rotate(-135deg); }
.sv-goal__need { display: inline-block; font-size: 12px; font-weight: 650; color: var(--primary-dark);
  background: var(--primary-tint); border: 1px solid var(--primary-tint-2); padding: 3px 10px; border-radius: 999px; }

.sv-goal__panel {
  border: 1px solid var(--primary); border-top: none; border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface-2); overflow: hidden; max-height: 0; transition: max-height .35s ease;
}
.sv-goal__panel-inner { padding: 4px 18px 16px; }
.sv-goal__rationale { color: var(--muted); font-size: 13px; margin: 10px 0 12px; }

/* Steps */
.sv-step { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.sv-step:first-of-type { border-top: none; }
.sv-step .dot { width: 18px; height: 18px; border-radius: 999px; flex-shrink: 0; margin-top: 1px;
  border: 2px solid var(--border-strong); background: var(--surface); position: relative; }
.sv-step.completed .dot { background: var(--success); border-color: var(--success); }
.sv-step.completed .dot::after { content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); animation: svCheck .35s ease; }
@keyframes svCheck { from { opacity: 0; transform: rotate(45deg) scale(.4); } to { opacity: 1; } }
.sv-step.in_progress .dot { border-color: var(--primary); }
.sv-step.in_progress .dot::after { content: ""; position: absolute; inset: 3px; border-radius: 999px; background: var(--primary); }
.sv-step.needs_referral .dot { border-color: var(--warning); }
.sv-step .body { flex: 1; }
.sv-step .label { font-size: 14px; font-weight: 550; }
.sv-step.completed .label { color: var(--muted); }
.sv-step .status { font-size: 12px; font-weight: 650; margin-top: 2px; }
.sv-step.completed .status { color: #14803c; }
.sv-step.in_progress .status { color: var(--primary-dark); }
.sv-step.needs_referral .status { color: #b45309; }
.sv-step.not_started .status { color: var(--muted); }
.sv-next-tag { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--primary-dark);
  background: var(--primary-tint); padding: 1px 8px; border-radius: 999px; }

/* Timeline */
.sv-timeline { display: flex; flex-direction: column; }
.sv-timeline .item { position: relative; padding: 0 0 16px 22px; }
.sv-timeline .item::before { content: ""; position: absolute; left: 0; top: 3px; width: 11px; height: 11px;
  border-radius: 999px; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.sv-timeline .item::after { content: ""; position: absolute; left: 5px; top: 14px; bottom: -3px; width: 2px; background: var(--border); }
.sv-timeline .item:last-child::after { display: none; }
.sv-timeline .item .text { font-size: 13.5px; }
.sv-timeline .item .who { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .sv-goal, .sv-bar > span, .sv-ring .fill, .sv-goal__panel, .sv-caret, .sv-step.completed .dot::after {
    animation: none !important; transition: none !important;
  }
  .sv-goal { opacity: 1; transform: none; }
}
