/* ============================================================
   stack.css — The Stack Builder (/stack)

   Tokens come from css/variables.css. Per-role colour arrives as an
   inline --stk-accent on .stk-hero .stk-role and on .stk-result, so
   every use here carries a fallback: var(--stk-accent, #ff5c35).
   ============================================================ */

/* ── Shared ─────────────────────────────────────────────── */

.stk-eyebrow {
    display: inline-block;
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--stk-accent, var(--accent-orange));
    margin-bottom: var(--space-4);
}

/* ── Chooser hero ───────────────────────────────────────── */

.stk-hero {
    position: relative;
    padding: var(--space-20) 0 var(--space-24);
    overflow: hidden;
}

/* Soft off-centre glow; purely decorative. */
.stk-hero::before {
    content: '';
    position: absolute;
    top: -220px;
    left: 50%;
    width: 760px;
    height: 620px;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(255, 92, 53, 0.16), transparent 68%);
    pointer-events: none;
}

.stk-hero-inner {
    position: relative;
    text-align: center;
}

.stk-h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, var(--text-5xl));
    font-weight: 800;
    line-height: 1.07;
    letter-spacing: -0.02em;
    margin: 0 0 var(--space-5);
}

.stk-h1-grad {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.stk-sub {
    max-width: 620px;
    margin: 0 auto var(--space-12);
    color: var(--text-muted);
    font-size: var(--text-md);
    line-height: 1.65;
}

.stk-sub strong {
    color: var(--text);
    font-weight: 600;
}

/* Role grid — two up on desktop, one up on phones. */
.stk-roles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    max-width: 880px;
    margin: 0 auto;
    text-align: left;
}

.stk-role {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: border-color var(--transition-base),
                transform var(--transition-base),
                background var(--transition-base);
}

/* Accent wash that only appears on hover. */
.stk-role::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
                var(--stk-accent, var(--accent-orange)) 0%,
                transparent 62%);
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.stk-role:hover {
    border-color: var(--stk-accent, var(--accent-orange));
    background: var(--surface-2);
    transform: translateY(-2px);
}

.stk-role:hover::after { opacity: 0.08; }

.stk-role:focus-visible {
    outline: 2px solid var(--stk-accent, var(--accent-orange));
    outline-offset: 2px;
}

.stk-role-ic {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--stk-accent, #ff5c35) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--stk-accent, #ff5c35) 34%, transparent);
}

.stk-role-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.stk-role-label {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text);
}

.stk-role-blurb {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.5;
}

.stk-role-go {
    flex: 0 0 auto;
    margin-left: auto;
    font-size: var(--text-xl);
    color: var(--text-faint);
    transition: color var(--transition-base), transform var(--transition-base);
}

.stk-role:hover .stk-role-go {
    color: var(--stk-accent, var(--accent-orange));
    transform: translateX(3px);
}

.stk-foot-note {
    margin-top: var(--space-10);
    font-size: var(--text-sm);
    color: var(--text-faint);
}

/* ── Result header ──────────────────────────────────────── */

.stk-result { padding: var(--space-12) 0 var(--space-20); }

.stk-result-head {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    padding: var(--space-6);
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--stk-accent, #ff5c35) 14%, transparent),
            transparent 70%),
        var(--surface);
    border: 1px solid color-mix(in srgb, var(--stk-accent, #ff5c35) 26%, var(--border));
    border-radius: var(--radius-xl);
}

.stk-result-ic {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    font-size: 2.1rem;
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--stk-accent, #ff5c35) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--stk-accent, #ff5c35) 38%, transparent);
}

.stk-result-copy { min-width: 0; }
.stk-result-copy .stk-eyebrow { margin-bottom: var(--space-2); }

.stk-result-h1 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4.4vw, var(--text-3xl));
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0 0 var(--space-2);
}

.stk-result-sub {
    margin: 0;
    color: var(--text-muted);
    font-size: var(--text-base);
    line-height: 1.6;
}

/* ── Controls ───────────────────────────────────────────── */

.stk-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin: var(--space-6) 0 var(--space-10);
}

