:root {
    --primary: #000000;
    --secondary: #111111;
    --accent: rgba(255, 255, 255, 0.9);
    --text: rgba(255, 255, 255, 0.9);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --cube-size: min(70vh, 700px);
    --vh: 1vh;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    width: 100%;
}

body {
    font-family: -apple-system, system-ui, sans-serif;
    line-height: 1.5;
    color: var(--text);
    background: var(--primary);
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
}

/* Only apply scroll restrictions to home page */
.home-page {
    overflow: hidden;
    position: fixed;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    overscroll-behavior: none;
    touch-action: none;
}

.ios-wrapper {
    position: fixed;
    width: 100%;
    height: 100%;
    height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
}

.world {
    position: absolute;
    width: 100%;
    height: 100%;
    perspective: 2000px;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    will-change: transform;
    transform-origin: center center;
    -webkit-transform-origin: center center;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    margin: auto;
}

@keyframes float-world {
    0%, 100% {
        transform: translateZ(0px) rotateX(2deg) rotateY(2deg);
    }
    50% {
        transform: translateZ(50px) rotateX(-2deg) rotateY(-2deg);
    }
}

.cube-container {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--cube-size);
    height: var(--cube-size);
    transform: translate3d(-50%, -50%, 0);
    -webkit-transform: translate3d(-50%, -50%, 0);
    perspective: 2000px;
    will-change: transform;
    transform-origin: center center;
    -webkit-transform-origin: center center;
}

.cube {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1);
    transform-origin: center center;
    -webkit-transform-origin: center center;
}

@keyframes rotate-cube {
    0%, 15% {
        transform: rotateX(0deg) rotateY(180deg) translateZ(100px);
    }
    20%, 35% {
        transform: rotateX(0deg) rotateY(270deg) translateZ(50px);
    }
    40%, 55% {
        transform: rotateX(0deg) rotateY(0deg) translateZ(0px);
    }
    60%, 75% {
        transform: rotateX(0deg) rotateY(90deg) translateZ(50px);
    }
    80%, 95% {
        transform: rotateX(90deg) rotateY(180deg) translateZ(0px);
    }
    100% {
        transform: rotateX(0deg) rotateY(180deg) translateZ(100px);
    }
}


.cube-face {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
    overflow: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

.content {
    padding: 2rem;
    text-align: center;
    max-width: 800px;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
    background: linear-gradient(to right, var(--text) 0%, rgba(255, 255, 255, 0.5) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.cryptic {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.1em;
    opacity: 0.7;
}

.metric {
    text-align: center;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.number {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    background: linear-gradient(to right, var(--text) 0%, rgba(255, 255, 255, 0.5) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
    margin-bottom: 1rem;
}

.label {
    font-size: clamp(0.8rem, 1.5vw, 1.2rem);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.contact-link {
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--text);
    text-decoration: none;
    font-weight: 300;
    letter-spacing: 0.2em;
    transition: opacity 0.3s ease;
    -webkit-transition: opacity 0.3s ease;
    padding: 1rem;
    display: inline-block;
}

.contact-link:hover,
.contact-link:active {
    opacity: 0.7;
}

/* Cube transformations */
.cube-face.front { 
    transform: translateZ(calc(var(--cube-size) / 2));
    -webkit-transform: translateZ(calc(var(--cube-size) / 2));
}
.cube-face.back { 
    transform: translateZ(calc(var(--cube-size) / -2)) rotateY(180deg);
    -webkit-transform: translateZ(calc(var(--cube-size) / -2)) rotateY(180deg);
}
.cube-face.right { 
    transform: translateX(calc(var(--cube-size) / 2)) rotateY(90deg);
    -webkit-transform: translateX(calc(var(--cube-size) / 2)) rotateY(90deg);
}
.cube-face.left { 
    transform: translateX(calc(var(--cube-size) / -2)) rotateY(-90deg);
    -webkit-transform: translateX(calc(var(--cube-size) / -2)) rotateY(-90deg);
}
.cube-face.top { 
    transform: translateY(calc(var(--cube-size) / -2)) rotateX(90deg);
    -webkit-transform: translateY(calc(var(--cube-size) / -2)) rotateX(90deg);
}
.cube-face.bottom { 
    transform: translateY(calc(var(--cube-size) / 2)) rotateX(-90deg) rotateZ(180deg);
    -webkit-transform: translateY(calc(var(--cube-size) / 2)) rotateX(-90deg) rotateZ(180deg);
}

/* Team photo and history button styling */
.team-container {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.team-photo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.history-button {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.7);
    color: var(--text);
    text-decoration: none;
    border-radius: 4px;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 2;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.history-button:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
}

/* History page styling */
.history-page {
    min-height: 100vh;
    padding: 4rem 2rem;
    background: var(--primary);
    color: var(--text);
    max-width: 800px;
    margin: 0 auto;
}

.history-page h1 {
    margin-bottom: 3rem;
    text-align: center;
}

.history-content p {
    margin-bottom: 2rem;
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.back-button {
    display: inline-block;
    margin-top: 3rem;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 768px), (max-height: 800px) {
    :root {
        --cube-size: min(80vw, 400px);
    }
}