/* ==========================================================================
   How-To Videos Page Styles
   Breakpoints (requested):
   - Small Devices (max-width: 400px)
   - Small-Medium Devices (400px - 500px)
   - Medium Devices (500px - 767px)
   - Large Devices (768px - 1020px)
   - Extra Large Devices (1020px - 1500px)
   - Extra Large Devices (1500px and up)
   - Ultra High Resolution (1920px and up)
   ========================================================================== */


/* =========================
   Base Layout
   ========================= */

/* Hero section */
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: fit-content;
    align-self: stretch;
    gap: 2rem;
}

.titles-and-subtitle {
    display: flex;
    flex-direction: column;
    padding: 7rem var(--side-padding) 0 var(--side-padding);
    gap: 1.25rem;
}

.interface-image {
    display: flex;
    margin-left: 30%;
    height: 20rem;
    border-radius: 999px;
    flex-direction: column;
    justify-content: right;
    align-items: center;
    align-self: stretch;
    background-image: url('../resources/how-to-videos-hero.svg');
    background-size: cover;
    background-repeat: no-repeat;
    z-index: 2;
}


/* Video section */
.video-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: fit-content;
    align-self: stretch;
    gap: 2rem;
    padding: 6rem var(--side-padding);
}


/* =========================
   Tabs
   ========================= */

.tabs {
    margin-top: 1.5rem;
    container-type: inline-size;
    container-name: tabs;
    position: relative;
    width: 100%;
    max-width: 100%;
}

.tablist {
    display: inline-flex;
    gap: 0.5rem;
    padding: .350rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.80);
    background: rgba(255, 255, 255, 0.4);
}

.tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    border-radius: 999px;
    padding: 1rem 1rem;
    transition: background 0.2s ease, opacity 0.2s ease;
    font-family: 'Kanit', Arial, sans-serif;
    font-size: var(--font-size-h3);
    line-height: 100%;
}

.tab.is-active {
    background: var(--green-color);
}

.tab:focus-visible {
    outline: 2px solid var(--green-color);
    outline-offset: 2px;
}


/* Tab panels */
.tabpanel {
    margin-top: 1.5rem;
    transition: opacity 0.3s ease;
    width: 100%;
}

.tabpanel[hidden] {
    display: none;
}

.panel-subtitle {
    margin: 0 0 3rem 0;
    font-size: var(--font-size-subtitle);
}


/* =========================
   Video Grid + Cards
   ========================= */

.video-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* forced 2 columns by default */
    gap: 2rem;
    width: 100%;
}

/* Keep container query (useful if tabs container is narrower than viewport) */
@container tabs (max-width: 768px) {
    .video-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Card */
.video-card {
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1),
        transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.video-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--md-elevation-3);
}

/* Media */
.video-media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    border-radius: 1rem;
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    cursor: pointer;
    background: transparent;
    position: relative;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-thumbnail:hover img {
    transform: scale(1.05);
}

/* Play button */
.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3.75rem;
    height: 3.75rem;
    background-image: url("../resources/modlforge_play_dark_button.svg");
    background-size: contain;
    background-repeat: no-repeat;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.video-thumbnail:hover .video-play-button {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 0.9;
}

/* Duration badge */
.video-duration {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    border-radius: 0.5rem;
    backdrop-filter: blur(4px);
}

/* Iframe */
.video-iframe {
    position: absolute;
    inset: 0;
}