.stk-budget {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.stk-budget-label {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-right: var(--space-1);
}

.stk-chip {
    padding: 7px var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.stk-chip:hover {
    color: var(--text);
    border-color: var(--border-hover);
}

.stk-chip.is-on {
    color: var(--bg);
    font-weight: 600;
    background: var(--stk-accent, var(--accent-orange));
    border-color: var(--stk-accent, var(--accent-orange));
}

.stk-reroll {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 7px var(--space-4);
    border: 1px dashed var(--border-hover);
    border-radius: var(--radius-pill);
    transition: all var(--transition-fast);
}

.stk-reroll:hover {
    color: var(--text);
    border-color: var(--stk-accent, var(--accent-orange));
    border-style: solid;
}

/* ── The rail: three numbered rungs ─────────────────────── */

.stk-rail { position: relative; }

.stk-rung {
    position: relative;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: var(--space-5);
    padding-bottom: var(--space-12);
}

/* Connector line down the number column. */
.stk-rung:not(.stk-rung--last)::before {
    content: '';
    position: absolute;
    top: 56px;
    bottom: var(--space-4);
    left: 27px;
    width: 2px;
    background: linear-gradient(to bottom,
                color-mix(in srgb, var(--stk-accent, #ff5c35) 55%, transparent),
                var(--border));
}

.stk-rung-num {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--stk-accent, var(--accent-orange));
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--stk-accent, #ff5c35) 40%, transparent);
    border-radius: var(--radius-md);
}

.stk-rung-body { min-width: 0; padding-top: var(--space-2); }

.stk-rung-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 var(--space-2);
}

.stk-rung-note {
    margin: 0 0 var(--space-5);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.stk-rung-link {
    display: inline-block;
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--stk-accent, var(--accent-orange));
    text-decoration: none;
}

.stk-rung-link:hover { text-decoration: underline; }

.stk-empty {
    padding: var(--space-5);
    background: var(--surface);
    border: 1px dashed var(--border-hover);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.stk-empty a { color: var(--stk-accent, var(--accent-orange)); }

/* ── 01 · Tools ─────────────────────────────────────────── */

.stk-tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: var(--space-4);
}

.stk-tool {
    display: flex;
    flex-direction: column;
    padding: var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    border-top: 2px solid var(--tool-color, #888);
    transition: border-color var(--transition-base), transform var(--transition-base);
}

.stk-tool:hover {
    border-color: var(--border-hover);
    border-top-color: var(--tool-color, #888);
    transform: translateY(-2px);
}

.stk-tool-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.stk-tool-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.stk-tool-logo--fb {
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--tool-color, #888);
    background: color-mix(in srgb, var(--tool-color, #888) 16%, transparent);
}

.stk-tool-price {
    flex: 0 0 auto;
    padding: 3px var(--space-2);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    color: var(--text-muted);
}

.stk-tool-price--free {
    background: color-mix(in srgb, var(--accent-green) 18%, transparent);
    color: var(--accent-green);
}

.stk-tool-price--freemium {
    background: color-mix(in srgb, var(--accent-cyan) 18%, transparent);
    color: var(--accent-cyan);
}

.stk-tool-price--paid {
    background: color-mix(in srgb, var(--accent-yellow) 18%, transparent);
    color: var(--accent-yellow);
}

.stk-tool-name {
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    margin-bottom: var(--space-2);
}

.stk-tool-name:hover { color: var(--tool-color, #888); }

.stk-tool-tag {
    flex: 1 1 auto;
    margin: 0 0 var(--space-4);
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-muted);
}

.stk-tool-foot {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.stk-tool-visit {
    flex: 1 1 auto;
    text-align: center;
    padding: 8px var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--bg);
    background: var(--tool-color, #888);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: filter var(--transition-fast);
}

.stk-tool-visit:hover { filter: brightness(1.12); }

.stk-tool-more {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-decoration: none;
}

.stk-tool-more:hover { color: var(--text); }

/* ── 02 · Prompts ───────────────────────────────────────── */

.stk-prompts {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.stk-prompt {
    padding: var(--space-4) var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-base);
}

.stk-prompt:hover { border-color: var(--border-hover); }

.stk-prompt-head {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.stk-prompt-n {
    flex: 0 0 auto;
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--stk-accent, var(--accent-orange));
    opacity: 0.75;
}

.stk-prompt-title {
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    line-height: 1.35;
}

.stk-prompt-title:hover { color: var(--stk-accent, var(--accent-orange)); }

.stk-prompt-desc {
    margin: 0 0 var(--space-3);
    padding-left: calc(var(--space-3) + 12px);
    font-size: var(--text-sm);
    line-height: 1.55;
    color: var(--text-muted);
}

.stk-prompt-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding-left: calc(var(--space-3) + 12px);
}

.stk-prompt-meta {
    font-size: var(--text-xs);
    color: var(--text-faint);
}

.stk-prompt-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: var(--space-5);
}

/* The one button on the page that asks for commitment, so it reads as the
   primary action in the rung rather than as another link. */
.stk-shelf-all {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--bg);
    background: var(--stk-accent, var(--accent-orange));
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: filter var(--transition-fast), transform var(--transition-fast);
}

.stk-shelf-all:hover { filter: brightness(1.1); transform: translateY(-1px); }

.stk-shelf-all.is-on {
    background: var(--accent-green);
    cursor: default;
    transform: none;
}

.stk-prompt-actions .stk-rung-link { margin-top: 0; }

/* ── 03 · Tracks ────────────────────────────────────────── */

.stk-tracks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-4);
}

.stk-track {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--track-color, #888);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition-base), transform var(--transition-base);
}

.stk-track:hover {
    border-color: var(--border-hover);
    border-left-color: var(--track-color, #888);
    transform: translateY(-2px);
}

.stk-track-ic {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--track-color, #888) 16%, transparent);
}

.stk-track-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.stk-track-title {
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.stk-track-desc {
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-muted);
}

.stk-track-meta {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--track-color, #888);
}

/* ── Keep this stack ────────────────────────────────────── */

.stk-keep {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-5);
    margin-top: var(--space-6);
    padding: var(--space-8);
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--stk-accent, #ff5c35) 12%, transparent),
            transparent 65%),
        var(--surface);
    border: 1px solid color-mix(in srgb, var(--stk-accent, #ff5c35) 24%, var(--border));
    border-radius: var(--radius-xl);
}

.stk-keep-copy { flex: 1 1 320px; min-width: 0; }

.stk-keep-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
    margin: 0 0 var(--space-2);
}

.stk-keep-sub {
    margin: 0;
    max-width: 52ch;
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--text-muted);
}

.stk-keep-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* ── Other stacks ───────────────────────────────────────── */

.stk-other {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-10);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
}

.stk-other-label {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-right: var(--space-2);
}

.stk-other-link {
    padding: 6px var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.stk-other-link:hover {
    color: var(--text);
    border-color: var(--stk-accent, var(--accent-orange));
}

/* ── Homepage entry band (rendered by index.php) ─────────── */

.stk-band {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-6);
    padding: var(--space-8);
    background:
        linear-gradient(135deg, rgba(255, 92, 53, 0.13), transparent 62%),
        var(--surface);
    border: 1px solid rgba(255, 92, 53, 0.26);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.stk-band-copy { flex: 1 1 340px; min-width: 0; }

.stk-band-title {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 3.6vw, var(--text-3xl));
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0 0 var(--space-3);
}

.stk-band-sub {
    margin: 0;
    max-width: 54ch;
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-muted);
}

