/* ===========================================
   ANJO CRAFTY - STATIC SITE STYLES
   =========================================== */

/* ===========================================
   CSS VARIABLES & RESET
   =========================================== */

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #6366f1;
    --text-color: #1f2937;
    --bg-color: #ffffff;
    --section-bg: #f9fafb;
    --border-color: #e5e7eb;
    --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Dark Mode Variables */
body.dark-mode {
    --text-color: #f9fafb;
    --bg-color: #111827;
    --section-bg: #1f2937;
    --border-color: #374151;
    --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Section-specific Dark Mode */
.services.dark-mode,
.gallery.dark-mode,
.about.dark-mode,
.contact.dark-mode {
    --text-color: #f9fafb;
    --bg-color: #111827;
    --section-bg: #1f2937;
    --border-color: #374151;
    --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    color: var(--text-color);
    background: var(--bg-color);
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    transition: var(--transition);
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-color);
}

h1 { font-size: 3rem; }
h2 { font-size: 2.5rem; }

p {
    margin-bottom: 1rem;
    color: #6b7280;
}

body.dark-mode p {
    color: #9ca3af;
}

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

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===========================================
   HERO SECTION
   =========================================== */

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #020617 100%);
    color: white;
    padding: 120px 2rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* Blinking Stars Background */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(3px 3px at 15% 25%, #fff, transparent),
        radial-gradient(2.8px 2.8px at 35% 70%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(3.2px 3.2px at 55% 15%, #fff, transparent),
        radial-gradient(2.5px 2.5px at 75% 45%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(3px 3px at 25% 80%, #fff, transparent),
        radial-gradient(2px 2px at 50% 30%, #fff, transparent),
        radial-gradient(1.8px 1.8px at 70% 75%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(2.2px 2.2px at 90% 40%, #fff, transparent),
        radial-gradient(1.9px 1.9px at 20% 65%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(2.1px 2.1px at 40% 10%, #fff, transparent),
        radial-gradient(1px 1px at 28% 40%, #fff, transparent),
        radial-gradient(1.2px 1.2px at 48% 95%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(1.1px 1.1px at 68% 15%, #fff, transparent),
        radial-gradient(1.3px 1.3px at 88% 60%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1px 1px at 3% 35%, rgba(255, 255, 255, 0.8), transparent);
    background-repeat: repeat;
    background-size: 100% 100%;
    animation: twinkle 4s ease-in-out infinite alternate;
}

/* Additional star layers for more random blinking */
.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(1.5px 1.5px at 22% 18%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(2.1px 2.1px at 67% 82%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1.2px 1.2px at 89% 45%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(2.4px 2.4px at 34% 67%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(1.8px 1.8px at 56% 23%, rgba(255, 255, 255, 0.9), transparent);
    background-repeat: repeat;
    background-size: 100% 100%;
    animation: twinkle-alt 6s ease-in-out infinite;
    z-index: 1;
}

/* Canvas Animation */
#demo-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 800px;
    margin: 0 auto;
}

/* Hero Title */
.hero-title {
    position: fixed;
    top: 50vh;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 1;
    cursor: pointer;
    transition: all 0.1s ease;
    z-index: 5;
    font-size: clamp(3.3rem, 6.75vw, 5.25rem);
    font-weight: 600;
    font-family: 'Anona', sans-serif;
    margin-bottom: 1rem;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 30%, #cbd5e1 60%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.2);
    text-stroke: 1px rgba(255, 255, 255, 0.2);
    text-shadow:
        0 -2px 2px rgba(255, 255, 255, 0.3),
        0 -1px 4px rgba(255, 255, 255, 0.25),
        0 1px 6px rgba(255, 255, 255, 0.2),
        0 2px 8px rgba(255, 255, 255, 0.15),
        0 0 10px rgba(255, 255, 255, 0.1),
        0 0 12px rgba(255, 255, 255, 0.05);
}

.hero-title:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

.hero-title.clicked {
    animation: moveUp 1s ease-out forwards;
}

.hero-title::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg,
        rgba(99, 102, 241, 0.3),
        rgba(139, 92, 246, 0.3),
        rgba(99, 102, 241, 0.3));
    border-radius: 12px;
    filter: blur(20px);
    opacity: 0;
    animation: cosmicGlow 3s ease-in-out infinite alternate;
    z-index: -1;
}

/* Hero Subtitle */
.hero-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    margin-bottom: 0.5rem;
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 1.5s ease-out forwards;
    transform: translateY(20px);
}

.hero-subtitle.fade-in {
    animation: fadeInUp 1.5s ease-out forwards, glow 3s ease-in-out infinite alternate;
}

/* Container for flip animation */
#container {
    color: #999;
    text-transform: uppercase;
    font-size: 36px;
    font-weight: bold;
    padding-top: 200px;
    position: relative;
    width: 100%;
    font-family: 'Inter', sans-serif;
    text-align: center;
    margin-top: 2rem;
    animation: fadeInUp 2s ease-out forwards;
    transform: translateY(30px);
}

#container.fade-in {
    animation: fadeInUp 2s ease-out forwards, textGlow 4s ease-in-out infinite alternate;
}

#flip {
    height: 45px;
    overflow: hidden;
    position: relative;
}

#flip > div {
    display: flex;
    flex-direction: column;
    animation: show 30s steps(15) infinite;
}

#flip > div > div {
    color: #fff;
    padding: 4px 12px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 30%, #cbd5e1 60%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.2);
    text-stroke: 1px rgba(255, 255, 255, 0.2);
    text-shadow:
        0 -2px 2px rgba(255, 255, 255, 0.3),
        0 -1px 4px rgba(255, 255, 255, 0.25),
        0 1px 6px rgba(255, 255, 255, 0.2),
        0 2px 8px rgba(255, 255, 255, 0.15),
        0 0 10px rgba(255, 255, 255, 0.1),
        0 0 12px rgba(255, 255, 255, 0.05);
}

/* Hero Actions */
.hero-actions {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    position: fixed;
    bottom: 6rem;
    left: 50%;
    z-index: 10;
    position: relative;
    overflow: visible;
}

/* CTA Buttons */
.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    border: 2px solid white;
    min-width: 160px;
    text-align: center;
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    position: relative;
    animation: float 6s ease-in-out infinite;
}

.cta-button:nth-child(2) {
    animation-delay: -2s;
}

.cta-button:nth-child(3) {
    animation-delay: -4s;
}

.cta-button:nth-child(4) {
    animation-delay: -6s;
}

.cta-button.primary {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.cta-button.secondary {
    background: rgba(206, 189, 189, 0.84);
    color: #5f6771;
}

/* Light mode specific styling for CTA button */
body:not(.dark-mode) .cta-button.primary {
    background: #374151;
    border-color: #374151;
}

.cta-button:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.cta-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    pointer-events: none;
}

.cta-button:hover::after {
    width: 200px;
    height: 200px;
    opacity: 0;
    animation: shootingStar 0.6s ease-out;
}

/* Initially hidden elements */
.hero-subtitle,
#container {
    display: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease-in-out, display 0s 0.8s;
}

.hero-actions,
.hero-credit {
    display: none;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    left: 50%;
    transition: opacity 0.8s ease-in-out, display 0s 0.8s;
}

/* Initially disable button interactions */
.hero-actions .cta-button {
    pointer-events: none;
    opacity: 0.3;
    cursor: not-allowed;
}

.hero-subtitle.fade-in,
#container.fade-in {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.hero-actions.fade-in {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    margin: 0 auto;
    left: 0;
    right: 0;
    width: fit-content;
}

.hero-actions.fade-in .cta-button {
    pointer-events: auto !important;
    opacity: 1 !important;
    cursor: pointer !important;
}

.hero-credit.fade-in {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    bottom: 1rem;
    margin: 0 auto;
    left: 0;
    right: 0;
    width: fit-content;
}

/* Hero Credit */
.hero-credit {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 300;
    z-index: 4;
    text-shadow:
        0 0 8px rgba(255, 255, 255, 0.4),
        0 0 16px rgba(255, 255, 255, 0.2),
        0 0 24px rgba(255, 255, 255, 0.1);
}

.hero-credit.fade-in {
    display: block;
    opacity: 1;
    pointer-events: auto;
    bottom: 1rem;
    margin: 0 auto;
    left: 0;
    right: 0;
    width: fit-content;
}

/* Unused keyframes removed */

@keyframes cosmicGlow {
    0% {
        opacity: 0.2;
        transform: scale(0.97);
    }
    100% {
        opacity: 0.4;
        transform: scale(1.02);
    }
}

@keyframes moveUp {
    0% {
        top: 50vh;
        transform: translate(-50%, -50%);
    }
    100% {
        top: 20vh;
        transform: translate(-50%, -50%);
    }
}

@keyframes twinkle {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }
    25% {
        opacity: 0.6;
        transform: scale(1.02);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
    75% {
        opacity: 0.5;
        transform: scale(1.03);
    }
    100% {
        opacity: 0.3;
        transform: scale(1);
    }
}

@keyframes twinkle-alt {
    0% {
        opacity: 0.2;
        transform: scale(0.98);
    }
    30% {
        opacity: 0.7;
        transform: scale(1.02);
    }
    60% {
        opacity: 0.4;
        transform: scale(1.01);
    }
    80% {
        opacity: 0.8;
        transform: scale(1.03);
    }
    100% {
        opacity: 0.2;
        transform: scale(0.98);
    }
}

@keyframes show {
    0%   {transform:translateY(0);}
    100% {transform:translateY(-675px);}
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes shootingStar {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    50% {
        width: 100px;
        height: 100px;
        opacity: 0.7;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes glow {
    0%, 100% {
        text-shadow:
            0 0 3px rgba(255, 255, 255, 0.3),
            0 0 6px rgba(255, 255, 255, 0.2);
    }
    50% {
        text-shadow:
            0 0 5px rgba(255, 255, 255, 0.5),
            0 0 10px rgba(255, 255, 255, 0.3);
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow:
            0 0 3px rgba(255, 255, 255, 0.4),
            0 0 6px rgba(255, 255, 255, 0.3),
            0 0 8px rgba(156, 217, 249, 0.2);
    }
    50% {
        text-shadow:
            0 0 5px rgba(255, 255, 255, 0.6),
            0 0 10px rgba(255, 255, 255, 0.4),
            0 0 12px rgba(156, 217, 249, 0.3);
    }
}

/* ===========================================
   OTHER SECTIONS STYLES
   =========================================== */

/* Services Section */
.services {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 5rem 0;
    background: var(--section-bg);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.service-card {
    background: var(--bg-color);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.service-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.service-card p {
    color: var(--text-color);
    opacity: 0.7;
    line-height: 1.6;
}

/* Gallery Section */
.gallery {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 5rem 0;
    background: var(--bg-color);
}

.gallery-intro {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 1.2rem;
    color: var(--text-color);
    opacity: 0.7;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Center the iframe */
.gallery iframe {
    display: block;
    margin: 0 auto;
}

/* Fixed width, dynamic height iframe container */
.gallery-iframe-container {
    position: relative;
    width: 900px;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    /* Let height be determined by iframe content */
    height: auto;
    min-height: 600px; /* Minimum height while loading */
}

.gallery-iframe-container iframe {
    width: 900px;
    max-width: 100%;
    height: auto;
    min-height: 600px;
    border: none;
    border-radius: 12px;
    pointer-events: auto;
    overflow: auto;
    display: block;
    margin: 0 auto;
}

/* Mobile responsive iframe - maintain fixed width but allow dynamic height */
@media (max-width: 768px) {
    .gallery-iframe-container {
        width: 100%;
        min-height: 500px;
    }

    .gallery-iframe-container iframe {
        width: 100%;
        min-height: 500px;
    }
}

@media (max-width: 480px) {
    .gallery-iframe-container {
        width: 100%;
        min-height: 450px;
    }

    .gallery-iframe-container iframe {
        width: 100%;
        min-height: 450px;
    }
}





/* About Section */
.about {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 5rem 0;
    background: var(--section-bg);
}

/* CTA Container */
.cta-container {
    text-align: center;
    margin: 3rem 0 2rem;
}

.cta-trigger {
    position: relative;
    overflow: hidden;
    min-width: 160px;
    transition: var(--transition);
}

.cta-trigger.loading {
    pointer-events: none;
}

.cta-trigger .button-text {
    display: inline-block;
    transition: var(--transition);
    position: relative;
    z-index: 2;
}

.cta-trigger.loading .button-text {
    opacity: 0;
}

.loading-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    font-weight: 600;
    color: black;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
    pointer-events: none;
}

.cta-trigger.loading .loading-percentage {
    opacity: 1;
}

.loading-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.cta-trigger.loading .loading-bar {
    opacity: 1;
}

.loading-progress {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: var(--accent-color);
    width: 0%;
    transition: width 2s ease-in-out;
    z-index: 1;
}

.cta-trigger.loading .loading-progress {
    width: 100%;
}

.about-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.about-content p {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: var(--text-color);
    opacity: 0.7;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.stat {
    text-align: center;
}

.stat h3 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.stat p {
    color: var(--text-color);
    font-weight: 600;
}

/* Contact Section */
.contact {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 5rem 0;
    background: var(--bg-color);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

.contact-intro {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 1.2rem;
    color: var(--text-color);
    opacity: 0.7;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.contact-cta {
    text-align: center;
    margin-top: 3rem;
    font-size: 1.1rem;
    color: var(--text-color);
    opacity: 0.8;
    font-weight: 500;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.contact-info h3 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.contact-info p {
    margin-bottom: 1rem;
    color: var(--text-color);
    opacity: 0.7;
}

.contact-info strong {
    color: var(--text-color);
    font-weight: 600;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--section-bg);
    border-radius: 8px;
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
}

.social-link:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-2px);
}

/* Contact Form */
.contact-form {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-family);
    background: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.submit-button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.submit-button:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

/* Footer */
.footer {
    background: var(--section-bg);
    color: var(--text-color);
    padding: 3rem 0 1rem;
    border-top: 1px solid var(--border-color);
}

body.dark-mode .footer {
    background: #0f172a;
    color: #f9fafb;
}

/* Footer dark mode when sections have dark mode */
.services.dark-mode ~ footer,
.gallery.dark-mode ~ footer,
.about.dark-mode ~ footer,
.contact.dark-mode ~ footer {
    background: #0f172a;
    color: #f9fafb;
    border-top-color: #374151;
}

.services.dark-mode ~ footer .footer-brand h3,
.services.dark-mode ~ footer .footer-links .footer-link,
.gallery.dark-mode ~ footer .footer-brand h3,
.gallery.dark-mode ~ footer .footer-links .footer-link,
.about.dark-mode ~ footer .footer-brand h3,
.about.dark-mode ~ footer .footer-links .footer-link,
.contact.dark-mode ~ footer .footer-brand h3,
.contact.dark-mode ~ footer .footer-links .footer-link {
    color: #f9fafb;
}

.services.dark-mode ~ footer .footer-brand p,
.services.dark-mode ~ footer .footer-bottom,
.gallery.dark-mode ~ footer .footer-brand p,
.gallery.dark-mode ~ footer .footer-bottom,
.about.dark-mode ~ footer .footer-brand p,
.about.dark-mode ~ footer .footer-bottom,
.contact.dark-mode ~ footer .footer-brand p,
.contact.dark-mode ~ footer .footer-bottom {
    color: #f9fafb;
    opacity: 0.7;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.footer-brand p {
    color: var(--text-color);
    opacity: 0.7;
    font-size: 0.9rem;
}

.footer-social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.footer-social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent-color);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid var(--accent-color);
}

.footer-social-link:hover {
    background: #4f46e5;
    border-color: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.footer-links {
    display: flex;
    gap: 2rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.footer-links .footer-link {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.7;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.footer-links .footer-link:hover {
    color: var(--text-color);
    opacity: 1;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
    font-size: 0.9rem;
}

/* Mobile Responsive - Enhanced Touch Responsiveness */
@media (max-width: 768px) {
    /* Hide desktop navigation */
    .nav-menu {
        display: none;
    }

    /* Enhanced hamburger button for touch */
    .hamburger-btn {
        display: flex;
        width: 56px; /* Minimum 44px + padding */
        height: 56px;
        border-radius: 12px;
        -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
        -webkit-touch-callout: none; /* Disable callout on iOS */
        user-select: none; /* Prevent text selection */
    }

    /* Enhanced hero section for mobile */
    .hero {
        padding: 40px 1rem 2rem;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        min-height: 100vh;
        touch-action: manipulation; /* Optimize touch handling */
    }

    .hero-title {
        font-size: clamp(2.7rem, 7.5vw, 3.75rem);
        font-weight: 600;
        font-family: 'Anona', sans-serif;
        margin-bottom: 0.8rem;
        line-height: 1.2;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        -webkit-text-stroke: 1px rgba(255, 255, 255, 0.3);
        text-stroke: 1px rgba(255, 255, 255, 0.3);
        text-shadow:
            0 0 5px rgba(255, 255, 255, 0.5),
            0 0 10px rgba(255, 255, 255, 0.3),
            0 0 15px rgba(255, 255, 255, 0.2),
            0 0 20px rgba(255, 255, 255, 0.1);
    }

    .hero-content {
        max-width: 600px;
        margin: 2rem auto 0;
        padding: 0 1rem;
    }

    /* Enhanced touch targets for hero buttons */
    .hero-actions {
        left: 50%;
        z-index: 10;
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(2, auto);
        gap: 2rem; /* Consistent spacing with desktop for better mobile UX */
        width: auto;
        bottom: 11rem;
    }

    .hero-actions .cta-button {
        padding: 1rem 1.5rem; /* Increased padding for better touch targets */
        min-width: 140px; /* Ensure minimum width */
        min-height: 48px; /* Minimum touch target height */
        font-size: 0.9rem;
        text-align: center;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        align-items: center;
        justify-content: center;
    }

    /* Enhanced touch feedback for buttons */
    .cta-button:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Hero title white in light mode (when not in dark mode) */
    body:not(.dark-mode) .hero-title {
        color: white;
    }

    /* Enhanced section titles */
    .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
        padding: 0 1rem;
    }

    /* Enhanced service cards for touch */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
    }

    .service-card {
        padding: 2rem 1.5rem;
        border-radius: 16px;
        min-height: 120px; /* Ensure adequate touch area */
        touch-action: manipulation;
    }

    .service-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Enhanced contact section */
    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1rem;
    }

    /* Enhanced form inputs for touch */
    .form-group input,
    .form-group textarea {
        padding: 1.2rem 1rem; /* Increased padding */
        font-size: 1rem; /* Prevent zoom on iOS */
        border-radius: 12px;
        min-height: 48px; /* Minimum touch target */
        -webkit-appearance: none; /* Remove iOS styling */
        touch-action: manipulation;
    }

    .submit-button {
        padding: 1.2rem 2rem;
        min-height: 48px;
        font-size: 1rem;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .submit-button:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Enhanced footer for touch */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
        padding: 0 1rem;
        /* Ensure footer is not affected by performance mode */
        contain: none !important;
        will-change: auto !important;
    }

    .footer-social-links {
        justify-content: center;
        gap: 1rem;
    }

    .footer-social-link {
        font-size: 0.9rem;
        padding: 0.75rem 1.5rem;
        min-width: 48px;
        min-height: 48px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .footer-social-link:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }

    .footer-links {
        justify-content: center;
        gap: 1rem;
    }

    .footer-link {
        font-size: 1rem;
        padding: 0.75rem 1rem;
        min-width: 48px;
        min-height: 48px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    /* Enhanced stats for touch */
    .stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
    }

    /* Enhanced dark mode toggle */
    input[type=checkbox].pristine {
        top: 1rem;
        right: 0.5rem;
        width: 2em; /* Larger touch target */
        height: 1.5em;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    input[type=checkbox].pristine:before {
        top: 0.15em;
        left: 0.15em;
        width: 0.9em;
        height: 0.8em;
    }

    /* Enhanced mobile container */
    #container {
        padding-top: 8rem;
        font-size: 1rem;
        font-weight: normal;
        touch-action: manipulation;
    }

    /* Enhanced navigation links in mobile menu */
    .mobile-nav .nav-link {
        padding: 1rem 1.5rem; /* Increased padding */
        min-height: 48px; /* Minimum touch target */
        font-size: 1rem;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-nav .nav-link:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Enhanced light toggle in mobile menu */
    .mobile-nav .light-toggle {
        width: 48px; /* Minimum touch target */
        height: 48px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .mobile-nav .light-toggle:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

/* Hide hamburger button on home page */
body:has(#home.active) .mobile-hamburger-container {
    display: none !important;
}

/* Hamburger Menu - Desktop and Mobile */
.mobile-hamburger-container {
    display: block; /* Show on all screen sizes */
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
}

/* Desktop/Tablet: Position hamburger button at top-right */
@media (min-width: 769px) {
    .mobile-hamburger-container {
        top: 2rem;
        right: 1rem;
        left: auto;
        transform: none;
    }
}

.hamburger-btn {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 0;
    transition: var(--transition);
    position: relative;
    z-index: 1002;
}

.hamburger-btn:hover {
    border-color: var(--accent-color);
    background: rgba(99, 102, 241, 0.05);
    transform: scale(1.05);
}

.hamburger-btn.active {
    border-color: var(--accent-color);
    background: rgba(99, 102, 241, 0.1);
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background: var(--text-color);
    border-radius: 2px;
    transition: var(--transition);
    transform-origin: center;
}

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

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

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

/* Mobile Navigation Bar - Show on all screen sizes for hamburger menu */

/* Mobile Navigation Bar Responsive */
@media (max-width: 768px) {
    .mobile-nav {
        display: none !important; /* Hidden by default, shown when hamburger is clicked */
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        gap: 0.75rem;
        padding: 1.5rem;
        margin-bottom: 2rem;
        background: var(--bg-color);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        box-shadow: var(--card-shadow);
        align-items: center;
        position: fixed; /* Fixed position for consistent placement */
        top: 4rem; /* Position below hamburger button */
        right: 1rem; /* Align with hamburger button */
        left: 1rem; /* Full width with margins */
        z-index: 999; /* Below hamburger button but above content */
        margin-top: 0;
        max-height: calc(100vh - 6rem); /* Prevent overflow */
        overflow-y: auto; /* Allow scrolling if needed */
    }

    .mobile-nav.active {
        display: grid !important;
    }

    /* First row: Início | Sobre nós */
    .mobile-nav .nav-link:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    .mobile-nav .nav-link:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }

    /* Second row: Serviços | Galeria */
    .mobile-nav .nav-link:nth-child(3) {
        grid-column: 1;
        grid-row: 2;
    }

    .mobile-nav .nav-link:nth-child(4) {
        grid-column: 2;
        grid-row: 2;
    }

    /* Third row: Contacto | Light toggle (same line, toggle in second column) */
    .mobile-nav .nav-link:nth-child(5) {
        grid-column: 1;
        grid-row: 3;
        width: 100%;
        min-width: 80px;
    }

    /* Light toggle button (in same row as Contacto, second column) */
    .mobile-nav .light-toggle {
        grid-column: 2;
        grid-row: 3;
        justify-self: center;
        margin-left: 0;
        margin-top: 0;
        background: none;
        border: 2px solid var(--border-color);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: var(--transition);
        color: var(--text-color);
        font-size: 1.2rem;
    }

    .mobile-nav .nav-link {
        padding: 0.75rem 1rem;
        text-align: center;
        font-size: 0.9rem;
        border-radius: 8px;
        transition: var(--transition);
        font-weight: 500;
        width: 100%;
        min-width: 80px;
    }

    .mobile-nav .nav-link:hover {
        background: rgba(99, 102, 241, 0.1);
        color: var(--accent-color);
    }

    .mobile-nav .light-toggle:hover {
        border-color: var(--accent-color);
        background: rgba(99, 102, 241, 0.05);
        transform: scale(1.05);
    }

    .mobile-nav .light-toggle::before {
        content: "💡";
        transition: var(--transition);
    }

    body.dark-mode .mobile-nav .light-toggle::before {
        content: "🌙";
    }
}

/* Desktop Navigation Bar - Show on desktop screens as single horizontal line */
@media (min-width: 769px) {
    .mobile-nav {
        display: none; /* Hidden by default, shown when hamburger is clicked */
    }

    .mobile-nav.active {
        display: flex !important; /* Use flexbox for horizontal layout */
        flex-direction: row; /* Single horizontal line */
        justify-content: center; /* Center the navigation items */
        align-items: center;
        gap: 1rem; /* Space between items */
        padding: 1rem 2rem;
        background: var(--bg-color);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        box-shadow: var(--card-shadow);
        position: fixed; /* Fixed position for consistent placement */
        top: 1rem; /* Position at the top */
        left: 50%; /* Center horizontally */
        transform: translateX(-50%); /* Perfect centering */
        z-index: 999; /* Above content */
        max-width: 90vw; /* Responsive width */
        width: auto; /* Auto width based on content */
        flex-wrap: wrap; /* Allow wrapping if needed */
        justify-content: center;
    }

    /* All navigation links in a single row */
    .mobile-nav .nav-link {
        padding: 0.5rem 1rem;
        text-align: center;
        font-size: 0.9rem;
        border-radius: 8px;
        transition: var(--transition);
        font-weight: 500;
        white-space: nowrap; /* Prevent text wrapping */
        min-width: auto; /* Auto width */
        flex: 0 0 auto; /* Don't grow or shrink */
    }

    .mobile-nav .nav-link:hover {
        background: rgba(99, 102, 241, 0.1);
        color: var(--accent-color);
    }

    /* Light toggle button in the same row */
    .mobile-nav .light-toggle {
        background: none;
        border: 2px solid var(--border-color);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: var(--transition);
        color: var(--text-color);
        font-size: 1.2rem;
        flex: 0 0 auto; /* Don't grow or shrink */
        margin-left: 0.5rem; /* Small margin from other items */
    }

    .mobile-nav .light-toggle:hover {
        border-color: var(--accent-color);
        background: rgba(99, 102, 241, 0.05);
        transform: scale(1.05);
    }

    .mobile-nav .light-toggle::before {
        content: "💡";
        transition: var(--transition);
    }

    body.dark-mode .mobile-nav .light-toggle::before {
        content: "🌙";
    }
}

/* Professional Enhancements */
body {
    font-feature-settings: "kern" 1, "liga" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.cta-button {
    position: relative;
    overflow: hidden;
}

.cta-button::before,
.submit-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.cta-button:hover::before,
.submit-button:hover::before {
    width: 300px;
    height: 300px;
}

/* Dark Mode Toggle */
input[type=checkbox].pristine {
    --off: #c7cad1;
    --mid: #6366f1;
    --on: #4f46e5;
    --transDur: 0.5s;
    --timing: cubic-bezier(0.6,0,0.4,1);
    animation: bgOff var(--transDur) var(--timing);
    background-color: var(--off);
    border-radius: 0.67em / 0.5em;
    box-shadow:
        0 0.05em 0.1em #00000007 inset,
        0 -0.25em 0.25em #0001 inset,
        0 -0.5em 0 #0001 inset,
        0 0.1em 0.1em #0001;
    cursor: pointer;
    width: 2.25em;
    height: 1.5em;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

/* Dark Mode Toggle - Hidden on home page */
body:has(#home.active) input[type=checkbox].pristine {
    display: none !important;
}

input[type=checkbox].pristine:before {
    animation: handleOff var(--transDur) var(--timing);
    background-attachment: fixed;
    background-position: 50% calc(50% - 0.1875em);
    border-radius: 0.5em / 0.375em;
    box-shadow:
        0 0.175em 0.175em 0 #0001 inset,
        0 0.375em 0 #0002 inset,
        0 0.375em 0 var(--off) inset,
        0 0.475em 0.1em #0001 inset;
    content: "";
    display: block;
    position: absolute;
    top: 0.125em;
    left: 0.125em;
    width: 1em;
    height: 0.75em;
}

input[type=checkbox].pristine:checked {
    animation: bgOn var(--transDur) var(--timing) forwards;
}

input[type=checkbox].pristine:checked:before {
    animation: handleOn var(--transDur) var(--timing) forwards;
}

input[type=checkbox].pristine:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Dark mode animations */
@keyframes bgOff {
    from {
        background-color: var(--on);
    }
    50% {
        background-color: var(--mid);
    }
    to {
        background-color: var(--off);
    }
}

@keyframes bgOn {
    from {
        background-color: var(--off);
    }
    50% {
        background-color: var(--mid);
    }
    to {
        background-color: var(--on);
    }
}

@keyframes handleOff {
    from {
        box-shadow:
            0 0.175em 0.175em 0 #0001 inset,
            0 0.375em 0 #0002 inset,
            0 0.375em 0 var(--on) inset,
            0 0.475em 0.1em #0001 inset;
        left: 1.125em;
        width: 1em;
    }
    50% {
        box-shadow:
            0 0.175em 0.175em 0 #0001 inset,
            0 0.375em 0 #0002 inset,
            0 0.375em 0 var(--mid) inset,
            0 0.475em 0.1em #0001 inset;
        left: 0.125em;
        width: 2em;
    }
    to {
        box-shadow:
            0 0.175em 0.175em 0 #0001 inset,
            0 0.375em 0 #0002 inset,
            0 0.375em 0 var(--off) inset,
            0 0.475em 0.1em #0001 inset;
        left: 0.125em;
        width: 1em;
    }
}

@keyframes handleOn {
    from {
        box-shadow:
            0 0.175em 0.175em 0 #0001 inset,
            0 0.375em 0 #0002 inset,
            0 0.375em 0 var(--off) inset,
            0 0.475em 0.1em #0001 inset;
        left: 0.125em;
        width: 1em;
    }
    50% {
        box-shadow:
            0 0.175em 0.175em 0 #0001 inset,
            0 0.375em 0 #0002 inset,
            0 0.375em 0 var(--mid) inset,
            0 0.475em 0.1em #0001 inset;
        left: 0.125em;
        width: 2em;
    }
    to {
        box-shadow:
            0 0.175em 0.175em 0 #0001 inset,
            0 0.375em 0 #0002 inset,
            0 0.375em 0 var(--on) inset,
            0 0.475em 0.1em #0001 inset;
        left: 1.125em;
        width: 1em;
    }
}

/* Hero Credit */
.hero-credit {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 300;
    z-index: 4;
    text-shadow:
        0 0 8px rgba(255, 255, 255, 0.4),
        0 0 16px rgba(255, 255, 255, 0.2),
        0 0 24px rgba(255, 255, 255, 0.1);
}

.hero-credit.fade-in {
    bottom: 1rem; /* Move up when content appears */
}

/* Mobile navigation styles removed - using hamburger menu instead */



/* Performance Mode Optimizations for Mobile */
.performance-mode .hero-title::before {
    animation: none; /* Disable cosmic glow effect */
}

.performance-mode .cta-button {
    animation: none; /* Disable floating animation */
}

.performance-mode .cta-button::after {
    animation: none; /* Disable shooting star effect */
}

.performance-mode .hero::before {
    animation: twinkle 8s ease-in-out infinite alternate; /* Slower twinkling */
}

.performance-mode .hero::after {
    animation: twinkle-alt 12s ease-in-out infinite; /* Much slower twinkling */
}

/* Reduce particle effects on mobile */
.performance-mode .particle {
    display: none;
}

/* Simplify button hover effects */
.performance-mode .cta-button:hover {
    transform: scale(1.02); /* Reduced scale effect */
}

/* Reduce iframe loading impact */
.performance-mode .gallery-iframe-container iframe {
    loading: lazy;
}

/* Disable complex animations on mobile */
.performance-mode .service-card {
    animation: none;
}

.performance-mode .stat {
    animation: none;
}

/* Reduce shadow complexity on mobile */
.performance-mode .service-card,
.performance-mode .contact-form {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Simpler shadow */
}

/* Optimize text rendering on mobile */
.performance-mode * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
}

/* Reduce gradient complexity on mobile */
.performance-mode .hero-title {
    background: linear-gradient(135deg, #ffffff 0%, #f0f4f8 50%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Additional mobile performance optimizations */
.performance-mode {
    /* Disable will-change for better performance */
    will-change: auto;
}

.performance-mode * {
    /* Performance optimizations for mobile */
}

/* Optimize scrolling on mobile */
.performance-mode {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .performance-mode *,
    .performance-mode *::before,
    .performance-mode *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Utility Classes */
.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;
}
