/* ============================================================
   okurairi.com - Styles
   Memorial Gallery for Shelved Projects
   ============================================================ */

/* Import Commissioner font with variable axes */
@import url('https://fonts.googleapis.com/css2?family=Commissioner:wght@300;400;600;700&display=swap');

/* ============================================================
   CSS Variables & Reset
   ============================================================ */

:root {
    /* Color Palette */
    --bg-main: #E8E2D6;
    --charcoal: #3A3632;
    --body-warm: #4A4640;
    --stencil-brown: #5A5248;
    --rust: #A67A5A;
    --moss: #7A8A6A;
    --faded-indigo: #6A7A8A;
    --plaster-light: #F2EDE4;

    /* Typography */
    --font-family: 'Commissioner', sans-serif;

    /* Layout */
    --grid-columns: 6;
    --gutter: 20px;
    --container-width: 1280px;

    /* Animations */
    --hover-duration: 400ms;
    --reveal-duration: 700ms;
    --stagger-delay: 150ms;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--body-warm);
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ============================================================
   Gallery Container & Modular Grid
   ============================================================ */

.gallery-container {
    display: grid;
    grid-template-columns: repeat(var(--grid-columns), 1fr);
    gap: var(--gutter);
    padding: 40px;
    max-width: 100%;
    margin: 0 auto;
    background-color: var(--bg-main);
    position: relative;
    filter: url(#plaster-noise);
}

/* ============================================================
   Module Base Styles
   ============================================================ */

.module {
    background-color: var(--plaster-light);
    border: 2px solid var(--stencil-brown);
    padding: 30px;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    transition: all var(--hover-duration) cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    animation: fadeReveal var(--reveal-duration) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    cursor: pointer;
}

/* Random rotation applied via custom properties */
.module {
    --rotation: 0deg;
    --offset-x: 0px;
    --offset-y: 0px;
    transform: rotate(var(--rotation)) translate(var(--offset-x), var(--offset-y));
}

.module:hover {
    transform: rotate(0deg) translate(0, 0);
    background-color: var(--bg-main);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Grid positioning for different module sizes */
.module-double {
    grid-column: span 3;
}

.module-single {
    grid-column: span 2;
}

.module-tall {
    grid-column: span 1;
    grid-row: span 3;
}

.module-double-row {
    grid-column: span 2;
    grid-row: span 2;
}

.hero-module {
    grid-column: span 2;
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--plaster-light) 0%, var(--bg-main) 100%);
}

/* ============================================================
   Stencil Text Effect (Hero Module)
   ============================================================ */

