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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e0f2f7 0%, #fff9e6 100%);
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 0;
}

/* Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

header {
    background: linear-gradient(135deg, #4A90A4 0%, #5FA8BE 100%);
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    display: block;
    height: 50px;
    width: auto;
}

.hamburger {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    transition: opacity 0.3s;
}

.hamburger:hover,
.hamburger:focus {
    opacity: 0.8;
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 4px;
}

.hamburger span {
    width: 30px;
    height: 3px;
    background: white;
    margin: 4px 0;
    transition: 0.3s;
    border-radius: 2px;
}

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

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

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

.mobile-menu {
    display: none;
    background: #5FA8BE;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.mobile-menu.active {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-menu a {
    color: white;
    text-decoration: none;
    padding: 0.75rem;
    border-radius: 4px;
    transition: background 0.3s;
}

.mobile-menu a:hover,
.mobile-menu a:focus {
    background: rgba(255,255,255,0.2);
    outline: 2px solid rgba(255,255,255,0.3);
    outline-offset: 2px;
}

main {
    flex: 1;
    padding: 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    justify-items: center;
}

.tile {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    max-width: 320px;
    width: 100%;
    cursor: pointer;
}

.tile:hover,
.tile:focus {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    outline: 3px solid #4A90A4;
    outline-offset: 2px;
}

/* Remove outline on mouse click but keep for keyboard */
.tile:focus:not(:focus-visible) {
    outline: none;
}

.tile:focus-visible {
    outline: 3px solid #4A90A4;
    outline-offset: 2px;
}

.tile-image {
    width: 100%;
    max-width: 320px;
    height: 240px;
    object-fit: cover;
    display: block;
}

.tile-image img[src*="cshow.php"] {
    width: 320px !important;
    height: 240px !important;
    background: #e0e0e0;
    object-fit: contain;
}

.tile-content {
    padding: 1.25rem;
}

.tile-content h2 {
    color: #4A90A4;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.tile-content p {
    color: #666;
    line-height: 1.6;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.tile-tag {
    display: inline-block;
    background: #E8F5F7;
    color: #4A90A4;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

/* Link styling for noscript fallback */
.tile-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #4A90A4;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s;
}

.tile-link:hover,
.tile-link:focus {
    background: #5FA8BE;
    outline: 2px solid #4A90A4;
    outline-offset: 2px;
}

footer {
    background: linear-gradient(135deg, #4A90A4 0%, #5FA8BE 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
    padding: 0.25rem 0.5rem;
}

.footer-links a:hover,
.footer-links a:focus {
    opacity: 0.8;
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tile-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .tile-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .footer-links.desktop-nav {
        display: none;
    }

    main {
        padding: 2rem 1rem;
    }
}

@media (max-width: 600px) {
    .tile-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    header {
        padding: 1rem 1.5rem;
    }
    
    .tile-content h2 {
        font-size: 1.1rem;
    }
    
    .tile-content p {
        font-size: 0.9rem;
    }
}

/* Print styles for better print output */
@media print {
    header,
    footer,
    .hamburger,
    .mobile-menu {
        display: none;
    }
    
    .tile {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    body {
        background: white;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tile:focus {
        outline-width: 4px;
    }
}

/* Reduced motion support for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .tile:hover {
        transform: none;
    }
}
