/* =========================================================
   How it works (redesigned)
   Loaded after home.css. Uses its own .process / .proc-* classes,
   so the old .how-it-works / .hiw-* rules in home.css can be deleted.
   Colors come from --af-* variables defined in theme.css.
========================================================= */

.process {
    padding: 112px 0;
    --proc-accent: var(--af-accent, #2563eb);
}

.process-header {
    max-width: 680px;
}

.process-header .section-description {
    margin-top: 16px;
}

.proc-layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 64px;
    margin-top: 56px;
    align-items: start;
}

/* ---------- Steps ---------- */

.proc-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid var(--af-border, rgba(128, 128, 128, 0.25));
}

.proc-step button {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 20px;
    width: 100%;
    padding: 28px 0;
    border: 0;
    border-top: 1px solid var(--af-border, rgba(128, 128, 128, 0.25));
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    position: relative;
}

/* Accent line on the active step */
.proc-step button::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--proc-accent);
    transition: width 0.35s ease;
}

.proc-step button[aria-selected="true"]::before {
    width: 100%;
}

.proc-step button:focus-visible {
    outline: 2px solid var(--proc-accent);
    outline-offset: 2px;
}

.proc-num {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--af-border, rgba(128, 128, 128, 0.35));
    border-radius: 50%;
    font-size: 0.9375rem;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.proc-step button[aria-selected="true"] .proc-num {
    background: var(--proc-accent);
    border-color: var(--proc-accent);
    color: #fff;
}

.proc-text {
    display: block;
}

.proc-title {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.proc-step button[aria-selected="true"] .proc-title,
.proc-step button:hover .proc-title {
    opacity: 1;
}

.proc-desc {
    display: block;
    margin-top: 10px;
    max-width: 46ch;
    line-height: 1.7;
    opacity: 0.75;
}

/* With JavaScript, only the active step shows its description */
.js .proc-step button[aria-selected="false"] .proc-desc {
    display: none;
}

/* ---------- Stage ---------- */

.proc-stage {
    display: grid;
    gap: 16px;
}

.proc-panel {
    position: relative;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--af-border, rgba(128, 128, 128, 0.25));
    border-radius: 20px;
    aspect-ratio: 4 / 3;
    background: var(--af-surface, rgba(128, 128, 128, 0.1));
}

.proc-panel img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.proc-chips {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.proc-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(10, 10, 12, 0.72);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.proc-chip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-buildings { background: #f59e0b; }
.dot-roads     { background: #38bdf8; }
.dot-trees     { background: #22c55e; }

/* JavaScript: stack panels and cross-fade the active one */
.js .proc-stage {
    position: sticky;
    top: 112px;
    display: block;
    aspect-ratio: 4 / 3;
}

.js .proc-panel {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.js .proc-panel.is-active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease;
}

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

@media (max-width: 900px) {
    .process {
        padding: 72px 0;
    }

    .proc-layout {
        grid-template-columns: 1fr;
        gap: 32px;
        margin-top: 40px;
    }

    .js .proc-stage {
        position: relative;
        top: auto;
        aspect-ratio: 16 / 11;
    }

    .proc-panel {
        aspect-ratio: 16 / 11;
    }
}

@media (max-width: 520px) {
    .proc-step button {
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 14px;
        padding: 22px 0;
    }

    .proc-num {
        width: 36px;
        height: 36px;
    }

    .proc-title {
        font-size: 1.125rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .proc-step button::before,
    .proc-num,
    .proc-title,
    .js .proc-panel,
    .js .proc-panel.is-active {
        transition: none;
    }
}
