/* ============================================== */
/* JJUGGL.dev — pop-art darkroom                  */
/* hand-printed broadside about failure & craft   */
/* ============================================== */

/* ---- Reset / Base ---- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-radius: 0; /* sharp angles only */
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #F4E9D2; /* Rag Cream */
    color: #0B0B0F; /* Press Black */
    font-family: 'DM Mono', monospace;
    font-size: 15px;
    line-height: 1.55;
    overflow-x: hidden;
    min-height: 260vh; /* 2.6 viewport heights tall */
    position: relative;
    transition: transform 720ms cubic-bezier(0.65, 0, 0.35, 1),
                filter 720ms cubic-bezier(0.65, 0, 0.35, 1);
    transform-origin: 50% 50%;
}

body.zoomed {
    transform: scale(2.4);
}

body.zoomed-out-others {
    filter: saturate(0.3);
}

/* ---- Paper Noise Overlay ---- */
#paper-noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: multiply;
    opacity: 0.6;
}

#defs-svg {
    position: absolute;
    width: 0;
    height: 0;
}

/* ---- Fixed SVG Overlay: Z-bar, reg ticks, smudges ---- */
#overlay-svg {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
}

#z-bar line {
    stroke: #0B0B0F;
}

.reg-tick {
    transform-origin: center;
}

.smudge {
    transform-origin: center;
    animation: smudge-breath 6.4s ease-in-out infinite;
}

.smudge:nth-child(2) {
    animation-delay: 1.8s;
}
.smudge:nth-child(3) {
    animation-delay: 3.6s;
}

@keyframes smudge-breath {
    0%, 100% { opacity: 0.78; }
    50%      { opacity: 0.92; }
}

/* ---- ACT I — Vertex A wordmark + Vertex B bubble ---- */
#act-one {
    position: relative;
    width: 100%;
    height: 100vh;
    padding: 6vh 6vw 0 6vw;
    z-index: 5;
}

#wordmark-wrap {
    position: absolute;
    top: 8vh;
    left: 6vw;
    max-width: 70vw;
    z-index: 6;
}

#wordmark {
    font-family: 'Bowlby One', sans-serif;
    font-weight: 400;
    font-size: clamp(72px, 14vw, 240px);
    letter-spacing: -0.02em;
    line-height: 0.86;
    color: #7A0E2C; /* Garnet */
    display: block;
    text-transform: uppercase;
    filter: url(#ink-bleed);
}

.wm-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) scale(0.7);
    animation: wm-land 280ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.wm-letter:nth-child(1) { animation-delay: 80ms; }
.wm-letter:nth-child(2) { animation-delay: 200ms; }
.wm-letter:nth-child(3) { animation-delay: 320ms; }
.wm-letter:nth-child(4) { animation-delay: 440ms; }
.wm-letter:nth-child(5) { animation-delay: 560ms; }
.wm-letter:nth-child(6) { animation-delay: 680ms; }

.wm-dot {
    display: inline-block;
    color: #E6B829; /* citrine spark */
    opacity: 0;
    animation: wm-land 280ms cubic-bezier(0.34, 1.56, 0.64, 1) 920ms forwards;
}

.wm-tld {
    display: inline-block;
    font-size: 0.42em;
    color: #0E5C3F; /* emerald */
    transform: skewX(-8deg) translateY(-0.4em);
    margin-left: 0.05em;
    opacity: 0;
    animation: wm-land 280ms cubic-bezier(0.34, 1.56, 0.64, 1) 1060ms forwards;
}

