/*
 * rig_build.php
 * Page-specific build dossier and gear-card presentation.
 */

.rig-build-page {
    min-height: 60vh;
    padding: clamp(2rem, 5vw, 4.5rem) 1.25rem clamp(4rem, 7vw, 7rem);
    background:
        radial-gradient(circle at 14% 8%, rgb(185 46 46 / 5%) 0 1px, transparent 2px),
        linear-gradient(rgb(246 241 231 / 96%), rgb(246 241 231 / 96%)),
        var(--stone-50);
    background-size: 31px 31px, auto, auto;
}

.rig-build-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
}

/* ==========================================================================
   Build dossier
   ========================================================================== */

.build-dossier {
    position: relative;
    overflow: hidden;
    margin-bottom: clamp(3rem, 6vw, 5rem);
    border: 1px solid var(--stone-300);
    border-radius: var(--radius);
    background: rgb(255 252 244 / 82%);
    box-shadow: var(--shadow);
}

.build-dossier::before {
    position: absolute;
    top: -4.5rem;
    right: -3.5rem;
    width: 15rem;
    height: 15rem;
    border: 1px solid rgb(29 33 30 / 9%);
    border-radius: 50%;
    box-shadow: 0 0 0 1.3rem rgb(29 33 30 / 3%), 0 0 0 2.6rem rgb(29 33 30 / 2%);
    content: "";
    pointer-events: none;
}

.build-dossier-heading {
    position: relative;
    padding: clamp(1.5rem, 3.5vw, 2.75rem) clamp(1.5rem, 4vw, 3.25rem) 1.5rem;
    border-bottom: 1px solid var(--stone-300);
}

.build-dossier-kicker,
.build-dossier-label,
.build-jump-title {
    margin: 0;
    color: var(--signal-dark);
    font-size: .74rem;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.build-dossier-heading h1 {
    max-width: 55rem;
    margin: .35rem 0 0;
    color: var(--forest-950);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.2rem, 5vw, 4.6rem);
    line-height: .98;
}

.build-dossier-subtitle {
    margin: .8rem 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    font-weight: 700;
}

.build-dossier-body {
    display: grid;
    grid-template-columns: minmax(17rem, .85fr) minmax(20rem, 1.15fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: center;
    padding: clamp(1.75rem, 4vw, 3.5rem) clamp(1.5rem, 4vw, 3.25rem);
}

.build-profile-wrap {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 18rem;
}

.build-profile-wrap::after {
    position: absolute;
    z-index: 0;
    bottom: 8%;
    left: 10%;
    width: 80%;
    height: 16%;
    border-radius: 50%;
    background: rgb(16 24 20 / 13%);
    filter: blur(16px);
    content: "";
}

.build-profile {
    position: relative;
    z-index: 1;
    display: block;
    width: min(100%, 30rem);
    height: auto;
    filter: drop-shadow(0 1rem 1rem rgb(0 0 0 / 16%));
}

.build-dossier-notes {
    position: relative;
    padding-left: clamp(1.25rem, 3vw, 2.25rem);
    border-left: .2rem solid var(--signal);
}


.build-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 2rem;
    margin: 0;
}

.build-facts div {
    padding-top: .75rem;
    border-top: 1px solid var(--stone-300);
}

