/* ==========================================================================
   Rifakto — Horizontal Cinema
   ========================================================================== */

/* ==========================================================================
   Variables
   ========================================================================== */

:root {
    --black: #0a0a0a;
    --white: #f5f5f3;
    --accent: #D64933;

    --serif: 'Playfair Display', Georgia, serif;
    --sans: 'Space Grotesk', -apple-system, sans-serif;
}

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

html {
    font-size: 16px;
    background: var(--black);
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--sans);
    background: var(--black);
    color: var(--white);
    overflow-x: hidden;
    overscroll-behavior: none;
}

::selection {
    background: var(--accent);
    color: var(--black);
}

a {
    color: inherit;
    text-decoration: none;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.1);
    z-index: 1000;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.1s ease-out;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 32px 48px;
    padding-top: max(32px, env(safe-area-inset-top));
    padding-left: max(48px, env(safe-area-inset-left));
    padding-right: max(48px, env(safe-area-inset-right));
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.nav-logo {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--white);
    transition: color 0.3s ease;
}

.nav-hint {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.5;
    color: var(--white);
    transition: color 0.3s ease;
}

.nav-hint::after {
    content: ' (1-7)';
    opacity: 0.5;
}

/* Dark nav for light backgrounds */
.nav-dark {
    color: var(--black);
}

.nav-dark .nav-logo,
.nav-dark .nav-hint {
    color: var(--black);
}

/* ==========================================================================
   Horizontal Scroll Container
   ========================================================================== */

.horizontal {
    display: flex;
    width: fit-content;
    height: 100vh;
    height: 100dvh;
}

/* ==========================================================================
   Panel Base
   ========================================================================== */

.panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 100px 80px;
    position: relative;
    overflow: hidden;
}

.panel > *:not(.panel-number) {
    transition: opacity 0.1s ease-out, transform 0.1s ease-out;
    will-change: opacity, transform;
}

@media (max-width: 768px) {
    .panel {
        padding: 80px 32px;
    }
}

.panel-number {
    position: absolute;
    top: 100px;
    right: 80px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.15em;
    opacity: 0.5;
}

@media (max-width: 768px) {
    .panel-number {
        top: 80px;
        right: 32px;
    }
}

/* ==========================================================================
   01: Hero
   ========================================================================== */

.panel-hero {
    background: var(--black);
}

