/*
 * Public-site / workspace handoff surface.
 * The public page itself keeps its existing layout; only its outer surface
 * and this fixed, viewport-sized sibling participate in the transition.
 */
#site_surface {
    position: absolute;
    inset: 0;
    transform: none;
    transition: transform 750ms ease-in-out;
}

#workspace_surface {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: block;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #fff;
    color: #171717;
    transform: translateY(100dvh);
    transition: transform 750ms ease-in-out;
    will-change: transform;
}

#workspace_surface[hidden] {
    display: none !important;
}

body[data-workspace-open="true"] #site_surface {
    transform: translateY(-100dvh);
}

body[data-workspace-transition="true"]:not([data-workspace-open="true"]) #site_surface {
    transform: translateY(0);
}

body[data-workspace-open="true"] #workspace_surface {
    transform: translateY(0);
}

.workspace_surface_header {
    position: absolute;
    inset: 0 0 auto;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 64px;
    min-height: 64px;
    background: transparent;
    pointer-events: none;
}

#workspace_return {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #000;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

#workspace_chevron {
    display: block;
    width: 20px;
    height: 20px;
    flex: none;
    overflow: visible;
    fill: #000;
    cursor: pointer;
    pointer-events: auto;
    transform: rotate(180deg);
    transition: transform 250ms ease-in-out;
}

#workspace_chevron path {
    fill: #000;
}

#workspace_return:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

#workspace_frame {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
    visibility: hidden;
}

#workspace_loading {
    position: absolute;
    inset: 64px 0 0;
    display: grid;
    place-content: center;
    margin: 0;
    padding: 24px;
    background: #fff;
    color: #171717;
    font: 16px/1.5 Figtree, sans-serif;
}
#workspace_loading[hidden] { display: none; }

#workspace_error {
    position: absolute;
    inset: 64px 0 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background: #fff;
    color: #171717;
    text-align: center;
}

#workspace_error[hidden] {
    display: none !important;
}

#workspace_error p {
    margin: 0;
}

#workspace_retry {
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid #171717;
    border-radius: 0;
    background: #fff;
    color: #171717;
    cursor: pointer;
}

#workspace_retry:hover {
    background: #171717;
    color: #fff;
}

#workspace_retry:focus-visible {
    outline: 2px solid #171717;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    #site_surface,
    #workspace_surface {
        transition: none;
        will-change: auto;
    }

    #workspace_chevron {
        transition: none;
    }
}

/* Standalone protected routes and no-JS sign-in keep a public return too.
 * The retained parent's header replaces this link only in our own iframe. */
html:not(.workspace-embedded) .admin-shell {
    padding-top: 64px;
}
html:not(.workspace-embedded) .admin-authenticated { padding-top: 0; }
.workspace-embedded .admin-shell:not(.admin-authenticated) { padding-top: 64px; }
html:not(.workspace-embedded) .admin-header { top: 0; }
.workspace-embedded .admin-header { top: 0; }
#workspace_direct_return {
    position: fixed;
    top: 10px;
    left: calc(50% - 22px);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background: transparent;
    color: #000;
}
#workspace_direct_return svg {
    fill: #000;
    transform: rotate(180deg);
    transition: transform 250ms ease-in-out;
}
.workspace-embedded #workspace_direct_return { display: none; }
#workspace_direct_return:focus-visible { outline: 2px solid #000; outline-offset: -4px; }
@media (any-hover: hover) {
    #workspace_direct_return:hover svg { transform: scale(150%) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
    #workspace_direct_return svg { transition: none; }
}
