/*
 * timeline.css — what happened, in order: the history of an order.
 *
 * <ol class="app-timeline" role="list">
 *   <li class="app-timeline-item" data-tone="neutral | info | success | warning | danger | accent">
 *     <span class="app-timeline-marker" aria-hidden="true">[icon]</span>
 *     <div class="app-timeline-content">
 *       <p class="app-timeline-title">Status: In Arbeit</p>
 *       <p class="app-timeline-meta"><time datetime="2026-11-18T08:04">18.11., 08:04</time> · Jonas Leitner</p>
 *       <div class="app-timeline-body">[text, attachments]</div>
 *     </div>
 *   </li>
 * </ol>
 *
 * Newest first or oldest first is the screen's. A line joins the markers; the last item has
 * none. Title and meta are 20 + 4 + 16 = 40; a body adds 4 and its lines.
 */
@layer components {
    .app-timeline {
        display: flex;
        flex-direction: column;
        gap: var(--app-space-timeline);
    }

    .app-timeline-item {
        position: relative;
        display: grid;
        grid-template-columns: var(--app-marker-size) minmax(0, 1fr);
        gap: var(--app-space-choice);
    }

    .app-timeline-item:not(:last-child)::before {
        content: "";
        position: absolute;
        inset-block: var(--app-marker-size) calc(-1 * var(--app-space-timeline));
        inset-inline-start: calc((var(--app-marker-size) - var(--app-border-width-strong)) / 2);
        inline-size: var(--app-border-width-strong);
        background: var(--app-color-line);
    }

    .app-timeline-marker {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        inline-size: var(--app-marker-size);
        block-size: var(--app-marker-size);
        border-radius: var(--app-radius-round);
        background: var(--app-color-surface-muted);
        color: var(--app-color-text-muted);
    }

    .app-timeline-item[data-tone="accent"] .app-timeline-marker {
        background: var(--app-color-accent-soft);
        color: var(--app-color-accent-text);
    }

    .app-timeline-item[data-tone="info"] .app-timeline-marker {
        background: var(--app-color-info-soft);
        color: var(--app-color-info-text);
    }

    .app-timeline-item[data-tone="success"] .app-timeline-marker {
        background: var(--app-color-success-soft);
        color: var(--app-color-success-text);
    }

    .app-timeline-item[data-tone="warning"] .app-timeline-marker {
        background: var(--app-color-warning-soft);
        color: var(--app-color-warning-text);
    }

    .app-timeline-item[data-tone="danger"] .app-timeline-marker {
        background: var(--app-color-danger-soft);
        color: var(--app-color-danger-text);
    }

    .app-timeline-content {
        display: flex;
        flex-direction: column;
        gap: var(--app-space-timeline-text);
        min-inline-size: 0;
    }

    .app-timeline-title {
        color: var(--app-color-text);
        font-size: var(--app-text-body-size);
        font-weight: var(--app-text-strong-weight);
        line-height: var(--app-text-body-leading);
    }

    .app-timeline-meta {
        color: var(--app-color-text-subtle);
        font-size: var(--app-text-help-size);
        line-height: var(--app-text-help-leading);
    }

    .app-timeline-body {
        color: var(--app-color-text-muted);
        font-size: var(--app-text-body-size);
        line-height: var(--app-text-body-leading);
        overflow-wrap: anywhere;
        hyphens: auto;
    }

    .app-timeline-body:empty {
        display: none;
    }
}
