@font-face {
    font-family: 'Des Montilles';
    src: url('/fonts/DesMontilles-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent pull-to-refresh and overscroll on mobile */
    overscroll-behavior: none;
}

/* ==========================================
   RESPONSIVE & MOBILE OPTIMIZATIONS
   ========================================== */

/* Prevent text selection on interactive elements */
button,
label,
[data-mouse-track] {
    -webkit-user-select: none;
    user-select: none;
}

/* Improve tap targets on mobile */
@media (max-width: 640px) {

    button,
    input,
    select,
    label {
        min-height: 44px;
    }
}

/* Smooth touch scrolling */
* {
    -webkit-tap-highlight-color: transparent;
}

/* 3D transform support for mouse-tracking logo */
[data-mouse-track] {
    perspective: 1000px;
    will-change: transform;
}

/* ==========================================
   LIFE IS STRANGE - STYLE TEXT ANIMATIONS
   ========================================== */

/* Typewriter effect */
.typewriter {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 2s steps(40, end) forwards;
}

.typewriter-cursor::after {
    content: '|';
    animation: blink 0.7s infinite;
    margin-left: 2px;
    opacity: 0.7;
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Character-by-character reveal (JS controlled) */
.char {
    opacity: 0;
    display: inline-block;
    animation: charReveal 0.1s ease forwards;
}

@keyframes charReveal {
    from {
        opacity: 0;
        transform: translateY(10px) rotate(-5deg);
        filter: blur(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
        filter: blur(0);
    }
}

/* Handwritten wobble effect - Life is Strange style */
.handwritten {
    animation: handwrittenWobble 3s ease-in-out infinite;
    transform-origin: center;
}

@keyframes handwrittenWobble {

    0%,
    100% {
        transform: rotate(-0.5deg) translateY(0);
    }

    25% {
        transform: rotate(0.3deg) translateY(-1px);
    }

    50% {
        transform: rotate(-0.3deg) translateY(1px);
    }

    75% {
        transform: rotate(0.5deg) translateY(-0.5px);
    }
}

/* Sketch/drawn line effect */
.sketch-underline {
    position: relative;
}

.sketch-underline::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    animation: sketchLine 0.8s ease forwards 0.5s;
}

@keyframes sketchLine {
    0% {
        transform: scaleX(0) rotate(-1deg);
    }

    50% {
        transform: scaleX(0.6) rotate(0.5deg);
    }

    100% {
        transform: scaleX(1) rotate(-0.5deg);
    }
}

/* Staggered reveal for multiple elements */
.stagger-reveal>* {
    opacity: 0;
    transform: translateY(20px);
    animation: staggerIn 0.6s ease forwards;
}

.stagger-reveal>*:nth-child(1) {
    animation-delay: 0.1s;
}

.stagger-reveal>*:nth-child(2) {
    animation-delay: 0.25s;
}

.stagger-reveal>*:nth-child(3) {
    animation-delay: 0.4s;
}

.stagger-reveal>*:nth-child(4) {
    animation-delay: 0.55s;
}

.stagger-reveal>*:nth-child(5) {
    animation-delay: 0.7s;
}

.stagger-reveal>*:nth-child(6) {
    animation-delay: 0.85s;
}

@keyframes staggerIn {
    from {
        opacity: 0;
        transform: translateY(20px) rotate(-2deg);
        filter: blur(3px);
    }

    to {
        opacity: 1;
        transform: translateY(0) rotate(0);
        filter: blur(0);
    }
}

/* Polaroid photo pop-in effect */
.polaroid-reveal {
    animation: polaroidPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

@keyframes polaroidPop {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-15deg);
    }

    60% {
        opacity: 1;
        transform: scale(1.1) rotate(3deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(-1deg);
    }
}

/* Floating gentle animation */
.float {
    animation: gentleFloat 4s ease-in-out infinite;
}

@keyframes gentleFloat {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-8px) rotate(1deg);
    }
}

/* Ink bleed effect for text */
.ink-bleed {
    animation: inkBleed 0.8s ease forwards;
}

@keyframes inkBleed {
    0% {
        opacity: 0;
        filter: blur(8px);
        letter-spacing: 0.3em;
    }

    50% {
        opacity: 0.7;
        filter: blur(2px);
        letter-spacing: 0.1em;
    }

    100% {
        opacity: 1;
        filter: blur(0);
        letter-spacing: normal;
    }
}

/* Rewind/time effect */
.rewind {
    animation: rewindEffect 0.5s ease-out forwards;
}

@keyframes rewindEffect {
    0% {
        opacity: 0;
        transform: translateX(50px) skewX(-10deg);
        filter: blur(5px) saturate(2);
    }

    100% {
        opacity: 1;
        transform: translateX(0) skewX(0);
        filter: blur(0) saturate(1);
    }
}

