/* ===================
   CSS RESET & BASE STYLES
   =================== */

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

:root {
    /* Color Palette */
    --primary-brown: #725037;
    --accent-orange: #E98532;
    --sage-green: #B3BBAF;
    --cream-bg: #F7F3E7;
    --deep-plum: #2F1B25;
    
    /* Extended Colors */
    --light-orange: #ff9d4a;
    --light-cream: #faf7f0;
    --white: #ffffff;
    --medium-gray: #6c757d;
    --dark-sage: #8a9285;
    --dark-brown: #5a3f2b;
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Poppins', sans-serif;
    
    /* Spacing */
    --section-padding: 80px 0;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(47, 27, 37, 0.08);
    --shadow-md: 0 4px 12px rgba(47, 27, 37, 0.12);
    --shadow-lg: 0 8px 24px rgba(47, 27, 37, 0.16);
    --shadow-xl: 0 16px 32px rgba(47, 27, 37, 0.2);

    /* Layout */
    --header-height: 110px;
    --header-offset: var(--header-height);
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--deep-plum);
    background-color: var(--cream-bg);
    overflow-x: hidden;
    width: 100%;
    padding-top: 0; /* Responsive fix: Ensure content doesn't jump */
}

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

.responsive-img {
    width: 100%;
    height: auto;
    display: block;
}

/* Exception for elements that need to overflow intentionally */
.hero-background,
.hero-overlay {
    max-width: none;
}

/* Ensure all sections respect viewport width */
section {
    width: 100%;
    overflow-x: hidden;
}

/* ===================
   TEXT OVERFLOW FIXES
   =================== */
h1, h2, h3, h4, h5, h6,
p, span, div, a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}

/* ===================
   UTILITY CLASSES
   =================== */

.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 16px;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    font-family: var(--font-primary);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s ease;
}

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

.btn-primary {
    background-color: var(--accent-orange);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--light-orange);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--primary-brown);
    border-color: var(--sage-green);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--sage-green);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    color: var(--accent-orange);
    border-color: var(--accent-orange);
}

.btn-outline:hover {
    background-color: var(--accent-orange);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===================
   HEADER & NAVIGATION
   =================== */

.header {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(247, 243, 231, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 15px 0;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, padding 0.3s ease; /* Fix: Updated for scroll behavior */
}

.header-container {
    width: 100%;
    max-width: 100% !important; 
    margin: 0 auto;
    padding: 0 20px;
}

.header.scrolled {
    padding: 10px 0;
    background-color: rgba(247, 243, 231, 0.98);
    box-shadow: var(--shadow-md);
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--primary-brown);
}

.logo-img {
    width: 240px;
    height: 80px;
    object-fit: scale-down;
    padding: 8px;
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 20px;
    color: var(--primary-brown);
}

.nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 10px;
    margin: 0;
}

.nav-link {
    color: var(--primary-brown);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--accent-orange);
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-orange);
    background-color: rgba(233, 133, 50, 0.1);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

.language-toggle {
    display: flex;
    background-color: var(--white);
    border-radius: 20px;
    padding: 4px;
    box-shadow: var(--shadow-sm);
}

.lang-btn {
    background: none;
    border: none;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-brown);
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn.active {
    background-color: var(--accent-orange);
    color: var(--white);
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius);
    z-index: 1001;
}

.mobile-menu-btn span {
    width: 25px;
    height: 3px;
    background-color: var(--primary-brown);
    border-radius: 2px;
    transition: var(--transition);
}

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

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

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

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

.hero {
    position: relative;
    width: 100%;
    margin-top: var(--header-height);
    text-align: center;
    color: var(--white);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    --hero-focus-x: 55%;
    --hero-focus-y: 46%;
    padding: clamp(72px, 13vh, 150px) 20px;
    min-height: clamp(520px, 92vh, 960px);
}


.hero-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.hero-media {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: var(--hero-focus-x) var(--hero-focus-y);
    z-index: 0;
}

.hero > .container {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 0;
    min-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (prefers-reduced-motion: no-preference) and (min-width: 768px) {
    .hero-media {
        animation: subtle-zoom 20s infinite alternate;
    }
}

@media (max-width: 900px) {
    .hero {
        --hero-focus-x: 54%;
        --hero-focus-y: 42%;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 80px;
    }
}

@keyframes subtle-zoom {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(114, 80, 55, 0.55) 0%, rgba(47, 27, 37, 0.35) 45%, rgba(179, 187, 175, 0.4) 100%);
    pointer-events: none;
    z-index: 1;
}

