/* ==========================================================================
   STYLE SYSTEM — LÊ HÙNG QUANG MINH PORTFOLIO
   Design Vibe: Swiss Technical Dossier (Minimalist & High-End)
   VARIANCE: 5 | MOTION: 3 | DENSITY: 3
   ========================================================================== */

/* 1. Design Tokens & Core Settings
   ========================================================================== */
:root {
    /* Color Palette — Matte Graphite Paper Vibe */
    --bg-base: #0E0E10;         /* Matte charcoal black */
    --bg-surface: #151518;      /* Fine-grain graphite card background */
    --text-primary: #E2E2E5;    /* Premium off-white */
    --text-muted: #8E8E93;      /* Slate gray */
    --text-highlight: #FFFFFF;  /* Pure white */
    
    --border-muffled: rgba(255, 255, 255, 0.05); /* Hair-line borders */
    --border-active: rgba(255, 255, 255, 0.12);  /* Focus/hover borders */
    
    --accent-green: #10B981;    /* Online indicator */
    
    /* Typography */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-mono: 'Geist Mono', 'SF Mono', 'JetBrains Mono', monospace;
    
    /* Transition dynamics */
    --transition-speed: 0.5s;
    --transition-curve: cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2. Global Reset & Foundations
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    position: relative;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* Global Subtle Noise Grain Overlay (GPU safe - fixed layer) */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.012;
    pointer-events: none;
    z-index: 999;
}

/* 3. Layout Grid
   ========================================================================== */
.dossier-layout {
    display: grid;
    grid-template-columns: minmax(280px, 320px) 1fr;
    gap: 80px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 8vh 24px;
}

/* 4. Left Sidebar (Profile Card)
   ========================================================================== */
.dossier-sidebar {
    position: sticky;
    top: 8vh;
    height: fit-content;
}

.profile-sticky-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Avatar Frame */
.avatar-block {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the avatar on desktop */
    margin-bottom: 28px;
    width: 100%;
}

.avatar-frame {
    width: 120px; /* Larger desktop size */
    height: 120px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-muffled);
    padding: 4px;
    overflow: hidden;
}

.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    filter: grayscale(0.2) contrast(1.05);
    transition: filter 0.4s ease;
}

.avatar-img:hover {
    filter: grayscale(0) contrast(1);
}

/* Identity & Typewriter */
.identity-block {
    margin-bottom: 24px;
}

.profile-name {
    font-size: clamp(20px, 3vw, 24px);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-highlight);
    min-height: 32px;
}

.profile-pseudonym {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 2px;
}

.profile-title {
    font-size: 14px;
    color: var(--text-primary);
    margin-top: 4px;
    font-weight: 500;
}

/* Typewriter cursor style */
.typewriter-cursor {
    color: var(--text-muted);
    font-weight: 300;
    animation: cursor-blink 0.8s infinite;
    margin-left: 1px;
    display: inline-block;
}

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

/* Bio */
.bio-block {
    margin-bottom: 32px;
}

.bio-statement {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-muted);
}

/* Dossier details list (Technical blueprint feel) */
.dossier-details {
    width: 100%;
    border-top: 1px solid var(--border-muffled);
    border-bottom: 1px solid var(--border-muffled);
    padding: 20px 0;
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dossier-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.dossier-item .lbl {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.dossier-item .val {
    color: var(--text-primary);
    font-weight: 400;
}

.dossier-item .mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

.status-green {
    color: var(--accent-green);
    font-weight: 500;
}

/* Social & contact links (Text-only system layout) */
.contact-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.link-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    padding: 8px 0;
    border-bottom: 1px dashed transparent;
    transition: all 0.3s ease;
}

.link-text-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.link-text-wrapper i {
    font-size: 16px;
    opacity: 0.75;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.link-item .ph-arrow-up-right {
    font-size: 12px;
    opacity: 0.4;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.link-item:hover {
    color: var(--text-highlight);
    border-bottom-color: var(--border-active);
}

.link-item:hover .link-text-wrapper i {
    opacity: 1;
    color: var(--text-highlight);
}

.link-item:hover .ph-arrow-up-right {
    transform: translate(2px, -2px);
    opacity: 1;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 36px;
    font-family: var(--font-mono);
    font-size: 11px;
}

.lang-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
    padding: 2px 4px;
    transition: color 0.3s ease;
}

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

.lang-btn.active {
    color: var(--text-highlight);
    font-weight: 600;
}

.lang-divider {
    color: rgba(255, 255, 255, 0.15);
}

/* 5. Right Main Content Area
   ========================================================================== */
.dossier-main {
    display: flex;
    flex-direction: column;
}

.dossier-section {
    padding-bottom: 56px;
    border-bottom: 1px solid var(--border-muffled);
    margin-bottom: 56px;
}

/* Quote/Manifesto (Editorial Serif) */
#philosophy-sec {
    padding-top: 10px;
}

.manifesto-quote {
    font-family: var(--font-serif);
    font-size: clamp(20px, 3.5vw, 26px);
    font-style: italic;
    line-height: 1.45;
    color: var(--text-highlight);
    max-width: 600px;
    margin-bottom: 16px;
}

.manifesto-author {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-style: normal;
}

.manifesto-license {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mono-license {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-highlight);
    background: rgba(255, 255, 255, 0.03);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-muffled);
}

