/* Look of the standalone find-your-table page (index.html). find-table.js sets
   only geometry and never a colour, so every .ft-* class it writes is styled here.
   Mobile-first: guests use this on a phone, standing in the hall. */

/* Weddsite's own brand tokens (weddsites/app/globals.css) on the admin's velvet
   base. Dark only: the velvet backdrop is built for a dark page. */
:root {
    color-scheme: dark;

    /* JS off = original value; the head script replaces it with the measured pin. */
    --vh: 1vh;

    --bg: #0e1319;
    --surface: #18233a;
    --floor: #131c30;
    --hover: #243551;
    --ink: #eef3f8;
    --ink-soft: #b3c1d1;
    --line: #34465f;
    --brand: #88a3be;
    --on-brand: #0e1319;
    --accent: #d2b478;
    --on-accent: #18233a;
    --shadow: rgba(136, 163, 190, 0.28);

    --radius: 14px;
    --font-ui: 'Noto Sans Georgian', sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    overscroll-behavior-y: none;
}

html {
    scrollbar-color: var(--line) transparent;
    scrollbar-width: thin;
    -webkit-text-size-adjust: 100%;
}

html::-webkit-scrollbar {
    width: 8px;
}

html::-webkit-scrollbar-track {
    background-color: transparent;
}

html::-webkit-scrollbar-thumb {
    background-color: var(--line);
    border-radius: 8px;
}

body {
    background-color: var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.5;
}

[hidden] {
    display: none !important;
}

/* ── backdrop ───────────────────────────────────────────────────────────── */

/* Same recipe as the admin's .admin-editor-backdrop: fine grain blended with
   overlay, a blue sheen from the upper centre, plush darkening toward the bottom.
   Fixed behind the page, inset 0 per the Weddsite overlay rule; never force its
   height. script.js scatters the flowers into it. */
.backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background-color: var(--bg);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='v'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23v)'/%3E%3C/svg%3E"),
        radial-gradient(150% 95% at 50% -12%, rgba(136, 163, 190, 0.18), rgba(136, 163, 190, 0.06) 38%, transparent 68%),
        radial-gradient(130% 130% at 50% 122%, rgba(0, 0, 0, 0.6), transparent 62%);
    background-size: 160px 160px, auto, auto;
    background-repeat: repeat, no-repeat, no-repeat;
    background-blend-mode: overlay, normal, normal;
    pointer-events: none;
}

/* A fixed box, so script.js can keep each flower inside its own grid cell. */
.backdrop__flower {
    position: absolute;
    width: 66px;
    height: 108px;
    object-fit: contain;
    opacity: 0.04;
}

/* ── loader ─────────────────────────────────────────────────────────────── */

.loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg);
    transition: opacity 0.4s ease;
}

.loader.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.loader__spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── page frame ─────────────────────────────────────────────────────────── */

.page {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    max-width: 1120px;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0 auto;
    padding: 28px 16px 20px;
}

.vh-lock .page {
    min-height: calc(var(--vh) * 100);
}

.ft {
    flex: 1;
}

/* Everything on this page is centred, down to the guest names. */
.ft {
    text-align: center;
}

.head__title {
    margin: 0 0 18px;
    font-size: 27px;
    font-weight: 600;
    line-height: 1.3;
}

.section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
}

/* ── search ─────────────────────────────────────────────────────────────── */

/* Sticks so a guest can correct a typo from anywhere on a long table list. */
.find {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0 -16px;
    padding: 6px 16px 10px;
    transition: background-color 0.15s ease;
}

/* Only once stuck, when content scrolls beneath it (script.js sets the class). At
   rest a bar here would show as a flat band across the velvet. */
.find.is-stuck {
    background-color: rgba(14, 19, 25, 0.82);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.find__label {
    display: block;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 500;
}

.find__box {
    position: relative;
}

.find__icon {
    position: absolute;
    top: 50%;
    left: 15px;
    width: 20px;
    height: 20px;
    color: var(--ink-soft);
    transform: translateY(-50%);
    pointer-events: none;
}

/* 17px on purpose: below 16px iOS zooms the whole page on focus. */
.find__input {
    display: block;
    width: 100%;
    height: 54px;
    padding: 0 48px 0 46px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background-color: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 17px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease;
}

.find__input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--shadow);
}

.find__input:disabled {
    opacity: 0.6;
}

.find__clear {
    position: absolute;
    top: 50%;
    right: 5px;
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-soft);
    font-size: 15px;
    cursor: pointer;
    transform: translateY(-50%);
}

.find__clear.visible {
    display: block;
}

/* ── status line ────────────────────────────────────────────────────────── */

