/* ===================================================================
   The Website Widget page (src/pages/widget.html, scripts/widget.js): small HTML recreations of the Live Widget on a customer's website
   (the real one is www/stasee-live.js), so they can move. Shared look (frame, chips, dots, sections, FAQ, call to action): style/pages.css.

   .wg-page ........ a customer's website (Blue Lake Travel) as a few grey shapes; .wg-w sits on it: the widget's own layer
   .wg-w ........... the widget's colours as variables (--bg --soft --tx --mu --bd --land --ac), data-theme="dark", .wg-is-left, .is-sidebar
   .wg-btn ......... the collapsed button (.is-open turns its arrow); .wg-panel (.is-open) the mini dashboard: .wg-hd .wg-bo > .wg-md .wg-by
   .wg-demo ........ a card in a split row (the settings strip .wg-set, then the customer's website, or the panel alone)
   =================================================================== */

.wg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---------- a customer's website ---------- */

.wg-page {
    position: relative;
    overflow: hidden;
    padding: 16px 18px;
    background: var(--color-bg);
}

.wg-page-big {
    height: clamp(380px, 46vw, 500px);
    padding: clamp(14px, 2vw, 24px) clamp(16px, 3vw, 36px);
}

.wg-page-small {
    height: 260px;
    border: 1px solid var(--color-border-soft);
    border-radius: 12px;
}

:root[data-theme="dark"] .wg-page-small {
    border-color: var(--color-border);
}

.wg-page-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wg-page-nav b {
    margin-inline-end: auto;
    font-size: 14px;
    font-weight: 800;
    color: var(--site-bluelake);
}

.wg-page-nav i {
    width: 34px;
    height: 8px;
    border-radius: 4px;
    background: var(--color-border);
}

.wg-page-hero {
    display: grid;
    align-content: center;
    gap: 9px;
    height: 104px;
    margin-top: 16px;
    padding: 0 16px;

    border-radius: 12px;
    background: color-mix(in srgb, var(--site-bluelake) 14%, var(--color-bg));
}

.wg-page-big .wg-page-hero {
    height: clamp(120px, 16vw, 170px);
}

.wg-page-hero i {
    height: 10px;
    border-radius: 5px;
    background: color-mix(in srgb, var(--site-bluelake) 42%, var(--color-bg));
}

.wg-page-hero i:nth-child(1) { width: 62%; }
.wg-page-hero i:nth-child(2) { width: 40%; }
.wg-page-hero i:nth-child(3) { width: 24%; height: 18px; background: var(--site-bluelake); }

.wg-page-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.wg-page-cards i {
    height: clamp(60px, 8vw, 96px);
    border: 1px solid var(--color-border-soft);
    border-radius: 10px;
    background: var(--color-bg-soft);
}

:root[data-theme="dark"] .wg-page-cards i {
    border-color: var(--color-border);
}

/* ---------- the widget (colours as the real one: a light card on any page, or dark when the owner picks it) ---------- */

.wg-w {
    --bg: #ffffff;
    --soft: #f4f6f9;
    --tx: #0b1120;
    --mu: #5f6f86;
    --bd: #e2e8f0;
    --land: #e3e8ef;
    --ac: #2563eb;
    --ox: 14px;
    --oy: 14px;

    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;

    font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    color: var(--tx);
}

.wg-w[data-theme="dark"] {
    --bg: #0f172a;
    --soft: #1b2537;
    --tx: #f1f5f9;
    --mu: #9fb0c6;
    --bd: #2a3850;
    --land: #2a3850;
}

.wg-w-inline {
    position: relative;
    inset: auto;
    overflow: visible;
}

/* the collapsed button: "● 8 active · last 5 min · 1,240 page views today ^" in one line */
.wg-btn {
    position: absolute;
    z-index: 2;
    right: var(--ox);
    bottom: var(--oy);

    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100% - 2 * var(--ox));
    min-height: 40px;
    padding: 8px 10px 8px 14px;
    overflow: hidden;

    border: 1px solid var(--bd);
    border-radius: 12px;
    background: var(--bg);
    box-shadow: 0 4px 18px rgba(15, 23, 42, .12);

    font-size: 14px;
    line-height: 20px;
    white-space: nowrap;
    transition: right .5s var(--ease), left .5s var(--ease), background-color .3s ease, border-color .3s ease;
}

