/* =========================================================
   COLLISION — Notizen (notizen/, notizen/*/)
   Loaded after pages.css. Article column + the speed-test duel.
   .duel.is-busy   a measurement is running (js/leitungsduell.js)
   ========================================================= */

:root {
    --paper-text: rgba(237, 231, 220, 0.82);
    --mono: ui-monospace, 'Cascadia Mono', Consolas, 'SF Mono', Menlo, monospace;
}

/* Article column; .wide children break out of it */
.note {
    display: grid;
    grid-template-columns: minmax(var(--gutter), 1fr) minmax(0, 44rem) minmax(var(--gutter), 1fr);
    padding: calc(var(--bar-h) + clamp(3rem, 8vw, 6rem)) 0 clamp(4rem, 10vw, 7rem);
}

.note > * {
    grid-column: 2;
}

.note > .wide {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(64rem, 100% - 2 * var(--gutter));
}

.note__head {
    margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.note__head h1 {
    margin: 1.5rem 0 1.75rem;
    font-size: clamp(2.8rem, 8vw, 5.6rem);
}

.note__head > * {
    animation: rise 1s var(--ease-out) backwards;
}

.note__head > :nth-child(1) { animation-delay: 0.3s; }
.note__head > :nth-child(2) { animation-delay: 0.42s; }
.note__head > :nth-child(3) { animation-delay: 0.54s; }

.note p,
.note li {
    color: var(--paper-text);
}

.note > p + p,
.note > p + .note-code__label {
    margin-top: 1.25rem;
}

.note strong {
    font-weight: 500;
    color: var(--paper);
}

.note a {
    color: var(--paper);
    text-decoration-color: var(--touch);
    text-underline-offset: 3px;
    transition: color 0.3s;
}

.note a:hover {
    color: var(--touch);
}

.note > h2 {
    margin: clamp(4rem, 9vw, 6rem) 0 1.75rem;
    padding-top: clamp(2.5rem, 5vw, 3.5rem);
    border-top: 1px solid var(--paper-line);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.note > h2 .label {
    display: flex;
    margin-bottom: 1.25rem;
    letter-spacing: 0.16em;
}

.note code {
    font-family: var(--mono);
    font-size: 0.9em;
}

.note-code__label {
    margin-top: 1.75rem;
    font: 500 0.72rem/1 var(--font-ui);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--paper-soft);
}

.note .note-code__label + .note-code {
    margin-top: 0.6rem;
}

.note-code {
    margin-bottom: 0.5rem;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    border: 1px solid var(--paper-line);
    border-radius: 12px;
    background-color: rgba(237, 231, 220, 0.04);
    font-size: 0.92rem;
    line-height: 1.5;
}

.note-code + p {
    margin-top: 1.5rem;
}

/* Result table in the story */
.note-table {
    margin: 2.25rem 0;
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.note-table th,
.note-table td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid var(--paper-line);
    text-align: left;
    font-weight: 400;
}

.note-table th:first-child {
    padding-left: 0;
}

.note-table thead th {
    font: 500 0.72rem/1.2 var(--font-ui);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--paper-soft);
}

.note-table tbody th {
    color: var(--paper-soft);
}

.note-table td {
    font-size: clamp(1rem, 2.4vw, 1.15rem);
    white-space: nowrap;
}

.note-list {
    list-style: none;
    display: grid;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.note-list li {
    position: relative;
    padding-left: 1.75rem;
}

.note-list li::before {
    content: "";
    position: absolute;
    top: 0.62em;
    left: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--touch);
    box-shadow: 0 0 12px var(--touch-glow);
}

/* ---------- Duel: the speed test ---------- */

.duel {
    margin: clamp(3.5rem, 8vw, 5.5rem) 0 0;
    padding: clamp(2.5rem, 5vw, 4rem) clamp(1.25rem, 4vw, 3.5rem);
    border: 1px solid var(--paper-line);
    border-radius: 28px;
    background-color: rgba(237, 231, 220, 0.025);
}

.duel__head {
    display: grid;
    justify-items: start;
    gap: 1.25rem;
    max-width: 44rem;
}

.duel__head h2 {
    font-size: clamp(1.9rem, 4.2vw, 3rem);
}

.duel__stage {
    width: 100%;
    max-width: 720px;
    height: auto;
    margin: clamp(1.5rem, 4vw, 2.5rem) auto;
    overflow: visible;
}

.duel__ring {
    fill: none;
    stroke: var(--paper);
    stroke-width: 1.6;
    transition: stroke 0.6s var(--ease-out), opacity 0.6s;
}

.duel__ring.is-measuring {
    stroke: var(--touch);
    filter: drop-shadow(0 0 8px var(--touch-glow));
}

.duel__ring.is-winner {
    stroke: var(--touch);
}

.duel__lens {
    fill: var(--touch);
    filter: drop-shadow(0 0 18px var(--touch-glow));
    transition: opacity 0.4s;
}

