/* ===========================
   BASE & RESET
   =========================== */
body {
    background-color: #0a0a0f;
    overflow-x: hidden;
    font-family: 'Space Grotesk', sans-serif;
}

/* ===========================
   CRT / RETRO OVERLAYS
   =========================== */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    z-index: 100;
}

.grid-bg {
    background-image:
        linear-gradient(rgba(244, 37, 140, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(244, 37, 140, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ===========================
   NEON BORDERS
   =========================== */
.neon-border-pink {
    border: 1px solid #f4258c;
    box-shadow: 0 0 10px rgba(244, 37, 140, 0.4), inset 0 0 5px rgba(244, 37, 140, 0.2);
}

.neon-border-cyan {
    border: 1px solid #00f3ff;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.4), inset 0 0 5px rgba(0, 243, 255, 0.2);
}

/* ===========================
   NEON TEXT EFFECTS
   =========================== */
.neon-text-cyan {
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.8);
}

.neon-text-pink {
    text-shadow: 0 0 8px rgba(244, 37, 140, 0.8);
}

.glow-text {
    text-shadow: 0 0 10px rgba(244, 37, 140, 0.8), 0 0 20px rgba(244, 37, 140, 0.4);
}

.glow-cyan {
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.8);
}

/* ===========================
   LED SEGMENTS (Skills)
   =========================== */
.led-segment {
    height: 12px;
    width: 8px;
    margin-right: 2px;
    background: #1a1a2e;
}

.led-active {
    background: #00f3ff;
    box-shadow: 0 0 5px #00f3ff;
}

/* ===========================
   CARDS
   =========================== */
.pixel-card {
    transition: all 0.1s ease;
}

.pixel-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px #f4258c;
}

/* ===========================
   GLITCH EFFECT
   =========================== */
.glitch-header::after {
    content: attr(data-text);
    position: absolute;
    left: 2px;
    text-shadow: -1px 0 #bc13fe;
    top: 0;
    color: #f4258c;
    overflow: hidden;
    clip: rect(0, 900px, 0, 0);
}

/* ===========================
   HERO SECTION
   =========================== */
.hero-grid-bg {
    background-image:
        linear-gradient(to right, rgba(0, 243, 255, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 243, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, #000 70%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, #000 70%, transparent 100%);
}

.btn-glow:hover {
    box-shadow: 0 0 25px rgba(244, 37, 140, 0.6);
}

/* ===========================
   CONTACT SECTION (Email Form)
   =========================== */
.terminal-border {
    box-shadow: 0 0 15px rgba(244, 37, 140, 0.4), inset 0 0 10px rgba(244, 37, 140, 0.2);
}

.contact-grid-bg {
    background-image:
        linear-gradient(to right, rgba(244, 37, 140, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(244, 37, 140, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: perspective(500px) rotateX(60deg);
    position: absolute;
    bottom: -25%;
    left: -50%;
    right: -50%;
    height: 100%;
    z-index: 0;
}

.button-glow:hover {
    box-shadow: 0 0 20px rgba(244, 37, 140, 0.6);
}

/* Contact form floating labels */
.contact-form input:focus+label,
.contact-form input:not(:placeholder-shown)+label,
.contact-form textarea:focus+label,
.contact-form textarea:not(:placeholder-shown)+label {
    transform: translateY(-1.5rem) scale(0.8);
    color: #f4258c;
}

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.cursor-blink {
    animation: blink 1s step-end infinite;
}

@keyframes flicker {
    0% {
        opacity: 1;
    }

    5% {
        opacity: 0.8;
    }

    10% {
        opacity: 1;
    }

    15% {
        opacity: 0.9;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 1;
    }
}

.flicker {
    animation: flicker 2s infinite;
}

/* Scanline animation for hero */
.scanline {
    width: 100%;
    height: 100px;
    z-index: 10;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(244, 37, 140, 0.05) 50%, rgba(0, 0, 0, 0) 100%);
    opacity: 0.1;
    position: absolute;
    bottom: 100%;
}

/* ===========================
   SMOOTH SCROLL
   =========================== */
html {
    scroll-behavior: smooth;
}

/* ===========================
   SECTION TRANSITIONS & SCROLL ANIMATIONS
   =========================== */
.section-fade {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.section-fade.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll-reveal base */
.scroll-reveal {
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    transition-delay: var(--reveal-delay, 0s);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translate(0, 0) scale(1) !important;
}

/* Slide up */
.reveal-up {
    transform: translateY(40px);
}

/* Slide from left */
.reveal-left {
    transform: translateX(-40px);
}

/* Slide from right */
.reveal-right {
    transform: translateX(40px);
}

/* Scale in */
.reveal-scale {
    transform: scale(0.85);
}

/* Glow in (for neon elements) */
.reveal-glow {
    transform: translateY(20px);
    filter: brightness(0.5);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, filter 0.8s ease-out;
    transition-delay: var(--reveal-delay, 0s);
}

.reveal-glow.revealed {
    filter: brightness(1);
}

/* ===========================
   SCROLLBAR STYLING
   =========================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0a0a0f;
}

::-webkit-scrollbar-thumb {
    background: #f4258c;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00f3ff;
}

/* ===========================
   MOBILE RESPONSIVE
   =========================== */

/* Small phones (max-width: 480px) */
@media (max-width: 480px) {

    /* Hero */
    #hero h1 {
        font-size: 3rem !important;
        letter-spacing: -0.03em;
    }

    #hero .text-sm.md\:text-lg {
        font-size: 0.65rem;
    }

    #hero a[href="dash/"],
    #hero button {
        padding: 0.75rem 2rem;
        font-size: 0.85rem;
    }

    /* Dashboard header */
    header h1,
    header h2 {
        font-size: 1.1rem !important;
    }

    /* Nav tabs */
    header nav {
        width: 100%;
        justify-content: center;
    }

    header nav a {
        padding: 0.4rem 0.8rem;
        font-size: 0.55rem;
        letter-spacing: 0.1em;
    }

    /* LED segments - smaller on mobile */
    .led-segment {
        height: 10px;
        width: 6px;
        margin-right: 1px;
    }

    /* Cert grid - tighter */
    .aspect-square i {
        font-size: 1rem !important;
    }

    /* Project cards text */
    .pixel-card h3,
    .pixel-card h4 {
        font-size: 0.95rem;
    }

    .pixel-card p {
        font-size: 0.65rem;
    }

    /* Pixel card - disable hover transform on touch */
    .pixel-card:hover {
        transform: none;
        box-shadow: 2px 2px 0px #f4258c;
    }

    /* Contact form */
    .terminal-border {
        padding: 1.25rem !important;
    }

    #contact h2 {
        font-size: 1.1rem !important;
        letter-spacing: 0.1em !important;
    }

    .contact-form .relative {
        margin-bottom: 0.5rem;
    }

    .contact-form button[type="submit"] {
        width: 100%;
        padding: 0.9rem 1.5rem;
    }

    /* Fixed action buttons - bigger tap targets */
    .fixed.bottom-4.right-4 a {
        width: 44px;
        height: 44px;
    }

    /* Footer */
    footer {
        text-align: center;
    }

    footer>div:first-child {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Phones & small tablets (max-width: 768px) */
@media (max-width: 768px) {

    /* Hero text scaling */
    #hero h1 {
        font-size: 3.5rem;
    }

    /* Dashboard padding */
    .grid-bg {
        padding: 0.75rem;
    }

    /* Hide contact grid bg on mobile (performance) */
    .contact-grid-bg {
        display: none;
    }

    /* Stack project card 03 vertically */
    .pixel-card .flex.flex-col.md\:flex-row {
        flex-direction: column;
    }

    .pixel-card .md\:w-1\/2 {
        width: 100%;
    }

    /* Terminal container - less padding */
    .terminal-border {
        padding: 1.5rem;
    }

    /* Contact section - less vertical padding */
    #contact {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    /* Mission log - reduce max height */
    .neon-border-cyan .overflow-y-auto {
        max-height: 350px;
    }

    /* Neon border glow - subtler on mobile for perf */
    .neon-border-pink {
        box-shadow: 0 0 5px rgba(244, 37, 140, 0.3);
    }

    .neon-border-cyan {
        box-shadow: 0 0 5px rgba(0, 243, 255, 0.3);
    }

    .terminal-border {
        box-shadow: 0 0 8px rgba(244, 37, 140, 0.3);
    }
}

/* Tablets (max-width: 1024px) */
@media (max-width: 1024px) {

    /* Side panels stack under center */
    .lg\:col-span-3,
    .lg\:col-span-6 {
        grid-column: span 12 / span 12;
    }

    /* Reorder: projects first, then skills, then mission log */
    main.grid {
        display: flex;
        flex-direction: column;
    }

    main.grid>div:nth-child(2) {
        order: -1;
    }

    /* Two column project grid still works */
    .grid.grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Very small screens (max-width: 360px) */
@media (max-width: 360px) {
    #hero h1 {
        font-size: 2.5rem !important;
    }

    header nav {
        flex-direction: column;
        align-items: stretch;
    }

    header nav a {
        text-align: center;
    }

    /* Single column projects */
    .grid.grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .pixel-card:hover {
        transform: none;
        box-shadow: none;
    }

    .pixel-card:active {
        transform: scale(0.98);
        box-shadow: 2px 2px 0px #f4258c;
    }

    .btn-glow:hover {
        box-shadow: none;
    }

    .btn-glow:active {
        box-shadow: 0 0 25px rgba(244, 37, 140, 0.6);
    }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
    .fixed.bottom-4 {
        bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}