.profile-flows { margin: 48px auto 0; max-width: 1000px; }
.flow-section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.flow-section-heading h1, .flow-section-heading h2 { margin: 0; }
.flow-upload-link { display: inline-flex; align-items: center; text-align: center; text-decoration: none; }
.flow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, calc((100% - 24px) / 2)), 1fr)); gap: 24px; }
.flow-card { --flow-card-highlight: color-mix(in srgb, var(--hover-background) 50%, var(--page-background)); min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--border-color); border-radius: var(--card-radius); overflow: hidden; }
.flow-card-link { display: flex; flex-direction: column; flex: 1; }
.flow-card:is(:hover, :focus-within) .flow-card-info, .flow-card:is(:hover, :focus-within) .flow-card-publication { background: var(--flow-card-highlight); }
.flow-card-link:focus-visible { outline-offset: -4px; border-radius: var(--card-radius); }
.flow-preview { position: relative; aspect-ratio: var(--flow-preview-aspect-ratio); display: grid; place-items: center; background: var(--hover-background); border-radius: 16px; overflow: hidden; }
.flow-card .flow-preview { flex-shrink: 0; border-radius: 0; }
/* Lets each layout keep sizing the image directly. */
.flow-thumbnail { display: contents; }
.flow-preview img { min-width: 0; min-height: 0; width: 100%; height: 100%; object-fit: contain; }
.flow-preview img.flow-preview-incoming { position: absolute; inset: 0; visibility: hidden; pointer-events: none; }
.flow-preview-status { padding: 24px; text-align: center; color: var(--secondary-text-color); }
.flow-card-info { flex: 1; padding: var(--card-padding); }
.flow-card-info h3 { margin: 0; overflow-wrap: anywhere; }
.flow-card-info p, .flow-empty { color: var(--secondary-text-color); }
.flow-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flow-card-info .flow-badges { margin-top: 12px; }
.flow-badge { display: inline-block; padding: 5px 10px; border: 1px solid var(--border-color); border-radius: 999px; font-size: 13px; }
.flow-badge-gallery, .flow-badge-thread { color: var(--text-color); border-color: color-mix(in srgb, var(--accent-blue) 45%, var(--border-color)); background: color-mix(in srgb, var(--accent-blue) 18%, var(--page-background)); }
.flow-detail { max-width: 800px; margin: 0 auto; }
.flow-detail > .flow-preview { width: 100%; max-width: 300px; }
.flow-detail h1 { overflow-wrap: anywhere; }
.flow-forum-posts { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border-color); }
.flow-forum-posts h2 { margin: 0 0 16px; font-size: 20px; }
.flow-forum-posts ul { margin: 0; padding-left: 24px; }
.flow-forum-posts li { margin: 12px 0; line-height: 1.5; overflow-wrap: anywhere; }
.flow-description { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.flow-warnings { margin: 24px 0; padding: var(--card-padding); border: 1px solid color-mix(in srgb, var(--accent-orange) var(--tint-edge-amount), transparent); border-radius: var(--card-radius); background: color-mix(in srgb, var(--accent-orange) var(--tint-background-amount), transparent); overflow-wrap: anywhere; }
.flow-warnings h2 { margin-top: 0; font-size: 18px; }
.flow-bundle-warning { border-color: color-mix(in srgb, var(--accent-orange) var(--tint-edge-amount), transparent); background: color-mix(in srgb, var(--accent-orange) var(--tint-background-amount), transparent); }
.flow-warnings li { margin: 8px 0; line-height: 1.5; }
.flow-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; margin-top: 24px; }
.flow-actions form { display: flex; align-items: center; margin: 0; }
.flow-actions .account-primary { margin-top: 0; }
.flow-delete { background: transparent; color: var(--secondary-text-color); border: 1px solid var(--border-color); border-radius: 999px; min-height: var(--button-height); padding: 0 18px; font: inherit; cursor: pointer; }
.flow-delete:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; }
.flow-remove-link { display: inline-flex; align-items: center; min-height: var(--button-height); padding: 0 18px; border: 1px solid currentColor; border-radius: 999px; color: var(--accent-red); font-weight: 600; text-decoration: none; }
.flow-remove-link:active { opacity: var(--press-button-opacity); }
.flow-remove-link:focus-visible, .flow-remove:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; }
.flow-remove { min-height: var(--button-height); padding: 0 18px; border: 1px solid var(--accent-edge-color); border-radius: 999px; color: #fff; background: var(--accent-red); font: inherit; font-weight: 600; cursor: pointer; }
.flow-remove:active { opacity: var(--press-button-opacity); }
.flow-removal .flow-removal-name { overflow-wrap: anywhere; }
.flow-removal-visuals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.flow-removal-visuals > .flow-cover-preview, .flow-removal-visuals > .flow-preview { border-radius: 12px; }
.flow-removal .account-form { margin-top: 20px; }
@media (max-width: 600px) { .profile-flows { margin-top: 32px; } .flow-section-heading { align-items: flex-start; } .flow-actions { align-items: flex-start; flex-direction: column; } }

.flow-preview-loading { width: 100%; height: 100%; min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; }
.flow-preview-loading .flow-preview-status { margin: 0; padding: 0; }
.flow-progress { position: relative; display: inline-block; width: 24px; height: 24px; color: var(--secondary-text-color); }
.flow-progress-segment { position: absolute; left: 10.5px; top: 0; width: 3px; height: 7px; border-radius: 3px; background: currentColor; transform-origin: 50% 12px; animation: flow-progress-fade .8s linear infinite; }
.flow-progress-segment:nth-child(1) { transform: rotate(0deg); animation-delay: -.8s; }
.flow-progress-segment:nth-child(2) { transform: rotate(45deg); animation-delay: -.7s; }
.flow-progress-segment:nth-child(3) { transform: rotate(90deg); animation-delay: -.6s; }
.flow-progress-segment:nth-child(4) { transform: rotate(135deg); animation-delay: -.5s; }
.flow-progress-segment:nth-child(5) { transform: rotate(180deg); animation-delay: -.4s; }
.flow-progress-segment:nth-child(6) { transform: rotate(225deg); animation-delay: -.3s; }
.flow-progress-segment:nth-child(7) { transform: rotate(270deg); animation-delay: -.2s; }
.flow-progress-segment:nth-child(8) { transform: rotate(315deg); animation-delay: -.1s; }
@keyframes flow-progress-fade { from { opacity: 1; } to { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .flow-progress-segment { animation: none; opacity: .5; } }

.flows-page { max-width: var(--content-max-width); margin: var(--content-block-margin) auto; }
.flows-page > .flow-section-heading { margin: 2rem 0; }
.flow-list-description { color: var(--secondary-text-color); margin: 12px 0 0; }
.flow-card-publication { display: flex; flex-direction: column; gap: 8px; padding: 0 var(--card-padding-x) var(--card-padding-y); font-size: 14px; overflow-wrap: anywhere; }
.flow-card-publication time { color: var(--secondary-text-color); }
.flow-like { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.flow-like-form { margin: 0; }
.flow-like-button, .flow-like-public-count { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: var(--segment-height); min-height: var(--segment-height); }
.flow-like-button { border: 1px solid var(--border-color); border-radius: 999px; padding: 0 12px; background: transparent; color: var(--text-color); font: inherit; cursor: pointer; }
.flow-like-button:hover { background: var(--hover-background); }
.flow-like-button:active { background: var(--press-background); }
.flow-like-button:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; }
.flow-like-public-count { color: var(--text-color); text-decoration: none; border-radius: 999px; }
a.flow-like-public-count:hover { background: var(--hover-background); box-shadow: var(--hover-edge); }
a.flow-like-public-count:active { background: var(--press-background); box-shadow: var(--press-edge); }
.flow-like-public-count:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; }
.flow-like-button[aria-disabled="true"] { opacity: .6; cursor: progress; }
.flow-like-icon { display: inline-block; flex-shrink: 0; width: 20px; height: 20px; background: currentColor; -webkit-mask: url('/images/heart.png') center / contain no-repeat; mask: url('/images/heart.png') center / contain no-repeat; }
.flow-like-button[aria-pressed="true"] .flow-like-icon { color: var(--accent-red); -webkit-mask-image: url('/images/heart-filled.png'); mask-image: url('/images/heart-filled.png'); }
.flow-like-public-count .flow-like-icon { color: var(--secondary-text-color); -webkit-mask-image: url('/images/heart-filled.png'); mask-image: url('/images/heart-filled.png'); }
.flow-like-button[aria-busy="true"] .flow-like-icon { color: var(--secondary-text-color); -webkit-mask-image: url('/images/heart-filled.png'); mask-image: url('/images/heart-filled.png'); }
.flow-like-feedback { flex-basis: 100%; margin: 0; color: var(--secondary-text-color); font-size: 12px; }
.flow-like-feedback:empty { display: none; }
.flow-like > a { min-height: var(--segment-height); display: inline-flex; align-items: center; }
.flow-like > a[hidden] { display: none; }
@media (max-width: 600px) {
    .flow-grid { gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .flow-grid .flow-card-info { padding: 12px; }
    .flow-grid .flow-card-info h3 { font-size: 16px; }
    .flow-grid .flow-card-info p { font-size: 13px; margin-bottom: 0; }
    .flow-grid .flow-card-publication { padding: 0 12px 12px; font-size: 12px; }
    .flow-grid .flow-preview-loading { padding: 8px; gap: 8px; flex-direction: row; }
    .flow-grid .flow-preview-status { padding: 8px; font-size: 12px; line-height: 1.35; }
    .flow-grid .flow-preview-loading .flow-preview-status { padding: 0; }
    .flow-grid .flow-progress { flex-shrink: 0; }
}

.flow-cover-preview { aspect-ratio: 16 / 9; min-width: 0; overflow: hidden; border-radius: 16px; background: var(--hover-background); display: grid; place-items: center; }
.flow-cover-preview img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.flow-visuals { display: grid; gap: 12px; min-width: 0; }
.flow-card .flow-visuals { gap: 1px; background: var(--border-color); }
.flow-card .flow-cover-preview { border-radius: 0; }
.flow-detail > .flow-visuals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.flow-cover-editor { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border-color); }
.flow-cover-editor h2 { font-size: 20px; }
.flow-cover-editor label { display: block; margin: 16px 0 8px; }
.flow-cover-editor input[type="file"] { max-width: 100%; padding: 16px; box-sizing: border-box; border: 1px dashed var(--border-color); border-radius: 12px; }
.flow-cover-editor .account-primary { margin-top: 8px; }
.flow-cover-editor button:disabled { opacity: .6; cursor: progress; }
@media (max-width: 600px) { .flow-detail > .flow-visuals { grid-template-columns: minmax(0, 1fr); } }

/* Gallery packs natural-height cards without changing their source order. */
.gallery-grid { align-items: start; }
.gallery-grid-positioned { position: relative; }
.gallery-grid-positioned > .flow-card { position: absolute; box-sizing: border-box; }
.gallery-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.gallery-heading > .flow-upload-link { justify-self: end; align-self: center; margin-top: 0; }
.gallery-sort { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
@media (max-width: 900px) {
    .gallery-heading { grid-template-columns: minmax(0, 1fr) auto; }
    .gallery-heading > .flow-upload-link { grid-column: 2; grid-row: 1; }
    .gallery-heading > .gallery-sort { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 400px) {
    .gallery-heading { grid-template-columns: minmax(0, 1fr); }
    .gallery-heading > .flow-upload-link { grid-column: 1; grid-row: 3; justify-self: center; }
}
.gallery-sort-option { padding: 0 16px; border-radius: 999px; text-decoration: none; color: var(--text-color); }
.gallery-sort-option:hover { background: var(--hover-background); }
.gallery-sort-option[aria-current="page"] { background: var(--accent-blue); color: white; }
.gallery-sort-option:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; }

/* Overlay also highlights opaque covers, while preserving image colors and contrast. */
.flow-card { --flow-media-highlight: rgb(0 0 0 / 5%); }
.flow-card .flow-cover-preview { position: relative; }
.flow-card .flow-preview::after, .flow-card .flow-cover-preview::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: var(--flow-media-highlight); opacity: 0;
}
.flow-card:is(:hover, :focus-within) .flow-preview::after,
.flow-card:is(:hover, :focus-within) .flow-cover-preview::after { opacity: 1; }
@media (prefers-color-scheme: dark) { .flow-card { --flow-media-highlight: rgb(255 255 255 / 6%); } }
/* Pressing the card link makes both hover highlights 1.5x stronger. */
.flow-card:has(.flow-card-link:active) { --flow-card-highlight: color-mix(in srgb, var(--hover-background) 75%, var(--page-background)); --flow-media-highlight: rgb(0 0 0 / 7.5%); }
@media (prefers-color-scheme: dark) { .flow-card:has(.flow-card-link:active) { --flow-media-highlight: rgb(255 255 255 / 9%); } }

.flow-references { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.flow-references h2 { margin: 0 0 12px; font-size: 20px; }
.flow-references > ul { margin: 0; padding-left: 24px; }
.flow-references > ul > li { margin: 8px 0; line-height: 1.5; overflow-wrap: anywhere; }

.flow-actions-separated { padding-top: 24px; border-top: 1px solid var(--border-color); }

/* Only existing blue accents in instance/reference controls use purple. */
.flow-instance-accent {
    --accent-blue: var(--accent-purple);
    --accent-background: color-mix(in srgb, var(--accent-purple) var(--tint-background-amount), transparent);
}
.flow-references .flow-card-link:focus-visible { outline-color: var(--accent-purple); }
