/* ==========================================================================
   The thread — "0 layers between you and the developer"
   One continuous line runs the whole page, from the first screen to the
   contact form. Every section hangs directly off it. It fills as you read.
   (Layered on top of apple.css: same tokens, header, springs, press feedback.)
   ========================================================================== */

:root {
    --tx: clamp(14px, 3.4vw, 52px);           /* thread centre x */
    --tw: clamp(5px, 0.6vw, 8px);             /* thread thickness */
    --lx: calc(var(--tx) + clamp(28px, 3.6vw, 60px));  /* where content starts */
    --node: clamp(18px, 1.6vw, 26px);
    --rx: var(--gutter);
    --panel-r: clamp(22px, 2.4vw, 36px);
}

body {
    position: relative;
    background: var(--paper);
}

html { background: var(--paper); }

/* --- The line ------------------------------------------------------------- */

.thread {
    position: absolute;
    z-index: 1;
    top: 0;
    bottom: 0;
    left: calc(var(--tx) - var(--tw) / 2);
    width: var(--tw);
    background: var(--mint-2);
    pointer-events: none;
}

.thread-fill {
    position: absolute;
    inset: 0;
    background: var(--ink);
    transform-origin: top;
    transform: scaleY(var(--p, 0));
}

/* end cap: the line arrives at the footer address */
.thread::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: calc(var(--node) * 1.7);
    height: calc(var(--node) * 1.7);
    transform: translate(-50%, 0);
    background: var(--mint-2);
    transition: background-color 0.4s ease;
}

.thread.is-done::after { background: var(--ink); }

/* --- Everything hangs off the line ---------------------------------------- */

.hero,
:root main > section,
.foot,
.subpage-sec {
    position: relative;
    margin-left: var(--lx);
    margin-right: var(--rx);
}

.hero::before,
main > section::before {
    content: "";
    position: absolute;
    z-index: 2;
    top: clamp(30px, 5vw, 64px);
    left: calc(var(--tx) - var(--lx) - var(--node) / 2);
    width: var(--node);
    height: var(--node);
    background: var(--paper);
    box-shadow: 0 0 0 clamp(3px, 0.4vw, 5px) var(--mint-2) inset;
    transform: scale(0.8);
    transition: transform 0.6s var(--spring), background-color 0.3s ease, box-shadow 0.3s ease;
}

/* stub from the line to the section */
.hero::after,
main > section::after {
    content: "";
    position: absolute;
    z-index: 1;
    top: calc(clamp(30px, 5vw, 64px) + var(--node) / 2 - var(--tw) / 2);
    left: calc(var(--tx) - var(--lx));
    width: calc(var(--lx) - var(--tx) - 2px);
    height: var(--tw);
    background: var(--mint-2);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.7s var(--spring), background-color 0.3s ease;
}

.reached::before {
    background: var(--ink);
    box-shadow: 0 0 0 0 var(--ink) inset;
    transform: scale(1);
}

.reached::after {
    background: var(--ink);
    transform: scaleX(1);
}

/* the hero's node is on from the start */
.hero::before { background: var(--ink); box-shadow: none; transform: scale(1); }
.hero::after { background: var(--ink); transform: scaleX(1); }

/* panels hang from the line instead of floating as tiles */
.hero,
.work-sec,
.mq,
.sketch-sec {
    border-radius: var(--panel-r);
}

.hero,
.work-sec,
.mq,
.sketch-sec,
.intro,
.name,
.build,
.how,
.faq {
    margin-top: var(--sec);
    margin-bottom: var(--sec);
}

.hero { margin-top: clamp(10px, 1.4vw, 20px); }

/* open sections live on the paper, between the line and the right edge */
.intro,
.name {
    background: none;
    padding: clamp(72px, 10vw, 150px) 0 clamp(40px, 6vw, 90px);
}

.intro { display: block; }
.intro-text { max-width: 70rem; }
.intro-title { font-size: clamp(54px, 9.6vw, 168px); }
.stairs { max-width: 26ch; }
.step.s2 { color: var(--ink); }

.name { padding-top: clamp(40px, 6vw, 90px); }
.name-title { font-size: clamp(36px, 5vw, 76px); }

.build,
.how,
.faq {
    max-width: none;
    padding-inline: 0;
}

.build { padding-block: clamp(48px, 7vw, 112px) 0; }
.build-head { max-width: none; padding-inline: 0; }
.build-list { max-width: none; }

.how { padding-block: clamp(64px, 9vw, 140px); }
.stages { max-width: none; }

