:root:not([data-theme]) {
    --ink: #080808;
    --paper: #dfddd6;
    --line: #8c8a84;
    --red: #ef3123;
}

.legacy-header[hidden],
.legacy-home-hero[hidden] {
    display: none !important;
}

#main-content {
    margin-inline: auto;
    max-width: var(--shell);
    width: min(calc(100% - 36px), var(--shell));
}

#main-content > .content-section {
    width: 100%;
}

.home-v4 {
    --paper: #f3f2ed;
    --surface: #fbfaf7;
    --ink: #0d0d0c;
    --muted: #66645e;
    --line: rgba(13, 13, 12, .22);
    --grid-line: rgba(13, 13, 12, .055);
    --red: #e82930;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(22, 22, 18, .055);
    margin-left: 0;
    margin-top: 14px;
    overflow: hidden;
    width: 100%;
}

.home-v4.scroll-hero {
    min-height: calc(100svh - 76px);
}

.home-v4 .hero-pin {
    grid-template-rows: minmax(260px, 1.1fr) minmax(315px, .9fr) 58px;
    height: calc(100svh - 76px);
    min-height: 680px;
}

.home-v4 .site-header {
    display: none;
}

.home-v4 .hero-copy {
    background-color: var(--surface);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 30px 30px;
}

.home-v4 .button {
    background: transparent;
    border-radius: 0;
    min-width: 0;
    overflow: hidden;
    position: relative;
    transform: translate3d(var(--motion-x, 0), var(--motion-y, 0), 0);
}

.home-v4 .button-primary {
    background: var(--red);
}

