/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    background: #fff;
    color: #000000;
    line-height: 1.4;
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Dark Mode */
body.dark-mode,
html.dark-mode-loading body {
    background: #0a0a0a;
    color: #e0e0e0;
}

body.dark-mode .header,
html.dark-mode-loading .header {
    background: rgba(10, 10, 10, 0.95);
}

body.dark-mode .header-name,
body.dark-mode .header-back,
html.dark-mode-loading .header-name,
html.dark-mode-loading .header-back {
    color: #e0e0e0;
}

body.dark-mode .header-btn,
html.dark-mode-loading .header-btn {
    color: #888;
}

body.dark-mode .header-btn:hover,
body.dark-mode .header-btn.active,
html.dark-mode-loading .header-btn:hover,
html.dark-mode-loading .header-btn.active {
    color: #e0e0e0;
}

body.dark-mode .product-code,
html.dark-mode-loading .product-code {
    color: #e0e0e0;
}

body.dark-mode .product-image img,
html.dark-mode-loading .product-image img {
    filter: grayscale(20%) brightness(0.9);
}

body.dark-mode #transition-overlay,
html.dark-mode-loading #transition-overlay {
    background: #0a0a0a;
}

body.dark-mode #page-load-overlay,
html.dark-mode-loading #page-load-overlay {
    background: #0a0a0a;
}

body.dark-mode .carousel-btn {
    color: #e0e0e0;
}

body.dark-mode .dot {
    background: #444;
}

body.dark-mode .dot:hover {
    background: #666;
}

body.dark-mode .dot.active {
    background: #e0e0e0;
}

body.dark-mode .game-code {
    color: #e0e0e0;
}

body.dark-mode .game-description {
    color: #999;
}

body.dark-mode .expand-btn {
    border-color: #333;
    color: #e0e0e0;
}

body.dark-mode .expand-btn:hover {
    border-color: #e0e0e0;
}

body.dark-mode .game-details p {
    color: #999;
}

body.dark-mode .tech-label {
    color: #666;
}

body.dark-mode .tech-value {
    color: #e0e0e0;
}

body.dark-mode .tech-info {
    border-top-color: #222;
}

body.dark-mode .cv-toolbar {
    border-bottom-color: #333;
}

body.dark-mode .cv-title {
    color: #e0e0e0;
}

body.dark-mode .cv-link {
    color: #999;
}

body.dark-mode .cv-link:hover {
    color: #e0e0e0;
    border-color: #e0e0e0;
}

body.dark-mode .cv-name {
    color: #e0e0e0;
}

body.dark-mode .cv-contact {
    color: #999;
}

body.dark-mode .cv-contact a {
    color: #999;
}

body.dark-mode .cv-contact a:hover {
    color: #e0e0e0;
    border-color: #e0e0e0;
}

body.dark-mode .cv-heading {
    border-bottom-color: #e0e0e0;
}

body.dark-mode .cv-section-title {
    border-bottom-color: #e0e0e0;
}

body.dark-mode .cv-item-title {
    color: #e0e0e0;
}

body.dark-mode .cv-item-date,
body.dark-mode .cv-item-location,
body.dark-mode .cv-item-note {
    color: #999;
}

body.dark-mode .cv-item-subtitle {
    color: #ccc;
}

body.dark-mode .cv-item-list,
body.dark-mode .cv-skills-list {
    color: #b0b0b0;
}

body.dark-mode .cv-project-title {
    color: #e0e0e0;
}

body.dark-mode .cv-project-tech {
    color: #999;
}

body.dark-mode .cv-project-desc {
    color: #aaa;
}

/* Zoom Container */
#zoom-container {
    width: 100%;
    height: 100%;
    transform-origin: center center;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

#zoom-container.zooming {
    pointer-events: none;
}

#zoom-container .header {
    transition: opacity 0.25s ease,
                background-color 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease;
}

#zoom-container.zooming .header,
#zoom-container.zooming .product-item:not(.target) {
    opacity: 0;
}

#zoom-container.zooming .product-item.target {
    opacity: 1;
}

/* Transition Overlay */
#transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.4s ease;
}

#transition-overlay.active {
    opacity: 1;
}

.product-item.target {
    position: relative;
    z-index: 100;
}


