/* "Try it now" demo (platform-demo.html). Uses platform-home.css for the header, buttons and footer; this adds the
   three panes: the guest's phone, the organizer's approval list and the big screen, in the boards' own look. */

.demo-hero {
    padding: 44px 0 24px;
    background: linear-gradient(180deg, var(--blue-100) 0%, var(--paper) 100%);
}

.demo-hero h1 {
    margin: 0 0 10px;
    font-size: clamp(1.8rem, 4.4vw, 2.6rem);
    line-height: 1.15;
    color: var(--blue-900);
}

.demo-hero p {
    margin: 0 0 16px;
    max-width: 44em;
    color: var(--muted);
    font-size: 1.08rem;
}

.demo-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--ink);
    font-weight: 600;
}

.demo-steps li,
.demo-pane h2 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.demo-steps .num,
.demo-pane .step {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--blue-500);
    color: #fff;
    font-size: 0.85rem;
}

.demo-stage {
    padding: 8px 0 40px;
}

/* phone | organizer on one row, the big screen across the full width below */
.demo-grid {
    display: grid;
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.demo-pane h2 {
    margin: 18px 0 12px;
    font-size: 1.15rem;
    color: var(--blue-900);
}

.wide-pane {
    grid-column: 1 / -1;
}

/* ---- the phone ---- */

.phone {
    width: 100%;
    max-width: 330px;
    padding: 12px;
    border-radius: 34px;
    background: #1d2733;
    box-shadow: 0 14px 34px rgba(18, 74, 124, 0.25);
}

.phone-screen {
    position: relative;
    min-height: 470px;
    padding: 14px 12px;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(180deg, var(--blue-500) 0%, var(--blue-100) 100%);
}

.phone-card {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff;
    font-size: 0.82rem;
    color: var(--muted);
}

.phone-board-title {
    color: var(--ink);
    font-size: 1rem;
}

.phone-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    margin-top: 12px;
}

.d-tile {
    position: relative;
    aspect-ratio: 1;
    border: 0;
    border-radius: 7px;
    padding: 0;
    overflow: hidden;
    background: #fff;
    color: var(--blue-700);
    font: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1;
}

.d-tile.open {
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(18, 74, 124, 0.25);
}

.d-tile.open:hover,
.d-tile.open:focus-visible {
    outline: 3px solid var(--orange);
    outline-offset: 1px;
}

.d-tile.pending {
    background: #fff4dc;
    color: #b26b00;
}

.d-tile img,
.d-cell img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.phone-note {
    margin: 12px 2px 0;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(18, 74, 124, 0.5);
}

