/* ============================================
   TILE SYSTEM - Metal Cards with 3D Effects
   ============================================ */

:root {
    /* Theme Colors */
    --color-software: #00aaff;
    --color-diving: #00ffcc;
    --color-flying: #ffaa00;
    --color-mathematics: #aa00ff;
    --color-travel: #ff6b35;
    --color-playground: #ff00ff;
    --color-larp: #8b4513;
    --color-paragliding: #00bfff;
}

/* Landing Container */
.landing-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 2rem;  /* 2rem statt 4rem oben */
    min-height: 100vh;
}

/* Header Tile - Dark Chrome/Gunmetal Effect */
.header-tile {
    position: relative;
    margin: 0 auto 2rem;
    max-width: 550px;
    text-align: center;
    padding: 1.25rem 2rem;
    border-radius: 16px;

    /* Dark Chrome Gradient - Realistic gunmetal/dark chrome */
    background:
        linear-gradient(145deg,
            #4a4a4a 0%,
            #3a3a3a 20%,
            #2a2a2a 40%,
            #1a1a1a 50%,
            #2a2a2a 60%,
            #3a3a3a 80%,
            #4a4a4a 100%
        );

    /* Metallic border */
    border: 1px solid rgba(255, 255, 255, 0.15);

    /* Deep 3D shadows for metallic depth */
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.9),
        inset 0 2px 4px rgba(255, 255, 255, 0.15),
        inset 0 -2px 4px rgba(0, 0, 0, 0.5),
        inset -2px 0 4px rgba(0, 0, 0, 0.3),
        inset 2px 0 4px rgba(255, 255, 255, 0.1);

    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

/* Glow effect on hover */
.header-tile:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.9),
        0 0 60px rgba(255, 255, 255, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        inset 0 -2px 4px rgba(0, 0, 0, 0.6);
}

/* Brushed Metal Overlay with Rare Animated Highlights */
.header-tile::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background:
        /* Fine horizontal brushed lines */
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 1px,
            rgba(255, 255, 255, 0.02) 1px,
            rgba(255, 255, 255, 0.02) 2px
        ),
        /* Animated highlight sweep - subtle */
        linear-gradient(
            110deg,
            transparent 0%,
            transparent 40%,
            rgba(255, 255, 255, 0.1) 48%,
            rgba(255, 255, 255, 0.18) 50%,
            rgba(255, 255, 255, 0.1) 52%,
            transparent 60%,
            transparent 100%
        );
    background-size: 100% 100%, 400% 400%;
    background-position: 0 0, -100% 0;
    animation: metalShine 60s ease-in-out infinite;  /* 60 seconds - once per minute */
    pointer-events: none;
    z-index: 1;
}

@keyframes metalShine {
    0%, 95% {
        background-position: 0 0, -100% 0;  /* Stay off-screen most of the time */
    }
    97.5% {
        background-position: 0 0, 200% 0;   /* Quick sweep across */
    }
    100% {
        background-position: 0 0, -100% 0;  /* Return to start */
    }
}

/* Portrait Container for Crossfade */
.portrait-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    z-index: 10;  /* Above MetalliCSS effect */

    /* Metal frame */
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);

    overflow: hidden;
}

.portrait-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    opacity: 0;  /* All invisible by default */
    z-index: 1;
    transition: opacity 0.4s ease-in-out;
}

/* Active class for currently visible image */
.portrait-image.active {
    opacity: 1;
    z-index: 2;
}

/* Legacy class names for backwards compatibility */
.portrait-image.visible {
    opacity: 1;  /* Only visible one is shown */
}

.portrait-image.transitioning {
    z-index: 2;  /* During fade, new image is on top */
}

.header-tile h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: #f5f5f5;  /* Light text on dark metal */
    letter-spacing: -0.02em;
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 10;
}

.header-tile .tagline {
    font-family: 'Space Grotesk', sans-serif;
    color: #b0b0b0;  /* Medium gray on dark metal */
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    text-transform: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    position: relative;
    z-index: 10;
}

/* Remove this rule - it conflicts with .portrait-image positioning
.header-tile img {
    position: relative;
    z-index: 10;
}
*/

/* Tiles Grid */
.tiles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);  /* 3 Spalten statt 2 */
    gap: 1.5rem;  /* Etwas weniger Gap */
    margin-bottom: 2rem;
}

@media (max-width: 1200px) {
    .tiles-grid {
        grid-template-columns: repeat(2, 1fr);  /* 2 Spalten auf mittleren Screens */
    }
}

@media (max-width: 768px) {
    .tiles-grid {
        grid-template-columns: 1fr;  /* 1 Spalte auf Mobile */
    }
}

