/**
 * style.css — Screen 3: Style Selection
 * Pattern: identical to format.css
 * Containers inherit aspect-ratio from format selection (9:16 or 16:9)
 * Media: <video> autoplay muted loop (not <img>)
 *
 * Architecture: ZERO inline CSS. SSR. External only.
 */

/* ═══ LAYOUT CONTAINER ═══ */
/* fm-main = 100vh - 110px (header 70 + footer 40) */
/* padding-top = nav(48px) + gap(5px) = 53px */
.style-layout {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    gap: 0;
    width: 100%;
    height: 100%;
    flex: 1;
    align-self: stretch;
    padding: 53px 2.5rem 5px;
}

/* ═══ STYLE OPTION ═══ */
/* Flex ROW: thumb-col (check+thumb+label) + info side by side */
.style-option {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
}

/* Landscape format: option stacks vertically (info below thumb) */
.style-layout.style-format-landscape .style-option {
    flex-direction: column;
    align-items: center;
}

.style-layout.style-format-landscape .style-info {
    width: calc(100vh - 224px);
    align-items: center;
    text-align: center;
}

.style-layout.style-format-landscape .style-info-desc {
    text-align: center;
}

/* Thumb column: check + container, centered */
.style-thumb-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* ═══ THUMBNAIL CONTAINER ═══ */
/* D = short side, shared by both (same rectangle, same format) */
/* H = 100vh - 224px (available for thumb) */
/* D = H * 9/16 = (100vh - 224px) * 9/16 */
.style-thumb {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: #1a1a1e;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.style-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* 9:16 Portrait — width = D, height from aspect-ratio */
.style-thumb-portrait {
    width: calc((100vh - 224px) * 9 / 16);
    aspect-ratio: 9/16;
}

/* 16:9 Landscape — height = D, width from aspect-ratio */
.style-thumb-landscape {
    height: calc((100vh - 224px) * 9 / 16);
    aspect-ratio: 16/9;
}

/* ═══ SELECT BUTTON (checkmark) ═══ */
/* 19px (same as format) */
.style-check {
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.style-option:hover .style-check {
    border-color: rgba(255, 255, 255, 0.4);
}

.style-option.selected .style-check {
    background: #fff;
    border-color: #fff;
}

.style-check svg {
    width: 11px;
    height: 11px;
    color: transparent;
    transition: color 0.3s;
}

.style-option.selected .style-check svg {
    color: #000;
}

/* ═══ LABELS ═══ */
.style-name {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: -0.04em;
    text-align: left;
    transition: color 0.3s;
}

.style-option.selected .style-name {
    color: #fff;
}

/* ═══ STYLE INFO (title + description grid cell) ═══ */
.style-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 120px;
    flex-shrink: 0;
    text-align: left;
}

.style-info-desc {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    line-height: 1.5;
    text-align: left;
    transition: color 0.3s;
    word-wrap: break-word;
}

.style-option.selected .style-info-desc {
    color: rgba(255, 255, 255, 0.75);
}

/* ═══ SELECTION STATES ═══ */
.style-option.selected .style-thumb {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
}

.style-layout.has-selection .style-option:not(.selected) .style-thumb {
    opacity: 0.5;
}

.style-layout.has-selection .style-option:not(.selected) .style-thumb video {
    opacity: 0.6;
}

/* ═══ ACTION COLUMN ═══ */
.style-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.style-hint {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    line-height: 1.6;
    max-width: 200px;
}

.style-submit {
    border-radius: 1rem;
    padding: 0.85rem 3.5rem;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(145deg, #e0e0e0, #a0a0a0);
    color: #111;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.4;
    pointer-events: none;
}

.style-submit.enabled {
    opacity: 1;
    pointer-events: auto;
}

.style-submit.enabled:hover {
    background: linear-gradient(145deg, #ffffff, #c0c0c0);
    transform: scale(1.02);
}

/* ═══ SHAKE ANIMATION ═══ */
.style-option.shake {
    animation: styleShake 0.4s ease;
}

@keyframes styleShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ═══ TABLET (768px) ═══ */
@media (max-width: 768px) {
    .style-layout {
        gap: 1.5rem;
        padding: 53px 1.5rem 5px;
    }

    .style-thumb-portrait {
        width: calc((100vh - 224px) * 9 / 16);
    }

    .style-thumb-landscape {
        height: calc((100vh - 224px) * 9 / 16);
    }

    .style-name {
        font-size: 11px;
    }

    .style-submit {
        padding: 0.75rem 1.5rem;
    }
}

/* ═══ MOBILE (480px) — stack vertical ═══ */
@media (max-width: 480px) {
    .style-layout {
        flex-direction: column;
        align-items: center;
        justify-content: space-evenly;
        gap: 0;
        padding: 53px 1.5rem 5px;
    }

    .style-thumb-portrait {
        width: clamp(90px, calc((100vh - 224px) * 9 / 16 * 0.30), 150px);
    }

    .style-thumb-landscape {
        height: clamp(90px, calc((100vh - 224px) * 9 / 16 * 0.30), 150px);
    }

    .style-action {
        width: 100%;
    }

    .style-submit {
        width: 100%;
    }

    .style-layout.style-format-landscape .style-info {
        width: auto;
    }
}
