/* ============================================
   JAPANESE THEMED SERVER PORTAL
   8 Themes with Background Images
   ============================================ */

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --transition-speed: 0.6s;
    --hover-lift: -10px;
    --overlay-darkness: rgba(0, 0, 0, 0.65);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans JP', 'Segoe UI', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    color: #fff;
}

/* ============================================
   BACKGROUND IMAGE & PARALLAX
   ============================================ */
.bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.bg-image {
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.8s ease;
    will-change: transform;
}

.bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-darkness);
    z-index: 1;
}

/* Shader Canvas with Opacity Transition */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0;
    display: none;
    transition: opacity 0.5s ease;
}

body.shader-active #canvas-container {
    display: block;
    opacity: 1;
}

body.shader-active .bg-container {
    opacity: 0;
    pointer-events: none;
}

.bg-image {
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    /* No transition - instant display for preloaded images */
    will-change: transform;
}

.bg-image[style*="background-image"] {
    opacity: 1;
}

/* ============================================
   THEME NAVIGATION (COMPACT)
   ============================================ */
.theme-nav {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    z-index: 100;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.theme-nav:hover {
    background: rgba(0, 0, 0, 0.5);
}

.theme-nav-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.theme-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.15);
}

.theme-btn:active {
    transform: scale(0.95);
}

.theme-btn svg {
    width: 16px;
    height: 16px;
}

.theme-info {
    text-align: center;
    min-width: 100px;
}

.theme-name-display {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.2;
}

.theme-jp {
    display: block;
    font-family: 'Yuji Syuku', serif;
    font-size: 0.7rem;
    opacity: 0.85;
    line-height: 1.1;
}

.theme-dots {
    display: flex;
    gap: 5px;
}

.theme-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-dot:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(1.3);
}

.theme-dot.active {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.3);
}

.keyboard-hint {
    font-size: 0.6rem;
    opacity: 0.5;
    font-family: monospace;
}

.keyboard-hint span {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 4px;
    border-radius: 3px;
}

/* ============================================
   LAYOUT
   ============================================ */
.overlay {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    padding-top: 5rem;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.title-en {
    display: block;
}

.title-jp {
    display: block;
    font-family: 'Yuji Syuku', serif;
    font-size: 0.8em;
    opacity: 0.9;
}

.subtitle {
    font-size: 1rem;
    letter-spacing: 0.15em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    opacity: 0.9;
}

.subtitle-en {
    display: block;
}

.subtitle-jp {
    display: block;
    font-size: 0.85em;
    opacity: 0.8;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 1000px;
    perspective: 1000px;
}

.service-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.icon-svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.card-text {
    text-align: center;
}

.service-card h2 {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.name-en {
    display: block;
}

.name-jp {
    display: block;
    font-family: 'Noto Serif JP', serif;
    font-size: 0.75em;
    opacity: 0.9;
}

.service-card p {
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    opacity: 0.8;
}

.desc-en {
    display: block;
}

.desc-jp {
    display: block;
    font-size: 0.85em;
    opacity: 0.75;
}

.service-card:hover .card-icon {
    transform: scale(1.15) translateZ(20px);
}

.service-card:hover {
    transform: translateY(var(--hover-lift)) rotateX(5deg) rotateY(-5deg);
    background: rgba(0, 0, 0, 0.55);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

footer {
    margin-top: 2.5rem;
    text-align: center;
}

footer p {
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    opacity: 0.85;
}

.footer-en {
    display: block;
}

.footer-jp {
    display: block;
    font-family: 'Yuji Syuku', serif;
    font-size: 1.1em;
    opacity: 0.9;
}

/* ============================================
   THEME-SPECIFIC ACCENT COLORS
   ============================================ */

/* Zen Mountains - Cool Blue/White */
body.theme-zen .title-jp,
body.theme-zen .name-jp {
    color: #a8d4f0;
}

/* Sakura Storm - Pink */
body.theme-sakura .title-jp,
body.theme-sakura .name-jp {
    color: #ffb6c1;
}

/* Torii Gate - Red/Vermillion */
body.theme-torii .title-jp,
body.theme-torii .name-jp {
    color: #ff6b6b;
}

/* Kinkakuji - Gold */
body.theme-kinkakuji .title-jp,
body.theme-kinkakuji .name-jp {
    color: #d4af37;
}

/* Spirited Away - Warm */
body.theme-spirited .title-jp,
body.theme-spirited .name-jp {
    color: #f4a460;
}

/* Your Name - Night Blue */
body.theme-yourname .title-jp,
body.theme-yourname .name-jp {
    color: #87ceeb;
}

/* Artistic - Purple */
body.theme-artistic .title-jp,
body.theme-artistic .name-jp {
    color: #da70d6;
}

/* Cyber Tokyo - Neon */
body.theme-cyber .title-jp,
body.theme-cyber .name-jp {
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

body.theme-cyber header h1 {
    animation: neonFlicker 4s infinite;
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.8), 0 0 20px rgba(255, 0, 255, 0.4);
}

@keyframes neonFlicker {
    0%, 100% { opacity: 1; }
    5% { opacity: 0.8; }
    10% { opacity: 1; }
    15% { opacity: 0.9; }
    20% { opacity: 1; }
    50% { opacity: 1; }
    52% { opacity: 0.7; }
    54% { opacity: 1; }
}

body.theme-cyber .service-card {
    border-color: rgba(255, 0, 255, 0.2);
    box-shadow: inset 0 0 20px rgba(255, 0, 255, 0.05);
}

body.theme-cyber .service-card:hover {
    border-color: rgba(255, 0, 255, 0.4);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 0, 255, 0.15), inset 0 0 30px rgba(255, 0, 255, 0.05);
}

body.theme-cyber .subtitle {
    color: #00ffff;
}

body.theme-cyber footer p {
    color: #ff00ff;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .theme-nav {
        position: fixed;
        top: auto;
        bottom: 1rem;
        right: 50%;
        transform: translateX(50%);
        padding: 0.5rem 0.8rem;
        background: rgba(0, 0, 0, 0.7);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .theme-btn {
        width: 32px;
        height: 32px;
    }
    
    .theme-btn svg {
        width: 16px;
        height: 16px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
    
    .service-card {
        padding: 1.5rem 1rem;
    }
    
    .overlay {
        padding-top: 2rem;
        padding-bottom: 5rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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