/* ============================================
   loves.day - Graffiti Love Declaration Wall
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --wall-concrete: #e0d8d0;
    --concrete-dark: #d0c8c0;
    --muted-rose: #b86a78;
    --muted-teal: #6a8c8c;
    --muted-gold: #b8a050;
    --muted-indigo: #5a5a8c;
    --muted-sage: #7a9070;
    --text-shadow: #0a0a0a;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--wall-concrete);
    overflow-x: hidden;
    font-family: 'Inter', sans-serif;
    color: var(--text-shadow);
    position: relative;
}

/* --- Concrete Wall Texture Overlay --- */
#wall-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

#svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Hero Section --- */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1;
}

#hero-title {
    font-family: 'Recursive', sans-serif;
    font-weight: 900;
    font-variation-settings: 'CASL' 1;
    font-size: clamp(48px, 14vw, 180px);
    color: var(--muted-rose);
    transform: skewX(-3deg);
    position: relative;
    z-index: 2;
    text-shadow: 2px 4px 8px rgba(10, 10, 10, 0.05);
    letter-spacing: -0.02em;
    line-height: 1;
    display: flex;
    align-items: baseline;
}

.hero-letter {
    display: inline-block;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s ease-out, transform 0.3s ease-out;
    position: relative;
}

.hero-letter.visible {
    opacity: 1;
    transform: scale(1);
}

/* Drip effects on specific letters */
.hero-letter[data-delay="0"].visible::after,
.hero-letter[data-delay="4"].visible::after,
.hero-letter[data-delay="8"].visible::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 3px;
    height: 0;
    background: linear-gradient(to bottom, var(--muted-rose), transparent);
    border-radius: 0 0 2px 2px;
    animation: drip 1.2s ease-in forwards 0.3s;
}

.hero-letter[data-delay="0"].visible::after {
    height: 0;
    left: 30%;
}

.hero-letter[data-delay="4"].visible::after {
    left: 60%;
}

.hero-letter[data-delay="8"].visible::after {
    left: 45%;
    animation-delay: 0.5s;
}

@keyframes drip {
    0% { height: 0; opacity: 1; }
    70% { height: 50px; opacity: 0.8; }
    100% { height: 65px; opacity: 0; }
}

/* Overspray halo behind title */
#hero-overspray {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(300px, 80vw, 900px);
    height: clamp(120px, 20vh, 250px);
    background: radial-gradient(ellipse, rgba(184, 106, 120, 0.1) 0%, transparent 70%);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

#hero-overspray.visible {
    opacity: 1;
}

.hero-dot {
    color: var(--muted-gold);
}

/* Scroll hint */
#scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    opacity: 0;
    animation: fadeInUp 1s ease-out 2.5s forwards;
}

.scroll-arrow {
    display: block;
    width: 24px;
    height: 24px;
    border-right: 2px solid var(--concrete-dark);
    border-bottom: 2px solid var(--concrete-dark);
    transform: rotate(45deg);
    animation: bounceDown 1.5s ease-in-out infinite;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 0.5; transform: translateX(-50%) translateY(0); }
}

@keyframes bounceDown {
    0%, 100% { transform: rotate(45deg) translateY(0); }
    50% { transform: rotate(45deg) translateY(8px); }
}

/* --- The Wall Section --- */
#the-wall {
    position: relative;
    width: 100%;
    min-height: 300vh;
    padding: 0;
    z-index: 2;
}

/* --- Declarations --- */
.declaration {
    position: absolute;
    left: var(--x, 10%);
    top: var(--y, 0);
    transform: rotate(var(--angle, 0deg)) scale(var(--scale, 1));
    opacity: 0;
    max-width: 45%;
    z-index: calc(var(--scale, 1) * 10);
    transition: opacity 0.4s ease-out;
    will-change: opacity;
}

.declaration.in-view {
    opacity: var(--op, 0.9);
}

