/* ==UserStyle==
@name           Bluesky optimized & customizable for wide screens
@description    Bluesky website interface is reworked to offer a cleaner and comfortable experience on desktop, with visual adjustments that adapt to your needs.
@version        1.0.4
@author         BreatFR (https://breat.fr)
@namespace      https://breat.fr
@homepageURL    https://usercssjs.breat.fr/b/bluesky
@updateURL      https://code.breat.fr/b/bluesky/css/pc.user.css
@supportURL     https://discord.gg/Q8KSHzdBxs
@license        AGPL-3.0-or-later; https://www.gnu.org/licenses/agpl-3.0.txt
@preprocessor   stylus

@var    checkbox    bigimages       "Big images"        1
@var    checkbox    hidescrollbars  "Hide scrollbars"   1
@var    checkbox    widemode        "Wide mode"         1
==/UserStyle== */

/* ==Credits==
Website         https://breat.fr
Bluesky			https://bsky.app/profile/breatfroff.bsky.social
facebook        https://www.facebook.com/breatfroff
mastodon        https://mastodon.social/@breat_fr
telegram        https://t.me/breatfr
vk              https://vk.com/breatfroff
X (twitter)     https://x.com/breatfroff
==/Credits== */

/* ==Support==
brave Creators  https://publishers.basicattentiontoken.org/c/breatfr
Buy me a coffee https://buymeacoffee.com/breatfr
ko-fi           https://ko-fi.com/breatfr
PayPal          https://paypal.me/breat
==/Support== */

@-moz-document domain("bsky.app") {
    /* Whole website */
    :root {
        --themeversion: 'Theme v1.0.4 by BreatFR (https://breat.fr)';
        --install: ' usercssjs.breat.fr/b/bluesky';
        --help: ' discord.gg/Q8KSHzdBxs';
        --support1: ' ko-fi.com/breatfr';
        --support2: ' paypal.me/breat';
    }

    @media screen and (min-width: 900px) {
        body::before {
            background: linear-gradient(88.55deg, rgb(139, 109, 255) 22.43%, rgb(254, 132, 132) 92.28%);
            background-clip: text;
            color: transparent;
            content: var(--themeversion) '\A\AInstall & Infos\A' url("https://code.breat.fr/share/images/icons/breat.fr.png") var(--install) '\A\AHelp\A' url("https://code.breat.fr/share/images/icons/discord.png") var(--help) '\A\ASupport me\A' url("https://code.breat.fr/share/images/icons/ko-fi.png") var(--support1) '\A' url("https://code.breat.fr/share/images/icons/paypal.png") var(--support2);
            bottom: 1em;
            display: inline-block;
            font-family: InterVariable, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
            font-size: 1.2rem;
            line-height: 1.5;
            right: 1em;
            pointer-events: none;
            position: fixed;
            text-align: center;
            width: 330px;
            white-space: pre-line;
            z-index: 9999;
        }
    }

    body {
        max-width: 100vw;
        overflow-x: hidden;
    }

    if bigimages {
        [style*="height: 100%"][style*="border-radius: 12px"][style*="overflow: hidden"][style*="aspect-ratio:"] {
            aspect-ratio: auto !important;
            width: 100% !important;
        }
        [data-expoimage="true"],
        [data-expoimage="true"] > div > img {
            aspect-ratio: auto !important;
            height: auto !important;
            max-width: 100% !important;
            min-width: 100% !important;
            min-height: 100% !important;
            object-fit: cover !important;
            object-position: center center !important;
            position: initial !important;
            width: 100% !important;
        }
        [data-testid="userBannerImage"] {
            height: 100% !important;
        }
    }

    if hidescrollbars {
        *,
        :root ::-webkit-scrollbar {
            scrollbar-width: none !important;
            -ms-overflow-style: none !important;
            -moz-overflow-style: none !important;
            -webkit-overflow-style: none !important;
        }
        ::-webkit-scrollbar {
            display: none !important;
            width: 0 !important;
        }
    }

    if widemode {
        /* Back to top */
        [data-testid="loadLatestBtn"] {
            display: flex;
            justify-content: center;
            left: 0;
            width: 240px;
        }
        [data-testid="loadLatestBtn"] > button {
            margin: auto;
        }

        /* Left nav */
        nav {
            left: 0 !important;
            transform: none !important;
        }
        nav > div:nth-of-type(1) > button:not(:hover) > div:nth-of-type(1) {
            left: 50% !important;
            transform: translateX(-50%) !important;
        }

        /* Feed */
        main > div > div > div > div > div:nth-of-type(1),
        [data-testid="homeScreenFeedTabs"] > div:nth-of-type(2) {
            display: none;
        }
        main > div > div > div > div > div:nth-of-type(2) {
            margin-left: 240px !important;
            width: calc(100vw - 240px - 330px - 1em) !important;
        }
        [data-testid="HomeScreen"] > div > div:nth-of-type(2),
        main > div > div > div > div > div:nth-of-type(2) > div > div:nth-of-type(1),
        main > div > div > div > div > div:nth-of-type(2) > div > div:nth-of-type(3) {
            margin: 0 !important;
            max-width: calc(100vw - 240px - 330px - 1em) !important;
            transform: none !important;
        }
        main > div > div > div > div > div:nth-of-type(2) > div > div:nth-of-type(3) > div {
            width: 100%;
        }
        [data-testid="customFeedPage-feed-flatlist"] > div:nth-of-type(2) {
            margin: 0 !important;
            max-width: calc(100% - 1em) !important;
            transform: none !important;
        }

		/* Buttons under post */
		[style="flex-direction: row; justify-content: space-between; align-items: center; padding-top: 2px; gap: 12px;"] {
			justify-content: space-evenly;
		}
		[style="flex-direction: row; justify-content: space-between; align-items: center; padding-top: 2px; gap: 12px;"] > div:first-child {
			max-width: 55% !important;
		}
		[style="flex-direction: row; justify-content: space-between; align-items: center; padding-top: 2px; gap: 12px;"] > div:last-child {
			justify-content: space-evenly !important;
			width: 45% !important;
		}
		[style="flex-direction: row; justify-content: space-between; align-items: center; padding-top: 2px; gap: 12px;"] > div:last-child > div {
			margin-left: auto !important;
		}

        /* Right sidebar */
        body > div > div > div > div > div > div > div {
            left: auto !important;
            right: 1em !important;
            transform: none !important;
        }

		/* Modify profile */
		[style="width: 100%; z-index: 20; align-items: center; min-height: 60vh; position: static;"] {
			height: 450px;
			left: 50%;
			min-width: 600px;
			position: fixed !important;
			top: 10vh;
			transform: translateX(-50%) !important;
		}

		/* New post */
		div:has(> [data-testid="composePostView"]) {
			max-height: 80vh !important;
			min-height: 323px !important;
			left: 50% !important;
			min-width: 600px !important;
			position: fixed !important;
			transform: translateX(-50%) !important;
		}

		/* Signup */
		body > div > div > div > div > div > div > div[aria-modal="true"] {
			left: 50% !important;
			margin: auto !important;
			right: unset !important;
			transform: translateX(-50%) !important;
			width: 100% !important;
		}
		[style="flex-direction: row; justify-content: center; padding-left: 40px; padding-right: 40px;"] > [style="flex: 1 1 0%; max-width: 420px;"] {
			max-width: 100% !important;
		}
    }
}