.stk-band-roles {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    flex: 1 1 300px;
}

.stk-band-role {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px var(--space-4);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.stk-band-role:hover {
    border-color: var(--stk-accent, var(--accent-orange));
    background: var(--surface-3);
    transform: translateY(-1px);
}

.stk-band-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px var(--space-4);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent-orange);
    background: transparent;
    border: 1px dashed rgba(255, 92, 53, 0.45);
    border-radius: var(--radius-pill);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.stk-band-all:hover {
    background: rgba(255, 92, 53, 0.1);
    border-style: solid;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 860px) {
    .stk-roles { grid-template-columns: 1fr; }

    .stk-result-head {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }

    .stk-result-ic { width: 60px; height: 60px; font-size: 1.8rem; }
}

@media (max-width: 640px) {
    .stk-hero { padding: var(--space-12) 0 var(--space-16); }

    .stk-rung {
        grid-template-columns: 1fr;
        gap: var(--space-3);
        padding-bottom: var(--space-10);
    }

    /* The connector line has no column to live in once the grid collapses. */
    .stk-rung:not(.stk-rung--last)::before { display: none; }

    .stk-rung-num { width: 44px; height: 44px; font-size: var(--text-sm); }
    .stk-rung-body { padding-top: 0; }

    .stk-prompt-desc,
    .stk-prompt-foot { padding-left: 0; }

    .stk-keep { padding: var(--space-6); }
    .stk-keep-actions { width: 100%; }
    .stk-keep-actions .btn { flex: 1 1 auto; text-align: center; }

    .stk-controls { gap: var(--space-4); }
}