.ft-state {
    margin: 14px 0 0;
    color: var(--ink-soft);
    font-size: 15px;
}

.ft-state--error {
    color: var(--accent);
}

.ft-state--empty {
    padding: 22px 18px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    text-align: center;
}

/* The embed reloads whenever a guest returns to the tab. The plan they are
   reading stays on screen, so a "loading" line would only make the page jump. */
.ft.is-ready .ft-state--loading {
    display: none;
}

/* Until the feed answers there is nothing to list under this heading. */
.ft:not(.is-ready) .tables {
    display: none;
}

/* ── results ────────────────────────────────────────────────────────────── */

.results {
    display: none;
    margin-top: 6px;
}

.results.visible {
    display: block;
}

.results__label {
    margin: 0 0 8px;
    color: var(--ink-soft);
    font-size: 14px;
}

.ft-result-item {
    margin-bottom: 8px;
    padding: 13px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background-color: var(--surface);
}

.ft-result-name {
    font-size: 16px;
}

.ft-result-name mark {
    background: none;
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.ft-result-host,
.ft-table-host {
    margin-top: 1px;
    color: var(--ink-soft);
    font-size: 13px;
}

/* The answer the guest came for, so it outweighs the name they just typed. */
.ft-result-table {
    margin-top: 2px;
    color: var(--accent);
    font-size: 19px;
    font-weight: 600;
}

/* Only rows that can show a map spot act like buttons (script.js sets .has-map). */
.ft.has-map .ft-result-item {
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.15s ease;
}

.ft.has-map .ft-result-item:active {
    transform: scale(0.985);
}

.ft.has-map .ft-result-item::after {
    content: 'სქემაზე ნახვა';
    display: block;
    margin-top: 4px;
    color: var(--ink-soft);
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ft-result-item:focus-visible,
.ft-map-table:focus-visible,
.ft-table-num:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.ft-no-results {
    margin: 0;
    padding: 18px 16px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--ink-soft);
    font-size: 15px;
}

/* ── hall scheme ────────────────────────────────────────────────────────── */

.hall {
    margin-top: 22px;
    /* Keeps the map clear of the sticky search when a result scrolls to it. */
    scroll-margin-top: 84px;
}

.hall__head {
    margin-bottom: 10px;
}

.hall__hint {
    margin: 1px 0 0;
    color: var(--ink-soft);
    font-size: 14px;
}

/* Must stay 4:5. The panel's board is 4:5 and landmark heights in the feed are
   computed for that ratio, so any other shape would misplace the couple's layout. */
.ft-map {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background-color: var(--floor);
}

/* The embed writes each landmark's centre into left/top, hence the translate. */
.ft-map-item {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px dashed var(--ink-soft);
    border-radius: 8px;
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.1;
    text-align: center;
    transform: translate(-50%, -50%);
}

.ft-map-item--stage {
    border: 0;
    background-color: var(--brand);
    color: var(--on-brand);
    font-size: 13px;
    font-weight: 500;
}

/* The embed sets only the width (the couple's size from the panel); 12% is the
   fallback for a feed without it. Each circle is a container so its number scales
   with it: a 47-table hall has circles near 23px on a phone. */
.ft-map-table {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 12%;
    aspect-ratio: 1;
    border: 1.5px solid var(--brand);
    border-radius: 50%;
    background-color: var(--surface);
    color: var(--ink);
    container-type: inline-size;
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Small circles still need a thumb-sized target. */
.ft-map-table::before {
    content: '';
    position: absolute;
    inset: -5px;
}

.ft-map-num {
    overflow: hidden;
    font-size: 13px;
    font-size: 40cqw;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

/* "VIP", "მთავარი": set by script.js from the label's length. */
.ft-map-table.is-long .ft-map-num {
    font-size: 10px;
    font-size: 26cqw;
}

.ft-map-table.is-longer .ft-map-num {
    font-size: 8px;
    font-size: 15cqw;
}

.ft-map-table.is-dim {
    opacity: 0.3;
}

/* Grown past its neighbours so a guest can spot it across a crowded hall. */
.ft-map-table.is-mine,
.ft-map-table.is-picked {
    z-index: 3;
    border-color: var(--accent);
    background-color: var(--accent);
    color: var(--on-accent);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.3);
}

.ft-map-table.is-picked {
    z-index: 4;
    box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent);
}

/* A name in several tables lights them all; a chosen one must stand out of those. */
.ft-map.has-pick .ft-map-table.is-mine:not(.is-picked) {
    opacity: 0.55;
    transform: translate(-50%, -50%);
}

/* The panel of whoever sits at the tapped table, cloned from its list card. */
.picked {
    position: relative;
    margin-top: 10px;
    /* Equal sides: the close button's gutter must not push the names off-centre. */
    padding: 14px 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background-color: var(--surface);
}

.picked__title {
    margin: 0;
    color: var(--accent);
    font-size: 18px;
    font-weight: 600;
}

.picked__close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-soft);
    font-size: 15px;
    cursor: pointer;
}