@-moz-document url-prefix("https://bsky.app/search") {
    /* Search page */
    if widemode {
        [data-testid="searchScreen"] > div:nth-of-type(3),
        [data-testid="searchScreen"] > div:nth-of-type(3) > div > div:nth-of-type(2) {
            margin: 0 !important;
            max-width: 100% !important;
            transform: none !important;
            width: 100% !important;
        }
    }
}

@-moz-document url("https://bsky.app/notifications") {
    /* Notifications page */
    if widemode {
        [data-testid="notificationsScreen"] > div:nth-of-type(1),
        [data-testid="notificationsScreen"] > div:nth-of-type(2) > div:nth-of-type(1) > div,
        [data-testid="notificationsScreen"] > div:nth-of-type(2) > div:nth-of-type(2) > div > div > div > div:nth-of-type(2) {
            margin: 0 !important;
            max-width: 100% !important;
            transform: none !important;
            width: 100% !important;
        }
    }
}

@-moz-document url("https://bsky.app/messages") {
    /* Messages page */
    if widemode {
        .css-g5y9jx[style="min-height: 100vh; padding-top: 0px;"] > div:nth-of-type(1),
        .css-g5y9jx[style="min-height: 100vh; padding-top: 0px;"] > div:nth-of-type(2) {
            margin: 0 !important;
            max-width: 100% !important;
            transform: none !important;
            width: 100% !important;
        }
    }
}

