@import url('https://fonts.googleapis.com/css2?family=Anton&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #000;
    color: #fff;
    font-family: 'Space Mono', monospace;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ===== NAV ===== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 20px 40px;
    z-index: 200;
    /* subtle fade-in */
    animation: navFadeIn 0.8s ease forwards;
}

.nav-brand  { justify-self: start; }
.nav-title  { justify-self: center; }
.nav-login  { justify-self: end; }

@keyframes navFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nav-brand,
.nav-title,
.nav-login,
.back-btn {
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #fff;
}

.back-btn {
    position: fixed;
    top: 20px;
    left: 40px;
    z-index: 300;
    font-size: 1.2rem;
    cursor: pointer;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.back-btn:hover {
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.1);
}


.nav-login {
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
}

.nav-login:hover {
    opacity: 0.6;
}

/* ===== HERO ===== */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#mesh-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hero-headline {
    position: relative;
    z-index: 2;
    font-family: 'Anton', sans-serif;
    font-size: clamp(5rem, 13vw, 13rem);
    text-transform: uppercase;
    letter-spacing: -0.01em;
    line-height: 1;
    text-align: center;
    color: #fff;
    user-select: none;
    opacity: 0; /* Start hidden */
}

.hero-headline.animate {
    /* Combined entry animation */
    animation: 
        heroRevealZoom 3s cubic-bezier(0.16, 1, 0.3, 1) both,
        heroGlitchEffect 3s step-end forwards; 
}

.hero-headline.animate::before {
    animation: glitchAnim1 3s linear forwards;
}

.hero-headline.animate::after {
    animation: glitchAnim2 3s linear forwards;
}

