/* Font Face */
@font-face {
    font-family: 'BaselGrotesk';
    src: url('fonts/BaselGrotesk-Medium.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* CSS Variables for theming */
:root {
    --bg-primary: #000000;
    --bg-secondary: #000000;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --poster-bg: #ffffff;
    --poster-text: #000000;
    --poster-border: #333333;
}

/* Dark mode variables */
body.dark-mode {
    --bg-primary: #2a2a2a; /* Dark grey page background */
    --bg-secondary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --poster-bg: #000000; /* Black poster background */
    --poster-text: #ffffff; /* White text on poster */
    --poster-border: #333333;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'BaselGrotesk', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
    transition: background-color 0.3s ease;
}

.container {
    width: 100%;
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    height: 100vh;
    padding: 0;
}

/* Header - removed for techy UI */

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    overflow-y: auto;
    flex-shrink: 0;
    transition: background-color 0.3s ease;
    z-index: 1000;
    position: relative;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: auto;
    position: relative;
    min-height: 100vh;
    margin-left: -140px; /* Half of sidebar width (280px) to center in viewport */
}

/* Controls Panel */
.controls-panel {
    background: var(--bg-secondary);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    transition: background-color 0.3s ease;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 400;
    color: #cccccc;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'BaselGrotesk', sans-serif;
    margin-bottom: 4px;
    display: block;
}

.control-group input,
.control-group select {
    padding: 6px 8px;
    border: 1px solid #333333;
    background: #000000;
    color: #ffffff;
    font-family: 'BaselGrotesk', sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.control-group input:hover,
.control-group select:hover {
    border-color: #666666;
    background: #111111;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-group select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    padding-right: 28px;
    width: 100%;
    min-height: 32px;
    cursor: pointer;
}

.control-group select:focus {
    outline: none;
    border-color: #666666;
    background-color: #111111;
}

.control-group select option {
    background: #000000;
    color: #ffffff;
    padding: 4px 8px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group input[type="radio"] {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    accent-color: #ffffff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 1px solid #333333;
    background: #000000;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
}

.control-group input[type="radio"]:checked {
    background: #ffffff;
    border-color: #ffffff;
}

.control-group input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    background: #000000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.control-group input[type="radio"]:hover {
    border-color: #666666;
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.control-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    accent-color: #ffffff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 1px solid #333333;
    background: #000000;
    border-radius: 2px;
    position: relative;
    transition: all 0.2s ease;
}

.control-group input[type="checkbox"]:checked {
    background: #ffffff;
    border-color: #ffffff;
}

.control-group input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    background: #000000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.control-group input[type="checkbox"]:hover {
    border-color: #666666;
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.radio-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #888888;
    background: #111111;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.control-group button {
    padding: 10px 15px;
    background: #000000;
    color: #ffffff;
    border: 1px solid #333333;
    font-family: 'BaselGrotesk', sans-serif;
    font-size: 10px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.control-group button:hover {
    background: #111111;
    border-color: #666666;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.control-group button:focus {
    outline: none;
    border-color: #888888;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.control-group button:active {
    background: #222222;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Poster Container */
.poster-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.poster {
    background: var(--poster-bg);
    overflow: hidden;
    position: relative;
    /* 1/√2 ratio: width/height = 1/√2 ≈ 0.707 */
    width: 600px;
    min-height: 848px; /* 600 / √2 ≈ 848 - minimum height */
    display: flex;
    flex-direction: column;
    padding: var(--margin, 4px);
    transition: background-color 0.3s ease;
}

.poster-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 24), 1fr);
    grid-auto-rows: auto;
    row-gap: var(--row-gap, 8px);
    column-gap: var(--column-gap, 3px);
    align-content: start;
    overflow: visible;
}

/* Grid items */
.grid-item {
    position: relative;
    background: var(--poster-bg);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    transition: background-color 0.3s ease;
}

.grid-item img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

.grid-item .caption {
    position: relative;
    background: #000000;
    color: #ffffff;
    padding: 1px 2px 1px 0;
    font-family: 'BaselGrotesk', sans-serif;
    font-size: 0.4rem;
    font-weight: normal;
    text-align: left;
    line-height: 1.0;
    margin-top: 1px;
    flex-shrink: 0;
}

