/* ═══════════════════════════════════════════════════════════
   Steps — guided multi-step journey indicator + panel transition

   A horizontal progress indicator for a funnel/wizard (e.g. Välj
   produkt → Konfigurera → Skapa konto → Checkout). Numbered markers
   with connectors; each .tn-step carries .is-complete or .is-current.
   .tn-step-panel gives the active step a premium fade-up entrance so
   the steps feel like one cohesive flow, not disjoint pages.
   ═══════════════════════════════════════════════════════════ */

.tn-steps {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.tn-step {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

/* Connector — runs from this marker's centre to the next */
.tn-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 16px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--tn-border);
    z-index: 0;
}

.tn-step.is-complete:not(:last-child)::after {
    background: var(--tn-accent);
}

.tn-step-marker {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--tn-bg-card);
    border: 2px solid var(--tn-border);
    color: var(--tn-text-muted);
    font-size: var(--tn-font-size-sm);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    transition: all var(--tn-transition);
}

.tn-step.is-current .tn-step-marker {
    border-color: var(--tn-accent);
    color: var(--tn-accent);
    box-shadow: 0 0 0 4px var(--tn-accent-light);
}

.tn-step.is-complete .tn-step-marker {
    background: var(--tn-accent);
    border-color: var(--tn-accent);
    color: #fff;
}

.tn-step-label {
    font-size: var(--tn-font-size-sm);
    font-weight: 500;
    color: var(--tn-text-secondary);
    max-width: 12ch;
}

.tn-step.is-current .tn-step-label {
    color: var(--tn-text-primary);
    font-weight: 600;
}

.tn-step.is-complete .tn-step-label {
    color: var(--tn-text-primary);
}

/* ── Funnel shell — immersive, full-page stepped layout ──
   Not a small centered card: a full-bleed page with a sticky header
   carrying the step indicator, a centered content column, and a
   back/next nav row. The configurator/cart live in .tn-funnel-body. */
.tn-funnel {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--tn-bg-page);
}

.tn-funnel-head {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: var(--tn-space-lg) var(--tn-page-pad-x);
    background: var(--tn-bg-card);
    border-bottom: 1px solid var(--tn-border);
}

/* Top row of the funnel head — brand on the left, actions (e.g. the
   language toggle) on the right — above the step indicator. */
.tn-funnel-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--tn-space-md);
    margin-bottom: var(--tn-space-md);
}

/* Centre + cap the step indicator so it doesn't stretch on wide screens */
.tn-funnel-steps {
    max-width: 680px;
    margin: 0 auto;
}

/* ── Language toggle (SV | EN) — compact pill for the funnel header ── */
.tn-lang-toggle {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--tn-border);
    border-radius: 999px;
    overflow: hidden;
    background: var(--tn-bg-card);
}

.tn-lang-toggle-btn {
    padding: 4px 12px;
    border: none;
    background: transparent;
    color: var(--tn-text-secondary);
    font: inherit;
    font-size: var(--tn-font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background var(--tn-transition), color var(--tn-transition);
}

.tn-lang-toggle-btn:hover {
    color: var(--tn-accent);
}

.tn-lang-toggle-btn.is-active {
    background: var(--tn-accent);
    color: #fff;
}

.tn-funnel-body {
    flex: 1;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--tn-space-xl) var(--tn-page-pad-x);
}

.tn-funnel-title {
    margin: 0 0 var(--tn-space-sm);
    font-size: var(--tn-font-size-2xl);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--tn-text-primary);
}

.tn-funnel-lead {
    margin: 0 0 var(--tn-space-xl);
    font-size: var(--tn-font-size-base);
    color: var(--tn-text-secondary);
    line-height: 1.6;
    max-width: 60ch;
}

.tn-funnel-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--tn-space-md);
    margin-top: var(--tn-space-xl);
}

/* Reserve room for the fixed mobile cart dock (cart.css .tn-cart-dock)
   so it never covers the step's Continue button. */
@media (max-width: 960px) {
    .tn-funnel-body {
        padding-bottom: 84px;
    }
}

/* ── Sticky action footer ── keeps Back/Continue visible without scrolling
   (the configure step is tall on a 1080p screen). Sticks to the viewport
   bottom within the funnel body on desktop; flows in document order on
   mobile so it doesn't fight the fixed cart dock. Use INSTEAD of
   .tn-funnel-nav on tall steps. */
.tn-funnel-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--tn-space-md);
    margin-top: var(--tn-space-lg);
    padding: var(--tn-space-md) 0;
    background: var(--tn-bg-page);
    border-top: 1px solid var(--tn-border);
}

@media (max-width: 960px) {
    .tn-funnel-footer {
        position: static;
    }
}

/* ── Short-viewport density ── on a 1080p screen (≈900px usable) the
   configurator is tall; tighten vertical rhythm so the primary actions
   sit at/near the fold. Kicks in only when height is constrained. */
@media (max-height: 900px) {
    .tn-funnel-head {
        padding-top: var(--tn-space-md);
        padding-bottom: var(--tn-space-md);
    }

    .tn-funnel-body {
        padding-top: var(--tn-space-lg);
    }

    .tn-funnel-lead {
        margin-bottom: var(--tn-space-lg);
    }
}

/* Brand lockup in the funnel head (light surface — teal monogram tile +
   dark wordmark). Mirrors the auth/email lockup so the funnel reads as
   the same product; the auth one is white-on-charcoal, this is dark-on-light. */
.tn-funnel-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: var(--tn-font-size-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--tn-text-primary);
    text-decoration: none;
}

.tn-funnel-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--tn-radius);
    background: var(--tn-accent);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}

/* Section heading inside a step (e.g. "Tillval" above the add-ons),
   subordinate to .tn-funnel-title. */
.tn-funnel-subtitle {
    margin: 0 0 var(--tn-space-md);
    font-size: var(--tn-font-size-xl);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--tn-text-primary);
}

/* ── Active-step panel transition ── */
.tn-step-panel {
    animation: tn-step-in var(--tn-transition-slow) ease both;
}

@keyframes tn-step-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Tighter on phones; drop labels to icons-only space if cramped */
@media (max-width: 640px) {
    .tn-step-marker {
        width: 28px;
        height: 28px;
        font-size: var(--tn-font-size-xs);
    }

    .tn-step:not(:last-child)::after {
        top: 13px;
    }

    .tn-step-label {
        font-size: var(--tn-font-size-xs);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tn-step-panel {
        animation: none;
    }
}
