/*
 * Go Wild Expedition: editorial table style.
 * Opt-in: gwe-tables.js adds .gwe-table only to editorial/trip-content tables,
 * so WP Travel Engine functional tables (booking, checkout, calendar, dashboard) are never styled.
 */
.gwe-table-wrap {
    --gwe-ink: #1f1235;
    --gwe-violet: #4c1d95;
    --gwe-magenta: #be185d;
    --gwe-lilac: #ede9fe;
    --gwe-blush: #fdf4ff;
    --gwe-amber: #fef3c7;
    --gwe-focus: #1e3a8a;
    position: relative;
    margin: 1.75rem 0;
    border-radius: 14px;
    box-shadow: 0 10px 28px -12px rgba(76, 29, 149, .45), 0 0 0 1px rgba(76, 29, 149, .12);
    max-width: 100%;
}
.gwe-table-wrap::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(90deg, #0891b2, #7c3aed, #db2777, #f59e0b);
    z-index: 2;
    pointer-events: none;
}

/* Scroll edge hints; they sit above the scroller so opaque cells cannot hide them */
.gwe-table-wrap::after {
    content: "";
    position: absolute;
    inset: 5px 0 0 0;
    border-radius: 0 0 14px 14px;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity .2s ease;
    background:
        linear-gradient(to right, rgba(76, 29, 149, .28), rgba(76, 29, 149, 0)) left center / 22px 100% no-repeat,
        linear-gradient(to left, rgba(76, 29, 149, .28), rgba(76, 29, 149, 0)) right center / 22px 100% no-repeat;
}
.gwe-table-wrap.gwe-can-scroll::after { opacity: 1; }
.gwe-table-wrap.gwe-at-start::after {
    background: linear-gradient(to left, rgba(76, 29, 149, .28), rgba(76, 29, 149, 0)) right center / 22px 100% no-repeat;
}
.gwe-table-wrap.gwe-at-end::after {
    background: linear-gradient(to right, rgba(76, 29, 149, .28), rgba(76, 29, 149, 0)) left center / 22px 100% no-repeat;
}

