/*
 * TapBios marketing showcases.
 *
 * Miniature, non-interactive replicas of the real product surfaces (bio pages,
 * menus, event games, operator analytics) for the public landing page. Every
 * class is namespaced `tb-` so it can never collide with the real bio.css /
 * menu.css / game.css when those load on their own pages.
 */

/* ------------------------------------------------------------------ *
 * Shared chrome: device + panel frames
 * ------------------------------------------------------------------ */

.tb-phone {
    --tb-phone-width: 15.5rem;
    position: relative;
    width: var(--tb-phone-width);
    max-width: 100%;
    aspect-ratio: 9 / 15.5;
    padding: 0.55rem;
    border-radius: 2.25rem;
    background: var(--tb-surface-2);
    border: 1px solid var(--border-strong);
    box-shadow:
        var(--tb-shadow-sm);
}

.tb-phone::before {
    content: "";
    position: absolute;
    top: 1.05rem;
    left: 50%;
    transform: translateX(-50%);
    width: 4.25rem;
    height: 0.35rem;
    border-radius: 999px;
    background: var(--tb-bg);
    opacity: 0.85;
    z-index: 2;
}

.tb-phone__screen {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 2rem;
    background: var(--tb-bg);
    padding: 1.9rem 0.85rem 1.1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.55rem;
    font-size: 0.75rem;
    line-height: 1.4;
}

/*
 * Top-aligned by default, so anything that does not fit reads as "below the
 * fold" rather than clipped at both ends. The game is a single centred object,
 * so it opts into centring instead.
 */
.tb-phone__screen--center {
    justify-content: center;
}

/* Fades the bottom edge so content that runs past the screen reads as
   "scrolls further" rather than as a clipping bug. */
.tb-phone__screen::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2.75rem;
    pointer-events: none;
    background: none;
}

.tb-phone__screen--center::after {
    display: none;
}

/* Wide panel used for the analytics replica */
.tb-panel {
    position: relative;
    border-radius: var(--tb-radius-lg);
    background: var(--tb-panel-bg);
    border: 1px solid var(--color-border);
    box-shadow: var(--tb-shadow-sm);
    overflow: hidden;
}

.tb-panel__bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--tb-panel-bg-muted);
}

.tb-panel__dots {
    display: flex;
    gap: 0.3rem;
}

.tb-panel__dots span {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--border-strong);
}

.tb-panel__addr {
    flex: 1;
    min-width: 0;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--tb-surface);
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tb-panel__body {
    padding: clamp(1rem, 2.5vw, 1.5rem);
}

/* Marks the panel as illustrative. Deliberately not a pill-with-a-dot badge —
   a short rule and plain sentence case reads as a caption, not a status chip. */
.tb-live-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--color-muted);
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
}

.tb-live-tag::before {
    content: "";
    width: 0.75rem;
    height: 2px;
    border-radius: 999px;
    background: var(--tb-primary);
}

/* ------------------------------------------------------------------ *
 * Hero: QR -> phone
 * ------------------------------------------------------------------ */

.tb-hero-demo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(1rem, 3vw, 2.25rem);
}

/*
 * The QR stays dark-on-light in both themes on purpose: inverted codes are
 * rejected by a meaningful share of phone scanners, and this one is real.
 */
.tb-hero-demo__qr {
    position: relative;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    padding: 1rem;
    border-radius: var(--tb-radius-md);
    background: #FFFFFF;
    border: 1px solid var(--border-strong);
    box-shadow: var(--tb-shadow-sm);
}

.tb-hero-demo__qr svg {
    display: block;
    width: 7.5rem;
    height: 7.5rem;
    color: var(--tb-text);
}

.tb-hero-demo__qr-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tb-muted);
}

/* The scan beam sweeping down the QR */
.tb-hero-demo__beam {
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: 1rem;
    height: 2px;
    border-radius: 999px;
    background: var(--tb-surface);
    box-shadow: var(--tb-shadow-sm);
    animation: tb-scan 3.6s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes tb-scan {
    0%, 8%    { transform: translateY(0); opacity: 0; }
    12%       { opacity: 1; }
    45%       { transform: translateY(7.5rem); opacity: 1; }
    52%, 100% { transform: translateY(7.5rem); opacity: 0; }
}

/* The route arrow between QR and phone */
.tb-hero-demo__route {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    white-space: nowrap;
    color: var(--color-muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tb-hero-demo__route svg {
    width: 2.25rem;
    height: 2.25rem;
    color: var(--tb-primary);
}

/* ------------------------------------------------------------------ *
 * Bio page replica
 * ------------------------------------------------------------------ */

.tb-bio {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.tb-bio__avatar {
    width: 3.1rem;
    height: 3.1rem;
    margin: 0 auto;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tb-surface);
    color: var(--tb-on-primary);
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
}

.tb-bio__name {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--color-text);
}

.tb-bio__headline {
    margin: 0;
    font-size: 0.7rem;
    color: var(--color-muted);
}

.tb-bio__label {
    margin: 0.35rem 0 0;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-subtle);
    text-align: left;
}

.tb-bio__links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.15rem;
}

