html {
    scroll-behavior: smooth;
}

.toggle-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.toggle-nav {
    position: relative;
    height: 0;
}

/* Desktop View */
.desktop-view {
    display: block;
}

.mobile-view {
    display: none;
}

.row-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* Mobile-first layout - 2 icons per row */
.icons-row {
    display: grid;
    grid-template-columns: repeat(var(--icons-per-row, 4), 1fr);
    gap: 20px;
    width: 100%;
}

/* Desktop layout - 4 icons per row */
@media (min-width: 769px) {
    .icons-row {
        grid-template-columns: repeat(var(--icons-per-row, 4), 1fr);
        gap: 20px;
    }
    
    .icon-wrapper {
        width: 150px;
        height: 150px;
    }
    
    .icon-title h2 {
        font-size: 18px;
    }
}

/* Tablet layout - 3 icons per row */
@media (max-width: 1024px) {
    .icons-row {
        gap: 15px;
    }
    
    .icon-wrapper {
        max-width: 150px;
    }
    
    .icon-title h2 {
        font-size: 18px;
    }
}

/* Mobile layout - 4 icons per row */
@media (max-width: 768px) {
    .desktop-view {
        display: none;
    }
    
    .mobile-view {
        display: block;
    }
    
    .icons-row {
        grid-template-columns: repeat(var(--icons-per-row, 4), 1fr);
        gap: 8px;
    }
    
    .toggle-container {
        gap: 15px;
    }

    .row-container {
        gap: 8px;
    }
    
    .icon-wrapper {
        max-width: 80px;
        height: 80px;
    }
    
    .icon-title h2 {
        font-size: 12px;
    }

    .expand-indicator svg {
        width: 16px;
        height: 16px;
    }

    .toggle-content {
        padding: 15px;
        padding-right: 52px;
    }

    .button-group {
        top: 10px;
        right: 10px;
        gap: 8px;
    }

    .prev-button,
    .next-button,
    .close-button {
        width: 32px;
        height: 32px;
    }

    .prev-button svg,
    .next-button svg,
    .close-button svg {
        width: 18px;
        height: 18px;
    }

    .up-button svg {
        width: 16px;
        height: 16px;
    }

    .content-wrapperx {
        padding-right: 50px;
    }

    .sb-toggle-icon {
        padding: 3px; /* Reduced padding for mobile */
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    .icons-row {
        grid-template-columns: repeat(var(--icons-per-row, 4), 1fr);
        gap: 6px;
    }
    
    .icon-wrapper {
        width: 60px;
        height: 60px;
    }
    
    .icon-title h2 {
        font-size: 11px;
    }
    
    .toggle-content {
        padding: 12px;
        padding-right: 48px;
    }

    .content-wrapperx {
        padding-right: 50px;
    }

    .sb-toggle-icon {
        padding: 3px; /* Maintain same padding for smaller screens */
    }
}

@media (max-width: 360px) {
    .icons-row {
        grid-template-columns: repeat(var(--icons-per-row, 4), 1fr);
        gap: 6px;
    }
    
    .icon-wrapper {
        width: 60px;
        height: 60px;
        max-width: 50px !important;
    }
    
    .icon-title h2 {
        font-size: 11px;
    }
    
    .toggle-content {
        padding: 12px;
        padding-right: 48px;
    }

    .content-wrapperx {
        padding-right: 50px;
    }

    .sb-toggle-icon {
        padding: 3px; /* Maintain same padding for smaller screens */
    }

    .icons-row {
        grid-template-columns: repeat(var(--icons-per-row, 2), 1fr);
    }
    
    .icon-wrapper {
        width: 100px;
        height: 100px;
    }
}

.content-row {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 10px 0;
    min-height: 0;
    transition: min-height 0.3s ease;
}

.content-row:empty {
    display: none;
}

.sb-toggle-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: none;
    cursor: pointer;
    padding: 6px;
    transition: all 0.3s ease;
    width: 100%;
    border-radius: 8px;
    /*background-color: #ffffff;*/
    position: relative;
}

