/* ============================================
   크리스마스 띠지 — 메인 · 검색 결과에서 크리스마스 페이지로 데려가는 띠
   전나무 초록 띠 · 왼쪽 사탕 줄무늬 · 금빛 별이 반짝이는 트리 · 흩날리는 눈
   색은 크리스마스 페이지(christmas.css)와 같은 값을 쓴다
   ============================================ */

.xr {
    --xr-green-deep: #0f3b2a;
    --xr-green: #1d5e43;
    --xr-glow: #2a7352;
    --xr-leaf: #3f9a6b;
    --xr-leaf-dark: #2b7a52;
    --xr-gold: #e7b75f;
    --xr-gold-light: #f3cf85;
    --xr-gold-dark: #c99645;
    --xr-cream: #fff8ec;
    --xr-cream-dim: rgba(255, 248, 236, 0.74);
    --xr-red: #c0392b;
    --xr-blue: #6fb0d6;
    --xr-ink: #2a1d14;
    --xr-stripe: 8px;

    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-6) 0 var(--space-4);
    padding: var(--space-4) var(--space-5) var(--space-4) calc(var(--xr-stripe) + var(--space-5));
    border-radius: var(--radius-xl);
    background:
        radial-gradient(140% 160% at 0% 0%, var(--xr-glow) 0%, transparent 55%),
        linear-gradient(110deg, var(--xr-green-deep) 0%, var(--xr-green) 100%);
    color: var(--xr-cream);
    text-decoration: none;
    overflow: hidden;
    box-shadow: 0 8px 20px -10px rgba(15, 59, 42, 0.6);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.xr:hover {
    color: var(--xr-cream);
    transform: translateY(-2px);
    box-shadow: 0 14px 26px -12px rgba(15, 59, 42, 0.65);
}

.xr:focus-visible {
    outline: 3px solid var(--xr-gold);
    outline-offset: 3px;
}

/* 왼쪽 가장자리의 사탕 줄무늬 — 선물 띠지 느낌 */
.xr::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--xr-stripe);
    background: repeating-linear-gradient(-45deg,
        var(--xr-red) 0 6px, var(--xr-cream) 6px 12px);
}

/* 안쪽 금빛 실선 테두리 */
.xr::after {
    content: '';
    position: absolute;
    inset: 5px 5px 5px calc(var(--xr-stripe) + 5px);
    border: 1px solid rgba(231, 183, 95, 0.32);
    border-radius: calc(var(--radius-xl) - 5px);
    pointer-events: none;
}

/* ── 눈: 점 두 겹을 천천히 흘린다 ── */
.xr__snow {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.55) 1.2px, transparent 1.6px),
        radial-gradient(circle, rgba(255, 255, 255, 0.3) 1px, transparent 1.4px);
    background-size: 46px 46px, 28px 28px;
    background-position: 0 0, 14px 9px;
    animation: xr-snow 14s linear infinite;
}

@keyframes xr-snow {
    to { background-position: 46px 92px, 42px 65px; }
}

/* ── 트리 ── */
.xr__tree {
    flex-shrink: 0;
    width: 52px;
    height: 62px;
    overflow: visible;
    filter: drop-shadow(0 0 10px rgba(231, 183, 95, 0.28));
}

.xr__leaf { fill: var(--xr-leaf-dark); }
.xr__leaf--top { fill: var(--xr-leaf); }
.xr__leaf--low { fill: #23694a; }
.xr__trunk { fill: #7a4f2e; }

.xr__garland {
    fill: none;
    stroke: var(--xr-gold);
    stroke-width: 1.1;
    stroke-linecap: round;
    stroke-dasharray: 0.1 2.4;
}

.xr__star {
    fill: var(--xr-gold-light);
    transform-box: fill-box;
    transform-origin: center;
    animation: xr-twinkle 2.6s ease-in-out infinite;
}

.xr__ball { animation: xr-blink 3s ease-in-out infinite; }
.xr__ball--red { fill: var(--xr-red); }
.xr__ball--gold { fill: var(--xr-gold); animation-delay: -1s; }
.xr__ball--blue { fill: var(--xr-blue); animation-delay: -2s; }

@keyframes xr-twinkle {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.18); opacity: 0.8; }
}

