/* ============================================================
   JULIETTE IN WONDERLAND — editorial design system
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
    --ivory: #faf6f0;
    --cream: #f2ebe0;
    --ink: #211c18;
    --ink-soft: #6b6159;
    --taupe: #a8998a;
    --accent: #a8542e;
    --line: rgba(33, 28, 24, 0.14);
    --line-light: rgba(250, 246, 240, 0.2);

    --serif: 'Fraunces', Georgia, serif;
    --sans: 'Inter', -apple-system, 'Helvetica Neue', sans-serif;

    --text-display: clamp(3.2rem, 11vw, 9rem);
    --text-h2: clamp(2rem, 4.5vw, 3.6rem);
    --text-h3: clamp(1.8rem, 3.6vw, 3rem);
    --text-body: clamp(1rem, 1.1vw, 1.125rem);
    --text-meta: 0.72rem;

    --space-section: clamp(6rem, 14vh, 11rem);
    --space-gutter: clamp(1.5rem, 5vw, 5rem);

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --dur-slow: 1.1s;
    --dur-med: 0.7s;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--sans);
    font-size: var(--text-body);
    line-height: 1.7;
    background-color: var(--ivory);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.menu-open {
    overflow: hidden;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
}

h1, h2, h3, figure, p, ul {
    margin: 0;
    padding: 0;
}

/* Subtle film grain over everything */
.grain {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Shared: labels & reveals ---------- */
.section-label {
    font-family: var(--sans);
    font-size: var(--text-meta);
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: clamp(2rem, 5vh, 3.5rem);
}

.section-label-light {
    color: rgba(250, 246, 240, 0.55);
}

.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity var(--dur-slow) var(--ease-out),
                transform var(--dur-slow) var(--ease-out);
}

.reveal.in-view {
    opacity: 1;
    transform: none;
}

/* Clip the inner media, not the observed wrapper — a fully-clipped
   element reports zero intersection and the observer never fires */
.reveal-img > img,
.reveal-img > iframe {
    clip-path: inset(0 0 100% 0);
    transition: clip-path 1.2s var(--ease-out);
}

.reveal-img.in-view > img,
.reveal-img.in-view > iframe {
    clip-path: inset(0 0 0 0);
}

.reveal-img img {
    transform: scale(1.08);
    transition: clip-path 1.2s var(--ease-out), transform 1.6s var(--ease-out);
}

.reveal-img.in-view img {
    transform: scale(1);
}

/* ---------- Header ---------- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.4rem var(--space-gutter);
    transition: background-color 0.45s ease, padding 0.45s ease,
                box-shadow 0.45s ease;
}

.site-header.scrolled {
    background-color: rgba(250, 246, 240, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
    box-shadow: 0 1px 0 var(--line);
}

/* Keep the toggle reachable above the full-screen menu */
body.menu-open .site-header {
    z-index: 110;
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

.brand {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-decoration: none;
}

.brand em {
    font-style: italic;
    font-weight: 300;
    color: var(--ink-soft);
}

.desktop-nav ul {
    list-style: none;
    display: flex;
    gap: 2.4rem;
}

.desktop-nav a {
    font-size: var(--text-meta);
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink);
    position: relative;
    padding-bottom: 3px;
}

.desktop-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s var(--ease-out);
}

.desktop-nav a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ---------- Mobile menu ---------- */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 110;
    padding: 10px 4px;
}

.menu-toggle span {
    display: block;
    width: 26px;
    height: 1.5px;
    background-color: var(--ink);
    margin: 7px 0;
    transition: transform 0.35s var(--ease-out);
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(4.25px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    transform: translateY(-4.25px) rotate(-45deg);
}

.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 105;
    background-color: var(--cream);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}

.mobile-menu.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav ul {
    list-style: none;
    text-align: center;
}

.mobile-nav li {
    margin: 1.2rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
    transition-delay: calc(0.08s * var(--i) + 0.15s);
}

.mobile-menu.active .mobile-nav li {
    opacity: 1;
    transform: none;
}

.mobile-nav a {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(2.4rem, 9vw, 3.5rem);
    text-decoration: none;
    color: var(--ink);
}

.mobile-menu-meta {
    font-size: var(--text-meta);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.mobile-menu-meta a {
    text-decoration: none;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background-color: var(--cream);
}

.hero-media {
    position: absolute;
    top: -6%;
    right: 0;
    width: min(52vw, 640px);
    height: 112%;
    will-change: transform;
}

.hero-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, var(--cream) 0%, rgba(242, 235, 224, 0) 38%);
}

.hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    animation: hero-img-in 2.2s var(--ease-out) both;
}

.hero-text {
    position: relative;
    z-index: 2;
    padding: 0 var(--space-gutter);
    max-width: 78vw;
}

.hero-kicker {
    font-size: var(--text-meta);
    font-weight: 500;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 2rem;
    animation: hero-fade-in 1.4s var(--ease-out) 0.9s both;
}

