/* ============= RESET ============= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100vh;
}

/* ============= BASE ============= */
body {
    position: relative;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #ffffff 0%, #f7efe0 45%, #f0e4cf 100%);
    color: #333025;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Generic links */
a {
    color: #905050;
}
a:hover {
    text-decoration: underline;
}

/* ============= ANIMATIONS ============= */

/* Fade + slide up for important UI */
@keyframes slideFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    opacity: 0;
    animation: slideFadeIn 0.9s ease-out forwards;
}

/* Snap rotation for photos */
@keyframes photoSnap {
    0% {
        transform: rotate(calc(var(--base-rotation, 0deg) - 2deg));
    }
    50% {
        transform: rotate(calc(var(--base-rotation, 0deg) + 2deg));
    }
    100% {
        transform: rotate(calc(var(--base-rotation, 0deg) - 2deg));
    }
}

/* Background layers falling in */
@keyframes bgFall {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Foreground slide-in */
@keyframes fgSlide {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Red lines vertical wave */
@keyframes driftLines {
    0%   { background-position-y: -10px; }
    50%  { background-position-y:  10px; }
    100% { background-position-y: -10px; }
}

/* Flip between two background images */
@keyframes flipVisible {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes flipHidden {
    0%, 49%   { opacity: 0; }
    50%, 100% { opacity: 1; }
}

/* Star idle sine-ish motion */
@keyframes starIdle {
    0% {
        transform: translateY(0px);
        opacity: 1;
    }
    25% {
        transform: translateY(25px);
        opacity: 1;
    }
    50% {
        transform: translateY(0px);
        opacity: 1;
    }
    75% {
        transform: translateY(-25px);
        opacity: 1;
    }
    100% {
        transform: translateY(0px);
        opacity: 1;
    }
}

/* ============= BACKGROUND LAYERS ============= */

.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Base paper (background_0.png) */
.bg-paper {
    z-index: -4;
    background-image: url("images/background_0.png");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center top;
    animation: bgFall 0.8s ease-out forwards;
}

/* Paper stars (background_1.png) */
.bg-stars {
    z-index: 2;
    background-image: url("images/background_1.png");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center top;
    animation:
        bgFall 0.8s ease-out forwards 0.25s,
        starIdle 10s ease-in-out infinite 1s;
}

/* Red lines container (background_2_0 / background_2_1) */
.bg-lines {
    z-index: -3;
    animation:
        bgFall 0.8s ease-out forwards 0.5s,
        driftLines 7s ease-in-out infinite 1.3s;
}

/* Two stacked layers that swap opacity */
.bg-lines::before,
.bg-lines::after {
    content: "";
    position: absolute;
    inset: 0;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center top;
}

/* First red-line image: background_2_0.png */
.bg-lines::before {
    background-image: url("images/background_2_0.png");
    animation: flipVisible 2s steps(1, end) infinite;
}

/* Second red-line image: background_2_1.png */
.bg-lines::after {
    background-image: url("images/background_2_1.png");
    animation: flipHidden 2s steps(1, end) infinite;
}

/* ============= FOREGROUND LAYER ============= */

.fg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.fg-fade {
    background-image: url("images/foreground_0.png");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center top;
    animation: fgSlide 0.8s ease-out forwards;
}

.fg-overlay {
    background-image: url("images/foreground_1.png");
    background-repeat: no-repeat;
    background-size: 100% 110%;
    background-position: top center;  /* stay anchored in the same place */
}


/* ============= HEADER ============= */

.site-header {
    padding: 1.3rem 2.5rem;
    background: #fdf8ef;
    color: #3b3426;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(180, 160, 130, 0.4);
}

.site-header h1 {
    font-size: 1.5rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

nav a {
    margin-left: 1rem;
    text-decoration: none;
    color: #5c5140;
    font-size: 0.95rem;
}
nav a:hover {
    text-decoration: underline;
}

/* ============= MAIN LAYOUT ============= */

main {
    position: relative;
    padding: 2rem 0 3.5rem;
}

/* Stack About + More Info together so height flows correctly */
.text-stack {
    position: absolute;
    top: 50px;
    left: 50px;

    /* shrink/grow like contact card */
    width: clamp(16rem, 35vw, 30rem);
    font-size: clamp(0.8rem, 0.95vw, 1rem);

    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


/* About + More Info sections */
.content-section h2 {
    margin-bottom: 0.5em;
    padding-bottom: 0.3em;
    border-bottom: 2px dashed rgba(160, 140, 110, 0.7);
    font-weight: 600;
    letter-spacing: 0.05em;
    /* scales with .text-stack font-size */
    font-size: 1.3em;
}


.content-section h2 {
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px dashed rgba(160, 140, 110, 0.7);
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Inside the stack, sections should be normal-flow, not absolute */
#about,
#more-info {
    position: static;
    max-width: 100%;
    margin: 0;
}

/* ============= PHOTO AREA ============= */

.hero-canvas {
    position: relative;
    margin: 0;
    width: 100%;
    min-height: 100vh;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    z-index: 1; /* below text/contacts, above bg */
}

/* Wrapper for each photo: positioning + shadow only */
.photo-card {
    position: absolute;
    transform-origin: center center;
    z-index: 2;
    background: transparent;
    border: none;
    box-shadow:
        0 22px 50px rgba(0, 0, 0, 0.5),
        0 2px 6px rgba(0, 0, 0, 0.18);
    overflow: visible;
}

/* Actual photo fills the card */
.photo-card .photo-img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    filter: saturate(0.9) contrast(1.02);
    z-index: 1;
}

/* Border image sits on top of the photo */
.photo-card .photo-frame {
    position: absolute;
    top: -20px;
    left: -20px;
    width: 110%;
    height: 110%;
    object-fit: fill;
    pointer-events: none;
    z-index: 2;
}

/* Fade-in + snap rotation */
.photo-anim {
    opacity: 0;
    animation:
        slideFadeIn 0.25s ease-out forwards,
        photoSnap 2s steps(1, end) var(--snap-delay, 2s) infinite;
}

/* ============= INDIVIDUAL PHOTO PLACEMENT ============= */
/* 50% smaller: widths halved from previous version */

#photo_4 {
    --base-rotation: 12deg;
    --snap-delay: 0.1s;
    width: 15vw;       /* was 12.5vw */
    top: 50%;
    left: 25%;
}

#photo_6 {
    --base-rotation: -9deg;
    --snap-delay: 0.1s;
    width: 11vw;       /* was 8.75vw */
    top: 0%;
    left: 50%;
}

#photo_8 {
    --base-rotation: 20deg;
    --snap-delay: 0.1s;
    width: 9vw;        /* was 6.5vw */
    top: 60%;
    left: 65%;
}

#photo_5 {
    --base-rotation: -22deg;
    --snap-delay: 0.1s;
    width: 10vw;       /* was 7.75vw */
    top: 15%;
    left: 42%;
}

