/* ==========================================================================
   Fomo Link - design previews: shared base
   Loaded by Pages/Shared/_DesignLayout.cshtml before the design's own CSS.

   Conventions
   - Components of the layout:  .design-switcher, .mock-badge, .design-footer
   - Helper classes / state:    .fd-*  and  .is-*
   - Custom properties:         --fd-*  (designs may override on :root or body)
   - <html> gets  .fd-js        (JavaScript available; reveal states are only
                                 applied when this class is present)
                  .fd-embedded  (page is shown inside an iframe, e.g. gallery
                                 thumbnails; switcher and badge are hidden)
   ========================================================================== */

:root {
    --fd-ease: cubic-bezier(.2, .7, .2, 1);
    --fd-reveal-distance: 28px;
    --fd-reveal-duration: .8s;
    --fd-ui-bg: rgba(15, 17, 26, .86);
    --fd-ui-border: rgba(255, 255, 255, .16);
    --fd-ui-text: #f3f5fb;
    --fd-ui-muted: rgba(243, 245, 251, .64);
    --fd-ui-accent: #7c8cff;
    --fd-focus: #7c8cff;
}

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

body {
    margin: 0;
}

img,
svg,
canvas {
    max-width: 100%;
}

.fd-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Focus ---------------------------------------------------------------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--fd-focus);
    outline-offset: 3px;
    border-radius: 4px;
}

/* --- Reveal on scroll ------------------------------------------------------
   Markup:  data-reveal="up|down|left|right|zoom|fade"  (empty = up)
            data-reveal-delay="200"  (ms)
   shared.js adds .is-revealed when the element becomes visible.              */

.fd-js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, var(--fd-reveal-distance), 0);
    transition: opacity var(--fd-reveal-duration) var(--fd-ease),
                transform var(--fd-reveal-duration) var(--fd-ease);
    will-change: opacity, transform;
}

.fd-js [data-reveal="down"] { transform: translate3d(0, calc(var(--fd-reveal-distance) * -1), 0); }
.fd-js [data-reveal="left"] { transform: translate3d(var(--fd-reveal-distance), 0, 0); }
.fd-js [data-reveal="right"] { transform: translate3d(calc(var(--fd-reveal-distance) * -1), 0, 0); }
.fd-js [data-reveal="zoom"] { transform: scale(.92); }
.fd-js [data-reveal="fade"] { transform: none; }

.fd-js [data-reveal].is-revealed {
    opacity: 1;
    transform: none;
    will-change: auto;
}

/* --- Mock data badge ------------------------------------------------------ */

.mock-badge {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 9000;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .75rem .35rem .6rem;
    border: 1px solid var(--fd-ui-border);
    border-radius: 999px;
    background: var(--fd-ui-bg);
    color: var(--fd-ui-muted);
    font: 500 .72rem/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    letter-spacing: .02em;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: none;
    user-select: none;
}

.mock-badge__dot {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 0 0 0 rgba(251, 191, 36, .6);
    animation: fd-badge-pulse 2.4s ease-out infinite;
}

@keyframes fd-badge-pulse {
    0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, .55); }
    70% { box-shadow: 0 0 0 7px rgba(251, 191, 36, 0); }
    100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}

/* --- Footer (neutral; designs override via their body class) ------------- */

.design-footer {
    padding: 2rem 1rem 5rem;
    text-align: center;
    font: .85rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: inherit;
}

.design-footer__inner {
    opacity: .72;
}

.design-footer a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.design-footer a:hover {
    opacity: .8;
}

/* --- Design switcher (bottom right) --------------------------------------- */

.design-switcher {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5rem;
    font: 500 .85rem/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--fd-ui-text);
}

.design-switcher__toggle {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .6rem 1rem .6rem .8rem;
    border: 1px solid var(--fd-ui-border);
    border-radius: 999px;
    background: var(--fd-ui-bg);
    color: var(--fd-ui-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    transition: transform .25s var(--fd-ease), border-color .25s var(--fd-ease);
}

.design-switcher__toggle:hover {
    transform: translateY(-2px);
    border-color: var(--fd-ui-accent);
}

.design-switcher__icon {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #7c8cff, #22d3ee, #f472b6, #fbbf24, #7c8cff);
    transition: transform .6s var(--fd-ease);
}

.design-switcher__toggle[aria-expanded="true"] .design-switcher__icon {
    transform: rotate(180deg);
}

.design-switcher__panel {
    width: min(18rem, calc(100vw - 32px));
    max-height: min(70vh, 30rem);
    overflow-y: auto;
    padding: .75rem;
    border: 1px solid var(--fd-ui-border);
    border-radius: 1rem;
    background: var(--fd-ui-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
    animation: fd-switcher-in .28s var(--fd-ease);
}

.design-switcher__panel[hidden] {
    display: none;
}

@keyframes fd-switcher-in {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: none; }
}

.design-switcher__title {
    margin: 0 0 .5rem;
    padding: 0 .5rem;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--fd-ui-muted);
}

.design-switcher__list {
    display: grid;
    gap: .15rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.design-switcher__link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    padding: .5rem .6rem;
    border-radius: .6rem;
    color: var(--fd-ui-text);
    text-decoration: none;
    transition: background-color .2s var(--fd-ease);
}

.design-switcher__link:hover {
    background: rgba(255, 255, 255, .09);
}

.design-switcher__link.is-active {
    background: rgba(124, 140, 255, .22);
    box-shadow: inset 0 0 0 1px rgba(124, 140, 255, .55);
}

.design-switcher__hint {
    font-size: .72rem;
    color: var(--fd-ui-muted);
}

/* --- Embedded (gallery thumbnails) ---------------------------------------- */

.fd-embedded .design-switcher,
.fd-embedded .mock-badge {
    display: none;
}

/* --- Small screens -------------------------------------------------------- */

@media (max-width: 575.98px) {
    .design-switcher { right: 10px; bottom: 10px; }
    /* Hide the label visually only: it stays the accessible name of the toggle button. */
    .design-switcher__label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    .design-switcher__toggle { padding: .65rem; }
    .mock-badge { top: 8px; left: 8px; font-size: .66rem; }
}

/* --- Reduced motion: minimise animation and transitions globally ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0ms !important;
        transition-duration: .001ms !important;
        transition-delay: 0ms !important;
        scroll-behavior: auto !important;
    }

    .fd-js [data-reveal] {
        opacity: 1;
        transform: none;
    }
}