.hero-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: var(--text-display);
    line-height: 0.98;
    letter-spacing: -0.015em;
}

.hero-line {
    display: block;
    overflow: hidden;
}

.hero-line > span {
    display: block;
    animation: hero-line-up 1.3s var(--ease-out) both;
}

.hero-line:nth-child(2) > span {
    animation-delay: 0.18s;
}

.hero-line-italic {
    font-style: italic;
    font-weight: 300;
    margin-left: clamp(1rem, 9vw, 9rem);
    color: var(--accent);
}

.hero-meta {
    margin-top: 2.4rem;
    font-size: 0.92rem;
    line-height: 1.8;
    color: var(--ink-soft);
    animation: hero-fade-in 1.4s var(--ease-out) 1.15s both;
}

.hero-scroll {
    position: absolute;
    bottom: 2.2rem;
    left: var(--space-gutter);
    z-index: 2;
    font-size: var(--text-meta);
    letter-spacing: 0.26em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    gap: 0.9rem;
    animation: hero-fade-in 1.4s var(--ease-out) 1.6s both;
}

.hero-scroll::after {
    content: '';
    width: 1px;
    height: 44px;
    background: var(--ink-soft);
    animation: scroll-hint 2.4s ease-in-out infinite;
    transform-origin: top;
}

@keyframes hero-line-up {
    from { transform: translateY(110%); }
    to   { transform: translateY(0); }
}

@keyframes hero-fade-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

@keyframes hero-img-in {
    from { opacity: 0; transform: scale(1.06); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes scroll-hint {
    0%, 100% { transform: scaleY(0.35); opacity: 0.4; }
    50%      { transform: scaleY(1); opacity: 1; }
}

/* ---------- About ---------- */
.about {
    padding: var(--space-section) var(--space-gutter);
    max-width: 1300px;
    margin: 0 auto;
}

.about-statement {
    font-family: var(--serif);
    font-weight: 400;
    font-size: var(--text-h2);
    line-height: 1.25;
    letter-spacing: -0.01em;
    max-width: 20ch;
    margin-bottom: clamp(3rem, 8vh, 5.5rem);
}

.about-statement em {
    font-style: italic;
    font-weight: 300;
    color: var(--accent);
}

.about-columns {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: clamp(2.5rem, 6vw, 6rem);
    align-items: start;
}

.about-body p {
    margin-bottom: 1.4em;
    color: var(--ink-soft);
    max-width: 46ch;
}

.about-sign {
    margin-top: 3rem;
}

.about-sign img {
    width: 130px;
    height: auto;
    mix-blend-mode: multiply;
}

.about-sign-name {
    font-family: var(--serif);
    font-size: 1.1rem;
    margin-top: 0.8rem;
}

.about-sign-title {
    font-size: var(--text-meta);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-top: 0.3rem;
}

.about-figure {
    position: relative;
    margin-top: clamp(0rem, 6vh, 4rem);
}

.about-figure img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.about-figure figcaption {
    margin-top: 0.9rem;
    font-size: var(--text-meta);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

/* ---------- Work / stories ---------- */
.work {
    padding: var(--space-section) var(--space-gutter);
    background-color: var(--cream);
}

.story {
    display: grid;
    gap: clamp(2rem, 5vw, 5rem);
    align-items: center;
    max-width: 1300px;
    margin: 0 auto clamp(5rem, 12vh, 9rem);
}

.story-right {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
}

.story-left {
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
}

.story-left .story-media {
    order: 2;
}

.story-left .story-text {
    order: 1;
    text-align: right;
}

.story-media {
    overflow: hidden;
}

.story-media img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 1.2s var(--ease-out);
}

.story-media:hover img {
    transform: scale(1.035);
}

.story-index {
    font-size: var(--text-meta);
    letter-spacing: 0.22em;
    color: var(--accent);
    margin-bottom: 1.2rem;
}

.story-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: var(--text-h3);
    line-height: 1.1;
    margin-bottom: 1.4rem;
}

.story-title em {
    font-style: italic;
    font-weight: 300;
}

.story-copy {
    color: var(--ink-soft);
    max-width: 38ch;
    margin-bottom: 1.6rem;
}

.story-left .story-copy {
    margin-left: auto;
}

.story-tags {
    font-size: var(--text-meta);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--taupe);
}

/* Reels */
.work-motion {
    max-width: 1300px;
    margin: 0 auto;
}

.work-motion-head {
    max-width: 50ch;
    margin-bottom: clamp(2.5rem, 6vh, 4rem);
}

.reel-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1.2rem, 3vw, 2.5rem);
}

.reel {
    aspect-ratio: 9 / 16;
    background-color: var(--ivory);
    overflow: hidden;
}