.hero-content {
    max-width: 820px;
    margin: 0 auto;
    animation: fade-in-up 1s ease-out;
}

@media (max-width: 600px) {
    .hero {
        padding: 96px 16px 90px;
        min-height: clamp(420px, 90svh, 720px);
        --hero-focus-x: 50%;
        --hero-focus-y: 38%;
    }
    .hero > .container {
        min-height: 100%;
    }
}

.hero--home .hero-media {
    background-image: url('../assets/hero.webp');
}

@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 24px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    line-height: 1.6;
    margin-bottom: 40px;
    opacity: 0.95;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2);
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===================
   GENERIC SECTIONS
   =================== */

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 600;
    color: var(--primary-brown);
    margin-bottom: 16px;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-orange), var(--sage-green));
    border-radius: 2px;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--medium-gray);
    max-width: 600px;
    margin: 0 auto;
}

.section-footer {
    text-align: center;
    margin-top: 50px;
}

/* ===================
   ADOPTABLE PETS SECTION
   =================== */

.adoptable-pets {
    padding: var(--section-padding);
    background-color: var(--white);
}

.pets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.pet-card {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
}

.pet-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.pet-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

@supports not (aspect-ratio: 1) {
    .pet-image::before {
        content: '';
        display: block;
        padding-top: calc(100% * 3 / 4);
    }
    .pet-image > img,
    .pet-image > picture,
    .pet-image > video {
        position: absolute;
        inset: 0;
    }
}

.pet-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    opacity: 0;
    animation: imageLoad 0.5s ease-out forwards;
}

.pet-card:hover .pet-image img {
    transform: scale(1.05);
}

.pet-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background-color: var(--accent-orange);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.pet-info {
    padding: 24px;
}

.petName {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-brown);
    margin-bottom: 12px;
}

.pet-description {
    color: var(--medium-gray);
    margin-bottom: 16px;
    line-height: 1.5;
}

.pet-details {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.pet-age,
.pet-size {
    background-color: var(--light-cream);
    color: var(--primary-brown);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--sage-green);
}

/* ===================
   FEATURES SECTION
   =================== */

.features {
    padding: var(--section-padding);
    background: linear-gradient(135deg, var(--cream-bg) 0%, var(--light-cream) 100%);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
}

.feature-card {
    background-color: var(--white);
    padding: 40px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-orange), var(--sage-green));
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-orange), var(--light-orange));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    font-size: 24px;
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-brown);
    margin-bottom: 16px;
}

.feature-card p {
    color: var(--medium-gray);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Newsletter Form */
.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--primary-brown);
    font-size: 14px;
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 2px solid var(--sage-green);
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: var(--font-primary);
    transition: var(--transition);
    background-color: var(--white);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(233, 133, 50, 0.1);
}

.preferences-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

/* Mission Stats */
.mission-stats {
    display: flex;
    gap: 30px;
    margin-top: 24px;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-orange);
}

.stat-label {
    font-size: 14px;
    color: var(--medium-gray);
    font-weight: 500;
}

/* Articles Preview */
.article-preview {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.mini-article {
    padding: 16px;
    background-color: var(--light-cream);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--accent-orange);
}

.mini-article h4 a {
    color: var(--primary-brown);
    text-decoration: none;
    transition: color 0.3s ease;
}

.mini-article h4 a:hover {
    color: var(--accent-orange);
    text-decoration: none;
}

.mini-article p {
    font-size: 14px;
    color: var(--medium-gray);
    margin: 0;
}

/* ===================
   FOOTER
   =================== */

.footer {
    background-color: var(--deep-plum);
    color: var(--white);
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand .logo {
    margin-bottom: 16px;
}

.footer-brand .logo-img {
    background-color: var(--cream-bg);
    border-radius: 10px;
}

.footer-brand .logo-text {
    color: var(--white);
}

.footer-description {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
    line-height: 1.5;
}

.social-links {
    display: flex;
    gap: 12px;
}

.social-links a {
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    text-decoration: none;
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--accent-orange);
    transform: translateY(-2px);
}

