/* =========================================================
   SHAPE CODES — CATALOGUE
========================================================= */

.shape-codes {
    width: 100%;
}

.shape-codes-content {
    padding-top: calc(var(--h-height) + var(--space-l));
    padding-bottom: var(--space-2xl);
}


/* =========================================================
   SHAPE CODE GRID
========================================================= */

.shape-codes-grid {
    display: flex;

    flex-direction: column;

    gap: var(--space-l);

    width: 100%;
}


/* =========================================================
   SHAPE CODE CARD
========================================================= */

.shape-code-card {
    display: flex;

    flex-direction: column;

    min-width: 0;

    width: 100%;

    background: #ffffff;

    border: 1px solid var(--color-secondary);

    cursor: pointer;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}


.shape-code-card:hover {
    transform: translateY(-3px);

    box-shadow:
        7px 7px 0 rgba(196, 59, 49, 0.18);
}


.shape-code-card:focus-visible {
    outline: 3px solid var(--color-primary);

    outline-offset: 4px;
}


/* =========================================================
   SHAPE CODE NUMBER
========================================================= */

.shape-code-number {
    display: block;

    padding:
        var(--space-s)
        var(--space-m);

    color: var(--color-primary);

    font-family: var(--font-secondary);

    font-size: var(--text-xs);

    font-weight: 700;

    letter-spacing: 0.14em;

    text-transform: uppercase;

    border-bottom: 1px solid var(--color-secondary);
}


/* =========================================================
   SHAPE IMAGE
========================================================= */

.shape-code-image {
    width: 100%;

    aspect-ratio: 16 / 9;

    overflow: hidden;

    background: #f7f6f3;
}


.shape-code-image img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;

    padding: var(--space-m);

    transition:
        transform 0.35s ease;
}


.shape-code-card:hover .shape-code-image img {
    transform: scale(1.025);
}


/* =========================================================
   CALCULATOR MODAL
========================================================= */

.shape-modal-open {
    overflow: hidden;
}


/* =========================================================
   MODAL OVERLAY
========================================================= */

.shape-calculator-overlay {
    position: fixed;

    inset: 0;

    z-index: 9999;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 5vh 5vw;

    background:
        rgba(0, 0, 0, 0.72);
}


/* =========================================================
   MODAL
========================================================= */

.shape-calculator-modal {
    display: flex;

    flex-direction: column;

    width: 75vw;

    max-width: 1400px;

    height: 75vh;

    max-height: 900px;

    min-height: 500px;

    overflow: hidden;

    background: var(--color-primary);

    color: #ffffff;

    border: 1px solid #ffffff;

    box-shadow:
        12px 12px 0 rgba(0, 0, 0, 0.25);
}


/* =========================================================
   MODAL HEADER
========================================================= */

.shape-calculator-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    flex-shrink: 0;

    min-height: 70px;

    padding:
        1rem
        1.5rem;

    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}


.shape-calculator-header h2 {
    margin: 0;

    color: #ffffff;

    font-family: var(--font-secondary);

    font-size: clamp(
        1.25rem,
        2vw,
        2rem
    );

    font-weight: 700;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}


/* =========================================================
   CLOSE BUTTON
========================================================= */

.shape-calculator-close {
    display: flex;

    align-items: center;

    justify-content: center;

    width: 42px;
    height: 42px;

    padding: 0;

    border: 1px solid rgba(255, 255, 255, 0.6);

    background: transparent;

    color: #ffffff;

    font-family: Arial, sans-serif;

    font-size: 2rem;

    line-height: 1;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}


.shape-calculator-close:hover {
    background: #ffffff;

    color: var(--color-primary);
}


.shape-calculator-close:focus-visible {
    outline: 2px solid #ffffff;

    outline-offset: 3px;
}


/* =========================================================
   MODAL BODY
========================================================= */

.shape-calculator-body {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr);

    flex: 1;

    min-height: 0;
}


/* =========================================================
   LEFT IMAGE PANEL
========================================================= */

.shape-calculator-image-panel {
    display: flex;

    align-items: center;

    justify-content: center;

    min-width: 0;

    min-height: 0;

    padding: 2rem;

    background: #ffffff;

    border-right: 1px solid rgba(255, 255, 255, 0.35);
}


.shape-calculator-image-panel img {
    display: block;

    width: 100%;

    max-width: 100%;

    max-height: 100%;

    object-fit: contain;
}


/* =========================================================
   RIGHT CALCULATOR PANEL
========================================================= */

.shape-calculator-panel {
    display: flex;

    flex-direction: column;

    min-width: 0;

    min-height: 0;

    overflow-y: auto;

    padding: 2rem;
}


/* =========================================================
   SECTION HEADINGS
========================================================= */

.shape-calculator-panel h3 {
    margin:
        0 0
        1.25rem;

    color: #ffffff;

    font-family: var(--font-secondary);

    font-size: 0.85rem;

    font-weight: 700;

    letter-spacing: 0.15em;

    text-transform: uppercase;
}


/* =========================================================
   INPUT SECTION
========================================================= */

.shape-calculator-inputs {
    width: 100%;

    margin-bottom: 1.5rem;
}


.shape-calculator-field {
    display: flex;

    flex-direction: column;

    gap: 0.5rem;

    margin-bottom: 1rem;
}


.shape-calculator-field label {
    color: #ffffff;

    font-family: var(--font-secondary);

    font-size: 0.8rem;

    font-weight: 700;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}