@keyframes xr-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* ── 문구 ── */
.xr__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* 좁은 화면에서 "계신가 / 요?" 처럼 글자 중간에서 끊기지 않게 어절 단위로 줄을 바꾼다 */
    word-break: keep-all;
}

.xr__eyebrow {
    color: var(--xr-gold);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.xr__title {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.xr__desc {
    color: var(--xr-cream-dim);
    font-size: var(--text-sm);
}

/* ── 캐롤 악보 보기 (금빛 리본 버튼) ── */
.xr__cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    background: linear-gradient(180deg, var(--xr-gold-light) 0%, var(--xr-gold) 55%, var(--xr-gold-dark) 100%);
    color: var(--xr-ink);
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    white-space: nowrap;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.2);
}

.xr__arrow { transition: transform var(--transition-fast); }
.xr:hover .xr__arrow { transform: translateX(3px); }

/* 버튼 위로 가끔 빛이 한 번 스쳐 지나간다 */
.xr__cta {
    position: relative;
    overflow: hidden;
}
.xr__cta::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.6) 50%, transparent 70%);
    transform: translateX(-120%);
    animation: xr-shine 4.5s ease-in-out infinite;
}

@keyframes xr-shine {
    0%, 62% { transform: translateX(-120%); }
    85%, 100% { transform: translateX(120%); }
}

/* ── 트리 아래 선물 상자 ── */
.xr__gift--red rect { fill: var(--xr-red); }
.xr__gift--gold rect { fill: var(--xr-gold); }
.xr__gift-ribbon {
    fill: none;
    stroke-width: 1.2;
    stroke-linecap: round;
}
.xr__gift--red .xr__gift-ribbon { stroke: var(--xr-gold-light); }
.xr__gift--gold .xr__gift-ribbon { stroke: var(--xr-red); }

/* ═════════ 메인용 화려한 띠지 (festive) ═════════ */

.xr--festive {
    /* 위쪽은 전구 줄(22px)이 걸릴 자리만 남긴다 */
    padding-top: calc(var(--space-5) + 4px);
    padding-bottom: calc(var(--space-4) + 4px);
    background:
        radial-gradient(55% 130% at 90% -20%, rgba(231, 183, 95, 0.2) 0%, transparent 60%),
        radial-gradient(140% 160% at 0% 0%, var(--xr-glow) 0%, transparent 55%),
        linear-gradient(110deg, #0b2e21 0%, var(--xr-green) 100%);
}

.xr--festive .xr__tree { width: 56px; height: 68px; }
.xr--festive .xr__title { font-size: var(--text-xl); }
.xr--festive .xr__cta { padding: 11px 20px; font-size: var(--text-base); }

/* 전구 줄 — 전선은 늘이고(svg), 전구는 처진 자리마다 하나씩 */
.xr__lights {
    position: absolute;
    top: 0;
    left: var(--xr-stripe);
    right: 0;
    height: 22px;
    pointer-events: none;
}

.xr__wire {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.xr__wire path {
    fill: none;
    stroke: rgba(255, 248, 236, 0.4);
    stroke-width: 1.2;
    vector-effect: non-scaling-stroke;
}

.xr__lights i {
    --bulb: var(--xr-red);
    position: absolute;
    top: 13px;
    left: calc((var(--i) * 10 + 5) * 1%);
    width: 7px;
    height: 10px;
    margin-left: -3.5px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    background: var(--bulb);
    box-shadow: 0 0 8px 2px var(--bulb);
    animation: xr-bulb 1.8s ease-in-out infinite;
    animation-delay: calc(var(--i) * -0.45s);
}
/* 전구 꼭지 */
.xr__lights i::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 1.5px;
    width: 4px;
    height: 3px;
    border-radius: 1px;
    background: #6b7a70;
}
.xr__lights i:nth-of-type(4n + 2) { --bulb: var(--xr-gold-light); }
.xr__lights i:nth-of-type(4n + 3) { --bulb: #7fd49b; }
.xr__lights i:nth-of-type(4n + 4) { --bulb: var(--xr-blue); }

@keyframes xr-bulb {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; box-shadow: 0 0 2px 0 var(--bulb); }
}

/* 별가루 — 반짝이는 네모난 별 */
.xr__sparkles {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}
.xr__sparkles i {
    position: absolute;
    width: 9px;
    height: 9px;
    background: var(--xr-gold-light);
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    animation: xr-sparkle 2.8s ease-in-out infinite;
    animation-delay: calc(var(--n) * -0.47s);
}
.xr__sparkles i:nth-of-type(1) { left: 38%; top: 30%; }
.xr__sparkles i:nth-of-type(2) { left: 55%; top: 66%; }
.xr__sparkles i:nth-of-type(3) { left: 64%; top: 30%; }
.xr__sparkles i:nth-of-type(4) { left: 75%; top: 60%; }
.xr__sparkles i:nth-of-type(5) { left: 47%; top: 74%; }
.xr__sparkles i:nth-of-type(6) { left: 84%; top: 28%; }

@keyframes xr-sparkle {
    0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); }
    50% { opacity: 0.9; transform: scale(1) rotate(45deg); }
}

