/* Load Outfit regular and bold (applies to all text unless overridden) */
@font-face {
    font-family: 'Outfit';
    src: url('assets/Outfit-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Outfit';
    src: url('assets/Outfit-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

/* Load Noto Sans SC for Chinese characters */
@font-face {
    font-family: 'Noto Sans SC';
    src: url('assets/NotoSansSC-Regular.ttf') format('opentype');
    font-weight: normal;
    font-style: normal;
    unicode-range: U+4E00-9FFF;
}

@font-face {
    font-family: 'Noto Sans SC';
    src: url('assets/NotoSansSC-Bold.ttf') format('opentype');
    font-weight: bold;
    font-style: normal;
    unicode-range: U+4E00-9FFF;
}

:root {
    --header-green: #2ee42e;
}

body {
  opacity: 1;
  transition: opacity 0.5s ease;
}

body.fade-out {
  opacity: 0;
}


/* Apply the same font family used in your main styles */
html, body, #pdf-container, .pdf-text, .scroll-message {
    font-family: 'Outfit', 'Noto Sans SC', sans-serif;
}

#header-placeholder {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1005;
}

#header-placeholder header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100%;
}

.home-button {
    margin-left: auto !important;
}

#pdf-container {
    height: auto;
    padding-top: 60px; /* Space for header */
    overflow-y: auto;
    scroll-snap-type: y mandatory;
}

/* Pulsing effect for brand title */
@keyframes pulse {
    0% {
        text-shadow: 0 0 8px var(--header-green),
                     0 0 16px var(--header-green);
    }
    50% {
        text-shadow: 0 0 12px var(--header-green),
                     0 0 24px var(--header-green);
    }
    100% {
        text-shadow: 0 0 8px var(--header-green),
                     0 0 16px var(--header-green);
    }
}

/* Scrollbars */
#pdf-container::-webkit-scrollbar {
    width: 8px;
}

#pdf-container::-webkit-scrollbar-track {
    background: var(--bg-color);
}

#pdf-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

#pdf-container::-webkit-scrollbar-thumb:hover {
    background: var(--button-color);
}

.page-container {
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;     
    height: calc(100vh - 60px);
    scroll-snap-align: center;
    scroll-snap-stop: always;
    width: 100%; 
    margin: 0 auto;
	padding-top: 60px;
    padding-bottom: 30px;
    position: relative;
}

.pdf-text {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 80%;
    background: rgba(0,0,0,0.5); 
    color: #e6e6e6;
    padding: 5px;
    border-radius: 5px;
    font-size: 15px;
    line-height: 1.2;
    opacity: 1;
    visibility: visible;
    z-index: 10;
}
.page-container.active .pdf-text {
    opacity: 1;
    visibility: visible;
}

.highlighted-text {
    color: #2ee42e;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(46, 228, 46, 0.8),
                 0 0 16px rgba(46, 228, 46, 0.5);
}

/* Spacing between pages */
.page-container + .page-container {
    margin-top: 10px;
}

/* Default dimming of pages */
canvas.pdf-page {
    display: block;
    width: 100%;
    height: auto;
    max-width: 1200px;
    /* Remove or comment out this line:
    max-height: calc(100vh - 150px); */
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
    background-color: white;
    filter: brightness(0.3);
    scroll-snap-align: center;
    scroll-snap-stop: normal;
    transition: filter 0.3s ease, transform 0.3s ease;
}

/* Highlight active page */
canvas.pdf-page.active {
    filter: brightness(1);
    outline: 2px solid var(--header-green);
    box-shadow: 0 0 10px 2px var(--header-green);
    z-index: 10;
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner-logo {
    width: 60px;
    height: 60px;
    animation: spin3d 2s linear infinite;
    transform-origin: center;
}

/* Loading overlay and components */
.loading-overlay {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 1s ease;
}

/* Container for both loader and logo */
.loader-container {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Logo styling */
.spinner-logo {
    position: absolute;
    width: 60px;
    height: 60px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    animation: shineSweep 3s infinite;
}

@keyframes shineSweep {
    0% {
        filter: drop-shadow(0 0 5px rgba(46, 228, 46, 0.6));
    }
    25% {
        filter: drop-shadow(0 0 15px rgba(46, 228, 46, 0.8));
    }
    50% {
        filter: drop-shadow(0 0 5px rgba(46, 228, 46, 0.6));
    }
    75% {
        filter: drop-shadow(0 0 15px rgba(46, 228, 46, 0.8));
    }
    100% {
        filter: drop-shadow(0 0 5px rgba(46, 228, 46, 0.6));
    }
}

/* Loader styling */
.loader {
    position: absolute;
    box-sizing: border-box;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    transform-origin: 50% 50%;
    transform: perspective(200px) rotateX(66deg);
    animation: spinner-wiggle 1.2s infinite;
    top: 50px; 
}

.loader:before,
.loader:after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    box-sizing: border-box;
    border: 4px solid #0000;
    animation: spinner-spin 1.2s cubic-bezier(0.6, 0.2, 0, 0.8) infinite,
        spinner-fade 1.2s linear infinite;
}

.loader:before {
    border-top-color: #fff;
}

.loader:after {
    border-top-color: var(--header-green);
    animation-delay: 0.4s;
}

@keyframes spinner-spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes spinner-fade {
    25%, 75% {
        opacity: 0.1;
    }
    50% {
        opacity: 1;
    }
}

/* Loading status styling (the "Loading page 1/x") */
.loading-status {
    margin-top: 150px; /* place it below the spinner logo & loader */
    font-size: 16px;
    color: var(--header-green);
    font-weight: bold;
    text-align: center;
    text-shadow: 0 0 8px rgba(46, 228, 46, 0.8);
	white-space: nowrap; /* Prevents the text from breaking into multiple lines */
}

/* Scroll message styling */
.scroll-message {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 50px; 
    margin-bottom: 200px;
    font-size: 16px;
    font-weight: bold;
    color: var(--header-green);
    cursor: pointer; 
    text-decoration: underline;
    animation: fadeIn 1.5s ease-in-out;
    background: none;
    border: none;
    box-shadow: none;
    text-align: center;
    transition: color 0.3s ease;
}

.scroll-message:hover {
    color: rgba(46, 228, 46, 0.8);
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
	canvas.pdf-page {
		margin-top: -200px;
	}
	.page-container {
		padding-top: -10px;
	}
    .pdf-text {
		width: 90%;
		bottom: 12%;
              font-size: 14px;
    }
	#pdf-container {
		padding-top: 0px; /* Space for header */
	}
}
