/* Table popups — reusable table sets (Yardage Table, Rates) opened from a button.
   Palette follows the Golf reference: Pine header, alternating Pine-filled rows. */

.table-popup-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

.table-popup-buttons .button--outline {
    background: transparent;
    color: #325C52;
    border: 1px solid #325C52;
}

dialog.table-popup {
    width: min(1100px, calc(100vw - 40px));
    max-width: none;
    max-height: calc(100vh - 60px);
    padding: 0;
    border: 0;
    background: #fff;
    color: #325C52;
    overflow: auto;
}

dialog.table-popup::backdrop {
    background: rgba(27, 73, 101, .6);
}

/* Fallback for browsers without showModal(): the [open] attribute alone leaves
   the dialog in flow, so pin it and paint its own scrim. */
dialog.table-popup[open]:not(:modal) {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1050;
    box-shadow: 0 0 0 100vmax rgba(27, 73, 101, .6);
}

.table-popup__inner {
    position: relative;
    padding: 48px 40px 40px;
}

.table-popup__close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 30px;
    line-height: 1;
    color: #325C52;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.table-popup__heading {
    margin: 0 0 32px;
    font-family: 'Idlewild', serif;
    font-weight: 400;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #325C52;
}

.table-popup__tables {
    display: grid;
    gap: 32px;
}

@media (min-width: 992px) {
    .table-popup__tables--multi {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
}

.table-popup__caption {
    margin: 0 0 10px;
    font-family: 'Idlewild', serif;
    font-size: 18px;
    color: #325C52;
}

.table-popup__table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Idlewild', serif;
    font-weight: 700;
    text-align: left;
}

.table-popup__table th,
.table-popup__table td {
    padding: 14px 20px;
    border: 1px solid rgba(50, 92, 82, .35);
    vertical-align: middle;
}

.table-popup__table thead th {
    font-size: 20px;
    color: #fff;
    background: #325C52;
    border-color: #325C52;
}

/* Blank top-left cell when the first column holds row labels. */
.table-popup__table thead th.is-corner {
    background: #325C52;
}

.table-popup__table tbody tr:nth-child(even) th,
.table-popup__table tbody tr:nth-child(even) td {
    color: #fff;
    background: #325C52;
    border-color: #325C52;
}

.table-popup__table tbody tr:nth-child(odd) th,
.table-popup__table tbody tr:nth-child(odd) td {
    color: #325C52;
    background: #fff;
}

@media (max-width: 767px) {
    .table-popup__inner {
        padding: 44px 18px 28px;
    }

    /* Stack each row as label: value instead of scrolling sideways. */
    .table-popup__table,
    .table-popup__table tbody,
    .table-popup__table tr,
    .table-popup__table td,
    .table-popup__table th {
        display: block;
        width: 100%;
    }

    .table-popup__table thead {
        display: none;
    }

    .table-popup__table tbody tr {
        margin-bottom: 16px;
        border: 1px solid rgba(50, 92, 82, .35);
    }

    .table-popup__table tbody tr th[scope="row"] {
        font-size: 18px;
        color: #fff;
        background: #325C52;
        border: 0;
    }

    .table-popup__table tbody tr:nth-child(even) td {
        color: #325C52;
        background: #fff;
    }

    .table-popup__table tbody td {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        border: 0;
        border-top: 1px solid rgba(50, 92, 82, .2);
    }

    .table-popup__table tbody td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        font-weight: 400;
        opacity: .75;
    }
}
