:root {
    --primary-color: #0a0a0a;
    --accent-color: #00ff88;
    --text-primary: #ffffff;
    --text-secondary: #888888;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--primary-color);
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    visibility: visible;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Home cube page keeps the preload behavior */
body.cube-page {
    height: 100vh;
    overflow: hidden;
    visibility: hidden;
}

body.cube-page.loaded {
    visibility: visible;
}

/* Global navigation (sectioned pages) */
header {
    background: #050505;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

nav .nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    text-transform: lowercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.nav-links {
    display: flex;
    gap: 1.25rem;
    margin-left: 1.5rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 300;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    opacity: 1;
}

.nav-actions {
    margin-left: auto;
}

.nav-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    transition: all 0.2s ease;
}

.nav-login:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.nav-login svg {
    width: 24px;
    height: 24px;
}

.container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    position: relative;
}

.website-name {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 20;
}

.website-name h1 {
    font-family: 'Inter', sans-serif;
    font-size: 2rem;
    font-weight: 200;
    color: var(--text-primary);
    text-transform: lowercase;
    letter-spacing: 0.1em;
    margin: 0;
    text-align: left;
}

.title-cursor {
    display: inline-block;
    background-color: var(--text-primary);
    width: 2px;
    height: 0.8em;
    animation: blink 1s infinite;
    margin-left: 2px;
    transition: opacity 0.3s ease;
}

.text-display {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    max-width: 400px;
    padding: 2rem;
    z-index: 10;
}

.text-content {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.typewriter-text {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-primary);
    min-height: 200px;
    opacity: 0;
    transition: opacity 0.5s ease;
    font-weight: 300;
    letter-spacing: 0.02em;
}

.typewriter-text.active {
    opacity: 1;
}

.typewriter-cursor {
    display: inline-block;
    background-color: var(--text-primary);
    width: 2px;
    height: 1em;
    animation: blink 1s infinite;
    transition: opacity 0.3s ease;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.cube-container {
    width: 60vmin;
    height: 60vmin;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: all 0.3s ease;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.cube-container:active {
    cursor: grabbing;
}

#cube-canvas {
    width: 100%;
    height: 100%;
}

.mobile-nav {
    display: none; /* Hidden on desktop */
    flex-direction: row;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}

.mobile-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 300;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    min-width: 80px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

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

/* Icons Container */
.icons-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    gap: 1rem;
    z-index: 1000;
}

.login-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    font-weight: 500;
    transition: all 0.2s ease;
}

.login-chip:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.login-chip svg {
    width: 24px;
    height: 24px;
}

