/* =========================================================
   domain — retro urban whimsy
   design avoids pure black #000 and pure white #FFF in rendered colors
   Use Intersection Observer with a 0.2 threshold to trigger underline-draw animations on scroll via Intersection Observer. The waviness makes them feel hand-drawn rather than mechanical.
   palette: parchment, clay, charcoal-umber, brick-dust,
            terracotta, mustard ochre, dusk plum, sage mist
   ========================================================= */

:root {
    --c-bg:        #F5ECD7;
    --c-bg-alt:    #E8D5B7;
    --c-text:      #3B2F2F;
    --c-text-2:    #7A5C47;
    --c-accent:    #C4593B;
    --c-accent-2:  #D4A843;
    --c-deco-dark: #4A3244;
    --c-deco-light:#A8B89C;

    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-body:    'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-hand:    'Caveat', 'Brush Script MT', cursive;

    --space-1: 1rem;
    --space-2: 3rem;
    --space-3: 4.85rem;
    --space-4: 7.85rem;
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

em { font-style: italic; color: var(--c-text-2); }

/* The hidden SVG only carries the filter definition. */
.grain-svg {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Fixed paper-grain overlay — subtle texture across the page. */
.paper-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    mix-blend-mode: multiply;
    background: transparent;
    filter: url(#paperGrain);
}

/* =========================================================
   THE ALLEYWAY (hero)
   ========================================================= */
.alleyway {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 110%, rgba(196,89,59,0.15), transparent 60%),
        var(--c-bg);
    padding: clamp(3rem, 6vw, 5rem) 0 clamp(3rem, 5vw, 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.alley-buildings {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 22vw;
    pointer-events: none;
}
.alley-buildings--left  { left: 0; }
.alley-buildings--right { right: 0; }

.building {
    position: absolute;
    width: 70%;
    height: var(--h, 60vh);
    top: var(--t, 10vh);
    background: var(--c-deco-dark);
    border-radius: 42% 58% 63% 37% / 6% 8% 4% 7%;
    opacity: 0;
    transform: translateY(20px);
    animation: building-rise 1.4s 0.2s cubic-bezier(.22,.9,.3,1) forwards;
}
.alley-buildings--left .building { left: 6%; }
.alley-buildings--left .building--mid {
    left: 38%;
    width: 55%;
    background: #5a3d51;
    border-radius: 38% 62% 47% 53% / 4% 6% 3% 5%;
}
.alley-buildings--right .building { right: 6%; }
.alley-buildings--right .building--short {
    right: 40%;
    width: 50%;
    background: #5a3d51;
    border-radius: 56% 44% 38% 62% / 7% 4% 6% 5%;
}

@keyframes building-rise {
    to { opacity: 1; transform: translateY(0); }
}

/* Water towers — shape made by overlapping blobs */
.water-tower {
    position: absolute;
    width: 70px;
    height: 90px;
    pointer-events: none;
}
.water-tower::before {
    /* tank */
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    width: 58px;
    height: 56px;
    background: var(--c-deco-dark);
    border-radius: 48% 52% 45% 55% / 60% 60% 40% 40%;
}
.water-tower::after {
    /* legs (zig pattern) */
    content: '';
    position: absolute;
    left: 14px;
    bottom: 0;
    width: 42px;
    height: 38px;
    border-left: 3px solid var(--c-deco-dark);
    border-right: 3px solid var(--c-deco-dark);
    transform: skewX(-6deg);
}
.water-tower__eye {
    position: absolute;
    left: 28px;
    top: 22px;
    width: 12px;
    height: 12px;
    background: var(--c-bg);
    border-radius: 50%;
    z-index: 1;
    animation: blink 4s var(--blink-delay, 0s) infinite ease-in-out;
}
.water-tower__eye::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: var(--c-text);
    border-radius: 50%;
}
.water-tower__eye--bright {
    background: var(--c-accent-2);
}
.water-tower__eye--bright::after {
    background: var(--c-accent);
}

.water-tower--left  { top: 6vh;  left: 8%;  }
.water-tower--right { top: 12vh; right: 10%; }
.water-tower--inline {
    position: absolute;
    top: 50%;
    right: 8%;
    transform: translateY(-50%);
}

@keyframes blink {
    0%, 90%, 100% { opacity: 1; }
    95%           { opacity: 0; }
}

/* Ivy blobs */
.ivy {
    position: absolute;
    background: var(--c-deco-light);
    opacity: 0.85;
    border-radius: 42% 58% 63% 37% / 45% 62% 38% 55%;
    transform-origin: top center;
    animation: ivy-sway 6s ease-in-out infinite;
}
.ivy--left-1  { left: 14%; top: 12vh; width: 80px; height: 140px; animation-delay: -1s; }
.ivy--left-2  { left: 8%;  top: 60vh; width: 60px; height: 120px; animation-delay: -3s; }
.ivy--right-1 { right: 14%; top: 26vh; width: 70px; height: 160px; animation-delay: -2s; }

.ivy--storefront {
    width: 70px;
    height: 130px;
    left: -36px;
    top: 1rem;
}
.ivy--reverse { left: auto; right: -36px; animation-delay: -2.5s; }

@keyframes ivy-sway {
    0%, 100% { transform: rotate(-3deg); }
    50%      { transform: rotate(4deg);  }
}

/* The corridor between the buildings — where the title lives */
.alley-corridor {
    position: relative;
    width: min(54vw, 720px);
    margin: 0 auto;
    text-align: center;
    z-index: 2;
    padding: clamp(2rem, 5vw, 4rem) 0;
}

.alley-aside {
    font-family: var(--font-hand);
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    color: var(--c-text-2);
    letter-spacing: 0.03em;
    margin: 0 0 0.5rem;
    transform: rotate(-2deg);
    opacity: 0;
    animation: aside-fade 1.2s 0.3s ease-out forwards;
}
@keyframes aside-fade { to { opacity: 1; } }

.alley-title {
    position: relative;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: -0.02em;
    line-height: 1;
    margin: 0 auto 1.2rem;
    color: var(--c-text);
    font-variation-settings: "opsz" 144, "WONK" 1, "SOFT" 100;
    display: inline-block;
}

.title-underline {
    display: block;
    width: 100%;
    height: 18px;
    margin-top: 0.2rem;
    overflow: visible;
}
.title-underline path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: draw-line 1.6s 0.8s cubic-bezier(.55,.1,.3,.95) forwards;
}
@keyframes draw-line { to { stroke-dashoffset: 0; } }

.alley-sub {
    max-width: 38ch;
    margin: 1.2rem auto 0;
    color: var(--c-text-2);
    opacity: 0;
    animation: aside-fade 1.4s 1.6s ease-out forwards;
}

.alley-scrollhint {
    margin-top: clamp(2rem, 5vh, 3.5rem);
    font-family: var(--font-hand);
    color: var(--c-accent);
    font-size: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    opacity: 0;
    animation: aside-fade 1.4s 2.2s ease-out forwards;
}
.alley-arrow {
    display: inline-block;
    animation: arrow-bob 2s ease-in-out infinite;
}
@keyframes arrow-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(6px); }
}

