/* ===== Секс-історії — читабельний сучасний оформлення ===== */

:root {
    --story-text: #e8e0f0;
    --story-text-soft: #c4b4d4;
    --story-muted: #9a8aad;
    --story-surface: rgba(20, 12, 34, 0.92);
    --story-surface-soft: rgba(255, 255, 255, 0.035);
    --story-border: rgba(188, 19, 254, 0.14);
    --story-read: 42rem;
}

/* ── Список ── */
.gallery-page--stories {
    padding-bottom: 32px;
}

.gallery-hero--story.gallery-hero--compact {
    border-color: rgba(240, 171, 252, 0.18);
}

.gallery-hero--story .gallery-hero__tag {
    color: #f0abfc;
}

.story-list {
    display: grid;
    gap: 18px;
    max-width: 880px;
}

.story-list-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    max-width: 880px;
    margin: 0 0 14px;
    padding: 0 2px;
    font-size: 13px;
    color: var(--story-muted);
}

.story-list-meta__page {
    font-weight: 700;
    color: #ddd0ec;
}

.gallery-page--stories .gallery-pagination {
    max-width: 880px;
    margin: 18px 0;
}

.gallery-page--stories .gallery-pagination:last-of-type {
    margin-bottom: 8px;
}

.story-card {
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    border: 1px solid var(--story-border);
    background: var(--story-surface);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.story-card:hover {
    border-color: rgba(188, 19, 254, 0.28);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.story-card__photo {
    display: block;
    flex-shrink: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.35);
}

.story-card__photo img {
    width: 100%;
    height: 100%;
    min-height: 168px;
    max-height: 220px;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.story-card:hover .story-card__photo img {
    transform: scale(1.03);
}

.story-card__body {
    padding: 20px 22px 22px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.story-card__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.story-card__cat {
    display: inline-flex;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #f5d7ff;
    background: rgba(188, 19, 254, 0.12);
    text-decoration: none;
    transition: background 0.15s ease;
}

.story-card__cat:hover {
    background: rgba(188, 19, 254, 0.22);
    color: #fff;
}

.story-card__date {
    font-size: 12px;
    color: var(--story-muted);
    white-space: nowrap;
}

.story-card__title {
    margin: 0 0 12px;
    font-size: clamp(1.05rem, 2.5vw, 1.28rem);
    line-height: 1.35;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.story-card__title a {
    color: #faf5ff;
    text-decoration: none;
    transition: color 0.15s ease;
}

.story-card__title a:hover {
    color: #f0abfc;
}

.story-card__excerpt {
    margin: 0 0 16px;
    color: var(--story-text-soft);
    line-height: 1.65;
    font-size: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    font-size: 12px;
    color: var(--story-muted);
    margin-bottom: 14px;
    margin-top: auto;
}

.story-card__author {
    color: #ddd0ec;
    font-weight: 700;
}

.story-card__stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.story-card__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 800;
    color: #e879f9;
    text-decoration: none;
    transition: color 0.15s ease, gap 0.15s ease;
}

.story-card__more:hover {
    color: #f0abfc;
    gap: 9px;
}

@media (min-width: 640px) {
    .story-card:has(.story-card__photo) {
        flex-direction: row;
    }

    .story-card__photo {
        width: 176px;
    }

    .story-card__photo img {
        min-height: 100%;
        max-height: none;
        height: 100%;
    }
}

/* ── Зірки ── */
.story-stars {
    display: inline-flex;
    gap: 2px;
    color: #ffd76a;
}

.story-stars--sm {
    font-size: 11px;
}

/* ── Сторінка читання ── */
.gallery-page--story-view {
    max-width: 780px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 16px 48px;
}

.story-breadcrumb {
    margin-bottom: 16px;
}

.story-breadcrumb__back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--story-muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.story-breadcrumb__back:hover {
    color: #f0abfc;
    border-color: rgba(188, 19, 254, 0.24);
    background: rgba(188, 19, 254, 0.08);
}

.story-view {
    margin-bottom: 8px;
}

.story-view__head {
    margin-bottom: 28px;
    text-align: center;
    padding: 26px 24px 24px;
    border-radius: 22px;
    border: 1px solid var(--story-border);
    background:
        linear-gradient(180deg, rgba(188, 19, 254, 0.07) 0%, rgba(188, 19, 254, 0) 42%),
        var(--story-surface);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
}

.story-view__cat {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 14px;
    padding: 7px 15px;
    border-radius: 999px;
    background: rgba(188, 19, 254, 0.12);
    border: 1px solid rgba(188, 19, 254, 0.22);
    color: #f5d7ff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.01em;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

a.story-view__cat:hover {
    background: rgba(188, 19, 254, 0.22);
    border-color: rgba(188, 19, 254, 0.38);
    color: #fff;
    transform: translateY(-1px);
}

.story-view__cat:not(a) {
    cursor: default;
}

.story-view__head h1 {
    margin: 0 0 18px;
    font-size: clamp(1.55rem, 4.5vw, 2.15rem);
    line-height: 1.22;
    font-weight: 900;
    letter-spacing: -0.025em;
    color: #faf5ff;
    text-wrap: balance;
}

.story-view__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    color: var(--story-muted);
    font-size: 13px;
}

.story-view__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #d8c8ea;
    font-weight: 600;
}

.story-view__photo {
    margin: 0 auto 28px;
    max-width: var(--story-read);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--story-border);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}

.story-view__photo img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    display: block;
}

