/* ===== SDAWSOGA GALLERY STYLES ===== */

.sdawsoga-scope {
    max-width: 1400px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    padding: 0 20px;
}

/* Defensive SVG reset — prevents theme rules like 'svg { width: 100% }' from breaking icons.
   Only constrains max-width; never overrides width/height so component rules always win. */
.sdawsoga-scope svg {
    max-width: 100%;
    height: auto;
}

/* Inside the modal/lightbox, lift the max-width cap so SVGs can use their
   component-defined dimensions without theme interference. */
.sdawsoga-scope .sdawsoga-modal svg,
.sdawsoga-scope .sdawsoga-lb-engagement svg {
    max-width: none;
}

/* Slightly narrower on medium screens */
@media (max-width: 1440px) {
    .sdawsoga-scope {
        max-width: 1200px;
    }
}

@media (max-width: 1280px) {
    .sdawsoga-scope {
        max-width: 1100px;
    }
}

/* ===== HEADER ===== */
.sdawsoga-header {
    display: flex;
    padding: 40px 20px;
    gap: 60px;
    border-bottom: 1px solid #dbdbdb;
    margin-bottom: 30px;
}

/* Header size variations */
.sdawsoga-header-small {
    padding: 25px 15px;
    gap: 30px;
}

.sdawsoga-header-small .sdawsoga-avatar-ring {
    width: 90px;
    height: 90px;
}

.sdawsoga-header-small .sdawsoga-user-bar h2 {
    font-size: 20px;
}

.sdawsoga-header-small .sdawsoga-stat-bar,
.sdawsoga-header-small .sdawsoga-bio-bar {
    font-size: 14px;
}

.sdawsoga-header-medium {
    /* Default sizes - already defined */
}

.sdawsoga-header-large {
    padding: 60px 30px;
    gap: 80px;
}

.sdawsoga-header-large .sdawsoga-avatar-ring {
    width: 200px;
    height: 200px;
}

.sdawsoga-header-large .sdawsoga-user-bar h2 {
    font-size: 36px;
}

.sdawsoga-header-large .sdawsoga-stat-bar,
.sdawsoga-header-large .sdawsoga-bio-bar {
    font-size: 18px;
}

/* Header style variations */
/* Standard style - default, no additional styling needed */

/* Boxed style */
.sdawsoga-header-boxed {
    background: #fafafa;
    border: 1px solid #dbdbdb;
    border-radius: 12px;
    padding: 40px 30px;
    margin-bottom: 30px;
}

.sdawsoga-header-boxed.sdawsoga-header-small {
    padding: 25px 20px;
    border-radius: 8px;
}

.sdawsoga-header-boxed.sdawsoga-header-large {
    padding: 60px 40px;
    border-radius: 16px;
}

/* Text only style - hide avatar, simplify layout */
.sdawsoga-header-text .sdawsoga-header-left {
    display: none;
}

.sdawsoga-header-text {
    border-bottom: none;
    padding: 20px 10px;
    gap: 0;
}

.sdawsoga-header-text .sdawsoga-header-right {
    gap: 15px;
}

.sdawsoga-header-text .sdawsoga-user-bar {
    flex-wrap: wrap;
}

.sdawsoga-header-text .sdawsoga-user-bar h2 {
    font-size: 22px;
}

.sdawsoga-header-text .sdawsoga-stat-bar {
    font-size: 14px;
    gap: 25px;
}

.sdawsoga-header-text .sdawsoga-bio-bar {
    font-size: 14px;
}

/* Text Only Content */
.sdawsoga-text-only-content {
    width: 100%;
    padding: 20px;
    line-height: 1.6;
    font-size: 16px;
}

.sdawsoga-text-only-content p {
    margin: 0 0 10px;
}

.sdawsoga-header-left {
    flex-shrink: 0;
}

.sdawsoga-header-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sdawsoga-avatar-ring {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid #dbdbdb;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    padding: 3px;
}

.sdawsoga-avatar-ring img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #fff;
}

.sdawsoga-user-bar {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sdawsoga-user-bar h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 300;
}

