/**
 * Dynamic Sitemap Styles
 * Illinois Conservatory for the Arts
 * Following site-grid-rails.css for layout and style.css for colors/fonts
 */

/* Sitemap page hero section */
.sitemap-hero {
    background: var(--ica-green-deep, #2c5530);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.sitemap-hero .page-title {
    font-family: var(--font-ui, "Termina", sans-serif) !important;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: white;
}

.sitemap-hero .page-excerpt {
    font-family: "Termina", sans-serif !important;
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

/* More specific selector to override theme styles */
.sitemap-page .sitemap-hero .page-excerpt p {
    font-family: "Termina", sans-serif !important;
}

/* Sitemap content section */
.sitemap-content {
    padding: 4rem 0;
}

.sitemap-content .section__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.sitemap-section {
    margin-bottom: 2.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sitemap-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
}

/* Collapsed section state - SEO-friendly approach */
.sitemap-section.collapsed .sitemap-list {
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    transition: max-height 0.3s ease, opacity 0.3s ease !important;
    position: relative !important;
    left: auto !important;
    width: auto !important;
    height: auto !important;
}

/* Expanded section state */
.sitemap-section.expanded .sitemap-list {
    display: grid !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
}

/* Force single-column layout on very small screens */
@media (max-width: 480px) {
    .sitemap-section.expanded .sitemap-list {
        grid-template-columns: 1fr !important;
    }
}

.sitemap-section-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: white;
    margin: 0;
    padding: 1.5rem 2rem;
    background: var(--ica-green-deep, #2c5530);
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Section title text styling */
.sitemap-section-title-text {
    font-family: var(--font-ui, "Termina", sans-serif) !important;
    text-transform: uppercase;
    flex: 0 0 70%;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: white !important;
    line-height: 1.2 !important;
}

.sitemap-section-title-text h2,
h2.sitemap-section-title-text {
    font-family: var(--font-ui, "Termina", sans-serif) !important;
    text-transform: uppercase;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: white !important;
    line-height: 1.2 !important;
}

.sitemap-section-toggle {
    border: none;
    background: none;
    flex: 0 0 30%;
    text-align: right;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
}

/* Toggle button styling */
.sitemap-section-toggle button {
    background: none !important;
    border: none !important;
    padding: 0.5rem !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
    transition: background-color 0.3s ease !important;
}

.sitemap-section-toggle button:hover {
    background-color: var(--ica-green-light, rgba(76, 175, 80, 0.1)) !important;
}

.sitemap-section-toggle button:focus {
    outline: 2px solid var(--ica-green-deep, #2c5530) !important;
    outline-offset: 2px !important;
}

.sitemap-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0.5rem 1.5rem 0.5rem;
    display: grid !important;
    gap: 0.75rem;
    grid-template-columns: repeat(1, 1fr) !important;
}

/* Pages: base (desktop and above) - 4 columns */
.pages-sitemap-section .pages-sitemap-list {
    grid-template-columns: repeat(4, 1fr) !important;
}

/* Special scholarship row - full width at the end */
.sitemap-special-row {
    grid-column: 1 / -1 !important;
    width: 100% !important;
}

/* Blog: 2 columns by default */
.blog-sitemap-section .blog-sitemap-list {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0.5rem 1.5rem 0.5rem;
    gap: 0.75rem;
}

/* Blog items with proper hanging indentation and numbering */
.blog-sitemap-item {
    text-align: left !important;
    display: flex !important;
    align-items: center;
    padding: 0.5rem 0;
    gap: 0.75rem;
}

.blog-item-number {
    flex-shrink: 0;
    min-width: 2.2rem;
    text-align: center;
    font-weight: 600;
    color: var(--ica-green-deep, #2c5530);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
}

.blog-sitemap-link {
    text-align: left !important;
    display: block !important;
    text-decoration: none;
    color: var(--ica-text-dark, #2c3e50);
    font-size: 16px;
    line-height: 1.5;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
}

.blog-sitemap-link:hover {
    color: var(--ica-green-deep, #2c5530) !important;;
    text-decoration: none;
}

/* Archives section base styling */
.sitemap-children {
    display: grid;
    gap: 0.75rem;
    list-style: none !important;
    padding: 1rem 1.5rem !important;
    margin: 0 !important;
    border-radius: 6px;
}

/* Categories grid: default 5 columns on large screens */
.archive-sitemap-section .sitemap-children {
    grid-template-columns: repeat(5, 1fr) !important;
}

/* Remove markers from all archive list items */
.sitemap-children li {
    list-style: none !important;
    margin-bottom: 0.25rem;
}

/* Grid item styling */
.sitemap-item {
    border: none;
    background: none;
    transition: background-color 0.3s ease;
    padding: 0.5rem;
    font-size: 16px;
}

.sitemap-item:last-child {
    border-bottom: none;
}

.sitemap-link {
    display: block;
    padding: 0.5rem 0.5rem;
    color: var(--ica-text-dark, #2c3e50);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
    text-align: center;
    font-size: 16px;
}

/* Pages sitemap links - dedicated styling (no inheritance from .sitemap-item) */
.pages-sitemap-link {
    text-transform: uppercase !important;
    display: block !important;
    padding: 0.5rem 0.5rem !important;
    color: var(--ica-green-deep, #2c5530) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: color 0.3s ease !important;
    position: relative !important;
    text-align: center !important;
    font-size: 16px !important;
    margin: 0 !important;
    border: none !important;
    background: none !important;
    list-style: none !important;
}

.sitemap-link:hover {
    color: var(--ica-green-deep, #2c5530) !important;
    text-decoration: none;
}

/* Pages sitemap links hover styling */
.pages-sitemap-link:hover {
    color: var(--ica-green-deep, #2c5530) !important;
    text-decoration: none !important;
    background-color: var(--ica-green-light, rgba(76, 175, 80, 0.1)) !important;
    border-radius: 4px !important;
    text-transform: uppercase !important;
}

/* Archive sections - improved styling */
.sitemap-section .sitemap-item strong {
    display: block;
    padding: 1rem 1.5rem 0.5rem 1.5rem;
    color: var(--ica-text-dark, #2c3e50);
    font-weight: 600;
    font-size: 1.1rem;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 0.5rem;
}

/* Archive children links - better spacing and typography */
.sitemap-children .sitemap-link {
    padding: 0.5rem 1.5rem;
    font-size: 16px;
    color: var(--ica-text-dark, #2c3e50);
    text-decoration: none;
    transition: color 0.3s ease;
    display: block;
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.sitemap-children .sitemap-link:hover {
    color: var(--ica-green-deep, #2c5530) !important;
    background-color: var(--ica-green-light, rgba(76, 175, 80, 0.1));
    text-decoration: none;
}

/* Archive links - better mobile spacing */
@media (max-width: 500px) {
    .sitemap-children .sitemap-link {
        padding: 0.75rem 1rem;
        font-size: 15px;
        margin-bottom: 0.5rem;
    }
    
    .sitemap-section .sitemap-item strong {
        padding: 0.75rem 1rem 0.5rem 1rem;
        font-size: 1rem;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .sitemap-hero {
        padding: 2rem 0;
    }
    
    .sitemap-hero .page-title {
        font-size: 2rem;
    }
    
    .sitemap-hero .page-excerpt {
        font-family: "Termina", sans-serif !important;
        font-size: 1rem;
    }
    
    .sitemap-content {
        padding: 2rem 0;
    }
    
    .sitemap-section-title {
        font-size: 1.5rem;
        padding: 1rem 1.5rem;
    }
    
    .sitemap-link {
        padding: 0.75rem 1.5rem;
    }
    
    /* Mobile: Stack all grids to single column */
    .sitemap-list {
        grid-template-columns: 1fr !important;
    }
    
    /* Pages: 3 columns at 768px */
    .pages-sitemap-section .pages-sitemap-list {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* Categories: 3 columns at 768px */
    .archive-sitemap-section .sitemap-children {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .sitemap-item.depth-1 {
        padding-left: 1rem;
    }
    
    .sitemap-item.depth-2 {
        padding-left: 2rem;
    }
    
    .sitemap-item.depth-3 {
        padding-left: 3rem;
    }
    
    .sitemap-toggle-icon {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* Tablet responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .sitemap-section:nth-of-type(2) .sitemap-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Accessibility improvements */
.sitemap-link:focus,
.sitemap-link:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Toggle icon */
.sitemap-toggle-icon {
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    filter: brightness(0) invert(1);
    transform: rotate(0deg);
}

.sitemap-toggle-icon:hover {
    filter: brightness(0) invert(1) brightness(0.8);
    transform: scale(1.1);
}

@media (max-width: 580px) {
    /* Pages: 2 columns */
    .pages-sitemap-section .pages-sitemap-list {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Categories: 2 columns */
    .archive-sitemap-section .sitemap-children {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Blog Posts: 1 column */
    .blog-sitemap-section .blog-sitemap-list {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 450px) {
    /* Pages: 1 column */
    .pages-sitemap-section .pages-sitemap-list {
        grid-template-columns: 1fr !important;
    }
    
    /* Categories: 1 column */
    .archive-sitemap-section .sitemap-children {
        grid-template-columns: 1fr !important;
    }
    
    /* Align text left for readability on very small screens */
    .pages-sitemap-section .pages-sitemap-list .sitemap-link {
        text-align: left !important;
    }
    
    .sitemap-item {
        padding: 0.2rem 1.5rem;
    }
}

/* Performance monitoring styles */
.ica-sitemap-container[data-performance-monitoring="true"] {
    position: relative;
}

.ica-sitemap-container[data-performance-monitoring="true"]::before {
    content: "Performance monitoring active";
    position: absolute;
    top: -2rem;
    right: 0;
    font-size: 0.8rem;
    color: #7f8c8d;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    opacity: 0.7;
}

/* Enhanced print styles */
@media print {
    .sitemap-toggle-icon {
        display: none !important;
    }
    
    .sitemap-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .sitemap-list {
        display: block !important;
    }
    
    .sitemap-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .sitemap-link {
        color: #000 !important;
        text-decoration: underline;
    }
    
    .sitemap-date {
        color: #666 !important;
    }
}

/* Website Credit Section */
.sitemap-credit {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--ica-green-light, rgba(76, 175, 80, 0.1));
    border-radius: 8px;
    text-align: center;
}

.sitemap-credit-text {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--ica-text-dark, #2c3e50);
    font-family: var(--font-ui, "Termina", sans-serif) !important;
    line-height: 1.5;
}

.sitemap-credit-subtext {
    margin: 0;
    font-size: 0.8rem;
    color: var(--ica-green-deep, #2c5530);
    font-family: var(--font-ui, "Termina", sans-serif);
    font-weight: 500;
    line-height: 1.4;
    opacity: 0.8;
}

.sitemap-credit-link {
    color: var(--ica-green-deep, #2c5530);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.sitemap-credit-link:hover {
    color: var(--ica-green, #4CAF50);
    text-decoration: underline;
}

/* Mobile responsive credit section */
@media (max-width: 500px) {
    .sitemap-credit {
        margin-top: 1.5rem;
        padding: 1rem;
    }
    
    .sitemap-credit-text {
        font-size: 0.85rem;
    }
    
    .sitemap-credit-subtext {
        font-size: 0.75rem;
    }
}