.video-iframe iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* Text */
.video-body {
    padding: 1rem 1.1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.video-title {
    font-size: var(--font-size-body);
    line-height: 1.4;
    font-weight: 400;
}

.video-summary {
    opacity: 0.9;
    line-height: 1.5;
}

/* More button */
.video-more {
    align-self: flex-start;
    background: none;
    border: 0;
    padding: 0;
    margin-top: 0.25rem;
    cursor: pointer;
    font: inherit;
    color: var(--orange-color);
    transition: opacity 0.2s ease;
}

.video-more:hover {
    text-decoration: underline;
    text-underline-offset: 0.25rem;
    opacity: 0.8;
}

.video-more:focus-visible {
    outline: 2px solid var(--orange-color);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Expanded description */
.video-details {
    margin-top: 0.75rem;
    line-height: 1.6;
}

.video-details[hidden] {
    display: none;
}

.video-details ul {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

.video-details li {
    list-style-type: circle;
    list-style-position: inside;
    margin: 0.25rem 0;
}

.video-note {
    margin: 2rem 0 0 0;
    font-size: var(--font-size-small);
}


/* =========================
   Contact CTA
   ========================= */

.frame2-text1,
.frame2-text2 {
    margin: 0;
    width: 28%;
}

.frame2-text2 {
    width: 32%;
}

.text-and-button {
    display: flex;
    padding-left: 1.5625rem;
    justify-content: center;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.highlight-demo {
    background-color: var(--green-color);
    color: var(--text-color);
    border-radius: 0.25rem;
    padding: 0.1rem 0.25rem;
}


/* ==========================================================================
   Media Queries (moved to end)
   ========================================================================== */

/* Small Devices (max-width: 400px) */
@media (max-width: 400px) {
    .titles-and-subtitle {
        padding-top: 5rem;
    }

    .interface-image {
        height: 18rem;
        margin-left: 40%;
    }

    .video-section {
        padding: 3rem var(--side-padding);
        gap: 1.5rem;
    }

    .tablist {
        flex-wrap: wrap;
    }

    .tab {
        padding: 0.5rem 0.875rem;
        font-size: 0.9375rem;
    }

    .video-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .video-play-button {
        width: 3rem;
        height: 3rem;
    }

    .frame2-text1,
    .frame2-text2 {
        width: 100%;
    }

    .text-and-button {
        flex-direction: column;
        align-items: flex-start;
        padding-left: 0;
    }
}

/* Small-Medium Devices (400px - 500px) */
@media (min-width: 401px) and (max-width: 500px) {
    .titles-and-subtitle {
        padding-top: 5.25rem;
    }

    .interface-image {
        height: 18.5rem;
        margin-left: 42%;
    }

    .video-section {
        padding: 3.25rem var(--side-padding);
        gap: 1.5rem;
    }

    .tablist {
        flex-wrap: wrap;
    }

    .tab {
        padding: 0.5rem 0.9rem;
        font-size: 0.95rem;
    }

    .video-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .video-play-button {
        width: 3.25rem;
        height: 3.25rem;
    }

    .frame2-text1,
    .frame2-text2 {
        width: 100%;
    }

    .text-and-button {
        flex-direction: column;
        align-items: flex-start;
        padding-left: 0;
    }
}

/* Medium Devices (500px - 767px) */
@media (min-width: 501px) and (max-width: 767px) {
    .titles-and-subtitle {
        padding-top: 5.75rem;
    }

    .interface-image {
        height: 19.5rem;
        margin-left: 45%;
    }

    .video-section {
        padding: 3.75rem var(--side-padding);
        gap: 1.5rem;
    }

    .tablist {
        flex-wrap: wrap;
    }

    .tab {
        padding: 0.55rem 0.95rem;
        font-size: 0.95rem;
    }

    .video-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Large Devices (768px - 1020px) */
@media (min-width: 768px) and (max-width: 1020px) {
    .video-section {
        padding: 4rem var(--side-padding);
        gap: 1.5rem;
    }

    .tablist {
        flex-wrap: wrap;
    }

    .tab {
        padding: 0.55rem 0.95rem;
        font-size: 0.975rem;
    }

    /* keep 2 columns here, but slightly tighter spacing */
    .video-grid {
        gap: 1.5rem;
    }
}

/* Extra Large Devices (1020px - 1500px) */
@media (min-width: 1021px) and (max-width: 1500px) {
    /* your current base values already fit this range well */
}

/* Extra Large Devices (1500px and up) */
@media (min-width: 1501px) {

    /* optional: give the layout a bit more breathing room */
    .video-section {
        padding: 6.5rem var(--side-padding);
    }

    .video-grid {
        gap: 2.25rem;
    }
}

/* Ultra High Resolution (1920px and up) */
@media (min-width: 1920px) {

    /* optional: slightly larger play button and spacing */
    .video-play-button {
        width: 4rem;
        height: 4rem;
    }

    .video-grid {
        gap: 2.5rem;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .tab,
    .video-card,
    .video-thumbnail img,
    .video-play-button,
    .video-more,
    .tabpanel {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tab.is-active {
        background: rgba(255, 25, 255, 0.3);
        border: 2px solid currentColor;
    }

    .video-card {
        border-width: 2px;
    }
}