/* =========================================================
   PIGEON  (CSS-drawn from overlapping blobs)
   ========================================================= */
.pigeon {
    position: relative;
    width: 70px;
    height: 50px;
    margin: 1.6rem auto 0;
    animation: pigeon-bob 1.2s ease-in-out infinite;
}

.pigeon__body {
    position: absolute;
    left: 14px;
    top: 14px;
    width: 50px;
    height: 28px;
    background: var(--c-text-2);
    border-radius: 60% 50% 50% 50% / 60% 60% 40% 40%;
}
.pigeon__head {
    position: absolute;
    left: 0;
    top: 6px;
    width: 22px;
    height: 22px;
    background: var(--c-deco-dark);
    border-radius: 50%;
}
.pigeon__beak {
    position: absolute;
    left: -5px;
    top: 14px;
    width: 8px;
    height: 5px;
    background: var(--c-accent-2);
    border-radius: 60% 0 0 60% / 50% 0 0 50%;
}
.pigeon__tail {
    position: absolute;
    right: -2px;
    top: 18px;
    width: 18px;
    height: 14px;
    background: var(--c-text-2);
    border-radius: 0 50% 50% 0 / 0 60% 40% 0;
    transform: rotate(-6deg);
}
.pigeon__leg {
    position: absolute;
    left: 30px;
    top: 40px;
    width: 2px;
    height: 8px;
    background: var(--c-accent);
}
.pigeon__leg::after {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    width: 2px;
    height: 8px;
    background: var(--c-accent);
}

@keyframes pigeon-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

.pigeon--storefront {
    position: absolute;
    right: -24px;
    bottom: -10px;
    transform: scale(0.8);
}

/* =========================================================
   STOREFRONTS (content sections)
   ========================================================= */
.storefront {
    position: relative;
    margin: var(--space-2) auto;
    padding: clamp(2rem, 4vw, 3.5rem) clamp(1.5rem, 4vw, 3rem);
    border-radius: 1rem;
    background: transparent;
    text-align: center;
    border: 2px solid transparent;
}

.storefront--odd  { max-width: 60vw; }
.storefront--even { max-width: 72vw; }
.storefront + .storefront { margin-top: var(--space-3); }
.storefront + .storefront + .storefront { margin-top: var(--space-4); }