/* Scribble circle highlight */
.scribble-highlight {
    position: relative;
}

.scribble-highlight::before {
    content: '';
    position: absolute;
    inset: -8px -12px;
    border: 2px solid currentColor;
    border-radius: 50% 45% 50% 45%;
    opacity: 0;
    animation: scribbleIn 0.6s ease forwards 0.3s;
    transform: rotate(-3deg);
}

@keyframes scribbleIn {
    0% {
        opacity: 0;
        transform: scale(0.8) rotate(-10deg);
    }

    100% {
        opacity: 0.6;
        transform: scale(1) rotate(-3deg);
    }
}

/* Page turn / note reveal */
.note-reveal {
    animation: noteFlip 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    transform-origin: left center;
    opacity: 0;
}

@keyframes noteFlip {
    0% {
        opacity: 0;
        transform: perspective(800px) rotateY(-90deg);
    }

    100% {
        opacity: 1;
        transform: perspective(800px) rotateY(0deg);
    }
}

/* Input focus glow - journal style */
input:focus,
select:focus {
    animation: journalFocus 0.3s ease forwards;
}

@keyframes journalFocus {
    from {
        box-shadow: 0 2px 0 transparent;
    }

    to {
        box-shadow: 0 2px 0 currentColor;
    }
}

/* ==========================================
   BASE STYLES
   ========================================== */

/* Form elements */
input,
select,
textarea {
    font-family: inherit;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%232d3b2c' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    background-size: 1.5rem;
    padding-right: 2rem;
}

/* Custom checkbox styling */
input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23f3eadf' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z'/%3E%3C/svg%3E");
    background-size: 14px;
    background-position: center;
    background-repeat: no-repeat;
}

/* Standard fade-in */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* HTMX transitions */
.htmx-swapping {
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

/* Focus styles */
input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: none;
}

/* Button hover animation */
button {
    position: relative;
    overflow: hidden;
}

button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity 0.2s ease;
}

button:active::after {
    opacity: 0.1;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(45, 59, 44, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(45, 59, 44, 0.4);
}

/* ==========================================
   LANDING PAGE STYLES
   ========================================== */

/* Fade-in animation with CSS variable delay */
.animate-fade-in {
    animation: landing-fade-in 1s ease forwards;
    animation-delay: var(--animation-delay, 0s);
    opacity: 0;
}

@keyframes landing-fade-in {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    100% {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================
   SCROLL REVEAL ANIMATIONS
   ========================================== */

/* Base: hidden state */
[data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Revealed state */
[data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children in grids */
[data-reveal-stagger]>* {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-reveal-stagger].is-visible>* {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays for children (up to 8) */
[data-reveal-stagger].is-visible>*:nth-child(1) {
    transition-delay: 0.05s;
}

[data-reveal-stagger].is-visible>*:nth-child(2) {
    transition-delay: 0.10s;
}

[data-reveal-stagger].is-visible>*:nth-child(3) {
    transition-delay: 0.15s;
}

[data-reveal-stagger].is-visible>*:nth-child(4) {
    transition-delay: 0.20s;
}

[data-reveal-stagger].is-visible>*:nth-child(5) {
    transition-delay: 0.25s;
}

[data-reveal-stagger].is-visible>*:nth-child(6) {
    transition-delay: 0.30s;
}

[data-reveal-stagger].is-visible>*:nth-child(7) {
    transition-delay: 0.35s;
}

[data-reveal-stagger].is-visible>*:nth-child(8) {
    transition-delay: 0.40s;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {

    [data-reveal],
    [data-reveal-stagger]>* {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Blue edge glow overlay for dark sections */
.landing-glow-overlay {
    position: absolute;
    inset: -48px;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse at 0% 0%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 0%, rgba(59, 130, 246, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 0% 100%, rgba(59, 130, 246, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(59, 130, 246, 0.12) 0%, transparent 50%);
}

/* Lighter version for cream sections */
.landing-glow-overlay-light {
    position: absolute;
    inset: -48px;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse at 0% 0%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 0%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 0% 100%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
}

/* Questionnaire button style matching reference */
.questionnaire-button {
    display: inline-block;
    text-decoration: none;
    cursor: pointer;
}

/* ==========================================
   CITY PICKER MODAL STYLES
   ========================================== */

#city-picker-modal:not(.hidden) .city-modal-backdrop {
    animation: modal-fade-in 0.3s ease forwards;
}

#city-picker-modal:not(.hidden) .city-modal-card {
    animation: modal-slide-up 0.35s ease forwards;
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.city-modal-option {
    background: transparent;
}

.city-modal-option:hover {
    background: rgba(201, 154, 64, 0.08);
}