.doujin-work-page {
    padding-block: clamp(32px, 4.5vw, 66px) clamp(44px, 6vw, 80px);
    background:
        linear-gradient(transparent, var(--doujin-footer-bg)) bottom / 100% 140px no-repeat,
        var(--doujin-bg);
}

.doujin-gallery,
.doujin-series-strip,
.doujin-work-comments {
    max-width: 1160px;
    margin-inline: auto;
}

.doujin-work-summary {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: clamp(195px, 33vw, 340px) minmax(0, 1fr);
    align-items: center;
    gap: clamp(24px, 4.4vw, 60px);
    max-width: 900px;
    margin-inline: auto;
    margin-block-end: clamp(8px, 1vw, 14px);
    padding-bottom: clamp(28px, 4vw, 52px);
}

.doujin-work-summary::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -24px 0 10px;
    pointer-events: none;
    background-color: var(--doujin-ruby);
    opacity: 0.17;
    mask: url("../images/doujin-smoke.webp") var(--doujin-smoke-position, 50%) center / 112% 100% no-repeat;
    transform: scaleX(var(--doujin-smoke-flip, 1));
}

.doujin-work-summary__cover {
    position: relative;
    isolation: isolate;
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    background: var(--doujin-surface);
    box-shadow: 0 17px 27px rgb(0 0 0 / 58%);
}

.doujin-work-summary__cover::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(156deg, var(--doujin-accent), var(--doujin-ruby) 72%, transparent);
    opacity: 0.18;
    filter: blur(8px);
}

.doujin-work-summary__cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    border-radius: inherit;
    object-fit: cover;
}

.doujin-work-summary__details {
    position: relative;
    justify-self: center;
    min-width: 0;
    width: min(100%, 600px);
    padding: clamp(16px, 2.5vw, 32px);
    overflow-wrap: anywhere;
    text-shadow: 0 1px 2px #000, 0 0 7px #000, 0 3px 12px rgb(0 0 0 / 85%);
}

