/*
 * Home page: live previews inside the five "ready for reporting" cards (src/pages/use-visuals.ts).
 * /js/reveal.js adds "is-armed" (start state) and then "is-in" to each card. Delay classes d1..d10 order the steps.
 * Without JS or with reduced motion neither class is set, so every preview shows its finished state.
 */

.use { display: flex; flex-direction: column; }
.uv {
  margin-top: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text);
}
.use--accent .uv { border-color: var(--accent-line); }
.use .uv p { max-width: none; }

/* Shared bits */
.uv-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.uv-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.uv-table td { padding: 0.32rem 0.4rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.uv-table tr:last-child td { border-bottom: 0; }
.uv-table th em, .uv-table td em { font-style: normal; font-weight: 500; color: var(--faint); margin-left: 0.2rem; }
.uv-chip { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 6px; background: var(--accent-soft); color: var(--text); font-weight: 600; font-size: 0.78rem; }
.uv-chip--quiet { background: var(--surface-2); color: var(--muted); font-weight: 500; }

/* Custom reports: pivot table */
.uv-toolbar { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.uv-pivot .uv-table td:nth-child(2) { text-align: right; }
.uv-pivot .uv-table th:nth-child(2) { text-align: right; }
.uv-bar-col { width: 38%; }
.uv-bar { display: block; width: 100%; height: 8px; }
.uv-bar rect { fill: var(--accent); transform-box: fill-box; transform-origin: 0 50%; }

/* No manual exports: refresh checklist */
.uv-sync-head { margin: 0 0 0.45rem; font-weight: 600; }
.uv-sync-list { list-style: none; margin: 0; padding: 0; }
.uv-sync-list li { display: flex; align-items: center; gap: 0.55rem; padding: 0.22rem 0; }
.uv-check { position: relative; flex: none; width: 1rem; height: 1rem; border-radius: 999px; background: var(--accent); }
.uv-check::after { content: ""; position: absolute; left: 0.32rem; top: 0.18rem; width: 0.28rem; height: 0.5rem; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.uv-sync-foot { margin: 0.5rem 0 0; padding-top: 0.45rem; border-top: 1px solid var(--line); color: var(--muted); }

/* Simple sharing: share box */
.uv-share-title { margin: 0 0 0.5rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uv-share-input { margin: 0 0 0.55rem; padding: 0.4rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; color: var(--faint); }
.uv-people { list-style: none; margin: 0; padding: 0; }
.uv-people li { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0; }
.uv-avatar { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 999px; display: grid; place-items: center; font-weight: 700; font-size: 0.72rem; color: #fefefe; }
.uv-avatar--1 { background: #2f6f8f; }
.uv-avatar--2 { background: #7a5c3e; }
.uv-person { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.uv-person b { font-weight: 600; }
.uv-person em { font-style: normal; color: var(--muted); font-size: 0.78rem; }
.uv-access { color: var(--muted); font-size: 0.78rem; }

/* Combine your numbers: formula bar and table */
.uv-formula { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.5rem; padding: 0.35rem 0.55rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.uv-fx { font-style: italic; font-weight: 600; color: var(--faint); }
.uv-type { display: inline-block; overflow: hidden; white-space: nowrap; width: 6ch; font: 600 0.84rem/1.3 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.uv-combine .uv-table td:not(:first-child), .uv-combine .uv-table th:not(:first-child) { text-align: right; }
.uv-profit { font-weight: 700; }

/* Built-in dashboard (dark card): copy on the left, preview on the right */
.use--ink { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 1.5rem 2.5rem; align-items: center; }
.use--ink .uv { margin-top: 0; background: #1a1d22; border-color: #2b3038; color: #eef0f2; }
.uv-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.uv-tile { padding: 0.6rem 0.7rem; border-radius: 10px; background: #22262c; }
.uv-tile span { display: block; color: #a9afb7; font-size: 0.76rem; }
.uv-tile strong { display: block; margin-top: 0.15rem; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.uv-red { color: #ff8a7a; }
.uv-line-wrap { margin-top: 0.75rem; }
.uv-line-label { color: #a9afb7; font-size: 0.76rem; }
.uv-line { display: block; width: 100%; height: auto; margin-top: 0.25rem; }
.uv-line line { stroke: #3a4048; stroke-width: 1; }
.uv-line polyline { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }

/* Armed start state */
.use.is-armed .uv-anim { opacity: 0; transform: translateY(6px); }
.use.is-armed .uv-bar rect { transform: scaleX(0); }
.use.is-armed .uv-pop { transform: scale(0.4); background: var(--surface-2); }
.use.is-armed .uv-pop::after { opacity: 0; }
.use.is-armed .uv-type { width: 0; }
.use.is-armed .uv-line polyline { stroke-dashoffset: 1; }

/* Played state */
.use.is-in .uv-anim { opacity: 1; transform: none; transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.use.is-in .uv-bar rect { transform: none; transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1); }
.use.is-in .uv-pop { transform: none; background: var(--accent); transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.25s ease; }
.use.is-in .uv-pop::after { opacity: 1; transition: opacity 0.2s ease 0.15s; }
.use.is-in .uv-type { width: 6ch; transition: width 0.7s steps(6) 0.25s; }
.use.is-in .uv-line polyline { stroke-dashoffset: 0; transition: stroke-dashoffset 1.4s cubic-bezier(0.65, 0, 0.35, 1) 0.4s; }

/* Step order */
.use.is-in .d1, .use.is-in .d1 rect, .use.is-in .d1::after { transition-delay: 0.1s; }
.use.is-in .d2, .use.is-in .d2 rect, .use.is-in .d2::after { transition-delay: 0.2s; }
.use.is-in .d3, .use.is-in .d3 rect, .use.is-in .d3::after { transition-delay: 0.3s; }
.use.is-in .d4, .use.is-in .d4 rect, .use.is-in .d4::after { transition-delay: 0.4s; }
.use.is-in .d5, .use.is-in .d5 rect, .use.is-in .d5::after { transition-delay: 0.5s; }
.use.is-in .d6, .use.is-in .d6 rect, .use.is-in .d6::after { transition-delay: 0.6s; }
.use.is-in .d7, .use.is-in .d7 rect, .use.is-in .d7::after { transition-delay: 0.7s; }
.use.is-in .d8, .use.is-in .d8 rect, .use.is-in .d8::after { transition-delay: 0.8s; }
.use.is-in .d9, .use.is-in .d9 rect, .use.is-in .d9::after { transition-delay: 0.9s; }
.use.is-in .d10, .use.is-in .d10 rect, .use.is-in .d10::after { transition-delay: 1.05s; }

@media (max-width: 860px) {
  .use--ink { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .uv { padding: 0.7rem 0.6rem; font-size: 0.8rem; }
  .uv-combine .uv-table { font-size: 0.72rem; }
  .uv-combine .uv-table th, .uv-combine .uv-table td { padding: 0.3rem 0.2rem; }
}
@media (max-width: 420px) {
  .uv-tiles { grid-template-columns: minmax(0, 1fr); }
  .uv-pivot .uv-bar-col { display: none; }
  .uv-combine .uv-table th em { display: none; }
}
@media (max-width: 340px) {
  .uv-combine .uv-table { font-size: 0.66rem; }
  .uv-combine .uv-table th, .uv-combine .uv-table td { padding: 0.28rem 0.12rem; }
}
