/* Default (Light Mode) */

:root {
    --app-accent: var(--ghost-accent-color);
}

html[data-color-scheme='dark'] {
    --app-accent: color-mix(in srgb, var(--ghost-accent-color) 65%, white);
}

/* Fix Ghost navigation visibility on desktop */
@media (min-width: 768px) {
    header[data-header] nav[data-nav="header"] {
        display: flex !important;
        align-items: center;
    }

    [data-header-actions] img {
        margin-top: 0 !important;
    }
}
.main-layout {
    display: grid;
    grid-template-columns: auto 1fr auto;
    min-height: 100vh;
    width: 100%;
}

.main-layout-inner {
    display: flex;
    grid-column: 2;
}

.main-content-area {
    flex: 1;
	padding: 0 3rem 0 2rem;
    height: fit-content;
}

.content-wrapper {
	width: 100%;
    margin-top: 0;
	padding-top: 0;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    width: 100%;
    gap: 14px;
    margin: 0 auto;
}

.tile-slot {
    position: relative;
    overflow: visible;
}

body.details-toggle-active .tile-slot {
    display: flex;
    flex-direction: column;
}

body.details-toggle-active .tile-slot > .tile {
    flex-grow: 1;
    padding-bottom: 0.85rem;
}

.apps-grid .tile {
    transition: none;
}

.tile {
    position: relative;
    background: #f7f7f7;
    border: 1px solid #e8e8e8;
    border-radius: 18px;
    padding: 0.65rem 1rem;
    cursor: pointer;
    overflow: hidden;
    min-height: 175px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}


.title-container {
	display: flex;
    flex-direction: column;
	width: 100%;
    justify-content: center;
    align-items: center;
    margin-bottom: 0px;
    gap: 4px;
}

.tile.sponsor {
    min-height: 185px;
    padding: 0.65rem 1rem;
}

.tile.hosting-sponsor:not(.sponsor) {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.tile.sponsor .title-container {
    margin-top: 8px;
}

body.details-toggle-active .tile.sponsor .title-container {
    margin-top: 0;
}


.project-name {
	font-size: 1.0625rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.1;
    letter-spacing: -0.01em;
    justify-content: center;
    margin: 0;
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
	padding: 0;
	color: #2e2e2e !important;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}

.project-name.long-name { font-size: 0.9375rem; }
.project-name.very-long-name { font-size: 0.8125rem; }
.project-name.extremely-long-name { font-size: 0.6875rem; }
.project-name.name-multiline { font-size: 0.875rem; }

.project-name a {
    text-wrap: balance;
}

.project-name span {
    text-align: center;
    position: relative;
    display: inline-flex;
    flex: 0 1 auto;
    align-items: center;
}

.project-name::before {
    content: '';
    width: 22px;
    flex-shrink: 0;
    display: block;
    height: 0;
    font-size: 0;
    line-height: 0;
}

.bookmark-container {
	display: flex;
    cursor: pointer;
	position: relative;
    z-index: 10;
    align-items: center;
    justify-content: center;
	padding: 2px;
    opacity: 0;
    width: 22px;
	flex-shrink: 0;
    height: 15px;
    overflow: visible;
    transition: none;
    align-self: center;
}

.bookmark-container::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    transition: none;
}

.bookmark-container:hover::after {
    opacity: 0.1;
}

.bookmark-icon {
    width: 16px;
    height: 16px;
    color: #c3c6c9;
    opacity: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    transition: all 0.15s;
    cursor: pointer;
    margin-left: 1px;
}

.bookmark-icon:hover {
    transform: scale(1.15);
    color: var(--app-accent);
}

.bookmark-icon.bookmarked {
    color: var(--app-accent);
    opacity: 1;
}

.bookmark-icon.bookmarked:hover {
    color: var(--app-accent);
    opacity: 1;
}

.bookmark-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
}

.bookmark-icon.bookmarked svg {
    fill: currentColor;
    stroke: currentColor;
}

.tile.tile-hovered .bookmark-container,
.tile.details-expanded .bookmark-container {
    opacity: 1;
}

.tile.details-expanded .project-description {
    margin-top: 10px;
}

.project-description {
	margin: 4px 0 7px 0;
    padding: 0 8px;
	padding-left: 0;
    text-align: center;
	align-self: center;
    width: 100%;
    box-sizing: border-box;
    color: #5a6170;
    font-size: 0.78125rem;
    line-height: 1.25;
    flex: 0 1 auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: break-word;
    transition: none;
}


/* No Results */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    min-height: 400px;
}

.no-results.hidden {
    display: none;
}

.no-results-icon {
    width: 4rem;
    height: 4rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.no-results-icon svg {
    width: 100%;
    height: 100%;
}

.no-results-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.no-results-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 400px;
}

.no-results-button {
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.no-results-button:hover {
    background: var(--accent-hover);
}

.hidden {
    display: none !important;
}

/* Skeleton loading tiles */
.tile-skeleton {
    cursor: default !important;
    pointer-events: none;
    position: relative;
    overflow: hidden;
    align-items: center;
    gap: 8px;
}

.tile-skeleton .skeleton-icon,
.tile-skeleton .skeleton-line {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 6px;
}

.tile-skeleton .skeleton-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    margin-bottom: 4px;
}

.tile-skeleton .skeleton-line {
    height: 10px;
    width: 60%;
}

.tile-skeleton .skeleton-line--name {
    height: 14px;
    width: 50%;
}

.tile-skeleton .skeleton-line--desc-short {
    width: 40%;
}

.tile-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        100deg,
        transparent 30%,
        rgba(255, 255, 255, 0.45) 50%,
        transparent 70%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Loading and Error States */
.loading-message, .error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    min-height: 200px;
    font-size: 1.1rem;
    color: var(--text-secondary, #6b7280);
}