.footer-section h4 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links a,
.footer-links button {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.footer-links a:hover,
.footer-links button:hover,
.footer-links button:focus-visible {
    color: var(--accent-orange);
    padding-left: 8px;
    outline: none;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-info p {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.contact-info i {
    width: 20px;
    color: var(--accent-orange);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* ===================
   ANIMATIONS & EFFECTS
   =================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes imageLoad {
    to { opacity: 1; }
}

/* Scroll animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.6s ease-out;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Focus states for accessibility */
.btn:focus,
input:focus,
select:focus,
a:focus {
    outline: 2px solid var(--accent-orange);
    outline-offset: 2px;
}

/* ===================
   RESPONSIVE DESIGN & FIXES
   =================== */

/* ------ Generic Responsive Fixes ------ */
iframe {
    max-width: 100%;
    height: auto;
}

.loading-container {
    padding: 40px 20px;
    text-align: center;
}

/* ------ Tablet & Larger Phones (max-width: 1024px) ------ */
@media (max-width: 1024px) {
    .header {
        padding: 12px 0;
    }

    .nav-wrapper {
        gap: 18px;
    }

    .logo-img {
        width: 200px;
        height: 68px;
        padding: 6px;
    }

    .logo-text {
        font-size: 18px;
    }

    .nav {
        gap: 20px;
    }

    .nav-list {
        gap: 6px;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 14px;
    }

    .pets-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 25px;
    }
}

/* ------ CRITICAL FIX: Tablet Range (700px-1024px) ------ */
@media (max-width: 1024px) and (min-width: 769px) {
    .logo-img {
        width: 160px;
        height: 54px;
        padding: 4px;
    }
    .logo-text {
        font-size: 16px;
    }
    .nav-list {
        gap: 4px;
    }
    .nav-link {
        padding: 6px 10px;
        font-size: 13px;
    }
    .language-toggle {
        padding: 3px;
    }
    .lang-btn {
        padding: 5px 10px;
        font-size: 13px;
    }
}

/* ------ Narrower Tablets (900px and below) ------ */
@media (max-width: 900px) {
    .logo-text {
        display: none;
    }
    .logo-img {
        width: 140px;
        height: 48px;
    }
    .nav-link {
        padding: 6px 8px;
        font-size: 13px;
    }
}

/* ------ Mobile Devices (max-width: 768px) ------ */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Hide header on scroll down */
    .header.scroll-down {
        transform: translateY(-100%);
    }
    .header.scroll-up {
        transform: translateY(0);
    }
    .header {
        padding: 10px 0;
    }
    .header-container {
        padding: 0 15px;
    }

    .nav {
        position: fixed;
        top: 70px; /* Adjust based on header height */
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background-color: var(--cream-bg);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 40px 20px;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
        z-index: 999;
        overflow-y: auto;
    }

    .nav.active {
        left: 0;
    }

    .nav-list {
        flex-direction: column;
        gap: 20px;
        width: 100%;
        margin-bottom: 20px;
    }

    .nav-link {
        width: 100%;
        text-align: center;
        padding: 15px 20px;
        font-size: 18px;
    }

    .language-toggle {
        margin-top: 20px;
        width: auto;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .hero {
        min-height: 500px;
        height: 70vh;
    }
    .hero-content {
        padding: 0 20px;
    }
    .hero-title {
        font-size: 2rem;
        margin-bottom: 16px;
    }
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
    }
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        width: 100%;
    }
    
    /* Responsive Button Fixes */
    .btn {
        padding: 12px 20px;
        font-size: 15px;
    }
    .btn-primary,
    .btn-secondary,
    .btn-outline {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .adoptable-pets,
    .features {
        padding: 50px 0;
    }
    
    .section-header {
        margin-bottom: 40px;
    }
    .section-title {
        font-size: 1.8rem;
    }
    .section-subtitle {
        font-size: 1rem;
    }

    .pets-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .feature-card {
        padding: 30px 20px;
    }

    .preferences-grid {
        grid-template-columns: 1fr;
    }

    .mission-stats {
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }
    
    /* Responsive Form Fixes */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        width: 100%;
    }

    /* Responsive Table Fixes */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Responsive Modal/Popup Fixes */
    .modal, .popup {
        width: 95%;
        max-width: 95%;
        margin: 10px auto;
    }

    /* Responsive Loading State Fixes */
    .loading-container {
        padding: 30px 15px;
    }
    .loading-spinner {
        width: 32px;
        height: 32px;
    }

    .footer {
        padding: 40px 0 20px;
    }
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
    .footer-brand {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .social-links {
        justify-content: center;
    }
    .footer-links, .contact-info {
        align-items: center;
    }
    .contact-info p {
        justify-content: center;
    }
}

/* ------ Small Mobile Devices (max-width: 480px) ------ */
@media (max-width: 480px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .adoptable-pets,
    .features {
        padding: 40px 0;
    }
    
    .section-header {
        margin-bottom: 30px;
    }

    .pets-grid {
        gap: 15px;
    }

    .pet-info {
        padding: 20px;
    }
    
    .feature-card {
        padding: 25px 15px;
    }

    .footer {
        padding: 30px 0 15px;
    }
    .footer-content {
        gap: 25px;
    }
    .social-links a {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

/* ===================
   LEGAL MODAL
   =================== */

.legal-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
}

.legal-modal.is-active {
    display: flex;
}

.legal-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.65);
    backdrop-filter: blur(2px);
}

.legal-modal__dialog {
    position: relative;
    background: var(--white);
    width: min(900px, 100%);
    max-height: 90vh;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalFadeIn 0.25s ease-out;
}

.legal-modal__header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 32px;
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.12), rgba(0, 128, 128, 0.08));
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.legal-modal__header i {
    font-size: 1.75rem;
    color: var(--sage-green);
}

