/* =========================================================
   PRINTQLY — REALISTIC PRINTER + 3-PAGE PAPER OUTPUT
   Related hero component only.
   Does not override global PrintQly styles.
   ========================================================= */

.pq-printer-hero {
    --pq-yellow: #ffd400;
    --pq-paper: #ffffff;
    --pq-ink: #111111;
    --pq-machine-1: #242424;
    --pq-machine-2: #111111;
    --pq-machine-3: #080808;

    position: relative;
    width: 100%;
    max-width: 920px;
    margin: 0 auto 28px;
    isolation: isolate;
}

.pq-printer-scene {
    position: relative;
    width: min(94vw, 760px);
    height: clamp(380px, 57vw, 520px);
    margin: 0 auto;
    perspective: 1100px;
}

/* ---------------- PAPER ---------------- */

.pq-paper-stage {
    position: absolute;
    z-index: 4;
    left: 50%;
    top: 5%;
    width: min(58vw, 490px);
    height: 78%;
    transform: translateX(-50%);
    pointer-events: none;
}

.pq-paper {
    position: absolute;
    left: 50%;
    bottom: 17%;
    width: 100%;
    height: 76%;
    transform: translate(-50%, 118%) scale(.97);
    transform-origin: 50% 100%;
    background:
        linear-gradient(90deg, rgba(0,0,0,.035), transparent 6%, transparent 94%, rgba(0,0,0,.035)),
        #fff;
    border: 1px solid rgba(0,0,0,.10);
    border-radius: 2px;
    box-shadow:
        0 15px 28px rgba(0,0,0,.34),
        0 3px 8px rgba(0,0,0,.20);
    overflow: hidden;
    opacity: 0;
    will-change: transform, opacity;
}

.pq-paper::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--pq-yellow);
}

.pq-paper::after {
    content: "";
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(0,0,0,.055);
    pointer-events: none;
}

.pq-paper__content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12%;
    text-align: center;
}

.pq-paper__text {
    position: relative;
    z-index: 2;
    color: var(--pq-ink);
    font-family: Poppins, Arial, sans-serif;
    font-size: clamp(1.55rem, 5vw, 3.6rem);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
}

/* Simulates ink being laid down while the paper feeds. */
.pq-paper__text::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -10px;
    width: 100%;
    height: 2px;
    background: var(--pq-yellow);
    transform: scaleX(0);
    transform-origin: left;
    opacity: .0;
}

.pq-paper.is-printing {
    animation: pqPaperOut 2600ms cubic-bezier(.16,.72,.17,1) forwards;
}

.pq-paper.is-printing .pq-paper__text {
    animation: pqInkAppear 1850ms steps(22, end) forwards;
    clip-path: inset(0 100% 0 0);
}

.pq-paper.is-printing .pq-paper__text::after {
    opacity: .9;
    animation: pqInkLine 1850ms linear forwards;
}

.pq-paper.is-complete {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
    transition: transform 450ms ease, opacity 450ms ease;
}

.pq-paper.is-stack-1 {
    z-index: 3;
    transform: translate(-50%, 7%) scale(.965) rotate(-.35deg);
}

.pq-paper.is-stack-2 {
    z-index: 2;
    transform: translate(-50%, 14%) scale(.93) rotate(.4deg);
}

@keyframes pqPaperOut {
    0% {
        opacity: 0;
        transform: translate(-50%, 118%) scale(.96) rotateX(9deg);
    }
    9% {
        opacity: 1;
    }
    34% {
        transform: translate(-50%, 62%) scale(.98) rotateX(6deg);
    }
    64% {
        transform: translate(-50%, 18%) scale(.995) rotateX(2deg);
    }
    86% {
        transform: translate(-50%, -1%) scale(1) rotateX(0);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, 0) scale(1) rotateX(0);
    }
}

@keyframes pqInkAppear {
    0% { clip-path: inset(0 100% 0 0); }
    100% { clip-path: inset(0 0 0 0); }
}

@keyframes pqInkLine {
    0% { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}

/* ---------------- PRINTER BODY ---------------- */

.pq-printer {
    position: absolute;
    z-index: 6;
    left: 50%;
    bottom: 1%;
    width: min(84vw, 650px);
    height: 38%;
    transform: translateX(-50%);
    filter: drop-shadow(0 19px 22px rgba(0,0,0,.48));
}

.pq-printer-top {
    position: absolute;
    left: 5%;
    right: 5%;
    top: -22%;
    height: 36%;
    border-radius: 22px 22px 8px 8px;
    background:
        linear-gradient(180deg, #3b3b3b 0%, #242424 45%, #171717 100%);
    border: 1px solid rgba(255,255,255,.09);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.10),
        0 4px 0 rgba(0,0,0,.65);
}

.pq-top-panel {
    position: absolute;
    right: 5%;
    top: 18%;
    width: 37%;
    height: 52%;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px;
    border-radius: 8px;
    background: #121212;
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: inset 0 2px 5px rgba(0,0,0,.65);
}

.pq-top-screen {
    flex: 1;
    min-width: 38px;
    height: 70%;
    border-radius: 3px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.13), rgba(255,255,255,.025)),
        #181818;
    border: 1px solid rgba(255,255,255,.08);
}

.pq-top-button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #777;
    box-shadow: inset 0 1px 1px rgba(255,255,255,.2);
}

.pq-top-button--small {
    width: 7px;
    height: 7px;
    background: #444;
}

.pq-paper-loader {
    position: absolute;
    left: 8%;
    top: 7%;
    width: 42%;
    height: 74%;
    overflow: hidden;
    border-radius: 10px;
    background: #080808;
    border: 1px solid rgba(255,255,255,.06);
}