/* Flowing ribbons */
.hero-ribbons {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

@media (max-width: 1024px) and (orientation: portrait) {
    .hero-ribbons {
        top: 5%;
    }
}

@media (max-width: 1366px) and (orientation: landscape) {
    .hero-ribbons {
        top: 10%;
    }
}

.ribbon {
    opacity: 0;
    animation: ribbonFadeIn 1.5s ease-out forwards;
}

.ribbon-1 { animation-delay: 0.3s; }
.ribbon-2 { animation-delay: 0.6s; }
.ribbon-3 { animation-delay: 0.9s; }

@keyframes ribbonFadeIn {
    to {
        opacity: 1;
    }
}


.hero-content {
    max-width: 900px;
    position: relative;
    isolation: isolate;
}

/* Glow that syncs with ribbon */
.hero-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 300px;
    background: radial-gradient(
        ellipse at center,
        rgba(214, 73, 51, 0.3) 0%,
        rgba(214, 73, 51, 0.1) 40%,
        transparent 70%
    );
    filter: blur(60px);
    pointer-events: none;
    z-index: -1;
    animation: glowPulse 10s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.9;
        left: 15%;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        left: 55%;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@media (max-width: 1366px) {
    .hero-content::before {
        width: 250px;
        height: 150px;
        filter: blur(30px);
        animation: glowPulseMobile 10s ease-in-out infinite;
    }
}

@keyframes glowPulseMobile {
    0%, 100% {
        opacity: 0.8;
        left: 50%;
        transform: translate(-50%, -50%) scale(1.1);
    }
    50% {
        opacity: 0.9;
        left: 15%;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes glowPulseLandscape {
    0%, 100% {
        opacity: 0.8;
        left: 30%;
        transform: translate(-50%, -50%) scale(1.1);
    }
    50% {
        opacity: 0.9;
        left: 10%;
        transform: translate(-50%, -50%) scale(1);
    }
}

.hero-title {
    font-family: var(--serif);
    font-size: clamp(80px, 18vw, 220px);
    font-weight: 400;
    letter-spacing: -0.04em;
    line-height: 1;
    padding-bottom: 0.1em;
    margin-left: -0.035em;
    margin-bottom: -0.05em;
    cursor: default;
    transform-origin: left center;
    width: fit-content;
    background: linear-gradient(
        90deg,
        #f5f5f3 0%,
        #f5f5f3 40%,
        #D64933 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleGradientFlow 10s ease-in-out infinite;
}


@keyframes titleGradientFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}


@media (max-width: 1366px) {
    .hero-title {
        animation: titleGradientFlowMobile 10s ease-in-out infinite;
    }
}

@keyframes titleGradientFlowMobile {
    0%, 100% { background-position: 100% 50%; }
    50% { background-position: 0% 50%; }
}

.hero-sub {
    font-family: var(--sans);
    font-size: clamp(14px, 1.5vw, 18px);
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    opacity: 0.5;
}

.hero-arrow {
    position: absolute;
    bottom: 100px;
    right: 80px;
    width: 48px;
    height: 24px;
    color: var(--white);
    animation: arrowSlide 2.5s ease-out infinite;
}

@keyframes arrowSlide {
    0% {
        transform: translateX(0);
        opacity: 0;
    }
    20% {
        transform: translateX(0);
        opacity: 0.35;
    }
    80% {
        transform: translateX(24px);
        opacity: 0.35;
    }
    100% {
        transform: translateX(32px);
        opacity: 0;
    }
}

/* ==========================================================================
   02: Statement
   ========================================================================== */

.panel-statement {
    background: var(--white);
    color: var(--black);
}

.statement {
    font-family: var(--sans);
    font-size: clamp(32px, 6vw, 72px);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.03em;
    max-width: 800px;
}

.statement em {
    font-family: var(--serif);
    font-style: italic;
    color: var(--accent);
    display: inline-block;
    cursor: default;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                text-shadow 0.4s ease,
                color 0.4s ease;
}

@media (hover: hover) {
    .statement em:hover {
        transform: translateY(-3px) rotate(-1deg);
        color: #E85A45;
        text-shadow:
            0 4px 20px rgba(214, 73, 51, 0.4),
            0 2px 6px rgba(214, 73, 51, 0.2);
    }
}

/* ==========================================================================
   03: Philosophy
   ========================================================================== */

.panel-philosophy {
    background: var(--black);
}

.philosophy {
    max-width: 1000px;
}

.philosophy p {
    font-family: var(--serif);
    margin-bottom: 16px;
}

.philosophy-1 {
    font-size: clamp(20px, 3vw, 32px);
    font-weight: 400;
    margin-bottom: 32px;
    opacity: 0.4;
}

.philosophy-2 {
    font-size: clamp(28px, 5vw, 56px);
    line-height: 1.2;
    opacity: 0.5;
}

.philosophy-3 {
    font-size: clamp(36px, 7vw, 84px);
    color: var(--accent);
    font-style: italic;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-left: -0.1em;
    padding-left: 0.1em;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.philosophy-3.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   05: Proof
   ========================================================================== */

.panel-proof {
    background: var(--accent);
    color: var(--white);
}

.proof {
    max-width: 700px;
}

.proof-quote {
    font-family: var(--serif);
    font-size: clamp(28px, 4vw, 48px);
    font-weight: 400;
    font-style: italic;
    line-height: 1.4;
    margin-bottom: 48px;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}

@media (hover: hover) {
    .proof-quote:hover {
        transform: scale(1.02);
    }
}

.proof-cite {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.proof-cite strong {
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.proof-cite span {
    font-size: 14px;
    opacity: 0.8;
}

/* ==========================================================================
   04: Services
   ========================================================================== */

.panel-services {
    background: var(--white);
    color: var(--black);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 48px;
}

.services-title {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0.4;
    margin-bottom: 32px;
}

.services-list {
    list-style: none;
}

.services-list li {
    padding: 20px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: default;
}

@media (hover: hover) {
    .services-list li:hover {
        padding-left: 20px;
        border-color: var(--accent);
    }

    .services-list li:hover .service-name {
        color: var(--accent);
    }
}

.service-name {
    font-family: var(--serif);
    font-size: clamp(24px, 3.5vw, 42px);
    font-weight: 400;
    display: block;
    transition: color 0.3s ease;
}

.service-desc {
    font-family: var(--sans);
    font-size: 14px;
    display: block;
    margin-top: 6px;
    opacity: 0.5;
}

.services {
    max-width: 600px;
}

/* ==========================================================================
   06: Voices
   ========================================================================== */

.panel-voices {
    background: var(--white);
    color: var(--black);
}

.voices {
    display: flex;
    flex-direction: column;
    gap: 48px;
    max-width: 600px;
}

.voice {
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: default;
}

@media (hover: hover) {
    .voice:hover {
        transform: translateY(-4px);
    }

    .voices:hover .voice:not(:hover) {
        opacity: 0.5;
    }
}

.voice p {
    font-family: var(--serif);
    font-size: clamp(18px, 2.5vw, 26px);
    font-style: italic;
    line-height: 1.5;
    margin-bottom: 12px;
}

.voice span {
    font-family: var(--sans);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.5;
}

/* ==========================================================================
   07: Contact
   ========================================================================== */

.panel-contact {
    background: var(--black);
    justify-content: center;
}

.contact {
    max-width: 600px;
}

.contact-cta {
    font-family: var(--serif);
    font-size: clamp(48px, 8vw, 96px);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 48px;
}

.contact-cta em {
    color: var(--accent);
    display: inline-block;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                text-shadow 0.4s ease;
}

@media (hover: hover) {
    .contact-cta em:hover {
        transform: translateX(8px);
        text-shadow: -8px 0 0 rgba(214, 73, 51, 0.3);
    }
}

.contact-email {
    font-family: var(--sans);
    font-size: clamp(18px, 2.5vw, 28px);
    font-weight: 500;
    display: inline-block;
    padding: 10px 14px;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

.contact-email::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--accent);
    transition: height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: -1;
}

@media (hover: hover) {
    .contact-email:hover::after {
        height: 100%;
    }
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-left > span {
    opacity: 0.3;
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links::before {
    content: '·';
    opacity: 0.3;
}

.footer-links a {
    opacity: 0.3;
    will-change: opacity;
    transition: opacity 0.3s ease;
}

@media (hover: hover) {
    .footer-links a:hover {
        opacity: 1;
    }
}

.footer {
    position: absolute;
    bottom: max(80px, env(safe-area-inset-bottom));
    left: max(80px, env(safe-area-inset-left));
    right: max(80px, env(safe-area-inset-right));
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.footer > span {
    opacity: 0.3;
}

@media (max-width: 768px) {
    .footer {
        bottom: max(32px, env(safe-area-inset-bottom));
        left: max(24px, env(safe-area-inset-left));
        right: max(24px, env(safe-area-inset-right));
    }
}

@media (max-width: 600px) {
    .footer {
        flex-direction: column;
        gap: 4px;
    }
}

/* ==========================================================================
   Mobile: Vertical Scroll
   ========================================================================== */

@media (max-width: 768px) {
    html {
        scroll-snap-type: y mandatory;
    }

    .horizontal {
        flex-direction: column;
        width: 100%;
        height: auto;
    }

    .panel {
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        scroll-snap-align: start;
        padding-top: max(80px, calc(32px + env(safe-area-inset-top)));
        padding-bottom: max(32px, env(safe-area-inset-bottom));
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }

    .nav-hint {
        display: none;
    }

    .hero-arrow {
        display: none;
    }

    .panel-services {
        padding-top: 120px;
        padding-bottom: 120px;
    }

}

/* ==========================================================================
   Mobile Landscape: Vertical scroll with compact layout
   ========================================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    html {
        -webkit-scroll-snap-type: y proximity;
        scroll-snap-type: y proximity;
    }

    body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .horizontal {
        flex-direction: column;
        width: 100%;
        height: auto;
        position: static !important;
        transform: none !important;
    }

    .panel {
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        -webkit-scroll-snap-align: start;
        scroll-snap-align: start;
        padding: max(60px, env(safe-area-inset-top)) max(32px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(32px, env(safe-area-inset-left));
    }

    /* Reset any transforms set by JS on panel content */
    .panel > *:not(.panel-number) {
        opacity: 1 !important;
        transform: none !important;
    }

    .nav {
        padding: 16px max(32px, env(safe-area-inset-right)) 16px max(32px, env(safe-area-inset-left));
    }

    .nav-hint {
        display: none;
    }

    .hero-arrow {
        display: none;
    }

    .panel-number {
        top: 60px;
        right: 32px;
    }

    /* Hero - compact layout */
    .hero-content::before {
        width: 200px;
        height: 120px;
        filter: blur(25px);
        animation: glowPulseLandscape 10s ease-in-out infinite;
    }

    .hero-title {
        font-size: clamp(48px, 15vw, 100px);
    }

    .hero-sub {
        font-size: clamp(12px, 1.5vw, 14px);
    }

    /* Statement */
    .statement {
        font-size: clamp(24px, 5vw, 48px);
    }

    /* Philosophy */
    .philosophy-1 {
        font-size: clamp(14px, 2vw, 20px);
        margin-bottom: 16px;
    }

    .philosophy-2 {
        font-size: clamp(18px, 3.5vw, 36px);
    }

    .philosophy-3 {
        font-size: clamp(24px, 5vw, 56px);
    }

    /* Services - compact layout to fit all items */
    .panel-services {
        padding-top: 48px;
        padding-bottom: 16px;
        gap: 12px;
    }

    .services-title {
        margin-bottom: 8px;
    }

    .services-list li {
        padding: 6px 0;
        border-bottom: none;
    }

    .services-list li:not(:last-child) {
        border-bottom: 1px solid rgba(0,0,0,0.1);
    }

    .service-name {
        font-size: clamp(16px, 2.5vw, 22px);
    }

    .service-desc {
        display: none;
    }

    /* Proof */
    .proof-quote {
        font-size: clamp(20px, 3.5vw, 36px);
        margin-bottom: 24px;
    }

    /* Voices - stack more compactly */
    .voices {
        gap: 24px;
    }

    .voice p {
        font-size: clamp(14px, 2vw, 20px);
        margin-bottom: 6px;
    }

    .voice span {
        font-size: 11px;
    }

    /* Contact - fix overlap issues by using flexbox with space-between */
    .panel-contact {
        padding-top: max(60px, env(safe-area-inset-top));
        padding-bottom: max(24px, env(safe-area-inset-bottom));
        justify-content: space-between;
        align-items: flex-start;
    }

    .contact {
        margin-top: auto;
        margin-bottom: auto;
    }

    .contact-cta {
        font-size: clamp(32px, 8vw, 64px);
        margin-bottom: 16px;
    }

    .contact-email {
        font-size: clamp(14px, 2vw, 20px);
        padding: 6px 10px;
        margin-bottom: 0;
    }

    /* Footer - use normal flow instead of absolute positioning */
    .footer {
        position: static;
        margin-top: auto;
        padding-top: 16px;
        font-size: 11px;
        width: 100%;
    }

    .footer-left {
        gap: 12px;
    }

    .footer-links {
        gap: 12px;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
