/* Card */
.comic-card {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 30px;
    width: 100%;
    max-width: 1150px;
    margin: 0 auto;
    padding: 30px;
    box-sizing: border-box;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* Publishers */
.edit-marvel {
    background-color: #dcfce7;
}

.edit-dc {
    background-color: #ffedd5;
}

.edit-outra {
    background-color: #fef9c3;
}

.edit-info {
    background-color: #dbeafe;
}

/* Covers */
.comic-cover-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-width: 0;
}

.comic-cover-container .comic-id-cover {
    display: block;
    position: static;
    width: 100%;
    margin-top: 12px;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: transparent;
    opacity: 1;
    user-select: text;
    -webkit-user-select: text;
}

.comic-cover {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    object-fit: contain;
}

.comic-cover-placeholder {
    width: 100%;
    max-width: 330px;
    aspect-ratio: 2 / 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 10px;
    color: #6b7280;
}

/* Info */
.comic-information {
    min-width: 0;
}

/* Title + Logos */
.comic-heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin: 0 0 5px;
}

/* Comic + Edition */
.comic-heading-title {
    width: 100%;
    min-width: 0;
    text-align: center;
}

.comic-heading-title h1 {
    margin: 0;
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    line-height: 1.15;
    font-weight: 800;
    color: #111827;
    text-align: center;
}

/* Logos */
.comic-heading-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    min-width: 0;
    margin-inline: auto;
    transform: translateX(-30px);
}

.publisher-logo {
    display: block;
    max-width: 120px;
    max-height: 70px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.logo-small {
    height: 30px;
    max-height: 50px;
    width: auto;
}

.publisher-fallback {
    font-size: 0.95rem;
    font-weight: 700;
    color: #374151;
}

/* Cover title */
.comic-title {
    margin: 10px 0 14px;
    font-size: 1.5rem;
    line-height: 1.25;
    font-weight: 400;
    color: #1f2937;
    text-align: center;
}

/* Cover characters */
.comic-cover-char {
    font-size: 1.15rem;
    font-weight: 600;
    text-align: center;
}

/* DC logo larger */
.logo-dc {
    max-width: 70px;
    max-height: 70px;
}

/* Info fields */
.comic-info-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 10px 0;
}

.comic-info-row-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Info items */
.comic-info-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
}

/* Field labels */
.comic-info-item span {
    font-size: 0.82rem;
    font-weight: 700;
    color: #4b5563;
}

/* Field values */
.comic-info-item strong {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.98rem;
    line-height: 1.3;
    overflow-wrap: break-word;
    font-weight: 700;
}

/* First row: Date, Price, Frequency, Status */
.info-published strong {
    background-color: #2563eb;
    color: #ffffff;
}

.info-price strong {
    background-color: #15803d;
    color: #ffffff;
}

.info-frequency strong {
    background-color: #f5970a;
    color: #ffffff;
}

.info-status-ended strong {
    background-color: #dc2626;
    color: #ffffff;
}

.info-status-published strong {
    background-color: #15803d;
    color: #ffffff;
}

.info-status-special strong {
    background-color: #ca8a04;
    color: #ffffff;
}

/* Second row: Format, Pages, Stories, Articles */
.comic-info-row-green .comic-info-item strong {
    background-color: #FEF9C3;
}

.edit-marvel .comic-info-row-green .comic-info-item strong {
    background-color: #CCFBF1;
}

.edit-dc .comic-info-row-green .comic-info-item strong {
    background-color: #fef08a;
}

.edit-outra .comic-info-row-green .comic-info-item strong {
    background-color: #fed7aa;
}

.edit-info .comic-info-row-green .comic-info-item strong {
    background-color: #bbf7d0;
}

.edit-marvel .comic-cover-char {
    color: #166534;
}

.edit-dc .comic-cover-char {
    color: #EA580C;
}

.edit-outra .comic-cover-char {
    color: #CA8A04;
}

.edit-info .comic-cover-char {
    color: #1E40AF;
}

/* Third row: Paper, Binding, Cover Type */
.comic-info-row-three .comic-info-item strong {
    background-color: whitesmoke;
}

/* Characteristics */
.comic-flags {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 2px 0;
}