.reel iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ---------- Services ---------- */
.services {
    padding: var(--space-section) var(--space-gutter);
    max-width: 1100px;
    margin: 0 auto;
}

.service-index {
    list-style: none;
    border-top: 1px solid var(--line);
}

.service-item {
    display: grid;
    grid-template-columns: 4rem minmax(0, 5fr) minmax(0, 6fr);
    gap: clamp(1rem, 3vw, 3rem);
    align-items: baseline;
    padding: clamp(1.6rem, 4vh, 2.6rem) 0;
    border-bottom: 1px solid var(--line);
    transition: padding-left 0.5s var(--ease-out);
}

.service-item:hover {
    padding-left: 1.2rem;
}

.service-num {
    font-size: var(--text-meta);
    letter-spacing: 0.2em;
    color: var(--accent);
}

.service-name {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    line-height: 1.2;
}

.service-desc {
    color: var(--ink-soft);
    font-size: 0.95rem;
}

/* ---------- Manifesto ---------- */
.manifesto {
    background-color: var(--ink);
    color: var(--ivory);
    padding: calc(var(--space-section) * 1.15) var(--space-gutter);
}

.manifesto-text {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.7rem, 4vw, 3.2rem);
    line-height: 1.4;
    max-width: 26ch;
    margin: 0 auto;
}

.m-word {
    opacity: 0.16;
    transition: opacity 0.5s ease;
}

.m-word.lit {
    opacity: 1;
}

/* ---------- Collaborations ---------- */
.collabs {
    padding: var(--space-section) var(--space-gutter);
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

.collabs-intro {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.2rem, 2.2vw, 1.6rem);
    color: var(--ink-soft);
    max-width: 34ch;
    margin: 0 auto clamp(3rem, 7vh, 5rem);
}

.logo-wall {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.logo-tile {
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.2rem, 3vw, 2.5rem);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background-color: transparent;
    transition: background-color 0.5s ease;
}

.logo-tile:hover {
    background-color: rgba(255, 255, 255, 0.6);
}

.logo-tile img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    mix-blend-mode: multiply;
    filter: grayscale(1) contrast(0.92);
    opacity: 0.6;
    transition: filter 0.5s ease, opacity 0.5s ease;
}

.logo-tile:hover img {
    filter: grayscale(0);
    opacity: 1;
}

/* ---------- Contact ---------- */
.contact {
    padding: var(--space-section) var(--space-gutter);
    background-color: var(--cream);
    text-align: center;
}

.contact-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.6rem, 7vw, 5.5rem);
    line-height: 1.08;
    letter-spacing: -0.015em;
    max-width: 14ch;
    margin: 0 auto 1.8rem;
}

.contact-title em {
    font-style: italic;
    font-weight: 300;
    color: var(--accent);
}

.contact-copy {
    color: var(--ink-soft);
    max-width: 44ch;
    margin: 0 auto 3rem;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.contact-link {
    font-size: var(--text-meta);
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink);
    padding: 1.1rem 2.4rem;
    border: 1px solid var(--ink);
    transition: background-color 0.4s ease, color 0.4s ease;
}

.contact-link:hover {
    background-color: var(--ink);
    color: var(--ivory);
}

/* ---------- Footer ---------- */
.site-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 2rem var(--space-gutter);
    border-top: 1px solid var(--line);
    font-size: var(--text-meta);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.site-footer p {
    margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .story-right,
    .story-left {
        grid-template-columns: 1fr;
    }

    .story-left .story-media {
        order: 1;
    }

    .story-left .story-text {
        order: 2;
        text-align: left;
    }

    .story-left .story-copy {
        margin-left: 0;
    }

    .service-item {
        grid-template-columns: 3rem 1fr;
    }

    .service-desc {
        grid-column: 2;
    }

    .about-columns {
        grid-template-columns: 1fr;
    }

    .logo-wall {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .hero {
        align-items: flex-end;
        padding-bottom: 14vh;
    }

    .hero-media {
        top: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 68%;
    }

    .hero-media::after {
        background: linear-gradient(180deg, rgba(242, 235, 224, 0.1) 40%, var(--cream) 96%);
    }

    .hero-text {
        max-width: 100%;
    }

    .hero-kicker {
        margin-bottom: 1.2rem;
    }

    .hero-line-italic {
        margin-left: clamp(1rem, 12vw, 4rem);
    }

    .hero-meta {
        margin-top: 1.6rem;
    }

    .hero-scroll {
        display: none;
    }

    .reel-row {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        margin: 0 calc(-1 * var(--space-gutter));
        padding: 0 var(--space-gutter);
        gap: 1rem;
    }

    .reel {
        flex: 0 0 78%;
        scroll-snap-align: center;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal,
    .reveal-img > img,
    .reveal-img > iframe {
        opacity: 1;
        transform: none;
        clip-path: none;
    }

    .reveal-img img {
        transform: none;
    }
}
