/* ===================================
   Portfolio Steampunk - Main Styles
   =================================== */

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

body {
    font-family: 'Orbitron', sans-serif;
    background: #0a0a0f;
    color: #e0d5c7;
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* Ensure no element causes horizontal scroll */
* {
    max-width: 100%;
}

svg, img, video {
    max-width: 100%;
    height: auto;
}

.cinzel {
    font-family: 'Cinzel', serif;
}

/* === Steampunk Space Background === */
.steampunk-bg {
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1520 50%, #0f0a15 100%);
    position: relative;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* === Prevent horizontal overflow === */
section {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

.container {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* === Contact Section - Extra overflow protection === */
#contact {
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100vw;
}

#contact .container {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

#contact .grid {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

#contact .steampunk-border {
    max-width: 100% !important;
    overflow-x: hidden;
}

#contact form,
#contact input,
#contact textarea,
#contact button,
#contact div {
    max-width: 100%;
    box-sizing: border-box;
}

/* === Animated Stars === */
@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: twinkle 3s infinite;
}

/* === Gears Animation === */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotate-reverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

.gear-rotate {
    animation: rotate 20s linear infinite;
}

.gear-rotate-reverse {
    animation: rotate-reverse 15s linear infinite;
}

/* === Steampunk Border === */
.steampunk-border {
    border: 2px solid #8b6f47;
    box-shadow: 0 0 20px rgba(139, 111, 71, 0.5), inset 0 0 20px rgba(139, 111, 71, 0.2);
    background: linear-gradient(135deg, rgba(26, 21, 32, 0.9) 0%, rgba(15, 10, 21, 0.95) 100%);
}

/* === Copper Gradient === */
.copper-gradient {
    background: linear-gradient(135deg, #b87333 0%, #cd8032 50%, #d4a259 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none !important;
}

/* === Glow Effects === */
.glow {
    text-shadow: 0 0 10px rgba(180, 115, 51, 0.8), 0 0 20px rgba(180, 115, 51, 0.5);
}

.glow-blue {
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.8), 0 0 20px rgba(100, 200, 255, 0.5);
}

/* === Steampunk Button === */
.steampunk-btn {
    position: relative;
    border: 2px solid #b87333;
    background: linear-gradient(135deg, rgba(184, 115, 51, 0.2) 0%, rgba(205, 128, 50, 0.3) 100%);
    color: #d4a259;
    padding: 12px 30px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.steampunk-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(184, 115, 51, 0.4), transparent);
    transition: left 0.5s ease;
}

.steampunk-btn:hover::before {
    left: 100%;
}

.steampunk-btn:hover {
    box-shadow: 0 0 20px rgba(184, 115, 51, 0.6);
    transform: translateY(-2px);
}

/* === Card Hover Effect === */
.project-card {
    transition: all 0.4s ease;
}

.project-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 10px 40px rgba(184, 115, 51, 0.4);
}

/* === Scroll Animations === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

/* === Hero Section Spacing === */
#home {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 2rem;
    padding-bottom: 12rem;
}

/* === Hero Content Spacing === */
#home .max-w-4xl {
    margin-bottom: 12rem;
}

#home h1 {
    text-decoration: none !important;
    border-bottom: none !important;
}

/* === Back to Top Button === */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(184, 115, 51, 0.9) 0%, rgba(205, 128, 50, 0.9) 100%);
    border: 2px solid #b87333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(184, 115, 51, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.1);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 25px rgba(184, 115, 51, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, rgba(205, 128, 50, 1) 0%, rgba(212, 162, 89, 1) 100%);
}

.back-to-top:active {
    transform: translateY(-3px) scale(0.95);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
    stroke: #1a1520;
    stroke-width: 3;
    fill: none;
}

/* Decorative gear inside button */
.back-to-top::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    border: 1px solid rgba(139, 111, 71, 0.3);
    border-radius: 50%;
    animation: rotate-slow 10s linear infinite;
}

@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Rivet decoration on button */
.back-to-top::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle at 30% 30%, #d4a259, #8b6f47);
    border-radius: 50%;
    box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.5);
}

/* === Parallax Effect === */
.parallax {
    transition: transform 0.5s ease-out;
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #0a0a0f;
    border-left: 1px solid #8b6f47;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #b87333 0%, #cd8032 100%);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #cd8032 0%, #d4a259 100%);
}

/* === Float Animation === */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.floating {
    animation: float 6s ease-in-out infinite;
}

/* === Steam Effect === */
@keyframes steam {
    0% {
        opacity: 0.6;
        transform: translateY(0) scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) scale(1.8) rotate(5deg);
    }
}

.steam {
    animation: steam 5s ease-out infinite;
}

/* === Dirigeable Float Animation === */
@keyframes dirigeable-float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-15px) translateX(10px);
    }
    50% {
        transform: translateY(-10px) translateX(-5px);
    }
    75% {
        transform: translateY(-20px) translateX(5px);
    }
}

.dirigeable-float {
    animation: dirigeable-float 15s ease-in-out infinite;
}

/* === Train Movement === */
@keyframes train-move {
    0% {
        transform: translateX(-100%) scaleX(-1);
    }
    100% {
        transform: translateX(100vw) scaleX(-1);
    }
}

.train-move {
    animation: train-move 30s linear infinite;
}

/* === Smoke Puff === */
@keyframes smoke-puff {
    0% {
        opacity: 0.8;
        transform: translateY(0) scale(0.5);
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(1.5);
    }
}

.smoke-puff {
    animation: smoke-puff 3s ease-out infinite;
}

/* === Propeller Spin === */
@keyframes propeller-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.propeller-spin {
    animation: propeller-spin 0.8s linear infinite;
}

