/* Interactive hero demo: layered DOM panels in CSS 3D (crisp text at any DPR). */

.demo { position: relative; width: 100%; color: #fff; --tiltX: 0deg; --tiltY: 0deg; --px: 0px; --py: 0px; }
.demo-controls { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.demo-samples { display: flex; gap: .35rem; flex-wrap: wrap; }
.demo-chip {
    font: inherit; font-size: .78rem; font-weight: 600; color: #cbd5e1; background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: .38rem .75rem; cursor: pointer;
    display: inline-flex; align-items: center; gap: .35rem; transition: background .15s, color .15s, border-color .15s;
}
.demo-chip:hover { background: rgba(255,255,255,.12); color: #fff; }
.demo-chip.is-active { background: #16a34a; border-color: #16a34a; color: #fff; }

.demo-stage {
    position: relative; height: 600px; perspective: 1400px; perspective-origin: 50% 40%;
    transform-style: preserve-3d; user-select: none;
}
.demo-stage > * { transform-style: preserve-3d; }
.demo-layer-back { position: absolute; inset: 0; pointer-events: none; transform: translate3d(calc(var(--px) * -.4), calc(var(--py) * -.4), -160px); }
.demo-orb { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .55; }
.demo-orb.o1 { width: 260px; height: 260px; left: -10%; top: 0; background: #ef4444; }
.demo-orb.o2 { width: 300px; height: 300px; right: -12%; bottom: -6%; background: #22c55e; }

/* ----- panels ----- */
.panel {
    position: absolute; display: flex; flex-direction: column; background: #fff; color: #0f172a;
    border-radius: 14px; overflow: hidden; box-shadow: 0 30px 60px -20px rgba(0,0,0,.75), 0 0 0 1px rgba(255,255,255,.06);
    transition: transform .4s cubic-bezier(.2,.8,.2,1), box-shadow .3s;
}
.panel-pdf {
    left: 0; top: 0; width: 80%; height: 55%;
    transform: rotateY(calc(9deg + var(--tiltY))) rotateX(calc(2deg + var(--tiltX))) translate3d(calc(var(--px) * .25), calc(var(--py) * .25), -70px);
}
.panel-xlsx {
    right: 0; bottom: 0; width: 90%; height: 57%;
    transform: rotateY(calc(-6deg + var(--tiltY))) rotateX(calc(-2deg + var(--tiltX))) translate3d(calc(var(--px) * .6), calc(var(--py) * .6), 60px);
}
.demo.is-done .panel-xlsx { box-shadow: 0 30px 60px -20px rgba(0,0,0,.75), 0 0 0 2px #16a34a, 0 0 40px -6px rgba(34,197,94,.55); }
.panel-bar { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; font-size: .68rem; font-weight: 600; color: #64748b; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.panel-pdf .panel-bar { border-top: 3px solid #dc2626; }
.panel-xlsx .panel-bar { border-top: 3px solid #16a34a; }
.panel-file { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-pages { margin-left: auto; color: #94a3b8; font-variant-numeric: tabular-nums; white-space: nowrap; }
.panel-body { flex: 1; padding: .55rem .75rem; font-size: .62rem; position: relative; overflow: hidden; }
.panel-foot { padding: .45rem .7rem; font-size: .66rem; color: #64748b; border-top: 1px solid #e2e8f0; background: #f8fafc; display: flex; align-items: center; gap: .5rem; min-height: 30px; }
.chip { font-size: .58rem; font-weight: 800; padding: .12rem .4rem; border-radius: 5px; letter-spacing: .04em; }
.chip-red { background: #fee2e2; color: #dc2626; }
.chip-green { background: #dcfce7; color: #15803d; }

/* ----- PDF look ----- */
.pdf-title { font-weight: 800; font-size: .92rem; letter-spacing: -.01em; }
.pdf-meta { color: #64748b; margin: .05rem 0 .4rem; font-size: .58rem; }
.pdf-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; background: #f1f5f9; border-radius: 8px; padding: .3rem .5rem; margin-bottom: .45rem; }
.pdf-summary small { display: block; font-size: .48rem; color: #64748b; text-transform: uppercase; letter-spacing: .05em; }
.pdf-summary b { font-size: .62rem; font-variant-numeric: tabular-nums; }
.pdf-table { position: relative; }
.pdf-head, .pdf-row { display: grid; grid-template-columns: 1.1fr 2.2fr 1fr 1fr 1.2fr; gap: .4rem; padding: .2rem .2rem; align-items: center; }
.pdf-head { color: #94a3b8; font-size: .52rem; font-weight: 700; letter-spacing: .06em; border-bottom: 1px solid #e2e8f0; }
.pdf-row { border-bottom: 1px solid #f1f5f9; transition: opacity .3s, background .2s; font-variant-numeric: tabular-nums; }
.pdf-row span, .pdf-head span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-num { text-align: right; }
.pdf-row .t-num:nth-child(3) { color: #b91c1c; }
.pdf-row .t-num:nth-child(4) { color: #15803d; }
.pdf-row .t-num:last-child { color: #0f172a; font-weight: 600; }
.pdf-row.is-taken { opacity: .22; }
.pdf-row.is-hot, .sheet-row.is-hot td { background: #fef3c7 !important; opacity: 1 !important; }
.pdf-detect { position: absolute; inset: 0; pointer-events: none; }
.pdf-col { position: absolute; top: 0; bottom: 0; border: 1.5px solid rgba(22,163,74,.0); border-radius: 4px; background: rgba(34,197,94,0); transition: border-color .25s, background .25s; }
.pdf-col.is-on { border-color: rgba(22,163,74,.8); background: rgba(34,197,94,.07); }
.pdf-col i { position: absolute; top: -9px; left: 4px; font-style: normal; font-size: .5rem; font-weight: 700; color: #fff; background: #16a34a; padding: .05rem .3rem; border-radius: 3px; opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s; }
.pdf-col.is-on i { opacity: 1; transform: none; }
.pdf-scan { position: absolute; left: -4px; right: -4px; top: 0; height: 2px; background: #22c55e; box-shadow: 0 0 14px 3px rgba(34,197,94,.6); opacity: 0; pointer-events: none; }
.pdf-scan.is-on { opacity: 1; animation: pdf-scan .9s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes pdf-scan { from { top: 0; } to { top: 100%; } }

/* ----- sheet look ----- */
.panel-body-sheet { padding: 0; }
.sheet-table { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: .62rem; font-variant-numeric: tabular-nums; }
.sheet-table th, .sheet-table td { border: 1px solid #e2e8f0; padding: .2rem .4rem; height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-table th { background: #f1f5f9; color: #64748b; font-weight: 600; font-size: .55rem; text-align: center; height: 20px; padding: .15rem; }
.sheet-table th.corner, .sheet-table td.rn { width: 22px; background: #f1f5f9; color: #94a3b8; text-align: center; font-size: .55rem; }
.sheet-table th:nth-child(2), .sheet-table th:nth-child(3) { width: auto; }
.sheet-table col.c-text { width: 32%; }
.sheet-head td { background: #dcfce7; color: #14532d; font-weight: 700; }
.sheet-row td:not(.rn) { color: #334155; }
.sheet-row td.t-num:nth-child(4) { color: #b91c1c; }
.sheet-row td.t-num:nth-child(5) { color: #15803d; }
.sheet-row td.t-num:last-child { color: #0f172a; font-weight: 600; }
.sheet-row td.is-flash { animation: cell-flash .7s ease-out; }
@keyframes cell-flash { from { background: #bbf7d0; } to { background: transparent; } }
.sheet-row.is-sel td { box-shadow: inset 0 0 0 1.5px #16a34a; }
.caret { display: inline-block; width: 1px; height: .8em; background: #16a34a; vertical-align: -1px; margin-left: 1px; animation: caret 1s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.demo-steps { display: inline-flex; gap: .35rem; }
.demo-steps i { font-style: normal; font-size: .58rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #94a3b8; background: #fff; border: 1px solid #e2e8f0; padding: .12rem .4rem; border-radius: 999px; transition: all .25s; }
.demo-steps i.is-on { color: #15803d; border-color: #86efac; background: #f0fdf4; }
.demo-steps i.is-done { color: #15803d; border-color: #86efac; }
.demo-done { display: inline-flex; align-items: center; gap: .35rem; color: #15803d; font-weight: 600; }

/* ----- flights (row clones animating across) ----- */
.demo-flights { position: absolute; inset: 0; pointer-events: none; transform: translateZ(80px); }
.flight {
    position: absolute; left: 0; top: 0; display: grid; grid-template-columns: 1.1fr 2.2fr 1fr 1fr 1.2fr; gap: .4rem; align-items: center;
    padding: .28rem .35rem; font-size: .62rem; color: #0f172a; background: #fff; border-radius: 6px; white-space: nowrap;
    box-shadow: 0 0 0 1.5px #22c55e, 0 14px 30px -8px rgba(0,0,0,.6), 0 0 24px -2px rgba(34,197,94,.7);
    will-change: transform, opacity; transform-origin: 0 0;
}
.flight span { overflow: hidden; text-overflow: ellipsis; }

/* ----- drop state ----- */
.demo-drop {
    position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; text-align: center;
    background: rgba(7,11,22,.72); border: 2px dashed #4ade80; border-radius: 16px; backdrop-filter: blur(4px); z-index: 5; transform: translateZ(120px);
}
.demo-drop strong { font-size: 1.1rem; }
.demo-drop span { color: #94a3b8; font-size: .85rem; }
.demo.is-over .demo-drop { display: flex; }
.demo-hint { margin: .7rem 0 0; font-size: .78rem; color: #94a3b8; display: flex; align-items: center; gap: .4rem; }
.demo-hint .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74,222,128,.6); animation: ping 1.8s infinite; flex: none; }

/* ----- responsive ----- */
@media (max-width: 960px) {
    .demo-stage { height: 560px; perspective: 1100px; }
}
@media (max-width: 560px) {
    .demo-stage { height: 520px; }
    .panel-pdf { width: 88%; height: 54%; }
    .panel-xlsx { width: 96%; height: 56%; }
    .panel-body { font-size: .56rem; }
    .sheet-table { font-size: .56rem; }
    .pdf-summary { grid-template-columns: repeat(2, 1fr); }
    .demo-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .panel { transition: none; }
    .pdf-scan.is-on { animation: none; opacity: 0; }
    .sheet-row td.is-flash { animation: none; }
    .demo-hint .dot { animation: none; }
}

/* once finished, the footer shows only the result badge */
.demo.is-done .demo-steps { display: none; }