/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem 1.5rem;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.header-name {
    position: absolute;
    left: 1.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: #000;
    text-decoration: none;
}

.header-back {
    position: absolute;
    left: 0.5rem;
    font-size: 1.5rem;
    color: #000;
    text-decoration: none;
    padding: 0.5rem;
    transition: opacity 0.2s;
}

.header-back:hover {
    opacity: 0.6;
}

.detail-page-header {
    opacity: 0;
    animation: fadeInElement 0.4s ease forwards 0.1s;
}

.header-buttons {
    display: flex;
    gap: 2rem;
}

.header-btn {
    background: transparent;
    border: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    cursor: pointer;
    padding: 0.5rem 0;
    color: #666;
    transition: color 0.2s;
}

.header-btn:hover {
    color: #000;
}

/* Active header button (current page) */
.header-btn.active {
    color: #000;
    cursor: default;
    pointer-events: none;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    right: 1.5rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    color: #000;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    opacity: 0.6;
}

.theme-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    transform-origin: center center;
    line-height: 1;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(180deg);
}

body.dark-mode .theme-toggle {
    color: #e0e0e0;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
    padding: 5rem 1rem 2rem;
    max-width: 100%;
}

.product-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.product-item:hover {
    opacity: 0.7;
    transform: scale(1.02);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    background: transparent;
    margin-bottom: 0.75rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: grayscale(20%);
}

.product-code {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.07em;
    color: #000;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        padding: 4rem 0.5rem 1rem;
    }
    
    .product-item {
        padding: 0.5rem;
    }
    
    .header-buttons {
        gap: 1rem;
    }
    
    .header-btn {
        font-size: 0.6rem;
    }
    
    .header-name {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header {
        padding: 0.75rem 1rem;
    }
    
    .header-name {
        left: 1rem;
        font-size: 0.6rem;
    }
    
    .header-buttons {
        gap: 0.75rem;
    }
    
    .header-btn {
        font-size: 0.55rem;
        padding: 0.25rem 0;
    }
}

/* Game Detail Page */
.game-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6rem 2rem 4rem;
    max-width: 800px;
    margin: 0 auto;
}

.game-carousel {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeInDelayed 0.4s ease forwards 0.3s;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    opacity: 0;
    animation: fadeInDelayed 0.4s ease forwards 0.4s;
}

.game-info-section {
    text-align: center;
    width: 100%;
    max-width: 500px;
    opacity: 0;
    animation: fadeInDelayed 0.4s ease forwards 0.5s;
}

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

.detail-page-header {
    opacity: 0;
    animation: fadeInDelayed 0.4s ease forwards 0.1s;
}

.cv-page {
    opacity: 0;
    animation: fadeInDelayed 0.4s ease forwards 0.2s;
}

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

#page-load-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 10000;
    pointer-events: none;
    opacity: 1;
    animation: fadeOutQuick 0.3s ease forwards;
}

@keyframes fadeOutQuick {
    to {
        opacity: 0;
    }
}

.game-carousel {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin-bottom: 2rem;
}

.game-carousel {
    position: relative;
    overflow: hidden;
}

.carousel-container {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
    width: 100%;
}

.carousel-slide {
    min-width: 100%;
    width: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    min-height: 600px;
}

.carousel-image {
    width: 100%;
    aspect-ratio: 1;
    background: transparent;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
}

.carousel-image.video-container {
    aspect-ratio: 1;
    height: auto;
}

.carousel-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

.carousel-video {
    width: 100%;
    max-height: 600px;
    height: auto;
    object-fit: contain;
}