.duel__wave {
    fill: none;
    stroke: var(--touch);
    stroke-width: 1;
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
}

.duel__wave.is-on {
    animation: wave 1.3s var(--ease-out) both;
}

.duel__tag {
    fill: var(--paper-soft);
    font: 500 12px var(--font-ui);
    letter-spacing: 0.16em;
    text-anchor: middle;
}

.duel__slots {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1rem, 2.5vw, 1.75rem);
}

.slot {
    display: grid;
    align-content: start;
    gap: 1.25rem;
    padding: clamp(1.4rem, 3vw, 2rem);
    border: 1px solid var(--paper-line);
    border-radius: 20px;
    background-color: var(--ground);
}

.slot__kicker {
    font: 500 0.72rem/1 var(--font-ui);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--paper-soft);
}

.slot h3 {
    margin: 0.6rem 0 0.35rem;
}

.note .slot__hint {
    font-size: 0.92rem;
    color: var(--paper-soft);
}

.slot__metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 1.1rem 0;
    border-top: 1px solid var(--paper-line);
    border-bottom: 1px solid var(--paper-line);
}

.slot__metrics dt {
    margin-bottom: 0.4rem;
    font: 500 0.68rem/1 var(--font-ui);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--paper-soft);
}

.slot__metrics dd {
    font-size: clamp(1.35rem, 2.6vw, 1.9rem);
    font-weight: 300;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.slot__metrics dd small {
    margin-left: 0.3em;
    font-size: 0.5em;
    color: var(--paper-soft);
}

.note .slot__who,
.note .slot__status {
    min-height: 1.4em;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--paper-soft);
    overflow-wrap: anywhere;
}

.note .slot__who:empty {
    display: none;
}

.note .slot__status {
    margin-top: -0.6rem;
}

.note .slot__who + .slot__status {
    margin-top: -0.9rem;
}

/* <button> variant of .button */
.note button.button {
    justify-self: start;
    background: transparent;
    color: var(--paper);
    cursor: pointer;
}

.note button.button:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.slot__manual summary {
    width: fit-content;
    font: 400 0.88rem/1.4 var(--font-ui);
    color: var(--paper-soft);
    cursor: pointer;
    transition: color 0.3s;
}

.slot__manual summary:hover {
    color: var(--touch);
}

.slot__inputs {
    display: grid;
    gap: 0.6rem;
    margin-top: 1rem;
}

.slot__inputs label,
.duel__contract {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--paper-soft);
}

.slot__inputs label > span,
.duel__contract > span:last-child {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.note input {
    width: 6.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--paper-line);
    border-radius: 10px;
    background-color: rgba(237, 231, 220, 0.05);
    color: var(--paper);
    font: 400 1rem/1.2 var(--font);
    font-variant-numeric: tabular-nums;
    transition: border-color 0.3s;
}

.note input:focus {
    outline: none;
    border-color: var(--touch);
}

.note input:disabled {
    opacity: 0.4;
}

.note .duel__switch {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px dashed rgba(255, 162, 255, 0.5);
    border-radius: 14px;
    color: var(--paper);
    text-align: center;
}

.duel__verdict {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.75rem;
    padding: 1.25rem 0 1.25rem 1.5rem;
    border-left: 2px solid var(--touch);
    font-size: 1.1rem;
}

.note .duel__verdict p {
    color: var(--paper);
}

.note .duel__warn {
    color: var(--touch);
}

.duel__contract {
    justify-content: flex-start;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--paper-line);
}

.note .duel__note {
    margin-top: 1.5rem;
    max-width: 60ch;
    font-size: 0.82rem;
    color: var(--paper-soft);
}

/* ---------- Notizen index ---------- */

.note-index {
    list-style: none;
    border-top: 1px solid var(--paper-line);
}

.note-index li {
    border-bottom: 1px solid var(--paper-line);
}

.note-index a {
    display: grid;
    gap: 0.5rem;
    padding: 2rem 0;
    text-decoration: none;
}

.note-index time {
    font: 500 0.72rem/1 var(--font-ui);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--paper-soft);
}

.note-index strong {
    font-size: clamp(1.6rem, 3.4vw, 2.4rem);
    font-weight: 300;
    line-height: 1.1;
    letter-spacing: -0.015em;
    transition: color 0.3s, transform 0.45s var(--ease-out);
}

.note-index span {
    color: var(--paper-soft);
}

.note-index a:hover strong {
    color: var(--touch);
    transform: translateX(0.5rem);
}

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

@media (max-width: 720px) {
    .duel__slots {
        grid-template-columns: minmax(0, 1fr);
    }

    .duel {
        border-radius: 20px;
    }
}

@media (max-width: 560px) {
    .duel__tag {
        font-size: 24px;
    }

    .duel__tag-value {
        display: none;
    }
}