.sheet {
    position: absolute;
    inset: auto 0 0 0;
    max-height: 92%;
    overflow-y: auto;
    padding: 14px;
    border-radius: 20px 20px 0 0;
    background: #fff;
    box-shadow: 0 -8px 24px rgba(18, 74, 124, 0.25);
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.sheet-x {
    border: 0;
    background: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
}

.sheet-body {
    display: grid;
    gap: 10px;
}

.sheet-hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.preview-box {
    position: relative;
    width: 140px;
    aspect-ratio: 1;
    justify-self: center;
    border-radius: 10px;
    overflow: hidden;
    background: var(--wash);
}

.preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.field {
    display: grid;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
}

.demo-btn {
    display: inline-block;
    padding: 10px 16px;
    border: 0;
    border-radius: 999px;
    background: var(--blue-500);
    color: #fff;
    font: inherit;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
}

.demo-btn.ghost {
    background: #fff;
    color: var(--blue-700);
    box-shadow: inset 0 0 0 2px var(--blue-500);
}

.demo-btn.wide {
    width: 100%;
}

.demo-btn.danger {
    background: #fff;
    color: var(--red);
    box-shadow: inset 0 0 0 2px var(--red);
}

.demo-link {
    border: 0;
    background: none;
    color: var(--blue-700);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

/* ---- the organizer: the board's approval page on a computer screen ---- */

.monitor {
    max-width: 640px;
}

.monitor-screen {
    position: relative;
    display: flex;
    flex-direction: column;
    aspect-ratio: 16 / 10;
    border: 10px solid #1d2733;
    border-bottom-width: 14px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(180deg, var(--blue-500) 0%, var(--blue-500) 55%, var(--blue-100) 100%);
    box-shadow: 0 14px 34px rgba(18, 74, 124, 0.25);
}

/* the stand under the screen */
.monitor-stand {
    position: relative;
    width: 22%;
    height: 26px;
    margin: 0 auto;
    background: linear-gradient(180deg, #2c3846, #1d2733);
    clip-path: polygon(30% 0, 70% 0, 82% 100%, 18% 100%);
}

.monitor-stand::after {
    content: "";
    position: absolute;
    left: -30%;
    right: -30%;
    bottom: -6px;
    height: 6px;
    border-radius: 3px;
    background: #1d2733;
}

/* the browser's own bar: three dots and the page's name */
.browser-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    background: #e8edf2;
    font-size: 0.7rem;
    color: var(--muted);
}

.browser-bar i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c3ccd6;
}

.browser-bar span {
    margin-left: 8px;
    padding: 1px 10px;
    border-radius: 999px;
    background: #fff;
}

.admin-page {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    padding: 8px;
}

.admin-card {
    display: grid;
    gap: 3px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.93);
    font-size: 0.74rem;
    color: var(--muted);
}

.admin-card strong {
    color: var(--ink);
    font-size: 0.95rem;
}

.admin-count {
    font-weight: 700;
    color: var(--ink);
}

.admin-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    color: var(--ink);
}

.admin-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.key {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.key.open {
    background: linear-gradient(rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.34)), var(--blue-500);
}

.key.pending,
.key.approved {
    background: linear-gradient(135deg, #f2b66d 0 50%, #6fb1e3 50% 100%);
    border: 2px solid #ff3d00;
}

.key.approved {
    border-color: #4caf50;
}

.key.approved::after {
    content: "";
    position: absolute;
    top: -3px;
    right: -3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e05252;
    box-shadow: 0 0 0 1px #fff;
}

/* every square, as on the big screen: open ones soft, pictures filling theirs (red edge while waiting, green on screen) */
.admin-grid {
    display: grid;
    flex: 1 1 auto;
    gap: 4px;
    min-height: 0;
}

.a-wrap {
    position: relative;
    min-width: 0;
    min-height: 0;
}

.a-cell {
    position: relative;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 7px;
    padding: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.34);
    cursor: pointer;
}

.a-cell.open {
    cursor: default;
}

.a-cell img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.a-cell img.whole,
.review-media img.whole {
    object-fit: contain;
}

/* the edge is a layer over the picture: red and pulsing while it waits, green while it is on screen */
.a-cell.pending::after,
.a-cell.approved::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 3px #4caf50;
}

.a-cell.pending::after {
    box-shadow: inset 0 0 0 3px #ff3d00;
    animation: pending-pulse 1.4s ease-in-out infinite;
}

