/* ============================================================
   miris.xyz - Main Styles
   ============================================================ */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #12121A;
    color: #D8D0C4;
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.6;
}

/* ============================================================
   Grain Texture Overlay
   ============================================================ */

#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    background-image:
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" seed="1"/></filter><rect width="100" height="100" filter="url(%23noise)" opacity="0.08"/></svg>');
    background-size: 100px 100px;
    z-index: 10;
    animation: grain-fade-in 0.8s ease-out 0.3s forwards;
}

@keyframes grain-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.08;
    }
}

/* ============================================================
   Grid Backdrop
   ============================================================ */

#grid-svg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
}

/* Grid draw animation starting from center */
@keyframes grid-draw {
    0% {
        opacity: 0;
        stroke-dasharray: 1000;
        stroke-dashoffset: 1000;
    }
    100% {
        opacity: 1;
        stroke-dasharray: 1;
        stroke-dashoffset: 0;
    }
}

/* Grid animates in from 300-800ms */
#grid-svg {
    animation: grid-draw 0.5s ease-in-out 0.3s forwards;
}

/* ============================================================
   Grid Container (12x8)
   ============================================================ */

.grid-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #12121A;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 0;
    overflow: hidden;
}

/* ============================================================
   Modules
   ============================================================ */

.module {
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: module-fade-in 0.6s ease-out forwards;
}

@keyframes module-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Module A: Identity Block (cols 1-5, rows 1-3) */
.module-a {
    grid-column: 1 / 6;
    grid-row: 1 / 4;
    background-color: #2A2A2E;
    border: 1px solid #3A3A3A;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    animation-delay: 0.5s;
}

.module-content {
    width: 100%;
}

.domain-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #D8D0C4;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.title-x {
    color: #D4654A;
}

.title-y {
    color: #4A8CD4;
}

.title-z {
    color: #5CAA6E;
}

.subtitle-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #A09890;
}

.subtitle-text p {
    margin-bottom: 0.8rem;
}

.xyz-note {
    color: #5CAA6E;
    font-weight: 500;
    font-style: italic;
}

/* Module B: Generative Art (cols 6-12, rows 1-4) */
.module-b {
    grid-column: 6 / 13;
    grid-row: 1 / 5;
    background-color: #12121A;
    border: 1px solid #3A3A3A;
    position: relative;
    overflow: hidden;
    animation-delay: 0.6s;
}

.generative-art {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.art-element {
    position: absolute;
    opacity: 0;
}

.art-element.circle {
    border-radius: 50%;
    border: 1px solid;
    animation: art-fade-in 0.8s ease-out forwards;
}

.art-element.circle:nth-child(1) {
    border-color: #4A8CD4;
    opacity: 0.15;
    animation-delay: 0.8s;
}

.art-element.circle:nth-child(2) {
    border-color: #5CAA6E;
    opacity: 0.12;
    animation-delay: 0.85s;
}

.art-element.circle:nth-child(3) {
    border-color: #D4654A;
    opacity: 0.18;
    animation-delay: 0.9s;
}

.art-element.circle:nth-child(4) {
    border-color: #4A8CD4;
    opacity: 0.14;
    animation-delay: 0.95s;
}

.art-element.circle:nth-child(5) {
    border-color: #5CAA6E;
    opacity: 0.16;
    animation-delay: 1s;
}

.art-element.circle:nth-child(6) {
    border-color: #D4654A;
    opacity: 0.13;
    animation-delay: 1.05s;
}

.art-element.circle:nth-child(7) {
    border-color: #4A8CD4;
    opacity: 0.15;
    animation-delay: 1.1s;
}

.art-element.circle:nth-child(8) {
    border-color: #5CAA6E;
    opacity: 0.14;
    animation-delay: 1.15s;
}

.art-element.line {
    height: 1px;
    border: none;
    background-color: #4A8CD4;
    opacity: 0.2;
    animation: art-fade-in 0.6s ease-out forwards;
}

.art-element.line:nth-child(9) {
    background-color: #5CAA6E;
    opacity: 0.18;
    animation-delay: 1.2s;
}

.art-element.line:nth-child(10) {
    background-color: #D4654A;
    opacity: 0.22;
    animation-delay: 1.25s;
}

.art-element.line:nth-child(11) {
    background-color: #4A8CD4;
    opacity: 0.19;
    animation-delay: 1.3s;
}

.art-element.line:nth-child(12) {
    background-color: #5CAA6E;
    opacity: 0.2;
    animation-delay: 1.35s;
}

.art-element.line:nth-child(13) {
    background-color: #D4654A;
    opacity: 0.21;
    animation-delay: 1.4s;
}

.art-element.line:nth-child(14) {
    background-color: #4A8CD4;
    opacity: 0.19;
    animation-delay: 1.45s;
}

.art-element.rectangle {
    border: 1px solid;
    background-color: transparent;
    animation: art-fade-in 0.7s ease-out forwards;
}

.art-element.rectangle:nth-child(15) {
    border-color: #5CAA6E;
    opacity: 0.16;
    animation-delay: 1.5s;
}

.art-element.rectangle:nth-child(16) {
    border-color: #D4654A;
    opacity: 0.14;
    animation-delay: 1.55s;
}

.art-element.rectangle:nth-child(17) {
    border-color: #4A8CD4;
    opacity: 0.17;
    animation-delay: 1.6s;
}

.art-element.rectangle:nth-child(18) {
    border-color: #5CAA6E;
    opacity: 0.15;
    animation-delay: 1.65s;
}

.art-element.rectangle:nth-child(19) {
    border-color: #D4654A;
    opacity: 0.19;
    animation-delay: 1.7s;
}

@keyframes art-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: inherit;
    }
}

