/* ==========================================================================
   HERO — the opening screen and the printer at work.
   ========================================================================== */

.hero {
    position: relative;
    min-block-size: 100svh;
    display: grid;
    align-items: center;
    padding-block: calc(var(--header-h) + clamp(1.5rem, 4vh, 3rem)) clamp(4.5rem, 10vh, 6.5rem);
    overflow: clip;
    isolation: isolate;
    background: var(--ink-950);
}

/* ---------------------------------------------------------------- backdrop */
.hero__bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.hero__glow {
    position: absolute;
    inset-block-start: 8%;
    inset-inline-end: -8%;
    inline-size: min(70vw, 900px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgb(236 121 37 / 0.22), rgb(236 121 37 / 0.06) 55%, transparent 72%);
    filter: blur(10px);
    animation: glow-breathe 7s ease-in-out infinite;
}

@keyframes glow-breathe {
    50% { transform: scale(1.06); opacity: 0.8; }
}

/* The build plate, receding: a perspective grid that drifts towards the viewer like a moving bed. */
.hero__floor {
    position: absolute;
    inset-inline: -30%;
    inset-block-end: -8%;
    block-size: 58%;
    background:
        linear-gradient(rgb(255 255 255 / 0.07) 1px, transparent 1px) 0 0 / 64px 64px,
        linear-gradient(90deg, rgb(255 255 255 / 0.07) 1px, transparent 1px) 0 0 / 64px 64px;
    transform: perspective(700px) rotateX(64deg);
    transform-origin: 50% 100%;
    mask-image: linear-gradient(to top, #000 10%, transparent 85%);
    -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 85%);
    animation: floor-drift 6s linear infinite;
}

@keyframes floor-drift {
    to { background-position: 0 64px, 0 0; }
}

/* Faint horizontal layer lines over everything, like looking at the side of a print. */
.hero__noise {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, rgb(255 255 255 / 0.018) 0 1px, transparent 1px 5px);
    mask-image: radial-gradient(80% 70% at 60% 45%, #000, transparent);
    -webkit-mask-image: radial-gradient(80% 70% at 60% 45%, #000, transparent);
}

/* ---------------------------------------------------------------- layout */
.hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(1.5rem, 4vw, 4rem);
}

.hero__copy {
    display: grid;
    gap: var(--space-5);
    justify-items: start;
    max-inline-size: 640px;
}

.hero__title {
    font-size: clamp(2.9rem, 1.1rem + 4.3vw, 5.5rem);
    font-stretch: 122%;
    line-height: 0.93;
    letter-spacing: -0.045em;
}

.hero__line {
    display: block;
}

.hero__line--accent {
    color: var(--hot-500);
    text-shadow: 0 0 60px rgb(236 121 37 / 0.35);
}

/* Each line of the headline is PRINTED onto the page: revealed bottom-up in visible steps, like layers
   being laid down, with a hot band riding the top edge of what is already there. */
.hero__ink {
    position: relative;
    display: inline-block;
}

.hero__ink {
    clip-path: inset(100% 0 0 0);
    animation: print-up 1.15s steps(14, end) forwards;
}

.hero__line--accent .hero__ink {
    animation-delay: 0.55s;
}

.hero__ink::after {
    content: "";
    position: absolute;
    inset-inline: -2%;
    inset-block-end: 0;
    block-size: 0.09em;
    background: var(--hot-400);
    box-shadow: 0 0 16px 2px var(--hot-glow);
    animation: print-head 1.15s steps(14, end) forwards;
}

.hero__line--accent .hero__ink::after {
    animation-delay: 0.55s;
}

@keyframes print-up {
    /* past the box, so the text glow is not cut into a rectangle */
    to { clip-path: inset(-0.4em -0.6em -0.4em -0.6em); }
}

@keyframes print-head {
    0% { inset-block-end: 0; opacity: 1; }
    92% { opacity: 1; }
    100% { inset-block-end: 100%; opacity: 0; }
}

.hero__eyebrow,
.hero__lead,
.hero__actions,
.hero__chips {
    opacity: 0;
    transform: translateY(14px);
    animation: rise 0.9s var(--ease-out) forwards;
}

.hero__eyebrow { animation-delay: 0.05s; }
.hero__lead { animation-delay: 1.2s; }
.hero__actions { animation-delay: 1.35s; }
.hero__chips { animation-delay: 1.5s; }

@keyframes rise {
    to { opacity: 1; transform: none; }
}

.hero__lead {
    max-inline-size: 52ch;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-5);
}

.hero__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 0;
    list-style: none;
}

.hero__chips li {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.8rem 0.45rem 0.6rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line);
    background: rgb(255 255 255 / 0.025);
    font-size: var(--step--1);
    color: var(--text-soft);
}

.hero__chips svg {
    inline-size: 1rem;
    block-size: 1rem;
    color: var(--hot-500);
}

.hero__scroll {
    position: absolute;
    inset-block-end: clamp(1rem, 3vh, 2rem);
    inset-inline-start: 50%;
    display: grid;
    justify-items: center;
    gap: 10px;
    transform: translateX(-50%);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-mute);
    text-decoration: none;
}

.hero__scroll-line {
    position: relative;
    inline-size: 2px;
    block-size: 44px;
    border-radius: 2px;
    background: var(--line-strong);
    overflow: hidden;
}