.wg-is-left .wg-btn {
    right: auto;
    left: var(--ox);
}

.wg-dot {
    position: relative;
    flex: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--ac);
    transition: background-color .3s ease;
}

.wg-btn .wg-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--ac);
    animation: wg-pulse 2s ease-out infinite;
}

.wg-ln {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.wg-m {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wg-m b {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.wg-m2 {
    color: var(--mu);
}

.wg-m2 b {
    font-weight: 400;
}

.wg-sp {
    flex: none;
    align-self: center;
    font-size: .7em;
    color: var(--mu);
}

.wg-cv {
    flex: none;
    width: 18px;
    height: 18px;
    color: var(--mu);
    transition: transform .25s ease;
}

.wg-btn.is-open .wg-cv {
    transform: rotate(180deg);
}

.wg-btn.is-hover {
    box-shadow: 0 6px 24px rgba(15, 23, 42, .2);
}

/* the panel: a popup above the button, or a sidebar along the same edge */
.wg-panel {
    position: absolute;
    z-index: 1;
    right: var(--ox);
    bottom: calc(var(--oy) + 50px);

    display: flex;
    flex-direction: column;
    width: min(330px, calc(100% - 2 * var(--ox)));
    max-height: calc(100% - var(--oy) - 64px);
    overflow: hidden;

    border: 1px solid var(--bd);
    border-radius: 14px;
    background: var(--bg);
    box-shadow: 0 12px 40px rgba(15, 23, 42, .2);

    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .25s ease, transform .3s var(--ease), visibility 0s linear .3s, right .5s var(--ease), left .5s var(--ease), width .5s var(--ease), background-color .3s ease;
}

.wg-is-left .wg-panel {
    right: auto;
    left: var(--ox);
}

.wg-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

.wg-w.is-sidebar .wg-panel {
    top: 0;
    right: 0;
    bottom: 0;
    width: 46%;
    max-height: none;
    border-width: 0 0 0 1px;
    border-radius: 0;
    box-shadow: -8px 0 32px rgba(15, 23, 42, .14);
}

.wg-w.is-sidebar.wg-is-left .wg-panel {
    right: auto;
    left: 0;
    border-width: 0 1px 0 0;
    box-shadow: 8px 0 32px rgba(15, 23, 42, .14);
}

/* in a split row the panel is shown on its own, always open */
.wg-w-inline .wg-panel {
    position: relative;
    inset: auto;
    width: 100%;
    max-height: none;
    height: 440px;
    opacity: 1;
    visibility: visible;
    transform: none;
}

.wg-hd {
    display: flex;
    flex: none;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 8px 8px 8px 14px;

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

.wg-logo {
    display: grid;
    flex: none;
    place-items: center;

    width: 24px;
    height: 24px;

    border-radius: 6px;
    background: var(--ac);

    font-size: 13px;
    font-weight: 800;
    color: #ffffff;
    transition: background-color .3s ease;
}

.wg-hx {
    flex: 1;
    min-width: 0;
}

.wg-tt {
    overflow: hidden;
    font-size: 14.5px;
    font-weight: 650;
    line-height: 19px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wg-st {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    line-height: 15px;
    color: var(--mu);
}

.wg-st .wg-dot {
    width: 7px;
    height: 7px;
}

.wg-st .wg-dot::after {
    display: none;
}

.wg-st span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wg-x {
    display: grid;
    flex: none;
    place-items: center;

    width: 32px;
    height: 32px;

    border-radius: 9px;
    color: var(--mu);
}

.wg-x svg {
    width: 18px;
    height: 18px;
}

.wg-bo {
    flex: 1;
    min-height: 0;
    padding: 2px 14px 8px;
    overflow: hidden;
}

.wg-md {
    padding: 11px 0;
    border-bottom: 1px solid var(--bd);
}

.wg-md:last-child {
    border-bottom: 0;
}

.wg-h3 {
    margin-bottom: 8px;
    font-size: 11.5px;
    font-weight: 650;
    line-height: 16px;
    color: var(--mu);
}

.wg-cap {
    margin-top: 6px;
    font-size: 10.5px;
    line-height: 14px;
    color: var(--mu);
}

.wg-kp {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.wg-kt {
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--soft);
    transition: background-color .3s ease;
}

.wg-kt b {
    display: block;
    font-size: 20px;
    font-weight: 700;
    line-height: 26px;
    font-variant-numeric: tabular-nums;
}

.wg-kt span {
    display: block;
    overflow: hidden;
    font-size: 11.5px;
    line-height: 15px;
    color: var(--mu);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wg-kt .wg-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-inline-end: 6px;
    vertical-align: 1px;
}

.wg-kt .wg-dot::after {
    display: none;
}

.wg-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 54px;
}

.wg-bars i {
    flex: 1;
    height: calc(var(--h, 0) * 100%);
    min-height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--ac);
    transition: height .7s var(--ease), background-color .3s ease;
}

.wg-bars i.cur {
    opacity: .55;
}

.wg-ax {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 10.5px;
    line-height: 14px;
    color: var(--mu);
    font-variant-numeric: tabular-nums;
}

.wg-mp {
    position: relative;
}

.wg-mp svg {
    display: block;
    width: 100%;
    height: auto;
}

.wg-mp .sm-country {
    fill: var(--land);
    stroke: var(--bg);
    stroke-width: .4;
    transition: fill .7s ease;
}

.wg-lgd {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 10.5px;
    color: var(--mu);
}

.wg-gr {
    flex: 1;
    max-width: 130px;
    height: 7px;
    border-radius: 4px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--ac) 25%, var(--land)), var(--ac));
}