/* Overspray halo on declarations */
.declaration::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% + 60px);
    height: calc(100% + 40px);
    background: radial-gradient(ellipse, var(--color) 0%, transparent 70%);
    opacity: 0.08;
    z-index: -1;
    pointer-events: none;
    border-radius: 50%;
}

/* Drip effect on declarations */
.declaration[data-drip="true"] .loved::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 20%;
    width: 2px;
    height: 0;
    background: linear-gradient(to bottom, var(--color), transparent);
    border-radius: 0 0 1px 1px;
    opacity: 0;
    transition: height 0.8s ease-in, opacity 0.3s ease-out;
}

.declaration[data-drip="true"].in-view .loved::after {
    height: 35px;
    opacity: 0.7;
}

/* Tag name (the person) */
.tag {
    display: block;
    font-family: 'Recursive', sans-serif;
    font-weight: 300;
    font-variation-settings: 'CASL' 0.3;
    font-size: clamp(11px, 1.2vw, 16px);
    color: var(--color);
    opacity: 0.6;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

/* Connector word */
.connector {
    display: block;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: var(--text-shadow);
    opacity: 0.35;
    margin-bottom: 4px;
}

/* The loved thing */
.loved {
    display: block;
    font-family: 'Recursive', sans-serif;
    font-weight: 700;
    font-variation-settings: 'CASL' 0.7;
    font-size: clamp(16px, 3vw, 48px);
    color: var(--color);
    line-height: 1.1;
    position: relative;
    text-shadow: 1px 2px 4px rgba(10, 10, 10, 0.05);
}

/* Variable font diversity: different declarations get different weights/casual */
.declaration:nth-child(3n) .loved {
    font-weight: 900;
    font-variation-settings: 'CASL' 1;
}

.declaration:nth-child(3n+1) .loved {
    font-weight: 500;
    font-variation-settings: 'CASL' 0.4;
}

.declaration:nth-child(5n) .loved {
    font-weight: 400;
    font-variation-settings: 'CASL' 0;
    font-size: clamp(14px, 2.2vw, 36px);
}

.declaration:nth-child(7n) .loved {
    font-weight: 800;
    font-variation-settings: 'CASL' 0.9;
    font-size: clamp(20px, 3.5vw, 52px);
}

.declaration:nth-child(4n) .tag {
    font-weight: 400;
    font-variation-settings: 'CASL' 0.6;
}

/* --- Stencil Pieces --- */
.stencil-piece {
    position: absolute;
    top: var(--stencil-top, 50vh);
    left: 50%;
    transform: translateX(-50%);
    width: clamp(250px, 50vw, 500px);
    height: clamp(200px, 35vh, 350px);
    z-index: 5;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.stencil-piece.in-view {
    opacity: 1;
}

.stencil-shape {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    clip-path: inset(0 50% 0 50%);
    transition: clip-path 0.6s ease-out;
}

.stencil-piece.in-view .stencil-shape {
    clip-path: inset(0 0 0 0);
}

.stencil-heart {
    background: var(--muted-rose);
    clip-path: inset(0 50% 0 50%);
}

.stencil-piece.in-view .stencil-heart {
    clip-path: polygon(50% 20%, 65% 5%, 80% 5%, 95% 20%, 95% 45%, 50% 85%, 5% 45%, 5% 20%, 20% 5%, 35% 5%);
}

.stencil-hands {
    background: var(--muted-teal);
    clip-path: inset(0 50% 0 50%);
}

.stencil-piece.in-view .stencil-hands {
    clip-path: polygon(10% 90%, 10% 50%, 20% 30%, 30% 15%, 40% 5%, 50% 10%, 60% 5%, 70% 15%, 80% 30%, 90% 50%, 90% 90%, 50% 75%);
}

.stencil-flower {
    background: var(--muted-gold);
    clip-path: inset(0 50% 0 50%);
}

.stencil-piece.in-view .stencil-flower {
    clip-path: polygon(50% 0%, 63% 25%, 100% 30%, 75% 55%, 80% 90%, 50% 72%, 20% 90%, 25% 55%, 0% 30%, 37% 25%);
}

.stencil-counter {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(36px, 8vw, 96px);
    color: var(--wall-concrete);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    line-height: 1;
}

.stencil-label {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 2.5vw, 28px);
    color: var(--wall-concrete);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.8;
    margin-top: 4px;
}

/* --- Wall End / Fade-out --- */
#wall-end {
    position: relative;
    width: 100%;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    background: linear-gradient(to bottom, transparent 0%, var(--concrete-dark) 60%, var(--wall-concrete) 100%);
}