/* Individual Tile */
.tile {
    position: relative;
    aspect-ratio: 1.6 / 1;
    perspective: 1500px;
    cursor: pointer;
    /* Add padding to show the "thickness" of the plate */
    padding: 2px;
    background: linear-gradient(145deg, #1a1a1a, #0a0a0a);
    border-radius: 14px;
    transition: box-shadow 0.3s ease;
}

/* Glow effect - using box-shadow like header-tile */
.tile:hover {
    box-shadow: 0 0 60px var(--tile-color);
}

/* Metal look - Heavy plate appearance */
.tile-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
    border-radius: 12px;
    overflow: hidden;

    /* Metal appearance */
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-bottom: 3px solid rgba(0, 0, 0, 0.8);
    border-right: 2px solid rgba(0, 0, 0, 0.6);

    /* Massive shadow - gives weight and depth */
    box-shadow:
        /* Main deep shadow */
        0 20px 60px rgba(0, 0, 0, 0.9),
        /* Closer shadow for depth */
        0 10px 30px rgba(0, 0, 0, 0.7),
        /* Subtle lift shadow */
        0 5px 15px rgba(0, 0, 0, 0.5),
        /* Top highlight (metal shine) */
        inset 0 2px 0 rgba(255, 255, 255, 0.15),
        /* Bottom depth */
        inset 0 -2px 0 rgba(0, 0, 0, 0.6),
        /* Left highlight */
        inset 1px 0 0 rgba(255, 255, 255, 0.08),
        /* Right shadow */
        inset -1px 0 0 rgba(0, 0, 0, 0.4);
}

.tile:hover .tile-inner {
    /* Enhanced shadow on hover - feels like lifting slightly */
    box-shadow:
        /* Main shadow gets bigger */
        0 30px 80px rgba(0, 0, 0, 0.95),
        0 15px 40px rgba(0, 0, 0, 0.8),
        0 8px 20px rgba(0, 0, 0, 0.6),
        /* Brighter highlights - kein Glow mehr hier! */
        inset 0 2px 0 rgba(255, 255, 255, 0.25),
        inset 0 -2px 0 rgba(0, 0, 0, 0.8),
        inset 1px 0 0 rgba(255, 255, 255, 0.12),
        inset -1px 0 0 rgba(0, 0, 0, 0.5);
}

/* Background Images */
.tile-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.tile-bg img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.tile-bg img.active {
    opacity: 0.25; /* Dimmed for readability */
}

/* Metal overlay for texture - Enhanced for depth */
.tile-metal-overlay {
    position: absolute;
    inset: 0;
    background:
        /* Brushed metal effect */
        linear-gradient(90deg,
            transparent 0%,
            rgba(255,255,255,0.05) 50%,
            transparent 100%
        ),
        /* Vertical subtle lines */
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(255,255,255,0.01) 2px,
            rgba(255,255,255,0.01) 4px
        ),
        /* Diagonal shine */
        linear-gradient(
            135deg,
            transparent 30%,
            rgba(255,255,255,0.03) 50%,
            transparent 70%
        );
    pointer-events: none;
    z-index: 1;
}

/* Content */
.tile-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

/* Icon Row - oben mit Icons */
.tile-icon-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: auto;
}

.tile-icon {
    font-size: 3rem;
    color: var(--tile-color);
    filter: drop-shadow(0 0 10px var(--tile-color));
    transition: transform 0.3s ease;
}

.tile:hover .tile-icon {
    transform: scale(1.1);
}

/* Zusätzliche Icons (für zukünftige Use Cases) */
.tile-meta-icons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.tile-meta-icon {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.tile:hover .tile-meta-icon {
    color: rgba(255, 255, 255, 0.9);
    transform: scale(1.1);
}

/* Feature Image - großes repräsentatives Bild */
.tile-feature-image {
    width: 80%;
    margin: auto;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile-feature-image img {
    width: 100%;
    height: auto;
    max-height: 180px;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.tile:hover .tile-feature-image img {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.8));
}

/* Text Content - unten */
.tile-text {
    margin-top: auto;
}

.tile-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: #f0f0f0;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;  /* Tight for modern tech look */

    /* Enhanced engraved effect with glow */
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.9),
        0 1px 0 rgba(0, 0, 0, 0.8),
        0 -1px 0 rgba(255, 255, 255, 0.08),
        0 0 20px rgba(var(--tile-color-rgb, 255, 255, 255), 0.1);
}

