/**
 * Tarot Shared Reading — Public Page Styles
 *
 * @package AI_Tarot_Reader
 * @since   3.20.3
 */

.atsr-shared-reading {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    font-family: inherit;
    color: inherit;
}

/* ── Header ── */
.atsr-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.atsr-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.atsr-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
    color: inherit;
}

.atsr-meta {
    color: #6b7280;
    font-size: 0.9rem;
    margin: 0.2rem 0;
}

.atsr-views {
    color: #9ca3af;
    font-size: 0.82rem;
    margin-top: 0.5rem;
}

/* ── Sections ── */
.atsr-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.atsr-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #6b46c1;
    margin: 0 0 1rem;
}

/* ── Question ── */
.atsr-question-text {
    margin: 0;
    padding: 0.75rem 1rem;
    border-left: 3px solid #9f7aea;
    background: #faf5ff;
    border-radius: 0 8px 8px 0;
    color: #374151;
    font-style: italic;
    font-size: 1rem;
    line-height: 1.6;
}

/* ── Cards Grid ── */
.atsr-cards-grid {
    display: grid;
    gap: 16px;
    justify-content: center;
}

/* ── Spread background modifier ── */
/* When a spread has a background set in the designer, the .atsr-cards section
   gets .atsr-spread-bg plus an inline style.  We remove the default white
   background so the spread image/colour shows through, adjust padding to give
   the image breathing room, and ensure text over dark backgrounds is readable. */
.atsr-spread-bg {
    background: transparent; /* overridden by inline style */
    border-color: transparent;
    padding-bottom: 2rem; /* extra room so card labels don't clip at the bottom */
}

.atsr-spread-bg .atsr-cards-grid {
    /* Lift cards visually against any background */
    filter: drop-shadow( 0 6px 20px rgba(0,0,0,0.35) );
}

/* Section heading inside a background — white for legibility on dark images */
.atsr-spread-bg h2 {
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* Card position label and name — white with shadow on dark backgrounds */
.atsr-spread-bg .atsr-card-position {
    color: #e0d7ff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

.atsr-spread-bg .atsr-card-name {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

.atsr-spread-bg .atsr-card-reversed {
    color: #d1d5db;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

.atsr-card-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    width: 160px; /* Match the grid column width so cards never collapse narrower */
}

.atsr-card-image {
    width: 100%;
    max-width: 160px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.atsr-card-image img {
    width: 100%;
    height: auto;
    display: block;
}

.atsr-card-placeholder {
    width: 100%;
    aspect-ratio: 2 / 3;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.5rem;
    text-align: center;
}

.atsr-card-position {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b46c1;
}

.atsr-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a2e;
}

.atsr-card-reversed {
    font-size: 0.75rem;
    color: #9ca3af;
    font-style: italic;
}

/* ── Interpretation ── */
.atsr-interpretation-text {
    font-size: 0.95rem;
    line-height: 1.75;
    color: #374151;
}

.atsr-interpretation-text h1,
.atsr-interpretation-text h2,
.atsr-interpretation-text h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 1.25rem 0 0.5rem;
}

.atsr-interpretation-text p {
    margin: 0 0 1rem;
}

.atsr-interpretation-text strong {
    color: #4c1d95;
}

/* ── Attribution ── */
.atsr-attribution {
    text-align: center;
    color: #9ca3af;
    font-size: 0.8rem;
    margin-top: 2rem;
}

.atsr-attribution a {
    color: #6b46c1;
    text-decoration: none;
}

/* ── Error ── */
.atsr-error {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
    font-size: 1rem;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .atsr-title { font-size: 1.4rem; }
    .atsr-section { padding: 1rem; }
    .atsr-cards-grid { gap: 12px; }
}

/* ==========================================================================
   3.26.4: cards fit the box, and their labels are easier to read
   ========================================================================== */

.atsr-cards h2 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 1.25rem;
}

.atsr-cards-grid {
    grid-template-columns: repeat(var(--atsr-cols, 5), minmax(0, 150px));
    gap: 22px 16px;
}

.atsr-card-item {
    width: auto;
    min-width: 0;
}

.atsr-card-image {
    max-width: 150px;
}

.atsr-card-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.atsr-card-position {
    font-size: 0.82rem;
    line-height: 1.3;
    color: #5b21b6;
}

.atsr-card-name {
    font-size: 1.05rem;
    line-height: 1.3;
    font-weight: 700;
}

.atsr-card-reversed {
    font-size: 0.85rem;
    color: #6b7280;
}

@media (max-width: 760px) {
    .atsr-cards-grid.atsr-cols-4,
    .atsr-cards-grid.atsr-cols-5 {
        grid-template-columns: repeat(3, minmax(0, 150px));
    }
}

@media (max-width: 480px) {
    .atsr-cards-grid.atsr-cols-3,
    .atsr-cards-grid.atsr-cols-4,
    .atsr-cards-grid.atsr-cols-5 {
        grid-template-columns: repeat(2, minmax(0, 150px));
    }
    .atsr-card-name { font-size: 0.95rem; }
}