/* Основний текст — зона читання */
.story-prose,
.story-view__body {
    font-family: "Literata", Georgia, "Times New Roman", serif;
    font-size: 1.0625rem;
    line-height: 1.82;
    letter-spacing: 0.012em;
    font-weight: 400;
    color: var(--story-text);
    max-width: var(--story-read);
    margin: 0 auto 32px;
    padding: 32px 28px;
    background: var(--story-surface);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 16px 40px rgba(0, 0, 0, 0.18);
    -webkit-font-smoothing: antialiased;
    text-wrap: pretty;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.story-prose p,
.story-view__body p {
    margin: 0 0 1.15em;
}

.story-prose p:last-child,
.story-view__body p:last-child {
    margin-bottom: 0;
}

.story-prose br + br,
.story-view__body br + br {
    display: block;
    content: "";
    margin-top: 0.6em;
}

/* ── Оцінка ── */
.story-rating-box,
.story-comments {
    max-width: var(--story-read);
    margin-left: auto;
    margin-right: auto;
    margin-top: 0;
    padding: 24px 26px;
    border-radius: 18px;
    border: 1px solid var(--story-border);
    background: var(--story-surface-soft);
}

.story-rating-box {
    margin-bottom: 20px;
}

.story-comments {
    margin-top: 24px;
}

.story-rating-box h2,
.story-comments h2 {
    margin: 0 0 16px;
    font-size: 1.1rem;
    font-weight: 800;
    color: #f3ebff;
    letter-spacing: -0.01em;
}

.story-rating-display {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 14px;
}

.story-rating-value {
    font-size: 1.65rem;
    font-weight: 900;
    color: #ffd76a;
    line-height: 1;
}

.story-rating-count {
    color: var(--story-muted);
    font-size: 13px;
}

.story-rate-stars {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.story-rate-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 106, 0.22);
    background: rgba(255, 215, 106, 0.05);
    color: #7a6840;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.story-rate-btn:hover {
    background: rgba(255, 215, 106, 0.12);
    color: #c9a84a;
}

.story-rate-btn.is-on {
    background: rgba(255, 215, 106, 0.18);
    color: #ffd76a;
    border-color: rgba(255, 215, 106, 0.45);
}

.story-rating-hint {
    color: var(--story-muted);
    font-size: 14px;
    margin: 0 0 10px;
}

.story-rating-hint a {
    color: #e879f9;
}

/* ── Коментарі ── */
.story-comment-form textarea {
    width: 100%;
    min-height: 110px;
    margin-bottom: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    padding: 14px 16px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.55;
    resize: vertical;
    transition: border-color 0.15s ease;
}

.story-comment-form textarea:focus {
    outline: none;
    border-color: rgba(188, 19, 254, 0.4);
}

.story-comment-list {
    margin-top: 20px;
    display: grid;
    gap: 12px;
}

.story-comment {
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.story-comment__head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--story-muted);
}

.story-comment__head strong {
    color: #ede4f8;
    font-weight: 700;
}

.story-comment p,
.story-comment__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--story-text-soft);
}

.story-comment-delete button {
    border: none;
    background: none;
    color: #ff8a8a;
    cursor: pointer;
    font-size: 12px;
    padding: 6px 0 0;
    opacity: 0.85;
}

.story-comment-delete button:hover {
    opacity: 1;
}

.story-comment-login {
    color: var(--story-muted);
    font-size: 14px;
}

.story-comment-login a {
    color: #e879f9;
}

/* ── Оголошення автора ── */
.story-ad-box {
    max-width: var(--story-read);
    margin: 24px auto 0;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px dashed rgba(188, 19, 254, 0.22);
    background: rgba(188, 19, 254, 0.04);
}

.story-ad-box__label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #e879f9;
    margin-bottom: 6px;
    font-weight: 800;
}

.story-ad-box__link {
    color: #fff;
    font-weight: 800;
    text-decoration: none;
}

.story-ad-box__link:hover {
    color: #f0abfc;
}

/* ── Форма / мої історії ── */
.story-form__body {
    min-height: 300px;
    font-size: 15px;
    line-height: 1.65;
}

.form-label {
    display: block;
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 800;
    color: #eadcf8;
}

.form-req {
    font-size: 11px;
    color: var(--story-muted);
    font-weight: 600;
}

/* ── Мої історії ── */
.gallery-page--my-stories {
    padding-bottom: 36px;
}

.story-mine-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid var(--story-border);
    background: var(--story-surface);
}

.story-mine-hero__main h1 {
    margin: 8px 0 6px;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    line-height: 1.2;
    color: #faf5ff;
}