.hero__scroll-line::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    block-size: 40%;
    border-radius: 2px;
    background: var(--hot-500);
    box-shadow: 0 0 10px var(--hot-glow);
    animation: extrude-down 1.8s var(--ease-in-out) infinite;
}

@keyframes extrude-down {
    0% { transform: translateY(-110%); }
    100% { transform: translateY(260%); }
}

/* ---------------------------------------------------------------- the printer */
.printer {
    position: relative;
    aspect-ratio: 1 / 1.02;
    inline-size: 100%;
    max-inline-size: 620px;
    justify-self: end;
    border-radius: var(--radius-xl);
    background:
        radial-gradient(75% 60% at 50% 70%, rgb(236 121 37 / 0.09), transparent 70%),
        linear-gradient(180deg, rgb(255 255 255 / 0.035), rgb(255 255 255 / 0.01));
    border: 1px solid var(--line);
    box-shadow: 0 40px 120px -40px rgb(0 0 0 / 0.9), 0 1px 0 rgb(255 255 255 / 0.05) inset;
    touch-action: pan-y;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.printer[data-dragging="true"] {
    cursor: grabbing;
}

.printer__canvas {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    border-radius: inherit;
}

.printer__frame {
    position: absolute;
    inset: 14px;
    pointer-events: none;
}

.printer__corner {
    position: absolute;
    inline-size: 18px;
    block-size: 18px;
    border: 1.5px solid var(--hud-dim);
}

.printer__corner--tl { inset-block-start: 0; inset-inline-start: 0; border-inline-end: 0; border-block-end: 0; }
.printer__corner--tr { inset-block-start: 0; inset-inline-end: 0; border-inline-start: 0; border-block-end: 0; }
.printer__corner--bl { inset-block-end: 0; inset-inline-start: 0; border-inline-end: 0; border-block-start: 0; }
.printer__corner--br { inset-block-end: 0; inset-inline-end: 0; border-inline-start: 0; border-block-start: 0; }

.printer__hud {
    position: absolute;
    inset: 26px;
    pointer-events: none;
}

.printer__hud .hud {
    position: absolute;
}

.hud--status {
    inset-block-start: 0;
    inset-inline-start: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--bone-50);
}

.hud__file {
    color: var(--text-mute);
    text-transform: none;
    letter-spacing: 0.04em;
}

.hud--temps {
    inset-block-start: 0;
    inset-inline-end: 0;
    display: grid;
    justify-items: end;
    gap: 4px;
}

.hud--gcode {
    inset-block-start: 44px;
    inset-inline-end: 0;
    margin: 0;
    font-size: 0.62rem;
    line-height: 1.6;
    text-align: end;
    color: rgb(95 211 222 / 0.38);
    text-transform: none;
    white-space: pre;
    mask-image: linear-gradient(to bottom, transparent, #000 40%);
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 40%);
}

.hud--progress {
    inset-inline: 0;
    inset-block-end: 0;
    display: grid;
    gap: 7px;
}

.hud__row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
}

.hud__row--soft {
    color: var(--text-mute);
}

.hud__bar {
    position: relative;
    display: block;
    block-size: 3px;
    border-radius: 3px;
    background: rgb(255 255 255 / 0.08);
    overflow: hidden;
}

.hud__bar span {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--hot-700), var(--hot-500));
    box-shadow: 0 0 10px var(--hot-glow);
    transform-origin: left;
    transform: scaleX(0);
}

.hud--hint {
    inset-block-end: 58px;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgb(8 9 11 / 0.6);
    color: var(--text-soft);
    font-size: 0.62rem;
    opacity: 0;
    transition: opacity var(--dur-3);
}

.printer:hover .hud--hint {
    opacity: 1;
}

.printer[data-interacted="true"] .hud--hint {
    opacity: 0 !important;
}

/* ---------------------------------------------------------------- tablet / phone
   The printer moves above the fold on a phone? No: the words come first — they are what a visitor
   needs to decide in the first second. The printer follows, full-width, as the "proof". */
@media (max-width: 980px) {
    .hero {
        min-block-size: auto;
        padding-block-end: clamp(4rem, 12vw, 6rem);
    }

    .hero__grid {
        grid-template-columns: 1fr;
    }

    .hero__copy {
        max-inline-size: none;
    }

    .printer {
        justify-self: stretch;
        max-inline-size: 560px;
        margin-inline: auto;
        aspect-ratio: 1 / 0.92;
    }

    .hero__scroll {
        display: none;
    }
}

@media (max-width: 560px) {
    .hero__title {
        font-size: clamp(2.6rem, 12.2vw, 3.6rem);
        font-stretch: 112%;
    }

    .hero__actions .button {
        inline-size: 100%;
        justify-content: center;
    }

    .hero__actions .text-link {
        margin-inline: auto;
    }

    .printer__hud {
        inset: 18px;
    }

    .printer__frame {
        inset: 10px;
    }

    .hud__file,
    .hud--gcode,
    .hud--hint {
        display: none;
    }

    .hud--temps span:last-child {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero__ink,
    .hero__eyebrow,
    .hero__lead,
    .hero__actions,
    .hero__chips {
        clip-path: none;
        opacity: 1;
        transform: none;
        animation: none;
    }

    .hero__ink::after,
    .hero__floor,
    .hero__glow {
        animation: none;
    }
}
