/* ============================================================
   Apple News Hub - Slider CSS
   ============================================================ */

/* ---- SLIDER ---- */
.anh-slider {
    position: relative;
    width: 100%;
    height: var(--slider-height, 580px);
    overflow: hidden;
    background: #000;
    user-select: none;
}

/* Track */
.anh-slider__track {
    display: flex;
    height: 100%;
    will-change: transform;
}

/* Individual Slide */
.anh-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.anh-slide.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

/* Transition: Slide */
[data-transition="slide"] .anh-slide {
    transform: translateX(100%);
    opacity: 1;
    transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-transition="slide"] .anh-slide.active {
    transform: translateX(0);
    z-index: 3;
}

[data-transition="slide"] .anh-slide.prev {
    transform: translateX(-100%);
    z-index: 2;
}

/* Transition: Zoom */
[data-transition="zoom"] .anh-slide {
    opacity: 0;
    transform: scale(1.08);
    transition: opacity 0.7s ease, transform 0.9s ease;
}

[data-transition="zoom"] .anh-slide.active {
    opacity: 1;
    transform: scale(1);
}

/* Background */
.anh-slide__bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.anh-slide__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.02);
    transition: transform 6s ease;
}

.anh-slide.active .anh-slide__img {
    transform: scale(1);
}

.anh-slide__gradient-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0051a2 0%, #1a1a2e 40%, #0d0d0d 100%);
}

/* Multiple gradient BGs for variety */
.anh-slide:nth-child(2) .anh-slide__gradient-bg {
    background: linear-gradient(135deg, #1c1c1e 0%, #2d1b69 40%, #11003d 100%);
}

.anh-slide:nth-child(3) .anh-slide__gradient-bg {
    background: linear-gradient(135deg, #003d2d 0%, #006644 40%, #1a3a1a 100%);
}

.anh-slide:nth-child(4) .anh-slide__gradient-bg {
    background: linear-gradient(135deg, #3d0020 0%, #660033 40%, #1a0010 100%);
}

/* Overlay */
.anh-slide__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        rgba(0, 0, 0, 0.15) 100%
    );
}

/* Content */
.anh-slide__content {
    position: relative;
    z-index: 10;
    width: 100%;
    padding-bottom: 64px;
}

.anh-slide__inner {
    max-width: 680px;
}

/* Badges */
.anh-slide__badges {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;

    /* Animate in */
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}

.anh-slide.active .anh-slide__badges {
    opacity: 1;
    transform: translateY(0);
}

.anh-slide__category {
    display: inline-flex;
    align-items: center;
    padding: 5px 13px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #ffffff !important;
    background: rgba(0,0,0,0.6) !important;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.anh-slide__badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #ffffff !important;
    background: rgba(220, 38, 38, 0.85) !important;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.anh-slide__badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #ff3b30;
    border-radius: 50%;
    animation: pulse-dot 1.5s ease infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}

/* Title */
.anh-slide__title {
    font-size: clamp(1.75rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: white;
    margin-bottom: 16px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.3);

    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.55s ease 0.35s, transform 0.55s ease 0.35s;
}

.anh-slide.active .anh-slide__title {
    opacity: 1;
    transform: translateY(0);
}

/* Subtitle */
.anh-slide__subtitle {
    font-size: clamp(0.9375rem, 1.5vw, 1.125rem);
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.6;
    margin-bottom: 28px;
    max-width: 560px;

    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.55s ease 0.48s, transform 0.55s ease 0.48s;
}

.anh-slide.active .anh-slide__subtitle {
    opacity: 1;
    transform: translateY(0);
}

/* CTA Button */
.anh-slide__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 26px;
    background: white;
    color: #1d1d1f;
    font-size: 15px;
    font-weight: 700;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.2s;
    letter-spacing: -0.01em;

    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s ease 0.58s, transform 0.5s ease 0.58s, background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.anh-slide.active .anh-slide__btn {
    opacity: 1;
    transform: translateY(0);
}

.anh-slide__btn:hover {
    background: var(--color-accent, #0071e3);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Navigation Arrows */
.anh-slider__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
}

.anh-slider:hover .anh-slider__arrow { opacity: 1; }
.anh-slider__arrow:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-50%) scale(1.08); }

.anh-slider__arrow--prev { left: 20px; }
.anh-slider__arrow--next { right: 20px; }

/* Dots */
.anh-slider__dots {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    gap: 8px;
    align-items: center;
}

