@import "./section-common.css";

.pg-headline {
    max-width: 720px;
}

.pg-spark {
    position: relative;
    display: inline-block;
}

.pg-spark-marks {
    position: absolute;
    left: 50%;
    top: -16px;
    width: 30px;
    height: 16px;
    transform: translateX(-50%);
    pointer-events: none;
}

.pg-spark-marks i {
    position: absolute;
    bottom: 0;
    width: 2px;
    height: 10px;
    background: var(--brand-bright);
    border-radius: 2px;
}

.pg-spark-marks i:nth-child(1) {
    left: 4px;
    transform: rotate(-32deg);
    height: 9px;
}

.pg-spark-marks i:nth-child(2) {
    left: 14px;
    height: 13px;
}

.pg-spark-marks i:nth-child(3) {
    left: 24px;
    transform: rotate(32deg);
    height: 9px;
}

.pg-diagram {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(240px, 0.62fr);
    align-items: center;
    gap: 16px clamp(28px, 5vw, 90px);
    width: 100%;
    padding: clamp(16px, 2vw, 32px) 0 clamp(24px, 3vw, 40px);
}

.pg-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 1;
}

.pg-line-base {
    fill: none;
    stroke: var(--line-strong);
    stroke-width: 1.6;
}

.pg-line-flow {
    fill: none;
    stroke: var(--brand-bright);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 14 78;
    animation: pg-flow 2.6s linear infinite;
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--brand-bright) 80%, transparent));
}

.pg-dot {
    fill: var(--brand-bright);
    filter: drop-shadow(0 0 6px var(--brand));
}

@keyframes pg-flow {
    to {
        stroke-dashoffset: -84;
    }
}

.pg-nodes {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: center;
    position: relative;
    z-index: 2;
}

.pg-node-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pg-node {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 78px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 10px 30px #00000059;
}

.pg-node-mark {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--brand-line);
    background: var(--brand-tint);
    color: var(--brand-bright);
    display: grid;
    place-items: center;
}

.pg-node-mark svg {
    width: 22px;
    height: 22px;
}

.pg-node-name {
    font-family: DM Sans;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-2);
    line-height: 1.25;
}

.pg-hub-wrap {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 0 8px;
}

.pg-hub {
    width: clamp(104px, 9vw, 132px);
    height: clamp(104px, 9vw, 132px);
    border-radius: 28px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    box-shadow:
        0 0 0 8px var(--brand-tint),
        0 18px 40px #00000080;
    display: grid;
    place-items: center;
    animation: pg-hub-pulse 3.2s ease-in-out infinite;
}

.pg-hub img {
    width: 58%;
    height: 58%;
    object-fit: contain;
}

/* The mark is a ring, so a slow continuous rotation reads as the hub working
   rather than as a spinner. */
.pg-hub-mark {
    animation: pg-mark-spin 24s linear infinite;
}

@keyframes pg-mark-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pg-hub-pulse {
    0%,
    100% {
        box-shadow:
            0 0 0 8px var(--brand-tint),
            0 18px 40px #00000080;
    }
    50% {
        box-shadow:
            0 0 0 14px var(--brand-tint),
            0 18px 40px #00000080;
    }
}

.pg-outcome {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    width: min(100%, 400px);
    margin-left: auto;
}

.pg-product {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 18px 50px #00000073;
}

.pg-product-media {
    height: clamp(168px, 15vw, 216px);
    overflow: hidden;
    background: var(--surface-3);
}

.pg-product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.pg-product-body {
    padding: 20px 20px 22px;
}

.pg-product-label {
    font-family: DM Sans;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-3);
    margin: 0 0 6px;
}

.pg-product-value {
    font-family: DM Sans;
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -0.03em;
    color: var(--text);
    margin: 0 0 18px;
}

.pg-product-btn {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 12px;
    background: var(--brand-solid);
    color: var(--text);
    font-family: DM Sans;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 14px 12px;
}

.pg-success {
    position: relative;
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 16px 40px #0000008c;
    animation: pg-success-in 0.7s ease both 0.4s;
}

.pg-check {
    width: 40px;
    height: 40px;
    grid-row: span 2;
}

.pg-check-ring {
    fill: none;
    stroke: var(--brand-bright);
    stroke-width: 2.4;
    stroke-dasharray: 110;
    stroke-dashoffset: 110;
    animation: pg-check-draw 1.1s ease forwards 0.6s;
}

.pg-check-mark {
    fill: none;
    stroke: var(--brand-bright);
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: pg-check-draw 0.5s ease forwards 1.2s;
}

.pg-success-title {
    font-family: DM Sans;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    margin: 0 0 8px;
}

.pg-success-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--line-soft);
    border-radius: 999px;
    padding: 7px 10px;
    font-family: DM Sans;
    font-size: 11px;
    color: var(--text-3);
}

.pg-success-pill svg {
    color: var(--brand-bright);
    flex: 0 0 auto;
}

@keyframes pg-success-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes pg-check-draw {
    to {
        stroke-dashoffset: 0;
    }
}

@media (max-width: 992px) {
    .pg-diagram {
        grid-template-columns: minmax(0, 1fr);
        justify-content: stretch;
        justify-items: center;
        gap: 36px;
        padding: 32px 0 8px;
    }

    .pg-nodes {
        max-width: 520px;
    }

    .pg-outcome {
        width: min(100%, 380px);
        margin-inline: auto;
    }
}

@media (max-width: 600px) {
    .pg-nodes {
        grid-template-columns: 1fr;
        max-width: 320px;
        gap: 12px;
    }

    /* Single column - the desktop card scale reads oversized here. */
    .pg-node {
        min-height: 68px;
    }

    .pg-node-mark {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .pg-node-mark svg {
        width: 20px;
        height: 20px;
    }

    .pg-node-col:nth-child(1),
    .pg-node-col:nth-child(2),
    .pg-node-col:nth-child(3) {
        margin-top: 0;
    }

    .pg-headline {
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pg-line-flow,
    .pg-hub,
    .pg-hub-mark,
    .pg-success,
    .pg-check-ring,
    .pg-check-mark {
        animation: none;
    }

    .pg-check-ring,
    .pg-check-mark {
        stroke-dashoffset: 0;
    }

    .pg-dot {
        display: none;
    }
}
