/* yongjoon.dev - Scholar's Cabinet Styles */

:root {
    --bg-desk: #3d2a1e;
    --cell-cream: #f2e8d6;
    --cell-parchment: #ece0c8;
    --accent-burgundy: #7a2e38;
    --accent-brass: #b89858;
    --text-primary: #2a1c12;
    --text-secondary: #6b5842;
    --ivory: #faf3e6;
    --shadow-dark: #1e1208;
    --link-burgundy: #5c1e28;
    --success-sage: #5a7a5e;
    
    --gap: 20px;
    --hex-size: 260px;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Literata', Georgia, serif;
    color: var(--text-primary);
    line-height: 1.75;
    letter-spacing: 0.008em;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-desk);
    background-image: 
        url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence baseFrequency='0.4' numOctaves='4' seed='2' /%3E%3CfeColorMatrix type='saturate' values='0.3' /%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' /%3E%3C/svg%3E"),
        repeating-linear-gradient(170deg, transparent, transparent 4px, rgba(0,0,0,0.03) 4px, rgba(0,0,0,0.03) 5px);
    background-repeat: repeat;
    z-index: -1;
}

.container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.hexagon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--hex-size), 1fr));
    gap: var(--gap);
    max-width: 1400px;
    width: 100%;
    align-items: center;
    animation: gridFadeIn 0.6s ease-out;
}

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

.hex-cell {
    aspect-ratio: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--cell-cream);
    clip-path: polygon(25% 5%, 75% 5%, 97% 50%, 75% 95%, 25% 95%, 3% 50%);
    box-shadow: 3px 4px 8px rgba(30, 18, 10, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='cellNoise'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='3' /%3E%3CfeColorMatrix type='saturate' values='0.4' /%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23cellNoise)' /%3E%3C/svg%3E");
    background-repeat: repeat;
    opacity: 0.8;
    pointer-events: none;
}

.hex-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.08), inset 0 -1px 3px rgba(255,255,255,0.4);
    pointer-events: none;
}

.hex-cell.cultural-cell {
    background: var(--cell-parchment);
}

.hex-cell.cultural-cell::before {
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='culturalNoise'%3E%3CfeTurbulence baseFrequency='0.5' numOctaves='4' /%3E%3CfeColorMatrix type='saturate' values='0.2' /%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23culturalNoise)' /%3E%3C/svg%3E");
    opacity: 1;
}

.hex-cell.hero-cell {
    grid-column: 2;
    animation: heroCellAppear 0.8s ease-out;
}

@keyframes heroCellAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hex-cell:hover:not(.hero-cell) {
    transform: translateY(-3px);
    box-shadow: 4px 6px 12px rgba(30, 18, 10, 0.35);
    border-top: 2px solid var(--accent-brass);
    padding-top: 2px;
}

.hex-cell.shake {
    animation: shakeCell 0.3s ease-in-out;
}

@keyframes shakeCell {
    0%, 100% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-3px);
    }
    40% {
        transform: translateX(3px);
    }
    60% {
        transform: translateX(-2px);
    }
    80% {
        transform: translateX(2px);
    }
}

.hex-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    text-align: center;
    width: 100%;
    height: 100%;
}

.hex-cell h1 {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 2.8rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.hex-cell h3 {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.hex-cell.hero-cell h1 {
    font-size: clamp(2rem, 4vw, 3rem);
}

.subtitle {
    font-family: 'Literata', serif;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    font-weight: 400;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
}

.specimen-id {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    font-weight: 300;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin: 0;
}

.motif-svg {
    width: 80%;
    height: 80%;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

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

.modal-header {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    color: white;
}

.modal-header h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.8rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--accent-brass);
}

.modal-content {
    background: var(--cell-cream);
    padding: 40px;
    border-radius: 8px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.4s ease-out;
}

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

.modal-content h3 {
    color: var(--accent-burgundy);
    margin-top: 0;
}

.modal-content p {
    color: var(--text-primary);
    margin: 12px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --hex-size: 200px;
        --gap: 16px;
    }
    
    .container {
        padding: 20px 10px;
    }
    
    .hex-cell.hero-cell {
        grid-column: 1;
    }
    
    .modal-content {
        margin: 20px;
        max-width: calc(100% - 40px);
    }
}

@media (max-width: 480px) {
    :root {
        --hex-size: 150px;
        --gap: 12px;
    }
    
    .container {
        padding: 16px 8px;
    }
    
    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .modal-content {
        margin: 60px 16px 16px;
        padding: 24px;
    }
}

/* Print Styles */
@media print {
    .background,
    .close-btn,
    .modal {
        display: none;
    }
    
    .hex-cell {
        break-inside: avoid;
    }
}
