/* Combo step layout ("combo-flow")
 *
 * Reusable, modern layout for written combo cards (.combo-step-card).
 *
 * Features:
 *   - Grid layout: sticky Yu-Gi-Oh card art (59:86 aspect ratio) on desktop, clean stacked layout on mobile.
 *   - Connected action timeline: each play/sentence is its own line with a numbered node and connecting line.
 *   - Callout note (.combo-note): illuminated lightbulb tip box for rulings / phase notes.
 *   - Theme-adaptive: automatically inherits --accent-color and page typography if defined.
 *   - OCGcore-safe: preserves all text, bolding, and structure for engine verification.
 */

.combo-flow {
    --combo-accent: var(--accent-color, #3b82f6);
    --combo-accent-2: #1d4ed8;
    --combo-note-accent: #fbbf24;
    width: 100%;
}

/* Card */
.combo-flow .combo-step-card {
    position: relative;
    width: 100%;
    max-width: 48rem;
    padding: 1.25rem 1.25rem 1.25rem 1.5rem;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.combo-flow .combo-step-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.55);
}

.combo-flow .combo-step-card::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--combo-accent), transparent);
    opacity: 0.85;
}

/* Image column + text column: supports nested wrappers or flex classes directly on the card */
.combo-flow .combo-step-card[class*="flex-col"][class*="md:flex-row"],
.combo-flow .combo-step-card > .content-wrapper,
.combo-flow .combo-step-card > [class*="flex-col"][class*="md:flex-row"],
.combo-flow .combo-step-card > div:first-child {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 1rem !important;
    align-items: start !important;
}

@media (min-width: 640px) {
    .combo-flow .combo-step-card[class*="flex-col"][class*="md:flex-row"],
    .combo-flow .combo-step-card > .content-wrapper,
    .combo-flow .combo-step-card > [class*="flex-col"][class*="md:flex-row"],
    .combo-flow .combo-step-card > div:first-child {
        grid-template-columns: 140px minmax(0, 1fr) !important;
        gap: 1.5rem !important;
    }
}

/* Card image container */
.combo-flow .combo-step-card .card-image-container,
.combo-flow .combo-step-card [id$="-img-container"] {
    width: 100%;
    max-width: 140px;
    justify-self: center;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
}

@media (min-width: 640px) {
    .combo-flow .combo-step-card .card-image-container,
    .combo-flow .combo-step-card [id$="-img-container"] {
        position: sticky;
        top: 1rem;
    }
}

/* While placeholder text is showing (before CardLoader injects the img) */
.combo-flow .combo-step-card .card-image-container:not(:has(img)),
.combo-flow .combo-step-card [id$="-img-container"]:not(:has(img)) {
    aspect-ratio: 59 / 86;
    min-height: 180px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0.75rem !important;
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    background-color: rgba(15, 23, 42, 0.6) !important;
    border: 1px dashed rgba(148, 163, 184, 0.3) !important;
    border-radius: 0.5rem;
}

/* Once card image is loaded */
.combo-flow .combo-step-card .card-image-container img,
.combo-flow .combo-step-card [id$="-img-container"] img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    border-radius: 0.5rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

/* Step body column */
.combo-flow .combo-step-body,
.combo-flow .combo-step-card .card-image-container + div,
.combo-flow .combo-step-card [id$="-img-container"] + div {
    min-width: 0;
}

/* Header: step number + title */
.combo-flow .combo-step-header,
.combo-flow .combo-step-card .card-image-container + div > .flex:first-child,
.combo-flow .combo-step-card [id$="-img-container"] + div > .flex:first-child,
.combo-flow .combo-step-body > .flex:first-child {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.combo-flow .combo-step-header > span,
.combo-flow .combo-step-card .card-image-container + div > .flex:first-child > span,
.combo-flow .combo-step-card [id$="-img-container"] + div > .flex:first-child > span,
.combo-flow .combo-step-body > .flex:first-child > span {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    margin-right: 0 !important;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    color: #fff;
    background: linear-gradient(135deg, var(--combo-accent), var(--combo-accent-2));
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.35);
}