.gwe-table-scroll {
    margin: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
    background: #fff;
}
.gwe-table-scroll:focus-visible {
    outline: 3px solid var(--gwe-focus, #1e3a8a);
    outline-offset: 3px;
}

body .gwe-table-wrap table.gwe-table {
    width: 100% !important;
    max-width: none;
    margin: 0;
    border: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--esn-font-body, system-ui, sans-serif);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--gwe-ink, #1f1235);
    background: #fff;
    text-align: left;
}
body .gwe-table-wrap table.gwe-table caption {
    padding: 1rem 1.1rem .75rem;
    font-weight: 700;
    text-align: left;
    caption-side: top;
    color: var(--gwe-violet, #4c1d95);
}
body .gwe-table-wrap table.gwe-table :is(th, td) {
    width: auto !important;
    min-width: 5.5rem;
    padding: .85rem 1.1rem;
    border: 0;
    border-bottom: 1px solid rgba(76, 29, 149, .14);
    vertical-align: middle;
    overflow-wrap: break-word;
    word-break: normal;
}
body .gwe-table-wrap table.gwe-table :is(th, td) > p { margin: 0 !important; padding: 0; color: inherit; font: inherit; line-height: inherit; }
body .gwe-table-wrap table.gwe-table :is(th, td) > p + p { margin-top: .5em !important; }
body .gwe-table-wrap table.gwe-table :is(th, td) { border-left: 0 !important; border-right: 0 !important; border-top: 0 !important; color: inherit; font-family: var(--esn-font-accent, 'DM Sans', system-ui, sans-serif); }
body .gwe-table-wrap table.gwe-table :is(th, td) strong, body .gwe-table-wrap table.gwe-table :is(th, td) b { color: inherit; font-weight: 700; }
body .gwe-table-wrap table.gwe-table :is(th, td) a { color: #1d4ed8; text-decoration: underline; text-underline-offset: 2px; }
body .gwe-table-wrap table.gwe-table :is(th, td) a:focus-visible { outline: 3px solid #1e3a8a; outline-offset: 2px; }
body .gwe-table-wrap table.gwe-table :is(thead, .gwe-has-headrow tr:first-child) a { color: #fff; }
body .gwe-table-wrap > figure.gwe-table-scroll { margin: 0 !important; }
body .gwe-table-wrap table.gwe-table tbody tr:nth-child(even) > :is(td, th) { background: var(--gwe-blush, #fdf4ff); }
body .gwe-table-wrap table.gwe-table tbody tr:last-child > :is(td, th) { border-bottom: 0; }
body .gwe-table-wrap table.gwe-table tbody tr:hover > :is(td, th) { background: var(--gwe-amber, #fef3c7); }

/* Header: a real thead/th, or a first row whose cells are all bold (set by JS) */
body .gwe-table-wrap table.gwe-table thead :is(th, td),
body .gwe-table-wrap table.gwe-table tbody tr:first-child > th,
body .gwe-table-wrap table.gwe-table.gwe-has-headrow tbody tr:first-child > :is(td, th) {
    margin-top: 5px;
    background: #5b21b6 !important;
    color: #fff;
    font-weight: 700;
    letter-spacing: .02em;
    border-bottom: 0;
}
body .gwe-table-wrap table.gwe-table.gwe-has-headrow tbody tr:first-child:hover > :is(td, th),
body .gwe-table-wrap table.gwe-table thead tr:hover > :is(th, td) {
    background: #5b21b6 !important;
}
body .gwe-table-wrap table.gwe-table :is(thead, tr:first-child) :is(th, td) strong,
body .gwe-table-wrap table.gwe-table.gwe-has-headrow tbody tr:first-child strong { color: inherit; }
.gwe-table-wrap table.gwe-table thead tr:first-child > :is(th, td),
.gwe-table-wrap table.gwe-table.gwe-has-headrow tbody tr:first-child > :is(th, td) { padding-top: 1.2rem; }

/* Row labels: a first column that is all bold stays visible while scrolling sideways */
body .gwe-table-wrap table.gwe-table.gwe-has-rowhead tbody tr:not(:first-child) > :first-child,
body .gwe-table-wrap table.gwe-table tbody > tr > th[scope="row"] {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--gwe-lilac, #ede9fe) !important;
    color: #3b0764;
    font-weight: 700;
    box-shadow: 1px 0 0 rgba(76, 29, 149, .18);
}
body .gwe-table-wrap table.gwe-table.gwe-has-headrow.gwe-has-rowhead tbody tr:first-child > :first-child { position: sticky; left: 0; z-index: 1; }
body .gwe-table-wrap table.gwe-table.gwe-has-rowhead tbody tr:not(:first-child):hover > :first-child { background: #ddd6fe !important; }

/* Single-cell tables are text callouts, not data grids */
body .gwe-table-wrap.gwe-callout { box-shadow: 0 6px 18px -10px rgba(8, 145, 178, .5), 0 0 0 1px rgba(8, 145, 178, .25); }
body .gwe-table-wrap.gwe-callout::before { background: #0891b2; width: 8px; height: auto; inset: 0 auto 0 0; border-radius: 14px 0 0 14px; }
body .gwe-table-wrap.gwe-callout::after { display: none; }
body .gwe-table-wrap.gwe-callout table.gwe-table,
body .gwe-table-wrap.gwe-callout table.gwe-table td { background: #ecfeff !important; color: #083344; }
body .gwe-table-wrap.gwe-callout table.gwe-table td { padding: 1.1rem 1.4rem 1.1rem 1.75rem; border: 0; }

/* The Customizer "Additional CSS" already styles tables with !important; these win on specificity */
body .gwe-table-wrap table.gwe-table {
    width: 100% !important;
    min-width: calc(var(--gwe-cols, 1) * 6rem);
    margin: 0 !important;
    border: 0 !important;
    border-collapse: separate !important;
    background: #fff;
}
body .gwe-table-wrap table.gwe-table :is(th, td) {
    padding: .85rem 1.1rem !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(76, 29, 149, .14) !important;
    text-align: left !important;
    font-family: var(--esn-font-accent, 'DM Sans', system-ui, sans-serif) !important;
    font-size: 1rem !important;
    line-height: 1.55 !important;
    color: var(--gwe-ink, #1f1235) !important;
}
body .gwe-table-wrap table.gwe-table :is(th, td) > p {
    font: inherit !important;
    line-height: inherit !important;
    color: inherit !important;
    margin: 0 !important;
}
body .gwe-table-wrap table.gwe-table :is(th, td) > p + p { margin-top: .5em !important; }
body .gwe-table-wrap table.gwe-table tbody tr:last-child > :is(td, th) { border-bottom: 0 !important; }
body .gwe-table-wrap table.gwe-table thead :is(th, td),
body .gwe-table-wrap table.gwe-table tbody tr:first-child > th,
body .gwe-table-wrap table.gwe-table.gwe-has-headrow tbody tr:first-child > :is(td, th) {
    color: #fff !important;
    padding-top: 1.2rem !important;
    border-bottom: 0 !important;
}
body .gwe-table-wrap table.gwe-table :is(thead, .gwe-has-headrow tr:first-child) :is(a, strong, b, p) { color: #fff !important; }
body .gwe-table-wrap table.gwe-table.gwe-has-rowhead tbody tr:not(:first-child) > :first-child { color: #3b0764 !important; }
body .gwe-table-wrap.gwe-callout table.gwe-table td { color: #083344 !important; background: #ecfeff !important; padding: 1.1rem 1.4rem 1.1rem 1.75rem !important; }
body .gwe-table-wrap table.gwe-table :is(td, th) a { color: #1d4ed8 !important; text-decoration: underline !important; text-underline-offset: 2px; }
body .gwe-table-wrap table.gwe-table :is(td, th) a:hover { color: #1e3a8a !important; }
body .gwe-table-wrap table.gwe-table :is(thead, .gwe-has-headrow tr:first-child) a { color: #fff !important; }

@media (max-width: 768px) {
    .gwe-table-wrap { margin: 1.25rem 0; border-radius: 12px; }
    body .gwe-table-wrap table.gwe-table :is(th, td) { padding: .7rem .75rem !important; min-width: 4.75rem; font-size: .9375rem !important; }
}
@media (max-width: 400px) {
    body .gwe-table-wrap table.gwe-table :is(th, td) { padding: .6rem .55rem !important; min-width: 4.25rem; font-size: .875rem !important; }
}

@media (prefers-reduced-motion: reduce) {
    .gwe-table-wrap::after { transition: none; }
}
@media (forced-colors: active) {
    .gwe-table-wrap, .gwe-table-scroll { border: 1px solid CanvasText; }
    body .gwe-table-wrap table.gwe-table :is(th, td) { border-bottom: 1px solid CanvasText; }
}
@media print {
    .gwe-table-wrap { box-shadow: none; }
    .gwe-table-wrap::before, .gwe-table-wrap::after { display: none; }
    .gwe-table-scroll { overflow: visible; }
}
