/* mang.quest -- styles.css */
/* Palette: #f0ece4, #e2c8b4, #b8afc4, #3d3a4a, #2e2b33, #7a7770, #c4956e, #d4d0ca */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: #2e2b33;
    background: linear-gradient(180deg, #f0ece4 0%, #e2c8b4 25%, #b8afc4 65%, #3d3a4a 100%);
    background-size: 100% 100%;
    min-height: 100vh;
}

/* Grid-line scaffold: visible construction lines */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(212, 208, 202, 0.12) 0px,
            rgba(212, 208, 202, 0.12) 1px,
            transparent 1px,
            transparent calc((100% - 2rem) / 4)
        ),
        repeating-linear-gradient(
            0deg,
            rgba(212, 208, 202, 0.12) 0px,
            rgba(212, 208, 202, 0.12) 1px,
            transparent 1px,
            transparent 8px
        );
    background-position: 1rem 0;
    background-size: calc(100% - 2rem) 100%;
}

/* Slow gradient hue shift animation */
@keyframes gradientBreath {
    0% {
        background-position: 0% 0%;
    }
    50% {
        background-position: 0% 3%;
    }
    100% {
        background-position: 0% 0%;
    }
}

body {
    animation: gradientBreath 60s ease-in-out infinite;
    background-size: 100% 103%;
}

/* ===== OPENING PANEL ===== */
.opening-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: flex-end;
    padding: clamp(2rem, 5vw, 6rem);
    padding-bottom: clamp(3rem, 8vh, 8rem);
}

.opening-content {
    max-width: 720px;
}

.purpose-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    letter-spacing: 0.02em;
    color: #7a7770;
    margin-bottom: 0.5em;
}

.hero-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: 0.02em;
    color: #2e2b33;
    line-height: 1.1;
}