.combo-flow .combo-step-header h3,
.combo-flow .combo-step-card .card-image-container + div > .flex:first-child h3,
.combo-flow .combo-step-card [id$="-img-container"] + div > .flex:first-child h3,
.combo-flow .combo-step-body > .flex:first-child h3 {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.3;
    font-weight: 700;
}

/* White titles and card names suit dark cards. Pages with light step cards put
   class="combo-light" on <body> and keep their own colours (see the end of this file).
   :where() keeps these selectors as specific as before. */
:where(body:not(.combo-light)) .combo-flow .combo-step-header h3,
:where(body:not(.combo-light)) .combo-flow .combo-step-card .card-image-container + div > .flex:first-child h3,
:where(body:not(.combo-light)) .combo-flow .combo-step-card [id$="-img-container"] + div > .flex:first-child h3,
:where(body:not(.combo-light)) .combo-flow .combo-step-body > .flex:first-child h3 {
    color: #fff;
}

/* Actions: one sentence per line on a numbered timeline */
.combo-flow .combo-actions {
    margin: 0;
    counter-reset: combo-action;
}

.combo-flow .combo-action {
    display: block;
    position: relative;
    padding: 0.35rem 0 0.35rem 2.2rem;
    line-height: 1.6;
}

.combo-flow .combo-action::before {
    counter-increment: combo-action;
    content: counter(combo-action);
    position: absolute;
    left: 0;
    top: 0.45rem;
    width: 1.4rem;
    height: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.18);
    border: 1px solid rgba(96, 165, 250, 0.45);
}

/* The connecting vertical line */
.combo-flow .combo-action::after {
    content: '';
    position: absolute;
    left: 0.7rem;
    top: 2rem;
    bottom: -0.45rem;
    width: 1px;
    background: rgba(96, 165, 250, 0.28);
}

.combo-flow .combo-action:last-child::after {
    display: none;
}

.combo-flow .combo-actions strong {
    font-weight: 700;
}

:where(body:not(.combo-light)) .combo-flow .combo-actions strong {
    color: #fff;
}

/* "Why it works" / Tips note */
.combo-flow .combo-note {
    position: relative;
    margin-top: 1rem;
    padding: 0.75rem 0.9rem 0.75rem 2.5rem;
    line-height: 1.6;
    border-radius: 0.6rem;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-left: 3px solid var(--combo-note-accent);
}

.combo-flow .combo-note::before {
    content: '\f0eb';
    font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    left: 0.9rem;
    top: 0.8rem;
    color: var(--combo-note-accent);
}

/* Arrows between steps */
.combo-flow > .w-full > .fa-arrow-down,
.combo-flow > .w-full > [class*="fa-arrow-down"] {
    font-size: 1.35rem;
    opacity: 0.65;
}

@media (max-width: 639px) {
    .combo-flow .combo-step-card {
        padding: 1rem 1rem 1rem 1.25rem;
    }

    .combo-flow .combo-step-header h3,
    .combo-flow .combo-step-card .card-image-container + div > .flex:first-child h3,
    .combo-flow .combo-step-card [id$="-img-container"] + div > .flex:first-child h3,
    .combo-flow .combo-step-body > .flex:first-child h3 {
        font-size: 1.1rem;
    }
}

@media print {
    .combo-flow .combo-step-card .card-image-container,
    .combo-flow .combo-step-card [id$="-img-container"] {
        position: static;
    }
}

/* Light step cards (<body class="combo-light">): titles and card names keep the page's
   colours, and the timeline numbers and notes switch to light versions. */
body.combo-light .combo-flow .combo-action::before {
    color: #1d4ed8;
    background: #dbeafe;
    border-color: #93c5fd;
}

body.combo-light .combo-flow .combo-action::after {
    background: rgba(37, 99, 235, 0.25);
}

body.combo-light .combo-flow .combo-note {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(217, 119, 6, 0.25);
    border-left-color: var(--combo-note-accent);
}

body.combo-light .combo-flow .combo-note::before {
    color: #d97706;
}