.anh-slider__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.anh-slider__dot.active {
    background: white;
    width: 24px;
    border-radius: 4px;
}

.anh-slider__dot:hover { background: rgba(255, 255, 255, 0.7); }

/* Progress Bar */
.anh-slider__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 20;
    overflow: hidden;
}

.anh-slider__progress-bar {
    height: 100%;
    background: white;
    transform-origin: left;
    transform: scaleX(0);
    animation: slider-progress linear forwards;
    animation-play-state: running;
}

@keyframes slider-progress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* Paused state */
.anh-slider.paused .anh-slider__progress-bar {
    animation-play-state: paused;
}

/* Thumbnails panel (for 3+ slides) */
.anh-slider__thumbs {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 24px 20px;
    z-index: 15;
    background: linear-gradient(to left, rgba(0,0,0,0.6), transparent);
}

/* Responsive */
@media (max-width: 768px) {
    .anh-slider {
        height: clamp(320px, 70vw, 480px);
    }

    .anh-slide__content { padding-bottom: 56px; }
    .anh-slider__arrow { width: 40px; height: 40px; }
    .anh-slider__arrow--prev { left: 12px; }
    .anh-slider__arrow--next { right: 12px; }
    .anh-slider__arrow { opacity: 1; } /* always visible on mobile */
}

@media (max-width: 480px) {
    .anh-slide__inner { max-width: 100%; }
    .anh-slide__content { padding-bottom: 48px; }
}

/* ============================================================
   DARK MODE TOGGLE STYLES
   ============================================================ */

/* Toggle Button */
.btn-darkmode {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.btn-darkmode:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    transform: rotate(15deg);
}

.btn-darkmode .icon-sun,
.btn-darkmode .icon-moon {
    position: absolute;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light mode: show moon, hide sun */
html[data-theme="light"] .btn-darkmode .icon-sun {
    transform: scale(0) rotate(90deg);
    opacity: 0;
}

html[data-theme="light"] .btn-darkmode .icon-moon {
    transform: scale(1) rotate(0);
    opacity: 1;
}

/* Dark mode: show sun, hide moon */
html[data-theme="dark"] .btn-darkmode .icon-sun {
    transform: scale(1) rotate(0);
    opacity: 1;
}

html[data-theme="dark"] .btn-darkmode .icon-moon {
    transform: scale(0) rotate(-90deg);
    opacity: 0;
}

/* ============================================================
   DARK MODE CSS OVERRIDES
   These override the @media prefers-color-scheme when forced
   ============================================================ */

html[data-theme="light"] {
    --color-bg: #ffffff;
    --color-bg-secondary: #f5f5f7;
    --color-bg-tertiary: #e8e8ed;
    --color-surface: #ffffff;
    --color-surface-elevated: #ffffff;
    --color-border: rgba(0, 0, 0, 0.08);
    --color-border-strong: rgba(0, 0, 0, 0.15);
    --color-text-primary: #1d1d1f;
    --color-text-secondary: #6e6e73;
    --color-text-tertiary: #aeaeb2;
    --color-text-inverse: #ffffff;
    --color-accent: #0071e3;
    --color-accent-hover: #0077ed;
    --color-accent-light: #e8f0fe;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);
    color-scheme: light;
}

html[data-theme="dark"] {
    --color-bg: #000000;
    --color-bg-secondary: #1c1c1e;
    --color-bg-tertiary: #2c2c2e;
    --color-surface: #1c1c1e;
    --color-surface-elevated: #2c2c2e;
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-strong: rgba(255, 255, 255, 0.15);
    --color-text-primary: #f5f5f7;
    --color-text-secondary: #aeaeb2;
    --color-text-tertiary: #636366;
    --color-text-inverse: #000000;
    --color-accent: #2997ff;
    --color-accent-hover: #409cff;
    --color-accent-light: rgba(41, 151, 255, 0.12);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.2);
    color-scheme: dark;
}

/* Dark mode body bg */
html[data-theme="dark"] body {
    background-color: var(--color-bg);
    color: var(--color-text-primary);
}

html[data-theme="dark"] .site-header {
    background: rgba(0, 0, 0, 0.85);
}

html[data-theme="dark"] .site-footer {
    background: var(--color-bg-secondary);
}

/* Prevent transition flash on page load */
html.theme-loading * {
    transition: none !important;
}

/* Dark mode smooth transition */
html[data-theme] body,
html[data-theme] .site-header,
html[data-theme] .post-card,
html[data-theme] .widget,
html[data-theme] .article-body {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