/* =========================================================
   INPUTS
========================================================= */

.shape-calculator-input {
    box-sizing: border-box;

    width: 100%;

    min-height: 48px;

    padding:
        0.75rem
        0.9rem;

    border: 1px solid rgba(255, 255, 255, 0.7);

    border-radius: 0;

    background: #ffffff;

    color: #1c1a1b;

    font-family: var(--font-primary);

    font-size: 1rem;

    outline: none;
}


.shape-calculator-input:focus {
    border-color: #ffffff;

    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.25);
}


.shape-calculator-input.invalid {
    border-color: #ffb3aa;

    box-shadow:
        0 0 0 2px rgba(255, 179, 170, 0.25);
}


/* =========================================================
   SELECT ARROW
========================================================= */

select.shape-calculator-input {
    cursor: pointer;
}


/* =========================================================
   CALCULATE BUTTON
========================================================= */

.shape-calculator-submit {
    width: 100%;

    min-height: 50px;

    margin:
        0 0
        2rem;

    padding:
        0.8rem
        1rem;

    border: 1px solid #ffffff;

    border-radius: 0;

    background: #ffffff;

    color: var(--color-primary);

    font-family: var(--font-secondary);

    font-size: 0.85rem;

    font-weight: 700;

    letter-spacing: 0.12em;

    text-transform: uppercase;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}


.shape-calculator-submit:hover:not(:disabled) {
    background: transparent;

    color: #ffffff;

    transform: translateY(-2px);
}


.shape-calculator-submit:disabled {
    opacity: 0.6;

    cursor: wait;
}


/* =========================================================
   RESULTS
========================================================= */

.shape-calculator-results {
    width: 100%;
}


.shape-calculator-result-list {
    display: flex;

    flex-direction: column;

    gap: 0.75rem;

    width: 100%;
}


/* =========================================================
   INDIVIDUAL RESULT
========================================================= */

.shape-calculator-result {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 1rem;

    min-height: 52px;

    padding:
        0.75rem
        1rem;

    background: rgba(255, 255, 255, 0.1);

    border: 1px solid rgba(255, 255, 255, 0.35);
}


.shape-calculator-result-label {
    color: #ffffff;

    font-family: var(--font-secondary);

    font-size: 0.78rem;

    font-weight: 700;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}


.shape-calculator-result-value {
    color: #ffffff;

    font-family: var(--font-secondary);

    font-size: 1rem;

    font-weight: 700;

    text-align: right;

    white-space: nowrap;
}


/* =========================================================
   ERROR
========================================================= */

.shape-calculator-error {
    padding:
        1rem;

    border: 1px solid rgba(255, 255, 255, 0.7);

    background: rgba(0, 0, 0, 0.15);

    color: #ffffff;

    font-size: 0.9rem;

    line-height: 1.5;
}


/* =========================================================
   PAGINATION
========================================================= */

.shape-codes-pagination {
    display: flex;

    justify-content: center;

    align-items: center;

    flex-wrap: wrap;

    gap: 0.5rem;

    margin-top: var(--space-l);
}


.shape-codes-pagination button {
    min-width: 42px;

    padding:
        0.65rem
        0.9rem;

    border: 1px solid var(--color-secondary);

    border-radius: 2px;

    background: transparent;

    color: inherit;

    font: inherit;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}


.shape-codes-pagination button:hover:not(:disabled) {
    background: var(--color-primary);

    color: var(--color-text-light);

    transform: translateY(-2px);
}


.shape-codes-pagination button.active,
.shape-codes-pagination button:disabled {
    background: var(--color-primary);

    color: var(--color-text-light);

    border-color: var(--color-primary);

    cursor: default;
}


.shape-codes-pagination button:focus-visible {
    outline: 2px solid var(--color-tertiary);

    outline-offset: 3px;
}


/* =========================================================
   TABLET
========================================================= */

@media (min-width: 729px) {

    .shape-codes-grid {
        display: grid;

        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        align-items: stretch;

        gap: var(--space-l);
    }

}


/* =========================================================
   DESKTOP
========================================================= */

@media (min-width: 1024px) {

    .shape-codes-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

}


/* =========================================================
   MOBILE MODAL
========================================================= */

@media (max-width: 728px) {

    .shape-calculator-overlay {
        align-items: flex-start;

        padding:
            1rem;
    }


    .shape-calculator-modal {
        width: 100%;

        height: calc(100vh - 2rem);

        max-height: none;

        min-height: 0;
    }


    .shape-calculator-body {
        display: flex;

        flex-direction: column;
    }


    .shape-calculator-image-panel {
        flex: 0 0 35%;

        min-height: 220px;

        padding: 1rem;

        border-right: 0;

        border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    }


    .shape-calculator-panel {
        flex: 1;

        padding: 1.25rem;

        overflow-y: auto;
    }


    .shape-calculator-header {
        min-height: 60px;

        padding:
            0.8rem
            1rem;
    }


    .shape-calculator-header h2 {
        font-size: 1.2rem;
    }


    .shape-calculator-result {
        align-items: flex-start;

        flex-direction: column;

        gap: 0.35rem;
    }


    .shape-calculator-result-value {
        text-align: left;
    }

}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .shape-code-card,
    .shape-code-image img,
    .shape-codes-pagination button,
    .shape-calculator-submit,
    .shape-calculator-close {
        transition: none;
    }

}