.wg-rk {
    list-style: none;
}

.wg-rk li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 10px;
    align-items: center;
    padding: 4px 0;
}

.wg-rk .wg-nm {
    overflow: hidden;
    font-size: 12.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wg-rk .wg-vl {
    font-size: 12.5px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.wg-rk .wg-tk {
    grid-column: 1 / 3;
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: var(--soft);
}

.wg-rk .wg-tk i {
    display: block;
    width: calc(var(--w, 0) * 100%);
    height: 100%;
    border-radius: 3px;
    background: var(--ac);
    transition: width .7s var(--ease), background-color .3s ease;
}

.wg-by {
    flex: none;
    padding: 8px 12px 9px;
    overflow: hidden;

    border-top: 1px solid var(--bd);

    font-size: 11px;
    line-height: 16px;
    text-align: center;
    color: var(--mu);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wg-by b {
    font-weight: 700;
    color: var(--tx);
}

.wg-by .wg-free {
    font-weight: 600;
    color: var(--ac);
}

.wg-by svg {
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-inline-end: 5px;
    vertical-align: -2.5px;
}

/* ---------- the settings strip of the small animations ---------- */

.wg-demo {
    position: relative;
    display: grid;
    gap: 12px;
    align-content: start;
    padding: clamp(12px, 1.6vw, 18px);
    overflow: hidden;

    border: 1px solid var(--color-border);
    border-radius: clamp(14px, 1.6vw, 20px);
    background: var(--color-bg-soft);
    box-shadow:
        0 28px 60px -32px rgba(5, 46, 22, .4),
        0 10px 24px -14px rgba(15, 23, 42, .18);
}

:root[data-theme="dark"] .wg-demo {
    background: var(--color-bg);
    box-shadow:
        0 28px 60px -28px rgba(0, 0, 0, .75),
        0 0 0 1px rgba(255, 255, 255, .03);
}

.wg-demo-panel {
    padding: clamp(10px, 1.4vw, 16px);
}

.wg-set {
    display: grid;
    gap: 8px;
    padding: 10px 12px;

    border: 1px solid var(--color-border-soft);
    border-radius: 12px;
    background: var(--color-bg);
}

:root[data-theme="dark"] .wg-set {
    border-color: var(--color-border);
    background: var(--color-bg-soft);
}

.wg-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
}

.wg-row-k {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-text-quiet);
}

/* a field that looks like the app's select, with the chosen value */
.wg-sel {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: min(210px, 100%);
    padding: 6px 10px 6px 12px;

    border: 1px solid var(--color-border);
    border-radius: 9px;

    font-size: 13px;
    font-weight: 700;
    transition: border-color .25s ease, background-color .25s ease;
}

.wg-sel::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-top: -3px;
    border-inline-end: 2px solid var(--color-text-quiet);
    border-bottom: 2px solid var(--color-text-quiet);
    transform: rotate(45deg);
}