.faq { padding-block: clamp(40px, 6vw, 96px); }

/* subpages */
.subpage-sec { max-width: 62rem; padding-inline: 0; margin-right: auto; }

/* footer: the line ends in the address */
.foot { max-width: none; padding-inline: 0; margin-right: var(--rx); }
.foot-top { grid-template-columns: auto 1fr 1fr auto; }

/* --- Hero: statement + the live chain -------------------------------------- */

.hero {
    --hs: clamp(60px, 12vw, 190px);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
        "title title"
        "lede  chain";
    align-content: space-between;
    min-height: min(calc(100svh - 96px), 960px);
    gap: clamp(32px, 6vh, 72px) clamp(24px, 5vw, 80px);
    background: var(--mint);
}

.hero-title {
    letter-spacing: -0.055em;
    line-height: 0.9;
}

.l2 .line-in {
    background: none;
    color: var(--ink);
}

.hero-foot { max-width: 34rem; }

.chain {
    grid-area: chain;
    align-self: end;
    display: grid;
    gap: 22px;
    min-width: 0;
}

.js .chain:not(.ready) { opacity: 0; }

.chain-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px 24px;
}

.chain-count {
    display: flex;
    align-items: baseline;
    gap: 14px;
}

.chain-count output {
    display: block;
    min-width: 0.65em;
    font-size: clamp(72px, 8vw, 128px);
    letter-spacing: -0.06em;
    line-height: 0.82;
    color: var(--ink);
}

.chain-count span {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
}

.chain-toggle {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 4px;
    border-radius: 999px;
    background: rgb(0 50 65 / 0.1);
}

.chain-toggle::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    border-radius: 999px;
    background: var(--ink);
    transition: transform var(--t-base) var(--spring);
}

.chain[data-mode="nyv"] .chain-toggle::before { transform: translateX(100%); }

.chain-toggle button {
    min-width: 96px;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.25s ease, transform var(--t-base) var(--spring);
    -webkit-tap-highlight-color: transparent;
}

.chain-toggle button:active { transform: scale(0.96); transition-duration: var(--t-fast); }
.chain-toggle button[aria-pressed="true"] { color: var(--mint); }

.chain-row {
    display: flex;
    align-items: flex-start;
}

.cn {
    position: relative;
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
    flex: 1 1 0;
    overflow: hidden;
    transition: flex-grow 0.7s var(--spring), opacity 0.35s ease, max-height 0.7s var(--spring);
}

.cn-end { overflow: visible; }
.cn-dev { flex: 0 0 auto; }

/* the bar that leads to the next node */
.cn:not(:last-child)::before {
    content: "";
    position: absolute;
    top: calc(var(--node) / 2 - var(--tw) / 2);
    left: calc(var(--node) / 2);
    right: 0;
    height: var(--tw);
    background: var(--ink);
}

.cn-dot {
    position: relative;
    z-index: 1;
    display: block;
    width: var(--node);
    height: var(--node);
    background: var(--ink);
}

.cn-layer .cn-dot { background: var(--mint-2); box-shadow: 0 0 0 clamp(3px, 0.4vw, 5px) var(--ink) inset; }

.cn-label {
    font-size: clamp(14px, 1.15vw, 17px);
    font-weight: 600;
    line-height: 1.2;
    padding-right: 10px;
}

.cn-layer .cn-label { color: color-mix(in oklab, var(--ink) 78%, transparent); }

/* nyv mode: the layers are gone, the line runs straight through */
.chain[data-mode="nyv"] .cn-layer {
    flex-grow: 0.0001;
    opacity: 0;
    pointer-events: none;
}

.chain.no-anim .cn,
.chain.no-anim .chain-toggle::before { transition: none; }

/* --- Panels: work, marquee, contact --------------------------------------- */

.work-sec { padding: clamp(28px, 5vw, 72px); }
.sketch-sec { overflow: hidden; }
.mq { margin-block: var(--sec); }

/* --- Responsive ------------------------------------------------------------ */

@media (max-width: 960px) {
    .hero {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "title"
            "chain"
            "lede";
        min-height: 0;
    }

    .foot-top { grid-template-columns: 1fr auto; }
    .foot-top p { grid-column: 1 / -1; order: 5; }
}

