/* =========================================================
   PHILOSOPHY CRYPT
   感情夜市 / NIGHT MARKET OF FEELINGS
   Three.js Hypercube Sticker
   ========================================================= */

/*  Sticker shell  */
.nightmarket-sticker {
    --nm-ink: #091215;
    --nm-paper: #ead9d6;

    --nm-brass: #c19a3f;
    --nm-copper: #b46a4c;

    --nm-cyan: #00ffe1;
    --nm-violet: #9b5cff;
    --nm-purple: #5b208b;
    --nm-pink: #ff3cac;

    position: relative;
    width: min(100%, 260px);
    aspect-ratio: 1 / 1;
    margin: 0 auto 1.35rem;
    isolation: isolate;
    transform:
        rotate(-2.25deg)
        translateZ(0);
    transition:
        transform 240ms ease,
        filter 240ms ease;
    filter:
        drop-shadow(0 8px 0 rgba(0, 0, 0, 0.18))
        drop-shadow(0 13px 18px rgba(0, 0, 0, 0.28));
}

/*
    Thick irregular-looking white sticker backing.
*/
.nightmarket-sticker::before {
    content: "";

    position: absolute;
    inset: -7px;

    z-index: -3;

    border-radius:
        43% 57% 48% 52%
        / 53% 44% 56% 47%;

    background: #efe7dd;

    clip-path: polygon(
        10% 5%,
        28% 1%,
        47% 4%,
        64% 1%,
        86% 7%,
        96% 22%,
        98% 42%,
        95% 62%,
        99% 81%,
        87% 95%,
        66% 98%,
        48% 95%,
        28% 99%,
        10% 91%,
        3% 73%,
        5% 53%,
        1% 32%
    );
}


/* Dark printed body. */
.nightmarket-sticker::after {
    content: "";

    position: absolute;
    inset: 0;

    z-index: -2;

    border-radius:
        42% 58% 46% 54%
        / 49% 43% 57% 51%;

    background:
        radial-gradient(
            circle at 71% 22%,
            rgba(155, 92, 255, 0.16),
            transparent 25%
        ),
        radial-gradient(
            circle at 24% 76%,
            rgba(255, 60, 172, 0.13),
            transparent 29%
        ),
        linear-gradient(
            145deg,
            #111a1d 0%,
            #091215 58%,
            #0d1820 100%
        );

    clip-path: polygon(
        10% 5%,
        28% 1%,
        47% 4%,
        64% 1%,
        86% 7%,
        96% 22%,
        98% 42%,
        95% 62%,
        99% 81%,
        87% 95%,
        66% 98%,
        48% 95%,
        28% 99%,
        10% 91%,
        3% 73%,
        5% 53%,
        1% 32%
    );
}


.nightmarket-sticker:hover {
    transform:
        rotate(0deg)
        translateY(-3px)
        scale(1.025);

    filter:
        drop-shadow(0 8px 0 rgba(0, 0, 0, 0.17))
        drop-shadow(0 16px 22px rgba(0, 0, 0, 0.34));
}


/*  Canvas area */
.nightmarket-sticker__scene {
    position: absolute;

    inset:
        7%
        5%
        21%
        5%;

    overflow: hidden;
    border-radius: 46% 54% 50% 50%;
    cursor: crosshair;
    touch-action: pan-y;
}


.nightmarket-sticker__scene canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    outline: none;
}


/* tiny printed screen texture */
.nightmarket-sticker__scene::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.16;
    background-image:
        radial-gradient(
            circle,
            rgba(234, 217, 214, 0.75) 0 0.65px,
            transparent 0.85px
        );
    background-size: 5px 5px;
    mix-blend-mode: soft-light;
}


/* Text label */
.nightmarket-sticker__label {
    position: absolute;
    left: 12%;
    bottom: 8%;
    z-index: 5;
    display: flex;
    align-items: flex-end;
    gap: 0.55rem;
    pointer-events: none;
}


.nightmarket-sticker__kanji {
    display: block;
    font-family:
        "Basteleur",
        "Yu Mincho",
        "Hiragino Mincho ProN",
        serif;
    font-weight: 700;
    font-size: clamp(1.35rem, 7vw, 2rem);
    line-height: 0.92;
    letter-spacing: -0.06em;
    color: var(--nm-paper);
    text-shadow:
        2px 2px 0 var(--nm-purple),
        4px 4px 0 rgba(255, 60, 172, 0.36);
}


.nightmarket-sticker__english {
    display: block;
    padding-bottom: 0.08rem;
    font-family:
        "Space Grotesk",
        system-ui,
        sans-serif;

    font-size: 0.48rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.12em;
    color: var(--nm-cyan);
    opacity: 0.82;
}


/*  四次元 stamp */
.nightmarket-sticker__stamp {
    position: absolute;
    top: 14%;
    right: 10%;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    border: 1px solid currentColor;
    border-radius: 50%;
    color: var(--nm-pink);
    font-family:
        "Yu Mincho",
        "Hiragino Mincho ProN",
        serif;

    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1;

    writing-mode: vertical-rl;
    opacity: 0.72;
    transform: rotate(9deg);
    box-shadow:
        inset 0 0 0 2px var(--nm-ink),
        inset 0 0 0 3px currentColor;
}


/*  small decorative sparks around sticker */
.nightmarket-sticker__label::before,
.nightmarket-sticker__label::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}