.stencil-text {
    font-size: clamp(2.5rem, 7vw, 5rem);
    font-weight: 700;
    color: var(--charcoal);
    text-transform: lowercase;
    letter-spacing: 0.05em;
    position: relative;
    background: repeating-linear-gradient(
        45deg,
        var(--stencil-brown),
        var(--stencil-brown) 10px,
        var(--rust) 10px,
        var(--rust) 20px
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: blur(0);
    transition: filter var(--hover-duration);
    text-align: center;
}

.hero-module:hover .stencil-text {
    filter: blur(0);
}

.module.hero-module {
    animation: stencilFadeReveal var(--reveal-duration) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ============================================================
   Typography Styles
   ============================================================ */

h2 {
    font-size: clamp(1.4rem, 2.8vw, 2.2rem);
    font-weight: 600;
    color: var(--stencil-brown);
    margin-bottom: 15px;
    line-height: 1.3;
}

.module-description {
    color: var(--body-warm);
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.7;
    font-weight: 400;
}

.module-category {
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--moss);
    margin-top: 20px;
}

/* ============================================================
   Kura Illustrations
   ============================================================ */

.kura-illustration {
    width: 100%;
    max-width: 150px;
    height: auto;
    margin: 20px 0;
    color: var(--rust);
    opacity: 0.6;
}

.kura-illustration svg {
    width: 100%;
    height: auto;
    display: block;
}

.module:hover .kura-illustration {
    opacity: 1;
    transition: opacity var(--hover-duration);
}

/* ============================================================
   Animations
   ============================================================ */

@keyframes fadeReveal {
    0% {
        opacity: 0;
        clip-path: inset(0, 100%, 0, 0);
    }
    100% {
        opacity: 1;
        clip-path: inset(0, 0, 0, 0);
    }
}

.module[data-reveal-edge="top"] {
    animation: revealFromTop var(--reveal-duration) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.module[data-reveal-edge="bottom"] {
    animation: revealFromBottom var(--reveal-duration) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.module[data-reveal-edge="left"] {
    animation: revealFromLeft var(--reveal-duration) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.module[data-reveal-edge="right"] {
    animation: revealFromRight var(--reveal-duration) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes revealFromTop {
    0% {
        opacity: 0;
        clip-path: inset(100%, 0, 0, 0);
    }
    100% {
        opacity: 1;
        clip-path: inset(0, 0, 0, 0);
    }
}

@keyframes revealFromBottom {
    0% {
        opacity: 0;
        clip-path: inset(0, 0, 100%, 0);
    }
    100% {
        opacity: 1;
        clip-path: inset(0, 0, 0, 0);
    }
}

@keyframes revealFromLeft {
    0% {
        opacity: 0;
        clip-path: inset(0, 100%, 0, 0);
    }
    100% {
        opacity: 1;
        clip-path: inset(0, 0, 0, 0);
    }
}

@keyframes revealFromRight {
    0% {
        opacity: 0;
        clip-path: inset(0, 0, 0, 100%);
    }
    100% {
        opacity: 1;
        clip-path: inset(0, 0, 0, 0);
    }
}

@keyframes stencilFadeReveal {
    0% {
        opacity: 0;
        clip-path: inset(0, 0, 0, 0);
    }
    100% {
        opacity: 1;
        clip-path: inset(0, 0, 0, 0);
    }
}

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

@media (max-width: 1024px) {
    :root {
        --grid-columns: 4;
    }

    .module-double {
        grid-column: span 2;
    }

    .module-single {
        grid-column: span 2;
    }

    .module-tall {
        grid-column: span 1;
        grid-row: span 2;
    }

    .module-double-row {
        grid-column: span 2;
        grid-row: span 1;
    }

    .hero-module {
        grid-column: span 2;
        grid-row: span 1;
    }
}

@media (max-width: 640px) {
    :root {
        --grid-columns: 2;
        --gutter: 12px;
    }

    .gallery-container {
        padding: 20px;
    }

    .module {
        grid-column: span 1 !important;
        grid-row: auto !important;
        padding: 20px;
    }

    .hero-module {
        grid-column: span 1;
        grid-row: auto;
    }

    .stencil-text {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
    }

    h2 {
        font-size: clamp(1rem, 2vw, 1.4rem);
    }

    .kura-illustration {
        max-width: 100px;
    }
}

/* ============================================================
   Nature Motifs (Vines & Leaves)
   ============================================================ */

.module::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    opacity: 0.15;
    pointer-events: none;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M 50 0 Q 40 20 50 40 Q 60 60 40 80 Q 20 90 10 100" fill="none" stroke="%237A8A6A" stroke-width="1.5"/><path d="M 55 10 L 65 20 M 60 25 L 75 30 M 50 50 L 70 55" stroke="%237A8A6A" stroke-width="1"/></svg>') no-repeat;
    background-size: contain;
}

/* ============================================================
   Entry Sequence Timing
   ============================================================ */

body {
    background-color: var(--bg-main);
    animation: entryBackground 400ms ease-out;
}

@keyframes entryBackground {
    0% {
        background-color: var(--bg-main);
    }
    100% {
        background-color: var(--bg-main);
    }
}

.hero-module {
    animation-delay: 400ms;
}

.module:nth-child(2) {
    animation-delay: calc(400ms + 150ms * 1);
}

.module:nth-child(3) {
    animation-delay: calc(400ms + 150ms * 2);
}

.module:nth-child(4) {
    animation-delay: calc(400ms + 150ms * 3);
}

.module:nth-child(5) {
    animation-delay: calc(400ms + 150ms * 4);
}

.module:nth-child(6) {
    animation-delay: calc(400ms + 150ms * 5);
}

.module:nth-child(7) {
    animation-delay: calc(400ms + 150ms * 6);
}

.module:nth-child(8) {
    animation-delay: calc(400ms + 150ms * 7);
}

.module:nth-child(9) {
    animation-delay: calc(400ms + 150ms * 8);
}

.module:nth-child(10) {
    animation-delay: calc(400ms + 150ms * 9);
}

.module:nth-child(11) {
    animation-delay: calc(400ms + 150ms * 10);
}

.module:nth-child(12) {
    animation-delay: calc(400ms + 150ms * 11);
}

.module:nth-child(13) {
    animation-delay: calc(400ms + 150ms * 12);
}

/* ============================================================
   Touch Device Styles
   ============================================================ */

@media (hover: none) and (pointer: coarse) {
    .module {
        cursor: pointer;
    }

    .module:active {
        transform: rotate(0deg) translate(0, 0);
    }
}