.sdawsoga-follow-btn {
    background: var(--sdawsoga-follow-btn-bg, #0095f6) !important; /* Instagram blue as neutral default */
    color: var(--sdawsoga-follow-btn-color, #fff) !important;
    padding: 8px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 149, 246, 0.2);
    white-space: nowrap;
}

.sdawsoga-follow-btn:hover {
    background: var(--sdawsoga-follow-btn-hover, #0084d6) !important;
    color: var(--sdawsoga-follow-btn-color-hover, var(--sdawsoga-follow-btn-color, #fff)) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 149, 246, 0.3);
}

.sdawsoga-stat-bar {
    display: flex;
    gap: 40px;
    font-size: 16px;
    align-items: center;
}

.sdawsoga-stat-bar span {
    color: #262626;
}

.sdawsoga-stat-bar strong {
    font-weight: 600;
}

.sdawsoga-stat-bar .sdawsoga-follow-btn {
    margin-left: auto;
}

.sdawsoga-bio-bar strong {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.sdawsoga-bio-bar p {
    margin: 0;
    line-height: 1.5;
    color: #262626;
}

/* ===== LOADING ===== */
.sdawsoga-loading {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.sdawsoga-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #b12839;
    border-radius: 50%;
    animation: sdawsoga-spin 1s linear infinite;
}

@keyframes sdawsoga-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== GRID BASE ===== */
.sdawsoga-grid {
    margin-bottom: 40px;
    /* Display og layout settes av spesifikke layout-klasser nedenfor */
}

/* ===== RESPONSIVE COLUMN VARIABLE ===== */
/* Maps per-breakpoint CSS variables (set on .sdawsoga-instance by template)
   to a single --sdawsoga-active-cols used by all layout types. */
.sdawsoga-instance {
    --sdawsoga-active-cols: var(--sdawsoga-cols, 3);
}

@media (max-width: 1440px) {
    .sdawsoga-instance {
        --sdawsoga-active-cols: var(--sdawsoga-cols-laptop, var(--sdawsoga-cols, 3));
    }
}

@media (max-width: 1024px) {
    .sdawsoga-instance {
        --sdawsoga-active-cols: var(--sdawsoga-cols-tablet-l, 3);
    }
}

@media (max-width: 768px) {
    .sdawsoga-instance {
        --sdawsoga-active-cols: var(--sdawsoga-cols-tablet-p, 2);
    }
}

@media (max-width: 600px) {
    .sdawsoga-instance {
        --sdawsoga-active-cols: var(--sdawsoga-cols-mobile-l, 2);
    }
}

@media (max-width: 480px) {
    .sdawsoga-instance {
        --sdawsoga-active-cols: var(--sdawsoga-cols-mobile-p, 1);
    }
}

/* Grid Layout - standard rutenett */
.sdawsoga-layout-grid {
    display: grid;
    grid-template-columns: repeat(var(--sdawsoga-active-cols, 3), 1fr);
    gap: var(--sdawsoga-gap, 28px);
}

.sdawsoga-layout-grid .sdawsoga-item {
    aspect-ratio: var(--sdawsoga-aspect, 1 / 1);
}

/* Fallback for browsers without aspect-ratio support (Safari <15) */
@supports not (aspect-ratio: 1 / 1) {
    .sdawsoga-layout-grid .sdawsoga-item::before {
        content: '';
        display: block;
        padding-top: 100%;
    }
}

/* Masonry Layout - Pinterest columns */
.sdawsoga-layout-masonry {
    display: block;
    column-count: var(--sdawsoga-active-cols, 3);
    column-gap: var(--sdawsoga-gap, 28px);
}

.sdawsoga-layout-masonry .sdawsoga-item {
    break-inside: avoid;
    margin-bottom: var(--sdawsoga-gap, 28px);
    display: inline-block;
    width: 100%;
}

.sdawsoga-layout-masonry .sdawsoga-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* Highlight Layout - første stor, resten små */
.sdawsoga-layout-highlight {
    display: grid;
    grid-template-columns: repeat(var(--sdawsoga-active-cols, 4), 1fr);
    gap: var(--sdawsoga-gap, 28px);
}

.sdawsoga-layout-highlight .sdawsoga-item {
    aspect-ratio: var(--sdawsoga-aspect, 1 / 1);
}

/* Featured first item: spans 2x2 only when the active grid has 2+ columns.
   When --sdawsoga-active-cols is 1 (typical mobile portrait), span 2 would
   force CSS Grid to create an implicit second column sized via
   grid-auto-columns: auto = 0px. All auto-placed items then alternate
   between the visible 1fr column and the invisible 0px column, hiding
   every other post. min(2, --sdawsoga-active-cols) clamps the span to the
   available columns so single-column layouts stack cleanly. (5.3.3) */
.sdawsoga-layout-highlight .sdawsoga-item:first-child {
    grid-column: span min(2, var(--sdawsoga-active-cols, 4));
    grid-row: span min(2, var(--sdawsoga-active-cols, 4));
}

/* Base item styles */
.sdawsoga-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.sdawsoga-item:hover {
    transform: scale(1.03);
    will-change: transform;
}

.sdawsoga-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sdawsoga-item img.sdawsoga-loaded {
    opacity: 1;
    transition: none;
}

/* ===== HOVER OVERLAY ===== */
.sdawsoga-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.3) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.7) 100%
    );
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    color: #fff;
    z-index: 2;
}

.sdawsoga-item:hover .sdawsoga-hover-overlay {
    opacity: 1;
    transform: translateY(0);
}

.sdawsoga-hover-caption {
    font-size: 13px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.sdawsoga-hover-stats {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

.sdawsoga-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sdawsoga-stat-icon {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.sdawsoga-scope .sdawsoga-stat-icon svg {
    fill: #fff;
    width: 100%;
    height: 100%;
}

/* ===== CAROUSEL ICON ===== */
.sdawsoga-carousel-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.75);
    padding: 6px 10px;
    border-radius: 16px;
    z-index: 3;
    backdrop-filter: blur(4px);
}

.sdawsoga-scope .sdawsoga-carousel-icon svg {
    width: 20px;
    height: 20px;
    fill: #fff;
    stroke: #fff;
    flex-shrink: 0;
}

.sdawsoga-carousel-count {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

/* ===== LOAD MORE ===== */
.sdawsoga-load-more-wrap {
    text-align: center;
    margin: 40px 0;
}

.sdawsoga-red-btn {
    background: var(--sdawsoga-loadmore-btn-bg, #0095f6) !important; /* Instagram blue as neutral default */
    color: var(--sdawsoga-loadmore-btn-color, #fff) !important;
    padding: 12px 32px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-block;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 149, 246, 0.2);
}

.sdawsoga-red-btn:hover {
    background: var(--sdawsoga-loadmore-btn-hover, #0084d6) !important;
    color: var(--sdawsoga-loadmore-btn-color-hover, var(--sdawsoga-loadmore-btn-color, #fff)) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 149, 246, 0.3);
}

/* ===== MODAL / LIGHTBOX - NEW DESIGN ===== */
.sdawsoga-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 999999;
    justify-content: center;
    align-items: center;
    animation: sdawsoga-fadeIn 0.2s ease;
}

.sdawsoga-modal.active {
    display: flex;
}

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

.sdawsoga-modal-content {
    display: flex;
    width: 90%;
    max-width: 1400px;
    height: 90vh;
    max-height: 1000px;
    background: #fff;
    position: relative;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: sdawsoga-slideUp 0.3s ease;
}

/* Scale down modal on smaller desktops */
@media (max-width: 1680px) {
    .sdawsoga-modal-content {
        max-width: 1200px;
    }
}

@media (max-width: 1440px) {
    .sdawsoga-modal-content {
        max-width: 1050px;
    }
}

@keyframes sdawsoga-slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Left side - Image container */
.sdawsoga-media-container {
    position: relative;
    background: #000;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
    overflow: hidden;
}

[data-role="slider-wrap"] {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-role="slider-wrap"] img,
[data-role="slider-wrap"] video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Navigation arrows - circular overlays */
.sdawsoga-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    opacity: 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sdawsoga-media-container:hover .sdawsoga-nav-btn {
    opacity: 1;
}

.sdawsoga-nav-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.sdawsoga-scope .sdawsoga-nav-btn svg {
    width: 20px;
    height: 20px;
    fill: #262626;
}

.sdawsoga-nav-left {
    left: 16px;
}

.sdawsoga-nav-right {
    right: 16px;
}

/* ===== POST NAVIGATION ARROWS (backdrop, desktop only) ===== */
/* These arrows sit in the dark backdrop OUTSIDE .sdawsoga-modal-content.
   They always jump to the next/previous POST (not carousel slide).
   Hidden on mobile where .sdawsoga-post-nav-mobile serves the same purpose. */

.sdawsoga-post-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    opacity: 0.5;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    color: rgba(255, 255, 255, 0.85);
    padding: 0;
}

.sdawsoga-post-arrow:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
}

.sdawsoga-post-arrow:active {
    transform: translateY(-50%) scale(0.92);
}

.sdawsoga-scope .sdawsoga-post-arrow svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.sdawsoga-post-arrow-prev {
    left: 16px;
}

.sdawsoga-post-arrow-next {
    right: 16px;
}

/* Ensure arrows don't overlap content box on medium screens */
@media (max-width: 1680px) {
    .sdawsoga-post-arrow-prev {
        left: 10px;
    }
    .sdawsoga-post-arrow-next {
        right: 10px;
    }
}

/* Hide desktop post arrows on tablet/mobile (mobile post-nav takes over) */
@media (max-width: 1024px) {
    .sdawsoga-post-arrow {
        display: none;
    }
}

/* Right side - Caption panel */
.sdawsoga-caption-panel {
    width: 450px;
    max-width: 35%;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Adjust caption panel for different screen sizes */
@media (max-width: 1440px) {
    .sdawsoga-caption-panel {
        width: 400px;
        max-width: 38%;
    }
}

@media (max-width: 1280px) {
    .sdawsoga-caption-panel {
        width: 380px;
        max-width: 40%;
    }
}

.sdawsoga-lb-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #efefef;
    gap: 12px;
    flex-shrink: 0;
}

.sdawsoga-lb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #dbdbdb;
    flex-shrink: 0;
}

.sdawsoga-lb-user {
    font-weight: 600;
    font-size: 14px;
    color: #262626;
    flex: 1;
}

.sdawsoga-caption-box {
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    color: #262626;
}

.sdawsoga-caption-box::-webkit-scrollbar {
    width: 6px;
}

.sdawsoga-caption-box::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sdawsoga-caption-box::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.sdawsoga-caption-username {
    font-weight: 600;
    margin-right: 6px;
}

/* Hashtag and mention links in lightbox caption */
.sdawsoga-caption-box .sdawsoga-hashtag,
.sdawsoga-caption-box .sdawsoga-mention {
    color: #00376b;
    text-decoration: none;
}

.sdawsoga-caption-box .sdawsoga-hashtag:hover,
.sdawsoga-caption-box .sdawsoga-mention:hover {
    text-decoration: underline;
}

/* ===== LIGHTBOX ENGAGEMENT BAR ===== */
.sdawsoga-scope .sdawsoga-lb-engagement {
    padding: 12px 16px;
    border-top: 1px solid #efefef;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    flex-shrink: 0;
}

.sdawsoga-scope .sdawsoga-lb-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.sdawsoga-scope .sdawsoga-lb-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #262626;
}

.sdawsoga-scope .sdawsoga-lb-stat svg {
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
    fill: #262626;
    flex-shrink: 0;
    display: block;
}

.sdawsoga-scope .sdawsoga-lb-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 12px;
    font-size: 12px;
    color: #8e8e8e;
}

.sdawsoga-lb-media-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f3f4f6;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
    color: #6b7280;
    font-size: 11px;
    line-height: 1;
}

