/* ==========================================
   thesecond.world - Styles
   Corporate. Old-money restraint. Marble and warmth.
   ========================================== */

/* --- CSS Custom Properties --- */
:root {
    --bg-cream: #FDF8F0;
    --surface-parchment: #F5EDE0;
    --text-espresso: #2C2418;
    --text-taupe: #9B8E7E;
    --border-bronze: #B8A990;
    --accent-rose: #C4A68C;
    --accent-sage: #A8B5A0;
    --accent-lavender: #B0A4BE;
    --accent-terracotta: #D4A889;
    --deep-walnut: #3D3226;
    --border-sand: #D4C5B0;
    --nav-bg: #FFFCF5;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'DM Sans', sans-serif;

    --grid-gutter: 24px;
    --card-padding: 32px;
    --nav-height: 64px;
    --section-spacing: 120px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.72;
    color: var(--text-espresso);
    background-color: var(--bg-cream);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* --- Grid-Line Architectural Overlay --- */
#grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-linear-gradient(
            to right,
            transparent,
            transparent 299px,
            rgba(184, 169, 144, 0.04) 299px,
            rgba(184, 169, 144, 0.04) 300px
        ),
        repeating-linear-gradient(
            to bottom,
            transparent,
            transparent 299px,
            rgba(184, 169, 144, 0.04) 299px,
            rgba(184, 169, 144, 0.04) 300px
        );
    will-change: transform;
}

/* --- Navigation --- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: rgba(255, 252, 245, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(184, 169, 144, 0.15);
    overflow: hidden;
}

.nav-marble-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#marble-nav-filter);
    background: var(--nav-bg);
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

.nav-inner {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.nav-logo {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    color: var(--text-espresso);
    transition: opacity 0.4s ease;
}

.nav-logo:hover {
    opacity: 0.7;
}

.nav-links {
    display: flex;
    gap: 48px;
}

.nav-link {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-taupe);
    transition: color 0.4s ease;
}

.nav-link:hover {
    color: var(--text-espresso);
}

/* --- Hero Section --- */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.marble-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#marble-filter);
    background: var(--bg-cream);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 24px;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 0.02em;
    color: var(--text-espresso);
    line-height: 1.1;
    margin-bottom: 24px;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: perspective(600px) rotateY(15deg);
    transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-title .char.revealed {
    opacity: 1;
    transform: perspective(600px) rotateY(0deg);
}

.hero-tagline {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1.1rem;
    color: var(--text-taupe);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s ease 0.3s, transform 0.8s ease 0.3s;
}

.hero-tagline.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Marble Divider --- */
.marble-divider {
    width: 100%;
    height: 2px;
    overflow: hidden;
    opacity: 0.5;
}

/* --- Sections Common --- */
.section-ghost-number {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 15vw;
    color: var(--border-bronze);
    opacity: 0.06;
    pointer-events: none;
    line-height: 1;
    z-index: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.section-label {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-taupe);
    margin-bottom: 40px;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* --- Philosophy Section (Act 2) --- */
#philosophy {
    position: relative;
    padding: var(--section-spacing) 40px;
    max-width: 900px;
    margin: 0 auto;
    overflow: hidden;
}

.philosophy-headline {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    letter-spacing: 0.02em;
    color: var(--text-espresso);
    line-height: 1.2;
    margin-bottom: 40px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.philosophy-text {
    position: relative;
    z-index: 1;
}

.philosophy-text p {
    margin-bottom: 24px;
    color: var(--text-espresso);
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.philosophy-text p:last-child {
    margin-bottom: 0;
}

/* --- Evidence Section (Act 3) - Masonry Grid --- */
#evidence {
    position: relative;
    padding: var(--section-spacing) 40px;
    max-width: 1400px;
    margin: 0 auto;
    overflow: hidden;
}

.masonry-grid {
    columns: 4;
    column-gap: var(--grid-gutter);
    position: relative;
    z-index: 1;
}

/* --- Masonry Cards --- */
.masonry-card {
    break-inside: avoid;
    margin-bottom: var(--grid-gutter);
    background: var(--bg-cream);
    border: 1px solid var(--border-sand);
    position: relative;
    padding: var(--card-padding);
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.03, 0.98, 0.52, 0.99),
                box-shadow 0.4s cubic-bezier(0.03, 0.98, 0.52, 0.99),
                border-color 0.4s ease;
    will-change: transform;
    overflow: hidden;
    /* Entry animation initial state */
    opacity: 0;
    transform: translateY(40px) rotateX(4deg);
}