/* Image number overlay */
.image-number {
    position: absolute;
    bottom: 0;
    left: 0;
    color: var(--poster-text);
    font-family: 'BaselGrotesk', sans-serif;
    font-size: 0.3rem;
    font-weight: normal;
    line-height: 1.0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
    padding-left: 0;
    padding-bottom: 1px;
    z-index: 99999;
    pointer-events: none;
}

/* Image number positioned below image */
.image-number.below-image {
    position: absolute;
    bottom: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    z-index: 99999;
    padding-left: 0;
    pointer-events: none;
}

/* Dynamic column spans for more interesting layout */
.grid-item.span-1 {
    grid-column: span 1;
}

.grid-item.span-2 {
    grid-column: span 2;
}

.grid-item.span-3 {
    grid-column: span 3;
}

.grid-item.span-4 {
    grid-column: span 4;
}

.grid-item.span-6 {
    grid-column: span 6;
}

.grid-item.span-8 {
    grid-column: span 8;
}

.grid-item.span-9 {
    grid-column: span 9;
}

.grid-item.span-10 {
    grid-column: span 10;
}

.grid-item.span-11 {
    grid-column: span 11;
}

.grid-item.span-12 {
    grid-column: span 12;
}

.grid-item.span-13 {
    grid-column: span 13;
}

.grid-item.span-14 {
    grid-column: span 14;
}

.grid-item.span-15 {
    grid-column: span 15;
}

.grid-item.span-16 {
    grid-column: span 16;
}

.grid-item.span-17 {
    grid-column: span 17;
}

.grid-item.span-18 {
    grid-column: span 18;
}

.grid-item.span-19 {
    grid-column: span 19;
}

.grid-item.span-20 {
    grid-column: span 20;
}

.grid-item.span-21 {
    grid-column: span 21;
}

.grid-item.span-22 {
    grid-column: span 22;
}

.grid-item.span-23 {
    grid-column: span 23;
}

.grid-item.span-24 {
    grid-column: span 24;
}

.grid-item.span-25 {
    grid-column: span 25;
}

.grid-item.span-26 {
    grid-column: span 26;
}

.grid-item.span-27 {
    grid-column: span 27;
}

.grid-item.span-28 {
    grid-column: span 28;
}

.grid-item.span-29 {
    grid-column: span 29;
}

.grid-item.span-30 {
    grid-column: span 30;
}

.grid-item.span-31 {
    grid-column: span 31;
}

.grid-item.span-32 {
    grid-column: span 32;
}



/* Info Panel */
.info-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-family: 'BaselGrotesk', sans-serif;
    transition: color 0.3s ease;
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 12px;
    border-radius: 4px;
    backdrop-filter: blur(10px);
    z-index: 1000;
    opacity: 1;
}

/* Typewriter animation for project count */
#project-count {
    font-family: 'BaselGrotesk', sans-serif;
    font-size: 0.6rem;
    color: #888888;
    white-space: nowrap;
    overflow: hidden;
    width: 0;
    display: inline-block;
    position: relative;
}

#project-count::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #888888;
    animation: blink-caret 1s infinite;
}

#project-count.typewriter-animating {
    animation: typewriter 1.5s steps(40, end) forwards;
}

/* Keep cursor visible - no hiding needed */

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink-caret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: #888888;
    }
}

.info-panel p {
    margin: 0;
    white-space: nowrap;
}


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

/* Project Index on Poster */
.poster-index {
    position: absolute;
    color: var(--poster-text);
    font-family: 'BaselGrotesk', sans-serif;
    font-size: 0.3rem;
    line-height: 1.0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px 6px;
    z-index: 10;
    transition: color 0.3s ease;
    text-align: left;
}

.poster-index-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

