/* ------------------------------------------------------------------
   kinetic.css — spring-motion layer for Property Vault
   Loaded AFTER styles.css so it can retro-fit existing components.
   No cursor trail. No cursor spotlight.
   ------------------------------------------------------------------ */

:root {
  --spring: cubic-bezier(.34, 1.56, .64, 1);   /* overshoot then settle */
  --glide: cubic-bezier(.16, 1, .3, 1);        /* fast out, soft landing */
  --overshoot: cubic-bezier(.18, 1.25, .4, 1); /* slide past rest */
  --sym: cubic-bezier(.65, 0, .35, 1);         /* measured travel */
  --shake: cubic-bezier(.36, .07, .19, .97);

  --p0: var(--red);
  --p1: var(--accent);
  --p2: var(--yellow);
  --p3: var(--blue);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- retro-fit: existing components get weight ---------- */

.btn {
  position: relative;
  overflow: hidden;
  transition: transform .45s var(--spring), border-color .25s, background .25s, color .25s, box-shadow .35s var(--glide);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.94) translateY(0); transition: transform .08s ease-out; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { box-shadow: 0 5px 0 -1px color-mix(in srgb, var(--ink) 55%, transparent); }
.btn-primary:active { box-shadow: 0 1px 0 -1px color-mix(in srgb, var(--ink) 55%, transparent); }
.btn-accent { box-shadow: 0 5px 0 -1px var(--accent-2); }
.btn-accent:active { box-shadow: 0 1px 0 -1px var(--accent-2); }

.k-ripple-ink {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  pointer-events: none;
  background: color-mix(in srgb, currentColor 26%, transparent);
  animation: k-ripple .62s ease-out forwards;
}
@keyframes k-ripple { to { transform: scale(2.7); opacity: 0; } }

.card { transition: transform .5s var(--glide), border-color .25s, box-shadow .5s var(--glide); }
.property-card:hover { transform: translateY(-5px); }

.nav-link { transition: transform .4s var(--spring), background .25s, color .25s; }
.nav-link:hover { transform: translateX(3px); }
.nav-link.active { transform: none; }

.profile-tab { transition: transform .4s var(--spring), background .25s, color .25s; }
.profile-tab:hover { transform: translateY(-2px); }
.profile-tab.active { transform: none; }

.badge { transition: transform .45s var(--spring); }
.badge.k-pop { transform: scale(1.18); }

.input, .select, .textarea { transition: border-color .25s, box-shadow .3s var(--glide), transform .4s var(--spring); }
.input:focus, .select:focus, .textarea:focus { transform: translateY(-1px); }
.input.k-error { border-color: var(--red); animation: k-shake .45s var(--shake) both; }
@keyframes k-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.modal { animation: k-modal-in .5s var(--spring) both; }
@keyframes k-modal-in { from { transform: translateY(18px) scale(.96); opacity: 0; } }
.modal-backdrop { animation: k-fade .22s ease both; }
@keyframes k-fade { from { opacity: 0; } }

.toast { animation: k-toast-in .55s var(--overshoot) both; }
@keyframes k-toast-in { from { transform: translateY(140%) scale(.92); opacity: 0; } }

.metric { transition: transform .5s var(--spring), box-shadow .5s var(--glide); }
.metric:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.metric-value { font-variant-numeric: tabular-nums; }

.timeline-dot { transition: transform .4s var(--spring); }
.timeline-item:hover .timeline-dot { transform: scale(1.5); }

/* staged entrance for grids and lists */
.k-stagger > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s var(--glide), transform .5s var(--glide);
}
.k-stagger.k-in > * { opacity: 1; transform: translateY(0); }

/* ---------- readiness dial (the playbook signature) ---------- */