.wg-sel.is-flash {
    border-color: color-mix(in srgb, var(--color-green) 55%, var(--color-border));
    background: var(--color-green-soft);
}

.wg-seg {
    display: inline-flex;
    flex-wrap: wrap;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
}

.wg-seg > span {
    padding: 5px 11px;

    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-text-quiet);
    transition: background-color .25s ease, color .25s ease;
}

.wg-seg > span + span {
    border-inline-start: 1px solid var(--color-border);
}

.wg-seg > span.is-on {
    background: var(--color-green-soft);
    color: var(--color-text);
}

.wg-seg-wide {
    display: flex;
}

.wg-seg-wide > span {
    flex: 1 1 auto;
    text-align: center;
}

.wg-swatches {
    display: inline-flex;
    gap: 8px;
}

.wg-swatches i {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 3px transparent;
    transition: box-shadow .25s ease;
}

.wg-swatches i.is-on {
    box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--c);
}

.wg-demo .wg-page-prev {
    height: 290px;
}

/* where it shows: the rule and the pages */
.wg-paths {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.wg-pchip {
    transition: opacity .3s ease;
}

.wg-pchip.is-off {
    opacity: .35;
}

.wg-pchip b {
    unicode-bidi: plaintext;
}

.wg-pages {
    display: grid;
    gap: 8px;
    list-style: none;
}

.wg-pages li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;

    border: 1px solid var(--color-border-soft);
    border-radius: 10px;
    background: var(--color-bg);

    font-size: 13px;
    font-weight: 600;
    transition: border-color .3s ease, background-color .3s ease;
}

:root[data-theme="dark"] .wg-pages li {
    border-color: var(--color-border);
    background: var(--color-bg-soft);
}

.wg-pages li b {
    font-weight: 700;
    unicode-bidi: plaintext;
}

.wg-pages li.is-on {
    border-color: color-mix(in srgb, var(--color-green) 55%, var(--color-border));
    background: var(--color-green-soft);
}

/* the small widget mark at the end of a page row: there when the page shows the widget */
.wg-pg-w {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;

    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg);

    font-size: 11.5px;
    font-weight: 700;
    color: var(--color-text-soft);

    opacity: 0;
    transform: scale(.9);
    transition: opacity .3s ease, transform .3s var(--ease);
}

.wg-pages li.is-on .wg-pg-w {
    opacity: 1;
    transform: none;
}

.wg-pg-w i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--site-bluelake);
}

/* ---------- the pointer ---------- */

.wg-cursor {
    position: absolute;
    z-index: 5;
    left: 60%;
    top: 100%;

    width: 22px;
    height: 22px;
    margin: -3px 0 0 -4px;

    color: #0b1120;
    pointer-events: none;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .3));

    transition: left .9s var(--ease), top .9s var(--ease), transform .15s ease;
}

.wg-cursor.is-press {
    transform: scale(.85);
}

/* ---------- keyframes ---------- */

@keyframes wg-pulse {
    0% { transform: scale(1); opacity: .5; }
    100% { transform: scale(2.6); opacity: 0; }
}

/* ---------- narrow screens ---------- */

@media (max-width: 640px) {

    .wg-w {
        --ox: 10px;
        --oy: 10px;
    }

    .wg-btn {
        font-size: 13px;
    }

    .wg-w.is-sidebar .wg-panel {
        width: 62%;
    }

    .wg-w-inline .wg-panel {
        height: 400px;
    }
}

/* the calm picture (reduce motion, or "Pause animations" before it ever played): nothing moves, nothing is half-drawn */
.wg-still *,
.wg-still *::before,
.wg-still *::after {
    animation: none !important;
    transition: none !important;
}

.wg-still .wg-cursor {
    display: none;
}

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

    .wg-live *,
    .wg-live *::before,
    .wg-live *::after,
    .wg-demo *,
    .wg-demo *::before,
    .wg-demo *::after {
        animation: none !important;
        transition: none !important;
    }

    .wg-cursor {
        display: none;
    }
}
