/* ==========================================
   COMPONENTS.CSS - Reusable Components
   Buttons, cards, forms, etc.
   ========================================== */

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    z-index: 100;
    display: flex;
    justify-content: center;
}

.logo {
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    transition: opacity 0.3s ease;
    cursor: pointer;
    opacity: 0;
    animation: logoFadeIn 0.4s ease 2s forwards;
}

.logo:hover {
    opacity: 0.7;
}

/* Hamburger Menu */
.hamburger-btn {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    z-index: 1001;
    background: transparent;
    border: none;
    padding: 0;
}

.hamburger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Side Navigation */
.side-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: min(400px, 100vw);
    height: 100vh;
    background: rgba(17, 17, 17, 0.98);
    backdrop-filter: blur(20px);
    padding: 8rem 3rem 3rem;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1);
    z-index: 1000;
    overflow-y: auto;
}

/* Light mode side nav */
[data-theme="light"] .side-nav {
    background: rgba(255, 255, 255, 0.98);
}

.side-nav.active {
    transform: translateX(0);
}

.nav-link {
    display: block;
    font-size: clamp(1.25rem, 4vw, 2rem);
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    transition: color 0.3s ease;
    position: relative;
    cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: var(--accent);
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 2rem;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.footer-link {
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    cursor: pointer;
}

.footer-link:hover {
    color: var(--text-primary);
}

.footer-divider {
    width: 1px;
    height: 16px;
    background: var(--text-secondary);
    opacity: 0.3;
}

.social-links {
    display: flex;
    gap: 1.5rem;
}

.social-link {
    color: var(--text-secondary);
    transition: color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
}

.social-link:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* Loader */
.loader {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    pointer-events: none;
    transition: opacity 0.6s ease 0.3s, visibility 0.6s ease 0.3s;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-logo {
    position: fixed;
    
    /* Size & Aspect Ratio */
    height: clamp(3rem, 8vw, 5rem);
    width: auto;
    
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    opacity: 0;
    
    /* STARTING POSITION: Exact Center */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    
    animation: slideToCenter 1.5s ease forwards;
}

/* Bounce Arrow */
.bounce-arrow {
    display: inline-block;
    animation: bounce 2s infinite;
    color: var(--text-secondary);
}

/* Scroll Hint */
.scroll-hint {
    position: absolute;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-secondary);
    font-size: 0.875rem;
    opacity: 0.5;
    animation: fadeInOut 3s ease infinite;
    pointer-events: none;
}

/* Project Card */
.project-card {
    flex-shrink: 0;
    width: 400px;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease;
}

.project-card:hover {
    transform: translateY(-10px);
    z-index: 10;
}

.project-card::after {
    content: 'View';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    
    /* True Black Overlay */
    background: rgba(0, 0, 0, 0.8);
    
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.project-card:hover::after {
    opacity: 1;
}

.project-image {
    width: 100%;
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
    position: relative;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.645, 0.045, 0.355, 1);
    opacity: 0;
    animation: imageLoad 0.5s ease forwards;
}

.project-card:hover .project-image img {
    transform: scale(1.08);
}

.project-title {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Form Components */
.form-input, .form-textarea {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
}

.form-input:focus, .form-textarea:focus {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 1px var(--text-primary);
    outline: none;
}

.form-input.error, .form-textarea.error {
    border-color: #ef4444;
}

.form-message {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #ef4444;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.form-message.show {
    opacity: 1;
}

.submit-btn {
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.submit-btn:hover {
    background: var(--text-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 245, 245, 0.2);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Accessibility - Skip Link */
.skip-link {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 1rem 2rem;
    border-radius: 4px;
    z-index: 10000;
    transition: top 0.3s ease;
    text-decoration: none;
    font-weight: 500;
}

.skip-link:focus {
    top: 1rem;
}

/* Accessibility - Visually Hidden */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Indicators */
*:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 3px;
}

button:focus-visible,
.nav-link:focus-visible,
.footer-link:focus-visible,
.social-link:focus-visible,
.marquee-link:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 3px;
}

.form-input:focus-visible,
.form-textarea:focus-visible {
    outline: none;
}

/* Cookie Consent Banner */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(17, 17, 17, 0.98);
    backdrop-filter: blur(20px);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    z-index: 9998;
    border-top: 1px solid rgba(245, 245, 245, 0.1);
    transform: translateY(100%);
    transition: transform 0.4s ease;
}

.cookie-consent.show {
    transform: translateY(0);
}

.cookie-consent p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
    flex: 1;
}

.cookie-consent a {
    color: var(--text-primary);
    text-decoration: underline;
}

.cookie-buttons {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
}

.cookie-btn.accept {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.cookie-btn.accept:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 245, 245, 0.2);
}

.cookie-btn.decline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--text-secondary);
}

.cookie-btn.decline:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

@media (max-width: 768px) {
    .cookie-consent {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem 1rem;
    }

    .cookie-buttons {
        width: 100%;
        justify-content: center;
    }
}
