/* Public floor map (live-view.php). Colours are the church website's: its two brand colours
   and the shades it mixes from them (church-website resources/css/tokens.css). */
:root {
    --brand-blue: #06486A;
    --brand-gold: #B5A213;
    --base-white: #FFFFFF;
    --base-black: #000000;

    --blue-night: color-mix(in oklab, var(--brand-blue) 62%, var(--base-black));
    --blue-deep: color-mix(in oklab, var(--brand-blue) 82%, var(--base-black));
    --gold: var(--brand-gold);
    --gold-light: color-mix(in oklab, var(--brand-gold) 55%, var(--base-white));
    --light: var(--base-white);

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }
body {
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    font-family: 'Noto Sans Ethiopic', system-ui, -apple-system, sans-serif;
    color: var(--light);
    background:
        radial-gradient(ellipse at top, color-mix(in srgb, var(--brand-blue) 55%, transparent), transparent 60%),
        var(--blue-deep);
}

.floor-page {
    width: 100%;
    max-width: 1500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

h1 {
    font-size: clamp(1.25rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--gold-light);
}
h1 span { display: block; margin-top: 0.15rem; font-size: 0.55em; font-weight: 400; color: color-mix(in srgb, var(--light) 70%, transparent); }

/* The floor: as wide as the screen allows while the heading, total and key still fit on one
   screen (projector). 2.128 = the drawing's width / height (41.5 / 19.5). */
.floor {
    display: block;
    width: min(100%, calc((100svh - 17.5rem) * 2.128));
    min-width: min(100%, 320px);
    height: auto;
}
.floor [data-region] { cursor: pointer; transition: opacity 0.3s ease; }
.floor__free { fill: color-mix(in srgb, var(--light) 8%, transparent); }
/* Each colour also gets a hairline of itself, so no gap shows where two colours meet */
.floor__paid, .floor__promised { stroke-width: 1px; vector-effect: non-scaling-stroke; }
.floor__paid { fill: var(--gold); stroke: var(--gold); }
.floor__promised { fill: var(--gold-light); stroke: var(--gold-light); }
.floor__metre { fill: none; stroke: color-mix(in srgb, var(--blue-night) 45%, transparent); stroke-width: 0.045; }
.floor__grid { pointer-events: none; }
.floor__edge {
    fill: none;
    stroke: color-mix(in srgb, var(--light) 30%, transparent);
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}
/* Paid and promised sweep in from the left once the first numbers arrive */
.floor__sweep { clip-path: inset(0 100% 0 0); }
.floor.is-ready .floor__sweep { clip-path: inset(0); transition: clip-path 2.2s var(--ease-out) 0.2s; }

/* Pointing at (or tapping) a colour, on the map or in the key, fades the other two */
[data-active='paid'] .floor [data-region]:not([data-region='paid']),
[data-active='promised'] .floor [data-region]:not([data-region='promised']),
[data-active='free'] .floor [data-region]:not([data-region='free']) { opacity: 0.3; }

.covered { font-size: clamp(1rem, 2vw, 1.35rem); font-weight: 700; color: var(--gold-light); }
.covered span { display: block; font-size: 0.75em; font-weight: 400; color: color-mix(in srgb, var(--light) 70%, transparent); }

.key { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.key__item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border-radius: 9999px;
    font: inherit;
    font-size: clamp(0.85rem, 1.4vw, 1.05rem);
    color: color-mix(in srgb, var(--light) 85%, transparent);
    background: none;
    border: 1px solid color-mix(in srgb, var(--light) 0%, transparent);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.key__item span[lang='en'] { color: color-mix(in srgb, var(--light) 65%, transparent); }
.key__item:hover,
.key__item[aria-pressed='true'],
[data-active='paid'] .key__item[data-region='paid'],
[data-active='promised'] .key__item[data-region='promised'],
[data-active='free'] .key__item[data-region='free'] {
    color: var(--light);
    background: color-mix(in srgb, var(--light) 8%, transparent);
    border-color: color-mix(in srgb, var(--gold) 45%, transparent);
}
.key__item:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.key__swatch { width: 0.95rem; height: 0.95rem; flex: none; border-radius: 0.2rem; background: var(--gold); }
.key__swatch--promised { background: var(--gold-light); }
.key__swatch--free {
    background: color-mix(in srgb, var(--light) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--light) 35%, transparent);
}

/* A number that just changed glows for a moment */
.flash { animation: flash 1.6s ease-out; }
@keyframes flash {
    0% { filter: brightness(1.8) drop-shadow(0 0 6px var(--gold)); }
    100% { filter: none; }
}

/* Fullscreen button for the projector: fades away when the mouse is still */
.fullscreen {
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.45rem 0.75rem;
    border-radius: 0.6rem;
    font: inherit;
    font-size: 0.85rem;
    color: var(--light);
    background: color-mix(in srgb, var(--light) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--light) 20%, transparent);
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.25s ease;
}
.fullscreen:hover { opacity: 1; }
.fullscreen.is-hidden { opacity: 0; pointer-events: none; }

@media (max-width: 640px) {
    .fullscreen span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .flash { animation: none; }
    .floor__sweep, .floor.is-ready .floor__sweep { clip-path: none; transition: none; }
}
