/* ============================================================
   AGENTIC WEB · designare.at
   Layout, Bühnen-Grafik und Architektur-Diagramm.
   Alle Farben kommen aus den globalen Design-Tokens,
   damit Hell- und Dunkelmodus ohne Zweitdatei funktionieren.
   ============================================================ */

.agentic-summary-box {
    align-items: stretch;
}

.summary-image.agentic-summary-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    aspect-ratio: auto;
    overflow: hidden;
}

.summary-image.agentic-summary-visual > img {
    display: block;
    width: 100%;
    max-width: 560px;
    height: auto;
    aspect-ratio: 31 / 26;
    object-fit: contain;
}

.agentic-intro {
    max-width: 72ch;
}

/* ------------------------------------------------------------
   1 · Demo-Rahmen
   ------------------------------------------------------------ */

.agentic-demo {
    --agentic-line: var(--border-color);
    --agentic-soft-line: var(--border-color-subtle);
    --agentic-surface: var(--card-bg);
    --agentic-code-bg: #080a09;
    --agentic-human: #e1b757;
    --agentic-human-surface: rgba(225, 183, 87, 0.09);
    margin: 2rem 0 3rem;
    border: 1px solid var(--agentic-line);
    background: var(--agentic-surface);
    overflow: hidden;
}

body.light-mode .agentic-demo {
    --agentic-code-bg: #f1f1f1;
    --agentic-human: #8a6a1f;
    --agentic-human-surface: rgba(138, 106, 31, 0.1);
}

.agentic-demo-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.2rem 1.35rem;
    border-bottom: 1px solid var(--agentic-line);
}

.agentic-demo-head p {
    max-width: 68ch;
    margin: 0.35rem 0 0;
    color: var(--text-color-muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

.agentic-eyebrow,
.agentic-step-meta,
.agentic-facts dt,
.agentic-facts dd,
.agentic-levels > article > span,
.agentic-demo-controls p,
.agentic-stage-hint {
    font-family: var(--font-code);
    font-weight: var(--font-weight-code);
    letter-spacing: 0;
}

.agentic-eyebrow {
    color: var(--accent-color);
    font-size: 0.74rem;
    line-height: 1.4;
}

.agentic-play,
.agentic-demo-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 42px;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--accent-color);
    border-radius: 2px;
    background: transparent;
    color: var(--accent-color);
    font-family: var(--font-code);
    font-size: 0.78rem;
    font-weight: var(--font-weight-code);
    line-height: 1.3;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.agentic-play:hover,
.agentic-demo-controls button:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

.agentic-play:focus-visible,
.agentic-demo-controls button:focus-visible,
.agentic-rail button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
}

.agentic-play[aria-pressed="true"] {
    background: var(--accent-color);
    color: var(--bg-color);
}

/* ------------------------------------------------------------
   2 · Schrittleiste
   ------------------------------------------------------------ */

.agentic-rail {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    padding: 1.1rem 1.35rem 1.25rem;
    border-bottom: 1px solid var(--agentic-line);
    overflow-x: auto;
    scrollbar-width: thin;
}

.agentic-rail-line {
    position: absolute;
    top: 2rem;
    left: calc(10% + 1.35rem);
    right: calc(10% + 1.35rem);
    height: 1px;
    background: var(--agentic-line);
    pointer-events: none;
}

.agentic-rail-line > span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent-color);
    transition: width 0.35s ease;
}

.agentic-rail button {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    min-width: 104px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-color-subtle);
    font-family: var(--font-code);
    font-size: 0.72rem;
    line-height: 1.3;
    cursor: pointer;
}