@keyframes wm-land {
    0%   { opacity: 0; transform: translateY(20px) scale(0.7); }
    70%  { opacity: 1; transform: translateY(-4px) scale(1.05); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

#wordmark-tag {
    margin-top: 1.2em;
    font-family: 'Caveat', cursive;
    font-size: clamp(18px, 1.8vw, 28px);
    color: #0E5C3F;
    transform: rotate(-2.2deg);
    transform-origin: left top;
    max-width: 32em;
    opacity: 0;
    animation: tag-in 600ms ease-out 1400ms forwards;
}

@keyframes tag-in {
    0%   { opacity: 0; transform: rotate(-2.2deg) translateY(8px); }
    100% { opacity: 1; transform: rotate(-2.2deg) translateY(0); }
}

/* ---- Bubble (shared) ---- */
.bubble-container {
    position: absolute;
    cursor: pointer;
    z-index: 7;
    transition: transform 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bubble-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.bubble-highlight {
    transition: transform 380ms cubic-bezier(0.65, 0, 0.35, 1);
    transform-origin: 296px 118px;
}

.bubble-container:hover .bubble-highlight {
    transform: rotate(-30deg);
}

.citrine-spark {
    transition: transform 380ms cubic-bezier(0.65, 0, 0.35, 1);
    transform-origin: 296px 118px;
}

.bubble-container:hover .citrine-spark {
    transform: rotate(-30deg);
}

.bubble-secret {
    opacity: 0;
    transition: opacity 280ms ease-out 320ms;
}

body.zoomed .bubble-secret.active {
    opacity: 1;
}

.bubble-label {
    position: absolute;
    bottom: -1.4em;
    left: 0;
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(11px, 1vw, 16px);
    letter-spacing: 0.18em;
    color: #0B0B0F;
    transform: skewX(-8deg);
    background: #E6B829;
    padding: 0.2em 0.6em;
    border: 2.5px solid #0B0B0F;
}

/* Vertex B: sapphire bubble */
#bubble-sapphire {
    top: 12vh;
    right: 6vw;
    width: clamp(180px, 22vw, 380px);
    aspect-ratio: 1 / 1;
    animation: bubble-pop 280ms cubic-bezier(0.34, 1.56, 0.64, 1) 1500ms backwards,
               bubble-drift 11s ease-in-out 1800ms infinite;
}

@keyframes bubble-pop {
    0%   { opacity: 0; transform: scale(0); }
    70%  { opacity: 1; transform: scale(1.08); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes bubble-drift {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-18px); }
}

/* Vertex C area: emerald bubble */
#bubble-emerald {
    bottom: 12vh;
    left: 12vw;
    width: clamp(160px, 20vw, 340px);
    aspect-ratio: 1 / 1;
    animation: bubble-drift 11s ease-in-out 0s infinite;
}

/* Vertex D: garnet bubble */
#bubble-garnet {
    bottom: 18vh;
    right: 10vw;
    width: clamp(180px, 22vw, 380px);
    aspect-ratio: 1 / 1;
    animation: bubble-drift 11s ease-in-out 3s infinite;
}

/* ---- ACT II — diagonal: confession list ---- */
#act-two {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 8vh 8vw;
    z-index: 4;
}

.run-label {
    font-family: 'Bowlby One', sans-serif;
    font-weight: 400;
    font-size: clamp(36px, 5.5vw, 92px);
    color: #7A0E2C;
    line-height: 0.9;
    transform: skewX(-8deg) rotate(-2deg);
    transform-origin: left top;
    margin-bottom: 0.6em;
    display: inline-block;
    text-transform: lowercase;
}

.run-label-tilt-pos {
    transform: skewX(-8deg) rotate(2deg);
    color: #1A2E78;
}

.run-label-tilt-neg {
    transform: skewX(-8deg) rotate(-3deg);
    color: #5B2A86;
}

#confession-list {
    margin-top: 4vh;
    max-width: 78vw;
    margin-left: auto;
    margin-right: auto;
    transform: rotate(-22deg) translateX(-3vw);
    transform-origin: 30% 50%;
    /* the diagonal run #1 — tilted -22° */
}

.confession-item {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    font-size: clamp(13px, 1.1vw, 18px);
    color: #0E5C3F;
    margin-bottom: 1.2em;
    max-width: 44em;
    line-height: 1.55;
    /* sharp-clipped paragraph wrap */
    clip-path: polygon(0 0, 100% 0, 96% 100%, 4% 100%);
    padding: 0.4em 1.6em 0.4em 1.6em;
    background: rgba(244, 233, 210, 0.6);
    border-left: 3px solid #7A0E2C;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.confession-item.in-view {
    opacity: 1;
    transform: translateX(0);
}

.confession-item .bullet {
    display: inline-block;
    color: #7A0E2C;
    font-family: 'Bowlby One', sans-serif;
    font-size: 1.4em;
    margin-right: 0.4em;
    transform: translateY(0.08em);
}

