/* 
 * Ethereal Engineer - Core Design System
 * --------------------------------------
 * Refactored for clean, human-readable vanilla CSS.
 * Sectioned by: Tokens, Global Reset, Typography, Navigation, Hero, About, Apps, and Footer.
 */

:root {
    /* Colors - Catppuccin Frappé Adaptation */
    --surface: #eff1f5;
    --on-surface: #1e1e2e;
    --on-surface-variant: #45475a;
    --primary: #8839ef;
    --primary-container: #cba6f7;
    --on-primary: #ffffff;
    --secondary: #179299;
    --surface-container-high: #e0e9f4;
    --surface-container: #e7eff9;

    /* Typography */
    --font-sans: "system-ui", "-apple-system", sans-serif;

    /* Layout */
    --max-w: 80rem;
}

/* ==========================================================================
   Global Reset & Base
   ========================================================================== */

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

body {
    background-color: var(--surface);
    font-family: var(--font-sans);
    color: var(--on-surface);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.mesh-bg {
    background-image:
        radial-gradient(at 0% 0%, rgba(136, 57, 239, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(23, 146, 153, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(203, 166, 247, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(242, 205, 205, 0.12) 0px, transparent 50%);
}

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 2rem;
}

::selection {
    background-color: var(--primary-container);
    color: #301934;
}

/* ==========================================================================
   Typography Tools
   ========================================================================== */

h1,
h2,
h3 {
    font-family: var(--font-sans);
    font-weight: 800;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 3.75rem;
    line-height: 1.05;
    margin-bottom: 2rem;
}

h2 {
    font-size: 2.25rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
    h1 {
        font-size: 6rem;
    }

    h2 {
        font-size: 3rem;
    }
}

.text-primary {
    color: var(--primary);
}

.text-secondary {
    color: var(--secondary);
}

/* ==========================================================================
   Navigation Header
   ========================================================================== */

.nav-header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 50;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(168, 179, 192, 0.15);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 5rem;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.nav-links {
    display: none;
    gap: 2.5rem;
    align-items: center;
}

@media (min-width: 768px) {
    .nav-links {
        display: flex;
    }
}

.nav-link {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--on-surface-variant);
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.25rem;
}

.btn-primary {
    background: linear-gradient(135deg, #764f90, #e3b5ff);
    color: var(--on-primary);
    padding: 0.75rem 1.75rem;
    border-radius: 9999px;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(136, 57, 239, 0.2);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero-section {
    position: relative;
    min-height: 85vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 8rem 0 4rem;
}

@media (min-width: 1024px) {
    .hero-section {
        padding: 10rem 0 5rem;
    }
}

.hero-blob {
    position: absolute;
    top: 5rem;
    right: -10%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(136, 57, 239, 0.4) 0%, transparent 70%);
    filter: blur(80px);
    opacity: 0.4;
}

.hero-blob-secondary {
    position: absolute;
    bottom: -10%;
    left: -5%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(23, 146, 153, 0.2);
    filter: blur(100px);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 10;
}

@media (min-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.hero-content {
    order: 2;
    text-align: center;
}

@media (min-width: 1024px) {
    .hero-content {
        order: 1;
        text-align: left;
    }
}

.hero-badge {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    margin-bottom: 2rem;
    border-radius: 9999px;
    background: rgba(136, 57, 239, 0.1);
    color: var(--primary);
    border: 1px solid rgba(136, 57, 239, 0.2);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.hero-description {
    color: var(--on-surface-variant);
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 3rem;
    max-width: 32rem;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 1024px) {
    .hero-description {
        margin-left: 0;
        margin-right: 0;
    }
}

@media (min-width: 1024px) {
    .hero-description {
        font-size: 1.5rem;
    }
}

.store-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

@media (min-width: 1024px) {
    .store-buttons {
        justify-content: flex-start;
    }
}

.store-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    border-radius: 9999px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 40px rgba(41, 51, 62, 0.06);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.store-btn:hover {
    transform: scale(1.05);
}

.store-btn-text h4 {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.store-btn-text p {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--on-surface);
}

.hero-visual {
    order: 1;
    display: flex;
    justify-content: center;
    position: relative;
}

@media (min-width: 1024px) {
    .hero-visual {
        order: 2;
        justify-content: flex-end;
    }
}

.glass-showcase {
    position: relative;
    z-index: 10;
    padding: 1.25rem;
    border-radius: 3.5rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.15);
    transform: rotate(6deg) scale(1.1);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-showcase:hover {
    transform: rotate(0deg) scale(1.1);
}

.mockup-img {
    width: 300px;
    height: 620px;
    object-fit: cover;
    border-radius: 2.8rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   About Me Section
   ========================================================================== */

.about-section {
    padding: 3rem 0;
    background: rgba(231, 239, 249, 0.6);
    backdrop-filter: blur(12px);
}

@media (min-width: 1024px) {
    .about-section {
        padding: 5rem 0;
    }
}

.about-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
    padding: 3rem;
    border-radius: 3.5rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 40px rgba(41, 51, 62, 0.06);
}

@media (min-width: 768px) {
    .about-card {
        flex-direction: row;
        padding: 5rem;
        gap: 6rem;
    }
}

.about-blob {
    position: absolute;
    top: -6rem;
    left: -6rem;
    width: 16rem;
    height: 16rem;
    border-radius: 50%;
    background: rgba(136, 57, 239, 0.2);
    filter: blur(80px);
}

.about-visual {
    position: relative;
    flex-shrink: 0;
}

.about-visual-bg {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(23, 146, 153, 0.3);
    filter: blur(30px);
    transform: scale(1.25);
}

.portrait-img {
    position: relative;
    z-index: 10;
    width: 14rem;
    height: 14rem;
    object-fit: cover;
    border-radius: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 4px solid rgba(255, 255, 255, 0.5);
}

@media (min-width: 1024px) {
    .portrait-img {
        width: 18rem;
        height: 18rem;
    }
}

.about-content {
    flex: 1;
    position: relative;
    z-index: 10;
    text-align: center;
}

@media (min-width: 768px) {
    .about-content {
        text-align: left;
    }
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2.5rem;
    justify-content: center;
}

@media (min-width: 768px) {
    .tech-stack {
        justify-content: flex-start;
    }
}

.tech-tag {
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    background: var(--surface-container-high);
    color: var(--secondary);
    font-size: 0.875rem;
    font-weight: 700;
}

/* ==========================================================================
   App Ecosystem
   ========================================================================== */

.apps-section {
    padding: 3rem 0;
}

@media (min-width: 1024px) {
    .apps-section {
        padding: 5rem 0;
    }
}

.section-header {
    text-align: center;
    margin-bottom: 5rem;
}

.section-subtitle {
    color: var(--on-surface-variant);
    font-size: 1.25rem;
    font-weight: 500;
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

@media (min-width: 768px) {
    .app-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 1280px) {
    .app-grid {
        /* Max 2 columns for a premium showcase feel */
        gap: 4rem;
        padding: 0 2rem;
    }
}

.app-card {
    padding: 2.5rem;
    border-radius: 2.5rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 40px rgba(41, 51, 62, 0.06);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-card:hover {
    transform: translateY(-1rem);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 15px 50px rgba(136, 57, 239, 0.1);
}

.app-image-wrapper {
    margin-bottom: 2.5rem;
    border-radius: 1.5rem;
    overflow: hidden;
    aspect-ratio: 9/16;
    background: var(--surface-container-high);
}

.app-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.app-card:hover .app-image {
    transform: scale(1.1);
}

.app-title {
    font-size: 1.875rem;
    margin-bottom: 1rem;
    text-align: center;
}

@media (min-width: 768px) {
    .app-title {
        text-align: left;
    }
}

.app-description {
    color: var(--on-surface-variant);
    margin-bottom: 2.5rem;
    line-height: 1.625;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
}

@media (min-width: 768px) {
    .app-description {
        text-align: left;
    }
}

.app-actions {
    display: flex;
    gap: 0.75rem;
    flex-direction: column;
    align-items: center;
}

@media (min-width: 640px) {
    .app-actions {
        flex-direction: row;
        align-items: stretch;
    }
}

.store-btn-small {
    padding: 0.6rem 1rem;
    gap: 0.75rem;
    flex: 1;
    justify-content: center;
}

.store-btn-small .store-btn-text h4 {
    font-size: 0.55rem;
    margin-bottom: 0.1rem;
}

.store-btn-small .store-btn-text p {
    font-size: 0.85rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    padding: 4rem 0;
    background: rgba(231, 239, 249, 0.6);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
}

.footer-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

@media (min-width: 768px) {
    .footer-container {
        flex-direction: row;
    }
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
}

@media (min-width: 768px) {
    .footer-brand {
        text-align: left;
    }
}

.footer-logo {
    font-size: 1.25rem;
    font-weight: 800;
}

.footer-copyright {
    font-size: 0.875rem;
    color: var(--on-surface-variant);
    opacity: 0.8;
}

.footer-links {
    display: flex;
    gap: 2.5rem;
}

.footer-link {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--on-surface-variant);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: var(--primary);
}

/* ==========================================================================
   Animations
   ========================================================================== */

.reveal {
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.app-card.reveal:nth-child(1) {
    transition-delay: 0s;
}

.app-card.reveal:nth-child(2) {
    transition-delay: 0.1s;
}

.app-card.reveal:nth-child(3) {
    transition-delay: 0.2s;
}

.app-card.reveal:nth-child(4) {
    transition-delay: 0.3s;
}

.app-card.reveal:nth-child(5) {
    transition-delay: 0.4s;
}

.app-card.reveal:nth-child(6) {
    transition-delay: 0.5s;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 15px 35px rgba(136, 57, 239, 0.15);
    border-left: 4px solid var(--primary);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 320px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-content {
    display: flex;
    flex-direction: column;
}

.toast-title {
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: 0.875rem;
    color: var(--on-surface);
    margin-bottom: 0.125rem;
}

.toast-message {
    font-size: 0.75rem;
    color: var(--on-surface-variant);
    line-height: 1.4;
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .app-card,
    .glass-showcase,
    .toast,
    .store-btn,
    .btn-primary,
    .app-image {
        transition: none;
    }

    .glass-showcase {
        transform: none;
    }
}