/* ===================================================
   relativity.quest — Japanese-minimal spacetime design
   Colors: #F5EDD6, #E8D8B4, #D9C9A3, #2C2418, #6B5D4A, #C4553A, #3A6B5C, #D4A853
   Fonts: Zen Kaku Gothic New, Shippori Mincho, IBM Plex Mono
   =================================================== */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Shippori Mincho', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.85;
    color: #2C2418;
    background: linear-gradient(180deg, #F5EDD6 0%, #E8D8B4 50%, #D9C9A3 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    position: relative;
}

/* Paper grain texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    background-size: 300px 300px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.5;
}

/* SVG filters container */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ===================================================
   Spacetime Blobs
   =================================================== */

.spacetime-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.blob {
    position: absolute;
    opacity: 0.08;
    will-change: transform;
}

.blob-1 {
    width: 50vw;
    height: 50vw;
    top: 10%;
    left: -10%;
}

.blob-2 {
    width: 35vw;
    height: 35vw;
    top: 50%;
    right: -5%;
}

.blob-3 {
    width: 60vw;
    height: 60vw;
    bottom: -20%;
    left: 20%;
    opacity: 0.06;
}

/* ===================================================
   Watermark Hexagons
   =================================================== */

.watermark-hexagons {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.watermark-hex {
    position: absolute;
    stroke-width: 1px;
    opacity: 0.08;
}

.wh-1 {
    width: 55vw;
    height: 55vw;
    top: -10%;
    right: -15%;
    transform: rotate(23deg);
}

.wh-2 {
    width: 40vw;
    height: 40vw;
    bottom: 10%;
    left: -8%;
    transform: rotate(-15deg);
}

.wh-3 {
    width: 48vw;
    height: 48vw;
    top: 40%;
    left: 30%;
    transform: rotate(42deg);
}

/* ===================================================
   ACT 1: Title
   =================================================== */

.act {
    position: relative;
    z-index: 2;
}

.act-1 {
    min-height: 120vh;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8vh 8vw;
}

.title-container {
    margin-bottom: 6vh;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}

.title-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.site-title {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5.5vw, 4.5rem);
    letter-spacing: 0.04em;
    line-height: 1.1;
    color: #2C2418;
}

.title-line {
    display: block;
}

.title-dot {
    color: #C4553A;
}

.title-subtitle {
    margin-top: 1.5rem;
}

.title-subtitle .annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: #6B5D4A;
    text-transform: uppercase;
}

/* ===================================================
   ACT 1: Honeycomb Grid
   =================================================== */

.honeycomb {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 12px;
    max-width: 80vw;
    padding-left: 5%;
    margin-top: 2vh;
}

.hex-cell {
    width: clamp(180px, 22vw, 320px);
    height: clamp(180px, 22vw, 320px);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    transform: rotate(var(--rotation, 0deg));
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
}

.hex-cell.entered {
    opacity: 1;
}

.hex-cell:hover {
    transform: rotate(var(--rotation, 0deg)) perspective(800px) rotateX(-3deg) rotateY(3deg) scale(1.04);
}

.hex-inner {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #F5EDD6 0%, #E8D8B4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.4s ease;
}

.hex-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    text-align: center;
}

.hex-icon {
    width: 48px;
    height: 48px;
}

.hex-label {
    font-family: 'Shippori Mincho', serif;
    font-weight: 600;
    font-size: clamp(0.85rem, 1vw, 1rem);
    color: #2C2418;
    letter-spacing: 0.02em;
}

.hex-annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    color: #6B5D4A;
    opacity: 0.7;
}

/* ===================================================
   Brush Divider
   =================================================== */

.brush-divider {
    width: 100%;
    padding: 2rem 0;
    position: relative;
    z-index: 2;
}

.brush-divider svg {
    width: 100%;
    height: 20px;
}

/* ===================================================
   ACT 2: Gravity Wells
   =================================================== */

.act-2 {
    padding: 0 8vw;
}

.gravity-well {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 10vh 0;
}

.well-glow {
    position: absolute;
    width: 40vw;
    height: 40vw;
    max-width: 500px;
    max-height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.12) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

.well-content {
    max-width: 680px;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(40px) scale(0.97);
    transition: opacity 0.6s ease-out, transform 0.8s ease-out;
}

.well-content.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.well-annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: #6B5D4A;
    display: block;
    margin-bottom: 1rem;
}

.well-title {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    letter-spacing: 0.04em;
    color: #2C2418;
    margin-bottom: 2rem;
    position: relative;
}

.well-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: #C4553A;
    margin-top: 0.8rem;
    opacity: 0.6;
}