/* Module C: Narrative Sections (cols 1-7, rows 4-8) */
.module-c {
    grid-column: 1 / 8;
    grid-row: 4 / 9;
    background-color: #2A2A2E;
    border: 1px solid #3A3A3A;
    padding: 2rem;
    overflow-y: auto;
    animation-delay: 0.7s;
}

.works-index {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

.works-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #D8D0C4;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #3A3A3A;
    padding-bottom: 0.5rem;
}

.works-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    overflow-y: auto;
}

.work-entry {
    display: flex;
    align-items: center;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    color: #A09890;
    line-height: 1.6;
    word-spacing: 0.5em;
    letter-spacing: 0.02em;
}

.work-year {
    min-width: 45px;
    color: #B0A8A0;
    font-weight: 700;
}

.work-title-text {
    flex: 0 0 auto;
    margin: 0 0.5em;
    color: #D8D0C4;
}

.work-dots {
    flex: 1;
    display: block;
    border-bottom: 1px dotted #3A3A3A;
    height: 0;
    margin: 0 0.2em;
}

.work-platform {
    flex: 0 0 auto;
    margin: 0 0.5em;
    color: #5CAA6E;
    min-width: 60px;
    text-align: right;
}

.work-status {
    flex: 0 0 auto;
    color: #4A8CD4;
    min-width: 70px;
    text-align: right;
}

/* Module D: Coordinates (cols 8-12, rows 6-8) */
.module-d {
    grid-column: 8 / 13;
    grid-row: 6 / 9;
    background-color: #2A2A2E;
    border: 1px solid #3A3A3A;
    padding: 2rem;
    overflow-y: auto;
    animation-delay: 0.75s;
}

.coordinates-block {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.coordinates-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #D8D0C4;
    text-transform: uppercase;
}

.coordinate-line {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.coord-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    width: 20px;
}

.coord-label.x-axis {
    color: #D4654A;
}

.coord-label.y-axis {
    color: #4A8CD4;
}

.coord-label.z-axis {
    color: #5CAA6E;
}

.coord-value {
    color: #B0A8A0;
}

/* Module E: Manifesto Strip (full width, rows 9-10) */
.module-e {
    grid-column: 1 / 13;
    grid-row: 9 / 11;
    background-color: #1A1A1E;
    border: 1px solid #3A3A3A;
    padding: 1.5rem 2rem;
    animation-delay: 0.8s;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.manifesto-container {
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.manifesto-text {
    display: flex;
    animation: manifesto-scroll 30s linear infinite;
    white-space: nowrap;
    padding-right: 2rem;
}

.manifesto-content {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #D8D0C4;
    display: inline-block;
    padding-right: 3rem;
}

.manifesto-text:hover {
    animation-play-state: paused;
}

@keyframes manifesto-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

.links-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.links-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #D8D0C4;
    text-transform: uppercase;
}

.link-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.link-item {
    font-size: 0.9rem;
    color: #A09890;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
    width: fit-content;
}

.link-item::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: #5CAA6E;
    transition: width 0.3s ease;
}

.link-item:hover {
    color: #5CAA6E;
}

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

/* ============================================================
   Scrollbar Styling
   ============================================================ */

.module-c::-webkit-scrollbar,
.module-d::-webkit-scrollbar {
    width: 6px;
}

.module-c::-webkit-scrollbar-track,
.module-d::-webkit-scrollbar-track {
    background-color: transparent;
}

.module-c::-webkit-scrollbar-thumb,
.module-d::-webkit-scrollbar-thumb {
    background-color: #3A3A3A;
    border-radius: 3px;
}

.module-c::-webkit-scrollbar-thumb:hover,
.module-d::-webkit-scrollbar-thumb:hover {
    background-color: #5CAA6E;
}

/* ============================================================
   Responsive Design
   ============================================================ */

@media (max-width: 1200px) {
    .grid-container {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(14, auto);
    }

    .module-a {
        grid-column: 1 / 7;
        grid-row: 1 / 4;
    }

    .module-b {
        grid-column: 1 / 7;
        grid-row: 4 / 7;
        min-height: 300px;
    }

    .module-c {
        grid-column: 1 / 7;
        grid-row: 7 / 10;
    }

    .module-d {
        grid-column: 1 / 7;
        grid-row: 10 / 13;
    }

    .module-e {
        grid-column: 1 / 7;
        grid-row: 13 / 15;
    }
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        overflow-y: auto;
    }

    .module {
        grid-column: 1 !important;
        min-height: 400px;
    }

    .module-a {
        grid-row: 1;
    }

    .module-b {
        grid-row: 2;
        min-height: 300px;
    }

    .module-c {
        grid-row: 3;
    }

    .module-d {
        grid-row: 4;
    }

    .module-e {
        grid-row: 5;
        min-height: 120px;
    }

    #grid-svg {
        display: none;
    }

    .domain-title {
        font-size: clamp(1.8rem, 5vw, 2.5rem);
    }

    .manifesto-text {
        animation: none !important;
    }

    .manifesto-content {
        font-size: clamp(1rem, 2vw, 1.5rem);
        white-space: normal;
    }
}

/* ============================================================
   Print Styles
   ============================================================ */

@media print {
    #grain-overlay,
    #grid-svg {
        display: none;
    }
}