.pq-loader-paper {
    position: absolute;
    left: 13%;
    top: 18%;
    width: 72%;
    height: 95%;
    background: #f8f8f8;
    transform: rotate(-3deg);
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
}

.pq-printer-body {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    border-radius: 17px 17px 9px 9px;
    background:
        linear-gradient(90deg, rgba(255,255,255,.045), transparent 15%, transparent 85%, rgba(0,0,0,.18)),
        linear-gradient(180deg, #292929 0%, #181818 52%, #0c0c0c 100%);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow:
        inset 0 2px 0 rgba(255,255,255,.07),
        inset 0 -8px 18px rgba(0,0,0,.45);
}

.pq-printer-brand {
    position: absolute;
    left: 7%;
    top: 38%;
    color: rgba(255,255,255,.80);
    font: 700 12px/1 Arial, sans-serif;
    letter-spacing: .04em;
}

.pq-printer-control {
    position: absolute;
    right: 7%;
    top: 29%;
    width: 23%;
    height: 17%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 5px;
    background: #090909;
    border: 1px solid rgba(255,255,255,.06);
}

.pq-status-light {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--pq-yellow);
    box-shadow: 0 0 9px rgba(255,212,0,.7);
    animation: pqStatus 850ms ease-in-out infinite alternate;
}

.pq-control-line {
    height: 3px;
    flex: 1;
    border-radius: 4px;
    background: #4c4c4c;
}

.pq-control-line--short {
    max-width: 35%;
}

.pq-output-bezel {
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 17%;
    height: 29%;
    border-radius: 8px;
    background: #090909;
    border: 1px solid rgba(255,255,255,.08);
    box-shadow:
        inset 0 5px 11px rgba(0,0,0,.8),
        0 2px 0 rgba(255,255,255,.025);
}

.pq-output-slot {
    position: absolute;
    left: 5%;
    right: 5%;
    top: 13%;
    height: 20%;
    border-radius: 999px;
    background: #000;
    box-shadow:
        inset 0 2px 4px rgba(255,255,255,.04),
        0 1px 0 rgba(255,255,255,.04);
}

.pq-feed-roller {
    position: absolute;
    top: 19%;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #333;
    border: 2px solid #111;
    box-shadow: inset 0 1px 1px rgba(255,255,255,.12);
    animation: pqRoller 500ms linear infinite;
}

.pq-feed-roller--left { left: 8%; }
.pq-feed-roller--right { right: 8%; }

.pq-printer-tray {
    position: absolute;
    left: 7%;
    right: 7%;
    bottom: -7%;
    height: 17%;
    border-radius: 3px 3px 13px 13px;
    background: linear-gradient(180deg, #2a2a2a, #101010);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow:
        inset 0 2px 0 rgba(255,255,255,.05),
        0 4px 5px rgba(0,0,0,.45);
}

.pq-tray-inner {
    position: absolute;
    left: 5%;
    right: 5%;
    top: 22%;
    bottom: 18%;
    border-radius: 3px;
    background: #090909;
    box-shadow: inset 0 3px 6px rgba(0,0,0,.75);
}

.pq-printer-shadow {
    position: absolute;
    z-index: 1;
    left: 12%;
    right: 12%;
    bottom: 0;
    height: 10%;
    border-radius: 50%;
    background: rgba(0,0,0,.65);
    filter: blur(10px);
}

/* Feed the paper visually from the output slot, not from the bottom. */
.pq-paper-stage::after {
    content: "";
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: 13%;
    width: min(58vw, 490px);
    height: 5%;
    transform: translateX(-50%);
    border-radius: 2px;
    background: #000;
    box-shadow: inset 0 2px 5px rgba(255,255,255,.04);
    pointer-events: none;
}

/* ---------------- RESPONSIVE ---------------- */

@media (max-width: 767px) {
    .pq-printer-hero {
        margin-bottom: 20px;
    }

    .pq-printer-scene {
        width: 96vw;
        height: 400px;
    }

    .pq-paper-stage {
        width: min(72vw, 430px);
        height: 78%;
        top: 2%;
    }

    .pq-paper {
        height: 74%;
        bottom: 18%;
    }

    .pq-paper__content {
        padding: 12%;
    }

    .pq-paper__text {
        font-size: clamp(1.45rem, 6.7vw, 2.7rem);
    }

    .pq-printer {
        width: 88vw;
        height: 34%;
    }

    .pq-printer-brand {
        font-size: 9px;
    }

    .pq-top-panel {
        gap: 4px;
        padding: 5px;
    }

    .pq-paper-stage::after {
        width: min(72vw, 430px);
    }
}

@media (max-width: 390px) {
    .pq-printer-scene {
        height: 355px;
    }

    .pq-paper__text {
        font-size: 1.32rem;
    }

    .pq-printer {
        width: 91vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pq-paper.is-printing {
        animation: none;
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }

    .pq-paper.is-printing .pq-paper__text {
        animation: none;
        clip-path: inset(0 0 0 0);
    }

    .pq-paper.is-printing .pq-paper__text::after {
        animation: none;
        opacity: 0;
    }

    .pq-feed-roller,
    .pq-status-light {
        animation: none;
    }
}

@keyframes pqStatus {
    from { opacity: .4; }
    to { opacity: 1; }
}

@keyframes pqRoller {
    from { transform: rotate(0); }
    to { transform: rotate(360deg); }
}

.pq-printer-noscript {
    margin: 0;
    color: #fff;
    text-align: center;
    font-weight: 800;
    line-height: 1.08;
    font-size: clamp(2rem, 7vw, 4rem);
}