.masonry-card.in-view {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
    transition: opacity 0.6s ease, transform 0.6s ease,
                box-shadow 0.4s cubic-bezier(0.03, 0.98, 0.52, 0.99),
                border-color 0.4s ease;
}

.masonry-card:hover {
    border-color: var(--border-bronze);
    box-shadow: 0 4px 24px rgba(44, 36, 24, 0.08);
}

/* Card marble hover background */
.card-marble-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#marble-filter-card);
    background: var(--bg-cream);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 0;
}

.masonry-card:hover .card-marble-hover {
    opacity: 0.16;
}

.masonry-card--tall {
    min-height: 380px;
}

.masonry-card--medium {
    min-height: 300px;
}

/* Card Accent Stripe */
.card-accent-stripe {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 2;
}

[data-accent="1"] .card-accent-stripe { background: var(--accent-rose); }
[data-accent="2"] .card-accent-stripe { background: var(--accent-sage); }
[data-accent="3"] .card-accent-stripe { background: var(--accent-lavender); }
[data-accent="4"] .card-accent-stripe { background: var(--accent-terracotta); }

/* Card Corner Brackets */
.card-corner {
    position: absolute;
    width: 8px;
    height: 8px;
    opacity: 0.04;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 2;
}

.masonry-card:hover .card-corner {
    opacity: 0.15;
}

.card-corner-tl {
    top: 6px;
    left: 6px;
    border-top: 1px solid var(--border-bronze);
    border-left: 1px solid var(--border-bronze);
}

.card-corner-tr {
    top: 6px;
    right: 6px;
    border-top: 1px solid var(--border-bronze);
    border-right: 1px solid var(--border-bronze);
}

.card-corner-bl {
    bottom: 6px;
    left: 6px;
    border-bottom: 1px solid var(--border-bronze);
    border-left: 1px solid var(--border-bronze);
}

.card-corner-br {
    bottom: 6px;
    right: 6px;
    border-bottom: 1px solid var(--border-bronze);
    border-right: 1px solid var(--border-bronze);
}

/* Card Content */
.card-content {
    position: relative;
    z-index: 1;
}

.card-meta {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.85rem;
    color: var(--text-taupe);
    display: block;
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    letter-spacing: 0.02em;
    color: var(--text-espresso);
    margin-bottom: 16px;
    line-height: 1.3;
}

.card-body {
    color: var(--text-espresso);
    margin-bottom: 12px;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.72;
}

.card-body:last-child {
    margin-bottom: 0;
}

/* --- Footer (Act 4) --- */
footer {
    background: var(--deep-walnut);
    padding: 80px 40px;
    margin-top: var(--section-spacing);
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.footer-logo {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.4rem;
    letter-spacing: 0.02em;
    color: var(--bg-cream);
    margin-bottom: 40px;
}

.footer-contact {
    margin-bottom: 48px;
}

.footer-line {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.85rem;
    color: var(--text-taupe);
    margin-bottom: 12px;
}

.footer-email {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--bg-cream);
    letter-spacing: 0.02em;
    transition: color 0.4s ease;
    border-bottom: 1px solid rgba(253, 248, 240, 0.2);
    padding-bottom: 2px;
}

.footer-email:hover {
    color: var(--accent-rose);
}

.footer-quiet p {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.8rem;
    color: var(--text-taupe);
    opacity: 0.6;
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
    .masonry-grid {
        columns: 2;
    }

    .nav-links {
        gap: 32px;
    }

    :root {
        --section-spacing: 80px;
        --card-padding: 24px;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 640px) {
    .masonry-grid {
        columns: 1;
    }

    .nav-links {
        gap: 24px;
    }

    .nav-link {
        font-size: 0.75rem;
    }

    .nav-inner {
        padding: 0 20px;
    }

    #philosophy,
    #evidence {
        padding-left: 20px;
        padding-right: 20px;
    }

    footer {
        padding: 60px 20px;
    }

    :root {
        --section-spacing: 60px;
        --card-padding: 20px;
    }

    .section-ghost-number {
        font-size: 30vw;
    }
}