.sdawsoga-scope .sdawsoga-lb-media-type svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.sdawsoga-lb-date {
    color: #8e8e8e;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Desktop: date on own line below likes/comments */
@media (min-width: 1025px) {
    .sdawsoga-lb-actions {
        flex-wrap: wrap;
    }
    .sdawsoga-lb-date {
        width: 100%;
        text-align: center;
        margin-top: 2px;
    }
}

.sdawsoga-modal-footer {
    padding: 16px;
    border-top: 1px solid #efefef;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.sdawsoga-slide-counter {
    font-size: 13px;
    color: #8e8e8e;
    text-align: center;
}

.sdawsoga-modal-links {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.sdawsoga-modal-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #0095f6;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.sdawsoga-modal-link:hover {
    opacity: 0.7;
}

.sdawsoga-scope .sdawsoga-modal-link svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ===== DOTS ===== */
[data-role="dots-container"] {
    position: absolute;
    bottom: 15px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 21;
}

.sdawsoga-prikk {
    width: 7px;
    height: 7px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sdawsoga-prikk.aktiv {
    background: #fff;
    transform: scale(1.2);
}

/* ===== MOBILE POST NAVIGATION ===== */
.sdawsoga-post-nav-mobile {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 16px;
    z-index: 22;
    background: rgba(0, 0, 0, 0.75);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
}

.sdawsoga-post-nav-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sdawsoga-post-nav-btn:active {
    transform: scale(0.9);
}

.sdawsoga-scope .sdawsoga-post-nav-btn svg {
    width: 18px;
    height: 18px;
    fill: #262626;
}

.sdawsoga-post-counter {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

/* Show mobile post nav on mobile/tablet */
@media (max-width: 1024px) {
    .sdawsoga-post-nav-mobile {
        display: flex;
        /* Pin to the dark backdrop below the modal-content, NOT inside the
           media-container where it would overlap the image. modal-content is
           max-height: 95vh on mobile, leaving ~2.5vh at the bottom — the pill
           sits in that gap on the modal's black background.
           max(16px, env(safe-area-inset-bottom)) keeps it clear of the iOS
           home indicator on devices that report a safe area. (5.3.4) */
        position: fixed;
        top: auto;
        bottom: max(16px, env(safe-area-inset-bottom));
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000001;
    }

    /* Hide desktop navigation arrows on mobile */
    .sdawsoga-nav-btn {
        display: none;
    }
}

/* ===== CLOSE BUTTON ===== */
.sdawsoga-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    font-size: 32px;
    cursor: pointer;
    z-index: 30;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    backdrop-filter: blur(4px);
}

.sdawsoga-close-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.sdawsoga-scope .sdawsoga-close-btn svg {
    width: 20px;
    height: 20px;
}

/* ===== RESPONSIVE ===== */

/* iPad and tablet-specific fixes */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Fix modal width for iPad - not too wide */
    .sdawsoga-modal-content {
        max-width: 85vw;
        width: 800px;
        height: 85vh;
    }
    
    /* Better proportions for tablet landscape */
    .sdawsoga-media-container {
        flex: 1.2; /* Slightly more space for image */
    }
    
    .sdawsoga-caption-panel {
        flex: 0.8;
        max-width: 350px;
    }
}

/* iPad Pro and larger tablets */
@media (min-width: 1024px) and (max-width: 1366px) {
    .sdawsoga-modal-content {
        max-width: 90vw;
        width: 1000px;
    }
}

/* Older iPads (768px portrait) - critical fix */
@media (min-width: 768px) and (max-width: 820px) {
    .sdawsoga-modal-content {
        max-width: 80vw;
        width: 700px;
        height: 80vh;
    }
    
    .sdawsoga-caption-panel {
        max-width: 300px;
        font-size: 14px;
    }
    
    .sdawsoga-nav-btn {
        width: 38px;
        height: 38px;
    }
}

/* Standard responsive breakpoint */
@media (max-width: 1024px) {
    .sdawsoga-modal-content {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
    }

    .sdawsoga-caption-panel {
        width: 100%;
        max-width: 100%;
        max-height: none;
        flex-shrink: 0;
    }
    
    /* Compact header on mobile */
    .sdawsoga-lb-header {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .sdawsoga-lb-avatar {
        width: 26px;
        height: 26px;
    }
    
    .sdawsoga-lb-user {
        font-size: 13px;
    }
    
    /* Caption: scrollable with fade hint when overflowing */
    .sdawsoga-caption-box {
        flex: 0 1 auto;
        max-height: 120px;
        overflow-y: auto;
        padding: 8px 12px;
        font-size: 13px;
        line-height: 1.5;
        position: relative;
    }
    
    /* Image area: flexible but capped so caption always has room */
    .sdawsoga-media-container {
        min-height: 200px;
        max-height: 65vh;
        flex: 1 1 auto;
    }
    
    /* Engagement: single compact row — ❤ 21 💬 0 Karusell·5 · 18 TIMER SIDEN */
    .sdawsoga-scope .sdawsoga-lb-engagement {
        padding: 6px 12px;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        border-top: 1px solid #efefef;
    }
    
    .sdawsoga-scope .sdawsoga-lb-actions {
        gap: 10px;
        flex-wrap: nowrap !important;
    }
    
    .sdawsoga-scope .sdawsoga-lb-stat {
        font-size: 13px;
    }
    
    .sdawsoga-scope .sdawsoga-lb-stat svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    .sdawsoga-scope .sdawsoga-lb-date {
        font-size: 10px !important;
        width: auto !important;
        text-align: left !important;
        margin-top: 0 !important;
        margin-left: 6px;
    }
    
    /* Hide footer entirely on mobile — Instagram link not needed */
    .sdawsoga-modal-footer {
        display: none !important;
    }
}

/* ===== LANDSCAPE PHONE OPTIMIZATIONS ===== */
/* Phones in landscape (short height, wider width) */
@media (max-width: 926px) and (max-height: 430px) and (orientation: landscape) {
    /* Keep modal horizontal for landscape phones */
    .sdawsoga-modal-content {
        flex-direction: row !important;
        height: 90vh;
        max-height: 90vh;
        max-width: 95vw;
    }
    
    /* Image takes most space */
    .sdawsoga-media-container {
        flex: 1;
        min-height: auto;
        height: 100%;
        max-height: 90vh;
    }
    
    /* Compact caption panel on the side */
    .sdawsoga-caption-panel {
        width: 280px;
        max-width: 280px;
        min-width: 280px;
        max-height: 100%;
        overflow-y: auto;
    }
    
    /* Ensure images fit properly */
    [data-role="slider-wrap"] {
        height: 100%;
        width: 100%;
    }
    
    [data-role="slider-wrap"] img,
    [data-role="slider-wrap"] video {
        max-height: 85vh;
        max-width: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
    }
    
    /* Hide carousel slide arrows in landscape — swipe handles slide navigation,
       and the arrows overlap the photo when vertical room is scarce. Dots and
       post-nav pill still convey position. (5.3.5) */
    .sdawsoga-nav-btn {
        display: none;
    }

    /* Compact post-nav pill so it consumes less vertical room over the photo */
    .sdawsoga-post-nav-mobile {
        padding: 4px 10px;
        gap: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));
    }

    .sdawsoga-post-nav-btn {
        width: 28px;
        height: 28px;
    }

    .sdawsoga-scope .sdawsoga-post-nav-btn svg {
        width: 14px;
        height: 14px;
    }

    .sdawsoga-post-counter {
        font-size: 11px;
        min-width: 50px;
    }

    /* Close button positioning */
    .sdawsoga-close-btn {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
    }

    .sdawsoga-scope .sdawsoga-close-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Compact caption content */
    .sdawsoga-caption-header {
        padding: 12px 15px;
    }
    
    .sdawsoga-caption-content {
        padding: 12px 15px;
        font-size: 13px;
        line-height: 1.4;
    }
    
    /* Compact engagement for landscape */
    .sdawsoga-lb-engagement {
        padding: 8px 12px;
    }
    
    .sdawsoga-lb-media-type {
        display: none;
    }
    
    .sdawsoga-caption-footer {
        padding: 10px 15px;
        font-size: 12px;
    }
}