.nightmarket-sticker__label::before {
    width: 4px;
    height: 4px;
    left: -1rem;
    top: -1.05rem;
    background: var(--nm-cyan);
    box-shadow:
        9px -5px 0 var(--nm-brass),
        -3px 11px 0 var(--nm-violet),
        20px 4px 0 var(--nm-pink);
}


.nightmarket-sticker__label::after {
    width: 3px;
    height: 3px;
    right: -1.4rem;
    bottom: 0.25rem;
    background: var(--nm-pink);
    box-shadow:
        7px -8px 0 var(--nm-cyan),
        13px 2px 0 var(--nm-brass);
}


/* Main visual section inside the active post */
.nightmarket-feature {
    position: relative;
    z-index: 2;
    width: calc( 100% - clamp(4rem, 9vw, 7rem) );
    height: clamp( 270px, 30vw, 390px );
    min-height: 0;
    margin:
        clamp(0.35rem, 1vw, 0.7rem)
        auto
        clamp(0.45rem, 1.2vw, 0.85rem);
    padding: 0;
    flex: 0 0 auto;
}

/*  Printed plate */
.nightmarket-feature__frame {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border:
        1px solid
        rgba(234, 217, 214, 0.22);
    background:
        radial-gradient(
            circle at 50% 42%,
            rgba(91, 32, 139, 0.22),
            transparent 47%
        ),
        linear-gradient(
            180deg,
            rgba(9, 18, 21, 0.26),
            rgba(9, 18, 21, 0.82)
        );
    clip-path: polygon(
        1.2% 5%,
        6% 1.4%,
        20% 2.5%,
        31% 0.8%,
        45% 2%,
        62% 0.4%,
        75% 2.2%,
        91% 0.9%,
        98.6% 5%,
        97.8% 21%,
        99.2% 37%,
        98% 53%,
        99.4% 69%,
        97.5% 85%,
        93.5% 97.8%,
        78% 97%,
        64% 99%,
        48% 97.5%,
        34% 99.2%,
        19% 97%,
        5% 98.5%,
        1.4% 92%,
        2.5% 76%,
        0.8% 60%,
        2.2% 43%,
        0.7% 25%
    );
    box-shadow:
        inset 0 0 32px rgba(0, 255, 225, 0.05),
        inset 0 0 70px rgba(155, 92, 255, 0.07);
}


/* Off-white sticker cut line */
.nightmarket-feature__frame::before {
    content: "";
    position: absolute;
    inset: 8px;
    z-index: 5;
    pointer-events: none;
    border:
        1px dashed
        rgba(234, 217, 214, 0.19);

    clip-path: inherit;
}


/* Halftone / printed grain */
.nightmarket-feature__frame::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    opacity: 0.18;
    background-image:
        radial-gradient(
            circle,
            rgba(234, 217, 214, 0.7)
            0 0.65px,
            transparent 0.85px
        );
    background-size: 6px 6px;
    mix-blend-mode: soft-light;
}


/*  THREE.JS CANVAS */
.nightmarket-feature__scene {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    cursor: crosshair;
    touch-action: pan-y;
}


.nightmarket-feature__scene canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}


/*  Top coordinate label */
.nightmarket-feature__coordinate {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 7;
    color: #c19a3f;
    font-family: var(--font-mono, monospace);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.68;
    pointer-events: none;
}


/*  Main sticker typography */
.nightmarket-feature__title {
    position: absolute;
    left: clamp(1rem, 3vw, 1.8rem);
    bottom: clamp(1rem, 3vw, 1.7rem);
    z-index: 7;
    display: flex;
    align-items: flex-end;
    gap: 0.8rem;
    pointer-events: none;
}


.nightmarket-feature__jp {
    color: #ead9d6;
    font-family:
        var(--font-display),
        "Yu Mincho",
        "Hiragino Mincho ProN",
        serif;
    font-size:
        clamp(1.55rem, 4vw, 2.65rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.055em;
    text-shadow:
        2px 2px 0 #5b208b,
        4px 4px 0 rgba(255, 60, 172, 0.27);
}


/*  Four-dimensional stamp */
.nightmarket-feature__stamp {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 7;
    display: grid;
    place-items: center;
    width: 2.65rem;
    height: 2.65rem;
    border: 1px solid #ff3cac;
    border-radius: 50%;
    color: #ff3cac;
    font-family:
        "Yu Mincho",
        "Hiragino Mincho ProN",
        serif;
    font-size: 0.63rem;
    writing-mode: vertical-rl;
    opacity: 0.78;
    transform: rotate(8deg);
    box-shadow:
        inset 0 0 0 2px #091215,
        inset 0 0 0 3px #ff3cac;
    pointer-events: none;
}



/* ---------------------------------------------------------
   Responsive & Reduced Motion
   --------------------------------------------------------- */
@media (max-width: 760px) {
    .nightmarket-feature {
        width: calc( 100% - clamp(2rem, 8vw, 3rem) );
        min-height: 290px;
    }
    .nightmarket-feature__frame {min-height: 310px;}
    .nightmarket-feature__title {gap: 0.5rem;}
    .nightmarket-feature__en {font-size: 0.45rem;}
}

@media (prefers-reduced-motion: reduce) {
    .nightmarket-feature__scene {cursor: default;}
}


@media (max-width: 900px) {
    .nightmarket-sticker {width: min(225px, 78vw);}
}

@media (prefers-reduced-motion: reduce) {
    .nightmarket-sticker {
        transition: none;
    }
    .nightmarket-sticker:hover {
        transform: rotate(-2.25deg);
    }
}