/* Site-wide visual effects: loader, scroll progress, grain, reveals, burnt-orange accents.
   Loaded on every page. Mobile/touch devices fall back gracefully. */

:root {
    --accent: #cc5500;
    --accent-light: #e0691e;
    --accent-glow: rgba(204, 85, 0, 0.45);
    --accent-soft: rgba(204, 85, 0, 0.12);
}

html { scroll-behavior: smooth; }

/* Page fade-in on load — opacity only (a transform here would create
   a containing block for fixed children and break .fx-loader centering) */
body { animation: fxPageIn 0.5s ease both; }
@keyframes fxPageIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Ambient orange light leaks layered on the body background.
   The page-level CSS sets background-color: #0a0a0a; this only adds the gradients on top. */
body {
    background-image:
        radial-gradient(ellipse 900px 700px at 8% 12%, rgba(204, 85, 0, 0.20) 0%, transparent 55%),
        radial-gradient(ellipse 800px 600px at 95% 92%, rgba(224, 105, 30, 0.16) 0%, transparent 55%),
        radial-gradient(ellipse 600px 400px at 50% 50%, rgba(204, 85, 0, 0.05) 0%, transparent 65%),
        linear-gradient(105deg, transparent 35%, rgba(224, 105, 30, 0.05) 50%, transparent 65%);
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* ============================================================ */
/* LOADING SCREEN — shown once per session                       */
/* ============================================================ */
.fx-loader {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fxLoaderOut 0.6s cubic-bezier(0.65, 0, 0.35, 1) 1.55s forwards;
    overflow: hidden;
}
.fx-loader::before {
    /* Subtle radial glow behind the logo */
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 60%);
    animation: fxLoaderGlow 1.6s ease-out forwards;
    pointer-events: none;
}
.fx-loader-content {
    position: relative;
    text-align: center;
    z-index: 1;
}
.fx-loader-text {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 200;
    letter-spacing: 0.6em;
    color: #fff;
    padding-left: 0.6em;
    margin-bottom: 1.4rem;
}
.fx-loader-text span {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    animation: fxLoaderLetter 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    will-change: transform, opacity;
}
.fx-loader-line {
    height: 2px;
    width: 0;
    background: var(--accent);
    margin: 0 auto;
    box-shadow: 0 0 18px var(--accent-glow);
    animation: fxLoaderLine 0.7s cubic-bezier(0.65, 0, 0.35, 1) 0.5s forwards;
}
.fx-loader-tag {
    margin-top: 1.2rem;
    font-size: 0.7rem;
    letter-spacing: 0.5em;
    color: #888;
    padding-left: 0.5em;
    opacity: 0;
    animation: fxLoaderFade 0.5s ease 1s forwards;
}
/* Six-bladed camera aperture (SVG, animated via CSS) */
.fx-aperture {
    width: 110px;
    height: 110px;
    margin: 0 auto 1.8rem;
    filter: drop-shadow(0 0 18px var(--accent-glow));
    opacity: 0;
    animation: fxLoaderFade 0.4s ease forwards;
    overflow: visible;
}
.fx-aperture-ring {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.5;
    opacity: 0.85;
}
.fx-aperture-ring-outer {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1;
    stroke-dasharray: 4 6;
    opacity: 0.5;
    transform-origin: center;
    transform-box: fill-box;
    animation: fxApertureSpinSlow 12s linear infinite;
}
.fx-aperture-blades {
    transform-origin: center;
    transform-box: fill-box;
    animation: fxApertureSpin 6s linear infinite;
}
.fx-aperture-blades path {
    fill: var(--accent);
    opacity: 0.55;
}
.fx-aperture-blades path:nth-child(odd) {
    opacity: 0.75;
}
.fx-aperture-pupil {
    fill: var(--accent-light);
    transform-origin: center;
    transform-box: fill-box;
    animation: fxAperturePulse 2.4s ease-in-out infinite;
}
@keyframes fxApertureSpin {
    to { transform: rotate(360deg); }
}
@keyframes fxApertureSpinSlow {
    to { transform: rotate(-360deg); }
}
@keyframes fxAperturePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.6); opacity: 0.7; }
}
@keyframes fxLoaderLetter {
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fxLoaderLine {
    to { width: clamp(180px, 30vw, 260px); }
}
@keyframes fxLoaderFade {
    to { opacity: 1; }
}
@keyframes fxLoaderGlow {
    from { opacity: 0; transform: scale(0.6); }
    50% { opacity: 1; }
    to { opacity: 0.7; transform: scale(1.2); }
}
@keyframes fxApertureSpin {
    to { transform: rotate(360deg); }
}
@keyframes fxLoaderOut {
    to {
        opacity: 0;
        transform: scale(1.06);
        visibility: hidden;
    }
}

/* ============================================================ */
/* SCROLL PROGRESS BAR (burnt orange)                            */
/* ============================================================ */
.fx-scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
    width: 0;
    z-index: 99998;
    transition: width 60ms linear;
    box-shadow: 0 0 12px var(--accent-glow);
}