.tb-bio__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.1rem;
    padding: 0.35rem 0.6rem;
    border-radius: 0.85rem;
    border: 1px solid var(--color-border);
    background: var(--tb-surface);
    color: var(--color-text);
    font-size: 0.72rem;
    font-weight: 700;
}

.tb-bio__btn--primary {
    background: var(--tb-primary);
    border-color: transparent;
    color: var(--tb-on-primary);
}

.tb-bio__socials {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 0.15rem;
}

.tb-bio__socials span {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--tb-surface-2);
    border: 1px solid var(--color-border);
}

/* ------------------------------------------------------------------ *
 * Menu replica
 * ------------------------------------------------------------------ */

.tb-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tb-menu__head {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.tb-menu__kicker {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tb-primary);
}

.tb-menu__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--color-text);
}

.tb-menu__tabs {
    display: flex;
    gap: 0.3rem;
    overflow: hidden;
}

.tb-menu__tab {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: var(--tb-surface-2);
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 0.62rem;
    font-weight: 600;
    white-space: nowrap;
}

.tb-menu__tab--on {
    background: var(--tb-primary);
    border-color: transparent;
    color: var(--tb-on-primary);
}

.tb-menu__items {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.tb-menu__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.7rem;
    background: var(--tb-surface);
    border: 1px solid var(--color-border);
}

.tb-menu__thumb {
    width: 1.9rem;
    height: 1.9rem;
    flex-shrink: 0;
    border-radius: 0.5rem;
    background: var(--tb-surface-2);
    border: 1px solid var(--color-border);
}

.tb-menu__item-body {
    flex: 1;
    min-width: 0;
}

.tb-menu__item-name {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tb-menu__item-note {
    display: block;
    font-size: 0.62rem;
    color: var(--color-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tb-menu__price {
    flex-shrink: 0;
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--color-text);
}

/* ------------------------------------------------------------------ *
 * Event game replica (spin wheel)
 * ------------------------------------------------------------------ */

.tb-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
}

.tb-game__kicker {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.tb-game__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--color-text);
}

.tb-game__wheel-wrap {
    position: relative;
    margin: 0.2rem 0;
}

.tb-game__wheel {
    width: 8.5rem;
    height: 8.5rem;
    border-radius: 50%;
    border: 3px solid var(--tb-surface);
    box-shadow: var(--tb-shadow-sm);
    background: conic-gradient(
        var(--tb-primary) 0deg 45deg,
        var(--tb-surface-2) 45deg 90deg,
        var(--tb-signal) 90deg 135deg,
        var(--tb-surface-2) 135deg 180deg,
        var(--tb-primary) 180deg 225deg,
        var(--tb-surface-2) 225deg 270deg,
        var(--tb-signal) 270deg 315deg,
        var(--tb-surface-2) 315deg 360deg
    );
    animation: tb-spin 9s cubic-bezier(0.25, 0.9, 0.3, 1) infinite;
}

@keyframes tb-spin {
    0%       { transform: rotate(0deg); }
    55%, 100% { transform: rotate(1065deg); }
}

.tb-game__pointer {
    position: absolute;
    top: -0.3rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 0.4rem solid transparent;
    border-right: 0.4rem solid transparent;
    border-top: 0.7rem solid var(--color-text);
}

.tb-game__hub {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: var(--tb-surface);
    border: 1px solid var(--color-border);
}

.tb-game__prizes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
}

.tb-game__prizes span {
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: var(--tb-surface);
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 0.58rem;
    font-weight: 600;
}

.tb-game__cta {
    width: 100%;
    padding: 0.45rem;
    border-radius: 0.85rem;
    background: var(--tb-primary);
    color: var(--tb-on-primary);
    font-size: 0.72rem;
    font-weight: 800;
    text-align: center;
}

.tb-game__note {
    font-size: 0.62rem;
    color: var(--color-muted);
}

/* ------------------------------------------------------------------ *
 * Operator analytics replica
 * ------------------------------------------------------------------ */

.tb-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.tb-stat {
    padding: 0.85rem;
    border-radius: var(--tb-radius-md);
    background: var(--tb-panel-bg-muted);
    border: 1px solid var(--color-border);
}

.tb-stat__label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.tb-stat__value {
    display: block;
    margin-top: 0.2rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--color-text);
    line-height: 1.1;
}

.tb-stat__delta {
    display: inline-block;
    margin-top: 0.15rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--tb-success);
}

.tb-chart {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 2rem);
    align-items: start;
}

.tb-chart__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.tb-chart__title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text);
}

.tb-chart__range {
    font-size: 0.7rem;
    color: var(--color-muted);
}

