/* ==============================================
   RELIABILITY — Problem Section (Before / After)
   SRE / incident-management aesthetic.
   Before column reads like an open incident on
   repeat; After reads like a closed, permanent
   resolution.
   ============================================== */

/* Parent grid defines the shared row structure both columns share via subgrid:
   row 1 = title
   row 2..6 = steps 1..5 (right column leaves row 6 empty by design)
   row 7 = outcome band
   row 8 = scorecard
   Each row auto-sizes to the tallest content across both columns, so step N
   on the left always aligns with step N on the right.
   row-gap stays at 0 so step rows sit flush — each step's padding-bottom
   supplies breathing room and the spine reaches the next icon cleanly. */
.sol-workflow-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows:
        auto /* 1: title */
        auto auto auto auto auto /* 2-6: steps */
        auto /* 7: outcome */
        auto; /* 8: scorecard */
    column-gap: 32px;
    row-gap: 0;
    max-width: 1080px;
    margin: 48px auto 0;
}

/* ---------------------------------------------
   Column shells (subgrid containers)
---------------------------------------------- */

.sol-before-box,
.sol-after-box {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    padding: 32px 30px 28px;
    display: grid;
    grid-template-rows: subgrid;
    grid-row: 1 / -1;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.55);
}

.sol-before-box {
    background:
        radial-gradient(ellipse at 85% 10%, rgba(255, 100, 100, 0.16) 0%, transparent 55%),
        radial-gradient(ellipse at 10% 95%, rgba(255, 60, 60, 0.08) 0%, transparent 55%),
        linear-gradient(180deg, #1a0d10 0%, #120a0c 100%);
    border: 1px solid rgba(255, 100, 100, 0.28);
}

.sol-after-box {
    background:
        radial-gradient(ellipse at 15% 85%, rgba(52, 248, 182, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse at 90% 10%, rgba(0, 212, 255, 0.07) 0%, transparent 55%),
        linear-gradient(180deg, #0a1a15 0%, #071613 100%);
    border: 1px solid rgba(52, 248, 182, 0.3);
}

/* Decorative corner accent — gives each column a
   subtle "case file" top-left tag look. */
.sol-before-box::before,
.sol-after-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 120px;
    height: 3px;
    border-radius: 0 0 3px 0;
    pointer-events: none;
}

.sol-before-box::before {
    background: linear-gradient(90deg, var(--before-red) 0%, transparent 100%);
    box-shadow: 0 0 20px rgba(255, 100, 100, 0.4);
}

.sol-after-box::before {
    background: linear-gradient(90deg, var(--el-green) 0%, transparent 100%);
    box-shadow: 0 0 20px rgba(52, 248, 182, 0.35);
}

/* ---------------------------------------------
   Column header (icon + label)
---------------------------------------------- */

.sol-before-title,
.sol-after-title {
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
    font-size: 22px;
    line-height: 28px;
    font-weight: 800;
}

.sol-before-title {
    color: var(--before-red);
}

.sol-after-title {
    color: var(--el-green);
}

.sol-before-title img,
.sol-after-title img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

/* ---------------------------------------------
   Steps — each step sits on its own grid row
   (rows 2-6), driven by the inline `--step`
   custom property set in the HTML.

   min-height makes every step row at least the
   same fixed size, so all 5 step rows end up
   visually uniform. The extra space above each
   step's content gives the spine room to breathe.
---------------------------------------------- */

.sol-step {
    grid-row: calc(var(--step, 1) + 1);
    display: flex;
    gap: 16px;
    position: relative;
    padding-bottom: 22px;
    min-height: 128px;
}

.sol-step-last {
    padding-bottom: 0;
}

/* Gradient spine connecting each step to the next. The step's border box
   stretches to fill its grid row, so `bottom: -6px` lands at the next icon. */
.sol-before-box .sol-step:not(.sol-step-last)::after {
    content: '';
    position: absolute;
    left: 23px;
    top: 52px;
    bottom: -6px;
    width: 2px;
    background: linear-gradient(
        180deg,
        rgba(255, 100, 100, 0.55) 0%,
        rgba(255, 100, 100, 0.15) 50%,
        rgba(255, 100, 100, 0.55) 100%
    );
    z-index: 0;
    pointer-events: none;
}

.sol-after-box .sol-step:not(.sol-step-last)::after {
    content: '';
    position: absolute;
    left: 23px;
    top: 52px;
    bottom: -6px;
    width: 2px;
    background: linear-gradient(
        180deg,
        rgba(52, 248, 182, 0.55) 0%,
        rgba(52, 248, 182, 0.2) 50%,
        rgba(52, 248, 182, 0.55) 100%
    );
    z-index: 0;
    pointer-events: none;
}

/* ---------------------------------------------
   Step icon (keep existing SVG layout,
   add an outer ring + glow halo)
---------------------------------------------- */

.sol-step-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    overflow: visible;
}

/* Outer gradient ring — gives the icon a polished halo. */
.sol-step-icon::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    padding: 1px;
    pointer-events: none;
    opacity: 0.5;
    background: linear-gradient(135deg, currentColor 0%, transparent 60%);
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.sol-step-icon-red {
    background: linear-gradient(135deg, #ff6464 0%, #b83333 100%);
    color: var(--before-red);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 4px 16px -4px rgba(255, 100, 100, 0.5);
}

.sol-step-icon-green {
    background: linear-gradient(135deg, #34f8b6 0%, #1e9a73 100%);
    color: var(--el-green);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 4px 16px -4px rgba(52, 248, 182, 0.5);
}

.sol-step-icon img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* ---------------------------------------------
   Step body
---------------------------------------------- */

.sol-step > div:last-child {
    flex: 1;
    padding-top: 2px;
}

.sol-step-title {
    font-size: 17px;
    line-height: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.sol-step-desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 21px;
}

/* Amber "broadcast" callout — styled as a chat bubble. Solid background so
   the tail can be filled with the exact same color without seam artifacts. */
.sol-step-callout {
    --callout-bg: #2a1d0a;
    --callout-border: rgba(251, 191, 36, 0.45);
    display: inline-block;
    background: var(--callout-bg);
    border: 1px solid var(--callout-border);
    border-radius: 8px;
    padding: 7px 12px;
    color: var(--warning);
    font-size: 14px;
    line-height: 20px;
    position: relative;
    font-style: italic;
    margin-top: 2px;
}

/* Outer triangle = border color */
.sol-step-callout::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 13px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 7px solid var(--callout-border);
}

/* Inner triangle = bubble fill color (matches background exactly) */
.sol-step-callout::after {
    content: '';
    position: absolute;
    left: -5px;
    top: 14px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 6px solid var(--callout-bg);
}

/* Red data-badge stat — styled like a monitoring metric */
.sol-step-stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 5px 10px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--before-red);
    border: 1px solid rgba(255, 100, 100, 0.4);
    border-radius: 4px;
    background: rgba(255, 100, 100, 0.08);
    letter-spacing: 0.4px;
    line-height: 15px;
    white-space: nowrap;
}

