/* Dinosaur Encyclopedia - Responsive Design */

/* Mobile First Approach */

/* Extra Small Devices (Portrait Phones, < 576px) */
@media (max-width: 575.98px) {
    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.875rem; }
    
    body {
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    /* Header & Navigation */
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .navbar-toggler {
        padding: 0.25rem 0.5rem;
        font-size: 1rem;
    }
    
    .navbar-nav {
        padding: 1rem 0;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    /* Hero Section */
    .hero-section {
        min-height: 60vh;
        padding: 2rem 1rem;
    }
    
    .hero-content {
        padding: 2rem 1rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    /* Cards */
    .dinosaur-card {
        margin-bottom: 1rem;
        border-radius: 0.75rem;
    }
    
    .dinosaur-card-image {
        height: 180px;
    }
    
    .dinosaur-card-content {
        padding: 1rem;
    }
    
    .dinosaur-card-title {
        font-size: 1.25rem;
    }
    
    .dinosaur-card-description {
        font-size: 0.875rem;
        line-height: 1.4;
    }
    
    /* Search & Filters */
    .search-container {
        padding: 1.5rem;
        border-radius: 0.75rem;
    }
    
    .search-input {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .filter-dropdown {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Buttons */
    .btn-dino-primary,
    .btn-dino-secondary {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
        width: 100%;
    }
    
    /* Dinosaur Detail Page */
    .dinosaur-detail-header {
        padding: 2rem 0;
    }
    
    .dinosaur-detail-title {
        font-size: 1.75rem;
    }
    
    .dinosaur-detail-subtitle {
        font-size: 1rem;
    }
    
    .dinosaur-info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .dinosaur-info-card {
        padding: 1rem;
    }
    
    .dinosaur-info-value {
        font-size: 1.125rem;
    }
    
    /* Gallery */
    .gallery-container {
        padding: 1.5rem;
    }
    
    .gallery-main-image {
        height: 250px;
        border-radius: 0.75rem;
    }
    
    .gallery-thumbnails {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .gallery-thumbnail {
        height: 60px;
        border-radius: 0.5rem;
    }
    
    /* Footer */
    .footer {
        padding: 2rem 0 1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-section h3 {
        font-size: 1.125rem;
    }
    
    /* Spacing */
    .container {
        padding: 0 1rem;
    }
    
    .section {
        padding: 2rem 0;
    }
}

/* Small Devices (Landscape Phones, 576px - 767.98px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    
    /* Hero Section */
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    /* Cards */
    .dinosaur-card-image {
        height: 200px;
    }
    
    .dinosaur-card-title {
        font-size: 1.375rem;
    }
    
    /* Search & Filters */
    .search-container {
        padding: 1.75rem;
    }
    
    /* Dinosaur Detail Page */
    .dinosaur-detail-title {
        font-size: 2rem;
    }
    
    .dinosaur-info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    /* Gallery */
    .gallery-main-image {
        height: 300px;
    }
    
    .gallery-thumbnails {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .gallery-thumbnail {
        height: 70px;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    /* Spacing */
    .section {
        padding: 2.5rem 0;
    }
}

/* Medium Devices (Tablets, 768px - 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Typography */
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.75rem; }
    
    /* Hero Section */
    .hero-title {
        font-size: 2.75rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    /* Cards */
    .dinosaur-card-image {
        height: 220px;
    }
    
    .dinosaur-card-title {
        font-size: 1.5rem;
    }
    
    /* Search & Filters */
    .search-container {
        padding: 2rem;
    }
    
    .filter-dropdown {
        min-width: 150px;
    }
    
    /* Dinosaur Detail Page */
    .dinosaur-detail-title {
        font-size: 2.5rem;
    }
    
    .dinosaur-detail-subtitle {
        font-size: 1.25rem;
    }
    
    .dinosaur-info-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
    
    /* Gallery */
    .gallery-main-image {
        height: 350px;
    }
    
    .gallery-thumbnails {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .gallery-thumbnail {
        height: 75px;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    /* Spacing */
    .section {
        padding: 3rem 0;
    }
    
    /* Grid */
    .dinosaur-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* Large Devices (Desktops, 992px - 1199.98px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Typography */
    h1 { font-size: 2.75rem; }
    h2 { font-size: 2.25rem; }
    h3 { font-size: 1.875rem; }
    
    /* Hero Section */
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-subtitle {
        font-size: 1.375rem;
    }
    
    /* Cards */
    .dinosaur-card-image {
        height: 240px;
    }
    
    /* Search & Filters */
    .search-container {
        padding: 2.25rem;
    }
    
    /* Dinosaur Detail Page */
    .dinosaur-detail-title {
        font-size: 2.75rem;
    }
    
    .dinosaur-info-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Gallery */
    .gallery-main-image {
        height: 400px;
    }
    
    .gallery-thumbnails {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .gallery-thumbnail {
        height: 80px;
    }
    
    /* Grid */
    .dinosaur-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    /* Spacing */
    .section {
        padding: 3.5rem 0;
    }
}

/* Extra Large Devices (Large Desktops, ≥ 1200px) */
@media (min-width: 1200px) {
    /* Typography */
    h1 { font-size: 3rem; }
    h2 { font-size: 2.5rem; }
    h3 { font-size: 2rem; }
    
    /* Hero Section */
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.5rem;
    }
    
    /* Cards */
    .dinosaur-card-image {
        height: 250px;
    }
    
    /* Search & Filters */
    .search-container {
        padding: 2.5rem;
    }
    
    /* Dinosaur Detail Page */
    .dinosaur-detail-title {
        font-size: 3rem;
    }
    
    .dinosaur-info-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
    
    /* Gallery */
    .gallery-main-image {
        height: 500px;
    }
    
    .gallery-thumbnails {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .gallery-thumbnail {
        height: 80px;
    }
    
    /* Grid */
    .dinosaur-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    /* Spacing */
    .section {
        padding: 4rem 0;
    }
}

/* Ultra Wide Screens (≥ 1400px) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .dinosaur-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem;
    }
}

/* Landscape Orientation Adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .hero-section {
        min-height: 50vh;
    }
    
    .hero-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
    
    .navbar {
        padding: 0.25rem 1rem;
    }
    
    .dinosaur-card-image {
        height: 150px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Improve rendering on high DPI screens */
    .dinosaur-card-image img,
    .gallery-main-image,
    .gallery-thumbnail {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Touch Device Specific */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .dinosaur-card:hover {
        transform: none;
        box-shadow: var(--shadow-lg);
    }
    
    .nav-link:hover::after {
        width: 0;
    }
    
    .btn-dino-primary:hover,
    .btn-dino-secondary:hover {
        transform: none;
    }
    
    .dinosaur-info-card:hover {
        transform: none;
    }
    
    /* Increase tap targets */
    .nav-link {
        padding: 1rem;
    }
    
    .btn-dino-primary,
    .btn-dino-secondary {
        min-height: 44px;
        min-width: 44px;
    }
    
    .gallery-thumbnail {
        min-height: 44px;
    }
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    /* Adjust colors for dark mode */
    .dinosaur-card {
        background: var(--gray-800);
        color: var(--gray-100);
    }
    
    .dinosaur-card-title {
        color: var(--gray-100);
    }
    
    .dinosaur-card-description {
        color: var(--gray-300);
    }
    
    .search-container {
        background: var(--gray-800);
        color: var(--gray-100);
    }
    
    .search-input,
    .filter-dropdown {
        background: var(--gray-700);
        color: var(--gray-100);
        border-color: var(--gray-600);
    }
    
    .gallery-container {
        background: var(--gray-800);
    }
}

/* Print Styles */
@media print {
    /* Hide unnecessary elements */
    .navbar,
    .hero-section,
    .footer,
    .btn,
    .gallery-thumbnails,
    .social-share {
        display: none !important;
    }
    
    /* Adjust layout for printing */
    .container {
        max-width: none;
        padding: 0;
    }
    
    .dinosaur-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--gray-300);
        margin-bottom: 1rem;
    }
    
    .dinosaur-detail-header {
        background: none;
        color: var(--black);
    }
    
    body {
        background: var(--white);
        color: var(--black);
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: var(--black);
        page-break-after: avoid;
    }
    
    p {
        orphans: 3;
        widows: 3;
    }
    
    img {
        max-width: 100%;
        height: auto;
        page-break-inside: avoid;
    }
}

/* Responsive Grid System */
.responsive-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 576px) {
    .responsive-grid-sm-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .responsive-grid-md-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .responsive-grid-md-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    .responsive-grid-lg-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .responsive-grid-lg-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1200px) {
    .responsive-grid-xl-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Responsive Typography */
.responsive-text {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}

.responsive-title {
    font-size: clamp(1.5rem, 5vw, 3rem);
}

.responsive-subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
}

/* Responsive Spacing */
.responsive-padding {
    padding: clamp(1rem, 5vw, 3rem);
}

.responsive-margin {
    margin: clamp(1rem, 5vw, 3rem);
}

/* Mobile Menu Specific */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--primary-dark);
    z-index: var(--z-modal);
    transition: right var(--transition-normal);
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive Tables */
@media (max-width: 767.98px) {
    .responsive-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .responsive-table thead,
    .responsive-table tbody,
    .responsive-table th,
    .responsive-table td,
    .responsive-table tr {
        display: block;
    }
    
    .responsive-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .responsive-table tr {
        border: 1px solid var(--gray-200);
        margin-bottom: 1rem;
    }
    
    .responsive-table td {
        border: none;
        border-bottom: 1px solid var(--gray-200);
        position: relative;
        padding-left: 50%;
        white-space: normal;
        text-align: left;
    }
    
    .responsive-table td:before {
        position: absolute;
        top: 0.5rem;
        left: 0.5rem;
        width: 45%;
        padding-right: 0.5rem;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        content: attr(data-label);
    }
}