/* =====================================================
   BAYQUEN.COM — Pattern Showcase
   Two animated patterns, one masked by a CSS-generated
   pattern mask (polka dots / checkers / stripes).
   Uses CSS gradients for masks so it works directly
   from the filesystem (no server required).
   ===================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ── Hero container ──────────────────────────────── */
.hero-area {
    --tile-size: 1200px;
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #1a1a2e;
    /* fallback if images fail */
    cursor: pointer;
    /* Indicates it's clickable */
}

/* Pause animations when .paused class is active */
.hero-area.paused .background-pattern,
.hero-area.paused .masked-pattern {
    animation-play-state: paused;
}

/* ── Layer 1: Base background pattern (moves left) ── */
.background-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background-image: url('patterns/modern-ikat.jpg');
    background-size: var(--tile-size) var(--tile-size);
    background-repeat: repeat;

    animation: moveLeft 90s linear infinite;
}

/* ── Layer 2: Top pattern (moves up) + B&W CSS mask ─ */
.masked-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background-image: url('patterns/hawaiian-aloha.jpg');
    background-size: var(--tile-size) var(--tile-size);
    background-repeat: repeat;

    /* Pattern rises in 90s; its mask drifts diagonally at half that speed. */
    animation: moveUp 90s linear infinite, moveMaskDiagonal 180s linear infinite;

    /* JavaScript randomly replaces this with a Bayquen top-100 alpha mask. */
    -webkit-mask-image: url('masks/top100-ikat.png');
    -webkit-mask-size: var(--tile-size) var(--tile-size);
    -webkit-mask-repeat: repeat;

    mask-image: url('masks/top100-ikat.png');
    mask-size: var(--tile-size) var(--tile-size);
    mask-repeat: repeat;
}


/* ── Keyframe Animations ─────────────────────────── */

/* Background pattern scrolls LEFT (negative = leftward) */
@keyframes moveLeft {
    0% {
        background-position-x: 0;
    }

    100% {
        background-position-x: -4500px;
    }

    /* exact tile width for seamless loop */
}

/* Top masked pattern scrolls UPWARD */
@keyframes moveUp {
    0% {
        background-position-y: 0;
    }

    100% {
        background-position-y: -2000px;
    }

    /* exact tile height for seamless loop */
}

/* The alpha mask moves up and left equally, making a 45° diagonal. */
@keyframes moveMaskDiagonal {
    0% {
        -webkit-mask-position: 0 0;
        mask-position: 0 0;
    }

    100% {
        -webkit-mask-position: calc(-1 * var(--tile-size)) calc(-1 * var(--tile-size));
        mask-position: calc(-1 * var(--tile-size)) calc(-1 * var(--tile-size));
    }
}

/* ── UI Controls Panel ──────────────────────────── */
.controls-panel {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(26, 26, 46, 0.85);
    padding: 10px 20px;
    border-radius: 50px;
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    gap: 16px;
    align-items: center;
}

.info-panel {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 10;
    background: rgba(26, 26, 46, 0.85);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.control-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #ffffff;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
    text-decoration: none;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.control-btn svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* Toggle icons based on hero-area state */
body:has(.hero-area.paused) .btn-pause {
    display: none;
}

body:not(:has(.hero-area.paused)) .btn-play {
    display: none;
}

/* ── Combination Recipe ─────────────────────────── */
.recipe-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    width: min(92vw, 620px);
}

.recipe-overlay[hidden] {
    display: none;
}