@media (max-width: 760px) {
    :root {
        --tx: 15px;
        --lx: 40px;
        --rx: 10px;
        --node: 17px;
        --tw: 5px;
    }

    .hero { --hs: min(16.4vw, 80px); padding: 26px 18px 22px; }

    /* vertical chain: the same line, turned to stand like the page thread */
    .chain-row { flex-direction: column; }

    .cn {
        flex: 0 0 auto;
        width: 100%;
        max-height: 80px;
        padding-bottom: 14px;
    }

    .cn:not(:last-child)::before {
        top: calc(var(--node) / 2);
        left: calc(var(--node) / 2 - var(--tw) / 2);
        right: auto;
        width: var(--tw);
        height: auto;
        bottom: calc(var(--node) * -0.5);
    }

    .cn { grid-template-columns: var(--node) 1fr; align-items: center; column-gap: 14px; gap: 0 14px; }
    .cn-label { padding-right: 0; font-size: 17px; }

    .chain[data-mode="nyv"] .cn-layer { max-height: 0; padding-bottom: 0; flex-grow: 0; }

    .chain-count output { font-size: 84px; }
    .chain-toggle button { min-width: 84px; }
}

@media (prefers-reduced-motion: reduce) {
    .thread-fill { transform: scaleY(var(--p, 0)); }
    .cn,
    .chain-toggle::before,
    .hero::before,
    .hero::after,
    main > section::before,
    main > section::after { transition: none !important; }
}

/* nodes and stubs sit outside the panel edge, so panels must not clip them */
.hero,
.mq,
.sketch-sec { overflow: visible; }

.mq-row { border-radius: 0; }
.mq { padding-inline: 0; }

@media (max-width: 760px) {
    .bar-lang a { min-width: 38px; }
    .bar-cta { padding: 0 12px; gap: 8px; }
}

/* --- Make it obvious: "Agentur" is crossed out, every layer is struck, then gone --- */

.chain-toggle button[data-chain-set="agency"] { position: relative; }

.chain-toggle button[data-chain-set="agency"]::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    top: 50%;
    height: 3px;
    margin-top: -1px;
    background: var(--ink);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s var(--spring) 0.1s, background-color 0.25s ease;
}

.chain[data-mode="nyv"] .chain-toggle button[data-chain-set="agency"]::after { transform: scaleX(1); }
.chain[data-mode="nyv"] .chain-toggle button[data-chain-set="agency"] { opacity: 0.7; }
.chain-toggle button[data-chain-set="agency"][aria-pressed="true"]::after { background: var(--mint); }

.chain-verdict {
    display: grid;
    font-size: clamp(17px, 1.35vw, 20px);
    font-weight: 600;
    line-height: 1.3;
}

.chain-verdict span {
    grid-area: 1 / 1;
    transition: opacity 0.3s ease, transform var(--t-base) var(--spring);
}

.chain[data-mode="agency"] .chain-verdict [data-v="nyv"],
.chain[data-mode="nyv"] .chain-verdict [data-v="agency"] {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
}

/* strike each layer label, one after the other, then collapse the layers */
.cn-layer .cn-label { position: relative; align-self: start; width: fit-content; }

.cn-layer .cn-label::after {
    content: "";
    position: absolute;
    left: 0;
    right: 6px;
    top: 52%;
    height: 3px;
    background: var(--ink);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s var(--spring);
}

.chain[data-mode="nyv"] .cn-layer .cn-label::after { transform: scaleX(1); }
.chain[data-mode="nyv"] .cn-layer:nth-child(2) .cn-label::after { transition-delay: 0s; }
.chain[data-mode="nyv"] .cn-layer:nth-child(3) .cn-label::after { transition-delay: 0.14s; }
.chain[data-mode="nyv"] .cn-layer:nth-child(4) .cn-label::after { transition-delay: 0.28s; }

.chain[data-mode="nyv"] .cn-layer {
    transition-delay: 0.75s, 0.75s, 0.75s;
}

.chain[data-mode="nyv"] .cn-layer .cn-dot {
    background: var(--ink);
}

.chain.no-anim .cn-layer,
.chain.no-anim .cn-label::after,
.chain.no-anim .chain-toggle button::after { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
    .chain[data-mode="nyv"] .cn-layer { transition-delay: 0s; }
}

