/**
 * RadyoYol — site-wide responsive fixes
 * Load after page styles; does not change color/theme tokens.
 */

/* ── Global: prevent horizontal scroll & media overflow ── */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    overflow-x: clip;
    max-width: 100%;
}

.main-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
}

img,
video,
picture {
    max-width: 100%;
}

svg {
    max-width: 100%;
    height: auto;
}

iframe {
    max-width: 100%;
    border: 0;
}

/* Responsive embed / video containers */
.video-detail__player,
.video-detail__player iframe,
.video-detail__player video,
.video-gallery-card__inline-player,
.video-gallery-card__inline-player iframe,
.video-gallery-card__inline-player video,
.video-modal__player,
.video-modal__player iframe,
.video-modal__player video {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Video / foto galeri — tek slayt, kutu içinde taşma yok */
.video-gallery-swiper-wrap,
.video-gallery-swiper,
.photo-gallery-announcement-slider,
.listener-swiper-wrap,
.listener-swiper {
    overflow: hidden;
}

.video-gallery-swiper .swiper-slide {
    width: 100% !important;
    max-width: 100%;
    flex-shrink: 0;
    box-sizing: border-box;
}

.home-news-slider-wrap .home-news-slide__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

/* Card / slider images — cover, centered */
.home-news-slide__img,
.home-news-sidebar__thumb img,
.news-page__img,
.news-detail__image,
.videos-card__cover img,
.gallery-album-card__cover,
.gallery-photo-card img,
.programci-card__img,
.sponsor-card__img,
.video-gallery-card__cover img,
.photo-gallery-announcement-card img,
.photo-gallery-announcement-card__image-btn img,
.listener-slide__media img,
.sponsors-swiper img,
.sm-feed-swiper img,
.sponsor-card__logo img {
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}

/* ── max-width: 1200px (small laptop / large tablet landscape) ── */
@media (max-width: 1200px) {
    .home-layout {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .news-page {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .videos-page,
    .gallery-page,
    .video-detail {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ── max-width: 992px (tablet / home sidebar stack) ── */
@media (max-width: 992px) {
    .home-main {
        grid-template-columns: 1fr;
    }

    .home-media-duo {
        grid-template-columns: 1fr;
    }

    .home-news-layout {
        --home-news-card-h: 460px;
    }

    .home-news-layout {
        display: flex;
        flex-direction: column;
        gap: 14px;
        grid-template-columns: 1fr;
    }

    /* Media duo boxes — tablet/mobil: sabit panel yüksekliği */
    .home-media-stack .home-media-duo .video-gallery-widget,
    .home-media-stack .home-media-duo .photo-gallery-announcement-widget {
        height: var(--home-media-panel-h, 360px);
        min-height: var(--home-media-panel-h, 360px);
        max-height: none;
        flex: 0 0 auto;
    }

    .home-media-stack .home-media-duo .photo-gallery-announcement-section {
        height: auto;
        min-height: 0;
    }

    .home-media-stack .home-media-duo .photo-gallery-announcement-slider {
        height: 100%;
        min-height: calc(var(--home-media-panel-h, 360px) - 20px);
        max-height: none;
    }

    .news-page__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ── max-width: 992px — ana sayfa widget görünürlüğü ── */
@media (max-width: 992px) {
    .page-home .home-main > .schedule-card,
    .page-home .home-main > .live-dj-card,
    .page-home .home-main > .ticker-wrap,
    .page-home .home-main > .listener-widget {
        display: block;
        visibility: visible;
        opacity: 1;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .page-home .schedule-top-bar__title,
    .page-home .live-banner {
        display: flex;
        visibility: visible;
    }

    .page-home .live-meta,
    .page-home .live-meta .live-track,
    .page-home .live-meta .live-listeners {
        display: block;
        visibility: visible;
        opacity: 1;
    }
}

/* ── max-width: 768px (tablet portrait / large phone) ── */
@media (max-width: 768px) {
    /* Ana slider — aspect ratio instead of fixed tall box */
    .home-slider-wrap {
        min-height: 0;
        aspect-ratio: 16 / 9;
        height: auto;
    }

    .home-slider {
        min-height: 0;
        height: 100%;
        position: absolute;
        inset: 0;
    }

    .home-slider-wrap {
        position: relative;
    }

    .home-slider__slide {
        background-size: cover;
        background-position: center center;
        background-repeat: no-repeat;
    }

    .home-slider__content {
        max-width: 92%;
        padding: 1rem 1.1rem;
    }

    .home-slider__title {
        font-size: clamp(1.1rem, 4.5vw, 1.5rem);
        line-height: 1.25;
    }

    .home-slider__subtitle {
        font-size: clamp(0.82rem, 3.2vw, 0.95rem);
        -webkit-line-clamp: 3;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .home-slider__nav {
        padding: 0.5rem 0.75rem 0.65rem;
        flex-wrap: wrap;
        gap: 6px;
    }

    .home-slider__dot {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    /* Haber slider nav — mobilde tek satır kaydırma, alt fade/nav hizası bozulmasın */
    .home-news-slider__nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0.55rem 0.75rem;
    }

    .home-news-slider__nav::-webkit-scrollbar {
        display: none;
    }

    .home-news-slider__dot {
        flex-shrink: 0;
        width: 30px;
        height: 30px;
        font-size: 0.78rem;
    }

    /* Canlı yayın + yayın akışı kartları */
    .live-dj-card,
    .schedule-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: visible;
        -webkit-transform: translateZ(0);
    }

    .schedule-list-wrap {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    .schedule-loading {
        display: block;
        padding: 1rem 0;
        text-align: center;
        color: rgba(255, 255, 255, 0.75);
        font-size: 0.9rem;
    }

    .live-dj-card,
    .live-dj-card img,
    .live-dj-photo-wrap img {
        max-width: 100%;
    }

    .live-dj-photo-wrap img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center top;
    }

    /* Galeri / video swiper controls — sadece nokta pagination */
    .video-gallery-swiper-pagination,
    .photo-gallery-slider-pagination {
        max-width: 100%;
    }

    /* Sabit player + footer — tek satır yatay (eski düzen) */
    .bottom-bar-player {
        bottom: var(--ry-legal-footer-h, 56px);
        height: 120px;
        min-height: 120px;
        max-height: 120px;
        padding: 0 1rem;
        box-sizing: border-box;
        overflow: visible;
        z-index: 1999;
    }

    .bottom-bar-player-inner {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        min-width: 0;
        width: 100%;
        height: 100%;
    }

    .player-logo-wrap {
        flex-shrink: 0;
    }

    .bottom-bar-logo {
        height: 90px;
        width: auto;
        max-width: none;
        object-fit: contain;
    }

    .player-volume-group {
        flex-shrink: 0;
        margin-left: 0;
    }

    .player-status-group {
        margin-left: 0;
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }

    .player-live-meta {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        min-width: 0;
        width: 100%;
    }

    .player-track,
    .player-listeners {
        display: block;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body {
        padding-bottom: calc(var(--ry-bottom-chrome-h, 176px) + env(safe-area-inset-bottom, 0px) + 16px) !important;
    }

    .legal-footer {
        bottom: 0;
        padding: 0 0.75rem;
        z-index: 1998;
    }

    .site-footer-bar {
        min-height: 48px;
        gap: 10px;
    }

    /* Haber detay görseli — tam görünsün */
    .news-detail__image {
        max-height: none;
        height: auto;
        object-fit: contain;
        background: var(--ry-schedule-bg, #1e2430);
    }

    .news-detail__image-wrap {
        line-height: 0;
    }

    /* Video sayfası */
    .videos-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    }

    .videos-page__title {
        font-size: clamp(1.25rem, 5vw, 1.7rem);
    }
}

/* ── max-width: 576px (phone) ── */
@media (max-width: 576px) {
    .home-layout {
        padding: 0.85rem 0.75rem;
    }

    .home-news-layout {
        --home-news-card-h: 380px;
    }

    .home-news-slide__title {
        font-size: 1.25rem;
    }

    .home-news-slide__media::after {
        height: clamp(105px, 58%, 190px);
    }

    .home-news-slide__body {
        padding: 0.75rem 0.85rem 0.9rem;
    }

    .news-page {
        padding: 1.25rem 0.85rem;
    }

    .news-page__grid {
        grid-template-columns: 1fr;
    }

    .home-media-stack .home-media-duo .video-gallery-widget,
    .home-media-stack .home-media-duo .photo-gallery-announcement-widget {
        height: var(--home-media-panel-h, 320px);
        min-height: var(--home-media-panel-h, 320px);
    }

    .home-media-stack .home-media-duo .photo-gallery-announcement-slider {
        min-height: calc(var(--home-media-panel-h, 320px) - 20px);
        height: 100%;
    }

    .home-media-duo {
        --home-media-panel-h: 320px;
        --home-media-panel-text-h: 68px;
    }

    .video-gallery-card {
        height: 100%;
        min-height: 280px;
    }

    .photo-gallery-announcement-card {
        min-height: 0;
    }

    .home-actions {
        gap: 0.65rem;
    }

    .btn-live,
    .btn-request,
    .btn-whatsapp-istek {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .home-icon-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .player-volume-wrap input[type="range"] {
        width: 56px;
        min-width: 48px;
    }

    .navbar {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .gallery-albums-grid {
        grid-template-columns: 1fr;
    }
}

/* ── max-width: 400px (small phone / iPhone SE) ── */
@media (max-width: 400px) {
    .navbar {
        height: 72px;
        min-height: 72px;
    }

    .navbar.is-scrolled {
        height: 64px;
        min-height: 64px;
    }

    .home-slider-wrap {
        aspect-ratio: 4 / 3;
    }

    .home-slider__content {
        max-width: 96%;
        padding: 0.75rem;
    }

    .home-slider__title {
        font-size: 1rem;
    }

    .schedule-day {
        font-size: 0.65rem;
        padding: 3px 6px;
    }

    .disc-overlay {
        width: 36px;
        height: 36px;
    }

    .bottom-bar-logo {
        height: 72px;
    }

    .player-volume-wrap input[type="range"] {
        width: 44px;
        min-width: 44px;
    }

    .player-status-group {
        font-size: 0.68rem;
    }

    .player-track {
        font-size: 10px;
    }

    .player-listeners {
        font-size: 10px;
    }

    .schedule-top-bar__title {
        font-size: 0.82rem;
    }

    .schedule-day {
        font-size: 0.62rem;
        padding: 3px 5px;
        min-height: 24px;
    }

    .home-news-sidebar__link {
        grid-template-columns: 60px minmax(0, 1fr);
    }

    .home-news-sidebar__thumb {
        width: 60px;
        height: 45px;
    }

    .video-gallery-section__title-row,
    .photo-gallery-announcement-section__title-row {
        flex-wrap: wrap;
        white-space: normal;
    }
}

/* Toast / lightbox above fixed player */
.news-share-toast,
.gallery-share-toast {
    bottom: calc(var(--ry-bottom-chrome-h, 188px) + 12px);
}

@media (max-width: 768px) {
    .photo-gallery-lightbox__dialog,
    .gallery-lightbox__panel {
        width: 100%;
        max-width: calc(100vw - 1rem);
        margin-left: auto;
        margin-right: auto;
    }

    .photo-gallery-lightbox__image,
    .gallery-lightbox__img {
        max-height: min(62vh, calc(100dvh - 220px));
        width: auto;
        max-width: 100%;
        object-fit: contain;
    }

    .gallery-lightbox__close,
    .gallery-lightbox__nav {
        min-width: 44px;
        min-height: 44px;
    }

    /* Reklam sayfası — mobil okunabilirlik */
    .reklam-page {
        overflow-x: clip;
    }

    .reklam-packages {
        grid-template-columns: 1fr;
    }

    .reklam-card__cta {
        min-height: 48px;
    }

    /* Video galeri — dokunmatik hedefler */
    .video-gallery-card__play,
    .videos-card__play {
        width: 56px;
        height: 56px;
        min-width: 48px;
        min-height: 48px;
    }

    .video-gallery-card__title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .videos-grid {
        grid-template-columns: 1fr;
    }

    /* Ana sayfa — player ikonları ve store badge dokunmatik alanı */
    .home-icon-buttons .icon-link {
        min-width: 48px;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .home-badges .badge-link-item {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .home-badges .store-badge {
        height: auto;
        max-height: 40px;
        width: auto;
        max-width: min(135px, 42vw);
    }
}

@media (max-width: 480px) {
    .gallery-lightbox__nav {
        top: auto;
        bottom: max(14px, env(safe-area-inset-bottom, 0px));
        transform: none;
    }

    .gallery-lightbox__nav--prev {
        left: max(8%, env(safe-area-inset-left, 0px));
    }

    .gallery-lightbox__nav--next {
        right: max(8%, env(safe-area-inset-right, 0px));
    }

    .gallery-lightbox__panel {
        padding-bottom: 5rem;
    }
}

/* Mobile navigation test hooks + narrow viewport layout (768px and below) */
@media (max-width: 768px) {
    html,
    body {
        overflow-x: clip;
        max-width: 100%;
    }

    .home-layout,
    .home-main,
    .main-content {
        overflow-x: clip;
        max-width: 100%;
    }

    .bottom-bar-player,
    .legal-footer {
        max-width: 100vw;
        left: 0;
        right: 0;
    }

    #mobile-menu-toggle {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        min-width: 44px !important;
        min-height: 44px !important;
        clip: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        display: flex !important;
    }

    #mobile-menu {
        visibility: visible !important;
        opacity: 1 !important;
    }

    .navbar .nav-center {
        position: fixed;
        transform: translateX(100%);
    }

    .navbar .nav-center.is-open {
        transform: translateX(0);
        pointer-events: auto;
    }
}
