/* City motion pieces (home): the case loop and the weekly contractor report.
   Timings live in the markup (data-at / data-off, seconds); js/motion.js adds .on. Reduced motion shows the final frame. */

/* Shared motion states */
.mo { --mo-ease: cubic-bezier(.2, .7, .2, 1); margin: 0; position: relative; }
.mo-ready [data-at]:not(.is) { transition: opacity .45s var(--mo-ease), transform .45s var(--mo-ease); }
.mo-ready [data-at]:not(.on):not(.is) { opacity: 0; transform: translateY(6px); pointer-events: none; }
.mo.m-reset *, .mo.m-static * { transition: none !important; animation: none !important; }
.mo:not(.mo-ready) [data-off] { display: none; }
.mo figcaption { font-size: 13px; color: var(--text-3); margin-top: 10px; }

/* Case loop */
.clc { margin-top: 40px; }
.clc-app { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--white); }
.clc-cam { position: relative; background: var(--night); min-height: 100%; aspect-ratio: 16 / 9; }
.clc-cam img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mo-ready .clc-b { transition: opacity .8s ease; }
.mo-ready .clc-b:not(.on) { transform: none; }
.clc-tag { position: absolute; left: 12px; bottom: 12px; padding: 6px 10px; border-radius: 6px; background: rgba(6, 10, 18, .86); color: #fff; font-size: 13px; font-weight: 700; line-height: 1.2; }
.clc-tag.ok { background: var(--ok); }
.clc-body { padding: 20px 24px; }
.clc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.clc-ttl { min-width: 0; }
.clc-ttl b { display: block; font: 700 18px/1.25 var(--head); color: var(--ink); }
.clc-ttl span { display: block; font-size: 14px; color: var(--text-3); }
.clc-pill { display: grid; justify-items: end; flex: none; }
.clc-pill i { grid-area: 1 / 1; font-style: normal; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 6px; white-space: nowrap; background: var(--civic-soft); color: var(--civic-ink); }
.clc-pill i.new, .clc-pill i.warn { background: var(--warn-soft); color: var(--warn); }
.clc-pill i.ok { background: var(--ok-soft); color: var(--ok); }
.clc-wo { margin: 14px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 8px; }
.clc-wo-t { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.clc-wo-t span { font-size: 13px; color: var(--text-3); }
.clc-wo-t b { font-size: 14.5px; color: var(--ink); }
.clc-due { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.clc-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.clc-bar i { display: block; height: 100%; width: 0; background: var(--civic); transition: width 7.2s linear, background-color .4s; }
.clc-bar i.on { width: 90%; }
.clc-wo.on .clc-bar i { background: var(--ok); }
.clc-log { list-style: none; margin: 0; padding: 0; }
.clc-log li { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 15px; line-height: 1.45; }
.clc-log li:first-child { border-top: 0; }
.clc-log b { font: 700 15px var(--head); color: var(--ink); font-variant-numeric: tabular-nums; }
.clc-log li.warn b { color: var(--warn); }
.clc-log li.ok b, .clc-log li.ok span { color: var(--ok); }

/* Weekly contractor report */
.clr .clr-doc { padding: 22px 24px; }
.clr .r-head h4 { margin-top: 8px; }
.clr-sub { font-size: 13px; color: var(--text-2); }
.clr .r-row { padding: 12px 0; }
.clr-flag { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 4px; font-weight: 700; transition: background-color .4s, color .4s; }
.clr-flag.on { background: var(--warn-soft); color: var(--warn); }
.clr-appr strong { color: var(--ok); }
.clr-exp { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.clr-exp span { padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; font-weight: 700; }
.clr-exp span:last-child { border-color: transparent; padding-left: 2px; font-weight: 400; }

@media (max-width: 900px) {
  .clc-app { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .clc { margin-top: 24px; }
  .clc-body { padding: 14px 14px 10px; }
  .clc-ttl b { font-size: 16px; }
  .clc-ttl span { font-size: 13px; }
  .clc-pill i { font-size: 12px; padding: 3px 8px; }
  .clc-wo { margin: 10px 0 2px; padding: 8px 10px; gap: 6px; }
  .clc-log li { grid-template-columns: 46px 1fr; font-size: 13.5px; padding: 6px 0; }
  .clc-log b { font-size: 13.5px; }
  .clc-tag { font-size: 12px; left: 8px; bottom: 8px; padding: 4px 8px; }
  .clr .clr-doc { padding: 16px 14px; }
  .clr .report table { font-size: 12px; }
  .clr .report th, .clr .report td { padding-left: 4px; padding-right: 4px; }
  .clr .report .th-full { display: none; } .clr .report .th-short { display: inline; }
}

/* Hero: three case types, each closed with the photo from the same camera */
.clh { background: var(--white); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 14px 34px -18px rgba(11, 19, 34, .28); padding: 12px 14px; }
.clh-tops, .clh-body, .clh-st { display: grid; }
.clh-tops > *, .clh-body > *, .clh-st > * { grid-area: 1 / 1; }
.clh-top { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.clh-top b { font-family: var(--head); font-weight: 600; color: var(--ink); }
.clh-cam { position: relative; aspect-ratio: 16 / 9; margin: 8px 0 10px; border-radius: 6px; overflow: hidden; background: var(--night); }
.clh-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mo-ready .clh-img { transition: opacity .8s ease; }
.mo-ready .clh-img:not(.on) { transform: none; }
.clh-done { position: absolute; left: 8px; bottom: 8px; padding: 4px 8px; border-radius: 5px; background: var(--ok); color: #fff; font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.clh-case { display: grid; gap: 6px; font-size: 14px; line-height: 1.4; }
.clh-what { color: var(--text-2); }
.clh-kv { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 8px; font-size: 13.5px; border-top: 1px solid var(--line-2); padding-top: 5px; }
.clh-kv span { color: var(--text-3); }
.clh-kv b { font-weight: 600; color: var(--ink); }
.clh-st { justify-items: start; margin-top: 2px; }
.clh-st i { font-style: normal; font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 6px; background: var(--civic-soft); color: var(--civic-ink); }
.clh-st i.ok { background: var(--ok-soft); color: var(--ok); }
.clh-bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.clh-bars span { height: 3px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.clh-bars i { display: block; height: 100%; width: 0; background: var(--civic); }
.clh-bars i.on { width: 100%; transition: width 5s linear; }
.mo.m-static .clh-bars i { width: 100%; }
.clh figcaption { font-size: 12px; margin-top: 6px; }

/* Use-case grid under the hero */
.ucg-sec { padding-top: 36px; padding-bottom: 8px; }
.ucg-h { font-size: clamp(22px, 2vw, 26px); margin-bottom: 14px; }
.ucg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ucg-t { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text-2); transition: border-color .2s; }
.ucg-t:hover { border-color: var(--civic); }
.ucg-t img { display: block; width: 104px; height: 65px; object-fit: cover; border-radius: 5px; }
.ucg-t b { display: block; font: 700 15px/1.25 var(--head); color: var(--ink); margin-bottom: 3px; }
.ucg-t > span > span { display: block; font-size: 13px; line-height: 1.4; }
@media (max-width: 1100px) { .ucg { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .ucg { grid-template-columns: 1fr; gap: 8px; }
  .ucg-t { grid-template-columns: 84px minmax(0, 1fr); padding: 8px; gap: 10px; }
  .ucg-t img { width: 84px; height: 53px; }
  .ucg-t b { font-size: 14.5px; }
  .clh { padding: 10px 12px; }
  .clh-what { display: none; }
}

.clr .th-short { display: none; }