@keyframes pending-pulse {
    0%, 100% { box-shadow: inset 0 0 0 3px #ff3d00; }
    50% { box-shadow: inset 0 0 0 3px #ff3d00, inset 0 0 12px 4px rgba(255, 61, 0, 0.9); }
}

@media (prefers-reduced-motion: reduce) {
    .a-cell.pending::after { animation: none; }
}

.a-clear {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #e05252;
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

/* a showcase board: no squares, the pictures in a gallery (pending first) */
.admin-grid.gallery {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    grid-auto-rows: 64px;
    align-content: start;
    overflow-y: auto;
}

/* the window over the page: one picture, Approve / Reject (or take it down) */
.review {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 10px;
    background: rgba(13, 28, 44, 0.45);
}

.review-box {
    display: grid;
    justify-items: center;
    gap: 8px;
    width: min(260px, 100%);
    max-height: 100%;
    overflow-y: auto;
    padding: 14px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.review-title {
    margin: 0;
    font-weight: 700;
    color: var(--ink);
}

.review-media {
    position: relative;
    width: 120px;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--wash);
}

.review-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.review-paid {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.review-actions {
    display: flex;
    gap: 8px;
}

.admin-note {
    margin: 10px 2px 0;
    font-size: 0.9rem;
    color: var(--muted);
}

/* ---- the big screen ---- */

.screen {
    display: grid;
    grid-template-columns: 1fr 22%;
    gap: 10px;
    aspect-ratio: 16 / 9;
    padding: 12px;
    border: 10px solid #1d2733;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--blue-500) 0%, var(--blue-100) 100%);
    box-shadow: 0 14px 34px rgba(18, 74, 124, 0.25);
}

.screen-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 1.2%;
    min-height: 0;
}

.d-cell {
    position: relative;
    display: grid;
    place-items: center;
    border-radius: 9px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.85);
    font-size: clamp(0.8rem, 2.2vw, 1.5rem);
}

.d-cell.new {
    animation: pop-in 900ms ease-out;
    box-shadow: 0 0 0 4px var(--orange);
}

@keyframes pop-in {
    0% { transform: scale(0.4); opacity: 0; }
    70% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .d-cell.new { animation: none; }
}

.screen-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4%;
    padding: 6% 4%;
    border-radius: 9px;
    background: #fff;
    text-align: center;
    font-size: clamp(0.55rem, 1.2vw, 0.9rem);
    color: var(--muted);
    min-width: 0;
    min-height: 0;
    overflow: hidden; /* on a small screen the QR code and logo shrink to fit instead of spilling out */
}

.screen-side strong {
    color: var(--ink);
    font-size: 1.25em;
}

.screen-scan {
    margin-top: auto;
    font-weight: 700;
    color: var(--ink);
}

#screen-qr {
    flex: 0 1 auto;
    min-height: 0;
    max-width: 80%;
    max-height: 45%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.screen-logo {
    flex: 0 1 auto;
    min-height: 0;
    max-width: 60%;
    max-height: 16%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.demo-again {
    margin-top: 10px;
    text-align: center;
}

.demo-cta {
    padding: 36px 0 52px;
    background: var(--blue-100);
    text-align: center;
}

.demo-cta h2 {
    margin: 0 0 8px;
    color: var(--blue-900);
}

.demo-cta p {
    margin: 0 0 18px;
    color: var(--muted);
}

/* Phones and narrow windows: one column (phone, organizer, big screen). */
@media (max-width: 760px) {
    .demo-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .phone {
        margin: 0 auto;
    }

    .screen {
        border-width: 6px;
        padding: 6px;
        gap: 6px;
    }

    /* the computer screen grows taller instead of shrinking its squares to nothing */
    .monitor-screen {
        aspect-ratio: auto;
        min-height: 260px;
        border-width: 7px 7px 10px;
    }

    .admin-grid:not(.gallery) {
        grid-template-rows: none !important;
        grid-auto-rows: auto;
    }

    .admin-grid:not(.gallery) .a-wrap {
        aspect-ratio: 1;
    }
}

/* ---- choosing the kind of board (classic grid or showcase) ---- */

.screen-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
}

.kind-switch {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: var(--wash);
    box-shadow: inset 0 0 0 1px var(--line);
}

.kind-switch button {
    padding: 7px 14px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--blue-700);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.kind-switch button[aria-pressed="true"] {
    background: var(--blue-500);
    color: #fff;
}

.kind-hint {
    margin: 0 0 10px;
    color: var(--muted);
}

/* the phone of a Showcase board */
.phone-showcase {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.phone-recent {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.phone-recent .d-tile {
    cursor: default;
}

/* the big screen of a Showcase board: the real mosaic layout, pictures taking turns */
.screen-grid.showcase .d-cell {
    border-radius: 12px;
}

.screen-grid.showcase .d-cell img {
    transition: opacity 600ms ease;
}

/* A design is shown whole on its own color (the cell's background); a photo fills its cell. */
.d-cell img.whole {
    object-fit: contain;
}

/* A full board: the button is greyed out (like the real guest page). */
.demo-btn:disabled {
    background: #b9c6d3;
    color: #fff;
    box-shadow: none;
    cursor: not-allowed;
}

/* ---- "Design Your Own" on the phone (like the real guest page's editor) ---- */

/* while designing, the sheet covers the whole phone screen */
.sheet.tall {
    top: 0;
    max-height: none;
    border-radius: 0;
}

.demo-btn.small {
    padding: 6px 10px;
    font-size: 0.8rem;
}

.d-view {
    position: relative;
    width: 100%;
    max-width: 240px;
    justify-self: center;
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    touch-action: none;
}

#design-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.d-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.d-tool {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
}

.d-tool select {
    flex: 1;
    min-width: 0;
    padding: 4px;
    font: inherit;
    font-weight: 400;
}

.d-slider input[type="range"] {
    flex: 1;
    min-width: 0;
}

.d-tool input[type="color"] {
    width: 30px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 4px;
    cursor: pointer;
}

.d-tool :disabled,
.d-swatch:disabled {
    opacity: 0.4;
    cursor: default;
}

.d-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.d-swatch {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 2px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
}

#d-rotate-value {
    min-width: 34px;
    text-align: right;
    font-weight: 400;
    color: var(--muted);
}

.d-item {
    position: absolute;
    user-select: none;
}

.d-grip {
    display: flex;
    justify-content: flex-end;
    padding: 2px 3px;
    border: 1px dashed #999;
    border-bottom: none;
    background: rgba(255, 255, 255, 0.85);
    cursor: move;
    touch-action: none;
}

.d-delete {
    width: 15px;
    height: 15px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #e05252;
    color: #fff;
    font-size: 10px;
    line-height: 15px;
    cursor: pointer;
}

.d-text {
    min-width: 24px;
    padding: 2px 5px;
    border: 1px dashed #999;
    background: rgba(255, 255, 255, 0.5);
    line-height: 1.2;
    text-align: center;
    white-space: pre;
    outline: none;
}

.d-item.selected .d-text {
    border: 1px solid #2563eb;
}

.d-emoji {
    display: block;
    cursor: move;
    touch-action: none;
}

.d-item.selected .d-emoji {
    outline: 1px solid #2563eb;
}

.d-emoji-panel {
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--wash);
}