/* Very small landscape phones (iPhone SE, etc) */
@media (max-width: 667px) and (max-height: 375px) and (orientation: landscape) {
    .sdawsoga-modal-content {
        max-width: 98vw;
        height: 95vh;
    }
    
    .sdawsoga-caption-panel {
        width: 240px;
        max-width: 240px;
        min-width: 240px;
        font-size: 12px;
    }
    
    .sdawsoga-caption-header {
        padding: 10px 12px;
    }
    
    .sdawsoga-caption-content {
        padding: 10px 12px;
        font-size: 12px;
    }
    
}

/* Alternative: Hide caption in landscape if too cramped */
@media (max-width: 568px) and (max-height: 320px) and (orientation: landscape) {
    /* Ultra-compact landscape (very old phones) */
    .sdawsoga-modal-content {
        flex-direction: row !important;
    }
    
    .sdawsoga-caption-panel {
        width: 200px;
        max-width: 200px;
        min-width: 200px;
    }
    
    /* Or optionally hide caption completely */
    /* .sdawsoga-caption-panel {
        display: none;
    } */
}


@media (max-width: 768px) {
    .sdawsoga-grid {
        gap: var(--sdawsoga-gap, 15px);
    }
    
    .sdawsoga-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
        padding: 30px 15px;
    }
    
    .sdawsoga-user-bar {
        flex-direction: column;
        gap: 12px;
    }
    
    .sdawsoga-stat-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
        row-gap: 15px;
    }
    
    .sdawsoga-stat-bar .sdawsoga-follow-btn {
        margin-left: 0;
        flex: 0 0 auto;
        order: 99;
        justify-content: center;
        display: inline-flex;
        white-space: nowrap;
        padding: 6px 16px;
        font-size: 13px;
        font-weight: 600;
        border-radius: 8px;
        box-shadow: none;
        gap: 6px;
    }
    
    .sdawsoga-stat-bar .sdawsoga-follow-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .sdawsoga-modal-content {
        max-width: 100%;
        margin: 0;
    }

    .sdawsoga-nav-btn {
        width: 36px;
        height: 36px;
    }

    .sdawsoga-scope .sdawsoga-nav-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Landscape phone grid optimization */