/* Animated traced border (uses background-clip + sized gradients) */
.storefront::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    padding: 2px;
    background:
        linear-gradient(90deg, var(--c-accent), var(--c-accent)) top    left  / 0% 2px no-repeat,
        linear-gradient(0deg,  var(--c-accent), var(--c-accent)) top    right / 2px 0% no-repeat,
        linear-gradient(90deg, var(--c-accent), var(--c-accent)) bottom right / 0% 2px no-repeat,
        linear-gradient(0deg,  var(--c-accent), var(--c-accent)) bottom left  / 2px 0% no-repeat;
    pointer-events: none;
    transition: none;
}

.storefront.is-revealed::before {
    background:
        linear-gradient(90deg, var(--c-accent), var(--c-accent)) top    left  / 100% 2px no-repeat,
        linear-gradient(0deg,  var(--c-accent), var(--c-accent)) top    right / 2px 100% no-repeat,
        linear-gradient(90deg, var(--c-accent), var(--c-accent)) bottom right / 100% 2px no-repeat,
        linear-gradient(0deg,  var(--c-accent), var(--c-accent)) bottom left  / 2px 100% no-repeat;
    transition:
        background-size 0.6s 0s   ease-out,
        background-size 0.6s 0.6s ease-out,
        background-size 0.6s 1.2s ease-out,
        background-size 0.6s 1.8s ease-out;
}

.storefront--alt {
    background: var(--c-bg-alt);
}

.storefront__label {
    font-family: var(--font-hand);
    color: var(--c-text-2);
    font-size: 1rem;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 0.8rem;
}

.storefront__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0 0 1.2rem;
    font-variation-settings: "opsz" 144, "WONK" 1;
}

.storefront__body {
    max-width: 52ch;
    margin: 0 auto;
    color: var(--c-text);
}

.storefront--alt .storefront__body { color: var(--c-text); }

/* underline-draw — wavy hand-drawn underline using background */
.underline-draw {
    position: relative;
    display: inline;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 14' preserveAspectRatio='none'><path d='M 4 8 Q 30 1, 56 7 T 112 7 T 168 7 T 216 9' fill='none' stroke='%23C4593B' stroke-width='3' stroke-linecap='round' /></svg>");
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0% 0.4em;
    padding-bottom: 0.15em;
    transition: background-size 1.4s cubic-bezier(.55,.1,.3,.95);
}
.is-revealed .underline-draw,
.reveal.is-revealed .underline-draw {
    background-size: 100% 0.4em;
}

/* Fire-escape decoration between sections */
.fire-escape {
    position: absolute;
    top: -2.5rem;
    left: 10%;
    right: 10%;
    height: 28px;
    pointer-events: none;
    opacity: 0.85;
}
.fire-escape svg { width: 100%; height: 100%; overflow: visible; }
.fire-escape--mirror { transform: scaleX(-1); }
.fire-escape__path {
    stroke-dasharray: 1600;
    stroke-dashoffset: 1600;
    transition: stroke-dashoffset 1.6s 0.2s cubic-bezier(.55,.1,.3,.95);
}
.is-revealed .fire-escape__path {
    stroke-dashoffset: 0;
}

/* Reveal base state */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s ease-out, transform 0.9s ease-out;
}
.reveal.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================================
   THE ROOFTOP (footer)
   ========================================================= */