.d-emoji-tabs {
    display: flex;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
}

.d-emoji-tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 2px 0;
    border: 0;
    border-bottom: 3px solid transparent;
    background: none;
    font-size: 1rem;
    opacity: 0.6;
    cursor: pointer;
}

.d-emoji-tab.active {
    opacity: 1;
    border-bottom-color: var(--blue-500);
}

.d-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
    max-height: 110px;
    overflow-y: auto;
}

.d-emoji-option {
    padding: 2px 0;
    border: 0;
    border-radius: 6px;
    background: none;
    font-size: 1.35rem;
    cursor: pointer;
}

.d-emoji-option:hover,
.d-emoji-option:focus-visible {
    background: var(--blue-100);
}

/* ---- the made-up board's own graphic (beside the title on the phone and the approval page, top of the big screen's sidebar) ---- */
.d-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.demo-graphic {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
}

.admin-card .demo-graphic {
    width: 28px;
    height: 28px;
}

.screen-side .screen-graphic {
    flex: 0 1 auto;
    width: auto;
    height: auto;
    max-width: 55%;
    max-height: 22%;
    min-height: 0;
    object-fit: contain;
}

/* On a narrow screen the big screen's sidebar is tiny: its thank-you line gives way, so the graphic and QR code keep some size. */
@media (max-width: 760px) {
    .screen-side > span {
        display: none;
    }
}

/* The squares keep the big screen's left-to-right order in every language, as on a real board (right-to-left ones too). */
.phone-grid,
.screen-grid,
.admin-grid {
    direction: ltr;
}