@media (max-width: 926px) and (max-height: 430px) and (orientation: landscape) {
    /* More columns in landscape for better browsing */
    .sdawsoga-grid {
        gap: var(--sdawsoga-gap, 12px);
    }
    
    /* Compact header for landscape */
    .sdawsoga-header {
        flex-direction: row;
        padding: 20px 15px;
        gap: 30px;
    }
    
    .sdawsoga-avatar-ring {
        width: 80px;
        height: 80px;
    }
    
    .sdawsoga-user-bar {
        flex-direction: row;
        gap: 20px;
        align-items: center;
    }
    
    .sdawsoga-stat-bar {
        gap: 20px;
        font-size: 14px;
    }
}

/* Small landscape phones */
@media (max-width: 667px) and (max-height: 375px) and (orientation: landscape) {
    .sdawsoga-grid {
        gap: var(--sdawsoga-gap, 10px);
    }
    
    .sdawsoga-header {
        padding: 15px 10px;
        gap: 20px;
    }
    
    .sdawsoga-avatar-ring {
        width: 60px;
        height: 60px;
    }
}


@media (max-width: 480px) {
    .sdawsoga-grid {
        gap: var(--sdawsoga-gap, 12px);
    }
    
    .sdawsoga-avatar-ring {
        width: 120px;
        height: 120px;
    }
    
    .sdawsoga-user-bar h2 {
        font-size: 24px;
    }
    
    .sdawsoga-nav-btn {
        width: 32px;
        height: 32px;
    }

    .sdawsoga-nav-left {
        left: 8px;
    }

    .sdawsoga-nav-right {
        right: 8px;
    }
}