.doujin-work-summary__details::before {
    content: "";
    position: absolute;
    inset-block: 30px;
    inset-inline-start: 0;
    width: 1px;
    background: linear-gradient(transparent, rgb(204 41 64 / 66%) 12%, rgb(204 41 64 / 17%) 77%, transparent);
    filter: drop-shadow(0 0 2px #000) drop-shadow(0 0 5px rgb(0 0 0 / 90%));
    pointer-events: none;
}

.doujin-work-page .doujin-work-summary h1 {
    margin: 0 0 6px;
    font: 720 clamp(1.4rem, 2.3vw, 2rem) / 1.14 Inter, system-ui, sans-serif;
    letter-spacing: -0.025em;
    color: var(--doujin-text);
}

.doujin-work-summary__alternative {
    margin: 0;
    color: #ddcbd3;
    font-size: clamp(0.9rem, 1.25vw, 1.12rem);
    font-weight: 500;
    line-height: 1.38;
}

.doujin-work-summary__jp {
    margin: 6px 0 0;
    color: #9e8a93;
    font-size: clamp(0.78rem, 1vw, 0.88rem);
    line-height: 1.4;
}

.doujin-work-summary__score {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 16px;
    margin-block: 27px 29px;
    color: #ddcbd3;
    font-size: 0.875rem;
}

.doujin-work-summary__score .post-rating {
    position: static;
    margin: 0;
    min-height: 0;
}

.doujin-work-summary__score .post-total-rating,
.doujin-work-summary__score .user-rating {
    display: inline-flex;
    align-items: center;
    position: static;
    padding: 0;
    background: transparent;
    white-space: nowrap;
}

.doujin-work-summary__score .user-rating { display: none; }

.doujin-work-summary__score .ratings_stars {
    margin-inline: 0 2px;
    color: var(--doujin-accent);
    font-size: clamp(1.3rem, 1.85vw, 1.65rem);
    line-height: 1;
}

.doujin-work-summary__score .ion-ios-star-outline { color: #b29da8; }

.doujin-work-summary__score .score {
    margin-inline-start: 9px;
    color: var(--doujin-text);
    font: inherit;
    font-weight: 650;
}

.doujin-work-summary__score .score:empty::after { content: "0"; }
.doujin-work-summary__score .vote-details { font-size: 0.75rem; }

.doujin-work-summary__facts {
    display: grid;
    grid-template-columns: minmax(max-content, clamp(92px, 10.5vw, 145px)) minmax(0, 1fr);
    gap: 7px clamp(12px, 1.65vw, 22px);
    margin: 0 0 31px;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.45;
}

.doujin-work-summary__facts dt {
    color: var(--doujin-ruby);
    font-weight: inherit;
}

.doujin-work-summary__facts dd {
    margin: 0;
    color: var(--doujin-text);
}

.doujin-work-summary__facts a { color: inherit; }
.doujin-work-summary__facts a:hover,
.doujin-work-summary__facts a:focus-visible { color: var(--doujin-accent); }

.doujin-work-page .doujin-work-summary__facts a.doujin-work-tag {
    display: inline-block;
    margin: 2px 3px 2px 0;
    padding: 2px 7px;
    border: 1px solid color-mix(in srgb, var(--doujin-ruby), transparent 60%);
    border-radius: 4px;
    background: color-mix(in srgb, var(--doujin-surface), var(--doujin-ruby) 10%);
    color: var(--doujin-accent);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.doujin-work-page .doujin-work-summary__facts a.doujin-work-tag:is(:hover, :focus-visible) {
    border-color: var(--doujin-accent);
    color: var(--doujin-text);
}

.doujin-work-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

body .doujin-work-page a.doujin-work-button,
.doujin-work-page .add-bookmark .action_icon a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid var(--doujin-line);
    border-radius: 6px;
    background: var(--doujin-surface);
    color: var(--doujin-text);
    font: 650 0.8125rem / 1.2 Inter, system-ui, sans-serif;
    text-decoration: none;
    text-shadow: 0 1px 2px rgb(0 0 0 / 60%);
}

body .doujin-work-page a.doujin-work-button--primary,
.doujin-work-page .doujin-work-favorite {
    background: var(--doujin-ruby);
    border-color: var(--doujin-ruby);
    color: #fff;
    box-shadow: 0 3px 10px rgb(0 0 0 / 25%);
}

.doujin-work-page .doujin-work-favorite {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid var(--doujin-ruby);
    border-radius: 6px;
}

.doujin-work-page .doujin-work-favorite .add-bookmark .action_icon a {
    border: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    min-height: 32px;
}

.doujin-work-page .doujin-work-favorite:hover { border-color: var(--doujin-accent); }

body .doujin-work-page a.doujin-work-button:hover,
.doujin-work-page .add-bookmark .action_icon a:hover { border-color: var(--doujin-accent); }

.doujin-work-favorite__count {
    display: inline-flex;
    align-items: center;
    padding-inline-start: 8px;
    margin-inline-start: 2px;
    border-inline-start: 1px solid rgb(255 255 255 / 35%);
    font: 650 0.8125rem / 1 Inter, system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 2px rgb(0 0 0 / 50%);
}

.doujin-work-favorite .doujin-work-favorite__count {
    margin-inline-start: 0;
    padding: 0 11px 0 9px;
}

.doujin-work-favorite__count[hidden] { display: none; }

.doujin-work-page .doujin-work-button i,
.doujin-work-page .add-bookmark .action_icon i {
    display: inline-grid;
    place-items: center;
    width: 1em;
    font-size: 1rem;
    line-height: 1;
}

.doujin-work-page .add-bookmark,
.doujin-work-page .add-bookmark .action_icon { display: flex; margin: 0; }
.doujin-work-page .add-bookmark .action_detail { display: none; }
.doujin-work-page .add-bookmark .wp-manga-action-button i::before { content: "\f19b"; }
.doujin-work-page .add-bookmark .wp-manga-delete-bookmark i::before { content: "\f443"; }
.doujin-work-page .add-bookmark .wp-manga-action-button::after { content: "Favoritar"; }
.doujin-work-page .add-bookmark .wp-manga-delete-bookmark::after { content: "Favoritado"; }

.doujin-gallery,
.doujin-series-strip,
.doujin-work-related,
.doujin-work-comments {
    border-top: 1px solid rgb(204 41 64 / 36%);
}

/* Series strip (only rendered when series has 2+ works; centered & symmetric) */
.doujin-series-strip {
    margin-bottom: clamp(18px, 2.2vw, 28px);
    padding-top: clamp(16px, 2vw, 24px);
}

.doujin-series-strip__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 10px;
    margin-bottom: 14px;
    text-align: center;
}

.doujin-work-page .doujin-series-strip__title {
    margin: 0;
    color: var(--doujin-text);
    font: 700 clamp(1rem, 1.45vw, 1.18rem) / 1.25 Inter, system-ui, sans-serif;
}

.doujin-series-strip__title a {
    color: inherit;
    text-decoration: none;
    transition: color 140ms ease;
}

.doujin-series-strip__title a:hover,
.doujin-series-strip__title a:focus-visible {
    color: var(--doujin-accent);
}

.doujin-series-strip__counter {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--doujin-ruby), transparent 55%);
    background: color-mix(in srgb, var(--doujin-surface), var(--doujin-ruby) 14%);
    color: var(--doujin-accent);
    font: 650 0.75rem / 1.3 Inter, system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
}