/* --- Mobile polish ---------------------------------------------------------- */
@media (max-width: 760px) {
    .work-sec { padding: 22px 12px 14px; }
    .work-head { gap: 18px; margin-bottom: 22px; padding-inline: 6px; }
    .work-title { font-size: clamp(38px, 11vw, 52px); }

    .work-filters { display: grid; grid-template-columns: repeat(3, auto); width: 100%; justify-content: stretch; }
    .wf-btn { padding: 0 8px; font-size: 15px; white-space: nowrap; }

    .wc-top { flex-wrap: wrap; gap: 6px 12px; padding: 16px 16px 12px; }
    .wc-meta { flex: 1 1 0; min-width: 0; font-size: 14px; }
    .wc-badge { margin-left: 0; font-size: 12px; }
    .wc-stage { margin: 0 8px; }
    .wc-body { padding: 18px 16px 18px; }
    .wc-foot { flex-direction: column; align-items: stretch; }
    .wc-action { justify-content: center; }

    .svc { padding: 20px 14px 22px; gap: 20px; }
    .svc-icon { width: 48px; padding: 10px; border-radius: 14px; }
    .ui-op-row,
    .ui-pipe-step { flex-wrap: wrap; row-gap: 8px; padding: 12px; }
    .ui-op-main,
    .ui-pipe-info { flex: 1 1 140px; }
    .ui-bar { padding: 12px 14px; }
    .ui-body { padding: 12px; }
    .ui-foot { flex-wrap: wrap; padding: 12px 14px; }

    .intro { padding-top: 56px; }
    .intro-title { font-size: clamp(46px, 14.5vw, 72px); }
    .stairs { font-size: 21px; }

    .name-grid .name-logo { height: 96px; }
    .name-keys { gap: 8px; }

    .how { padding-block: 56px; }
    .stage { grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 16px 0; }
    .stage-line { font-size: clamp(26px, 8vw, 36px); }
    .st4 { padding-inline: 14px; }

    .faq { padding-block: 40px; }
    summary { padding: 16px 16px; min-height: 68px; }
    .a { padding: 0 16px 20px; }

    .werkblatt { padding: 26px 16px 20px; gap: 24px; }
    .wb-title { font-size: clamp(40px, 12vw, 56px); }
    .wb-right { padding: 14px; }

    .foot-mail { font-size: clamp(48px, 17vw, 84px); }
    .foot { padding-top: 40px; }
}

/* process: icon stays a square, no counter fighting the headline */
.stage::before { content: none; }
.stage-icon { align-self: start; aspect-ratio: 1; height: auto; }

@media (max-width: 760px) {
    .stage { background: none; box-shadow: none; }
    .st4 { background: var(--ink); }
    .stage-icon { width: 44px; padding: 9px; }
}

/* --- Narrow phones: nothing may run past the edge ---------------------------- */
.wc-title,
.wc-title a,
.svc-title,
.q { overflow-wrap: anywhere; }

.wc-title a { max-width: 100%; }

@media (max-width: 960px) {
    /* nav row: four links spread across the width instead of scrolling off-screen */
    .bar-links {
        justify-content: space-between;
        overflow: visible;
        gap: 0;
        margin: 0 -4px;
    }

    .bar-links a { padding: 10px 6px; font-size: 15px; }
}

@media (max-width: 420px) {
    .bar { padding: 6px 6px 6px 14px; gap: 0 6px; }
    .bar-mark { width: 48px; }
    .bar-lang a { min-width: 34px; font-size: 12px; }
    .bar-cta { padding: 0 11px; gap: 7px; font-size: 13px; min-height: 40px; }
    .bar-cta-arrow { display: none; }
    .bar-links a { font-size: 14px; padding: 10px 4px; }

    .hero { padding: 24px 16px 20px; }
    .chain-toggle button { min-width: 78px; padding: 0 12px; font-size: 15px; }
    .chain-count output { font-size: 72px; }
    .chain-count span { font-size: 16px; }
    .work-sec { padding-inline: 10px; }
    .wf-btn { font-size: 14px; padding: 0 4px; }
}

.wc-meta,
.wc-text,
.cn-label,
.stage-text { overflow-wrap: anywhere; }

/* --- No sideways pan, ever (iOS Safari ignores overflow-x: clip on body) ------- */
html {
    overflow-x: hidden;
    overscroll-behavior-x: none;
}

/* things that are fixed-width by nature must shrink to their box */
.wb-turnstile,
.wb-turnstile > div,
.wb-turnstile iframe,
.cf-turnstile { max-width: 100%; }

.wb-left,
.wb-right,
.werkblatt > * { min-width: 0; }

.foot-mail { font-size: clamp(44px, 15vw, 84px); max-width: 100%; }

@media (min-width: 761px) {
    .foot-mail { font-size: clamp(56px, 13vw, 210px); }
}

/* long words and the marquee never push the page wider */
.mq,
.mq-row { max-width: 100%; }
.mq-row { overflow: hidden; }