.k-dial {
  position: relative;
  width: 168px;
  height: 168px;
  flex: 0 0 auto;
}
.k-dial svg { transform: rotate(-90deg); }
.k-dial .k-dial-bg { fill: none; stroke: var(--surface-2); stroke-width: 12; }
.k-dial .k-dial-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 452;
  stroke-dashoffset: 452;
  transition: stroke-dashoffset 1.1s var(--glide), stroke .4s ease;
}
.k-dial.k-complete .k-dial-fg { stroke: var(--green); }
.k-dial .k-dial-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 2px;
}
.k-dial .k-dial-pct {
  font-family: "Instrument Serif", serif;
  font-size: 2.8rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.k-dial .k-dial-sub {
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.k-readiness {
  display: flex;
  gap: 26px;
  align-items: center;
  flex-wrap: wrap;
  padding: 22px;
}
.k-readiness-body { flex: 1 1 320px; min-width: 260px; display: grid; gap: 14px; }

/* Critical 12 segment strip */
.k-segments { display: flex; gap: 4px; }
.k-segments i {
  flex: 1;
  height: 9px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
}
.k-segments i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .42s var(--spring);
  transition-delay: calc(var(--i) * 55ms);
}
.k-segments i.on::after { transform: scaleX(1); }
.k-segments.all-on i::after { background: var(--green); }

/* phase rail */
.k-rail { display: flex; gap: 6px; flex-wrap: wrap; }
.k-rail-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
  transition: transform .45s var(--spring), background .25s, color .25s, border-color .25s;
}
.k-rail-chip:hover { transform: translateY(-2px); }
.k-rail-chip.active {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
  transform: scale(1.04);
  font-weight: 700;
}
.k-rail-chip b { font-variant-numeric: tabular-nums; font-weight: 800; }
.k-rail-chip.done { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); color: var(--green); }

/* ---------- task rows ---------- */