.doujin-series-strip__track {
    display: flex;
    gap: 12px;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 4px 2px 10px;
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--doujin-ruby), transparent 45%) transparent;
}

.doujin-series-strip__track::-webkit-scrollbar { height: 6px; }
.doujin-series-strip__track::-webkit-scrollbar-track { background: transparent; }
.doujin-series-strip__track::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--doujin-ruby), transparent 45%);
    border-radius: 999px;
}

.doujin-series-card {
    flex: 0 0 118px;
    scroll-snap-align: start;
}

.doujin-series-card__link {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 44px;
    border-radius: 6px;
    color: var(--doujin-text);
    text-decoration: none;
    transition: transform 160ms ease, color 140ms ease;
}

.doujin-series-card__link:focus-visible {
    outline: 2px solid var(--doujin-accent);
    outline-offset: 4px;
}

.doujin-series-card__cover {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid var(--doujin-line);
    background: var(--doujin-surface);
    box-shadow: 0 6px 14px rgb(0 0 0 / 38%);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.doujin-series-card.is-current .doujin-series-card__cover {
    border: 2px solid var(--doujin-ruby);
    box-shadow: 0 8px 20px rgb(0 0 0 / 52%);
}

.doujin-series-card__cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.doujin-series-card__badge {
    position: absolute;
    top: 6px;
    left: 6px;
    max-width: calc(100% - 12px);
    padding: 2px 6px;
    border-radius: 4px;
    background: rgb(11 10 14 / 82%);
    color: #fff;
    font: 700 0.6875rem / 1.25 Inter, system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doujin-series-card__current {
    position: absolute;
    right: 6px;
    bottom: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--doujin-ruby);
    color: #fff;
    font: 700 0.65rem / 1.2 Inter, system-ui, sans-serif;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgb(0 0 0 / 50%);
}

.doujin-chapter-card__num {
    display: block;
    color: var(--doujin-accent);
    font: 700 0.72rem / 1.2 Inter, system-ui, sans-serif;
    letter-spacing: 0.01em;
    margin-bottom: -4px;
}

.doujin-series-card__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font: 600 0.78rem / 1.3 Inter, system-ui, sans-serif;
    color: inherit;
}

.doujin-series-card.is-current .doujin-series-card__title {
    color: var(--doujin-accent);
}

