/* Root Variables for Configurable Styles */
:root {
    --sihf-gap: 10px;
    --sihf-border-radius: 8px;
    --sihf-transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Container */
.sihf-container {
    width: 100%;
    margin-bottom: 30px;
}

/* --- Layout: Grid --- */
.sihf-feed.sihf-layout-grid {
    display: grid;
    gap: var(--sihf-gap);
    /* Columns are handled inline or via utility classes */
}

/* --- Layout: Carousel (Horizontal Scroll) --- */
.sihf-feed.sihf-layout-carousel {
    display: flex;
    overflow-x: auto;
    gap: var(--sihf-gap);
    padding-bottom: 15px; /* Space for scrollbar */
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.sihf-feed.sihf-layout-carousel .sihf-item {
    flex: 0 0 250px; /* Fixed width for better carousel feel */
    min-width: 200px; /* Prevent too small items */
    scroll-snap-align: start;
}

/* --- Layout: Card Slider (Enschede Style) --- */
.sihf-feed.sihf-layout-card_slider {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 20px 0;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.sihf-feed.sihf-layout-card_slider .sihf-item {
    flex: 0 0 300px;
    min-width: 300px;
    scroll-snap-align: center;
    background: #000; /* Dark background */
    color: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    height: auto; /* Allow height to grow */
    aspect-ratio: auto; /* Remove 1/1 ratio */
    border: 2px solid #fff; /* White border for contrast */
}

.sihf-feed.sihf-layout-card_slider .sihf-item img {
    height: 300px; /* Fixed image height */
    width: 100%;
    object-fit: cover;
}

.sihf-card-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.sihf-card-caption {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; /* Clean, bold font */
    font-size: 14px;
    line-height: 1.4;
    margin: 0 0 15px 0;
    font-weight: 600;
    text-transform: uppercase; /* Bold industrial look */
    color: #fff;
}

.sihf-card-link {
    color: #ff0000; /* Red accent color */
    text-decoration: none;
    font-weight: bold;
    font-size: 12px;
    align-self: flex-end;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

.sihf-card-link:hover {
    color: #fff;
    text-decoration: underline;
}

/* --- Layout: Memory Stack (Scroll Animation) --- */
.sihf-feed.sihf-layout-memory_stack {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    /* Self-contained scroll container */
    height: 600px; /* Or 80vh, but fixed height is safer for containment */
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    padding: 20px; /* Space for shadows */
    /* Hide scrollbar for cleaner look */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE 10+ */
}

.sihf-feed.sihf-layout-memory_stack::-webkit-scrollbar { 
    display: none;  /* Chrome/Safari */
}

.sihf-feed.sihf-layout-memory_stack .sihf-item {
    position: sticky;
    top: 20px; /* Stick at top of container */
    width: 100%;
    background: #fff;
    padding: 15px 15px 60px 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border-radius: 8px; /* Doubled radius */
    /* Important: height of item must be less than container height to allow scrolling */
    min-height: 500px; /* Increased height */
    margin-bottom: 300px; /* Large margin to allow "time" to scroll before next one covers it */
    scroll-snap-align: start;
    
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    
    /* Initial state */
    transform-origin: center top;
    transition: transform 0.1s linear;
}

/* Last item needs no bottom margin */
.sihf-feed.sihf-layout-memory_stack .sihf-item:last-child {
    margin-bottom: 0;
}

/* Add some random rotation via nth-child to look organic */
.sihf-feed.sihf-layout-memory_stack .sihf-item:nth-child(odd) {
    transform: rotate(-2deg);
}
.sihf-feed.sihf-layout-memory_stack .sihf-item:nth-child(even) {
    transform: rotate(2deg);
}

.sihf-feed.sihf-layout-memory_stack .sihf-item img {
    width: 100%;
    height: auto;
    max-height: 400px; /* Limit image height to ensure text fits */
    aspect-ratio: 1/1;
    object-fit: cover;
    margin-bottom: 15px;
    background: #f4f4f4;
    display: block; /* Fix inline gap */
    border-radius: 4px; /* Slight radius for image inside card */
}

/* Ensure content is visible */
.sihf-feed.sihf-layout-memory_stack .sihf-card-content {
    text-align: center;
    position: relative;
    z-index: 10;
    display: block !important; /* Force display */
    opacity: 1 !important;
}

.sihf-feed.sihf-layout-memory_stack .sihf-card-author {
    font-weight: bold;
    color: #000;
    margin-bottom: 5px;
    font-size: 16px;
    display: block;
}

.sihf-feed.sihf-layout-memory_stack .sihf-card-caption {
    font-family: 'Courier New', monospace;
    color: #666;
    font-size: 14px;
    display: block;
    line-height: 1.4;
}

/* Ensure images don't overflow or become huge */
.sihf-feed img {
    max-width: 100%;
    height: auto;
}

/* --- Items --- */
.sihf-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--sihf-border-radius);
    aspect-ratio: 1 / 1;
    background: #f0f0f0; /* Loading placeholder */
}

.sihf-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--sihf-transition);
}

/* --- Hover Effects --- */
.sihf-hover-zoom .sihf-item:hover img {
    transform: scale(1.05);
}

.sihf-hover-grayscale .sihf-item img {
    filter: grayscale(100%);
}
.sihf-hover-grayscale .sihf-item:hover img {
    filter: grayscale(0%);
}

/* --- Lightbox Styles --- */
#sihf-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#sihf-lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.sihf-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sihf-lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.sihf-lightbox-close {
    position: absolute;
    top: -40px;
    right: -40px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    font-family: sans-serif;
    line-height: 1;
    z-index: 100000;
}

.sihf-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 50px;
    cursor: pointer;
    padding: 20px;
    user-select: none;
    z-index: 100000;
    transition: opacity 0.3s;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
}

.sihf-lightbox-nav:hover {
    background: rgba(0,0,0,0.5);
}

.sihf-lightbox-prev {
    left: -80px;
}

.sihf-lightbox-next {
    right: -80px;
}

/* Mobile adjustments for nav */
@media (max-width: 768px) {
    .sihf-lightbox-prev {
        left: 0;
        font-size: 30px;
    }
    .sihf-lightbox-next {
        right: 0;
        font-size: 30px;
    }
    .sihf-lightbox-close {
        right: 0;
        top: -40px;
    }
}

.sihf-lightbox-caption {
    color: #ccc;
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
    font-family: sans-serif;
}

/* --- Responsive Grid --- */
@media (max-width: 600px) {
    .sihf-feed.sihf-layout-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 400px) {
    .sihf-feed.sihf-layout-grid {
        grid-template-columns: 1fr !important;
    }
}