.comic-flags span,
.comic-flags-items span {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fefce8;
    font-size: 0.78rem;
    font-weight: 600;
    color: #854d0e;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Gallery button */
.comic-flags .edition-gallery-link {
    display: inline-flex;
    flex: 0 0 160px;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #374151;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}

.comic-flags-items {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.comic-flags .edition-gallery-link:hover {
    filter: brightness(0.92);
}

/* Call */
.comic-call {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding-top: 7px;
    font-size: 0.92rem;
    color: #374151;
    text-align: center;
}

.comic-call strong {
    font-weight: 700;
}

/* Empty state */
.random-empty {
    text-align: center;
    padding: 80px 24px;
    max-width: 480px;
    margin: 0 auto;
}

.random-icon {
    font-size: 3.8rem;
    margin-bottom: 1.2rem;
    line-height: 1;
}

.random-empty h1 {
    margin: 0 0 12px;
    font-size: 1.9rem;
    font-weight: 800;
    color: #111827;
}

.random-empty p {
    margin: 0 0 28px;
    color: #6b7280;
    font-size: 1.05rem;
}

.comic-button {
    display: inline-block;
    padding: 12px 28px;
    background-color: #2563eb;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 10px;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.comic-button:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

/* Hidden comic ID */
.comic-id {
    color: transparent;
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0.05;
    margin-left: 50px;
    user-select: text;
}

/* NotFound */
.comic-not-found {
    max-width: 620px;
    margin: 60px auto;
    padding: 40px 24px;
    text-align: center;
    border-radius: 16px;
    background: #f5f5f5;
    color: #292929;
}

.comic-not-found .error-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.comic-not-found h1 {
    font-size: 2rem;
    margin-bottom: 12px;
}

.comic-not-found p {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.comic-not-found .comic-button {
    display: inline-block;
    padding: 12px 22px;
    border-radius: 8px;
    background: #198754;
    color: white;
    text-decoration: none;
    font-weight: 600;
}

.comic-not-found .comic-button:hover {
    background: #146c43;
}

/* Gallery */
.comic-edition-navigation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 6px;
    width: 100%;
    max-width: 1150px;
    box-sizing: border-box;
    margin: 10px auto;
    padding: 18px 30px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.home-page {
    background: transparent;
}

/* Editions link below cover */
.edition-gallery-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 30%;
    max-width: 330px;
    min-height: 38px;
    margin-top: 0;
    margin-right: 10px;
    padding: 5px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

/* Edition numbers */
.edition-number-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 44px;
    min-width: 44px;
    height: 38px;
    min-height: 38px;
    padding: 0 4px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

.edit-marvel .edition-gallery-link,
.edit-marvel .edition-number-link.is-current {
    background-color: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.edit-dc .edition-gallery-link,
.edit-dc .edition-number-link.is-current {
    background-color: #ea580c;
    border-color: #ea580c;
    color: #fff;
}

.edit-outra .edition-gallery-link,
.edit-outra .edition-number-link.is-current {
    background-color: #ca8a04;
    border-color: #ca8a04;
    color: #fff;
}

.edit-info .edition-gallery-link,
.edit-info .edition-number-link.is-current {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.edition-gallery-link:hover {
    filter: brightness(0.92);
}

.edition-number-link:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Selected edition */
.edition-number-link.is-current {
    font-weight: 700;
    pointer-events: none;
}

.edition-gallery-link:focus-visible,
.edition-number-link:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
}

.edition-number-link.is-current {
    background-color: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
    font-weight: 700;
    pointer-events: none;
}

.edit-marvel .edition-number-link.is-current {
    background-color: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}

.edit-dc .edition-number-link.is-current {
    background-color: #ea580c;
    border-color: #ea580c;
    color: #ffffff;
}

.edit-outra .edition-number-link.is-current {
    background-color: #ca8a04;
    border-color: #ca8a04;
    color: #ffffff;
}

.edit-info .edition-number-link.is-current {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

/* Gallery page */
.comic-gallery-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Gallery header */
.comic-gallery-header {
    margin-bottom: 24px;
    text-align: center;
}

.comic-gallery-header h1 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.15;
    font-weight: 800;
    text-align: center;
}

.comic-gallery-header p {
    margin: 0 0 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #4b5563;
    text-align: center;
}

.comic-gallery-page.edit-marvel .comic-gallery-header h1 {
    color: #16a34a;
}

.comic-gallery-page.edit-dc .comic-gallery-header h1 {
    color: #ea580c;
}

.comic-gallery-page.edit-outra .comic-gallery-header h1 {
    color: #ca8a04;
}

.comic-gallery-page.edit-info .comic-gallery-header h1 {
    color: #2563eb;
}

/* Gallery grid */
.comic-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 20px 14px;
    align-items: start;
}

/* Gallery item */
.comic-gallery-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

/* Full cover */
.comic-gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: contain;
    border-radius: 6px;
    background: #e5e7eb;
    transition: transform 0.2s ease;
}

/* Edition information */
.comic-gallery-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
    text-align: center;
}

.comic-gallery-number,
.comic-gallery-price {
    display: block;
    width: 100%;
    line-height: 1.4;
    font-weight: 700;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

.comic-gallery-price {
    font-size: 0.90rem;
    font-weight: 500;
    color: #4b5563;
}

/* Missing cover */
.comic-gallery-no-cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    aspect-ratio: 2 / 3;
    box-sizing: border-box;
    padding: 8px;
    text-align: center;
    background: #e5e7eb;
    border-radius: 6px;
}

.comic-gallery-item:focus-visible,
.edition-thumbnail:focus-visible,
.edition-gallery-link:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 4px;
}

.comic-gallery-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    margin-bottom: 24px;
    font-size: 0.95rem;
    text-align: center;
    color: inherit;
}

.summary-count,
.summary-period,
.summary-value,
.summary-pages {
    font-weight: 700;
}

.summary-count {
    color: #16a34a;
}

.summary-period {
    color: #3b82f6;
}

.summary-value {
    color: #B91C1C;
}

.summary-pages {
    color: #F97316;
}

.summary-separator {
    color: inherit;
}

/* Volume info */
.comic-volume-navigation,
.comic-gallery-volumes {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: 8px;
}

.comic-volume-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.15s ease;
}

