/* Custom Styles for Pale Clover */

/* Root Variables */
:root {
    --clover-primary: #3f8a65;
    --clover-dark: #2d6e50;
    --clover-light: #b9dccb;
    --charcoal: #30333b;
    --charcoal-light: #606874;
    scroll-behavior: smooth;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Smooth Scrolling */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* Animation Classes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Fade In Animations */
.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.fade-in-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Modal Animations */
.modal {
    animation: modalFadeIn 0.3s ease-out;
}

.modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

.modal.closing {
    animation: modalFadeIn 0.3s ease-out reverse;
}

.modal.closing .modal-content {
    animation: modalSlideIn 0.3s ease-out reverse;
}

/* Button Hover Effects */
.btn-primary,
.contact-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary::before,
.contact-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before,
.contact-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Navigation Styles */
#header {
    transition: all 0.3s ease;
}

#header.scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#header-inner {
    transition: height 0.3s ease;
}

.header-logo-icon {
    height: 2.5rem;
    transition: height 0.3s ease;
}

.header-logo-text {
    font-size: 1.25rem;
    transition: font-size 0.3s ease;
}

#header.scrolled #header-inner {
    height: 3.5rem;
}

#header.scrolled .header-logo-icon {
    height: 2rem;
}

#header.scrolled .header-logo-text {
    font-size: 1.05rem;
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--clover-primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Mobile Menu Transition */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

#mobile-menu.active {
    max-height: 500px;
}

/* Card Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Form Focus Styles */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--clover-primary);
    box-shadow: 0 0 0 3px rgba(63, 138, 101, 0.1);
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--clover-primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--clover-dark);
}

/* Error Message Animation */
.error-message {
    animation: fadeIn 0.3s ease-out;
}

/* Success Message Animation */
#success-message {
    animation: fadeInUp 0.5s ease-out;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--clover-primary), var(--clover-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Section Spacing */
section {
    position: relative;
}

/* Hero Background Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

#hero {
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

/* Modal Overlay Click Area */
.modal {
    backdrop-filter: blur(4px);
}

/* Print Styles */
@media print {
    #header,
    #contact-modal,
    footer {
        display: none;
    }
    
    section {
        page-break-inside: avoid;
    }
}

/* Responsive Typography */
@media (max-width: 640px) {
    html {
        font-size: 14px;
    }

    .header-logo-icon {
        height: 2.25rem;
    }

    .header-logo-text {
        font-size: 1.1rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    html {
        font-size: 15px;
    }
}

@media (min-width: 1025px) {
    html {
        font-size: 16px;
    }

    #header.scrolled #header-inner {
        height: 4rem;
    }

    .header-logo-icon {
        height: 3rem;
    }

    .header-logo-text {
        font-size: 1.5rem;
    }

    #header.scrolled .header-logo-icon {
        height: 2.25rem;
    }

    #header.scrolled .header-logo-text {
        font-size: 1.15rem;
    }
}

/* Accessibility */
.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: 999;
}

.skip-to-main:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
    background: var(--clover-primary);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
}

/* Focus Visible */
*:focus-visible {
    outline: 2px solid var(--clover-primary);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Loading State */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--clover-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn-primary,
    .contact-btn {
        border: 2px solid currentColor;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Can be implemented if needed */
}

/* Selection Color */
::selection {
    background-color: var(--clover-light);
    color: var(--charcoal);
}

::-moz-selection {
    background-color: var(--clover-light);
    color: var(--charcoal);
}

/* Utility Classes */
.text-balance {
    text-wrap: balance;
}

.container-narrow {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Image Optimization */
img {
    max-width: 100%;
    height: auto;
}

/* Link Focus */
a:focus {
    outline: 2px solid var(--clover-primary);
    outline-offset: 2px;
}

/* Button Active State */
button:active,
.btn-primary:active,
.contact-btn:active {
    transform: scale(0.98);
}

/* Form Validation States */
input.error,
textarea.error,
select.error {
    border-color: #ef4444;
}

input.success,
textarea.success,
select.success {
    border-color: #10b981;
}

/* Skeleton Loading (for future use) */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Tooltip (for future use) */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--charcoal);
    color: white;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tooltip:hover::after {
    opacity: 1;
}
