/* QWorks Civil Learning · Animasi proses
   Dipakai di atas src/styles.css Civil Learning (token --ink, --signal, --accent, …).
   Panggung selalu gelap (navy merek + pita hazard) di kedua tema; kartu lain mengikuti halaman. */

.an-lab { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 1080px) { .an-lab { grid-template-columns: minmax(0, 1fr); } }

/* panggung gelap */
.an-stage-card { background: var(--brand); color: #fff; border-radius: var(--r); overflow: hidden; min-width: 0; }
.an-tape { height: 6px; background: repeating-linear-gradient(45deg, var(--signal) 0 9px, var(--panel) 9px 18px); }
.an-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.14); }
.an-tgroup { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-tlabel { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--panel-muted); }
.an-btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 8px; min-height: 40px; padding: 0 14px; font-size: 15px; font-weight: 600; border: 1px solid transparent; cursor: pointer; }
.an-btn svg { width: 16px; height: 16px; flex: none; }
.an-primary { background: var(--signal); color: var(--ink-strong); box-shadow: inset 0 -2px 0 0 rgba(0,0,0,.14); }
.an-primary:hover { background: var(--signal-hover); }
.an-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.28); }
.an-ghost:hover { background: rgba(255,255,255,.08); }
.an-seg { display: inline-flex; border: 1px solid rgba(255,255,255,.28); border-radius: 8px; overflow: hidden; }
.an-seg button { background: transparent; color: #C9D0DA; border: 0; min-height: 38px; padding: 0 11px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.an-seg button + button { border-left: 1px solid rgba(255,255,255,.18); }
.an-seg button[aria-pressed="true"] { background: var(--panel-raised); color: #fff; }
.an-layer { display: inline-flex; align-items: center; gap: 7px; background: transparent; border: 1px solid rgba(255,255,255,.22); color: #C9D0DA; border-radius: 9999px; min-height: 32px; padding: 0 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.an-layer i, .an-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.an-layer[aria-pressed="true"] { background: var(--panel-raised); color: #fff; border-color: rgba(255,255,255,.4); }
.an-layer[aria-pressed="false"] i { opacity: .3; }
.an-stage { position: relative; background: radial-gradient(120% 90% at 55% 35%, #16294A 0%, var(--brand) 70%); }
.an-scene { display: block; width: 100%; height: auto; touch-action: manipulation; }
.an-scene [data-part] { cursor: pointer; transition: opacity .25s; }
.an-hint { position: absolute; top: 10px; right: 14px; left: 14px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--panel-muted); pointer-events: none; z-index: 2; text-align: right; }
.an-hint a { pointer-events: auto; color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.an-hint a:hover { color: var(--signal); }

/* tampilan 3D (WebGL) */
.an-stage.is-3d { height: clamp(420px, 62vh, 640px); touch-action: none; overflow: hidden; }
.an-stage.is-3d .an-hint { top: auto; bottom: 10px; }
.an-canvas { display: block; width: 100%; height: 100%; cursor: grab; outline: none; }
.an-canvas:active { cursor: grabbing; }
.an-canvas:focus-visible { box-shadow: inset 0 0 0 2px #8AB0FF; }
.an-b3wrap { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.an-b3 { position: absolute; left: 0; top: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px; padding: 0; border-radius: 50%; background: #fff; color: var(--brand); border: 1.5px solid var(--brand); font: 600 13px/1 var(--display); display: grid; place-items: center; cursor: pointer; pointer-events: auto; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: background .2s, color .2s, opacity .2s; will-change: transform; }
.an-b3:hover { background: var(--signal-tint); }
.an-b3.on { background: var(--signal); color: var(--ink-strong); border: 2px solid #fff; }
.an-b3:focus { outline: none; }
.an-b3:focus-visible { box-shadow: 0 0 0 3px #8AB0FF; }
.an-b3[hidden] { display: none; }
@media (max-width: 520px) { .an-stage.is-3d { height: clamp(360px, 58vh, 520px); } .an-hint span { display: none; } }
.an-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 16px; border-top: 1px solid rgba(255,255,255,.14); font-size: 12.5px; color: #C9D0DA; }
.an-legend span { display: inline-flex; align-items: center; gap: 6px; }
.an-legend .an-faint { opacity: .8; }
.an-steps { display: flex; gap: 6px; padding: 12px 16px 16px; overflow-x: auto; border-top: 1px solid rgba(255,255,255,.14); scrollbar-width: thin; }
.an-step { flex: none; display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 1px solid rgba(255,255,255,.18); color: #C9D0DA; border-radius: 8px; min-height: 36px; padding: 0 10px 0 6px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.an-step b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--panel-raised); color: #fff; font: 600 13px var(--display); }
.an-step:hover { border-color: rgba(255,255,255,.4); }
.an-step[aria-current="step"] { background: var(--panel-raised); color: #fff; border-color: var(--signal); }
.an-step[aria-current="step"] b { background: var(--signal); color: var(--ink-strong); }

/* nomor tahap di gambar */
.an-badge { cursor: pointer; }
.an-badge circle { fill: #fff; stroke: var(--brand); stroke-width: 1.5; transition: fill .2s; }
.an-badge text { font: 600 13px var(--display); fill: var(--brand); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.an-badge:hover circle { fill: var(--signal-tint); }
.an-badge.on circle { fill: var(--signal); stroke: #fff; stroke-width: 2; }
.an-badge:focus { outline: none; }
.an-badge:focus-visible circle { stroke: #8AB0FF; stroke-width: 3; }

/* gerak alat */
.an-scene .belt { animation: an-belt calc(1.2s / var(--spd, 1)) linear infinite; }
.an-scene .bucket { animation: an-bucket calc(1.4s / var(--spd, 1)) linear infinite; }
.an-scene .spin { animation: an-spin calc(1.6s / var(--spd, 1)) linear infinite; }
.an-scene .vib { animation: an-vib calc(.18s / var(--spd, 1)) linear infinite; }
.an-scene .flame { animation: an-flame calc(.5s / var(--spd, 1)) ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.an-scene .smoke { animation: an-smoke calc(4s / var(--spd, 1)) linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes an-belt { to { stroke-dashoffset: -12; } }
@keyframes an-bucket { to { stroke-dashoffset: 16; } }
@keyframes an-spin { to { stroke-dashoffset: -14; } }
@keyframes an-vib { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(.7px, -.5px); } }
@keyframes an-flame { from { opacity: .55; transform: scale(.85); } to { opacity: 1; transform: scale(1.1); } }
@keyframes an-smoke { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 15% { opacity: .5; } 100% { transform: translate(18px, -60px) scale(2.2); opacity: 0; } }
.an-scene.paused .belt, .an-scene.paused .bucket, .an-scene.paused .spin, .an-scene.paused .vib, .an-scene.paused .flame, .an-scene.paused .smoke { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .an-scene .belt, .an-scene .bucket, .an-scene .spin, .an-scene .vib, .an-scene .flame, .an-scene .smoke { animation: none; } }

/* panel penjelasan tahap */
.an-info { background: var(--surface); border: 1px solid var(--line-subtle); border-radius: var(--r); padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; position: sticky; top: 16px; min-width: 0; }
@media (max-width: 1080px) { .an-info { position: static; } }
.an-ihead { display: grid; gap: 6px; }
.an-imeta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.an-info h2 { font-size: 26px; }
.an-en { font-size: 14px; color: var(--muted); margin-top: -2px; }
.an-info p { color: var(--ink-2); }
.an-sub { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.an-info ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--ink-2); font-size: 15px; }
.an-note { border-radius: 8px; padding: 10px 12px; font-size: 14.5px; }
.an-warn { background: var(--warning-tint); border: 1px solid #F6D9A8; color: var(--ink-2); }
.an-warn strong { color: var(--warning); }
.an-alab { background: var(--accent-tint); color: var(--ink); }
.an-alab strong { color: var(--accent); }
.an-none { background: var(--surface-2); color: var(--muted); }
.an-inav { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line-subtle); padding-top: 14px; }
.chip.an-cont { background: var(--accent-tint); color: var(--accent); }
.chip.an-batch { background: var(--signal-tint); color: #7A4A00; }
.chip.an-site { background: var(--teal-tint); color: var(--teal); }

/* kartu siklus */
.an-cycle { background: var(--surface); border: 1px solid var(--line-subtle); border-radius: var(--r); padding: 20px; margin-top: 20px; display: grid; gap: 16px; }
.an-chead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.an-chead h2 { font-size: 22px; }
.an-cycle > p { color: var(--ink-2); max-width: 80ch; }
.an-tl { display: grid; gap: 6px; }
.an-tlbar { position: relative; display: flex; height: 44px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.an-tlseg { display: flex; align-items: center; padding: 0 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border-right: 1px solid var(--line); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; transition: background .2s, color .2s; }
.an-tlseg:last-of-type { border-right: 0; }
.an-tlseg.on { background: var(--signal-tint); color: #7A4A00; }
.an-tlhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); left: 0; pointer-events: none; }
.an-ticks { position: relative; height: 16px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-ticks span { position: absolute; transform: translateX(-50%); }
.an-ticks span:first-child { transform: none; }
.an-ticks span:last-child { transform: translateX(-100%); }
.an-cbody { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; }
.an-cbody-lebar { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); }
@media (max-width: 760px) { .an-cbody, .an-cbody-lebar { grid-template-columns: minmax(0, 1fr); } }
.an-wtable { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.an-wtable th { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 6px 8px; background: var(--surface-2); border-bottom: 1px solid var(--line-subtle); }
.an-wtable th.r, .an-wtable td.r { text-align: right; white-space: nowrap; }
.an-wtable td { padding: 7px 8px; border-bottom: 1px solid var(--line-subtle); color: var(--ink-2); vertical-align: middle; }
.an-wtable td:first-child { color: var(--ink); font-weight: 500; white-space: nowrap; }
.an-wbar { height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line-subtle); overflow: hidden; min-width: 60px; }
.an-wbar i { display: block; height: 100%; background: var(--signal); width: 0; }
.an-wbar.asp i { background: #5B3A1E; }
.an-stats { display: grid; gap: 10px; align-content: start; }
.an-stat { border: 1px solid var(--line-subtle); border-radius: 8px; padding: 10px 12px; display: grid; gap: 2px; }
.an-stat .k { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.an-stat .v { font: 600 22px var(--display); font-variant-numeric: tabular-nums; color: var(--ink); }
.an-stat .s { font-size: 13px; color: var(--muted); }

/* penjelasan tertulis di bawah animasi (juga untuk mesin pencari dan cetak) */
.an-tahap { display: grid; gap: 12px; counter-reset: tahap; }
.an-tahap article { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 14px; }
.an-tahap .n { grid-row: span 3; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); color: #fff; font: 600 14px var(--display); }
.an-tahap h3 { font-size: 19px; }
.an-tahap h3 span { font: 400 14px var(--font); color: var(--muted); margin-left: 6px; }
.an-tahap p { color: var(--ink-2); }
.an-tahap ul { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 15px; }
.an-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.an-grid > a, .an-grid > div { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
.an-grid > a:hover h3 { text-decoration: underline; }
.an-grid .segera { opacity: .78; }

/* kertas kalendering (pemancangan) */
.an-kal { margin: 0; display: grid; gap: 6px; }
.an-kal svg { width: 100%; height: auto; display: block; border: 1px solid var(--line-subtle); border-radius: 8px; overflow: hidden; }

/* panel dengan isian (neraca laju, dsb.) */
.an-ctrls { display: grid; gap: 14px; align-content: start; }
.an-range { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; font-size: 14.5px; color: var(--ink-2); }
.an-range b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.an-range input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.an-stats-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .an-stats-2 { grid-template-columns: minmax(0, 1fr); } }