.legal-modal__header h2 {
    font-size: clamp(1.125rem, 1.5vw, 1.5rem);
    font-weight: 600;
    color: var(--deep-green);
    margin: 0;
}

.legal-modal__close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--deep-green);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.legal-modal__close:hover,
.legal-modal__close:focus-visible {
    background: rgba(46, 125, 50, 0.12);
    outline: none;
    transform: scale(1.05);
}

.legal-modal__body {
    padding: 28px 32px 32px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.legal-modal__body::-webkit-scrollbar {
    width: 10px;
}

.legal-modal__body::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.45);
    border-radius: 999px;
}

.legal-modal__body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.7);
    border-radius: 999px;
}

.legal-content {
    display: none;
    color: var(--deep-slate, #1f2937);
}

.legal-content h3,
.legal-content h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--deep-green);
    margin-bottom: 12px;
}

.legal-content h3:first-child {
    font-size: 1.2rem;
    margin-top: 0;
}

.legal-content p {
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 16px;
}

.legal-content ul {
    margin: 0 0 16px 24px;
    line-height: 1.7;
}

.legal-content strong {
    font-weight: 600;
    color: var(--primary-brown);
}

html[lang="tr"] .legal-content[data-lang="tr"],
html:not([lang]) .legal-content[data-lang="tr"] {
    display: block;
}

html[lang="en"] .legal-content[data-lang="en"] {
    display: block;
}

.legal-modal-trigger {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
    transition: color 0.2s ease;
}

.legal-modal-trigger:hover,
.legal-modal-trigger:focus-visible {
    color: inherit;
    outline: none;
}

.legal-modal-trigger:focus-visible {
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.25);
    border-radius: 6px;
}

.form-legal-disclaimer {
    font-size: 0.875rem;
    color: rgba(31, 41, 55, 0.85);
    margin-top: 12px;
    line-height: 1.6;
}

.form-legal-disclaimer .legal-modal-trigger {
    font-weight: 600;
    padding: 0;
    color: var(--sage-green);
    text-decoration: underline;
}

/* Legal Page */
body[data-page-id="legal"] {
    background: #f6f8f4;
}

body[data-page-id="legal"] .legal-hero {
    padding: 120px 0 72px;
    background: linear-gradient(180deg, rgba(228, 244, 236, 0.65) 0%, rgba(255, 255, 255, 0.95) 100%);
}

body[data-page-id="legal"] .legal-hero .legal-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(46, 125, 50, 0.12);
    color: var(--deep-green);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
}

body[data-page-id="legal"] .legal-hero .legal-badge i {
    font-size: 0.85rem;
}

body[data-page-id="legal"] .legal-hero h1 {
    margin-top: 20px;
    font-size: clamp(2.3rem, 2vw + 2rem, 3.1rem);
    color: var(--deep-slate);
    line-height: 1.2;
}