#end-message {
    font-family: 'Recursive', sans-serif;
    font-weight: 900;
    font-variation-settings: 'CASL' 1;
    font-size: clamp(32px, 8vw, 100px);
    color: var(--muted-sage);
    transform: skewX(-2deg);
    opacity: 0;
    transition: opacity 0.8s ease-out;
    text-shadow: 2px 3px 6px rgba(10, 10, 10, 0.05);
    position: relative;
}

#end-message.in-view {
    opacity: 0.85;
}

/* Overspray on end message */
#end-message::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% + 80px);
    height: calc(100% + 60px);
    background: radial-gradient(ellipse, rgba(122, 144, 112, 0.1) 0%, transparent 70%);
    z-index: -1;
    border-radius: 50%;
}

/* Drip on end message */
#end-message::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 35%;
    width: 3px;
    height: 0;
    background: linear-gradient(to bottom, var(--muted-sage), transparent);
    border-radius: 0 0 2px 2px;
    transition: height 1s ease-in;
}

#end-message.in-view::after {
    height: 50px;
}

/* --- Geometric Abstract Background Shapes --- */
#the-wall::before {
    content: '';
    position: absolute;
    top: 20vh;
    left: -5%;
    width: 30vw;
    height: 30vw;
    border: 2px solid rgba(184, 106, 120, 0.06);
    border-radius: 50%;
    transform: rotate(15deg);
    pointer-events: none;
    z-index: 0;
}

#the-wall::after {
    content: '';
    position: absolute;
    top: 120vh;
    right: -8%;
    width: 40vw;
    height: 40vw;
    border: 2px solid rgba(106, 140, 140, 0.05);
    transform: rotate(-10deg);
    pointer-events: none;
    z-index: 0;
}

/* Additional geometric shapes via wall background elements */
#the-wall {
    background-image:
        linear-gradient(135deg, rgba(90, 90, 140, 0.03) 25%, transparent 25%),
        linear-gradient(225deg, rgba(184, 160, 80, 0.03) 25%, transparent 25%),
        linear-gradient(315deg, rgba(122, 144, 112, 0.02) 25%, transparent 25%);
    background-size: 400px 400px, 600px 600px, 500px 500px;
    background-position: 0 0, 200px 100px, 100px 200px;
}

/* --- Retro Pattern Stencil Bands --- */
.stencil-piece::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -10%;
    right: -10%;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--concrete-dark) 0px,
        var(--concrete-dark) 8px,
        transparent 8px,
        transparent 16px
    );
    opacity: 0.4;
}

.stencil-piece::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: -10%;
    right: -10%;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--concrete-dark) 0px,
        var(--concrete-dark) 8px,
        transparent 8px,
        transparent 16px
    );
    opacity: 0.4;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .declaration {
        max-width: 70%;
    }

    #hero-title {
        font-size: clamp(36px, 12vw, 80px);
    }

    .stencil-piece {
        width: clamp(200px, 80vw, 350px);
        height: clamp(150px, 30vh, 250px);
    }
}

@media (max-width: 480px) {
    .declaration {
        max-width: 85%;
    }

    .loved {
        font-size: clamp(14px, 5vw, 32px);
    }
}
