/* === BASE & PAPER TEXTURE === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --aged-linen: #f5efe3;
    --lamp-black: #2b2622;
    --brass-patina: #b8943f;
    --cart-teal: #4a7c78;
    --dusk-umber: #3d342c;
    --foxed-cream: #e8d9c0;
    --morning-mist: #f9f6f0;
    --spring-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--aged-linen);
    color: var(--lamp-black);
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.05rem, 1.3vw, 1.2rem);
    line-height: 1.85;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    /* CSS paper texture */
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(232,217,192,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(232,217,192,0.05) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(232,217,192,0.03) 0%, transparent 60%),
        radial-gradient(circle at 30% 70%, rgba(184,148,63,0.015) 0%, transparent 30%),
        radial-gradient(circle at 70% 30%, rgba(184,148,63,0.01) 0%, transparent 25%);
    background-size: 600px 600px, 400px 400px, 800px 800px, 500px 500px, 350px 350px;
}

/* === COMPASS NAVIGATION === */
#compass-nav {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.3s var(--spring-ease);
}

#compass-nav:hover {
    transform: scale(1.1);
}

#compass-nav .compass-center {
    animation: pulse-center 3s ease-in-out infinite;
}

@keyframes pulse-center {
    0%, 100% { transform-origin: center; r: 3; }
    50% { r: 3.15; }
}

/* === NAV OVERLAY === */
#nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.4s ease;
}

#nav-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.nav-overlay-bg {
    position: absolute;
    inset: 0;
    background: rgba(61, 52, 44, 0.85);
    backdrop-filter: blur(20px);
}

.nav-compass-container {
    position: relative;
    width: 400px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-compass-large {
    position: absolute;
}

.nav-link {
    position: absolute;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: var(--foxed-cream);
    text-decoration: none;
    transition: color 0.3s ease;
    letter-spacing: 0.04em;
}

.nav-link:hover {
    color: var(--brass-patina);
}

.nav-n { top: -10px; left: 50%; transform: translateX(-50%); }
.nav-e { right: -40px; top: 50%; transform: translateY(-50%); }
.nav-s { bottom: -10px; left: 50%; transform: translateX(-50%); }
.nav-w { left: -40px; top: 50%; transform: translateY(-50%); }

/* === HERO SECTION === */
.section-hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    z-index: 2;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(4rem, 10vw, 8rem);
    letter-spacing: 0.08em;
    color: var(--lamp-black);
    display: flex;
    justify-content: center;
    gap: 0.02em;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
}

.hero-title .letter.animate {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.8s var(--spring-ease);
}

.hero-subtitle {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--lamp-black);
    opacity: 0;
    margin-top: 1rem;
    transition: opacity 0.8s ease;
}

.hero-subtitle.animate {
    opacity: 0.3;
}

.hero-map-fragment {
    position: absolute;
    bottom: 5%;
    right: 8%;
    z-index: 1;
}

.hero-map-fragment .map-draw {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
}

.hero-map-fragment.animate .map-draw {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 2s ease-in-out;
}

/* === PROJECTS SECTION === */
.section-projects {
    padding: 10vh 5% 15vh;
    position: relative;
}

.projects-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.project-sheet {
    background: var(--aged-linen);
    border: 1px solid var(--foxed-cream);
    padding: 3rem 3.5rem;
    position: relative;
    transform: rotate(var(--rotation, 0deg)) translateX(var(--offset-x, 0));
    margin-bottom: -40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    will-change: transform;
    box-shadow:
        2px 3px 4px rgba(59, 52, 44, 0.15),
        6px 10px 20px rgba(59, 52, 44, 0.08);
    opacity: 0;
    transform: rotate(var(--rotation, 0deg)) translateX(var(--offset-x, 0)) translateY(30px);
    transition: transform 0.7s var(--spring-ease), box-shadow 0.4s ease, opacity 0.6s ease;
}

.project-sheet.revealed {
    opacity: 1;
    transform: rotate(var(--rotation, 0deg)) translateX(var(--offset-x, 0)) translateY(0);
}

.project-sheet:hover {
    transform: rotate(0deg) translateX(0) translateY(-8px);
    box-shadow:
        3px 5px 8px rgba(59, 52, 44, 0.2),
        10px 16px 30px rgba(59, 52, 44, 0.12);
    z-index: 10;
}