@media (hover: hover) and (pointer: fine) {
    .doujin-series-card__link:hover {
        transform: translateY(-2px);
        color: var(--doujin-accent);
    }

    .doujin-series-card__link:hover .doujin-series-card__cover {
        border-color: color-mix(in srgb, var(--doujin-accent), transparent 25%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .doujin-series-card__link,
    .doujin-series-card__cover { transition: none; }
    .doujin-series-card__link:hover { transform: none; }
}

.doujin-gallery {
    padding-top: clamp(18px, 2.2vw, 30px);
    scroll-margin-top: 24px;
}

.doujin-gallery__grid {
    --doujin-gallery-fade: linear-gradient(#000 10%, rgb(0 0 0 / 68%) 52%, transparent 100%);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(6px, 0.7vw, 10px);
    margin: 0;
    padding: 0;
    list-style: none;
}

.doujin-gallery__grid a {
    display: block;
    overflow: hidden;
    aspect-ratio: 180 / 264;
    border-radius: 4px;
    background: var(--doujin-surface);
}

.doujin-gallery__grid img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.doujin-gallery__grid.has-more > :nth-last-child(-n + 2):not(:focus-within) {
    mask-image: var(--doujin-gallery-fade);
}

.doujin-gallery__actions {
    justify-content: center;
    margin-top: 18px;
}

.doujin-gallery__actions[hidden] { display: none; }
.doujin-gallery__empty { color: var(--doujin-muted); text-align: center; }

.doujin-work-related,
.doujin-work-comments {
    margin-top: clamp(34px, 5.2vw, 70px);
    padding-top: clamp(20px, 2.8vw, 36px);
}

.doujin-work-page .doujin-work-section-title {
    margin: 0 0 clamp(16px, 2.6vw, 32px);
    color: var(--doujin-text);
    font: 730 21px / 1.2 Inter, system-ui, sans-serif;
    text-align: center;
    text-shadow: 0 2px 6px rgb(0 0 0 / 72%);
}

.doujin-work-related { max-width: 1200px; margin-inline: auto; }
.doujin-work-related .doujin-home__grid {
    gap: clamp(18px, 1.15vw + 4px, 20px) clamp(10px, 1.15vw - 4px, 12px);
}
.doujin-work-comments { scroll-margin-top: 24px; }
.doujin-work-comments :is(.hr.mv40, #manga-discussion.c-blog__heading > .h4) { display: none; }
.doujin-work-comments :is(h3, h4, p, label) { color: var(--doujin-text); }
.doujin-work-comments :is(textarea, input[type="text"], input[type="email"], input[type="url"]) {
    color: var(--doujin-text);
    background: var(--doujin-surface);
    border-color: var(--doujin-line);
}

.doujin-work-page :is(.doujin-work-button, .add-bookmark a, .doujin-gallery__grid a):focus-visible {
    outline: 2px solid var(--doujin-accent);
    outline-offset: 2px;
}

@media (min-width: 576px) and (max-width: 899px) {
    .doujin-gallery__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .doujin-gallery__grid.has-more > :nth-last-child(-n + 4):not(:focus-within) { mask-image: var(--doujin-gallery-fade); }
}

@media (min-width: 900px) {
    .doujin-gallery__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .doujin-gallery__grid.has-more > :nth-last-child(-n + 6):not(:focus-within) { mask-image: var(--doujin-gallery-fade); }
}

@media (max-width: 575px) {
    .doujin-work-summary { grid-template-columns: minmax(0, 1fr); }
    .doujin-work-summary__cover { width: min(74%, 285px); justify-self: center; }
    .doujin-work-summary__details::before {
        inset-block: 0 auto;
        inset-inline: 16px;
        width: auto;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgb(204 41 64 / 52%) 25% 75%, transparent);
    }
    .doujin-series-card { flex-basis: 102px; }
}

@media (prefers-reduced-motion: no-preference) {
    html:has(.doujin-work-page) { scroll-behavior: smooth; }
}