/* === Piston Movement === */
@keyframes piston {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(8px); }
}

.piston-move {
    animation: piston 1.5s ease-in-out infinite;
}

/* === Wheel Spin === */
@keyframes wheel-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* === Language Switcher === */
.lang-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.lang-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.lang-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #8b6f47;
    transition: .4s;
    border-radius: 30px;
    border: 2px solid #b87333;
}

.lang-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(135deg, #b87333 0%, #d4a259 100%);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .lang-slider {
    background-color: #b87333;
}

input:checked + .lang-slider:before {
    transform: translateX(30px);
}

/* === Rivets === */
.rivet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #d4a259, #8b6f47);
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.5), 0 2px 2px rgba(212, 162, 89, 0.3);
}

/* === Steampunk Solar System === */
.steampunk-solar-system {
    width: 100%;
    height: auto;
}

/* Planet orbit animations */
@keyframes orbit-1 {
    from { transform: rotate(0deg) translateX(80px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(80px) rotate(-360deg); }
}

@keyframes orbit-2 {
    from { transform: rotate(0deg) translateX(120px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(120px) rotate(-360deg); }
}

@keyframes orbit-3 {
    from { transform: rotate(0deg) translateX(160px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(160px) rotate(-360deg); }
}

.planet-orbit-1 {
    transform-origin: 200px 200px;
    animation: orbit-1 20s linear infinite;
}

.planet-orbit-2 {
    transform-origin: 200px 200px;
    animation: orbit-2 30s linear infinite;
}

.planet-orbit-3 {
    transform-origin: 200px 200px;
    animation: orbit-3 40s linear infinite;
}

/* ===================================
   RESPONSIVE MOBILE OPTIMIZATION
   =================================== */

/* === Mobile Improvements === */
@media (max-width: 768px) {
    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden !important;
        width: 100%;
        max-width: 100vw;
    }

    section, .container, div {
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Constrain SVG and images */
    svg {
        max-width: 100%;
        height: auto;
    }

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

    /* Reduce animations for better performance */
    .gear-rotate {
        animation: rotate 30s linear infinite;
    }

    .gear-rotate-reverse {
        animation: rotate-reverse 25s linear infinite;
    }

    /* Smaller decorative elements */
    .star {
        width: 1px !important;
        height: 1px !important;
    }

    /* Better button sizing */
    .steampunk-btn {
        padding: 10px 24px;
        font-size: 14px;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        display: block;
        text-align: center;
    }

    /* Optimize cards on mobile */
    .project-card:hover {
        transform: translateY(-5px) scale(1.01);
    }

    /* Better spacing for mobile */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
        max-width: 100%;
    }

    /* Reduce shadow intensity */
    .steampunk-border {
        box-shadow: 0 0 10px rgba(139, 111, 71, 0.3), inset 0 0 10px rgba(139, 111, 71, 0.1);
    }

    /* Smaller scrollbar */
    ::-webkit-scrollbar {
        width: 6px;
    }

    /* Hide large decorative gears on mobile */
    .absolute.top-20.right-10,
    .absolute.bottom-20.left-10 {
        display: none !important;
    }

    /* Constrain fixed positioned elements */
    .fixed {
        max-width: 100vw;
    }

    /* Ensure text doesn't cause overflow */
    h1, h2, h3, h4, h5, h6, p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }

    /* Hero section spacing */
    #home {
        padding-bottom: 8rem !important;
        padding-top: 6rem;
    }

    /* Hero content spacing on mobile */
    #home .max-w-4xl {
        margin-bottom: 6rem;
        padding-top: 2rem;
    }

    /* Back to top button - smaller on mobile */
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 1rem;
        right: 1rem;
    }

    .back-to-top svg {
        width: 20px;
        height: 20px;
    }

    .back-to-top::before {
        width: 50px;
        height: 50px;
    }

    /* Contact section mobile fixes */
    #contact {
        overflow-x: hidden !important;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    #contact .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    #contact .grid {
        gap: 1.5rem;
    }

    #contact .steampunk-border {
        padding: 1rem;
    }

    #contact input,
    #contact textarea,
    #contact button {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* === Small Mobile (phones) === */
@media (max-width: 480px) {
    /* Even more compact */
    .steampunk-btn {
        padding: 8px 20px;
        font-size: 13px;
    }

    /* Smaller text shadows */
    .glow {
        text-shadow: 0 0 5px rgba(180, 115, 51, 0.6), 0 0 10px rgba(180, 115, 51, 0.3);
    }

    .glow-blue {
        text-shadow: 0 0 5px rgba(100, 200, 255, 0.6), 0 0 10px rgba(100, 200, 255, 0.3);
    }

    /* Reduce border width */
    .steampunk-border {
        border-width: 1px;
    }

    /* Smaller rivets */
    .rivet {
        width: 6px;
        height: 6px;
    }

    /* Hero section more compact */
    #home {
        padding-bottom: 7rem !important;
        padding-top: 5rem;
    }

    #home .max-w-4xl {
        margin-bottom: 5rem;
        padding-top: 1.5rem;
    }
}

/* === Touch optimization === */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover effects on touch devices */
    .steampunk-btn:hover {
        transform: none;
        box-shadow: none;
    }

    .project-card:hover {
        transform: none;
        box-shadow: 0 0 20px rgba(139, 111, 71, 0.5), inset 0 0 20px rgba(139, 111, 71, 0.2);
    }

    /* Make clickable areas larger */
    .steampunk-btn {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Active states for touch feedback */
    .steampunk-btn:active {
        transform: scale(0.98);
        opacity: 0.8;
    }
}