.tile-description {
    font-family: 'Space Grotesk', sans-serif;
    color: #b0b0b0;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0.01em;

    /* Better readability with subtle shadow */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* Optional: Längere Beschreibung mit max-height */
.tile-description-long {
    max-height: 4.5rem; /* ~3 Zeilen */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Lock icon for protected areas */
.tile-lock {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    color: var(--tile-color);
    z-index: 3;

    /* Direkt auf Hintergrund - kein dicker Rahmen */
    text-shadow:
        0 0 10px var(--tile-color),
        0 0 20px var(--tile-color),
        0 2px 8px rgba(0, 0, 0, 0.8);

    cursor: pointer;
    transition: all 0.3s ease;
}

.tile:hover .tile-lock {
    /* Aufleuchten beim Hover */
    transform: scale(1.2);
    text-shadow:
        0 0 20px var(--tile-color),
        0 0 30px var(--tile-color),
        0 0 40px var(--tile-color),
        0 2px 8px rgba(0, 0, 0, 0.9);
    animation: lockPulse 1.5s ease-in-out infinite;
}

@keyframes lockPulse {
    0%, 100% {
        text-shadow:
            0 0 20px var(--tile-color),
            0 0 30px var(--tile-color),
            0 2px 8px rgba(0, 0, 0, 0.9);
    }
    50% {
        text-shadow:
            0 0 30px var(--tile-color),
            0 0 50px var(--tile-color),
            0 2px 8px rgba(0, 0, 0, 0.9);
    }
}

/* Password Prompt on Tile - direkt über dem Text */
.tile-password-prompt {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    z-index: 4;

    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(15px);
    border: 1px solid var(--tile-color);
    border-radius: 12px;
    padding: 1rem;

    box-shadow:
        0 0 30px var(--tile-color),
        0 4px 20px rgba(0, 0, 0, 0.8);

    /* Smooth fade-in */
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease-out;
    pointer-events: none;
}

.tile-password-prompt.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.password-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.password-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.65rem 1rem;
    color: #fff;
    font-size: 0.95rem;
    outline: none;

    transition: all 0.3s ease;
}

.password-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--tile-color);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.password-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

.password-submit {
    background: var(--tile-color);
    border: none;
    border-radius: 8px;
    width: 45px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;

    box-shadow: 0 0 15px var(--tile-color);
}

.password-submit:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px var(--tile-color);
}

/* Theme-specific colors */
.tile[data-theme="software"] {
    --tile-color: var(--color-software);
}

.tile[data-theme="diving"] {
    --tile-color: var(--color-diving);
}

.tile[data-theme="flying"] {
    --tile-color: var(--color-flying);
}

.tile[data-theme="mathematics"] {
    --tile-color: var(--color-mathematics);
}

.tile[data-theme="travel"] {
    --tile-color: var(--color-travel);
}

.tile[data-theme="playground"] {
    --tile-color: var(--color-playground);
}

.tile[data-theme="larp"] {
    --tile-color: var(--color-larp);
}

.tile[data-theme="paragliding"] {
    --tile-color: var(--color-paragliding);
}

/* Expandable grid hint */
.tiles-grid::after {
    content: '';
    grid-column: 1 / -1;
    height: 80px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.02) 50%,
        transparent 100%
    );
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.2);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .tile-title {
        font-size: 1.5rem;
    }

    .tile-icon {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    /* Landing Container - smaller padding on mobile */
    .landing-container {
        padding: 1rem;
        max-width: 100%;
    }

    /* Header Tile - smaller on mobile */
    .header-tile {
        margin-bottom: 1.5rem;
        padding: 1rem;
    }

    .header-tile h1 {
        font-size: 1.5rem;
    }

    .header-tile .tagline {
        font-size: 0.85rem;
    }

    .portrait-container {
        width: 120px;
        height: 120px;
    }

    /* Tiles Grid - smaller gap on mobile */
    .tiles-grid {
        gap: 1rem;
    }

    /* Tiles - adjust sizing */
    .tile {
        border-radius: 12px;
    }

    .tile-inner {
        border-radius: 10px;
    }

    .tile-content {
        padding: 1rem;
    }

    .tile-icon {
        font-size: 2rem;
    }

    .tile-title {
        font-size: 1.25rem;
    }

    .tile-description {
        font-size: 0.85rem;
    }

    /* Disable 3D effects on mobile (performance) */
    .tile {
        perspective: none;
    }

    .tile-inner {
        transform-style: flat;
    }

    /* Hide expandable grid hint on mobile */
    .tiles-grid::after {
        display: none;
    }
}

/* Very small phones */
@media (max-width: 480px) {
    .landing-container {
        padding: 0.75rem;
    }

    .header-tile {
        padding: 0.75rem;
    }

    .header-tile h1 {
        font-size: 1.25rem;
    }

    .portrait-container {
        width: 100px;
        height: 100px;
    }

    .tile-content {
        padding: 0.75rem;
    }

    .tile-icon {
        font-size: 1.75rem;
    }

    .tile-title {
        font-size: 1.1rem;
    }

    .tile-description {
        font-size: 0.8rem;
        line-height: 1.4;
    }
}