/* ============================================================ */
/* GRAIN OVERLAY                                                  */
/* ============================================================ */
.fx-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99997;
    opacity: 0.045;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ============================================================ */
/* REVEAL-ON-SCROLL                                               */
/* ============================================================ */
.fx-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}
.fx-reveal.fx-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================ */
/* LETTER-REVEAL                                                  */
/* ============================================================ */
.fx-letters > span {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px) rotate(8deg);
    animation: fxLetter 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    will-change: transform, opacity;
}
@keyframes fxLetter {
    to { opacity: 1; transform: translateY(0) rotate(0deg); }
}

/* Magnetic-style nudge on hover */
.fx-magnetic {
    transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.4);
    will-change: transform;
}

/* Image lazy-fade-in */
img.fx-img {
    opacity: 0;
    transition: opacity 0.6s ease, filter 0.6s ease;
    filter: blur(6px);
}
img.fx-img.fx-img-loaded {
    opacity: 1;
    filter: blur(0);
}

/* ============================================================ */
/* BURNT-ORANGE ACCENT OVERRIDES (apply across all pages)        */
/* ============================================================ */

/* Nav: underline + active state in burnt orange */
nav .nav-links a::after {
    background: var(--accent);
    height: 2px;
    box-shadow: 0 0 8px var(--accent-glow);
}
nav .nav-links a.active {
    color: var(--accent);
}

/* CTA buttons: orange glow on hover */
.cta-button:hover {
    box-shadow: 0 10px 30px var(--accent-glow), 0 0 0 1px var(--accent);
}

/* Card hover borders → burnt orange */
.work-item:hover,
.album-card:hover,
.project-card:hover,
.option-card:hover {
    border-color: var(--accent);
    box-shadow: 0 12px 40px rgba(204, 85, 0, 0.18);
}
.interest-card:hover,
.skill-category:hover {
    border-color: var(--accent);
}

/* Resume left-bar items → burnt orange on hover */
.education-item:hover,
.experience-item:hover {
    border-left-color: var(--accent) !important;
    box-shadow: -2px 0 20px var(--accent-soft);
}

/* GPA badge → burnt orange tint */
.gpa {
    color: var(--accent-light);
    background: var(--accent-soft);
    border: 1px solid rgba(204, 85, 0, 0.3);
}

/* Focus badge (about page) → burnt orange */
.focus-badge {
    color: var(--accent-light);
    border-color: rgba(204, 85, 0, 0.4) !important;
    background: var(--accent-soft) !important;
}

/* Quote section: vertical accent line on the side */
.quote::before {
    content: '';
    display: block;
    width: 40px;
    height: 2px;
    background: var(--accent);
    margin: 0 auto 1.5rem;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Unified page-header treatment: orange glow on text + bookended accent lines */
.about-hero h1,
.projects-hero h1,
.page-header h1 {
    text-shadow: 0 0 60px rgba(204, 85, 0, 0.35), 0 0 100px rgba(204, 85, 0, 0.15);
    position: relative;
}
.about-hero h1::before,
.projects-hero h1::before,
.page-header h1::before {
    content: '';
    display: block;
    width: 36px;
    height: 1px;
    background: var(--accent);
    margin: 0 auto 1.5rem;
    box-shadow: 0 0 8px var(--accent-glow);
    opacity: 0.85;
}
.about-hero h1::after,
.projects-hero h1::after,
.page-header h1::after {
    content: '';
    display: block;
    width: 110px;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
    margin: 1.5rem auto 0;
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Featured section title: matching gradient line accent */
.featured .section-title {
    text-shadow: 0 0 60px rgba(204, 85, 0, 0.3);
}
.featured .section-title::after {
    content: '';
    display: block;
    width: 110px;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
    margin: 1.2rem auto 0;
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Scroll indicator → orange */
.scroll-indicator span {
    background: var(--accent) !important;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Album thumbnails: subtle orange tint border on hover */
.album-card:hover .album-thumbnail::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid var(--accent);
    pointer-events: none;
}

/* Submit / contact button accents */
.submit-btn:hover,
.back-btn:hover,
.social-link:hover,
.download-btn:hover {
    border-color: var(--accent) !important;
    color: var(--accent-light) !important;
    box-shadow: 0 6px 20px var(--accent-soft);
}
