/* ==============================================
   YESAN.XYZ - CALLIGRAPHIC TREASURY
   Hand-drawn bento grid aesthetic with Korean cultural references
============================================== */

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

html, body {
    width: 100%;
    height: 100%;
    font-family: "Noto Sans KR", sans-serif;
    background-color: #faf3e6;
    color: #2c1810;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow-x: hidden;
}

/* BENTO GRID CONTAINER */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: minmax(200px, auto);
    gap: 6px;
    width: 100vw;
    height: 100vh;
    padding: 0;
    background-color: #faf3e6;
    overflow: hidden;
    animation: gridReveal 1.6s ease-out 0.2s both;
}

@keyframes gridReveal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* INDIVIDUAL BENTO CELL */
.bento-cell {
    background-color: #faf3e6;
    border: 1.5px solid #1e1410;
    filter: url(#brushEdge);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
    animation: cellFadeIn 0.6s ease-out both;
}

.bento-cell:nth-child(1) { animation-delay: 0.2s; }
.bento-cell:nth-child(2) { animation-delay: 0.28s; }
.bento-cell:nth-child(3) { animation-delay: 0.36s; }
.bento-cell:nth-child(4) { animation-delay: 0.44s; }
.bento-cell:nth-child(5) { animation-delay: 0.52s; }
.bento-cell:nth-child(6) { animation-delay: 0.6s; }
.bento-cell:nth-child(n+7) { animation-delay: calc(0.6s + (var(--row-index, 1) * 0.08s)); }

@keyframes cellFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* MOTIF CELLS (decorative) */
.motif-cell {
    background-color: #f0e8d4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.small-motif {
    padding: 12px;
}

/* CELL CONTENT WRAPPER */
.cell-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    height: 100%;
}

/* HERO CELL */
.hero-cell {
    background: linear-gradient(135deg, #faf3e6 0%, #f0e8d4 100%);
    grid-column: span 3;
    grid-row: span 2;
    font-size: clamp(1.5rem, 5vw, 4rem);
    padding: 40px;
}

.domain-title {
    font-family: "Instrument Sans", sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 6vw, 3.5rem);
    color: #b87333;
    letter-spacing: 0.02em;
    margin-bottom: 15px;
    line-height: 1.1;
    word-break: break-word;
}

.subtitle-korean {
    font-family: "Noto Sans KR", sans-serif;
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 700;
    color: #c44e28;
    margin-bottom: 8px;
}

.subtitle-english {
    font-family: "Instrument Sans", sans-serif;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    color: #6b5a4e;
    font-weight: 400;
    letter-spacing: 0.05em;
}

/* ICON CELLS */
.icon-cell {
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.icon {
    width: 80px;
    height: 80px;
    max-width: 100%;
    max-height: 100%;
    animation: iconDraw 0.6s ease-out both;
}

@keyframes iconDraw {
    from {
        stroke-dasharray: 1000;
        stroke-dashoffset: 1000;
        opacity: 0;
    }
    to {
        stroke-dasharray: 1000;
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

.icon-label {
    font-family: "Caveat", cursive;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: #3d2b1f;
    font-weight: 600;
    text-align: center;
}

/* TEXT CELLS */
.text-cell {
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 10px;
    padding: 20px;
    grid-column: span 2;
}

.text-cell h2 {
    font-family: "Instrument Sans", sans-serif;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 700;
    color: #b87333;
    letter-spacing: 0.01em;
    margin-bottom: 8px;
}

.text-cell p {
    font-size: clamp(0.85rem, 1.3vw, 1rem);
    line-height: 1.7;
    color: #2c1810;
    font-weight: 400;
}

/* CULTURAL MOTIFS */
.cultural-motif {
    width: 100%;
    height: 100%;
    max-width: 120px;
    max-height: 150px;
    animation: motifDraw 0.8s ease-out both;
}

.small-cultural-motif {
    width: 60px;
    height: 60px;
}

@keyframes motifDraw {
    from {
        stroke-dasharray: 500;
        stroke-dashoffset: 500;
        opacity: 0;
    }
    to {
        stroke-dasharray: 500;
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

.motif-path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.motif-label {
    font-family: "Caveat", cursive;
    font-size: clamp(0.8rem, 1.1vw, 1rem);
    color: #3d2b1f;
    font-weight: 600;
    margin-top: 5px;
    text-align: center;
}

/* GLITCH EFFECT (periodic random cell) */
.bento-cell.glitch {
    animation: glitchPulse 0.3s ease-in-out;
    filter: saturate(3) hue-rotate(180deg);
    border-color: #7fb5a0;
}

@keyframes glitchPulse {
    0%, 100% {
        clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
    }
    50% {
        clip-path: polygon(0% 0%, 100% 0%, 100% 45%, 0% 55%);
    }
}

/* COLOR PALETTE ACCENT VARIATIONS */
.bento-cell:nth-child(2) { border-color: #c44e28; }
.bento-cell:nth-child(5) h2,
.bento-cell:nth-child(8) h2 { color: #d4a030; }

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: minmax(160px, auto);
        gap: 5px;
    }

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

    .text-cell {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: minmax(140px, auto);
        gap: 4px;
        height: auto;
        min-height: 100vh;
        padding: 0;
    }

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

    .text-cell {
        grid-column: span 2;
    }

    .motif-cell {
        grid-column: span 1;
        grid-row: span 1;
    }

    .icon-cell {
        grid-column: span 1;
        grid-row: span 1;
    }

    .bento-cell {
        padding: 12px;
    }

    .icon {
        width: 60px;
        height: 60px;
    }

    .domain-title {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }

    .subtitle-korean {
        font-size: clamp(1rem, 2.5vw, 1.5rem);
    }

    .text-cell h2 {
        font-size: clamp(1rem, 1.8vw, 1.2rem);
    }

    .text-cell p {
        font-size: clamp(0.8rem, 1.2vw, 0.95rem);
    }
}

@media (max-width: 480px) {
    .bento-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(120px, auto);
        gap: 3px;
    }

    .hero-cell,
    .text-cell,
    .motif-cell {
        grid-column: span 1;
    }

    .hero-cell {
        grid-row: span 1;
    }

    .bento-cell {
        padding: 10px;
    }

    .icon {
        width: 50px;
        height: 50px;
    }

    .icon-label,
    .motif-label {
        font-size: 0.75rem;
    }

    .domain-title {
        font-size: clamp(1.2rem, 3vw, 1.8rem);
        margin-bottom: 8px;
    }

    .subtitle-korean {
        font-size: 1rem;
    }

    .subtitle-english {
        font-size: 0.8rem;
    }

    .text-cell {
        gap: 6px;
        padding: 12px;
    }

    .text-cell h2 {
        font-size: 1rem;
        margin-bottom: 4px;
    }

    .text-cell p {
        font-size: 0.8rem;
        line-height: 1.5;
    }
}

/* ACCESSIBILITY */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* DARK MODE SUPPORT */
@media (prefers-color-scheme: dark) {
    body,
    .bento-grid {
        background-color: #1e1410;
        color: #f5e6d3;
    }

    .bento-cell {
        background-color: #2c1810;
        border-color: #6b5a4e;
    }

    .motif-cell {
        background-color: #3d2b1f;
    }

    .domain-title {
        color: #d4a030;
    }

    .subtitle-korean {
        color: #d4a030;
    }

    .icon-label,
    .motif-label {
        color: #f5e6d3;
    }

    .text-cell h2 {
        color: #d4a030;
    }

    .text-cell p {
        color: #e6d4c3;
    }
}