.story-mine-hero__main p {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--story-text-soft);
    max-width: 520px;
}

.story-mine-hero__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, #bc13fe, #e879f9);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.story-mine-hero__cta:hover {
    filter: brightness(1.06);
}

.story-mine-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.story-mine-summary__item {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--story-border);
    background: rgba(255, 255, 255, 0.025);
    text-align: center;
}

.story-mine-summary__item.is-public {
    border-color: rgba(0, 255, 136, 0.18);
}

.story-mine-summary__item.is-pending {
    border-color: rgba(255, 193, 7, 0.18);
}

.story-mine-summary__num {
    display: block;
    font-size: 1.5rem;
    font-weight: 900;
    color: #faf5ff;
    line-height: 1.1;
}

.story-mine-summary__label {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--story-muted);
}

.story-mine-list {
    display: grid;
    gap: 16px;
}

.story-mine-card {
    border-radius: 20px;
    border: 1px solid var(--story-border);
    background: var(--story-surface);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.story-mine-card.is-open {
    border-color: rgba(188, 19, 254, 0.32);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
}

.story-mine-card__summary {
    padding: 18px 20px;
}

.story-mine-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.story-mine-card__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.story-mine-card__badges .state-badge {
    position: static;
    backdrop-filter: none;
}

.story-mine-card__cat {
    font-size: 12px;
    font-weight: 700;
    color: #e9d5ff;
}

.story-mine-card__date {
    font-size: 12px;
    color: var(--story-muted);
}

.story-mine-card__actions-top {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.story-mine-card__open,
.story-mine-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.story-mine-card__open {
    border: 1px solid rgba(188, 19, 254, 0.22);
    background: rgba(188, 19, 254, 0.08);
    color: #f0abfc;
}

.story-mine-card__open:hover {
    background: rgba(188, 19, 254, 0.16);
    color: #fff;
}

.story-mine-toggle {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #ede4f8;
}

.story-mine-toggle:hover,
.story-mine-card.is-open .story-mine-toggle {
    background: rgba(188, 19, 254, 0.14);
    border-color: rgba(188, 19, 254, 0.28);
    color: #fff;
}

.story-mine-card__preview {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.story-mine-card__preview:not(:has(.story-mine-card__thumb)) {
    grid-template-columns: minmax(0, 1fr);
}

.story-mine-card__thumb {
    width: 88px;
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.story-mine-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.story-mine-card__title {
    margin: 0 0 8px;
    font-size: 1.05rem;
    line-height: 1.35;
    color: #faf5ff;
}

.story-mine-card__excerpt {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--story-text-soft);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-mine-card__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12px;
    font-weight: 700;
    color: var(--story-muted);
}

.story-mine-card__stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.story-mine-editor {
    padding: 0 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.14);
}

.story-mine-form {
    padding-top: 18px;
}

.story-mine-form__body {
    min-height: 260px;
}

.story-mine-current-photo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.story-mine-current-photo img {
    width: 72px;
    height: 96px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.story-mine-remove-photo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #ffb4b4;
    cursor: pointer;
}

.story-mine-remove-photo input {
    accent-color: #ff6b6b;
}

.story-mine-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.story-mine-save {
    flex: 1 1 220px;
}

.story-mine-cancel {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #ddd0ec;
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.story-mine-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
}

.story-mine-delete {
    margin: 14px 0 0;
    padding-top: 14px;
    border-top: 1px dashed rgba(255, 77, 77, 0.18);
}

.story-mine-delete__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: none;
    color: #ff8a8a;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 0;
}

.story-mine-delete__btn:hover {
    color: #ffb4b4;
}

@media (max-width: 720px) {
    .story-mine-summary {
        grid-template-columns: 1fr;
    }

    .story-mine-hero {
        padding: 16px;
    }

    .story-mine-hero__cta {
        width: 100%;
        justify-content: center;
    }

    .story-mine-card__summary,
    .story-mine-editor {
        padding-left: 16px;
        padding-right: 16px;
    }

    .story-mine-card__top {
        flex-direction: column;
    }

    .story-mine-card__actions-top {
        width: 100%;
    }

    .story-mine-card__open,
    .story-mine-toggle {
        flex: 1 1 auto;
        justify-content: center;
    }

    .story-mine-card__preview {
        grid-template-columns: 1fr;
    }

    .story-mine-card__thumb {
        width: 100%;
        max-width: 180px;
    }

    .story-mine-form__actions {
        flex-direction: column;
    }

    .story-mine-save,
    .story-mine-cancel {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .story-prose,
    .story-view__body {
        padding: 24px 20px;
        font-size: 1rem;
        line-height: 1.78;
        border-radius: 16px;
    }

    .story-rating-box,
    .story-comments {
        padding: 20px 18px;
    }

    .story-view__head {
        padding: 20px 18px;
        text-align: left;
    }

    .story-view__meta {
        justify-content: flex-start;
    }

    .story-card__body {
        padding: 18px 16px 20px;
    }
}

@media (min-width: 1200px) {
    .site-content .gallery-page--story-view {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}