#photo_9 {
    --base-rotation: -16deg;
    --snap-delay: 0.1s;
    width: 14vw;       /* was 11.25vw */
    top: 65%;
    left: 35%;
}

#photo_7 {
    --base-rotation: -21deg;
    --snap-delay: 0.1s;
    width: 11vw;       /* was 8.75vw */
    top: 58%;
    left: 72%;
}


#photo_self1 {
    --base-rotation: -18deg;
    --snap-delay: 0.1s;
    width: 15vw;         /* was 30vw */
    top: 40%;
    left: 85%;
}

#photo_self2 {
    --base-rotation: 19deg;
    --snap-delay: 0.1s;
    width: 15vw;         /* was 30vw */
    top: 10%;
    left: 70%;
}

#photo_self3 {
    --base-rotation: 11deg;
    --snap-delay: 0.1s;
    width: 14vw;         /* was 28vw */
    top: 25%;
    left: 50%;
}

/* ============= CONTACT SECTION ============= */

/* Always just under header, right-aligned */
.contact-section {
    position: absolute;
    top: 100px;                /* inside main’s padding, so directly under header */
    right: 0px;
    margin: 0;
    display: flex;
    justify-content: flex-start;
    z-index: 7;            /* on top of photos */
    width: min(320px, 24vw);
}

.contact-card {
    position: relative;

    /* scales with viewport, but with sane bounds */
    width: clamp(14rem, 18vw, 22rem);
    /* let height grow to fit content */
    height: auto;

    /* base font size scales with viewport */
    font-size: clamp(0.75rem, 0.9vw, 0.95rem);

    /* padding also scales slightly with viewport */
    padding: clamp(0.9rem, 1.1vw, 1.3rem)
             clamp(1.0rem, 1.3vw, 1.6rem);

    border-radius: 18px;
    background:
        linear-gradient(135deg,
            rgba(214, 196, 166, 0.18) 25%,
            transparent 25%,
            transparent 50%,
            rgba(214, 196, 166, 0.18) 50%,
            rgba(214, 196, 166, 0.18) 75%,
            transparent 75%,
            transparent),
        #fffaf2;
    background-size: 14px 14px, auto;
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.18),
        0 0 0 1px rgba(190, 170, 140, 0.9);
    color: #3b3426;
}


.contact-card h2 {
    font-size: 1.2em;              /* relative to card font-size */
    margin-bottom: 0.4em;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.contact-card p {
    font-size: 1em;                /* matches card base font-size */
    margin-bottom: 0.25em;
}


.contact-name {
    font-weight: 600;
    margin-bottom: 0.2em;
}

.contact-card a {
    color: #905050;
    text-decoration: none;
}
.contact-card a:hover {
    text-decoration: underline;
}

/* ============= RESPONSIVE ============= */

@media (max-width: 1300px) {
    #photo_self1 { left: 18%; }
    #photo_self2 { left: 6%; }
    #photo_self3 { left: 30%; }
    #photo_8    { left: 62%; }
    #photo_9    { left: 66%; }
}

/* Tablet-ish: stack text and contact, keep responsive photos */
@media (max-width: 1000px) {
    .site-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    nav a {
        margin-left: 0;
        margin-right: 0.75rem;
    }

    main {
        padding: 2rem 6vw 3.5rem;
    }

    .text-stack {
        position: static;
        width: 100%;
        max-width: 100%;
        margin-bottom: 2rem;
    }

    #about,
    #more-info {
        max-width: 100%;
    }

    .contact-section {
        position: static;
        width: 100%;
        max-width: 100%;
        margin-top: 2rem;
        justify-content: flex-start;
    }

    .hero-canvas {
        min-height: 80vh;
        margin-top: 2rem;
    }
}

/* Phone: photos stack vertically */
@media (max-width: 700px) {

    .hero-canvas {
        min-height: auto;
    }

    .photo-card {
        position: static;
        width: 90vw;
        max-width: 100%;
        margin: 0 auto 1.5rem;
        transform: none;
    }

    .photo-card .photo-frame {
        top: -10px;
        left: -10px;
        width: 110%;
        height: 110%;
    }
}