/* ===== THREAD OVERLAY ===== */
.thread-overlay {
    position: absolute;
    top: 100vh;
    left: 0;
    width: 100%;
    height: calc(100% - 200vh);
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.thread-svg {
    width: 100%;
    height: 100%;
}

.thread-svg line {
    stroke: #c4956e;
    stroke-width: 1;
    opacity: 0.4;
}

/* ===== MASONRY FIELD ===== */
.masonry-field {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    grid-auto-rows: 8px;
    gap: clamp(4px, 0.5vw, 8px);
    padding: clamp(1rem, 3vw, 4rem);
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== TILES ===== */
.tile {
    position: relative;
    padding: clamp(1.2rem, 2vw, 2rem);
    display: flex;
    align-items: flex-start;
    overflow: hidden;
}

.tile p {
    position: relative;
    z-index: 1;
}

/* Tile color variations */
.tile--warm {
    background-color: rgba(226, 200, 180, 0.35);
}

.tile--cool {
    background-color: rgba(184, 175, 196, 0.3);
}

.tile--fog {
    background-color: rgba(240, 236, 228, 0.45);
}

.tile--transparent {
    background-color: rgba(212, 208, 202, 0.2);
}

/* Soft Rectangle pseudo-element overlays on tiles */
.tile--warm::before,
.tile--cool::before,
.tile--fog::before,
.tile--transparent::before {
    content: '';
    position: absolute;
    border-radius: 3px;
    pointer-events: none;
    z-index: 0;
}

.tile--warm::before {
    top: 10px;
    left: -8px;
    width: 60%;
    height: 45%;
    background-color: rgba(226, 200, 180, 0.2);
}

.tile--cool::before {
    bottom: 8px;
    right: -10px;
    width: 55%;
    height: 50%;
    background-color: rgba(184, 175, 196, 0.18);
}

.tile--fog::before {
    top: -6px;
    right: 12px;
    width: 50%;
    height: 40%;
    background-color: rgba(240, 236, 228, 0.25);
}

.tile--transparent::before {
    bottom: -8px;
    left: 10px;
    width: 65%;
    height: 35%;
    background-color: rgba(212, 208, 202, 0.15);
}

/* Display phrase tiles */
.tile-display {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    letter-spacing: 0.02em;
    line-height: 1.4;
    color: #2e2b33;
}

/* ===== SHAPE COMPOSITION TILES ===== */
.tile--shape {
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile--shape::before {
    display: none;
}

.shape-composition {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 80px;
}

.soft-rect {
    position: absolute;
    border-radius: 3px;
}

.soft-rect--1 {
    top: 10%;
    left: 8%;
    width: 65%;
    height: 50%;
    background-color: rgba(226, 200, 180, 0.22);
}

.soft-rect--2 {
    top: 30%;
    left: 25%;
    width: 55%;
    height: 45%;
    background-color: rgba(184, 175, 196, 0.18);
}

.soft-rect--3 {
    top: 15%;
    left: 40%;
    width: 50%;
    height: 55%;
    background-color: rgba(196, 149, 110, 0.15);
}

.soft-rect--4 {
    top: 5%;
    left: 12%;
    width: 70%;
    height: 60%;
    background-color: rgba(240, 236, 228, 0.3);
}

.soft-rect--5 {
    top: 25%;
    left: 20%;
    width: 60%;
    height: 50%;
    background-color: rgba(184, 175, 196, 0.2);
}

.soft-rect--6 {
    top: 8%;
    left: 5%;
    width: 50%;
    height: 40%;
    background-color: rgba(61, 58, 74, 0.1);
}

.soft-rect--7 {
    top: 20%;
    left: 30%;
    width: 55%;
    height: 50%;
    background-color: rgba(226, 200, 180, 0.2);
}

.soft-rect--8 {
    top: 40%;
    left: 15%;
    width: 45%;
    height: 35%;
    background-color: rgba(196, 149, 110, 0.12);
}

.soft-rect--9 {
    top: 10%;
    left: 10%;
    width: 60%;
    height: 55%;
    background-color: rgba(184, 175, 196, 0.22);
}

.soft-rect--10 {
    top: 30%;
    left: 25%;
    width: 65%;
    height: 45%;
    background-color: rgba(240, 236, 228, 0.25);
}

/* ===== BREATHING ROWS ===== */
.breathing-row {
    grid-column: 1 / -1;
    height: clamp(3rem, 5vh, 5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.breathing-text {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7a7770;
    opacity: 0.5;
}

/* Dot clusters */
.dot-cluster {
    display: flex;
    gap: 6px;
    align-items: center;
}

.dot {
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #7a7770;
    opacity: 0.25;
}

.dot:nth-child(2n) {
    width: 4px;
    height: 4px;
    opacity: 0.2;
}

.dot:nth-child(3n) {
    width: 6px;
    height: 6px;
    opacity: 0.3;
}

/* ===== CLOSING PANEL ===== */
.closing-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 6rem);
}

.closing-content {
    text-align: center;
}

.closing-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    letter-spacing: 0.02em;
    color: #f0ece4;
}

/* ===== UNDERLINE-DRAW HOVER ===== */
a,
.tile-display {
    background-image: linear-gradient(#c4956e, #c4956e);
    background-size: 0% 1.5px;
    background-repeat: no-repeat;
    background-position: left bottom;
    transition: background-size 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
    text-decoration: none;
    color: inherit;
    display: inline;
    padding-bottom: 2px;
}

a:hover,
.tile-display:hover {
    background-size: 100% 1.5px;
}

/* ===== RESPONSIVE: single column below 640px ===== */
@media (max-width: 640px) {
    .masonry-field {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .tile {
        grid-row: span 1 !important;
    }

    .thread-overlay {
        display: none;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    body {
        animation: none;
    }

    a,
    .tile-display {
        transition: none;
        background-size: 100% 1.5px;
    }
}

/* ===== PRINT ===== */
@media print {
    body::before {
        display: none;
    }

    .thread-overlay {
        display: none;
    }

    .masonry-field {
        display: block;
    }

    .tile {
        break-inside: avoid;
        margin-bottom: 1rem;
        background: none;
    }

    body {
        font-family: Georgia, 'Times New Roman', serif;
        background: white;
        color: black;
        animation: none;
    }

    .hero-title,
    .purpose-text,
    .closing-text,
    .tile-display,
    .breathing-text {
        font-family: Georgia, 'Times New Roman', serif;
    }
}