body[data-page-id="legal"] .legal-hero p {
    max-width: 720px;
    margin-top: 18px;
    font-size: 1.05rem;
    line-height: 1.8;
    color: rgba(31, 41, 55, 0.8);
}

body[data-page-id="legal"] .legal-meta {
    margin: 32px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 14px 28px;
    color: rgba(31, 41, 55, 0.7);
    font-size: 0.95rem;
}

body[data-page-id="legal"] .legal-meta li {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

body[data-page-id="legal"] .legal-meta i {
    color: var(--deep-green);
}

body[data-page-id="legal"] .legal-body {
    padding: 0 0 110px;
}

body[data-page-id="legal"] .legal-body .container {
    max-width: 860px;
}

body[data-page-id="legal"] .legal-content-wrapper {
    background: #ffffff;
    border-radius: 18px;
    padding: 42px 48px 52px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 93, 52, 0.08);
}

body[data-page-id="legal"] .legal-content-wrapper header {
    margin-bottom: 32px;
    border-bottom: 1px solid rgba(15, 93, 52, 0.08);
    padding-bottom: 24px;
}

body[data-page-id="legal"] .legal-content-wrapper header h2 {
    font-size: 1.2rem;
    color: var(--deep-green);
    margin-bottom: 8px;
}

body[data-page-id="legal"] .legal-content-wrapper header p {
    margin: 0;
    color: rgba(31, 41, 55, 0.72);
    font-size: 0.95rem;
}

body[data-page-id="legal"] .legal-content-wrapper .legal-content {
    display: none;
}

html[lang="tr"] body[data-page-id="legal"] .legal-content-wrapper .legal-content[data-lang="tr"],
html:not([lang]) body[data-page-id="legal"] .legal-content-wrapper .legal-content[data-lang="tr"] {
    display: block;
}

html[lang="en"] body[data-page-id="legal"] .legal-content-wrapper .legal-content[data-lang="en"] {
    display: block;
}

body[data-page-id="legal"] .legal-content h3 {
    font-size: 1.35rem;
    margin-top: 32px;
}

body[data-page-id="legal"] .legal-content h4 {
    font-size: 1.1rem;
    margin-top: 24px;
}

body[data-page-id="legal"] .legal-content p {
    font-size: 1rem;
    margin-bottom: 18px;
}

body[data-page-id="legal"] .legal-content ul {
    margin: 0 0 18px 22px;
}

body[data-page-id="legal"] .legal-contact-card {
    margin-top: 32px;
    padding: 20px 24px;
    border-radius: 12px;
    background: rgba(46, 125, 50, 0.08);
    border: 1px solid rgba(46, 125, 50, 0.2);
    color: rgba(31, 41, 55, 0.8);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 0.95rem;
}

body[data-page-id="legal"] .legal-contact-card i {
    color: var(--deep-green);
    font-size: 1.1rem;
    margin-top: 4px;
}

@media (max-width: 992px) {
    body[data-page-id="legal"] .legal-hero {
        padding: 100px 0 60px;
    }

    body[data-page-id="legal"] .legal-content-wrapper {
        padding: 32px 28px 40px;
    }
}

@media (max-width: 640px) {
    body[data-page-id="legal"] .legal-hero {
        padding: 90px 0 48px;
    }

    body[data-page-id="legal"] .legal-hero p {
        font-size: 0.98rem;
    }

    body[data-page-id="legal"] .legal-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    body[data-page-id="legal"] .legal-content-wrapper {
        padding: 28px 22px 36px;
    }

    body[data-page-id="legal"] .legal-content h3 {
        font-size: 1.25rem;
    }

    body[data-page-id="legal"] .legal-content h4 {
        font-size: 1.05rem;
    }
}

body.modal-open {
    overflow: hidden;
}

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

@media (max-width: 640px) {
    .legal-modal {
        padding: 16px;
    }

    .legal-modal__dialog {
        border-radius: 20px;
    }

    .legal-modal__header {
        padding: 20px 24px;
    }

    .legal-modal__body {
        padding: 20px 24px 24px;
    }
}

/* ===================
   PRINT STYLES
   =================== */

@media print {
    .header,
    .footer,
    .hero,
    .btn {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }

    .pet-card, .feature-card {
        box-shadow: none !important;
        border: 1px solid #ccc;
    }
}