.recipe-card {
    padding: 28px 32px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: 20px;
    background: rgba(11, 22, 37, 0.82);
    color: white;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.recipe-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

.recipe-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    color: white;
    background: rgba(255, 255, 255, 0.14);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.recipe-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

.recipe-eyebrow,
.recipe-note {
    margin: 0;
    font-family: 'Roboto Condensed', sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.recipe-eyebrow {
    color: #b9d5ee;
    font-size: 0.85rem;
    font-weight: 700;
}

.recipe-card h1 {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: clamp(1.55rem, 4vw, 2.65rem);
    margin: 8px 0 18px;
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
    overflow-wrap: anywhere;
}

.recipe-list {
    display: grid;
    gap: 9px;
    margin: 0 0 18px;
}

.recipe-list div {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 10px;
    align-items: baseline;
}

.recipe-list dt,
.recipe-list dd {
    margin: 0;
    font-family: 'Roboto Condensed', sans-serif;
}

.recipe-list dd a,
.recipe-note a {
    color: inherit;
    text-decoration-color: rgba(185, 213, 238, 0.7);
    text-underline-offset: 3px;
}

.recipe-list dd a:hover,
.recipe-note a:hover {
    color: #b9d5ee;
}

.recipe-thumbnails {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 0 0 18px;
}

.recipe-thumbnails figure {
    margin: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 10px;
    background: #f8fafc;
}

.recipe-thumbnails img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.recipe-thumbnail-link {
    display: block;
    transition: opacity 0.2s, transform 0.2s;
}

.recipe-thumbnail-link:hover {
    opacity: 0.8;
    transform: scale(1.025);
}

.recipe-thumbnails figcaption {
    padding: 6px 8px;
    background: rgba(11, 22, 37, 0.96);
    color: #dce7f0;
    font: 700 0.72rem 'Roboto Condensed', sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.recipe-thumbnails .mask-thumbnail {
    background: #172535;
}

.combo-details {
    margin: -8px 0 18px;
    color: #b9d5ee;
    font: 600 0.73rem/1.35 'Roboto Condensed', sans-serif;
    letter-spacing: 0.055em;
}

.paused-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 14px;
}

.download-combo-btn,
.preview-combo-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.52);
    border-radius: 10px;
    background: #ffffff;
    color: #142235;
    cursor: pointer;
    font: 800 1rem/1 'Roboto Condensed', sans-serif;
    letter-spacing: 0.025em;
    text-align: left;
    transition: background 0.2s, transform 0.2s, opacity 0.2s;
}

.download-help {
    margin: 0 0 9px;
    color: #dce7f0;
    font: 600 0.82rem/1.35 'Roboto Condensed', sans-serif;
}

.download-combo-btn:hover:not(:disabled),
.preview-combo-btn:hover:not(:disabled) {
    background: #dcebf7;
    transform: translateY(-1px);
}

.download-combo-btn:disabled,
.preview-combo-btn:disabled {
    cursor: wait;
    opacity: 0.72;
}

.preview-overlay {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(6, 15, 25, 0.74);
}

.preview-overlay[hidden] { display: none; }

.preview-card {
    width: min(92vw, 760px);
    padding: 24px;
    border: 1px solid rgba(255,255,255,.38);
    border-radius: 18px;
    background: #102033;
    box-shadow: 0 18px 52px rgba(0,0,0,.45);
}

.preview-card h2 { margin: 5px 0 0; color: #ffffff; font: 800 clamp(1rem,3vw,1.55rem)/1 'Roboto Condensed',sans-serif; }
.preview-card > p { margin: 14px 0; color: #dce7f0; font: 0.88rem/1.4 'Roboto Condensed',sans-serif; }
.preview-stage { position: relative; height: min(54vh, 470px); overflow: hidden; border-radius: 10px; background-color:#eef4fa; background-repeat: repeat; }
.preview-guides { position:absolute; inset:0; pointer-events:none; opacity:.58; background-image:linear-gradient(90deg,transparent calc(100% - 1px),#e91e63 calc(100% - 1px)),linear-gradient(0deg,transparent calc(100% - 1px),#e91e63 calc(100% - 1px)); }
.preview-scale-label { display:flex; justify-content:space-between; margin:14px 0 7px; color:#dce7f0; font:700 .78rem 'Roboto Condensed',sans-serif; letter-spacing:.06em; text-transform:uppercase; }
#previewScale { width:100%; }

.recipe-list dt {
    color: #b9d5ee;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.recipe-list dd {
    color: white;
    font-size: clamp(1rem, 2.2vw, 1.18rem);
    font-weight: 600;
}

.recipe-note {
    color: #dce7f0;
    font-size: 0.72rem;
    line-height: 1.45;
    letter-spacing: 0.045em;
    text-transform: none;
}

@media (max-width: 540px) {
    .recipe-card {
        padding: 22px;
    }

    .recipe-list div {
        grid-template-columns: 60px 1fr;
    }

    .info-panel {
        bottom: 18px;
        left: 18px;
        padding: 8px 16px;
    }
}