@keyframes heroGlitchEffect {
    0%, 95% { text-shadow: -2px 0 #ff00c1, 2px 0 #00fff9; }
    100% { text-shadow: none; }
}


/* Glitch pseudo-elements */
.hero-headline::before,
.hero-headline::after {
    content: 'SECTION C';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.hero-headline::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    /* animation added via .animate class */
}

.hero-headline::after {
    left: -2px;
    text-shadow: 2px 0 #00fff9;
    /* animation added via .animate class */
}


@keyframes heroRevealZoom {
    0% {
        opacity: 0;
        transform: scale(0.6) translateY(30px);
        filter: blur(15px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}


@keyframes glitchAnim1 {
    0%, 5%, 10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 55%, 60%, 65%, 70%, 75%, 80%, 85%, 90% {
        clip: rect(calc(var(--rand-top, 0) * 1px), 9999px, calc(var(--rand-bottom, 20) * 1px), 0);
        transform: translateX(calc(var(--rand-x, 0) * 1px));
    }
    /* Manually defining some high-freq steps for better control */
    2% { clip: rect(10px, 9999px, 30px, 0); transform: translateX(-5px); }
    7% { clip: rect(80px, 9999px, 100px, 0); transform: translateX(5px); }
    12% { clip: rect(40px, 9999px, 60px, 0); transform: translateX(-3px); }
    17% { clip: rect(20px, 9999px, 90px, 0); transform: translateX(4px); }
    22% { clip: rect(50px, 9999px, 70px, 0); transform: translateX(-4px); }
    27% { clip: rect(10px, 9999px, 40px, 0); transform: translateX(3px); }
    32% { clip: rect(90px, 9999px, 100px, 0); transform: translateX(-5px); }
    37% { clip: rect(30px, 9999px, 50px, 0); transform: translateX(4px); }
    42% { clip: rect(60px, 9999px, 80px, 0); transform: translateX(-2px); }
    47% { clip: rect(20px, 9999px, 40px, 0); transform: translateX(3px); }
    52% { clip: rect(70px, 9999px, 90px, 0); transform: translateX(-4px); }
    57% { clip: rect(10px, 9999px, 50px, 0); transform: translateX(3px); }
    62% { clip: rect(40px, 9999px, 80px, 0); transform: translateX(-5px); }
    67% { clip: rect(0, 9999px, 100px, 0); transform: translateX(4px); }
    72% { clip: rect(30px, 9999px, 60px, 0); transform: translateX(-3px); }
    77% { clip: rect(10px, 9999px, 40px, 0); transform: translateX(2px); }
    82% { clip: rect(80px, 9999px, 100px, 0); transform: translateX(-4px); }
    87% { clip: rect(40px, 9999px, 70px, 0); transform: translateX(3px); }
    92% { clip: rect(20px, 9999px, 50px, 0); transform: translateX(-2px); }
    97% { clip: rect(0, 0, 0, 0); transform: translateX(0); }
    100% { clip: rect(0, 0, 0, 0); transform: translateX(0); }
}

@keyframes glitchAnim2 {
    0%, 5%, 10%, 15%, 20%, 25%, 30%, 35%, 40%, 45%, 50%, 55%, 60%, 65%, 70%, 75%, 80%, 85%, 90% {
        clip: rect(calc(var(--rand-top, 0) * 1px), 9999px, calc(var(--rand-bottom, 20) * 1px), 0);
        transform: translateX(calc(var(--rand-x, 0) * 1px));
    }
    4% { clip: rect(80px, 9999px, 100px, 0); transform: translateX(5px); }
    9% { clip: rect(20px, 9999px, 40px, 0); transform: translateX(-4px); }
    14% { clip: rect(60px, 9999px, 80px, 0); transform: translateX(4px); }
    19% { clip: rect(10px, 9999px, 30px, 0); transform: translateX(-5px); }
    24% { clip: rect(80px, 9999px, 100px, 0); transform: translateX(3px); }
    29% { clip: rect(40px, 9999px, 60px, 0); transform: translateX(-4px); }
    34% { clip: rect(20px, 9999px, 40px, 0); transform: translateX(5px); }
    39% { clip: rect(60px, 9999px, 80px, 0); transform: translateX(-3px); }
    44% { clip: rect(10px, 9999px, 30px, 0); transform: translateX(4px); }
    49% { clip: rect(80px, 9999px, 100px, 0); transform: translateX(-5px); }
    54% { clip: rect(40px, 9999px, 60px, 0); transform: translateX(2px); }
    59% { clip: rect(20px, 9999px, 40px, 0); transform: translateX(-3px); }
    64% { clip: rect(60px, 9999px, 80px, 0); transform: translateX(4px); }
    69% { clip: rect(10px, 9999px, 30px, 0); transform: translateX(-5px); }
    74% { clip: rect(80px, 9999px, 100px, 0); transform: translateX(3px); }
    79% { clip: rect(40px, 9999px, 60px, 0); transform: translateX(-4px); }
    84% { clip: rect(20px, 9999px, 40px, 0); transform: translateX(5px); }
    89% { clip: rect(60px, 9999px, 80px, 0); transform: translateX(-3px); }
    94% { clip: rect(10px, 9999px, 30px, 0); transform: translateX(2px); }
    97% { clip: rect(0, 0, 0, 0); transform: translateX(0); }
    100% { clip: rect(0, 0, 0, 0); transform: translateX(0); }
}



/* Remove glitch after animation completes to keep it clean */
.hero-headline {
    animation-fill-mode: forwards;
}


.hero-scroll-cta {
    position: absolute;
    bottom: 44px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 2;
    cursor: pointer;
    text-decoration: none;
}

.hero-scroll-label {
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #fff;
}

.hero-scroll-arrow {
    font-size: 1.1rem;
    color: #fff;
    animation: arrowBounce 2s ease-in-out infinite;
}

@keyframes arrowBounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(7px); }
}

/* ===== PROJECTS SECTION (index) ===== */
.projects-wrap {
    padding: 80px 50px 80px;
    background: #000;
}

/* ===== PROJECTS PAGE ===== */
.projects-page {
    padding: 100px 50px 80px;
    background: #000;
    min-height: 100vh;
}

.section-title {
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #666;
    text-align: center;
    margin-bottom: 50px;
}

/* ===== CARDS GRID ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    max-width: 1380px;
    margin: 0 auto;
}

/* ===== PROJECT CARD ===== */
.project-card {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    background: transparent;
    transition: border-color 0.3s ease, transform 0.3s ease;
    animation: cardFadeUp 0.6s ease both;
}

.project-card:hover {
    border-color: rgba(255, 255, 255, 0.32);
    transform: translateY(-5px);
}

/* staggered entrance */
.project-card:nth-child(1) { animation-delay: 0.05s; }
.project-card:nth-child(2) { animation-delay: 0.12s; }
.project-card:nth-child(3) { animation-delay: 0.19s; }
.project-card:nth-child(4) { animation-delay: 0.26s; }
.project-card:nth-child(5) { animation-delay: 0.33s; }
.project-card:nth-child(6) { animation-delay: 0.40s; }
.project-card:nth-child(7) { animation-delay: 0.47s; }
.project-card:nth-child(8) { animation-delay: 0.54s; }

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

.card-image-area {
    background: #232323;
    border-radius: 8px;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.card-image-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.card-logo-placeholder {
    font-size: 0.58rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #555;
}

.card-system-name {
    font-family: 'Anton', sans-serif;
    font-size: 1.75rem;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    color: #fff;
    line-height: 1.05;
}

.card-system-desc {
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    text-transform: none;
    color: #888;
    margin-top: 8px;
    margin-bottom: 18px;
    line-height: 1.5;
}

.card-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 14px;
}

.card-members {
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-left: 2px solid rgba(255, 255, 255, 0.35);
    padding-left: 12px;
    margin-bottom: 22px;
    flex: 1;
}

.card-member-name {
    font-size: 0.6rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: #bbb;
}

.card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 15px 10px;
    background: #262626;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: 'Space Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
    margin-bottom: 10px; /* Backup gap */
}

.card-btn:hover {
    background: #333;
}

.card-btn:last-child {
    margin-bottom: 0;
}

