/* ============================================
   Plant Species Page - Modern Responsive Styles
   Habenaria clavellata (Small Green Wood Orchid)
   ============================================ */

/* CSS Variables for consistent theming */
:root {
    --primary-color: #1b5e20;
    --secondary-color: #2e7d32;
    --accent-color: #ff6f00;
    --text-color: #2c3e50;
    --light-bg: #f1f8f4;
    --border-color: #b3e5b3;
    --image-border: #4caf50;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --line-height: 1.6;
    --letter-spacing: 0.3px;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Breakpoints */
    --mobile: 576px;
    --tablet: 768px;
    --desktop: 992px;
}

/* ============================================
   Global Styles
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: var(--line-height);
    color: var(--text-color);
    background-color: #FFC680;
    background-image: url('../images/backgrn1.gif');
    background-attachment: fixed;
    background-size: cover;
    background-repeat: repeat;
    background-position: center;
    min-height: 100vh;
    letter-spacing: var(--letter-spacing);
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(241, 248, 244, 0.85) 0%, rgba(200, 235, 200, 0.85) 100%);
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/backgrn1.gif');
    background-attachment: fixed;
    background-size: cover;
    background-repeat: repeat;
    background-position: center;
    pointer-events: none;
    z-index: -2;
    opacity: 0.6;
}

/* ============================================
   Container & Layout
   ============================================ */

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--spacing-md);
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

@media (max-width: 768px) {
    .container {
        padding: var(--spacing-sm);
        border-radius: 0;
        margin: 0;
    }
}

/* ============================================
   Header
   ============================================ */

.header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 3px solid var(--primary-color);
}

.header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

.common-name {
    font-size: 2.2rem;
    color: var(--primary-color);
    font-weight: 700;
}

.scientific-name {
    font-size: 1.6rem;
    color: var(--accent-color);
    font-style: italic;
    font-weight: 600;
    margin: var(--spacing-sm) 0;
}

.family {
    font-size: 1.15rem;
    color: var(--secondary-color);
    font-weight: 600;
    margin: var(--spacing-sm) 0 0 0;
}

.header .subtitle {
    color: var(--secondary-color);
    font-size: 1rem;
    font-weight: 500;
    margin-top: var(--spacing-sm);
}

@media (max-width: 768px) {
    .header h1,
    .common-name {
        font-size: 1.8rem;
    }

    .scientific-name {
        font-size: 1.3rem;
    }

    .family {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .header h1,
    .common-name {
        font-size: 1.4rem;
    }

    .scientific-name {
        font-size: 1.1rem;
    }

    .family {
        font-size: 0.9rem;
    }
}

/* ============================================
   Navigation
   ============================================ */

.navigation {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md) 0;
}

.nav-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 4px;
}

.nav-link:hover {
    color: var(--accent-color);
    background-color: rgba(46, 125, 50, 0.1);
    transform: translateY(-2px);
}

.nav-link:active {
    color: var(--primary-color);
}

.nav-separator {
    color: var(--border-color);
    margin: 0 var(--spacing-xs);
}

.footer-nav {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 2px solid var(--light-bg);
}

@media (max-width: 576px) {
    .navigation {
        font-size: 0.85rem;
        gap: 2px;
        padding: var(--spacing-sm) 0;
    }

    .nav-link {
        padding: var(--spacing-xs) 4px;
    }

    .nav-separator {
        margin: 0 2px;
    }
}

/* ============================================
   Divider
   ============================================ */

.divider {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
    margin: var(--spacing-lg) 0;
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    line-height: 1.8;
}

/* ============================================
   Gallery Section
   ============================================ */

.gallery-section {
    margin-bottom: var(--spacing-lg);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.image-item {
    margin: 0;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.05) 0%, rgba(76, 175, 80, 0.05) 100%);
    border: 2px solid var(--image-border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-item:hover {
    box-shadow: 0 8px 24px rgba(27, 94, 32, 0.15);
    transform: translateY(-4px);
}

.image-link {
    display: block;
    margin-bottom: var(--spacing-md);
    overflow: hidden;
    border-radius: 4px;
    text-decoration: none;
}

.plant-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
    cursor: pointer;
}

.image-link:hover .plant-image {
    transform: scale(1.05);
}

figcaption {
    color: var(--text-color);
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
    line-height: 1.4;
}

/* ============================================
   Description Section
   ============================================ */

.description-section {
    padding: var(--spacing-md);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05) 0%, rgba(100, 200, 100, 0.05) 100%);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    margin-bottom: var(--spacing-lg);
}

.section-title {
    color: var(--primary-color);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--secondary-color);
    border-radius: 50%;
}

.description-section p {
    color: var(--text-color);
    margin-bottom: var(--spacing-sm);
    font-size: 0.95rem;
    line-height: 1.8;
}

.description-section p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Links
   ============================================ */

.inline-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--secondary-color);
}

.inline-link:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* ============================================
   Footer
   ============================================ */

.footer {
    text-align: center;
    padding: var(--spacing-lg) var(--spacing-md);
    border-top: 2px solid var(--light-bg);
    color: var(--text-color);
    font-size: 0.85rem;
}

.footer-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.footer-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* ============================================
   Accessibility
   ============================================ */

.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 4px 0;
}

.skip-to-main:focus {
    top: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

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

/* ============================================
   Focus Styles (Keyboard Navigation)
   ============================================ */

a:focus,
button:focus,
[tabindex]:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================
   Responsive Design - Tablet
   ============================================ */

@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .description-section {
        padding: var(--spacing-sm);
        margin-bottom: var(--spacing-md);
    }

    .section-title {
        font-size: 1.15rem;
    }
}

/* ============================================
   Responsive Design - Mobile
   ============================================ */

@media (max-width: 576px) {
    .container {
        padding: var(--spacing-sm);
        box-shadow: none;
    }

    .header {
        margin-bottom: var(--spacing-md);
        padding-bottom: var(--spacing-md);
    }

    .description-section {
        padding: var(--spacing-sm);
        border-left-width: 3px;
        margin-bottom: var(--spacing-md);
    }

    .image-item {
        padding: var(--spacing-sm);
    }

    .section-title {
        font-size: 1rem;
    }

    .image-grid {
        gap: var(--spacing-sm);
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    body {
        background: white;
    }

    body::before,
    body::after {
        display: none;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
        max-width: 100%;
    }

    .navigation {
        display: none;
    }

    .divider {
        background: var(--border-color);
    }

    .image-item {
        page-break-inside: avoid;
        box-shadow: none;
    }

    .image-link {
        display: none;
    }

    .plant-image {
        display: block;
        margin: var(--spacing-sm) 0;
        max-width: 100%;
    }
}

/* ============================================
   Dark Mode Support
   ============================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #81c784;
        --secondary-color: #a5d6a7;
        --text-color: #e0e0e0;
        --light-bg: #2c3e50;
    }

    body {
        background-color: #1a1a1a;
    }

    body::before {
        background: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(40, 80, 40, 0.9) 100%);
    }

    .container {
        background: #1e1e1e;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }

    .image-item {
        background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
        border-color: rgba(165, 214, 167, 0.4);
    }

    .description-section {
        background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
    }

    figcaption {
        color: #e0e0e0;
    }
}

/* ============================================
   Animation Keyframes
   ============================================ */

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

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

.image-item {
    animation: fadeIn 0.6s ease-out;
}

.image-item.in-view {
    animation: slideIn 0.5s ease-out;
}