.agentic-step-number {
    display: grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    border: 1px solid var(--agentic-line);
    border-radius: 50%;
    background: var(--agentic-surface);
    color: var(--text-color-muted);
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.agentic-rail button.is-complete .agentic-step-number {
    border-color: var(--success-color);
    color: var(--success-color);
}

.agentic-rail button[aria-selected="true"] {
    color: var(--text-color);
}

.agentic-rail button[aria-selected="true"] .agentic-step-number {
    border-color: var(--accent-color);
    background: var(--accent-surface);
    color: var(--accent-color);
}

/* ------------------------------------------------------------
   3 · Die Bühne: eine Grafik, fünf Zustände
   ------------------------------------------------------------ */

.agentic-stage {
    padding: 1.5rem 1.35rem 1.1rem;
    border-bottom: 1px solid var(--agentic-line);
    background: var(--agentic-code-bg);
}

.agentic-stage-scroll {
    overflow-x: auto;
    scrollbar-width: thin;
}

.agentic-stage-svg {
    display: block;
    width: 100%;
    height: auto;
}

.agentic-stage-svg text {
    font-family: var(--font-code);
    font-weight: var(--font-weight-code);
}

.agentic-stage-hint {
    display: none;
    margin: 0.9rem 0 0;
    color: var(--text-color-subtle);
    font-size: 0.7rem;
    line-height: 1.5;
}

/* Grundzustand aller beweglichen Teile */
.agentic-stage-svg [data-agentic-on] {
    opacity: 0.42;
    transition: opacity 0.3s ease;
}

.agentic-stage-svg [data-agentic-on].is-on {
    opacity: 1;
}

.agentic-stage-svg [data-agentic-on].agentic-stage-seg {
    opacity: 0.12;
}

.agentic-stage-svg [data-agentic-on].agentic-stage-seg.is-on {
    opacity: 1;
}

/* Wechselnde Beschriftungen liegen uebereinander und duerfen sich
   im inaktiven Zustand nicht gegenseitig ueberlagern. */
.agentic-stage-svg [data-agentic-on].agentic-stage-swap {
    opacity: 0;
}

.agentic-stage-zone {
    fill: none;
    stroke: var(--agentic-soft-line);
    stroke-width: 1;
    stroke-dasharray: 4 6;
}

.agentic-stage-zone-label,
.agentic-stage-sub {
    fill: var(--text-color-subtle);
    font-size: 11px;
    letter-spacing: 0.06em;
}

.agentic-stage-box {
    fill: var(--surface-light, var(--card-bg));
    stroke: var(--agentic-line);
    stroke-width: 1.5;
    transition: stroke 0.3s ease, fill 0.3s ease;
}

.agentic-stage-label {
    fill: var(--text-color-subtle);
    font-size: 13px;
    letter-spacing: 0.04em;
    transition: fill 0.3s ease;
}

.agentic-stage-mark {
    fill: none;
    stroke: var(--text-color-subtle);
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.3s ease;
}

.agentic-stage-wire {
    fill: none;
    stroke: var(--agentic-line);
    stroke-width: 1.5;
    transition: stroke 0.3s ease;
}

.agentic-stage-head {
    fill: var(--agentic-line);
    transition: fill 0.3s ease;
}

.agentic-stage-wire-label {
    fill: var(--text-color-subtle);
    font-size: 11px;
}

.is-on > .agentic-stage-box,
.is-on .agentic-stage-box {
    stroke: var(--accent-color);
    fill: var(--accent-surface);
}

.is-on .agentic-stage-label {
    fill: var(--text-color);
}

.is-on .agentic-stage-mark {
    stroke: var(--accent-color);
}

.is-on .agentic-stage-wire {
    stroke: var(--accent-color);
}

.is-on .agentic-stage-head {
    fill: var(--accent-color);
}

.is-on .agentic-stage-wire-label {
    fill: var(--accent-color);
}

.agentic-stage-flow {
    stroke-dasharray: 5 7;
    opacity: 0;
    animation: agentic-stage-dash 1.1s linear infinite;
}

.is-on .agentic-stage-flow {
    opacity: 1;
}

@keyframes agentic-stage-dash {
    to { stroke-dashoffset: -24; }
}

/* Freigabe-Schranke: das Bauteil, um das es im Artikel geht */
.agentic-stage-gate .agentic-stage-box {
    fill: var(--agentic-code-bg);
    stroke: var(--agentic-human);
    stroke-dasharray: 4 4;
}

.agentic-stage-gate.is-on .agentic-stage-box {
    fill: var(--agentic-human-surface);
    stroke: var(--agentic-human);
    stroke-dasharray: none;
}

.agentic-stage-gate .agentic-stage-mark {
    stroke: var(--agentic-human);
}

.agentic-stage-gate .agentic-stage-label {
    fill: var(--agentic-human);
}

.agentic-stage-gate.is-on .agentic-stage-wire,
.agentic-stage-return.is-on .agentic-stage-wire {
    stroke: var(--agentic-human);
}

.agentic-stage-return.is-on .agentic-stage-head {
    fill: var(--agentic-human);
}

/* ------------------------------------------------------------
   4 · Schritt-Panels
   ------------------------------------------------------------ */

.agentic-step-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.agentic-web-enhanced .agentic-step-panel:not(.is-active) {
    display: none;
}

.agentic-step-copy,
.agentic-tech-view {
    min-width: 0;
    padding: clamp(1.25rem, 3vw, 2rem);
}

.agentic-step-copy {
    border-right: 1px solid var(--agentic-line);
}

.agentic-step-copy h3 {
    margin: 1rem 0 1.1rem;
    color: var(--text-color);
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    line-height: 1.25;
}

.agentic-step-copy p {
    margin: 0 0 1rem;
    color: var(--text-color-muted);
    font-size: 0.98rem;
    line-height: 1.65;
}

.agentic-step-copy p a {
    color: var(--accent-color);
}

.agentic-step-copy .agentic-plain {
    padding-left: 1rem;
    border-left: 2px solid var(--accent-color);
    color: var(--text-color);
}

.agentic-step-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text-color-subtle);
    font-size: 0.7rem;
    line-height: 1.4;
    text-transform: uppercase;
}