/* Bars are a plain flex row so they stay crisp at any width */
.tb-chart__bars {
    display: flex;
    align-items: flex-end;
    gap: 0.35rem;
    height: 7rem;
    padding-top: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.tb-chart__bar {
    flex: 1;
    min-width: 0;
    border-radius: 3px 3px 0 0;
    background: color-mix(in srgb, var(--tb-primary) 32%, transparent);
}

.tb-chart__bar--peak {
    background: var(--tb-primary);
}

.tb-chart__axis {
    display: flex;
    justify-content: space-between;
    margin-top: 0.4rem;
    font-size: 0.65rem;
    color: var(--color-muted);
}

.tb-toplist {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tb-toplist__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.75rem;
    align-items: center;
    font-size: 0.75rem;
}

.tb-toplist__name {
    color: var(--color-text);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tb-toplist__count {
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}

.tb-toplist__meter {
    grid-column: 1 / -1;
    height: 4px;
    border-radius: 999px;
    background: var(--tb-surface-2);
    overflow: hidden;
}

.tb-toplist__meter span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--tb-primary);
}

/* ------------------------------------------------------------------ *
 * Showcase section layout
 * ------------------------------------------------------------------ */

.tb-showcase {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(2rem, 6vw, 5rem);
    align-items: center;
}

.tb-showcase + .tb-showcase {
    margin-top: clamp(3.5rem, 8vw, 6rem);
}

/* Even showcases put the replica on the left without reordering the DOM */
.tb-showcase--flip .tb-showcase__art {
    order: -1;
}

.tb-showcase__art {
    display: flex;
    justify-content: center;
}

.tb-showcase__copy h3 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    letter-spacing: -0.03em;
}

.tb-showcase__copy > p {
    color: var(--color-muted);
    margin: 0 0 1.25rem;
    max-width: 34rem;
}

.tb-showcase__points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.tb-showcase__points li {
    position: relative;
    padding-left: 1.6rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.tb-showcase__points li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 0.6rem;
    height: 2px;
    border-radius: 999px;
    background: var(--tb-primary);
}

/* ------------------------------------------------------------------ *
 * Flow rail (Scan / Route / Measure / Improve)
 * ------------------------------------------------------------------ */

.tb-rail {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.tb-rail__step {
    position: relative;
    padding: clamp(1.25rem, 3vw, 2rem) clamp(1rem, 2vw, 1.75rem);
}

.tb-rail__step + .tb-rail__step {
    border-left: 1px solid var(--color-border);
}

.tb-rail__num {
    display: block;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--tb-primary);
    margin-bottom: 0.5rem;
}

.tb-rail__title {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.tb-rail__step p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-muted);
}

/* ------------------------------------------------------------------ *
 * Editorial audience list (replaces the use-case cards)
 * ------------------------------------------------------------------ */

.tb-audiences {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border-top: 1px solid var(--color-border);
}

.tb-audience {
    padding: clamp(1.5rem, 3vw, 2.25rem) clamp(1rem, 2vw, 2rem);
}

.tb-audience + .tb-audience {
    border-left: 1px solid var(--color-border);
}

.tb-audience__label {
    margin: 0 0 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tb-signal);
}

.tb-audience h3 {
    margin: 0 0 0.6rem;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.tb-audience p {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.95rem;
}

/* ------------------------------------------------------------------ *
 * Scroll reveal — opt-in, and disabled for reduced motion
 * ------------------------------------------------------------------ */

.tb-reveal {
    opacity: 0;
    transform: translateY(1.25rem);
    transition: opacity 0.6s cubic-bezier(0.2, 0, 0, 1), transform 0.6s cubic-bezier(0.2, 0, 0, 1);
}

.tb-reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ------------------------------------------------------------------ *
 * Responsive
 * ------------------------------------------------------------------ */

@media (max-width: 991px) {
    .tb-showcase,
    .tb-chart {
        grid-template-columns: minmax(0, 1fr);
    }

    .tb-showcase--flip .tb-showcase__art {
        order: 0;
    }

    .tb-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tb-rail,
    .tb-audiences {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tb-rail__step:nth-child(odd),
    .tb-audience:nth-child(odd) {
        border-left: 0;
    }

    .tb-rail__step:nth-child(n + 3),
    .tb-audience:nth-child(n + 3) {
        border-top: 1px solid var(--color-border);
    }
}

@media (max-width: 767px) {
    .tb-hero-demo {
        flex-direction: column;
    }

    .tb-hero-demo__route {
        flex-direction: row;
    }

    .tb-hero-demo__route svg {
        transform: rotate(90deg);
    }

    .tb-rail,
    .tb-audiences,
    .tb-stats {
        grid-template-columns: minmax(0, 1fr);
    }

    .tb-rail__step,
    .tb-audience {
        border-left: 0;
    }

    .tb-rail__step + .tb-rail__step,
    .tb-audience + .tb-audience {
        border-top: 1px solid var(--color-border);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tb-hero-demo__beam,
    .tb-game__wheel {
        animation: none;
    }

    .tb-hero-demo__beam {
        opacity: 0.6;
        transform: translateY(3.75rem);
    }

    .tb-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