.k-phase { margin-top: 20px; }
.k-phase-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  cursor: pointer;
}
.k-phase-head h3 { margin: 0; font-size: 1.28rem; }
.k-phase-head .k-phase-meta { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.k-phase-body { overflow: hidden; transition: max-height .5s var(--glide); }
.k-phase.collapsed .k-phase-body { max-height: 0 !important; }
.k-phase-chevron { display: inline-block; transition: transform .35s var(--spring); }
.k-phase.collapsed .k-phase-chevron { transform: rotate(-90deg); }

.k-section-label {
  margin: 16px 0 8px;
  font-size: .7rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.k-tasks { display: grid; gap: 8px; }

.k-task {
  display: grid;
  grid-template-columns: 6px 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: transform .45s var(--spring), border-color .25s, background .25s, opacity .3s;
}
.k-task:hover { transform: translateX(3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.k-task.done { opacity: .55; }
.k-task.done .k-task-title { text-decoration: line-through; color: var(--muted); }
.k-task.k-just-done { animation: k-task-pop .5s var(--spring); }
@keyframes k-task-pop { 40% { transform: scale(1.02) translateX(6px); } }

.k-strip { align-self: stretch; border-radius: 99px; background: var(--p2); }
.k-strip.p0 { background: var(--p0); }
.k-strip.p1 { background: var(--p1); }
.k-strip.p2 { background: var(--p2); }
.k-strip.p3 { background: var(--p3); }

.k-check {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background .3s, border-color .3s, transform .4s var(--spring);
}
.k-check:hover { transform: scale(1.1); }
.k-check:active { transform: scale(.88); }
.k-check svg { width: 16px; height: 16px; }
.k-check path {
  fill: none;
  stroke: var(--surface);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transition: stroke-dashoffset .3s ease-out .1s;
}
.k-task.done .k-check { background: var(--green); border-color: var(--green); }
.k-task.done .k-check path { stroke-dashoffset: 0; }

.k-task-title { font-weight: 650; font-size: .93rem; line-height: 1.35; }
.k-task-detail { color: var(--muted); font-size: .8rem; line-height: 1.45; margin-top: 5px; }
.k-task-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; align-items: center; }
.k-tag {
  font-size: .68rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface-2);
  color: var(--muted);
}
.k-tag.crit { background: color-mix(in srgb, var(--red) 14%, var(--surface)); color: var(--red); }
.k-tag.due { background: color-mix(in srgb, var(--blue) 14%, var(--surface)); color: var(--blue); }
.k-tag.overdue { background: color-mix(in srgb, var(--red) 16%, var(--surface)); color: var(--red); }
.k-tag.note { background: color-mix(in srgb, var(--yellow) 15%, var(--surface)); color: var(--yellow); }
.k-task-link { font-size: .74rem; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.k-task-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .25s; }
.k-task:hover .k-task-actions, .k-task:focus-within .k-task-actions { opacity: 1; }
@media (hover: none) { .k-task-actions { opacity: 1; } }

.k-note {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

/* ---------- hold-to-confirm ---------- */

.k-hold { position: relative; overflow: hidden; }
.k-hold::after {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--red) 30%, transparent);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
  transition: transform .18s ease-out;
}
.k-hold.holding::after { transform: scaleX(1); transition: transform 1s linear; }

/* ---------- confetti ---------- */

.k-confetti {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 90;
  animation: k-confetti-fly .95s var(--glide) forwards;
}
@keyframes k-confetti-fly {
  from { transform: translate(-50%, -50%) rotate(0); opacity: 1; }
  to { transform: translate(var(--tx), var(--ty)) rotate(var(--rot)); opacity: 0; }
}

/* ---------- systems tab ---------- */

.k-sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.k-fact {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 14px;
  display: grid;
  gap: 6px;
  transition: transform .5s var(--spring), border-color .25s;
}
.k-fact:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.k-fact-label { font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.k-fact-value { font-size: 1.02rem; font-weight: 650; overflow-wrap: anywhere; }
.k-fact-value.empty { color: var(--muted); font-weight: 400; font-style: italic; }
.k-fact-where { font-size: .78rem; color: var(--muted); }

.k-maint { display: grid; gap: 8px; }
.k-maint-row {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: transform .45s var(--spring), border-color .25s;
}
.k-maint-row:hover { transform: translateX(3px); }
.k-maint-row .k-strip { min-height: 34px; }
.k-maint-row.overdue .k-strip { background: var(--red); }
.k-maint-row.soon .k-strip { background: var(--yellow); }
.k-maint-row.ok .k-strip { background: var(--green); }
.k-maint-due { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- misc primitives ---------- */

.k-beam { position: relative; padding: 1.5px; border-radius: 16px; overflow: hidden; background: var(--line); }
.k-beam::before {
  content: "";
  position: absolute;
  inset: -50%;
  background: conic-gradient(from 0deg, transparent 0 72%, var(--accent) 84%, var(--ink) 90%, transparent 96%);
  animation: k-spin 3.2s linear infinite;
}
.k-beam-inner { position: relative; z-index: 1; background: var(--surface); border-radius: 14.5px; }
@keyframes k-spin { to { transform: rotate(1turn); } }

.k-shine { position: relative; overflow: hidden; }
.k-shine::before {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 40%, transparent), transparent);
  pointer-events: none;
}
.k-shine:hover::before { left: 120%; transition: left .9s var(--sym); }

.k-empty-mark {
  width: 74px;
  height: 74px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  background: var(--surface-2);
  animation: k-breathe 4.5s ease-in-out infinite;
}
@keyframes k-breathe {
  0%, 100% { transform: scale(.94); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 22%, transparent); }
  50% { transform: scale(1.05); box-shadow: 0 0 34px 8px color-mix(in srgb, var(--accent) 22%, transparent); }
}

.k-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

@media (max-width: 780px) {
  .k-task { grid-template-columns: 5px 26px minmax(0, 1fr); }
  .k-task-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .k-dial { width: 132px; height: 132px; }
  .k-dial .k-dial-pct { font-size: 2.1rem; }
  .k-maint-row { grid-template-columns: 5px minmax(0, 1fr) auto; }
}