/* Marvel */
.edit-marvel .comic-volume-link:hover,
.edit-marvel .comic-volume-link.is-current {
    background-color: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

/* DC */
.edit-dc .comic-volume-link:hover,
.edit-dc .comic-volume-link.is-current {
    background-color: #ea580c;
    border-color: #ea580c;
    color: #fff;
}

/* Other publishers */
.edit-outra .comic-volume-link:hover,
.edit-outra .comic-volume-link.is-current {
    background-color: #ca8a04;
    border-color: #ca8a04;
    color: #fff;
}

/* Informative publications */
.edit-info .comic-volume-link:hover,
.edit-info .comic-volume-link.is-current {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.comic-volume-link:hover {
    transform: translateY(-1px);
}

.comic-volume-link.is-current {
    pointer-events: none;
}

.comic-volume-link:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
}

/* Comic title and volume buttons */
.comic-heading-title,
.comic-gallery-title {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
}

.comic-heading-title h1,
.comic-gallery-title h1 {
    margin: 0;
}

.comic-volume-navigation,
.comic-gallery-volumes {
    margin-left: 0;
    flex-shrink: 0;
}

/* Tablet mode */
@media (max-width: 900px) {
    .comic-card {
        grid-template-columns: 260px minmax(0, 1fr);
        gap: 28px;
        padding: 24px;
    }

    .comic-cover {
        max-width: 260px;
    }

    .comic-info-row {
        gap: 12px;
    }

    /* Fist row */
    .info-published {
        min-width: 135%;
    }

    .info-price strong {
        margin-left: 17px;
        min-width: 90%;
    }

    .comic-info-item strong {
        font-size: 0.7rem;
    }

    .comic-info-row-first .comic-info-item strong {
        padding: 8px 4px;
    }

    /* Second row */
    .comic-info-row-green .comic-info-item strong {
        font-size: 0.8rem;
        padding: 8px 6px;
    }

    .comic-info-item span {
        font-size: 0.75rem;
    }
}

/* Cell mode */
@media (max-width: 700px) {
    .comic-card {
        grid-template-columns: 1fr;
        gap: 22px;
        padding: 20px;
    }

    .comic-cover-container {
        justify-content: center;
    }

    .comic-cover {
        max-width: 280px;
        margin: 0 auto;
    }

    .comic-heading {
        flex-direction: column;
        align-items: center;
        gap: 14px;
        text-align: center;
    }

    .comic-heading-title {
        text-align: center;
    }

    .comic-heading-logos {
        justify-content: center;
    }

    .comic-info-row,
    .comic-info-row-three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .info-published {
        min-width: 100%;
    }

    .info-price strong {
        margin-left: 0px;
        min-width: 100%;
    }

    .comic-info-item strong {
        font-size: 0.9rem;
    }

    .comic-info-row-first .comic-info-item strong {
        padding: 8px 4px;
    }

    /* Second row */
    .comic-info-row-green .comic-info-item strong {
        font-size: 0.9rem;
        padding: 8px 6px;
    }

    .comic-info-item span {
        font-size: 0.75rem;
    }

    .comic-heading-title,
    .comic-gallery-title {
        gap: 8px;
    }

    .comic-flags {
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .comic-volume-navigation {
        flex-shrink: 0;
    }

    .comic-flags-items {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 6px;
        width: 100%;
    }
}

/* Small cell mode */
@media (max-width: 480px) {
    .comic-edition-navigation {
        gap: 10px;
        padding: 14px 0;
    }

    .edition-gallery-link {
        width: 30%;
        min-height: 38px;
        padding: 5px 10px;
        font-size: 0.9rem;
    }

    .edition-number-link {
        width: 44px;
        min-width: 44px;
        height: 38px;
        min-height: 38px;
        padding: 0 4px;
        font-size: 0.9rem;
    }

    .comic-gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px 10px;
    }

    .comic-gallery-page {
        padding: 16px 10px;
    }

    .comic-gallery-number {
        font-size: 0.85rem;
    }

    .comic-gallery-price {
        font-size: 0.75rem;
    }
}

/* Small cell mode - Gallery and navigation */
@media (max-width: 600px) {
    .comic-flags {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .edition-gallery-link,
    .comic-volume-navigation {
        flex: 0 0 auto;
        justify-content: center;
    }

    .comic-volume-navigation {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
    }

    .comic-flags-items {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
        gap: 6px;
        justify-content: center;
        align-items: center;
    }

    .comic-flags-items span {
        display: inline-flex;
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* Very small cell mode */
@media (max-width: 430px) {
    .comic-card {
        padding: 16px;
    }

    .comic-heading-title h1 {
        font-size: 1.7rem;
    }

    .comic-info-row,
    .comic-info-row-three {
        grid-template-columns: 1fr;
    }

    .comic-flags {
        gap: 6px;
    }
}