.hand-note {
    font-family: 'Caveat', cursive;
    color: #7A0E2C;
    font-size: 1.4em;
    margin-left: 0.4em;
}

.hand-arrow {
    font-family: 'Caveat', cursive;
    color: #7A0E2C;
    font-size: 1.5em;
    transform: rotate(-3deg);
    display: inline-block;
    margin-left: 0.4em;
}

/* ---- Comic SFX panels ---- */
.sfx {
    position: absolute;
    width: clamp(120px, 14vw, 220px);
    aspect-ratio: 1 / 1;
    z-index: 8;
    pointer-events: none;
    opacity: 0;
    transform: scale(0);
}

.sfx.fired {
    animation: sfx-punch 360ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes sfx-punch {
    0%   { opacity: 0; transform: scale(0) rotate(-12deg); }
    60%  { opacity: 1; transform: scale(1.18) rotate(2deg); }
    100% { opacity: 1; transform: scale(1) rotate(0); }
}

.sfx svg {
    width: 100%;
    height: 100%;
    display: block;
}

.sfx span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(18px, 2.4vw, 38px);
    color: #F4E9D2;
    text-transform: uppercase;
    transform: skewX(-8deg);
    letter-spacing: 0.05em;
    text-align: center;
    line-height: 1;
}

.sfx-thwump {
    top: 64vh;
    left: 22vw;
}

.sfx-plop {
    bottom: 8vh;
    left: 6vw;
}

.sfx-kersplat {
    top: 38vh;
    right: 28vw;
}

.sfx-miss {
    bottom: 32vh;
    left: 22vw;
}

/* speed-stripes */
.speed-stripes {
    position: absolute;
    bottom: 12vh;
    left: 14vw;
    width: 22vw;
    height: 18vh;
    z-index: 7;
    pointer-events: none;
    opacity: 0;
    transition: opacity 480ms ease-out;
}

.speed-stripes.fired {
    opacity: 1;
    animation: stripes-fade 1200ms ease-out forwards;
}

@keyframes stripes-fade {
    0%   { opacity: 0; transform: translateX(-30px); }
    40%  { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(20px); }
}

/* ---- ACT III — Mid-air gallery ---- */
#act-three {
    position: relative;
    width: 100%;
    min-height: 80vh;
    padding: 6vh 6vw;
    z-index: 4;
}

#act-three .run-label {
    margin-left: 14vw;
}

#repo-gallery {
    position: relative;
    width: 100%;
    height: 60vh;
    margin-top: 2vh;
    transform: rotate(22deg);
    transform-origin: 30% 50%;
}

.repo-bubble {
    position: absolute;
    width: clamp(100px, 11vw, 200px);
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: 50% 100%;
}

.repo-bubble:hover {
    transform: scale(1.12);
}

.repo-bubble:hover .bubble-highlight,
.repo-bubble:hover polygon[fill="#FFFFFF"] {
    transform: rotate(-30deg);
}

.repo-bubble svg {
    width: 100%;
    height: 100%;
    display: block;
}

.repo-bubble polygon[fill="#FFFFFF"] {
    transition: transform 380ms cubic-bezier(0.65, 0, 0.35, 1);
    transform-origin: 148px 68px;
}

.repo-bubble:nth-child(1) {
    top: 4vh;
    left: 18vw;
    animation: bubble-drift 9s ease-in-out 0s infinite;
}
.repo-bubble:nth-child(2) {
    top: 22vh;
    left: 32vw;
    animation: bubble-drift 10s ease-in-out 1s infinite;
}
.repo-bubble:nth-child(3) {
    top: 8vh;
    left: 50vw;
    animation: bubble-drift 11s ease-in-out 2s infinite;
}
.repo-bubble:nth-child(4) {
    top: 28vh;
    left: 68vw;
    animation: bubble-drift 12s ease-in-out 1.5s infinite;
}

.repo-name {
    position: absolute;
    bottom: -2.4em;
    left: 50%;
    transform: translateX(-50%) skewX(-8deg);
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(10px, 0.9vw, 14px);
    color: #F4E9D2;
    background: #0B0B0F;
    padding: 0.2em 0.5em;
    letter-spacing: 0.1em;
    white-space: nowrap;
    text-transform: lowercase;
}