.sb-toggle-icon:hover,
.sb-toggle-icon:focus {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.sb-toggle-icon:focus {
    outline: 3px solid var(--content-bg);
    outline-offset: 2px;
}

.sb-toggle-icon:focus-visible {
    outline: 4px solid yellow;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}



.sb-toggle-icon.active {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    margin-bottom: 15px;
}



.sb-toggle-icon.active::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid var(--content-bg, #ffff00);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
    z-index: 2;
    pointer-events: none;
}

.icon-wrapper {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: 8px;
    overflow: hidden;
    background: inherit;
}

.icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.icon-title h2 {
    color: #222222;
    font-size: clamp(14px, 2vw, 18px);
    margin: 0;
    padding: 0;
    text-align: center;
    font-weight: 600;
    line-height: 1.5;
    word-break: break-word;
}

/* Hide titles visually while keeping them accessible */
.toggle-container.hide-titles .icon-title h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.toggle-container.hide-titles .icon-title {
    height: 0;
    margin: 0;
    padding: 0;
}

/* Down arrow to indicate expandable content */
.expand-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    flex-shrink: 0;
}

.expand-indicator svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    opacity: 0.7;
}

.sb-toggle-icon:hover .expand-indicator svg,
.sb-toggle-icon:focus .expand-indicator svg,
.sb-toggle-icon.active .expand-indicator svg {
    opacity: 1;
}

.toggle-container.hide-titles .expand-indicator {
    margin-top: 6px;
}

.button-group {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 20px;
    right: 20px;
    gap: 10px;
    z-index: 10;
}

/* Set the order of buttons */
.close-button {
    order: 1;
}

.up-button {
    order: 2;
}

.prev-button {
    order: 3;
}

.next-button {
    order: 4;
}

.prev-button,
.next-button,
.close-button,
.up-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 20%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #ffffff;
    position: relative;
}

.prev-button:hover,
.next-button:hover,
.close-button:hover,
.up-button:hover {
    transform: scale(1.1);
    background-color: #f5f5f5;
}

.prev-button:focus,
.next-button:focus,
.close-button:focus,
.up-button:focus {
    outline: 3px solid var(--content-bg);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.prev-button:focus-visible,
.next-button:focus-visible,
.close-button:focus-visible,
.up-button:focus-visible {
    outline: 2px solid yellow;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* High contrast mode support */
@media (forced-colors: active) {
    .prev-button:focus,
    .next-button:focus,
    .close-button:focus {
        outline: 2px solid CanvasText;
    }
}

.prev-button svg,
.next-button svg,
.close-button svg,
.up-button svg {
    width: 20px;
    height: 20px;
    pointer-events: none; /* Ensures clicks go to the button */
}

.toggle-content {
    display: none;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    grid-column: 1 / -1;
    margin: 0;
    position: relative;
    padding-right: 76px;
    padding-bottom: 30px;
    z-index: 100; /* Ensure content appears above icons */
}

.toggle-content:focus-within {
    /* Optional: add visual indicator when focusing within content */
    outline: 2px solid var(--content-bg);
    outline-offset: 2px;
}

.content-wrapperx {
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

.content-wrapperx .full-content {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.read-more-button {
    background-color: #7a1810;
    color: #ffffff !important;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
    padding: 10px 20px;
    margin-top: 20px;
    display: inline-block;
    min-height: 44px; /* Touch target size */
    min-width: 44px; /* Touch target size */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.read-more-button:hover, .read-more-button:focus {
    background-color: #b82a21;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.read-more-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-content.active {
    display: block;
}

.toggle-content.active .content-wrapperx {
    opacity: 1;
    animation: fadeIn 0.3s ease-in forwards;
}

.toggle-content.closing .content-wrapperx {
    animation: fadeOut 0.2s ease-in forwards;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 20px;
    background: #000000;
    color: #ffffff;
    padding: 10px 15px;
    z-index: 1000;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid yellow;
    outline-offset: 2px;
}

/* Zoom support */
@media (max-width: 1024px) and (min-resolution: 192dpi) {
    .toggle-container {
        max-width: 100%;
        padding: 10px;
    }

    .icon-wrapper {
        max-width: none;
        width: 100%;
    }

    .toggle-content {
        padding: 15px;
        max-width: 100vw;
        overflow-x: auto;
    }
}

/* High contrast mode improvements */
@media (forced-colors: active) {
    .sb-toggle-icon,
    .prev-button,
    .next-button,
    .close-button,
    .up-button {
        border: 2px solid currentColor;
    }

    .toggle-content {
        border: 1px solid currentColor;
    }
} 