@-moz-document url("https://bsky.app/feeds") {
    /* Feeds page */
    if widemode {
        [data-testid="FeedsScreen"] > div:nth-of-type(1),
        [data-testid="FeedsScreen"] > div:nth-of-type(1) > div:nth-of-type(2) > div:nth-of-type(2) {
            margin: 0 !important;
            max-width: 100% !important;
            transform: none !important;
            width: 100% !important;
        }
    }
}

@-moz-document url("https://bsky.app/lists") {
    /* Lists page */
    if widemode {
        [data-testid="listsScreen"] > div:nth-of-type(1),
        [data-testid="listsScreen"] div:nth-of-type(2) > div,
        [data-testid="listsScreen"] div:nth-of-type(2) > div > div:nth-of-type(2),
        [data-testid="listsScreen"] div:nth-of-type(2) > div > div:nth-of-type(2) > div {
            margin: 0 !important;
            max-width: 100% !important;
            transform: none !important;
            width: 100% !important;
        }
    }
}

@-moz-document url("https://bsky.app/saved") {
    /* Saved page */
    if widemode {
        [data-testid="bookmarksScreen"] > div:nth-of-type(1),
        [data-testid="bookmarksScreen"] div:nth-of-type(2) > div,
        [data-testid="bookmarksScreen"] div:nth-of-type(2) > div > div:nth-of-type(2),
        [data-testid="bookmarksScreen"] div:nth-of-type(2) > div > div:nth-of-type(2) > div {
            margin: 0 !important;
            max-width: 100% !important;
            transform: none !important;
            width: 100% !important;
        }
        [href="/"] > div {
            margin: auto;
        }
    }
}

@-moz-document url-prefix("https://bsky.app/profile/") {
    /* Profile page */
    if widemode {
        [data-testid="profileFollowersScreen"] > div:nth-of-type(1),
        [data-testid="profileFollowersScreen"] > div:nth-of-type(2) > div:nth-of-type(2),
        [data-testid="profileFollowsScreen"] > div:nth-of-type(1),
        [data-testid="profileFollowsScreen"] > div:nth-of-type(2) > div:nth-of-type(2),
        [data-testid="profileView"] > div:nth-of-type(1) > div:nth-of-type(1),
        [data-testid="profileView"] > div:nth-of-type(1) > div:nth-of-type(3),
        [data-testid="profileView"] > div:nth-of-type(1) > div:nth-of-type(3) > div,
        [data-testid="profileView"] > div:nth-of-type(1) > div:nth-of-type(4),
        [data-testid="profileView"] > div:nth-of-type(1) > div:nth-of-type(5),
        [data-testid="profileView"] > div:nth-of-type(1) > div:nth-of-type(6),
        [data-testid="profileView"] > div:nth-of-type(1) > div:nth-of-type(7),
        [data-testid="profileView"] > div:nth-of-type(1) > div:nth-of-type(8),
        [data-testid="profileView"] > div:nth-of-type(1) > div:nth-of-type(9),
        [data-testid="profileView"] > div:nth-of-type(1) > div:nth-of-type(9) > div > div > div > div:nth-of-type(2),
        [data-testid="profileView"] > div:nth-of-type(1) > div:nth-of-type(10),
        [data-testid="postsFeed-flatlist"] > div:nth-of-type(2) {
            margin: 0 !important;
            max-width: 100% !important;
            transform: none !important;
            width: 100% !important;
        }
    }
}

@-moz-document url("https://bsky.app/moderation"), url-prefix("https://bsky.app/settings") {
    /* Settings page */
    if widemode {
        .css-g5y9jx[style="min-height: 100vh; padding-top: 0px;"] > div:nth-of-type(1),
        .css-g5y9jx[style="min-height: 100vh; padding-top: 0px;"] > div:nth-of-type(2) > div > div {
            margin: 0 !important;
            max-width: 100% !important;
            transform: none !important;
            width: 100% !important;
        }
    }
}

@-moz-document url-prefix("https://bsky.app/starter-pack/") {
    /* Starter pack page */
    if widemode {
        .css-g5y9jx[style="min-height: 100vh; padding-top: 0px;"] > div > div:nth-of-type(1) > div:nth-of-type(1),
        .css-g5y9jx[style="min-height: 100vh; padding-top: 0px;"] > div > div:nth-of-type(3),
        .css-g5y9jx[style="min-height: 100vh; padding-top: 0px;"] > div > div:nth-of-type(4) > div > div > div:nth-of-type(2) {
            margin: 0 !important;
            max-width: 100% !important;
            transform: none !important;
            width: 100% !important;
        }
    }
}