/* ── all tables ─────────────────────────────────────────────────────────── */

.tables {
    margin-top: 28px;
}

.tables__list {
    margin-top: 10px;
}

.ft-table-card {
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background-color: var(--surface);
}

/* Collapsed by default: 40 open tables would be a very long phone scroll. */
.ft-table-num {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ft-table-num::after {
    content: attr(data-count);
    flex-shrink: 0;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 400;
}

.ft-table-note {
    margin-top: -8px;
    padding: 0 16px 12px;
    color: var(--ink-soft);
    font-size: 14px;
}

.ft-table-guests {
    display: none;
    margin: 0;
    padding: 0 16px 14px;
    list-style: none;
}

.ft-table-card.is-open .ft-table-guests,
.picked .ft-table-guests {
    display: block;
}

.ft-table-guests li {
    padding: 3px 0;
    font-size: 15px;
}

.picked .ft-table-note {
    margin: 0;
    padding: 0;
}

.picked .ft-table-guests {
    margin-top: 6px;
    padding: 0;
}

/* ── footer ─────────────────────────────────────────────────────────────── */

.foot {
    margin-top: 32px;
    text-align: center;
}

.foot__credit {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--ink);
    font-size: 12px;
    text-decoration: none;
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

.foot__credit:hover {
    opacity: 0.75;
}

/* A mask so the logo takes the palette's ink in both colour schemes. */
.foot__logo {
    width: 18px;
    height: 18px;
    background-color: currentColor;
    -webkit-mask: url('logo-vector.svg') center / contain no-repeat;
    mask: url('logo-vector.svg') center / contain no-repeat;
}

/* ── larger screens ─────────────────────────────────────────────────────── */

@media (min-width: 481px) {
    .page {
        padding-right: 24px;
        padding-left: 24px;
    }

    .find {
        margin-right: -24px;
        margin-left: -24px;
        padding-right: 24px;
        padding-left: 24px;
    }

    .ft-map-item {
        font-size: 12px;
    }
}

/* Title and search centred over the full width; below them, results and map sit
   side by side so the map stays in view while the guest searches. Rows are placed
   explicitly so a status line appearing cannot shift the map's start row. */
@media (min-width: 769px) {
    .page {
        padding-top: 48px;
    }

    .ft {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: auto auto auto auto auto auto 1fr;
        column-gap: 40px;
        align-items: start;
    }

    .head,
    .find__label,
    .find,
    .ft-state {
        grid-column: 1 / -1;
    }

    .head { grid-row: 1; }
    .find__label { grid-row: 2; }
    .find { grid-row: 3; }
    .ft-state { grid-row: 4; }

    .results {
        grid-column: 1;
        grid-row: 5;
    }

    .tables {
        grid-column: 1;
        grid-row: 6;
        margin-top: 6px;
    }

    .find {
        position: static;
        justify-self: center;
        width: 100%;
        max-width: 560px;
        margin: 0;
        padding: 6px 0 12px;
    }

    /* Static from this width, so it is never actually stuck here. */
    .find.is-stuck {
        background-color: transparent;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .hall {
        position: sticky;
        top: 24px;
        grid-column: 2;
        grid-row: 5 / -1;
        margin-top: 6px;
    }

    /* Height-led so the whole hall fits under the centred search on a short laptop
       screen: 4:5 means width is 80% of the height left for it. */
    .ft-map {
        max-width: calc((var(--vh) * 100 - 310px) * 0.8);
        margin: 0 auto;
    }

    .picked {
        max-width: calc((var(--vh) * 100 - 310px) * 0.8);
        margin-right: auto;
        margin-left: auto;
    }

    /* Without a map, one centred column rather than half an empty page. */
    .ft:not(.has-map) {
        grid-template-columns: minmax(0, 620px);
        justify-content: center;
    }

    .head__title {
        font-size: 34px;
    }
}

@media (min-width: 1025px) {
    .ft {
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
        column-gap: 64px;
    }
}

@media (hover: hover) {
    .ft.has-map .ft-result-item:hover {
        border-color: var(--brand);
    }

    .ft-map-table:hover:not(.is-mine):not(.is-picked) {
        background-color: var(--hover);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
    }
}
