/* ==========================================================================
   /how-it-works/ — one note through the whole loop (note → knowledge → quiz).
   The sequence plays once when the block scrolls into view: flow.js adds
   .is-in, and the transition delays below set the order. Without JS or with
   reduced motion everything is shown in its finished state.
   ========================================================================== */

.flow-wide {
    width: min(1180px, 100vw - var(--gutter) * 2);
    margin-left: 50%;
    transform: translateX(-50%);
    margin-top: 2em;
    margin-bottom: 2em;
}

.flow {
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr;
    gap: clamp(20px, 3vw, 40px);
    align-items: start;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
}
.prose .flow p { margin: 0; }

.flow-label {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-3); margin-bottom: 14px;
}
.flow-label b {
    width: 24px; height: 24px; border-radius: 50%;
    display: inline-grid; place-items: center;
    font-size: 12px; letter-spacing: 0; color: #000; background: var(--text);
}

.flow .card { padding: 22px; }

/* 1 · The note */
.flow-date { font-size: 21px; font-weight: 700; letter-spacing: -0.025em; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.flow-note { font-size: 16px; line-height: 1.65; color: #d2d2d7; }
.flow-foot { display: flex; justify-content: space-between; margin-top: 16px; font-size: 13px; color: var(--text-3); }
.flow-hl {
    color: inherit;
    background-color: transparent;
    background-image: linear-gradient(90deg, rgba(123, 108, 246, 0.55), rgba(245, 96, 154, 0.5));
    background-repeat: no-repeat;
    background-size: 100% 100%;
    border-radius: 4px;
    padding: 1px 2px; margin: 0 -2px;
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
    transition: background-size 0.7s var(--ease);
}
.flow-hl--b { background-image: linear-gradient(90deg, rgba(255, 162, 51, 0.5), rgba(240, 211, 92, 0.45)); }
.flow-hl--c { background-image: linear-gradient(90deg, rgba(44, 200, 211, 0.5), rgba(86, 166, 238, 0.5)); }

/* 2 · What Prismo keeps */
.flow-stack { display: flex; flex-direction: column; gap: 12px; }
.flow-k { padding: 20px !important; transition: opacity 0.6s var(--ease), transform 0.7s var(--ease); }
.flow-badge {
    display: inline-flex; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
    color: var(--success); background: rgba(52, 211, 153, 0.12);
    padding: 4px 8px; border-radius: 6px; margin-bottom: 10px;
}
.flow-k-title { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; margin-bottom: 6px; padding-right: 30px; }
.flow-k-text { font-size: 14px; color: var(--text-2); }
.flow-folder {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
    font-size: 12px; font-weight: 500; color: #b4acff;
    padding: 5px 10px; border-radius: 8px; background: rgba(123, 108, 246, 0.14);
}
.flow-folder svg { width: 13px; height: 13px; }
.flow-check {
    position: absolute; top: 18px; right: 18px;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--success); display: grid; place-items: center;
    transition: transform 0.45s cubic-bezier(0.34, 1.8, 0.64, 1);
}
.flow-check svg { width: 13px; height: 13px; color: #000; }

/* 3 · The quiz, days later */
.flow-quiz { transition: opacity 0.6s var(--ease), transform 0.7s var(--ease); }
.flow-qmeta { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-3); margin-bottom: 12px; }
.flow-qbar { height: 6px; border-radius: 3px; background: var(--surface-2); margin-bottom: 16px; overflow: hidden; }
.flow-qbar i { display: block; height: 100%; width: 38%; border-radius: inherit; background: var(--violet); }
.flow-q { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; margin-bottom: 16px; }
.flow-opts { display: flex; flex-direction: column; gap: 10px; }
.flow-opt {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 14px;
    border: 1.5px solid var(--line-strong);
    font-size: 15px; font-weight: 500;
    transition: border-color 0.4s ease, background-color 0.4s ease;
}
.flow-opt b {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--surface-2); font-size: 13px; color: var(--text-2);
    transition: background-color 0.4s ease, color 0.4s ease;
}
.flow-opt--answer { border-color: var(--success); background: rgba(52, 211, 153, 0.1); }
.flow-opt--answer b { background: var(--success); color: #000; }
.flow-result {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
    font-weight: 700; color: var(--success); font-size: 17px;
    transition: opacity 0.5s ease, transform 0.5s var(--ease);
}
.flow-result span:last-child { font-size: 13px; padding: 5px 10px; border-radius: 999px; border: 1.5px solid rgba(52, 211, 153, 0.5); }

.flow-caption { text-align: center; font-size: 14px; color: var(--text-3); margin-top: 18px !important; }

/* ---- Before it plays (only when flow.js is running) ----
   flow.js adds .is-in to the whole .flow on wide screens, or to each
   .flow-col on phones, so ":is(.is-in)" covers both. */
.flow.is-ready .flow-hl { background-size: 0% 100%; }
.flow.is-ready .flow-k,
.flow.is-ready .flow-quiz { opacity: 0; transform: translateX(-24px) scale(0.97); }
.flow.is-ready .flow-check { transform: scale(0); }
.flow.is-ready .flow-opt--answer { border-color: var(--line-strong); background: transparent; }
.flow.is-ready .flow-opt--answer b { background: var(--surface-2); color: var(--text-2); }
.flow.is-ready .flow-result { opacity: 0; transform: translateY(8px); }

/* ---- Playing ---- */
.flow.is-ready.is-in .flow-hl, .flow.is-ready .is-in .flow-hl { background-size: 100% 100%; }
.flow.is-ready.is-in :is(.flow-k, .flow-quiz), .flow.is-ready .is-in :is(.flow-k, .flow-quiz) { opacity: 1; transform: none; }
.flow.is-ready.is-in .flow-check, .flow.is-ready .is-in .flow-check { transform: none; }
.flow.is-ready.is-in .flow-opt--answer, .flow.is-ready .is-in .flow-opt--answer { border-color: var(--success); background: rgba(52, 211, 153, 0.1); }
.flow.is-ready.is-in .flow-opt--answer b, .flow.is-ready .is-in .flow-opt--answer b { background: var(--success); color: #000; }
.flow.is-ready.is-in .flow-result, .flow.is-ready .is-in .flow-result { opacity: 1; transform: none; }

/* Order on wide screens: highlights, then the topics, then the quiz */
.flow.is-in .flow-hl:nth-of-type(1) { transition-delay: 0.2s; }
.flow.is-in .flow-hl:nth-of-type(2) { transition-delay: 0.55s; }
.flow.is-in .flow-hl:nth-of-type(3) { transition-delay: 0.9s; }
.flow.is-in .flow-hl:nth-of-type(4) { transition-delay: 1.25s; }
.flow.is-in .flow-k:nth-child(1) { transition-delay: 1.9s; }
.flow.is-in .flow-k:nth-child(2) { transition-delay: 2.3s; }
.flow.is-in .flow-k:nth-child(1) .flow-check { transition-delay: 2.4s; }
.flow.is-in .flow-k:nth-child(2) .flow-check { transition-delay: 2.8s; }
.flow.is-in .flow-quiz { transition-delay: 3.3s; }
.flow.is-in .flow-opt--answer, .flow.is-in .flow-opt--answer b { transition-delay: 4.3s; }
.flow.is-in .flow-result { transition-delay: 4.7s; }

/* Order on phones: each column plays by itself as it reaches the screen */
.flow-col.is-in .flow-hl:nth-of-type(1) { transition-delay: 0.1s; }
.flow-col.is-in .flow-hl:nth-of-type(2) { transition-delay: 0.4s; }
.flow-col.is-in .flow-hl:nth-of-type(3) { transition-delay: 0.7s; }
.flow-col.is-in .flow-hl:nth-of-type(4) { transition-delay: 1s; }
.flow-col.is-in .flow-k:nth-child(2) { transition-delay: 0.3s; }
.flow-col.is-in .flow-k:nth-child(2) .flow-check { transition-delay: 0.6s; }
.flow-col.is-in .flow-opt--answer, .flow-col.is-in .flow-opt--answer b { transition-delay: 0.9s; }
.flow-col.is-in .flow-result { transition-delay: 1.3s; }

@media (max-width: 1024px) {
    .flow { grid-template-columns: 1fr 1fr; }
    .flow-col--quiz { grid-column: 1 / -1; max-width: 520px; width: 100%; justify-self: center; }
}
@media (max-width: 760px) {
    .flow { grid-template-columns: 1fr; gap: 26px; }
    .flow-col--quiz { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .flow * { transition: none !important; }
}