.repo-meta {
    position: absolute;
    bottom: -4em;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'DM Mono', monospace;
    font-size: clamp(9px, 0.8vw, 12px);
    color: #0E5C3F;
    white-space: nowrap;
}

/* ---- ACT IV — vertex D ---- */
#act-four {
    position: relative;
    width: 100%;
    min-height: 80vh;
    padding: 8vh 8vw;
    z-index: 4;
}

#act-four .run-label {
    margin-left: 6vw;
}

#caught-list {
    margin-top: 4vh;
    max-width: 60vw;
    transform: rotate(-22deg);
    transform-origin: 30% 50%;
    margin-left: 8vw;
}

.caught-item {
    font-family: 'DM Mono', monospace;
    font-size: clamp(13px, 1.2vw, 18px);
    color: #5B2A86; /* amethyst */
    margin-bottom: 1.4em;
    max-width: 40em;
    line-height: 1.65;
    padding-left: 0.3em;
    border-left: 3px solid #5B2A86;
    padding-top: 0.4em;
    padding-bottom: 0.4em;
    padding-right: 1em;
    background: rgba(244, 233, 210, 0.55);
    clip-path: polygon(0 0, 100% 0, 97% 100%, 3% 100%);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.caught-item.in-view {
    opacity: 1;
    transform: translateY(0);
}

.dropcap {
    font-family: 'Bowlby One', sans-serif;
    color: #7A0E2C;
    font-size: 2.6em;
    float: left;
    line-height: 0.85;
    margin-right: 0.12em;
    margin-top: 0.04em;
}

/* the "drop in →" pentagon CTA */
#drop-in {
    position: absolute;
    bottom: 8vh;
    right: 8vw;
    width: clamp(180px, 22vw, 340px);
    aspect-ratio: 320 / 240;
    text-decoration: none;
    z-index: 9;
    display: block;
    cursor: pointer;
    transition: transform 380ms cubic-bezier(0.65, 0, 0.35, 1);
}

.pentagon-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

#drop-in:hover {
    transform: scale(1.04);
}

#drop-in-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 380ms ease-out;
}

#drop-in.caught #drop-in-path {
    stroke-dashoffset: 0;
}

#drop-in:hover #drop-in-path {
    stroke-dashoffset: 0;
}

/* ---- Colophon ---- */
#colophon {
    position: relative;
    width: 100%;
    padding: 4vh 8vw 6vh 8vw;
    z-index: 5;
    background: #F4E9D2;
    border-top: 4px solid #0B0B0F;
}

#colophon p {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: #0B0B0F;
    margin-bottom: 0.4em;
    max-width: 60em;
}

#colophon p:first-child {
    font-family: 'Caveat', cursive;
    font-size: 18px;
    color: #7A0E2C;
    transform: rotate(-1.4deg);
    margin-bottom: 1em;
}

/* ---- Zoom instruction ---- */
#zoom-instruction {
    position: fixed;
    bottom: 1.2em;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Caveat', cursive;
    font-size: 18px;
    color: #7A0E2C;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

body.show-zoom-tip #zoom-instruction {
    opacity: 0.9;
}

body.zoomed #zoom-instruction {
    opacity: 0;
}

/* ---- Citrine spark zoom-rotation when zoomed ---- */
body.zoomed .bubble-container.active .citrine-spark,
body.zoomed .bubble-container.active .bubble-highlight {
    transform: rotate(-30deg);
}

/* ---- Responsive ---- */
@media (max-width: 720px) {
    body {
        min-height: 320vh;
    }
    #wordmark {
        font-size: clamp(56px, 18vw, 120px);
    }
    #bubble-sapphire {
        width: 34vw;
        top: 30vh;
    }
    #bubble-emerald {
        width: 30vw;
    }
    #bubble-garnet {
        width: 32vw;
    }
    #confession-list,
    #caught-list,
    #repo-gallery {
        transform: rotate(-10deg);
    }
    .repo-bubble {
        width: 22vw;
    }
    .repo-bubble:nth-child(1) { top: 2vh; left: 6vw; }
    .repo-bubble:nth-child(2) { top: 18vh; left: 36vw; }
    .repo-bubble:nth-child(3) { top: 34vh; left: 10vw; }
    .repo-bubble:nth-child(4) { top: 50vh; left: 40vw; }
    .sfx { width: 22vw; }
}