.project-sheet:hover + .project-sheet {
    transform: rotate(var(--rotation, 0deg)) translateX(var(--offset-x, 0)) translateY(4px);
}

.sheet-content {
    flex: 1;
    min-width: 0;
}

.project-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 0.04em;
    color: var(--lamp-black);
    line-height: 1.1;
    margin-bottom: 0.75rem;
}

.project-desc {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.7;
    color: var(--dusk-umber);
    max-width: 420px;
    margin-bottom: 1.5rem;
}

.project-date {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--dusk-umber);
    opacity: 0.6;
}

.project-map {
    flex-shrink: 0;
    margin-left: 2rem;
    margin-right: -2rem;
    overflow: visible;
}

/* === ABOUT / INSCRIPTION WALL === */
.section-about {
    padding: 15vh 0;
    background-color: var(--morning-mist);
    background-image:
        radial-gradient(ellipse at 40% 50%, rgba(232,217,192,0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 30%, rgba(232,217,192,0.04) 0%, transparent 40%);
}

.inscription-wall {
    max-width: 60%;
    margin: 0 auto;
    padding: 0 2rem;
}

.inscription-paragraph {
    margin-bottom: 2.5rem;
}

.inscription-paragraph p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.05rem, 1.3vw, 1.2rem);
    line-height: 1.85;
    color: var(--lamp-black);
}

.ruled-line {
    height: 1px;
    background: var(--foxed-cream);
    margin-top: 1.5rem;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s ease;
}

.reveal-paragraph {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.7s ease, transform 0.7s var(--spring-ease);
}

.reveal-paragraph.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-paragraph.revealed .ruled-line {
    transform: scaleX(1);
    transition-delay: 0.3s;
}

/* On hover, ruled lines turn brass */
.inscription-paragraph:hover .ruled-line {
    background: var(--brass-patina);
    transition: background 0.4s ease, transform 0.6s ease;
}

/* === FOOTER / SEAL === */
.section-footer {
    background: var(--dusk-umber);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.seal-container {
    margin-bottom: 3rem;
}

.studio-seal .seal-outer,
.studio-seal .seal-inner {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 0.8s ease;
}

.studio-seal .seal-detail,
.studio-seal .seal-text {
    opacity: 0;
    transition: opacity 0.8s ease 0.6s;
}

.studio-seal.animate .seal-outer {
    stroke-dashoffset: 0;
    transition-duration: 0.4s;
}

.studio-seal.animate .seal-inner {
    stroke-dashoffset: 0;
    transition-duration: 0.6s;
    transition-delay: 0.3s;
}

.studio-seal.animate .seal-detail,
.studio-seal.animate .seal-text {
    opacity: 1;
    transition-delay: 0.8s;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-link {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brass-patina);
    text-decoration: none;
    position: relative;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--brass-patina);
    transition: width 0.4s ease;
}

.footer-link:hover::after {
    width: 100%;
}

.footer-sep {
    color: var(--foxed-cream);
    opacity: 0.4;
    font-family: 'DM Mono', monospace;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .project-sheet {
        flex-direction: column;
        --rotation: 0deg !important;
        --offset-x: 0 !important;
        padding: 2rem;
        margin-bottom: -20px;
    }

    .project-map {
        margin: 1.5rem 0 0 0;
        width: 160px;
        height: 160px;
    }

    .inscription-wall {
        max-width: 90%;
    }

    .nav-compass-container {
        width: 280px;
        height: 280px;
    }

    .nav-compass-large {
        width: 280px;
        height: 280px;
    }

    #compass-nav {
        top: 16px;
        right: 16px;
    }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    .hero-title .letter {
        opacity: 1;
        transform: none;
    }
    .hero-subtitle {
        opacity: 0.3;
    }
    .hero-map-fragment .map-draw {
        stroke-dashoffset: 0;
    }
    .project-sheet {
        opacity: 1;
        transform: rotate(var(--rotation, 0deg)) translateX(var(--offset-x, 0));
    }
    .reveal-paragraph {
        opacity: 1;
        transform: none;
    }
    .reveal-paragraph .ruled-line {
        transform: scaleX(1);
    }
    .studio-seal .seal-outer,
    .studio-seal .seal-inner {
        stroke-dashoffset: 0;
    }
    .studio-seal .seal-detail,
    .studio-seal .seal-text {
        opacity: 1;
    }
    * {
        transition-duration: 0s !important;
        animation-duration: 0s !important;
    }
}