/* ===== SWIPE HINT ===== */
.sdawsoga-swipe-hint {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000000;
    backdrop-filter: blur(10px);
}

.sdawsoga-swipe-hint.show {
    opacity: 1;
}

.sdawsoga-scope .sdawsoga-swipe-hint svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* ===== ACCESSIBILITY ===== */

/* Visually-hidden helper for screen-reader-only text (e.g. lightbox keyboard hint).
   Defined locally so the plugin does not depend on a theme providing
   .screen-reader-text. (5.2.3) */
.sdawsoga-sr-only {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* Focus-visible outlines for keyboard users — expanded coverage in 5.2.3
   to include post arrows, dot navigators, story viewer controls, and
   load-more wrap. */
.sdawsoga-item:focus-visible,
.sdawsoga-red-btn:focus-visible,
.sdawsoga-follow-btn:focus-visible,
.sdawsoga-close-btn:focus-visible,
.sdawsoga-nav-btn:focus-visible,
.sdawsoga-post-arrow:focus-visible,
.sdawsoga-dot:focus-visible,
.sdawsoga-story-trigger:focus-visible,
.sdawsoga-story-close:focus-visible,
.sdawsoga-story-prev:focus-visible,
.sdawsoga-story-next:focus-visible {
    outline: 3px solid #0095f6;
    outline-offset: 3px;
}

/* Respect reduced motion preferences — broadened in 5.2.3 to cover all
   plugin elements via the 0.01ms pattern (preserves animationend events). */
@media (prefers-reduced-motion: reduce) {
    .sdawsoga-scope,
    .sdawsoga-scope *,
    .sdawsoga-modal,
    .sdawsoga-modal *,
    .sdawsoga-stories-viewer,
    .sdawsoga-stories-viewer * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== LOADING SKELETON (Enhancement #3) ===== */
.sdawsoga-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(var(--sdawsoga-columns, 3), 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.sdawsoga-skeleton-item {
    position: relative;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.sdawsoga-skeleton-item::before {
    content: '';
    display: block;
    padding-top: 100%; /* 1:1 aspect ratio */
}

.sdawsoga-skeleton-img {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 50%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: sdawsoga-skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes sdawsoga-skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive skeleton */
@media (max-width: 768px) {
    .sdawsoga-skeleton-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .sdawsoga-skeleton-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ===== IMAGE OPTIMIZATION (Enhancement #5) ===== */
.sdawsoga-item img[loading="lazy"] {
    background: #f0f0f0;
}

/* ===== CAROUSEL AUTO-ADVANCE INDICATOR (Enhancement #10) ===== */
.sdawsoga-carousel-progress {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    z-index: 5;
}

.sdawsoga-carousel-progress-bar {
    height: 100%;
    background: #fff;
    width: 0;
    transition: width linear;
}

/* ===== CUSTOM GRID LAYOUTS - Fjernet duplikater, se linje 262 ===== */

/* ===== VIDEO HOVER PREVIEW ===== */
.sdawsoga-hover-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Video badge styling */
.sdawsoga-video-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    z-index: 3;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 4px;
}

.sdawsoga-scope .sdawsoga-video-badge svg {
    width: 12px;
    height: 12px;
    fill: #fff;
}

/* ===== NOTICE/ERROR MESSAGES (Enhancement #7) ===== */
.sdawsoga-notice {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 6px;
    border-left: 4px solid;
}

.sdawsoga-notice p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.sdawsoga-notice-error {
    background: #fef2f2;
    border-left-color: #dc2626;
    color: #7f1d1d;
}

.sdawsoga-notice-warning {
    background: #fffbeb;
    border-left-color: #f59e0b;
    color: #78350f;
}

.sdawsoga-notice-success {
    background: #f0fdf4;
    border-left-color: #10b981;
    color: #14532d;
}

.sdawsoga-notice-info {
    background: #eff6ff;
    border-left-color: #3b82f6;
    color: #1e3a8a;
}

/* ===== INSTAGRAM STORIES ===== */

/* Story ring gradient on avatar */
.sdawsoga-avatar-ring {
    all: unset;
    display: block;
    cursor: default;
}

.sdawsoga-avatar-ring.sdawsoga-has-stories {
    cursor: pointer;
    position: relative;
    padding: 3px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    transition: transform 0.2s ease;
    /* Subtle expanding glow so visitors notice there are Stories to watch.
       Box-shadow only (no transform) so it never conflicts with the hover
       scale below. Disabled under prefers-reduced-motion by the blanket rule. */
    animation: sdawsoga-story-pulse 2.4s ease-out infinite;
}

.sdawsoga-avatar-ring.sdawsoga-has-stories:hover {
    transform: scale(1.05);
}

@keyframes sdawsoga-story-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(220, 39, 67, 0.5); }
    70%  { box-shadow: 0 0 0 7px rgba(220, 39, 67, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 39, 67, 0); }
}

.sdawsoga-avatar-ring.sdawsoga-has-stories img {
    border: 3px solid #fff;
    border-radius: 50%;
}

/* Story Viewer - Fullscreen Overlay */
.sdawsoga-story-viewer {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Progress bars */
.sdawsoga-story-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    z-index: 3;
}

.sdawsoga-story-progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 2px;
    overflow: hidden;
}

.sdawsoga-story-progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 0;
    transition: width linear;
}

.sdawsoga-story-progress-bar.sdawsoga-viewed .sdawsoga-story-progress-fill {
    width: 100%;
}

.sdawsoga-story-progress-bar.sdawsoga-active .sdawsoga-story-progress-fill {
    width: 0;
}

/* Story header (user info + close) */
.sdawsoga-story-header {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    z-index: 3;
}

.sdawsoga-story-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sdawsoga-story-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.sdawsoga-story-user-name {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.sdawsoga-story-user-time {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.sdawsoga-story-close {
    all: unset;
    cursor: pointer;
    color: #fff;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sdawsoga-story-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Story media container */
.sdawsoga-story-media {
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.sdawsoga-story-media img,
.sdawsoga-story-media video {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
    border-radius: 12px;
}

/* Tap zones (left = prev, right = next) */
.sdawsoga-story-nav {
    position: absolute;
    inset: 0;
    display: flex;
    z-index: 2;
}

.sdawsoga-story-nav-prev,
.sdawsoga-story-nav-next {
    all: unset;
    flex: 1;
    cursor: pointer;
}

.sdawsoga-story-nav-prev {
    cursor: w-resize;
}

.sdawsoga-story-nav-next {
    cursor: e-resize;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .sdawsoga-story-media {
        max-width: 100%;
        border-radius: 0;
    }

    .sdawsoga-story-media img,
    .sdawsoga-story-media video {
        border-radius: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sdawsoga-story-progress-fill {
        transition: none;
    }

    .sdawsoga-avatar-ring.sdawsoga-has-stories:hover {
        transform: none;
    }
}