.well-text {
    font-family: 'Shippori Mincho', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.85;
    color: #2C2418;
    margin-bottom: 1.5rem;
}

.well-equation {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
    color: #C4553A;
    margin-top: 2rem;
    opacity: 0.8;
}

.well-equation sup,
.well-equation sub {
    font-size: 0.7em;
}

/* ===================================================
   ACT 3: The Singularity
   =================================================== */

.act-3 {
    background: linear-gradient(180deg, transparent 0%, #2C2418 30%);
    min-height: 100vh;
    position: relative;
}

.singularity-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Spiral fragments */
.spiral-fragments {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.fragment {
    position: absolute;
    top: 50%;
    left: 50%;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: #E8D8B4;
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateX(var(--distance));
    transition: opacity 1s ease-out, transform 1.5s ease-out;
}

.fragment.visible {
    opacity: 0.35;
}

.fragment.collapsed {
    transform: translate(-50%, -50%) rotate(var(--angle)) translateX(20px);
    opacity: 0.15;
    font-size: 0.5rem;
}

/* Central blob */
.singularity-blob {
    width: 120px;
    height: 120px;
    position: relative;
    z-index: 2;
    animation: pulse-blob 4s ease-in-out infinite;
}

.singularity-blob svg {
    width: 100%;
    height: 100%;
}

@keyframes pulse-blob {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.08);
        opacity: 1;
    }
}

/* Haiku */
.haiku-container {
    text-align: center;
    margin-top: 4rem;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}

.haiku-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.haiku-line {
    font-family: 'Shippori Mincho', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.4rem);
    line-height: 2.2;
    color: #D4A853;
    letter-spacing: 0.02em;
}

/* Silence at end */
.silence {
    height: 40vh;
    background: #2C2418;
}

/* ===================================================
   Tomoe and Asanoha micro-decorations
   =================================================== */

.hex-cell::before {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #D4A853;
    border-top-color: transparent;
    opacity: 0.2;
    transform: rotate(45deg);
}

/* ===================================================
   Mobile Responsive
   =================================================== */

@media (max-width: 768px) {
    .act-1 {
        padding: 6vh 5vw;
        align-items: center;
    }

    .honeycomb {
        flex-direction: column;
        align-items: center;
        padding-left: 0;
        max-width: 100%;
        gap: 8px;
    }

    .hex-cell {
        width: clamp(160px, 60vw, 280px);
        height: clamp(160px, 60vw, 280px);
    }

    .hex-cell:nth-child(even) {
        transform: translateX(15%) rotate(var(--rotation, 0deg));
    }

    .hex-cell:nth-child(odd) {
        transform: translateX(-15%) rotate(var(--rotation, 0deg));
    }

    .act-2 {
        padding: 0 5vw;
    }

    .well-content {
        max-width: 100%;
    }

    .site-title {
        text-align: center;
    }

    .title-subtitle {
        text-align: center;
    }

    .spiral-fragments .fragment {
        --distance: 100px;
    }
}

@media (max-width: 480px) {
    .hex-cell {
        width: clamp(150px, 70vw, 250px);
        height: clamp(150px, 70vw, 250px);
    }

    .gravity-well {
        min-height: 80vh;
        padding: 6vh 0;
    }
}

/* ===================================================
   Honeycomb row layout for desktop
   =================================================== */

@media (min-width: 769px) {
    .honeycomb {
        display: grid;
        grid-template-columns: repeat(3, clamp(180px, 22vw, 320px));
        grid-template-rows: repeat(2, clamp(180px, 22vw, 320px));
        gap: 12px;
        justify-content: start;
    }

    /* Offset second row for honeycomb effect */
    .hex-cell:nth-child(4),
    .hex-cell:nth-child(5),
    .hex-cell:nth-child(6) {
        transform: translateX(calc(clamp(90px, 11vw, 160px) + 6px)) rotate(var(--rotation, 0deg));
    }

    .hex-cell:nth-child(4):hover,
    .hex-cell:nth-child(5):hover,
    .hex-cell:nth-child(6):hover {
        transform: translateX(calc(clamp(90px, 11vw, 160px) + 6px)) rotate(var(--rotation, 0deg)) perspective(800px) rotateX(-3deg) rotateY(3deg) scale(1.04);
    }
}

/* ===================================================
   Ma space — breathing column on right
   =================================================== */

@media (min-width: 1024px) {
    .act-1 {
        padding-right: 20vw;
    }
}

/* ===================================================
   Scroll-triggered gradient deepening
   =================================================== */

.act-2 {
    background: linear-gradient(180deg, transparent 0%, rgba(232, 216, 180, 0.3) 100%);
}