/* 금빛 산타 썰매 — 문구와 버튼 사이 빈 자리를 오른쪽 위로 천천히 지나간다 */
.xr__sleigh {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150px;
    z-index: -1;
    pointer-events: none;
    animation: xr-fly 14s ease-in-out infinite;
}
.xr__sleigh .xm-sleigh {
    display: block;
    width: 100%;
    height: auto;
}
.xr__sleigh .xm-sleigh__body path { fill: rgba(243, 207, 133, 0.55); }
.xr__sleigh .xm-sleigh__rein { fill: none; stroke: rgba(243, 207, 133, 0.55); stroke-width: 1; }

@keyframes xr-fly {
    0%   { transform: translate(-40px, -20%) rotate(-5deg); opacity: 0; }
    15%  { opacity: 1; }
    85%  { opacity: 1; }
    100% { transform: translate(220px, -90%) rotate(-5deg); opacity: 0; }
}

/* 아래쪽 눈 언덕 */
.xr__drift {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 18px;
    z-index: -1;
    pointer-events: none;
}
.xr__drift-back { fill: rgba(238, 244, 241, 0.22); }
.xr__drift-front { fill: rgba(238, 244, 241, 0.85); }

/* ── 반응형 ── */
@media (max-width: 768px) {
    .xr {
        gap: var(--space-3);
        margin: var(--space-4) 0 var(--space-3);
        padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--xr-stripe) + var(--space-3));
    }
    .xr__tree { width: 44px; height: 52px; }
    .xr__title { font-size: var(--text-base); }

    .xr--festive {
        padding-top: calc(var(--space-4) + 8px);
        padding-bottom: calc(var(--space-3) + 4px);
    }
    .xr--festive .xr__tree { width: 48px; height: 58px; }
    .xr--festive .xr__title { font-size: var(--text-lg); }
    .xr--festive .xr__cta { padding: 10px 18px; font-size: var(--text-sm); }
    .xr__sleigh { display: none; } /* 좁으면 문구와 겹친다 */
}

@media (max-width: 480px) {
    .xr__tree { width: 38px; height: 46px; }
    .xr__eyebrow { font-size: 0.6875rem; }
    /* 폰에서는 보조 문구까지 넣으면 띠지가 세 줄 넘게 부풀어서 제목과 버튼만 남긴다 */
    .xr__desc { display: none; }
    .xr__cta { padding: 8px 12px; font-size: var(--text-xs); }

    .xr--festive .xr__tree { width: 40px; height: 48px; }
    .xr--festive .xr__title { font-size: var(--text-base); }
    .xr--festive .xr__cta { padding: 8px 12px; font-size: var(--text-xs); }
    .xr__lights i:nth-of-type(2n) { display: none; } /* 폰에서는 전구를 반만 단다 */
    .xr__sparkles { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .xr, .xr__arrow { transition: none; }
    .xr:hover { transform: none; }
    .xr__snow, .xr__star, .xr__ball,
    .xr__lights i, .xr__sparkles i, .xr__cta::after { animation: none; }
    .xr__sleigh { display: none; }
    .xr__sparkles i { opacity: 0.6; }
}
