/* Base Styles, Reset, Custom Cursor, Scrollbar and Dark Mode Theme */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: clip;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    line-height: 1.6;
    transform: none !important;
    perspective: none !important;
    filter: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-accent);
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border: 2px solid var(--bg-accent);
    border-radius: var(--border-radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Typography Selection */
::selection {
    background-color: var(--secondary);
    color: var(--white);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Loading Overlay */
#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #FAF7F2;
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
[data-theme="dark"] #loader-wrapper {
    background-color: #121212;
}
.loader-logo-img {
    height: 70px;
    width: auto;
    object-fit: contain;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 12px rgba(200, 161, 101, 0.3));
    opacity: 0;
    transform: translateY(20px);
    animation: fadeRevealUp 1.2s forwards 0.1s;
}
.loader-logo {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeRevealUp 1.2s forwards 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.loader-logo span {
    color: var(--secondary);
}
.loader-bar {
    width: 150px;
    height: 2px;
    background: rgba(111, 78, 55, 0.15);
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}
[data-theme="dark"] .loader-bar {
    background: rgba(200, 161, 101, 0.15);
}
.loader-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    animation: loadBar 1.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes loadBar {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}
@keyframes fadeRevealUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Cursor Trail */
.custom-cursor {
    width: 8px;
    height: 8px;
    background-color: var(--secondary);
    border-radius: 50%;
    position: fixed;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 99999;
    transition: width 0.2s, height 0.2s, background-color 0.2s;
}
.custom-cursor-follower {
    width: 40px;
    height: 40px;
    border: 1px solid var(--primary);
    border-radius: 50%;
    position: fixed;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 99998;
    transition: transform 0.08s ease-out, width 0.3s, height 0.3s, border-color 0.3s;
}
body.cursor-hover .custom-cursor {
    width: 12px;
    height: 12px;
    background-color: var(--primary);
}
body.cursor-hover .custom-cursor-follower {
    width: 60px;
    height: 60px;
    border-color: var(--secondary);
    background-color: rgba(200, 161, 101, 0.05);
}

@media (max-width: 1024px) {
    .custom-cursor, .custom-cursor-follower {
        display: none !important;
    }
}

/* Scroll Progress Bar */
.scroll-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 10001;
}
.scroll-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

/* Page Transition Overlay — use 100vh and display:none when idle to
   prevent the brown overlay from creating extra scroll space on file:// URLs */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--primary);
    z-index: 99999;
    display: none;          /* hidden by default — JS adds display:block before animating */
    transform: translateY(-100%);
    transition: transform 0.6s cubic-bezier(0.85, 0, 0.15, 1);
    pointer-events: none;
}
.page-transition-overlay.active {
    display: block;
    pointer-events: all;
    transform: translateY(0);
}
.page-transition-overlay.exit {
    display: block;
    transform: translateY(-100%);
}