html[data-theme="dark"] .home-v4 .button.button-primary,
html[data-theme="dark"] .home-v4 .header-action {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.home-v4 .button + .button {
    margin-left: 0;
}

.home-v4 .button::after,
.content-section .button::after,
.legacy-header .theme-toggle::after {
    background: currentColor;
    bottom: 0;
    content: "";
    height: 3px;
    left: 0;
    position: absolute;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 300ms cubic-bezier(.2, .8, .2, 1);
    width: 100%;
}

.home-v4 .button:hover::after,
.home-v4 .button:focus-visible::after,
.content-section .button:hover::after,
.content-section .button:focus-visible::after,
.legacy-header .theme-toggle:hover::after,
.legacy-header .theme-toggle:focus-visible::after {
    transform: scaleX(1);
}

.home-v4 .workflow-status {
    border-radius: 0;
    box-shadow: none;
}

.legacy-header {
    align-items: center;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px 14px 8px 8px;
    box-shadow: var(--shadow);
    display: grid;
    gap: clamp(.75rem, 1.4vw, 1.5rem);
    grid-template-columns: auto 1fr auto;
    margin-inline: auto;
    margin-top: 18px;
    max-width: var(--shell);
    min-height: 58px;
    padding: .55rem var(--pad);
    position: sticky;
    top: 12px;
    width: min(calc(100% - 36px), var(--shell));
    z-index: 1000;
}

.legacy-header .logo {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
}

.legacy-header .site-nav {
    border-top: 0;
    display: flex;
    gap: clamp(.55rem, 1.15vw, 1.15rem);
    grid-column: 2;
    grid-row: 1;
    justify-content: center;
    margin: 0;
    min-width: 0;
    padding: 0;
}

.legacy-header .site-nav a {
    border-bottom: 0;
    font-size: .6rem;
    letter-spacing: .055em;
    padding-block: .55rem;
    white-space: nowrap;
}

.legacy-header .site-nav a::after {
    bottom: .2rem;
}

.legacy-header .header-tools {
    align-items: center;
    display: flex;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
}

.legacy-header .theme-toggle {
    font-size: .6rem;
    letter-spacing: .055em;
    overflow: hidden;
    position: relative;
    transform: translate3d(var(--motion-x, 0), var(--motion-y, 0), 0);
}

.content-section .button {
    border-radius: 7px;
    display: inline-flex;
    font-size: .68rem;
    gap: 1rem;
    justify-content: space-between;
    letter-spacing: .045em;
    min-height: 50px;
    min-width: 190px;
    overflow: hidden;
    padding: .9rem 1rem;
    position: relative;
    transform: translate3d(var(--motion-x, 0), var(--motion-y, 0), 0);
}

.content-section .button-red {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.process-grid.process-seven {
    background: var(--white);
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    overflow: hidden;
}

.process-grid.process-seven li {
    align-items: flex-start;
    border-bottom: 0;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 292px;
    padding: 1.25rem clamp(.7rem, 1.05vw, 1.15rem) 1.45rem;
}

.process-grid.process-seven li:last-child {
    border-right: 0;
}

.process-grid.process-seven li::before {
    background: var(--line);
    content: "";
    height: 1px;
    left: 0;
    position: absolute;
    right: 0;
    top: 2.3rem;
}

.process-grid.process-seven li::after {
    background: var(--red);
    bottom: auto;
    height: 3px;
    left: clamp(.7rem, 1.05vw, 1.15rem);
    right: clamp(.7rem, 1.05vw, 1.15rem);
    top: 0;
    transform: scaleX(.22);
    transform-origin: left;
    width: auto;
}

.process-grid.process-seven li:hover::after {
    transform: scaleX(1);
}

.process-grid.process-seven li > span {
    align-items: center;
    background: var(--red);
    color: #fff;
    display: inline-flex;
    font-size: .7rem;
    height: 36px;
    justify-content: center;
    letter-spacing: .06em;
    margin: 0 0 2.1rem;
    padding: 0;
    position: relative;
    width: 42px;
    z-index: 1;
}

.process-grid.process-seven h3 {
    font-size: clamp(1.05rem, 1.35vw, 1.5rem);
    line-height: .98;
    margin: 0 0 .85rem;
    transition: color 220ms ease, transform 300ms cubic-bezier(.2, .8, .2, 1);
}

.process-grid.process-seven p {
    color: var(--gray);
    font-size: clamp(.68rem, .72vw, .77rem);
    line-height: 1.45;
    margin: 0;
}

.process-grid.process-seven li:hover h3 {
    color: var(--red);
    transform: translateY(-4px);
}

.problem-list li,
.model-grid article,
.reason-grid article,
.scope-list li {
    transition:
        background-color 240ms ease,
        border-color 240ms ease,
        transform 300ms cubic-bezier(.2, .8, .2, 1);
}

.problem-list li:hover,
.model-grid article:hover,
.reason-grid article:hover,
.scope-list li:hover {
    transform: translateY(-3px);
}

.problem-list .signal-dot {
    transition: transform 300ms cubic-bezier(.2, .8, .2, 1);
}

.problem-list li:hover .signal-dot {
    transform: scale(1.6);
}

.reason-grid article > svg {
    transition: color 220ms ease, transform 400ms cubic-bezier(.2, .8, .2, 1);
}

.reason-grid article:hover > svg {
    color: var(--red);
    transform: translateY(-5px) rotate(-3deg);
}

.content-section .arrow {
    transition: transform 260ms cubic-bezier(.2, .8, .2, 1);
}

.content-section a:hover .arrow {
    transform: translateX(6px);
}

html[data-theme="dark"] .home-v4 {
    --paper: #11110f;
    --surface: #1a1a17;
    --ink: #f1efe9;
    --muted: #b9b6af;
    --line: rgba(241, 239, 233, .2);
    --grid-line: rgba(241, 239, 233, .065);
    --red: #ff555d;
}

html[data-theme="dark"] .home-v4 .laptop-frame,
html[data-theme="dark"] .home-v4 .laptop-screen > img,
html[data-theme="dark"] .home-v4 .cnc-body,
html[data-theme="dark"] .home-v4 .cnc-head,
html[data-theme="dark"] .home-v4 .parts-output img,
html[data-theme="dark"] .home-v4 .document-packet {
    filter: invert(1) hue-rotate(180deg);
}

html[data-theme="dark"] .home-v4 .workflow-status {
    background: rgba(26, 26, 23, .94);
    color: var(--ink);
}

html[data-theme="dark"] .home-v4 .workflow-status .status-copy {
    color: var(--ink);
}

@media (max-width: 1120px) {
    .legacy-header {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .process-grid.process-seven h3 {
        font-size: .98rem;
    }

    .process-grid.process-seven p {
        font-size: .65rem;
    }
}

@media (max-width: 820px) {
    #main-content {
        width: calc(100% - 24px);
    }

    .legacy-header {
        grid-template-columns: 1fr auto;
        margin-top: 12px;
        top: 6px;
        width: calc(100% - 24px);
    }

    .legacy-header .site-nav {
        border-top: 1px solid var(--line);
        display: grid;
        gap: .25rem;
        grid-column: 1 / -1;
        grid-row: 2;
        grid-template-columns: repeat(6, 1fr);
        margin: .1rem 0 -.15rem;
        padding-top: .45rem;
    }

    .legacy-header .site-nav a {
        font-size: .53rem;
        line-height: 1.15;
        padding: .35rem .2rem;
        text-align: center;
        white-space: normal;
    }

    .legacy-header .header-tools {
        grid-column: 2;
    }

    .home-v4.scroll-hero,
    .home-v4 .hero-pin {
        height: calc(100svh - 108px);
        min-height: 620px;
    }

    .home-v4 .hero-pin {
        grid-template-rows: 245px minmax(300px, 1fr) 44px;
    }
}

@media (max-width: 620px) {
    #main-content {
        width: calc(100% - 20px);
    }

    .legacy-header {
        top: 5px;
        width: calc(100% - 20px);
    }

    .process-grid.process-seven {
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .process-grid.process-seven li {
        align-items: start;
        border-bottom: 1px solid var(--line);
        border-right: 0;
        display: grid;
        gap: .35rem 1rem;
        grid-template-columns: 42px minmax(0, 1fr);
        min-height: 0;
        padding: 1.15rem 1rem 1.2rem;
    }

    .process-grid.process-seven li:last-child {
        border-bottom: 0;
    }

    .process-grid.process-seven li::before {
        bottom: 0;
        height: auto;
        left: 2.3rem;
        right: auto;
        top: 0;
        width: 1px;
    }

    .process-grid.process-seven li::after {
        bottom: 1rem;
        height: auto;
        left: 0;
        right: auto;
        top: 1rem;
        transform: scaleY(.25);
        transform-origin: top;
        width: 3px;
    }

    .process-grid.process-seven li:hover::after {
        transform: scaleY(1);
    }

    .process-grid.process-seven li > span {
        grid-row: 1 / span 2;
        margin: 0;
    }

    .process-grid.process-seven h3,
    .process-grid.process-seven p {
        grid-column: 2;
    }

    .process-grid.process-seven h3 {
        font-size: 1.15rem;
        margin-bottom: .25rem;
    }

    .process-grid.process-seven p {
        font-size: .76rem;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .compact-section-header.reveal-target .section-label,
    .compact-section-header.reveal-target h2,
    .compact-section-header.reveal-target > div > p {
        clip-path: inset(0 0 100% 0);
        transform: translateY(18px);
        transition:
            clip-path 650ms cubic-bezier(.2, .8, .2, 1),
            opacity 500ms ease,
            transform 650ms cubic-bezier(.2, .8, .2, 1);
    }

    .compact-section-header.reveal-target h2 {
        transition-delay: 70ms;
    }

    .compact-section-header.reveal-target > div > p {
        transition-delay: 140ms;
    }

    .compact-section-header.reveal-target.is-visible .section-label,
    .compact-section-header.reveal-target.is-visible h2,
    .compact-section-header.reveal-target.is-visible > div > p {
        clip-path: inset(0 0 0 0);
        transform: translateY(0);
    }

    .process-grid.process-seven li:nth-child(2) { transition-delay: 45ms; }
    .process-grid.process-seven li:nth-child(3) { transition-delay: 90ms; }
    .process-grid.process-seven li:nth-child(4) { transition-delay: 135ms; }
    .process-grid.process-seven li:nth-child(5) { transition-delay: 180ms; }
    .process-grid.process-seven li:nth-child(6) { transition-delay: 225ms; }
    .process-grid.process-seven li:nth-child(7) { transition-delay: 270ms; }
}

@media (prefers-reduced-motion: reduce) {
    .home-v4 .button,
    .content-section .button,
    .legacy-header .theme-toggle,
    .problem-list li,
    .model-grid article,
    .reason-grid article,
    .scope-list li,
    .process-grid.process-seven h3,
    .reason-grid article > svg {
        transform: none !important;
        transition: none !important;
    }
}

/* Process refinement: strong red numerals, no decorative line behind them. */
.process-grid.process-seven li::before {
    display: none;
}

.process-grid.process-seven li > span {
    align-items: flex-start;
    background: transparent;
    color: var(--red);
    font-size: clamp(1.45rem, 1.85vw, 1.9rem);
    font-weight: 800;
    height: auto;
    justify-content: flex-start;
    letter-spacing: -.045em;
    line-height: .9;
    margin-bottom: 1.55rem;
    width: auto;
}

.home-v4 .hero-actions .button:not(.button-primary) {
    background: var(--surface);
    border-color: var(--ink);
    color: var(--ink);
}

.home-v4 .hero-actions .button:not(.button-primary):hover,
.home-v4 .hero-actions .button:not(.button-primary):focus-visible {
    background: var(--ink);
    color: var(--paper);
}

/* The large contact bar fills left-to-right, then script follows the link. */
.hold-to-contact {
    isolation: isolate;
    overflow: hidden;
    position: relative;
}

.hold-to-contact::before {
    background: #0d0d0c;
    content: "";
    inset: 0;
    position: absolute;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1200ms linear;
    z-index: 0;
}

.hold-to-contact.is-holding::before {
    transform: scaleX(1);
}

.hold-to-contact .button-label,
.hold-to-contact .arrow {
    position: relative;
    z-index: 1;
}

.hold-to-contact:hover {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
    transform: translate3d(var(--motion-x, 0), var(--motion-y, 0), 0);
}

@media (prefers-reduced-motion: no-preference) {
    .process-grid.process-seven li.reveal-target > span {
        opacity: 0;
        transform: translateY(14px);
        transition:
            opacity 360ms cubic-bezier(.2, .8, .2, 1),
            transform 480ms cubic-bezier(.2, .8, .2, 1);
    }

    .process-grid.process-seven li.reveal-target.is-visible > span {
        opacity: 1;
        transform: translateY(0);
    }

    .process-grid.process-seven li:nth-child(2) > span { transition-delay: 70ms; }
    .process-grid.process-seven li:nth-child(3) > span { transition-delay: 140ms; }
    .process-grid.process-seven li:nth-child(4) > span { transition-delay: 210ms; }
    .process-grid.process-seven li:nth-child(5) > span { transition-delay: 280ms; }
    .process-grid.process-seven li:nth-child(6) > span { transition-delay: 350ms; }
    .process-grid.process-seven li:nth-child(7) > span { transition-delay: 420ms; }
}

@media (max-width: 620px) {
    .process-grid.process-seven li > span {
        font-size: 1.45rem;
        grid-row: 1 / span 2;
        margin: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hold-to-contact::before {
        transition: none;
    }
}