.sol-step-stat::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--before-red);
    box-shadow: 0 0 6px currentColor;
    flex-shrink: 0;
}

/* Citation pill (small, subtle) */
.sol-step .citation-pill,
.sol-summary-box .citation-pill {
    display: inline-block;
    background: rgba(160, 174, 192, 0.1);
    color: var(--text-link-subtle);
    padding: 1px 5px;
    border-radius: 5px;
    font-size: 7px;
    line-height: 1.4;
    font-weight: 500;
    text-decoration: none;
    margin-left: 6px;
    transition: all 0.2s ease;
    border: 1px solid rgba(160, 174, 192, 0.25);
    vertical-align: middle;
    white-space: nowrap;
}

.sol-step .citation-pill:hover,
.sol-summary-box .citation-pill:hover {
    background: rgba(160, 174, 192, 0.2);
    color: var(--text-secondary);
    border-color: rgba(160, 174, 192, 0.4);
}

/* ---------------------------------------------
   Outcome band — row 7 of the shared subgrid, so
   both columns' outcomes sit at the same y.
---------------------------------------------- */

.sol-outcome {
    grid-row: 7;
    margin-top: 10px;
    margin-bottom: 26px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    position: relative;
}

.sol-outcome-before {
    background:
        repeating-linear-gradient(135deg, rgba(255, 100, 100, 0.04) 0 10px, transparent 10px 20px),
        rgba(255, 100, 100, 0.09);
    border: 1px dashed rgba(255, 100, 100, 0.45);
    color: var(--before-red);
}