.poster-index-number {
    color: var(--poster-text);
    font-weight: normal;
    min-width: 12px;
    font-size: 0.3rem;
    font-family: 'BaselGrotesk', sans-serif;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

.poster-index-name {
    color: var(--poster-text);
    font-weight: normal;
    font-size: 0.3rem;
    font-family: 'BaselGrotesk', sans-serif;
    transition: color 0.3s ease;
}

.poster-index-year {
    color: var(--poster-text);
    font-weight: normal;
    font-size: 0.3rem;
    font-family: 'BaselGrotesk', sans-serif;
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

/* Poster Description */
.poster-description {
    position: absolute;
    color: var(--poster-text);
    font-family: 'BaselGrotesk', sans-serif;
    font-size: 0.3rem;
    line-height: 1.0;
    z-index: 10;
    max-width: 200px;
    text-align: left;
    transition: color 0.3s ease;
}

.poster-description-title {
    color: var(--poster-text);
    font-family: 'BaselGrotesk', sans-serif;
    font-size: 0.3rem;
    font-weight: normal;
    margin: 0 0 8px 0;
    padding: 0;
    transition: color 0.3s ease;
}

.poster-description p {
    margin: 0;
    padding: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .controls-panel {
        padding: 15px;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .controls-panel {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
    }
    
    .main-content {
        padding: 15px;
        align-items: center;
        justify-content: center;
        margin-left: 0; /* Reset margin on mobile */
    }
    
    .poster {
        width: 100%;
        max-width: 400px;
        height: 565px; /* 400 / √2 */
        padding: 15px;
    }
    
    .info-panel {
        bottom: 10px;
        right: 10px;
        font-size: 0.6rem;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .controls-panel {
        grid-template-columns: 1fr;
    }
    
    .poster {
        width: 100%;
        max-width: 300px;
        height: 424px; /* 300 / √2 */
        padding: 10px;
    }
    
    .grid-item .caption {
        font-size: 0.6rem;
        padding: 3px 4px;
    }
}

/* Loading state */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    font-size: 0.9rem;
    color: #666666;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

/* Error state */
.error {
    color: #ff6666;
    text-align: center;
    padding: 15px;
    background: #111111;
    border: 1px solid #333333;
    margin: 15px 0;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

/* Grid Item Styles */
.grid-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    overflow: visible;
}



/* Animation classes for different patterns */

/* Default Stagger Animation */
.grid-item.animate-stagger {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.grid-item.animate-stagger-delayed-1 { 
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.1s; 
}
.grid-item.animate-stagger-delayed-2 { 
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.2s; 
}
.grid-item.animate-stagger-delayed-3 { 
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.3s; 
}
.grid-item.animate-stagger-delayed-4 { 
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.4s; 
}
.grid-item.animate-stagger-delayed-5 { 
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.5s; 
}
.grid-item.animate-stagger-delayed-6 { 
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.6s; 
}
.grid-item.animate-stagger-delayed-7 { 
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.7s; 
}
.grid-item.animate-stagger-delayed-8 { 
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.8s; 
}
.grid-item.animate-stagger-delayed-9 { 
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.9s; 
}
.grid-item.animate-stagger-delayed-10 { 
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 1.0s; 
}

/* Random Animation */
.grid-item.animate-random {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: randomIn 0.3s cubic-bezier(0.15, 0.25, 0.15, 1) forwards;
}

/* Row by Row Animation */
.grid-item.animate-rows {
    opacity: 0;
    transform: scale(0.8) translateY(30px);
    animation: rowIn 0.35s cubic-bezier(0.15, 0.25, 0.15, 1) forwards;
}

/* Column by Column Animation */
.grid-item.animate-columns {
    opacity: 0;
    transform: scale(0.8) translateX(30px);
    animation: columnIn 0.35s cubic-bezier(0.15, 0.25, 0.15, 1) forwards;
}

/* Center Out Animation */
.grid-item.animate-center-out {
    opacity: 0;
    transform: scale(0.3);
    animation: centerOut 0.4s cubic-bezier(0.15, 0.25, 0.15, 1) forwards;
}

/* Edges In Animation */
.grid-item.animate-edges-in {
    opacity: 0;
    transform: scale(0.8) translateY(40px);
    animation: edgesIn 0.3s cubic-bezier(0.15, 0.25, 0.15, 1) forwards;
}

/* Text elements animation */
.poster-index.animate-in {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.8s ease-out forwards;
    animation-delay: 0.5s;
}

.poster-description.animate-in {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.8s ease-out forwards;
    animation-delay: 0.7s;
}

/* Keyframe animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}


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

@keyframes rowIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes columnIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateX(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

@keyframes centerOut {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes edgesIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(40px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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