.loading-message::before {
    content: '';
    width: 2rem;
    height: 2rem;
    border: 3px solid #e5e7eb;
    border-top-color: #0f60d9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.error-message {
    color: #dc2626;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Dark Mode */
html[data-color-scheme='dark'] {
	
	.tile.sponsor {
		background: linear-gradient(135deg, #2a3038 0%, #1e242a 50%, #1c2026 100%);
	}

	.tile {
		background: #1c2026;
        border: none;
	}
	
	.project-name {
		color: rgb(245, 245, 245) !important;
	}
	
	.project-description {
		color: rgba(245, 245, 245, 0.72);
	}

	.bookmark-icon {
		color: #4b5563;
	}

	.bookmark-icon:hover {
		color: var(--app-accent);
	}

	.bookmark-icon.bookmarked {
		color: var(--app-accent) !important;
	}

	.bookmark-icon.bookmarked:hover {
		color: var(--app-accent) !important;
	}

	.tile-skeleton .skeleton-icon,
	.tile-skeleton .skeleton-line {
		background: rgba(255, 255, 255, 0.06);
	}

	.tile-skeleton::after {
		background: linear-gradient(
			100deg,
			transparent 30%,
			rgba(255, 255, 255, 0.08) 50%,
			transparent 70%
		);
		background-size: 200% 100%;
	}

}

/* 1080p screens */
@media (max-width: 1080px) {

    .main-content-area {
        margin-left: -0.5rem !important;
    }

	.apps-grid {
		grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
		gap: 16px;
		padding: 0;
	}

	.tile {
        padding: 10px 16px;
        min-height: 165px;
    }



	.project-name {
		font-size: 1.1rem;
	}

	.project-description {
		font-size: 0.8rem;
	}

	.bookmark-icon {
		width: 14px;
		height: 14px;
	}

	.bookmark-icon:hover {
		transform: scale(1.1);
	}

}

/* Hover effects only on larger screens AND hover-capable devices */
@media (min-width: 769px) and (hover: hover) {

    body:not(.details-toggle-active) .tile.tile-hovered:not(.details-expanded) {
        transform: scale(1.02);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), 0 4px 8px rgba(0, 0, 0, 0.08);
        z-index: 30;
        justify-content: center;
        padding: 0.75rem 1rem;
        overflow: visible;
    }

    body:not(.details-toggle-active) .tile.sponsor.tile-hovered:not(.details-expanded) {
        justify-content: center;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        background: linear-gradient(135deg, color-mix(in srgb, var(--app-accent) 12%, transparent) 0%, color-mix(in srgb, var(--app-accent) 5%, transparent) 100%), #f7f7f7;
    }

    html[data-color-scheme='dark'] body:not(.details-toggle-active) .tile.sponsor.tile-hovered:not(.details-expanded) {
        background: linear-gradient(135deg, #2a3038 0%, #1e242a 50%, #1c2026 100%);
    }

    html[data-color-scheme='dark'] body:not(.details-toggle-active) .tile.tile-hovered:not(.details-expanded) {
        box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(255, 255, 255, 0.015);
    }

    body:not(.details-toggle-active) .tile.sponsor.tile-hovered:not(.details-expanded) .sponsor-badge {
        display: none;
    }

    body:not(.details-toggle-active) .tile.tile-hovered:not(.details-expanded) .project-name {
        font-size: 1.0625rem;
    }

    body:not(.details-toggle-active) .tile.tile-hovered:not(.details-expanded) .project-description {
        display: none;
    }

/* 1080p screens */
    @media (max-width: 1080px) {

        body:not(.details-toggle-active) .tile.tile-hovered:not(.details-expanded) .project-name {
            font-size: 0.9375rem;
        }

    }
    
}

/* Mobile (768px and below) */
@media (max-width: 768px) {

    .main-layout {
        display: flex; /* revert to flex on mobile */
        grid-template-columns: none;
    }

    .main-layout-inner {
        grid-column: unset;
        width: 100%;
    }

    .main-content-area {
        padding: 0 1.25rem;
        margin-left: 0rem !important;
    }
    
    .content-wrapper {
        padding: 0;
        max-width: 100%;
    }
    
    .apps-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        width: 100%;
    }

    .tile {
        padding: 0.875rem;
        min-height: 100px;
    }
    
    .title-container {
        gap: 0.25rem;
        margin-bottom: 0.375rem;
        min-height: 40px;
        text-align: center;
        align-items: center;
        justify-content: center;
    }

    .project-name {
        font-size: 1.70rem;
        text-align: center;
        width: 100%;
    }

    .project-name::before {
        display: none;
    }

    .project-description {
        text-align: center;
        font-size: 0.9rem;
        padding: 0;
        width: 100%;
        align-self: center;
    }

    /* Hide bookmarks completely on mobile */
    .bookmark-container {
        display: none !important;
    }
}

/* Standard desktop monitors (DPR ≤ 1.5 — 1080p, 1440p) */
@media (min-width: 1200px) and (max-resolution: 1.5dppx) {
    html {
        font-size: 18px;
    }
    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    .tag-chip {
        font-size: 0.667rem;
    }
    .sponsor-badge {
        font-size: 0.611rem;
    }
    .affiliate-disclaimer-tag {
        font-size: 0.611rem;
    }
    .source-link.tag-chip span {
        transform: translateY(1px);
    }
}

/* Toast notifications */
.app-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(0.5rem);
    background: #1c2026;
    color: #f5f5f5;
    padding: 0.65rem 1.1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 9999;
    max-width: min(400px, calc(100vw - 2rem));
    text-align: center;
    pointer-events: none;
}

html[data-color-scheme='dark'] .app-toast {
    background: #2a3038;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.app-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