.agentic-step-meta strong {
    font: inherit;
    text-transform: uppercase;
}

.agentic-step-meta .is-live {
    color: var(--success-color);
}

.agentic-step-meta .is-agent {
    color: var(--accent-color);
}

.agentic-step-meta .is-human {
    color: var(--agentic-human);
}

.agentic-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 1.6rem 0 0;
    border-top: 1px solid var(--agentic-soft-line);
    border-bottom: 1px solid var(--agentic-soft-line);
}

.agentic-facts > div {
    min-width: 0;
    padding: 0.75rem 0.6rem;
    border-right: 1px solid var(--agentic-soft-line);
}

.agentic-facts > div:first-child {
    padding-left: 0;
}

.agentic-facts > div:last-child {
    padding-right: 0;
    border-right: 0;
}

.agentic-facts dt {
    margin: 0 0 0.25rem;
    color: var(--text-color-subtle);
    font-size: 0.64rem;
    line-height: 1.35;
    text-transform: uppercase;
}

.agentic-facts dd {
    margin: 0;
    overflow: hidden;
    color: var(--text-color);
    font-size: 0.72rem;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agentic-tech-view {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    background: var(--agentic-code-bg);
}

.agentic-tech-label {
    margin: 0;
    color: var(--text-color-subtle);
    font-family: var(--font-code);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.agentic-tech-view pre {
    margin: 0;
    padding: 1rem;
    overflow: auto;
    border: 1px solid var(--agentic-soft-line);
    background: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-code);
    font-size: 0.75rem;
    font-weight: var(--font-weight-code);
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.agentic-code-muted {
    color: var(--text-color-subtle);
}

.agentic-code-key {
    color: var(--accent-color);
}

.agentic-code-value {
    color: var(--success-color);
}

.agentic-demo-controls {
    display: grid;
    grid-template-columns: minmax(110px, auto) 1fr minmax(110px, auto);
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.35rem;
    border-top: 1px solid var(--agentic-line);
}

.agentic-demo-controls p {
    margin: 0;
    color: var(--text-color-subtle);
    font-size: 0.72rem;
    text-align: center;
}

.agentic-demo-controls button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.agentic-demo-controls button:disabled:hover {
    background: transparent;
    color: var(--accent-color);
}

/* ------------------------------------------------------------
   5 · Stufenmodell
   ------------------------------------------------------------ */

.agentic-levels {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 2rem 0 3rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.agentic-levels > article {
    min-width: 0;
    padding: 1.35rem;
    border-right: 1px solid var(--border-color);
}

.agentic-levels > article:last-child {
    border-right: 0;
}

.agentic-levels > article > span {
    display: block;
    margin: 0 0 0.8rem;
    color: var(--accent-color);
    font-size: 0.68rem;
}

.agentic-levels h3 {
    margin: 0 0 0.75rem;
    color: var(--text-color);
    font-size: 1.05rem;
    line-height: 1.35;
}

.agentic-levels p {
    margin: 0;
    color: var(--text-color-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

/* ------------------------------------------------------------
   6 · Architektur-Diagramm (inline, damit Tokens greifen)
   ------------------------------------------------------------ */

.agentic-architecture {
    --agentic-human: #e1b757;
    --agentic-human-surface: rgba(225, 183, 87, 0.09);
}

body.light-mode .agentic-architecture {
    --agentic-human: #8a6a1f;
    --agentic-human-surface: rgba(138, 106, 31, 0.1);
}

.agentic-arch-svg {
    display: block;
    width: 100%;
    height: auto;
}

.agentic-arch-svg text {
    font-family: var(--font-code);
    font-weight: var(--font-weight-code);
}

.agentic-arch-svg text.agentic-arch-headline {
    font-family: inherit;
    font-size: 32px;
    font-weight: 700;
    fill: var(--text-color);
}

.agentic-arch-eyebrow {
    fill: var(--accent-color);
    font-size: 14px;
    letter-spacing: 0.08em;
}

.agentic-arch-rule {
    stroke: var(--border-color-subtle);
    stroke-width: 1;
}

.agentic-arch-zone {
    fill: none;
    stroke: var(--border-color-subtle);
    stroke-width: 1.5;
    stroke-dasharray: 4 6;
}

.agentic-arch-zone-label {
    fill: var(--text-color-subtle);
    font-size: 12px;
    letter-spacing: 0.08em;
}

.agentic-arch-box {
    fill: var(--surface-light, var(--card-bg));
    stroke: var(--border-color);
    stroke-width: 1.5;
}

.agentic-arch-box-key {
    fill: var(--accent-surface);
    stroke: var(--accent-color);
    stroke-width: 1.5;
}

.agentic-arch-title {
    fill: var(--text-color);
    font-size: 17px;
    letter-spacing: 0.02em;
}

.agentic-arch-small {
    fill: var(--text-color-subtle);
    font-size: 12px;
}

.agentic-arch-mark {
    fill: none;
    stroke: var(--text-color-muted);
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.agentic-arch-mark-key {
    stroke: var(--accent-color);
}

.agentic-arch-wire {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 1.5;
}

.agentic-arch-head {
    fill: var(--accent-color);
}

.agentic-arch-wire-back {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 1.5;
    stroke-dasharray: 5 5;
}

.agentic-arch-head-back {
    fill: var(--border-color);
}

.agentic-arch-human {
    fill: var(--agentic-human-surface);
    stroke: var(--agentic-human);
    stroke-width: 1.5;
}

.agentic-arch-human-label {
    fill: var(--agentic-human);
    font-size: 13px;
    letter-spacing: 0.06em;
}

.agentic-arch-mark-human {
    fill: none;
    stroke: var(--agentic-human);
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.agentic-arch-wire-human {
    fill: none;
    stroke: var(--agentic-human);
    stroke-width: 1.5;
}

.agentic-arch-head-human {
    fill: var(--agentic-human);
}

/* ------------------------------------------------------------
   7 · Status-Raster
   ------------------------------------------------------------ */

.agentic-reality-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 2rem 0 3rem;
    border: 1px solid var(--border-color);
}

.agentic-reality-grid > div {
    min-width: 0;
    padding: clamp(1.25rem, 3vw, 1.75rem);
}

.agentic-reality-grid > div + div {
    border-left: 1px solid var(--border-color);
}

.agentic-reality-grid h3 {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0 0 1rem;
    color: var(--text-color);
    font-size: 1.1rem;
}

.agentic-reality-grid ul {
    margin: 0;
}

.agentic-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    flex: 0 0 0.5rem;
    border-radius: 50%;
    background: var(--success-color);
}

.agentic-status-dot.is-guarded {
    background: var(--accent-color);
}

/* ------------------------------------------------------------
   8 · Breakpoints
   ------------------------------------------------------------ */

@media (max-width: 960px) {
    .agentic-step-panel {
        grid-template-columns: 1fr;
    }

    .agentic-step-copy {
        border-right: 0;
        border-bottom: 1px solid var(--agentic-line);
    }

    .agentic-levels {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .agentic-levels > article:nth-child(2) {
        border-right: 0;
    }

    .agentic-levels > article:nth-child(-n + 2) {
        border-bottom: 1px solid var(--border-color);
    }
}

@media (max-width: 768px) {
    .agentic-summary-visual {
        width: 100%;
    }

    .agentic-demo-head {
        align-items: stretch;
        flex-direction: column;
    }

    .agentic-play {
        align-self: flex-start;
    }

    .agentic-rail {
        justify-content: start;
        grid-template-columns: repeat(5, 92px);
        padding-inline: 1rem;
        scrollbar-width: none;
    }

    .agentic-rail::-webkit-scrollbar {
        display: none;
    }

    .agentic-rail-line {
        left: 47px;
        right: auto;
        width: 368px;
    }

    /* Die Bühne bleibt lesbar und wird seitlich scrollbar,
       statt auf unlesbare Schriftgrößen zusammenzuschrumpfen. */
    .agentic-stage {
        padding: 1.1rem 1rem 1rem;
    }

    .agentic-stage-svg {
        min-width: 640px;
    }

    .agentic-stage-hint {
        display: block;
    }

    .agentic-arch-svg {
        min-width: 720px;
    }

    .agentic-architecture .article-diagram__viewport {
        overflow-x: auto;
    }

    .agentic-step-copy,
    .agentic-tech-view {
        padding: 1.1rem;
    }

    .agentic-facts {
        grid-template-columns: 1fr;
    }

    .agentic-facts > div,
    .agentic-facts > div:first-child,
    .agentic-facts > div:last-child {
        display: grid;
        grid-template-columns: minmax(90px, 0.45fr) 1fr;
        align-items: baseline;
        padding: 0.6rem 0;
        border-right: 0;
        border-bottom: 1px solid var(--agentic-soft-line);
    }

    .agentic-facts > div:last-child {
        border-bottom: 0;
    }

    .agentic-facts dt,
    .agentic-facts dd {
        margin: 0;
    }

    .agentic-levels,
    .agentic-reality-grid {
        grid-template-columns: 1fr;
    }

    .agentic-levels > article,
    .agentic-levels > article:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .agentic-levels > article:last-child {
        border-bottom: 0;
    }

    .agentic-reality-grid > div + div {
        border-left: 0;
        border-top: 1px solid var(--border-color);
    }
}

@media (max-width: 480px) {
    .agentic-demo {
        margin-inline: -0.25rem;
    }

    .agentic-demo-head {
        padding: 1rem;
    }

    .agentic-step-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.35rem;
    }

    .agentic-demo-controls {
        grid-template-columns: 1fr 1fr;
        padding-inline: 1rem;
    }

    .agentic-demo-controls p {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .agentic-demo-controls button {
        width: 100%;
    }

    .agentic-tech-view pre {
        font-size: 0.7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .agentic-rail-line > span,
    .agentic-play,
    .agentic-demo-controls button,
    .agentic-step-number,
    .agentic-stage-svg [data-agentic-on],
    .agentic-stage-box,
    .agentic-stage-mark,
    .agentic-stage-wire,
    .agentic-stage-head {
        transition: none;
    }

    .agentic-stage-flow {
        animation: none;
    }

    .is-on .agentic-stage-flow {
        opacity: 0.85;
    }
}
