@source "../../shade/src/**/*.{ts,tsx}";
@source "../../activitypub/src/**/*.{ts,tsx}";
@source "../../admin-x-settings/src/**/*.{ts,tsx}";
@source "../../admin-x-framework/src/**/*.{ts,tsx}";
@source "../node_modules/@tryghost/kg-unsplash-selector/dist/**/*.js";

@import "@tryghost/shade/styles.css";

/* Koenig mounts floating toolbars to document.body. Radix modal dialogs disable
   body pointer events, so body-level Koenig portals need to opt back in. */
[data-kg-portal] {
    pointer-events: auto;
}

/* Legacy utility compatibility (Spirit/Tachyons-style percentages). */
.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

/* Keep admin-x heading line-height consistent with pre-migration settings render. */
.admin-x-base h1,
.admin-x-base h2,
.admin-x-base h3,
.admin-x-base h4,
.admin-x-base h5 {
    line-height: 1.25em;
}

/* ActivityPub onboarding animations previously defined in admin tailwind config */
@keyframes lineExpand {
    0% {
        transform: scaleX(0);
        transform-origin: right;
    }

    100% {
        transform: scaleX(1);
        transform-origin: right;
    }
}

@keyframes scale {
    0% {
        transform: scale(0.8);
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.animate-onboarding-handle-bg {
    opacity: 1;
    animation: fadeIn 0.2s ease-in 0.5s forwards;
}

.animate-onboarding-handle-line {
    animation: lineExpand 0.2s ease-in-out 0.7s forwards;
}

.before\:animate-onboarding-handle-bg::before {
    opacity: 1;
    animation: fadeIn 0.2s ease-in 0.5s forwards;
}

.after\:animate-onboarding-handle-line::after {
    animation: lineExpand 0.2s ease-in-out 0.7s forwards;
    transform: scaleX(1) !important;
    transform-origin: right;
}

.animate-onboarding-handle-label {
    opacity: 1;
    animation: fadeIn 0.2s ease-in 1.2s forwards;
}

.animate-onboarding-next-button {
    opacity: 1;
    animation: fadeIn 0.2s ease-in 2s forwards;
}

.animate-onboarding-followers {
    opacity: 1;
    transform: scale(1);
    animation: fadeIn 0.2s ease-in 0.5s forwards, scale 0.3s ease-in 0.5s forwards;
}

.break-anywhere {
    overflow-wrap: anywhere;
}

/* Base layout - grid structure for alerts and main content */
body.react-admin {
    height: 100svh;
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 100%;
    overflow: hidden; /* Prevent body scroll */
}

/* Alerts show at the top and push content down */
body.react-admin #ember-alerts-wormhole {
    grid-row: 1;
    grid-column: 1;
    z-index: 0; /* Hide alerts when settings app modal is open */
}

/* Main app container - pass through to children (.shade.shade-admin) */
body.react-admin #root {
    display: contents;
}

/* Ensure ShadeApp takes full grid space */
body.react-admin #root .shade.shade-admin {
    grid-row: 2;
    grid-column: 1;
    min-height: 0;
    overflow: hidden;
}

/* iOS safe area handling for mobile navbar */
body.react-admin .safe-area-inset-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

/* Ensure the Ember app renders in the correct position and takes full width/height */
body.react-admin #ember-app {
    width: 100%;
    height: 100%;
    /* Contain legacy Ember z-indexes (e.g. the billing overlay at 9999) so they can't
       paint over React shell chrome like the mobile sidebar drawer (z-50). */
    isolation: isolate;
}

/* Temporary overrides until Ember transition is finished */
body.react-admin .gh-canvas-header {
    padding-top: 20px;
    padding-bottom: 20px;
}

body.react-admin .gh-canvas-breadcrumb+.gh-canvas-title {
    padding-top: 0px;
    margin-top: -4px;
}

body.react-admin .gh-canvas-title,
body.react-admin [data-header="header-title"] {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
}

body.react-admin [data-header="header"] {
    padding-top: 20px;
    min-height: 32px;
    /* padding-bottom: 18px; */
}

body.react-admin [data-navbar="navbar"] {
    padding-top: 20px;
    padding-bottom: 20px;
}

body.react-admin #ember-app .gh-viewport {
    padding-bottom: 0px;
}

body.react-admin .gh-canvas-header {
    z-index: 40;
}

body.react-admin .members-header {
    position: relative;
}

body.react-admin [data-test-table="members"] thead,
body.react-admin [data-test-table="members"] tr {
    position: relative;
    z-index: 30;
}