/* Help Icon */
.help-icon {
    position: relative;
    top: auto;
    right: auto;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.help-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.help-icon:active {
    transform: scale(0.95);
}

/* Contact Icon */
.contact-icon {
    position: relative;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.contact-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.contact-icon:active {
    transform: scale(0.95);
}

/* Contact Overlay */
.contact-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.contact-overlay.active {
    opacity: 1;
    visibility: visible;
}

.contact-form {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    backdrop-filter: blur(20px);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.contact-overlay.active .contact-form {
    transform: scale(1);
}

.contact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.contact-header h2 {
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 300;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.contact-content {
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
}

.contact-content p {
    margin: 0 0 1.5rem 0;
}

.contact-info {
    margin: 1.5rem 0;
}

.contact-item {
    margin: 1rem 0;
    padding: 0.5rem 0;
}

.contact-item strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* Contact Form Fields */
.contact-form-fields {
    margin: 1.5rem 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.08);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.submit-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    margin-top: 1rem;
}

.submit-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.submit-btn:active {
    transform: scale(0.98);
}

@media (max-width: 768px) {
    nav .nav-container {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .nav-links {
        margin-left: 0;
        flex: 1;
        flex-wrap: wrap;
    }
    
    .nav-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        margin-left: 0;
    }
    
    .container {
        flex-direction: column;
        gap: 1rem;
        padding: 4.5rem 1rem 1rem;
        justify-content: flex-start;
        align-items: center;
        min-height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
        width: 100vw;
    }
    
    .website-name {
        position: static;
        top: auto;
        left: auto;
        right: auto;
        transform: none;
        order: 1;
        margin-bottom: 1rem;
        width: 100%;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .website-name h1 {
        font-size: 1.5rem;
        text-align: center;
        margin: 0;
    }
    
    .mobile-nav {
        display: flex !important;
        opacity: 0;
        animation: fadeInNav 0.5s ease forwards;
        animation-delay: 2s; /* Show after title finishes typing */
    }
    
    .cube-container {
        position: static;
        top: auto;
        left: auto;
        transform: none;
        width: 70vw;
        height: 70vw;
        max-width: 300px;
        max-height: 300px;
        order: 2;
        margin: 1rem auto;
    }
    
    .text-display {
        position: static;
        bottom: auto;
        left: auto;
        right: auto;
        transform: none;
        max-width: calc(100% - 2rem);
        padding: 1rem;
        order: 3;
        margin: 1rem;
        margin-bottom: 2rem;
        background: transparent;
        backdrop-filter: none;
        border: none;
        border-radius: 0;
        min-height: 200px;
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .text-content {
        text-align: left;
    }
    
    .typewriter-text {
        font-size: 0.85rem;
        line-height: 1.6;
        text-align: left;
        min-height: 150px;
        opacity: 0;
        transition: opacity 0.5s ease;
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
        white-space: pre-wrap;
        width: 100%;
    }
    
    .typewriter-text.active {
        opacity: 1;
    }
    
    /* Icons container on mobile */
    .icons-container {
        display: none;
    }
    
    /* Help icon smaller on mobile */
    .help-icon {
        width: 40px;
        height: 40px;
    }
    
    .help-icon svg {
        width: 18px;
        height: 18px;
    }
    
    /* Contact icon smaller on mobile */
    .contact-icon {
        width: 40px;
        height: 40px;
    }
    
    .contact-icon svg {
        width: 18px;
        height: 18px;
    }
    
    /* Contact modal fixes for mobile */
    .contact-overlay {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 2rem;
    }
    
    .contact-form {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .contact-header {
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }
    
    .contact-header h2 {
        font-size: 1.2rem;
    }
    
    .contact-content {
        font-size: 0.9rem;
    }
    
    .contact-content p {
        margin: 0 0 1rem 0;
    }
    
    .contact-form-fields {
        margin: 1rem 0;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 0.3rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 0.6rem;
        font-size: 0.85rem;
        border-radius: 4px;
    }
    
    .form-group textarea {
        min-height: 80px;
    }
    
    .submit-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
        margin-top: 0.5rem;
    }
    
    .contact-info {
        margin: 1rem 0;
        font-size: 0.85rem;
    }
    
    .contact-item {
        margin: 0.5rem 0;
        padding: 0.3rem 0;
    }
    
    .close-btn {
        width: 25px;
        height: 25px;
        font-size: 1.5rem;
    }
}

/* Additional breakpoint for very small screens */
@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }
    
    .website-name h1 {
        font-size: 1.3rem;
    }
    
    .text-display {
        max-width: calc(100% - 1rem);
        margin: 0.5rem;
        padding: 0.8rem;
        max-height: 45vh;
        min-height: 180px;
    }
    
    .typewriter-text {
        font-size: 0.8rem;
        line-height: 1.5;
        min-height: 120px;
    }
    
    .cube-container {
        width: 80vw;
        height: 80vw;
        max-width: 250px;
        max-height: 250px;
    }
}

/* Additional breakpoint for extra small screens */
@media (max-width: 360px) {
    .text-display {
        max-height: 40vh;
        min-height: 160px;
        padding: 0.6rem;
    }
    
    .typewriter-text {
        font-size: 0.75rem;
        line-height: 1.4;
        min-height: 100px;
    }
}

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

/* Login page */
body.login-page {
    background: var(--primary-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow: auto;
    visibility: visible;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem 3rem;
}

.auth-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 960px;
    width: 100%;
    margin: 0 auto 1.5rem;
}

.auth-logo {
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.08em;
    font-size: 1rem;
    text-transform: lowercase;
}

.auth-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 0.2rem;
}

.auth-link:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

.auth-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.75rem;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding-top: 3rem;
}

.auth-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-family: 'Inter', sans-serif;
    font-size: 2rem;
    font-weight: 200;
    letter-spacing: 0.1em;
    color: var(--text-primary);
}

.auth-logo-text {
    text-transform: lowercase;
}

.auth-cube {
    width: 320px;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.auth-cube canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.auth-card {
    width: 100%;
    max-width: 520px;
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
}

.auth-link-below {
    display: block;
    text-align: center;
    margin-top: 1.1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
}

.auth-link-below:hover {
    color: var(--text-primary);
}

.auth-card-header h1 {
    color: var(--text-primary);
    font-size: 1.6rem;
    margin: 0 0 0.4rem;
    font-weight: 500;
}

.auth-card-header .eyebrow {
    color: var(--accent-color);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.8rem;
    margin: 0 0 0.5rem;
}

.auth-card-header .muted {
    color: var(--text-secondary);
    margin: 0;
}

.auth-form {
    margin-top: 1.25rem;
}

.auth-card .form-group input {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
}

.auth-card .form-group input:focus {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.07);
}

.auth-card .submit-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    border-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.auth-card .submit-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.1));
    border-color: rgba(255, 255, 255, 0.28);
}

.auth-card .submit-btn:active {
    transform: scale(0.98);
}

@media (max-width: 640px) {
    .auth-shell {
        padding: 1.5rem 1rem 2.5rem;
    }

    .auth-header {
        margin-bottom: 1rem;
    }

    .auth-main {
        gap: 1.2rem;
    }

    .auth-cube {
        width: 240px;
        height: 240px;
        margin-bottom: 1.2rem;
    }

    .auth-card {
        padding: 1.5rem;
    }
}