@keyframes slideLeft {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

@keyframes slideRight {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.carousel-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-top: 0.5rem;
    margin-bottom: 1.5rem;
}

.carousel-btn {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #000;
    cursor: pointer;
    padding: 0 1rem;
    opacity: 0.5;
    transition: all 0.3s ease;
    font-family: 'IBM Plex Mono', monospace;
    height: 40px;
    display: flex;
    align-items: center;
}

.carousel-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.carousel-prev {
    margin-right: auto;
}

.carousel-next {
    margin-left: auto;
}

.carousel-image {
    touch-action: pan-y pinch-zoom;
    cursor: grab;
}

.carousel-image:active {
    cursor: grabbing;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    height: 40px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dot:hover {
    transform: scale(1.2);
    background: #999;
}

.dot.active {
    background: #000;
}

.game-info-section {
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.game-code {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    color: #000;
}

.game-description {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 2rem;
    font-weight: 400;
}

.expand-btn {
    background: transparent;
    border: 1px solid #ddd;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0 auto 2rem;
    transition: all 0.3s;
}

.expand-btn:hover {
    border-color: #000;
}

.expand-icon {
    font-size: 1.5rem;
    font-weight: 300;
    transition: transform 0.3s;
}

.expand-btn.active .expand-icon {
    transform: rotate(45deg);
}

.game-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.game-details.show {
    max-height: 500px;
}

.game-details.hidden {
    display: none;
}

.game-details p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 2rem;
}

.tech-info {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-top: 1px solid #eee;
}

.tech-label {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: #999;
}

.tech-value {
    font-size: 0.7rem;
    color: #000;
    font-weight: 500;
}

@media (max-width: 768px) {
    .game-detail {
        padding: 5rem 1rem 3rem;
    }
    
    .carousel-btn {
        font-size: 2rem;
        padding: 0.5rem;
    }
    
    .game-code {
        font-size: 0.8rem;
    }
    
    .game-description {
        font-size: 0.8rem;
    }
}

/* CV Page */
.cv-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 6rem 2rem 4rem;
}

.cv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ddd;
}

.cv-title {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: #000;
    font-weight: 500;
}

.cv-actions {
    display: flex;
    gap: 1rem;
}

.cv-link {
    color: #666;
    text-decoration: none;
    font-size: 0.7rem;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.cv-link:hover {
    color: #000;
    border-color: #000;
}

/* CV Content */
.cv-content {
    line-height: 1.6;
}

.cv-heading {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #000;
}

.cv-name {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.cv-contact {
    font-size: 0.75rem;
    color: #666;
}

.cv-contact a {
    color: #666;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.cv-contact a:hover {
    color: #000;
    border-color: #000;
}

.cv-section {
    margin-bottom: 2.5rem;
}

.cv-section-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #000;
}

.cv-item {
    margin-bottom: 1.5rem;
}

.cv-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
    gap: 1rem;
}

.cv-item-title {
    font-weight: 600;
    font-size: 0.85rem;
}

.cv-item-date {
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
    white-space: nowrap;
}

.cv-item-subtitle {
    font-size: 0.8rem;
    font-style: italic;
    margin-bottom: 0.15rem;
}

.cv-item-location {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.cv-item-note {
    font-size: 0.7rem;
    color: #888;
    margin-top: 0.25rem;
}

.cv-item-list {
    margin-top: 0.5rem;
    padding-left: 1.25rem;
    font-size: 0.8rem;
}

.cv-item-list li {
    margin-bottom: 0.5rem;
}

.cv-skills-list {
    list-style: none;
    padding: 0;
    font-size: 0.8rem;
}

.cv-skills-list li {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}

.cv-skills-list li::before {
    content: '•';
    position: absolute;
    left: 0;
}

.cv-project {
    margin-bottom: 1.25rem;
}

.cv-project-title {
    font-weight: 600;
    font-size: 0.85rem;
    display: inline;
}

.cv-project-tech {
    display: inline;
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    margin-left: 0.25rem;
}

.cv-project-desc {
    font-size: 0.8rem;
    margin-top: 0.25rem;
    color: #444;
}

@media (max-width: 768px) {
    .cv-page {
        padding: 5rem 1rem 3rem;
    }
    
    .cv-name {
        font-size: 1.4rem;
    }
    
    .cv-item-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cv-item-date {
        white-space: normal;
    }
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.lightbox-image {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
}

.lightbox-video {
    max-width: 100%;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: default;
    pointer-events: auto;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 3rem;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    z-index: 10002;
    padding: 0.5rem;
    line-height: 1;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    z-index: 10002;
    padding: 1rem;
}

.lightbox-nav:hover {
    opacity: 1;
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

.lightbox-counter {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 0.9rem;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .lightbox-close {
        top: 1rem;
        right: 1rem;
        font-size: 2.5rem;
    }
    
    .lightbox-nav {
        font-size: 2.5rem;
        padding: 0.5rem;
    }
    
    .lightbox-prev {
        left: 0.5rem;
    }
    
    .lightbox-next {
        right: 0.5rem;
    }
}