.card-actions {
    display: flex;
    flex-direction: column;
    margin-top: auto;
}

.card-btn.btn-delete {
    background: #3a0a0a;
}

.card-btn.btn-delete:hover {
    background: #551111;
}

.card-btn.btn-secondary {
    background: #1c1c1c;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-btn.btn-secondary:hover {
    background: #262626;
    border-color: rgba(255, 255, 255, 0.3);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #444;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    grid-column: 1 / -1;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-card {
    background: #0f0f0f;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 64px 52px 60px;
    width: 100%;
    max-width: 510px;
    animation: cardFadeUp 0.7s ease both;
}

.login-title {
    font-family: 'Anton', sans-serif;
    font-size: 4.5rem;
    text-transform: uppercase;
    text-align: center;
    color: #fff;
    margin-bottom: 52px;
    letter-spacing: 0.01em;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 22px;
}

.form-label {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 10px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: #1c1c1c;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    color: #fff;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-row-split {
    display: flex;
    gap: 20px;
    margin-bottom: 22px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.3)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 40px;
    cursor: pointer;
}

.form-select option {
    background: #1c1c1c;
    color: #fff;
}

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

.form-input::placeholder {
    color: #444;
}

.form-input:focus {
    border-color: rgba(255,255,255,0.28);
}

.input-wrapper {
    position: relative;
}

.input-wrapper .form-input {
    padding-right: 48px;
}

.btn-eye {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    padding: 4px;
    transition: color 0.2s;
}

.btn-eye:hover {
    color: #888;
}

.btn-eye svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 17px 20px;
    background: #232323;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s ease;
}

.btn-primary:hover {
    background: #333;
}

.form-error {
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #c0392b;
    margin-top: 14px;
    text-align: center;
    min-height: 16px;
}

/* ===== SUBMIT PAGE ===== */
.submit-page {
    min-height: 100vh;
    background: #000;
    padding: 36px 40px 60px;
}

.page-welcome {
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #777;
    margin-bottom: 28px;
}

.submit-panel {
    background: #0e0e0e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    min-height: 540px;
    animation: cardFadeUp 0.6s ease both;
}

.submit-left {
    padding: 46px 46px 46px 46px;
    display: flex;
    flex-direction: column;
}

.submit-title {
    font-family: 'Anton', sans-serif;
    font-size: 2.6rem;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.05;
    margin-bottom: 40px;
}

.submit-divider {
    width: 1px;
    background: rgba(255,255,255,0.1);
    align-self: stretch;
}

.submit-right {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* corner bracket decoration */
.bracket-tl,
.bracket-br {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: rgba(255,255,255,0.3);
    border-style: solid;
}

.bracket-tl {
    top: 14px;
    right: 14px;
    border-width: 1px 1px 0 0;
}

.bracket-br {
    bottom: 14px;
    left: 14px;
    border-width: 0 0 1px 1px;
}

.logo-upload-area {
    width: 100%;
    max-width: 340px;
    height: 340px;
    background: #1c1c1c;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
    overflow: hidden;
}

.logo-upload-area:hover {
    background: #242424;
}

.logo-upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.logo-upload-area svg {
    width: 52px;
    height: 52px;
    color: #555;
}

.logo-upload-label {
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #555;
}

.logo-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    border-radius: 10px;
}

/* ===== MANAGE PAGE ===== */
.manage-page {
    min-height: 100vh;
    background: #000;
    padding: 60px 50px 80px;
}

/* ===== FOOTER LINK ===== */
.page-footer-link {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #666;
    text-align: center;
    margin-top: 60px;
    transition: color 0.2s;
    cursor: pointer;
}

.page-footer-link:hover {
    color: #aaa;
}

/* ===== AUTH GUARD ===== */
.auth-guard-hidden {
    display: none !important;
}

@media (max-width: 1100px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav {
        padding: 16px 24px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .nav-title {
        order: -1;
        width: 100%;
        text-align: center;
    }

    .hero-headline {
        font-size: clamp(3.5rem, 18vw, 7rem);
    }

    .projects-wrap,
    .projects-page,
    .manage-page {
        padding-left: 24px;
        padding-right: 24px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .submit-panel {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1px auto;
    }

    .submit-divider {
        width: auto;
        height: 1px;
    }

    .submit-left {
        padding: 32px 28px;
    }

    .submit-right {
        padding: 28px;
    }

    .logo-upload-area {
        height: 220px;
    }

    .login-card {
        padding: 48px 30px 44px;
    }

    .login-title {
        font-size: 3.2rem;
    }
}

@media (max-width: 480px) {
    .hero-headline {
        font-size: clamp(3rem, 20vw, 5rem);
    }

    .submit-page {
        padding: 24px 20px 50px;
    }
}

/* ===== FLOATING LOGOUT ===== */
.floating-logout {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 10px 18px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #666;
    font-family: 'Space Mono', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 0.2s ease;
    z-index: 1000;
}

.floating-logout:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}