.sol-outcome-after {
    background:
        repeating-linear-gradient(135deg, rgba(52, 248, 182, 0.04) 0 10px, transparent 10px 20px),
        rgba(52, 248, 182, 0.1);
    border: 1px solid rgba(52, 248, 182, 0.45);
    color: var(--el-green);
}

.sol-outcome-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.35);
    border: 1.5px solid currentColor;
    line-height: 1;
}

.sol-outcome-body {
    flex: 1;
}

.sol-outcome-body strong {
    display: block;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 2px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}

.sol-outcome-body span {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
}

/* ---------------------------------------------
   Summary scorecard (bottom of each column)
---------------------------------------------- */

/* Scorecard sits on row 8 of the shared subgrid — both columns' scorecards
   align at the same y, regardless of what's above them. */
.sol-summary-box {
    grid-row: 8;
    position: relative;
    padding: 24px 20px 18px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sol-before-box .sol-summary-box {
    border-color: rgba(255, 100, 100, 0.22);
}

.sol-after-box .sol-summary-box {
    border-color: rgba(52, 248, 182, 0.22);
}

.sol-summary-header {
    position: absolute;
    top: -9px;
    left: 20px;
    padding: 2px 10px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    border-radius: 3px;
    white-space: nowrap;
}

.sol-before-box .sol-summary-header {
    background: #120a0c;
    color: var(--before-red);
    border: 1px solid rgba(255, 100, 100, 0.3);
}

.sol-after-box .sol-summary-header {
    background: #071613;
    color: var(--el-green);
    border: 1px solid rgba(52, 248, 182, 0.3);
}

.sol-summary-row {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 12px;
    align-items: start;
}

.sol-summary-row img {
    width: 22px;
    height: 22px;
    opacity: 0.75;
    margin-top: 1px;
}

.sol-summary-row > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sol-summary-label {
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 9px;
    letter-spacing: 1.4px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.sol-summary-value-red {
    font-size: 14px;
    line-height: 19px;
    font-weight: 700;
    color: var(--before-red);
}

.sol-summary-value-green {
    font-size: 14px;
    line-height: 19px;
    font-weight: 700;
    color: var(--el-green);
}

/* ---------------------------------------------
   Responsive
---------------------------------------------- */

@media (max-width: 960px) {
    /* On mobile the two columns stack, so the subgrid no longer has a
       counterpart to align with. Drop back to plain block layout in each
       column; the per-element grid-row assignments become no-ops. */
    .sol-workflow-grid {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .sol-before-box,
    .sol-after-box {
        display: block;
        max-width: 640px;
        margin: 0 auto;
        width: 100%;
    }
}

@media (max-width: 600px) {
    .sol-before-box,
    .sol-after-box {
        padding: 26px 22px 22px;
    }

    .sol-before-title,
    .sol-after-title {
        font-size: 20px;
        line-height: 26px;
    }

    .sol-step-title {
        font-size: 16px;
        line-height: 22px;
    }

    .sol-outcome {
        padding: 10px 14px;
    }
}
