/**
 * RESTRICTED ACCESS: This software is proprietary and closed-source.
 * NO AI TRAINING OR ANALYSIS: Use of this code for machine learning training,
 * automated analysis, ingestion by AI agents, or dataset creation is prohibited
 * without prior written permission from the copyright holder.
 * See TERMS.txt and https://www.yoozecase.com/terms
 *
 * Purpose: frontend styles for Wow, Handshakable Downloads (list, buttons, popup).
 * Design system: central --yc-* tokens, every component reads them via
 * var(--yc-token, fallback). All selectors are prefixed (yc-whd-). Colours
 * inherit from the theme where possible (currentColor / inherit); the
 * tokens only define structure, spacing and neutral overlays.
 */

/* ------------------------------------------------ design tokens */

.yc-whd,
.yc-whd-modal {
    --yc-space-xs: 0.25rem;
    --yc-space-s: 0.5rem;
    --yc-space-m: 1rem;
    --yc-space-l: 1.5rem;
    --yc-radius: 6px;
    --yc-border: rgba(0, 0, 0, 0.15);
    --yc-overlay: rgba(0, 0, 0, 0.55);
    --yc-surface: #fff;
    --yc-text: #333;
    --yc-muted: #666;
    --yc-accent: #0ca678;
    --yc-accent-contrast: #fff;
    --yc-danger: #b02a37;
    --yc-focus: #1c7ed6;
    --yc-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    --yc-tap: 44px;
}

/* ------------------------------------------------ list */

.yc-whd-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.yc-whd-item {
    margin: 0 0 var(--yc-space-s, 0.5rem);
}

.yc-whd-link {
    display: inline-flex;
    align-items: center;
    gap: var(--yc-space-s, 0.5rem);
    min-height: var(--yc-tap, 44px);
    text-decoration: none;
    color: inherit;
}

.yc-whd-link:hover .yc-whd-title,
.yc-whd-link:focus-visible .yc-whd-title {
    text-decoration: underline;
}

.yc-whd-link:focus-visible {
    outline: 2px solid var(--yc-focus, #1c7ed6);
    outline-offset: 2px;
    border-radius: var(--yc-radius, 6px);
}

.yc-whd-style-button .yc-whd-link,
.yc-whd-link-button {
    padding: var(--yc-space-s, 0.5rem) var(--yc-space-m, 1rem);
    border: 1px solid var(--yc-border, rgba(0, 0, 0, 0.15));
    border-radius: var(--yc-radius, 6px);
}

.yc-whd-flag {
    flex: none;
    width: 16px;
    height: 12px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px var(--yc-border, rgba(0, 0, 0, 0.15));
}

.yc-whd-size {
    color: var(--yc-muted, #666);
    font-size: 0.875em;
}

/* ------------------------------------------------ popup */

.yc-whd-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--yc-space-m, 1rem);
}

.yc-whd-modal[hidden] {
    display: none;
}

body.yc-whd-modal-open {
    overflow: hidden;
}

.yc-whd-overlay {
    position: absolute;
    inset: 0;
    background: var(--yc-overlay, rgba(0, 0, 0, 0.55));
}

.yc-whd-dialog {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    background: var(--yc-surface, #fff);
    color: var(--yc-text, #333);
    border-radius: var(--yc-radius, 6px);
    box-shadow: var(--yc-shadow, 0 10px 30px rgba(0, 0, 0, 0.25));
    padding: var(--yc-space-l, 1.5rem);
    animation: yc-whd-in 0.18s ease-out;
}

@keyframes yc-whd-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.yc-whd-modal-title {
    margin: 0 var(--yc-space-l, 1.5rem) var(--yc-space-m, 1rem) 0;
    font-size: 1.25rem;
    line-height: 1.3;
    /* The dialog is always light; do not inherit the theme heading colour
       (dark/inverse themes give headings a white colour, invisible here). */
    color: var(--yc-text, #333);
}

.yc-whd-terms {
    overflow-y: auto;
    min-height: 4rem;
    max-height: 45vh;
    padding: var(--yc-space-m, 1rem);
    border: 1px solid var(--yc-border, rgba(0, 0, 0, 0.15));
    border-radius: var(--yc-radius, 6px);
    font-size: 0.9375rem;
}

.yc-whd-terms:focus-visible {
    outline: 2px solid var(--yc-focus, #1c7ed6);
    outline-offset: 2px;
}

.yc-whd-check {
    display: flex;
    align-items: center;
    gap: var(--yc-space-s, 0.5rem);
    min-height: var(--yc-tap, 44px);
    margin-top: var(--yc-space-m, 1rem);
    cursor: pointer;
}

.yc-whd-check input {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--yc-accent, #0ca678);
}

.yc-whd-check input:focus-visible {
    outline: 2px solid var(--yc-focus, #1c7ed6);
    outline-offset: 2px;
}

.yc-whd-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--yc-space-s, 0.5rem);
    margin-top: var(--yc-space-m, 1rem);
}

.yc-whd-btn {
    min-height: var(--yc-tap, 44px);
    padding: var(--yc-space-s, 0.5rem) var(--yc-space-l, 1.5rem);
    border-radius: var(--yc-radius, 6px);
    border: 1px solid var(--yc-border, rgba(0, 0, 0, 0.15));
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.yc-whd-btn-agree {
    background: var(--yc-accent, #0ca678);
    border-color: var(--yc-accent, #0ca678);
    color: var(--yc-accent-contrast, #fff);
}

.yc-whd-btn-agree[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.yc-whd-btn:focus-visible {
    outline: 2px solid var(--yc-focus, #1c7ed6);
    outline-offset: 2px;
}

.yc-whd-close {
    position: absolute;
    top: var(--yc-space-s, 0.5rem);
    right: var(--yc-space-s, 0.5rem);
    width: var(--yc-tap, 44px);
    height: var(--yc-tap, 44px);
    border: 0;
    background: transparent;
    color: var(--yc-muted, #666);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--yc-radius, 6px);
}

.yc-whd-close:focus-visible {
    outline: 2px solid var(--yc-focus, #1c7ed6);
    outline-offset: 2px;
}

.yc-whd-msg {
    margin: var(--yc-space-m, 1rem) 0 0;
    color: var(--yc-danger, #b02a37);
    font-size: 0.9375rem;
}

/* ------------------------------------------------ responsive */

@media (max-width: 640px) {
    .yc-whd-modal {
        padding: var(--yc-space-s, 0.5rem);
        align-items: flex-end;
    }

    .yc-whd-dialog {
        max-height: calc(100vh - 1rem);
        padding: var(--yc-space-m, 1rem);
    }

    .yc-whd-actions {
        flex-direction: column-reverse;
    }

    .yc-whd-btn {
        width: 100%;
    }

    .yc-whd-style-button .yc-whd-link {
        display: flex;
        width: 100%;
    }
}

/* ------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
    .yc-whd-dialog {
        animation: none;
    }
}