.rooftop {
    position: relative;
    margin-top: var(--space-4);
    padding: clamp(4rem, 8vw, 7rem) 1rem clamp(3rem, 6vw, 5rem);
    background: linear-gradient(180deg,
        var(--c-bg) 0%,
        #f0d8a8 25%,
        #e6b87a 60%,
        #b56a3e 100%);
    overflow: hidden;
    text-align: center;
}

.skyline {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 180px;
    pointer-events: none;
}
.skyline__blob {
    position: absolute;
    bottom: 0;
    background: var(--c-deco-dark);
    opacity: 0.92;
    transform: translateY(40px);
    opacity: 0;
}
.is-revealed .skyline__blob {
    transform: translateY(0);
    opacity: 0.92;
    transition: transform 1s cubic-bezier(.22,.9,.3,1), opacity 1s ease-out;
}
.is-revealed .skyline__blob--1 { transition-delay: 0.05s; }
.is-revealed .skyline__blob--2 { transition-delay: 0.18s; }
.is-revealed .skyline__blob--3 { transition-delay: 0.32s; }
.is-revealed .skyline__blob--4 { transition-delay: 0.45s; }
.is-revealed .skyline__blob--5 { transition-delay: 0.58s; }

.skyline__blob--1 { left:  3%;  width: 18%; height: 130px; border-radius: 42% 58% 0 0 / 18% 22% 0 0; }
.skyline__blob--2 { left: 22%;  width: 14%; height: 170px; border-radius: 38% 62% 0 0 / 16% 18% 0 0; background: #3a2536; }
.skyline__blob--3 { left: 38%;  width: 22%; height: 110px; border-radius: 50% 50% 0 0 / 24% 22% 0 0; }
.skyline__blob--4 { left: 60%;  width: 16%; height: 150px; border-radius: 46% 54% 0 0 / 20% 18% 0 0; background: #3a2536; }
.skyline__blob--5 { left: 78%;  width: 19%; height: 130px; border-radius: 38% 62% 0 0 / 18% 24% 0 0; }

.skyline__antenna {
    position: absolute;
    bottom: 0;
    width: 2px;
    background: var(--c-deco-dark);
}
.skyline__antenna--1 { left: 30%; height: 200px; }
.skyline__antenna--2 { left: 68%; height: 180px; background: #3a2536; }

.rooftop-tower {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 90px;
}
.rooftop-tower::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    width: 58px;
    height: 56px;
    background: var(--c-deco-dark);
    border-radius: 48% 52% 45% 55% / 60% 60% 40% 40%;
}
.rooftop-tower::after {
    content: '';
    position: absolute;
    left: 14px;
    bottom: 0;
    width: 42px;
    height: 38px;
    border-left: 3px solid var(--c-deco-dark);
    border-right: 3px solid var(--c-deco-dark);
    transform: skewX(-6deg);
}
.rooftop-tower .water-tower__eye {
    position: absolute;
    left: 28px;
    top: 22px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 2;
    animation: blink 4s var(--blink-delay, 0s) infinite ease-in-out;
}

.rooftop-copy {
    position: relative;
    z-index: 2;
    max-width: 56ch;
    margin: 0 auto;
    padding-bottom: 220px;
}
.rooftop-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 1rem;
    color: var(--c-text);
    font-variation-settings: "opsz" 144, "WONK" 1;
}
.rooftop-body { color: var(--c-text); }
.rooftop-credit {
    margin-top: 2rem;
    font-family: var(--font-hand);
    color: var(--c-text-2);
    font-size: 1.1rem;
}

/* =========================================================
   COMPASS NAV
   ========================================================= */
.compass {
    position: fixed;
    right: clamp(1rem, 2vw, 2rem);
    bottom: clamp(1rem, 2vw, 2rem);
    z-index: 50;
}
.compass__pin {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 60% 40% 50% 50% / 50% 50% 40% 60%;
    background: var(--c-accent-2);
    color: var(--c-text);
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(59,47,47,0.18);
    position: relative;
    transition: transform 0.3s ease, background 0.3s ease;
}
.compass__pin:hover { background: var(--c-accent); }
.compass__pin::after {
    content: '';
    position: absolute;
    inset: 14px;
    border-radius: 50%;
    background: var(--c-bg);
}
.compass__needle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    transform: translate(-50%, -50%) rotate(0deg);
    z-index: 1;
}
.compass__needle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -2px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 12px solid var(--c-accent);
    transform: translateX(-50%);
}
.compass__needle::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -2px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 12px solid var(--c-text);
    transform: translateX(-50%);
}

.compass__list {
    position: absolute;
    right: 60px;
    bottom: 0;
    margin: 0;
    padding: 0.6rem 1rem;
    list-style: none;
    background: var(--c-bg);
    border: 2px solid var(--c-accent);
    border-radius: 0.6rem;
    box-shadow: 0 8px 22px rgba(59,47,47,0.2);
    font-family: var(--font-hand);
    font-size: 1.1rem;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(8px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.compass.is-open .compass__list {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
.compass.is-open .compass__pin {
    transform: rotate(20deg) scale(1.05);
    background: var(--c-accent);
}
.compass.is-open .compass__pin .compass__needle {
    animation: needle-spin 1.6s ease-in-out;
}
@keyframes needle-spin {
    0%   { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.compass__list li { line-height: 1.6; }
.compass__list a {
    color: var(--c-text);
    text-decoration: none;
    transition: color 0.2s ease;
}
.compass__list a:hover { color: var(--c-accent); }

/* =========================================================
   RESPONSIVE — let alleys collapse a bit on small screens
   ========================================================= */
@media (max-width: 900px) {
    .alley-buildings { width: 18vw; }
    .alley-corridor  { width: 70vw; }
    .storefront--odd  { max-width: 80vw; }
    .storefront--even { max-width: 88vw; }
    .water-tower--right { right: 4%; }
    .water-tower--left  { left: 4%; }
}
@media (max-width: 600px) {
    .alley-buildings { width: 14vw; }
    .alley-corridor  { width: 80vw; }
    .building { width: 80%; }
    .storefront--odd, .storefront--even { max-width: 92vw; }
    .compass__list { font-size: 1rem; }
}