/* Section Header Metas */
.section-meta {
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    margin-bottom: 12px;
}

.section-title {
    font-size: clamp(22px, 3.5vw, 28px);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-highlight);
    margin-bottom: 28px;
}

/* Case Study: WinNest */
.case-study-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 40px;
    align-items: center;
}

.case-desc {
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.case-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    border-top: 1px solid var(--border-muffled);
    padding-top: 20px;
}

.case-meta-row .mono {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

/* Button-in-Button primary style */
.case-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--text-highlight);
    color: var(--bg-base);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 6px 6px 16px;
    border-radius: 9999px;
    transition: all 0.3s var(--transition-curve);
}

.circle-arrow {
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: transform 0.3s var(--transition-curve);
}

.case-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05);
}

.case-link:hover .circle-arrow {
    transform: translate(2px, -2px) scale(1.05);
}

.case-link:active {
    transform: scale(0.98);
}

/* Image Visual container */
.case-study-visual {
    width: 100%;
}

.visual-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border-muffled);
    padding: 6px;
    border-radius: 14px;
    overflow: hidden;
}

.visual-element {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    filter: brightness(0.8) contrast(1.05);
    transition: transform 0.6s var(--transition-curve);
}

.visual-wrap:hover .visual-element {
    transform: scale(1.015);
}

/* 6. Repositories Grid (Block links) */
.repos-grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.repo-item-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-muffled);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s var(--transition-curve);
}

.repo-item-card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
}

.repo-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.repo-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.repo-title i {
    font-size: 14px;
}

.repo-anchor {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-highlight);
    text-decoration: none;
}

.tag-pub {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-muffled);
    padding: 2px 6px;
    border-radius: 4px;
}

.repo-description {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

.repo-card-bottom {
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.lang {
    display: flex;
    align-items: center;
    gap: 6px;
}

.indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.indicator.ts { background-color: #3178c6; }
.indicator.md { background-color: #707075; }

.stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 7. Experience Timeline
   ========================================================================== */
.dossier-timeline {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.timeline-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 20px;
    align-items: baseline;
}

.timeline-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.timeline-detail {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.timeline-header {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-highlight);
    margin-bottom: 6px;
}

.timeline-text {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-muted);
}

/* 8. Footer
   ========================================================================== */
.dossier-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
    margin-top: auto;
}

.dossier-footer p {
    font-size: 12px;
    color: var(--text-muted);
}

/* 9. Scroll entry transitions (Observer)
   ========================================================================== */
.scroll-reveal {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(4px);
    transition: opacity 0.8s var(--transition-curve), 
                transform 0.8s var(--transition-curve), 
                filter 0.8s var(--transition-curve);
    will-change: transform, opacity, filter;
}

.scroll-reveal.reveal-active {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* 10. Responsive Adaptations (Mobile Scale Rules)
   ========================================================================== */
@media (max-width: 960px) {
    .dossier-layout {
        grid-template-columns: 1fr;
        gap: 56px;
        padding: 40px 20px;
    }
    
    .dossier-sidebar {
        position: static;
        width: 100%;
    }
    
    .profile-sticky-card {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 24px;
        align-items: center;
        border-bottom: 1px solid var(--border-muffled);
        padding-bottom: 32px;
    }
    
    .avatar-block {
        width: auto;
        margin-bottom: 0;
        gap: 16px;
    }

    .avatar-frame {
        width: 56px; /* Scaled down for mobile */
        height: 56px;
        padding: 2px;
    }
    
    .identity-block {
        margin-bottom: 0;
        flex-grow: 1;
    }
    
    .bio-block {
        width: 100%;
        margin-bottom: 0;
    }
    
    .dossier-details {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .contact-links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .link-item {
        border-bottom: none;
        padding: 4px 0;
    }
}

@media (max-width: 768px) {
    .case-study-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .case-study-visual {
        order: -1; /* visual on top for mobile */
    }
    
    .repos-grid-layout {
        grid-template-columns: 1fr;
    }
    
    .timeline-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* 11. Accessibility (Reduced Motion)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .scroll-reveal {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        transition: none !important;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .status-pulse-dot {
        animation: none !important;
    }
}
