:root {
    --bg-color: #050505;
    --text-color: #e0e0e0;
    --accent-color: #00ff41;
    /* Matrix Green */
    --secondary-accent: #00f3ff;
    /* Cyber Blue */
    --font-mono: 'Fira Code', monospace;
    --font-sans: 'Inter', sans-serif;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    cursor: none;
    /* Custom cursor */
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    margin: 0;
    overflow-x: hidden;
}

#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
    overflow: hidden;
}

/* External TARDIS Wrapper */
#tardis-wrapper {
    position: fixed;
    top: 10%;
    right: -150px;
    /* Start off-screen */
    width: 200px;
    height: 360px;
    z-index: -1;
    /* Behind text globally */
    opacity: 0;
    transform: scale(0.5);
    /* Initial scale */
}

/* CodePen TARDIS CSS */
.perspective {
    perspective: 1200px;
    -webkit-perspective: 1200px;
}

.tardis-wrap {
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transform: translateZ(-300px);
    -webkit-transform: translateZ(-300px);
}

.tardis {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transform-origin: 50% 50%;
    -webkit-transform-origin: 50% 50%;
    transform: rotateX(-20deg) rotateY(-30deg);
    -webkit-transform: rotateX(-20deg) rotateY(-30deg);
    animation-name: spin;
    animation-duration: 5000ms;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

@keyframes spin {
    from {
        transform: rotateX(-20deg) rotateY(0deg);
    }

    to {
        transform: rotateX(-20deg) rotateY(360deg);
    }
}

.tardis .side {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 200px;
    height: 360px;
    background-color: #3f577d;
    box-shadow: inset 1px 0 0 #313d49, inset -1px 0 0 #313d49, inset 0 1px 0 #313d49, inset 0 -1px 0 #313d49;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    z-index: 1;
}

.side:nth-of-type(1) {
    transform: translateZ(100px);
    -webkit-transform: translateZ(100px);
}

.side:nth-of-type(2) {
    transform: rotateY(90deg) translateZ(100px);
    -webkit-transform: rotateY(90deg) translateZ(100px);
}

.side:nth-of-type(3) {
    transform: rotateY(180deg) translateZ(100px);
    -webkit-transform: rotateY(180deg) translateZ(100px);
}

.side:nth-of-type(4) {
    transform: rotateY(-90deg) translateZ(100px);
    -webkit-transform: rotateY(-90deg) translateZ(100px);
}

.tardis .roof {
    position: absolute;
    width: 200px;
    height: 200px;
    background-color: #3f577d;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transform: rotateX(-90deg) translateZ(-100px);
    -webkit-transform: rotateX(-90deg) translateZ(-100px);
    z-index: 2;
}

.roof-top {
    position: absolute;
    left: 30px;
    width: 140px;
    height: 140px;
    z-index: 2;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.top-lid {
    width: 140px;
    height: 140px;
    background-color: #355683;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transform: rotateX(-90deg) translateZ(-89px);
    -webkit-transform: rotateX(-90deg) translateZ(-89px);
}

.roof-panel {
    position: absolute;
    width: 140px;
    height: 20px;
    background-color: #445d84;
    box-shadow: inset 1px 0 0 #313d49, inset -1px 0 0 #313d49, inset 0 1px 0 #313d49, inset 0 -1px 0 #313d49;
    top: -20px;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.roof-panel.a {
    transform: rotateY(0deg) translateZ(70px);
    -webkit-transform: rotateY(0deg) translateZ(70px);
}

.roof-panel.b {
    transform: rotateY(90deg) translateZ(70px);
    -webkit-transform: rotateY(90deg) translateZ(70px);
}

.roof-panel.c {
    transform: rotateY(180deg) translateZ(70px);
    -webkit-transform: rotateY(180deg) translateZ(70px);
}

.roof-panel.d {
    transform: rotateY(-90deg) translateZ(70px);
    -webkit-transform: rotateY(-90deg) translateZ(70px);
}

/* Light Animation */
@keyframes pulse-light {

    0%,
    100% {
        background-color: #eee;
        box-shadow: 0 0 2px #fff;
    }

    50% {
        background-color: #fff;
        box-shadow: 0 0 15px #fff, 0 0 30px var(--secondary-accent);
    }
}

.light {
    position: absolute;
    width: 40px;
    height: 40px;
    top: -60px;
    left: 85px;
    z-index: 3;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.light-lid {
    width: 30px;
    height: 30px;
    background-color: #eee;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transform: rotateX(-90deg) translateZ(-14px);
    -webkit-transform: rotateX(-90deg) translateZ(-14px);
    animation: pulse-light 3s infinite ease-in-out;
}

.light .light-panel {
    position: absolute;
    width: 30px;
    height: 40px;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.light .light-panel .bottom {
    width: 30px;
    height: 12px;
    position: absolute;
    bottom: 0px;
    background-color: #355683;
    box-shadow: inset 1px 0 0 #313d49, inset -1px 0 0 #313d49, inset 0 1px 0 #313d49, inset 0 -1px 0 #313d49;
}

.light .light-panel .top {
    width: 30px;
    height: 28px;
    position: absolute;
    top: 0px;
    background-color: #eee;
    box-shadow: inset 1px 0 0 #fff, inset -1px 0 0 #fff, inset 0 1px 0 #fff, inset 0 -1px 0 #fff;
    animation: pulse-light 3s infinite ease-in-out;
}

.light-panel.a {
    transform: rotateY(0deg) translateZ(15px);
    -webkit-transform: rotateY(0deg) translateZ(15px);
}

.light-panel.b {
    transform: rotateY(90deg) translateZ(15px);
    -webkit-transform: rotateY(90deg) translateZ(15px);
}

.light-panel.c {
    transform: rotateY(180deg) translateZ(15px);
    -webkit-transform: rotateY(180deg) translateZ(15px);
}

.light-panel.d {
    transform: rotateY(-90deg) translateZ(15px);
    -webkit-transform: rotateY(-90deg) translateZ(15px);
}

/* Floor */
.tardis .floor {
    position: absolute;
    width: 220px;
    height: 220px;
    left: -10px;
    top: 360px;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.floor-lid {
    position: absolute;
    width: 220px;
    height: 220px;
    background-color: #355683;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transform: rotateX(90deg) translateZ(109px);
    -webkit-transform: rotateX(90deg) translateZ(109px);
}

.floor-panel {
    position: absolute;
    width: 220px;
    height: 10px;
    background-color: #3f577d;
    box-shadow: inset 1px 0 0 #313d49, inset -1px 0 0 #313d49, inset 0 1px 0 #313d49, inset 0 -1px 0 #313d49;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.floor-panel.a {
    transform: rotateY(0deg) translateZ(110px);
    -webkit-transform: rotateY(0deg) translateZ(110px);
}

.floor-panel.b {
    transform: rotateY(90deg) translateZ(110px);
    -webkit-transform: rotateY(90deg) translateZ(110px);
}

.floor-panel.c {
    transform: rotateY(180deg) translateZ(110px);
    -webkit-transform: rotateY(180deg) translateZ(110px);
}

.floor-panel.d {
    transform: rotateY(-90deg) translateZ(110px);
    -webkit-transform: rotateY(-90deg) translateZ(110px);
}

/* Top sign */
.side .top-sign {
    width: 180px;
    height: 28px;
    background-color: #445d84;
    border: solid 1px #54749f;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, .4);
    border-radius: 2px;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.top-sign .text {
    background-color: #28394d;
    border: solid 1px #54749f;
    border-radius: 2px;
    width: 100px;
    margin: 3px auto;
    height: 20px;
    color: #fff;
    font-size: 12px;
    line-height: 20px;
    padding: 0px 5px;
    box-shadow: inset 0px 0px 3px rgba(0, 0, 0, .4);
    position: relative;
    text-shadow: 0px 0px 4px rgba(255, 255, 255, .6);
}

.text .tiny {
    font-size: 4px;
    line-height: 6px;
    text-align: center;
    width: 20px;
    position: absolute;
    right: 35px;
    top: 4px;
}

/* Door frame */
.side .door-frame {
    position: absolute;
    width: 160px;
    left: 20px;
    top: 35px;
    bottom: 0px;
    background-color: #445d84;
    box-shadow: inset 0px 2px 8px rgba(0, 0, 0, .5);
    z-index: 5;
}

.door-frame .door {
    position: absolute;
    top: 0px;
    bottom: 0px;
    width: 77px;
    box-shadow: inset 0px 0px 3px rgba(0, 0, 0, .7);
}

.door.door-left {
    left: 0px;
}

.door.door-right {
    right: 0px;
}

/* Insets */
.door .door-inset {
    position: absolute;
    left: 10px;
    bottom: 10px;
    width: 55px;
    height: 65px;
    box-shadow: inset 0px .5px 5px rgba(0, 0, 0, .5);
}

.door-inset:nth-of-type(2) {
    bottom: 85px;
}

.door-inset:nth-of-type(3) {
    bottom: 160px;
}

/* Sign */
.door .sign {
    position: absolute;
    left: 15px;
    bottom: 165px;
    width: 45px;
    height: 55px;
    background-color: #d5e4f6;
    box-shadow: inset 1px 0 0 #313d49, inset -1px 0 0 #313d49, inset 0 1px 0 #313d49, inset 0 -1px 0 #313d49;
}

/* Window */
.door .window {
    position: absolute;
    left: 10px;
    bottom: 235px;
    width: 55px;
    height: 65px;
    background-color: #28475d;
}

.window .pane {
    width: 14px;
    height: 28px;
    background-color: #dfe7fc;
    float: left;
    margin: 2px;
    box-shadow: inset 0px 0px 10px #fff;
}

.pane.a {
    margin-left: 3px;
    margin-right: 1px;
}

.pane.d {
    margin-left: 3px;
    margin-right: 1px;
}

/* Custom Cursor */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 1px solid var(--accent-color);
    transition: width 0.2s, height 0.2s, background-color 0.2s;
}

/* Typography */
h1,
h2,
h3,
.logo,
.label,
.prompt {
    font-family: var(--font-mono);
}

a {
    color: inherit;
    text-decoration: none;
}

/* Nav */
.main-nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 2rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    mix-blend-mode: difference;
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--accent-color);
}

.links a {
    margin-left: 2rem;
    font-size: 0.9rem;
    position: relative;
    transition: color 0.3s;
}

.links a::before {
    content: '>';
    position: absolute;
    left: -15px;
    opacity: 0;
    color: var(--accent-color);
    transition: opacity 0.3s;
}

.links a:hover::before {
    opacity: 1;
}

.links a:hover {
    color: var(--accent-color);
}

/* Sections */
.section {
    min-height: 100vh;
    padding: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.section-title {
    font-size: 4rem;
    margin-bottom: 4rem;
    opacity: 0.2;
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: -1;
}

/* Hero */
#hero {
    align-items: flex-start;
}

.hero-content h1 {
    font-size: 6rem;
    margin: 0;
    line-height: 1;
    position: relative;
}

.subtitle {
    font-size: 2rem;
    color: var(--secondary-accent);
    margin-top: 1rem;
}

.bio-terminal {
    margin-top: 2rem;
    font-family: var(--font-mono);
    color: #888;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    animation: blink 2s infinite;
}

/* About */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 2rem;
    backdrop-filter: blur(10px);
    transition: transform 0.3s;
}

.card:hover {
    border-color: var(--accent-color);
}

.stats-card ul {
    list-style: none;
    padding: 0;
}

.stats-card li {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed #333;
    padding-bottom: 0.5rem;
}

.label {
    color: var(--secondary-accent);
}

/* Projects */
.projects-wrapper {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding-bottom: 2rem;
}

.project-card {
    min-width: 300px;
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
}

.project-image {
    height: 200px;
    background: #111;
    border-bottom: 1px solid var(--card-border);
}

.project-info {
    padding: 1.5rem;
}

.tags span {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    border: 1px solid var(--secondary-accent);
    color: var(--secondary-accent);
    flex-direction: column;
}

.input-group label {
    font-family: var(--font-mono);
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

input,
textarea {
    background: transparent;
    border: none;
    border-bottom: 1px solid #333;
    color: #fff;
    padding: 1rem 0;
    font-family: var(--font-mono);
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.3s;
}

input:focus,
textarea:focus {
    outline: none;
    border-bottom-color: var(--accent-color);
}

.btn-glitch {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 1rem 3rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    cursor: none;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-glitch:hover {
    background: var(--accent-color);
    color: #000;
    box-shadow: 0 0 20px var(--accent-color);
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Glitch Effect Class */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 red;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 blue;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(12px, 9999px, 5px, 0);
    }

    100% {
        clip: rect(120px, 9999px, 80px, 0);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip: rect(65px, 9999px, 100px, 0);
    }

    100% {
        clip: rect(10px, 9999px, 15px, 0);
    }
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .section-title {
        font-size: 3rem;
        left: 1rem;
    }

    .hero-content h1 {
        font-size: 4rem;
    }

    .main-nav {
        padding: 2rem;
    }
}

@media (max-width: 768px) {

    /* Typography */
    .hero-content h1 {
        font-size: 3rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 2.5rem;
        top: 1rem;
        position: relative;
        margin-top: 0%;
    }

    /* Layout */
    .section {
        padding: 4rem 1.5rem;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .projects-wrapper {
        flex-direction: column;
        overflow-x: visible;
    }

    .project-card {
        min-width: auto;
        width: 100%;
    }

    /* Nav */
    .main-nav {
        position: absolute;
        /* Unfix nav on mobile */
        padding: 1.5rem;
        flex-direction: column;
        gap: 1rem;
        background: transparent;
        backdrop-filter: none;
    }

    .links a {
        margin-left: 1rem;
        margin-right: 1rem;
        font-size: 0.8rem;
    }

    /* TARDIS Mobile Adjustments */
    #tardis-wrapper {
        right: -60px;
        transform: scale(0.4) !important;
        transform-origin: top right;
    }

    /* Disable Custom Cursor on Mobile */
    .cursor-dot,
    .cursor-outline {
        display: none !important;
    }

    * {
        cursor: auto !important;
    }
}

.project-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.text-card {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}