.build-facts dt {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.build-facts dd {
    margin: .15rem 0 0;
    color: var(--forest-950);
    font-weight: 800;
}

.build-cost-details {
    position: relative;
}

.build-cost-details summary {
    display: inline-flex;
    gap: .45rem;
    align-items: center;
    cursor: pointer;
    list-style: none;
}

.build-cost-details summary::-webkit-details-marker {
    display: none;
}

.build-cost-details summary::after {
    display: inline-block;
    color: var(--signal-dark);
    content: "▾";
    font-size: .75rem;
    transform-origin: center;
    transition: transform 160ms ease;
}

.build-cost-details[open] summary::after {
    transform: rotate(180deg);
}

.build-cost-details summary:focus-visible {
    border-radius: .15rem;
    outline: 2px solid var(--signal);
    outline-offset: .2rem;
}

.build-cost-tally {
    width: calc(200% + 2rem);
    margin-top: 1.1rem;
    margin-left: calc(-100% - 2rem);
    padding: 1rem 0 .2rem;
    border-top: 1px solid var(--stone-300);
}

.build-cost-tally-title {
    margin: 0 0 .55rem;
    color: var(--signal-dark);
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.build-cost-tally dl {
    margin: 0;
}

.build-cost-tally dl div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    padding: .28rem 0;
    border-top: 0;
}

.build-cost-tally dl dt,
.build-cost-tally dl dd {
    margin: 0;
    font-size: .82rem;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
}

.build-cost-tally dl dd {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.build-cost-tally .build-cost-tally-total {
    margin-top: .45rem;
    padding-top: .55rem;
    border-top: 1px solid var(--stone-300);
}

.build-cost-tally .build-cost-tally-total dt,
.build-cost-tally .build-cost-tally-total dd {
    font-weight: 900;
}

.build-jump-panel {
    padding: 1.35rem clamp(1.5rem, 4vw, 3.25rem) 1.6rem;
    border-top: 1px solid var(--stone-300);
    background: rgb(207 196 176 / 20%);
}

.build-jump-title {
    margin-bottom: .85rem;
    color: var(--forest-950);
}

.build-jump-links {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.build-jump-links a {
    display: inline-flex;
    align-items: center;
    min-height: 2.35rem;
    padding: .42rem .8rem;
    border: 1px solid rgb(16 24 20 / 28%);
    border-radius: .2rem;
    color: var(--forest-950);
    background: rgb(255 255 255 / 44%);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .07em;
    text-decoration: none;
    text-transform: uppercase;
}

.build-jump-links a:hover,
.build-jump-links a:focus-visible {
    border-color: var(--signal);
    color: var(--signal-dark);
    background: var(--white);
}

.build-jump-links a:focus-visible {
    outline: 3px solid var(--signal);
    outline-offset: 2px;
}


    /*
     * ----------------------------------------------------------------------
     * Category sections and field-note cards
     * ----------------------------------------------------------------------
     */

    .build-category {
        margin-bottom: clamp(3.5rem, 7vw, 5.5rem);
        scroll-margin-top: 1rem;
    }

    .build-category-heading {
        display: flex;
        align-items: end;
        justify-content: space-between;
        gap: 1.5rem;
        margin-bottom: 1.5rem;
        padding: 0 0 .7rem;
        border-bottom: 1px solid var(--stone-300);
    }

    .build-category-title {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: .55rem 1rem;
    }

    .build-category-heading h2 {
        margin: 0;
        color: var(--forest-950);
        font-family: Georgia, "Times New Roman", serif;
        font-size: clamp(1.8rem, 3vw, 2.7rem);
        line-height: 1;
        letter-spacing: .015em;
        text-transform: uppercase;
    }

    .build-category-title span {
        color: var(--signal-dark);
        font-size: .68rem;
        font-weight: 900;
        letter-spacing: .14em;
        text-transform: uppercase;
    }

    .build-category-heading a {
        flex-shrink: 0;
        color: var(--muted);
        font-size: .72rem;
        font-weight: 900;
        letter-spacing: .08em;
        text-decoration: none;
        text-transform: uppercase;
    }

    .build-category-heading a:hover,
    .build-category-heading a:focus-visible {
        color: var(--signal-dark);
        text-decoration: underline;
        text-underline-offset: .2em;
    }

    .build-category-heading a:focus-visible {
        outline: 3px solid var(--signal);
        outline-offset: 3px;
    }

    .gear-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(240px, 320px));
        gap: 1.6rem;
        align-items: stretch;
        justify-content: start;
    }

    .gear-card {
        position: relative;
        min-width: 0;
        height: 390px;
        perspective: 1200px;
    }

    .gear-card-inner {
        position: relative;
        width: 100%;
        height: 100%;
        transition: transform .55s ease;
        transform-style: preserve-3d;
    }

    .gear-card.is-flipped .gear-card-inner {
        transform: rotateY(180deg);
    }

    .gear-card-front,
    .gear-card-back {
        position: absolute;
        inset: 0;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        transform-style: preserve-3d;
    }

    .gear-card-back {
        transform: rotateY(180deg);
    }

    .gear-card-paper {
        position: relative;
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100%;
        overflow: hidden;
        background:
            radial-gradient(circle at 12% 14%, rgb(117 83 45 / 7%) 0 1px, transparent 1.5px),
            radial-gradient(ellipse at 2% 38%, rgb(112 59 20 / 18%), transparent 9%),
            radial-gradient(ellipse at 98% 71%, rgb(112 59 20 / 15%), transparent 10%),
            linear-gradient(105deg, rgb(255 252 241 / 98%), rgb(247 238 217 / 98%));
        background-size: 23px 23px, auto, auto, auto;
        clip-path: polygon(
            1.5% 1.2%, 7% .2%, 14% 1.5%, 23% .5%, 31% 2.1%, 43% .4%, 52% 1.1%, 64% .1%, 73% 1.7%,
            85% .5%, 94% 1.3%, 99.2% 4%, 98.4% 13%, 99.5% 22%, 97.8% 34%, 99.1% 47%, 98.2% 57%,
            99.4% 69%, 97.9% 82%, 99% 92%, 96.5% 99%, 87% 98.1%, 78% 99.5%, 68% 97.8%, 57% 99.2%,
            49% 98%, 39% 99.6%, 29% 97.9%, 18% 99.1%, 10% 97.7%, 2.2% 99%, .4% 94%, 1.5% 84%,
            .2% 73%, 1.2% 65%, .1% 52%, 1.7% 44%, .3% 32%, 1.3% 23%, .2% 12%
        );
        box-shadow:
            inset 0 0 1.1rem rgb(103 57 19 / 20%),
            inset .35rem 0 .65rem rgb(126 69 22 / 10%),
            inset -.3rem 0 .75rem rgb(126 69 22 / 12%);
        filter:
            drop-shadow(0 .18rem .16rem rgb(45 31 18 / 22%))
            drop-shadow(0 .75rem .65rem rgb(45 31 18 / 28%))
            drop-shadow(.2rem .35rem 1rem rgb(45 31 18 / 15%));
    }

    .gear-card-paper::after {
        position: absolute;
        inset: 0;
        z-index: 4;
        border: 1px solid rgb(111 61 20 / 14%);
        box-shadow: inset 0 0 .45rem rgb(95 46 14 / 18%);
        content: "";
        pointer-events: none;
    }

    .gear-card-flip-button {
        border: 0;
        font: inherit;
        cursor: pointer;
    }

    .gear-card-front-button {
        position: absolute;
        inset: 0;
        z-index: 2;
        width: 100%;
        height: 100%;
        padding: 0;
        background: transparent;
    }

    .gear-card-front-button:focus-visible {
        outline: 3px solid var(--signal);
        outline-offset: -5px;
    }

    .gear-card-back-button {
        width: 100%;
        padding: .6rem 1rem .75rem;
        border-top: 1px solid rgb(117 83 45 / 18%);
        color: var(--muted);
        background: rgb(255 250 236 / 52%);
        font-size: .76rem;
        font-weight: 800;
        letter-spacing: .06em;
        text-align: center;
        text-transform: uppercase;
    }

    .gear-card-back-button:hover,
    .gear-card-back-button:focus-visible {
        color: var(--signal-dark);
        background: rgb(255 250 236 / 82%);
    }

    .gear-card-back-button:focus-visible {
        outline: 3px solid var(--signal);
        outline-offset: -4px;
    }

    .gear-card-name,
    .gear-card-back-name {
        min-height: 4.7rem;
        padding: .9rem 1.15rem .75rem;
        display: flex;
        align-items: center;
        justify-content: center;
        border-bottom: 1px solid rgb(117 83 45 / 20%);
        color: var(--forest-950);
        background: transparent;
        font-family: Georgia, "Times New Roman", serif;
        font-size: 1rem;
        font-weight: 700;
        line-height: 1.22;
        text-align: center;
    }

    .gear-card-image {
        position: relative;
        flex: 1;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        padding: 1rem;
        background: #fff;
        box-shadow:
            inset 0 .75rem .85rem -.8rem rgb(76 43 19 / 24%),
            inset 0 -.75rem .85rem -.8rem rgb(76 43 19 / 20%);
    }

    .gear-card-image img,
    .gear-card-image-missing {
        position: relative;
        z-index: 1;
    }

    .gear-card-image img {
        display: block;
        width: 200px;
        height: 200px;
        max-width: 100%;
        object-fit: contain;
    }

    .gear-card-image-missing {
        position: relative;
        z-index: 2;
    }

    .gear-card-image-missing {
        color: var(--muted);
        font-style: italic;
        text-align: center;
    }

    .gear-card-price {
        padding: .72rem 1.15rem .85rem;
        border-top: 1px solid rgb(117 83 45 / 20%);
        color: var(--forest-950);
        background: transparent;
        font-family: Georgia, "Times New Roman", serif;
        font-size: 1.15rem;
        font-variant-numeric: tabular-nums;
        font-weight: 700;
        text-align: right;
    }

    .gear-card-details {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: 1.1rem 1.2rem .9rem;
    }

    .gear-card-review {
        flex: 1;
        overflow: auto;
        margin: 0 0 .8rem;
        padding-right: .25rem;
        color: #333333;
        font-family: Arial, Helvetica, sans-serif;
        font-size: .9rem;
        font-weight: 400;
        line-height: 1.35;
        scrollbar-color: rgb(117 83 45 / 42%) transparent;
        scrollbar-width: thin;
    }

    .gear-card-review-list {
        margin: 0 0 .5rem !important;
        padding: 0;
        list-style: none;
    }

    .gear-card-review-list:last-child {
        margin-bottom: 0 !important;
    }

    .gear-card-review-list li {
        position: relative;
        margin: 0;
        padding: .15rem 0 .15rem 1.6rem;
        color: #333333;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 1em;
        font-weight: 400;
        line-height: 1.3;
    }

    .gear-card-review-list li::before {
        position: absolute;
        top: .15rem;
        left: 0;
        width: 1.2rem;
        font-family: Arial, Helvetica, sans-serif;
        font-weight: 700;
        text-align: center;
    }

    .gear-card-pros li::before {
        color: #536B58;
        content: "✓";
    }

    .gear-card-cons li::before {
        color: #A94442;
        content: "✕";
    }

    .gear-card-review-empty {
        margin: 0;
        color: var(--muted);
        font-family: Arial, Helvetica, sans-serif;
        font-style: italic;
        font-weight: 400;
        line-height: 1.3;
    }

    .gear-card-product-link {
        display: block;
        padding: .7rem .8rem;
        border-top: 1px solid rgb(117 83 45 / 22%);
        border-bottom: 1px solid rgb(117 83 45 / 22%);
        color: var(--signal-dark);
        background: rgb(255 250 236 / 48%);
        font-size: .78rem;
        font-weight: 900;
        letter-spacing: .08em;
        text-align: right;
        text-decoration: none;
        text-transform: uppercase;
    }

    .gear-card-product-link::after {
        content: " →";
    }

    .gear-card-product-link:hover,
    .gear-card-product-link:focus-visible {
        color: var(--signal-dark);
        background: rgb(226 207 170 / 28%);
    }

    .gear-card-product-link:focus-visible {
        outline: 3px solid var(--signal);
        outline-offset: -3px;
    }


    /*
     * ----------------------------------------------------------------------
     * Responsive behavior
     *
     * On smaller screens the card is allowed to consume the available width.
     * ----------------------------------------------------------------------
     */

    @media screen and (max-width: 736px) {
        .build-dossier-body {
            grid-template-columns: 1fr;
        }

        .build-profile-wrap {
            min-height: 0;
        }

        .build-profile {
            max-width: 26rem;
            margin: 0 auto;
        }

        .build-dossier-notes {
            padding-top: 1.25rem;
            padding-left: 0;
            border-top: .2rem solid var(--signal);
            border-left: 0;
        }

        .build-facts {
            grid-template-columns: 1fr 1fr;
        }

        .gear-grid {
            grid-template-columns: 1fr;
        }

        .build-category-heading {
            align-items: flex-start;
        }
    }


    /*
     * ----------------------------------------------------------------------
     * Reduced motion
     * ----------------------------------------------------------------------
     */

    @media (prefers-reduced-motion: reduce) {
        .gear-card-inner {
            transition: none;
        }
    }


.build-description {
    margin: 0 0 1rem;
    max-width: 48rem;
    line-height: 1.55;
}
