/* SEO ja suorituskyky optimoitu CSS - PopUpBuddies */

/* Critical CSS - lataantuu ensimmäisenä */
body {
    position: absolute;
    left: 0px;
    right: 0px;
    top: 0px;
    bottom: 0px;
    font-family: 'Raleway', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Improved accessibility and focus states */
*:focus {
    outline: 2px solid #8cc68d;
    outline-offset: 2px;
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Navbar improvements */
.navbar-toggler {
    border: 3px solid transparent;
    border-radius: 0;
}

.navbar-light .navbar-toggler {
    color: rgba(0,0,0,.55);
    border-color: rgb(123 187 124);
}

.navbar {
    padding-bottom: 0px;
}

.nav-link {
    font-family: 'Raleway', Arial, sans-serif;
    font-size: 1.15rem;
    font-weight: bold;
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link:focus {
    color: #4da04f !important;
}

/* Button improvements with better accessibility */
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    color: #333;
    background-color: #fed461;
    border-color: #ffbc00;
}

.btn-primary {
    background-color: #8cc68d;
    border-color: #80a780;
    border-radius: 0;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #4da04f;
    border-color: #76ab78;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-check:active+.btn-primary, 
.btn-check:checked+.btn-primary, 
.btn-primary.active, 
.btn-primary:active, 
.show>.btn-primary.dropdown-toggle {
    background-color: #4da04f;
    border-color: #76ab78;
}

.btn-check:focus+.btn-primary, 
.btn-primary:focus {
    background-color: #4da04f;
    border-color: #76ab78;
    box-shadow: 0 0 0 0.25rem rgb(50 160 30 / 50%);
}

.headlinebtn {
    border-radius: 2rem;
    padding: 12px 24px;
    font-size: 1.1rem;
}

/* Link styles */
a {
    color: #d58b18;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover,
a:focus {
    color: #b8720f;
    text-decoration: underline;
}

/* Typography improvements */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Raleway', Arial, sans-serif;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-family: 'Satisfy', cursive, Arial, sans-serif;
    font-weight: 400;
}

h3, h4 {
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.6em;
}

p {
    line-height: 1.8;
    font-family: 'Raleway', Arial, sans-serif;
    font-weight: 400;
    margin-bottom: 1rem;
}

.lead {
    font-family: 'Raleway', Arial, sans-serif;
    font-size: 1.25rem;
    font-weight: 200;
    line-height: 1.6;
}

.front-display {
    line-height: 1.5;
}

/* Image optimization for SEO */
img {
    height: auto;
    max-width: 100%;
}

.img-fluid {
    transition: transform 0.3s ease;
}

.img-fluid:hover {
    transform: scale(1.02);
}

.circleimg {
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Card improvements */
.card {
    border: 1px solid rgb(76 175 80 / 26%);
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.linetop {
    border-top: solid 3px #8cc68d;
}

/* Form improvements */
.custom-form {
    background: white;
    box-shadow: 1px 1px 10px rgba(0,0,0,0.1);
    border-radius: 8px;
}

.form-control:focus {
    border-color: #8cc68d;
    box-shadow: 0 0 0 0.2rem rgba(140, 198, 141, 0.25);
}

/* Blockquote styling */
.blockquote {
    margin-bottom: 1rem;
    font-size: 1rem;
    text-align: right;
    font-style: italic;
    position: relative;
}

blockquote:after {
    font-family: Georgia, serif;
/*    position: absolute; */
    float: right;
    font-size: 5em;
    line-height: 1;
    right: 0.12em;
    bottom: -0.55em;
    content: "\201D";
    color: #afafaf;
}

/* Background and design elements */
.fade-background {
    background: #ffffffb8;
    border-top: 4px solid #8cc68d94;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

/* Scallop designs - optimized for performance */
.scallop-down {
    height: 30px;
    width: 100%;
    background: radial-gradient(circle at 50% 0, #ffffff 0, #ffffff 49%, transparent 51%, transparent 100%);
    background-size: 30px 100%;
    position: absolute;
    z-index: 10;
}

.scallop2-down {
    height: 100px;
    width: 100%;
    background: radial-gradient(circle at 50% 0, #e7f1c6 0, #e7f1c6 49%, #fff 51%, white 100%);
    background-size: 49px 100%;
}

.scallop2-up {
    height: 100px;
    width: 100%;
    background: radial-gradient(circle at 50% 100%, #e7f1c6 0, #e7f1c6 49%, #fff 51%, white 100%);
    background-size: 49px 100%;
}

/* Timeline CSS - improved accessibility */
.timeline {
    position: relative;
    padding-left: 4rem;
    margin: 0 0 0 30px;
    color: white;
}

.timeline:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: #27293d;
}

.timeline .timeline-container {
    position: relative;
    margin-bottom: 2.5rem;
}

.timeline .timeline-container .timeline-icon {
    position: absolute;
    left: -88px;
    top: 4px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    text-align: center;
    font-size: 2rem;
    background: #4f537b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline .timeline-container .timeline-icon i {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.timeline .timeline-container .timeline-icon img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.timeline .timeline-container .timeline-body {
    background: #27293d;
    border-radius: 8px;
    padding: 30px 30px 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
}

.timeline .timeline-container .timeline-body a {
    color: #fed461;
    text-decoration: none;
    font-weight: 600;
}

.timeline .timeline-container .timeline-body a:hover,
.timeline .timeline-container .timeline-body a:focus {
    color: #ffbc00;
    text-decoration: underline;
}

.timeline .timeline-container .timeline-body:before {
    content: "";
    background: inherit;
    width: 20px;
    height: 20px;
    display: block;
    position: absolute;
    left: -10px;
    transform: rotate(45deg);
    border-radius: 0 0 0 2px;
}

.timeline .timeline-container .timeline-body .timeline-title {
    margin-bottom: 1.4rem;
}

.timeline .timeline-container .timeline-body .timeline-title .badge {
    background: #4f537b;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.timeline .timeline-container .timeline-body .timeline-subtitle {
    font-weight: 300;
    font-style: italic;
    opacity: 0.4;
    margin-top: 16px;
    font-size: 11px;
}

/* Timeline color variants */
.timeline .timeline-container.primary .badge,
.timeline .timeline-container.primary .timeline-icon {
    background: #1d8cf8 !important;
}

.timeline .timeline-container.info .badge,
.timeline .timeline-container.info .timeline-icon {
    background: #11cdef !important;
}

.timeline .timeline-container.success .badge,
.timeline .timeline-container.success .timeline-icon {
    background: #00bf9a !important;
}

.timeline .timeline-container.warning .badge,
.timeline .timeline-container.warning .timeline-icon {
    background: #ff8d72 !important;
}

.timeline .timeline-container.danger .badge,
.timeline .timeline-container.danger .timeline-icon {
    background: #fd5d93 !important;
}

.author {
    font-family: inherit;
    padding: 3em;
    text-align: center;
    width: 100%;
    color: white;
}

.author a:link,
.author a:visited {
    color: white;
}

.author a:link:hover,
.author a:visited:hover {
    text-decoration: none;
}

.author .btn:link,
.author .btn:visited {
    margin-top: 1em;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
    font-weight: 100;
    color: white;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    background-color: black;
    padding: 1.5em 2rem;
    border-radius: 1em;
    transition: 0.5s all;
}

.author .btn:link:hover, 
.author .btn:link:focus, 
.author .btn:link:active,
.author .btn:visited:hover,
.author .btn:visited:focus,
.author .btn:visited:active {
    background-color: #1a1a1a;
}

/* Cookie Banner - GDPR compliant */
.cookie-banner {
    position: fixed;
    bottom: 40px;
    left: 10%;
    right: 10%;
    width: 80%;
    padding: 5px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #eee;
    border-radius: 5px;
    box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.2);
}

.close {
    height: 20px;
    background-color: #777;
    border: none;
    color: white;
    border-radius: 2px;
    cursor: pointer;
}

/* Contact and CTA sections */
.contact-info a {
    transition: all 0.3s ease;
}

.contact-info a:hover,
.contact-info a:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Social media links */
.social-links a {
    transition: all 0.3s ease;
}

.social-links a:hover,
.social-links a:focus {
    transform: scale(1.1);
    color: #8cc68d !important;
}

/* Service highlights in footer */
.service-highlights ul li {
    padding: 4px 0;
    transition: color 0.3s ease;
}

.service-highlights ul li:hover {
    color: #8cc68d;
}

/* CTA buttons styling */
.cta-buttons .btn {
    margin: 0 8px 8px 0;
    transition: all 0.3s ease;
}

.cta-buttons .btn:hover,
.cta-buttons .btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* Map container */
.ratio {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* FAQ styling for better readability */
[itemtype="https://schema.org/FAQPage"] h3 {
    color: #27293d;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

[itemtype="https://schema.org/FAQPage"] p {
    color: #666;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 3px solid #8cc68d;
}

/* Gallery improvements */
.gallery-container {
    margin: 2rem 0;
}

.gallery-container figure {
    margin: 1rem 0;
    text-align: center;
}

.gallery-container figcaption {
    font-style: italic;
    color: #666;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Alert boxes for important information */
.alert {
    border-radius: 8px;
    border-left: 4px solid;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.alert-info {
    border-left-color: #17a2b8;
    background-color: #d1ecf1;
    color: #0c5460;
}

.alert-success {
    border-left-color: #28a745;
    background-color: #d4edda;
    color: #155724;
}

.alert-warning {
    border-left-color: #ffc107;
    background-color: #fff3cd;
    color: #856404;
}

/* Loading states and lazy loading */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Responsive design improvements */
@media (max-width: 1279px) {
    .lead {
        line-height: 1.6em;
        font-size: 1.20em;
    }
}

@media (max-width: 1468px) {
    .col-md-6,
    .col-md-8,
    .col-md-4 {
        flex: 0 0 auto;
        width: 100%;
        margin-bottom: 2rem;
    }
    
    .h-100 {
        height: 70%!important;
    }
}

@media (min-width: 1200px) {
    .h2, h2 {
        font-size: 1.8rem;
    }
}

@media (max-width: 991px) {
    .menu-item {
        border-bottom: 1px solid #8cc68d4a;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    
    .usecard h2 {
        font-size: 0.5em;
    }
    
    .usecard .card-body {
        flex: 1 1 auto;
        padding: 0.5rem 0.2rem;
    }
    
    .usecard .col-4 {
        padding: 0;
    }
}

@media (min-width: 992px) {
    .navbar-expand-lg .navbar-nav .nav-link {
        padding-right: 1.5rem !important;
        padding-left: 1.5rem !important;
    }
}

/* Print styles for better accessibility */
@media print {
    .navbar,
    .social-links,
    .btn,
    .cookie-banner {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: #000;
        page-break-after: avoid;
    }
    
    p, li {
        orphans: 3;
        widows: 3;
    }
    
    .container {
        width: 100% !important;
        max-width: none !important;
    }
}

/* Dark mode support for better user experience */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --card-bg: #2d2d2d;
        --border-color: #404040;
    }
}

/* Reduced motion for accessibility */
@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;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary {
        background-color: #000;
        border-color: #000;
        color: #fff;
    }
    
    .btn-primary:hover,
    .btn-primary:focus {
        background-color: #333;
        border-color: #333;
    }
    
    .card {
        border: 2px solid #000;
    }
    
    a {
        color: #0000ff;
        text-decoration: underline;
    }
    
    a:visited {
        color: #800080;
    }
}

/* Performance optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Contain layout for better performance */
.card,
.timeline-container,
.gallery-container {
    contain: layout style;
}

/* Smooth scrolling with fallback */
html {
    scroll-behavior: smooth;
}

@supports not (scroll-behavior: smooth) {
    html {
        scroll-behavior: auto;
    }
}

/* Focus visible for better keyboard navigation */
@supports selector(:focus-visible) {
    *:focus {
        outline: none;
    }
    
    *:focus-visible {
        outline: 2px solid #8cc68d;
        outline-offset: 2px;
    }
}

/* Grid layouts for better responsive design */
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

/* Utility classes for spacing and layout */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.text-shadow {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.box-shadow-soft {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.box-shadow-medium {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.border-radius-lg {
    border-radius: 12px;
}

/* Animation classes for enhanced UX */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

.pulse-hover:hover {
    animation: pulse 0.6s ease-in-out;
}