/* =========================================================
   XevoNet — Per-product page signatures
   Each product page has its own scoped class block.
   Activated by body[data-product="docs"] (etc.)
   ========================================================= */

/* ============================================================
   1. DOCS — typewriter on tilted paper, gentle 3D mouse-bend
   ============================================================ */

.pg-docs-stage {
    width: min(960px, 100%);
    margin: 64px auto 0;
    perspective: 1400px;
    position: relative;
    height: clamp(380px, 50vw, 560px);
}
.pg-docs-paper {
    --rx: 0deg;
    --ry: 0deg;
    --tilt: 0deg;
    position: absolute;
    inset: 0;
    background: #ffffff;
    color: #1d1d1f;
    border-radius: 14px;
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.05) inset;
    text-align: left;
    padding: 56px clamp(40px, 8%, 100px);
    transform: rotateX(var(--rx)) rotateY(var(--ry)) rotateZ(var(--tilt));
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}
.pg-docs-paper::before {
    /* paper grain top sheen */
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.4), transparent 25%),
        radial-gradient(900px circle at var(--sheen-x, 50%) var(--sheen-y, 0%),
            rgba(124, 92, 255, 0.06), transparent 60%);
    pointer-events: none;
}
.pg-docs-meta {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #86868b;
    margin: 0 0 16px;
}
.pg-docs-h1 {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: clamp(28px, 4vw, 44px);
    letter-spacing: -0.02em;
    line-height: 1.08;
    margin: 0 0 14px;
    min-height: 1.2em;
}
.pg-docs-h1 .pg-cursor {
    display: inline-block;
    width: 2px;
    height: 0.95em;
    background: #7c5cff;
    margin-left: 4px;
    vertical-align: -0.08em;
    animation: pgBlink 1s steps(2) infinite;
}
.pg-docs-line {
    height: 9px;
    background: rgba(0,0,0,0.08);
    border-radius: 3px;
    margin: 10px 0;
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.pg-docs-line.w-90 { width: 90%; }
.pg-docs-line.w-78 { width: 78%; }
.pg-docs-line.w-66 { width: 66%; }
.pg-docs-line.w-50 { width: 50%; }
.pg-docs-stage.in .pg-docs-line { transform: scaleX(1); }
.pg-docs-stage.in .pg-docs-line:nth-child(4) { transition-delay: 0.30s; }
.pg-docs-stage.in .pg-docs-line:nth-child(5) { transition-delay: 0.45s; }
.pg-docs-stage.in .pg-docs-line:nth-child(6) { transition-delay: 0.60s; }
.pg-docs-stage.in .pg-docs-line:nth-child(7) { transition-delay: 0.75s; }
@keyframes pgBlink { 0%,100%{opacity:1} 50%{opacity:0} }

/* Floating pen nib (signature element) */
.pg-docs-pen {
    position: absolute;
    top: 12%;
    right: -2%;
    width: 60px;
    height: 60px;
    color: #7c5cff;
    animation: penWiggle 5s ease-in-out infinite;
    filter: drop-shadow(0 8px 18px rgba(124, 92, 255, 0.35));
    z-index: 2;
}
@keyframes penWiggle {
    0%,100% { transform: rotate(18deg) translateY(0); }
    50%     { transform: rotate(15deg) translateY(-8px); }
}

/* ============================================================
   2. SPREADS — live grid with animated count-up & ripple
   ============================================================ */

.pg-sheet-stage {
    width: min(960px, 100%);
    margin: 64px auto 0;
    background: #fff;
    color: #1d1d1f;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
.pg-sheet-bar {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    background: #f5f5f7;
    font-size: 12px;
    color: #6e6e73;
    gap: 8px;
}
.pg-sheet-cell-ref {
    font-weight: 600;
    color: #1d1d1f;
    padding: 2px 8px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 4px;
}
.pg-sheet-formula { color: #4d9c8f; font-family: ui-monospace, monospace; }

.pg-sheet-grid {
    display: grid;
    grid-template-columns: 48px repeat(5, 1fr);
    grid-auto-rows: 44px;
    font-size: 13px;
}
.pg-sheet-grid > * {
    border-right: 1px solid rgba(0,0,0,0.06);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    padding: 0 12px;
    position: relative;
    overflow: hidden;
}
.pg-sheet-grid > .pg-sheet-rowlabel,
.pg-sheet-grid > .pg-sheet-collabel {
    background: #f5f5f7;
    color: #86868b;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
}
.pg-sheet-grid > .pg-sheet-cell.is-numeric { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.pg-sheet-grid > .pg-sheet-cell.is-pos     { color: #2e7d68; }
.pg-sheet-grid > .pg-sheet-cell.is-neg     { color: #c44b4b; }
.pg-sheet-grid > .pg-sheet-cell.is-active  { background: rgba(77, 156, 143, 0.10); }

/* Ripple effect on cell click */
.pg-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(77, 156, 143, 0.35);
    transform: scale(0);
    animation: pgRipple 0.7s ease-out forwards;
    pointer-events: none;
}
@keyframes pgRipple {
    0%   { transform: scale(0);   opacity: 0.7; }
    100% { transform: scale(20);  opacity: 0; }
}

/* Bar chart growing on scroll */
.pg-sheet-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 120px;
    padding: 16px;
    border-top: 1px solid rgba(0,0,0,0.06);
    background: #fafafb;
}
.pg-sheet-chart span {
    flex: 1;
    background: linear-gradient(180deg, #4d9c8f, #2e7d68);
    border-radius: 4px 4px 0 0;
    transform-origin: bottom center;
    transform: scaleY(0);
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.pg-sheet-stage.in .pg-sheet-chart span:nth-child(1) { transform: scaleY(0.40); transition-delay: 0.00s; }
.pg-sheet-stage.in .pg-sheet-chart span:nth-child(2) { transform: scaleY(0.62); transition-delay: 0.08s; }
.pg-sheet-stage.in .pg-sheet-chart span:nth-child(3) { transform: scaleY(0.48); transition-delay: 0.16s; }
.pg-sheet-stage.in .pg-sheet-chart span:nth-child(4) { transform: scaleY(0.85); transition-delay: 0.24s; }
.pg-sheet-stage.in .pg-sheet-chart span:nth-child(5) { transform: scaleY(0.74); transition-delay: 0.32s; }
.pg-sheet-stage.in .pg-sheet-chart span:nth-child(6) { transform: scaleY(0.95); transition-delay: 0.40s; }

/* ============================================================
   3. SLIDES — fanned hand of slide cards
   ============================================================ */

.pg-slides-stage {
    width: min(960px, 100%);
    margin: 64px auto 0;
    height: clamp(360px, 48vw, 520px);
    position: relative;
    perspective: 1600px;
}
.pg-slide {
    --r: 0deg;
    --x: 0px;
    --y: 0px;
    --z: 0px;
    --mx: 0deg;
    --my: 0deg;
    --flip: 0deg;
    position: absolute;
    left: 50%;
    top: 50%;
    width: clamp(280px, 36%, 460px);
    aspect-ratio: 16 / 10;
    background: #fff;
    color: #1d1d1f;
    border-radius: 16px;
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transform:
        translate(-50%, -50%)
        translate3d(var(--x), var(--y), var(--z))
        rotate(var(--r))
        rotateX(var(--mx))
        rotateY(calc(var(--my) + var(--flip)));
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.4s ease;
    will-change: transform;
    cursor: pointer;
}
.pg-slide.pg-slide-l { --r: -10deg; --x: -180px; --y: 12px; --z: -60px; }
.pg-slide.pg-slide-c { --r:   0deg; --x:    0px; --y:  0px; --z:   0px; z-index: 2; }
.pg-slide.pg-slide-r { --r:  10deg; --x:  180px; --y: 12px; --z: -60px; }
.pg-slide.is-flipped { --flip: 180deg; }
.pg-slide-eyebrow { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #86868b; }
.pg-slide-title {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: clamp(22px, 3vw, 30px);
    line-height: 1.1;
    letter-spacing: -0.014em;
}
.pg-slide-sub {
    font-size: 12px;
    color: #6e6e73;
}
.pg-slide-shapes {
    display: flex; gap: 6px; align-items: flex-end; height: 60px;
}
.pg-slide-shapes span {
    width: 14px;
    background: linear-gradient(180deg, #bf9248, #8a672f);
    border-radius: 3px;
}
.pg-slide-shapes span:nth-child(1) { height: 30%; }
.pg-slide-shapes span:nth-child(2) { height: 60%; }
.pg-slide-shapes span:nth-child(3) { height: 45%; }
.pg-slide-shapes span:nth-child(4) { height: 78%; }
.pg-slide-shapes span:nth-child(5) { height: 55%; }

/* ============================================================
   4. PDF — page with cursive signature that draws
   ============================================================ */

.pg-pdf-stage {
    width: min(680px, 100%);
    margin: 64px auto 0;
    aspect-ratio: 5 / 7;
    max-height: 70vh;
    background: #fff;
    color: #1d1d1f;
    border-radius: 8px;
    box-shadow:
        0 50px 100px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(0, 0, 0, 0.06);
    padding: clamp(28px, 5%, 56px);
    position: relative;
    text-align: left;
    overflow: hidden;
    transform-style: preserve-3d;
    perspective: 1200px;
    --pdf-flip: 0deg;
    transform: rotateY(var(--pdf-flip));
    transition: transform 1.1s cubic-bezier(0.66, 0, 0.34, 1);
}
.pg-pdf-h {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: clamp(22px, 3vw, 30px);
    letter-spacing: -0.018em;
    margin: 0 0 10px;
}
.pg-pdf-meta { font-size: 11px; color: #86868b; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 24px; }
.pg-pdf-line {
    height: 7px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    margin: 8px 0;
}
.pg-pdf-line.w-90 { width: 90%; }
.pg-pdf-line.w-70 { width: 70%; }
.pg-pdf-line.w-80 { width: 80%; }
.pg-pdf-line.w-50 { width: 50%; }

.pg-pdf-highlight {
    background: linear-gradient(120deg, rgba(217, 122, 100, 0.0) 0%, rgba(217, 122, 100, 0.32) 100%);
    background-size: 0 100%;
    background-repeat: no-repeat;
    padding: 1px 2px;
    transition: background-size 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.pg-pdf-stage.in .pg-pdf-highlight { background-size: 100% 100%; }

.pg-pdf-sig {
    position: absolute;
    bottom: clamp(24px, 6%, 56px);
    right: clamp(24px, 6%, 56px);
    width: clamp(160px, 30%, 240px);
    height: 70px;
}
.pg-pdf-sig svg { width: 100%; height: 100%; }
.pg-pdf-sig svg path {
    fill: none;
    stroke: #d97a64;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 2.4s cubic-bezier(0.66, 0, 0.34, 1);
}
.pg-pdf-stage.in .pg-pdf-sig svg path { stroke-dashoffset: 0; }
.pg-pdf-sig-label {
    position: absolute;
    bottom: -16px;
    left: 0;
    font-size: 10px;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ============================================================
   5. CRM — Kanban columns with drifting cards
   ============================================================ */

.pg-crm-stage {
    width: min(960px, 100%);
    margin: 64px auto 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 18px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.35);
    color: #1d1d1f;
    height: clamp(380px, 48vw, 520px);
}
.pg-crm-col {
    background: #f5f5f7;
    border-radius: 10px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    /* Allow drifting cards to visibly cross into the next column.
       z-index keeps the column chrome behind the drifting cards. */
}
.pg-crm-card[data-drift] { z-index: 5; }
.pg-crm-col-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #86868b;
    padding: 0 4px 6px;
}
.pg-crm-count {
    background: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    color: #1d1d1f;
}

.pg-crm-card {
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    color: #1d1d1f;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    transition: transform 0.9s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.5s ease;
    transform-origin: center;
    will-change: transform;
    cursor: grab;
}
.pg-crm-card[data-drift] { animation: crmDrift 8s cubic-bezier(0.66, 0, 0.34, 1) infinite; }
.pg-crm-card-name { font-weight: 600; margin-bottom: 4px; }
.pg-crm-card-meta { color: #86868b; font-size: 11px; }
.pg-crm-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(155, 123, 224, 0.16);
    color: #6d4cd1;
    font-size: 10px;
    margin-top: 6px;
}

@keyframes crmDrift {
    0%   { transform: translate(0, 0); }
    45%  { transform: translate(115%, 0); }
    50%  { transform: translate(115%, 0); }
    95%  { transform: translate(0, 0); }
    100% { transform: translate(0, 0); }
}

/* Pulse on the active column */
.pg-crm-pulse {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: 0 0 0 0 rgba(155, 123, 224, 0.5);
    animation: crmPulse 3s ease-out infinite;
}
@keyframes crmPulse {
      0%, 60% { box-shadow: 0 0 0 0 rgba(155, 123, 224, 0.5); }
    100%     { box-shadow: 0 0 0 30px rgba(155, 123, 224, 0); }
}

/* ============================================================
   6. DRIVE — files orbiting around a central cloud
   ============================================================ */

.pg-drive-stage {
    width: min(820px, 100%);
    margin: 64px auto 0;
    aspect-ratio: 1;
    max-height: 70vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pg-drive-center {
    width: 22%;
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.6), transparent 60%),
        linear-gradient(135deg, #5a86e6, #2c5dc6);
    box-shadow:
        0 30px 60px rgba(90, 134, 230, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.4);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    position: relative;
    z-index: 2;
}
.pg-drive-orbit {
    position: absolute;
    inset: 0;
    animation: driveOrbit 30s linear infinite;
    will-change: transform;
}
.pg-drive-orbit-2 { animation-duration: 45s; animation-direction: reverse; }
.pg-drive-orbit-3 { animation-duration: 60s; }
.pg-drive-file {
    --angle: 0deg;
    --radius: 38%;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    height: 70px;
    margin-left: -28px;
    margin-top: -35px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
    transform: rotate(var(--angle)) translateX(var(--radius)) rotate(calc(var(--angle) * -1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 600;
    color: #5a86e6;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-top: 4px solid #5a86e6;
}
/* Note: orbit-1 spins forward, orbit-2 reverse, orbit-3 forward.
   At 30–60s per full rotation, labels rotate imperceptibly. */
.pg-drive-file.is-hidden { opacity: 0.2; transition: opacity 0.4s ease; }
.pg-drive-file.is-shown  { opacity: 1;   transition: opacity 0.4s ease; }
@keyframes driveOrbit {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.pg-drive-search {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 16px 32px rgba(0,0,0,0.18);
    padding: 12px 20px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1d1d1f;
    font-size: 14px;
    min-width: 280px;
    z-index: 3;
}
.pg-drive-search-text { color: #86868b; }
.pg-drive-search-cursor {
    display: inline-block;
    width: 1.5px;
    height: 1em;
    background: #5a86e6;
    vertical-align: -0.1em;
    animation: pgBlink 1s steps(2) infinite;
}

@media (prefers-reduced-motion: reduce) {
    .pg-drive-orbit, .pg-crm-card[data-drift], .pg-docs-pen { animation: none !important; }
    .pg-docs-line { transform: scaleX(1) !important; }
    .pg-pdf-sig svg path { stroke-dashoffset: 0 !important; }
    .pg-sheet-chart span { transform: scaleY(0.6) !important; }
}
