/* === Homepage Styles === */

/* Hide scrollbar */
html {
    scrollbar-width: none;
}
html::-webkit-scrollbar {
    display: none;
}
pre {
    overflow: hidden;
}

/* Clean Terminal Theme - NO BLUR */
body {
    font-family: var(--font-mono);
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

.bg-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, rgba(10, 10, 10, 0.15) 0%, rgba(10, 10, 10, 0.45) 50%, rgba(10, 10, 10, 0.7) 100%),
                url('/backiee.webp') center/cover no-repeat,
                url('/backiee.jpg') center/cover no-repeat;
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
    filter: saturate(1.05) brightness(1.1);
}

nav,
main,
footer {
    position: relative;
    z-index: 1;
}

/* Apply theme colors to page-specific elements */
.ascii-art,
.terminal-window,
.tech-badge,
.nav-item,
.social-link,
.mobile-name {
    color: var(--theme-color) !important;
}

.nav-item:hover,
.social-link:hover {
    background: rgba(var(--theme-rgb), 0.06) !important;
}

.nav-item {
    border-color: var(--border-color) !important;
}

/* Terminal Window - Responsive */
.terminal-window {
    background: rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 1rem;
    position: relative;
}

@media (min-width: 480px) {
    .terminal-window {
        padding: 1.25rem;
    }
}

@media (min-width: 640px) {
    .terminal-window {
        padding: 1.5rem;
    }
}

@media (min-width: 768px) {
    .terminal-window {
        padding: 2rem;
    }
}

/* Reduce backdrop-filter on mobile for GPU perf */
@media (max-width: 768px) {
    .terminal-window {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

/* Mobile name - only for very small screens */
.mobile-name {
    display: none;
}

@media (max-width: 359px) {
    .ascii-art {
        display: none;
    }
    .mobile-name {
        display: block;
    }
}

/* ASCII Art - Responsive */
.ascii-art {
    font-size: 0.28rem;
    line-height: 0.36rem;
    overflow: hidden;
    scrollbar-width: none;
}
.ascii-art::-webkit-scrollbar {
    display: none;
}

@media (min-width: 400px) {
    .ascii-art {
        font-size: 0.35rem;
        line-height: 0.45rem;
    }
}

@media (min-width: 480px) {
    .ascii-art {
        font-size: 0.5rem;
        line-height: 0.6rem;
    }
}

@media (min-width: 640px) {
    .ascii-art {
        font-size: 0.625rem;
        line-height: 0.75rem;
    }
}

@media (min-width: 768px) {
    .ascii-art {
        font-size: 0.75rem;
        line-height: 0.875rem;
    }
}

@media (min-width: 1024px) {
    .ascii-art {
        font-size: 0.85rem;
        line-height: 1rem;
    }
}

/* Tech Badges - Matching Blog/Projects */
.tech-badge {
    padding: 0.375rem 0.775rem;
    background: rgba(var(--theme-rgb), 0.03);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--theme-color);
    font-size: 0.775rem;
    opacity: 0.8;
    transition: all 0.2s;
}

.tech-badge:hover {
    background: rgba(var(--theme-rgb), 0.06);
    opacity: 1;
}

/* Navigation Items */
.nav-item {
    display: block;
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--theme-color);
    opacity: 0.8;
    background: transparent;
}

.nav-item:hover {
    background: rgba(var(--theme-rgb), 0.06);
    opacity: 1;
}

/* Social Links */
.social-link {
    padding: 0.25rem 0.75rem;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    color: var(--theme-color);
    transition: all 0.2s;
    opacity: 0.8;
    background: transparent;
    font-size: 0.75rem;
}

.social-link:hover {
    background: rgba(var(--theme-rgb), 0.06);
    opacity: 1;
}

/* Cursor Blink */
@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

.cursor-blink {
    animation: blink 1s infinite;
    color: var(--theme-color);
}

/* Typing animation */
.typing-text {
    color: var(--theme-color);
    opacity: 0.6;
    font-size: 0.75rem;
}

@keyframes typeChar {
    from { width: 0; }
    to { width: 100%; }
}

/* Recent posts — smooth reveal */
.recent-posts-container {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.4s ease, margin 0.4s ease;
    margin: 0;
}

.recent-posts-container.revealed {
    max-height: 300px;
    opacity: 1;
}

#recent-posts-sep.revealed {
    max-height: 2px;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* Recent post item */
.recent-post-item {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.375rem 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
    color: var(--text-primary);
}

.recent-post-item:hover {
    background: rgba(var(--theme-rgb), 0.05);
    transform: translateX(3px);
}

.recent-post-date {
    font-size: 0.625rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.recent-post-title {
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-post-item:hover .recent-post-title {
    color: var(--text-accent);
}

/* Covent tooltip */
.dg-tooltip-wrap {
    position: relative;
    display: inline;
}

.dg-link {
    cursor: help;
    border-bottom: 1px dotted var(--text-accent);
    transition: all 0.2s;
}

.dg-link:hover {
    text-shadow: 0 0 8px rgba(var(--theme-rgb), 0.4);
}

.dg-tooltip {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: calc(100% + 12px);
    width: min(300px, 90vw);
    padding: 0;
    background: var(--code-bg, #161b22);
    border: 1px solid var(--border-color, #21262d);
    border-radius: 8px;
    color: var(--text-primary, #c9d1d9);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    z-index: 50;
    white-space: normal;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.dg-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border-color, #21262d);
    background: rgba(var(--theme-rgb), 0.04);
}

.dg-tooltip-name {
    font-weight: 600;
    color: var(--text-accent, #6298e0);
    font-size: 0.8125rem;
}

.dg-tooltip-badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color, #21262d);
    color: var(--text-secondary, #8b949e);
}

.dg-tooltip-body {
    display: block;
    padding: 0.625rem 0.875rem;
    color: var(--text-primary, #c9d1d9);
    font-size: 0.6875rem;
    line-height: 1.6;
}

.dg-tooltip-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-top: 1px solid var(--border-color, #21262d);
    background: rgba(var(--theme-rgb), 0.02);
}

.dg-tooltip-stat {
    font-size: 0.5625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: rgba(var(--theme-rgb), 0.08);
    color: var(--text-accent, #6298e0);
    white-space: nowrap;
}

@media (min-width: 640px) {
    .dg-tooltip-wrap:hover .dg-tooltip {
        display: block;
        animation: tooltipIn 0.2s ease-out;
    }
}

/* On mobile, tap to toggle */
@media (max-width: 639px) {
    .dg-tooltip {
        position: fixed;
        left: 5vw;
        right: 5vw;
        top: auto;
        bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
        width: auto;
        transform: none;
    }
    .dg-tooltip-wrap:hover .dg-tooltip,
    .dg-tooltip-wrap:focus-within .dg-tooltip {
        display: block;
        animation: tooltipIn 0.2s ease-out;
    }
}

@keyframes tooltipIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Boot Sequence Overlay */
#boot-overlay {
    position: fixed;
    inset: 0;
    z-index: 9997;
    background: var(--theme-bg);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 2rem;
    overflow: hidden;
    cursor: pointer;
    transition: opacity 0.4s ease;
}

#boot-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#boot-overlay.hidden {
    display: none;
}

#boot-text {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-all;
}

#boot-text .boot-line {
    display: block;
    opacity: 0;
    animation: bootLineIn 0.05s ease forwards;
}

@keyframes bootLineIn {
    to { opacity: 1; }
}

#boot-text .boot-bios {
    color: var(--text-primary);
    font-weight: bold;
}

#boot-text .boot-kernel {
    color: #4ae04a;
}

#boot-text .boot-systemd {
    color: #8be08b;
}

#boot-text .boot-accent {
    color: var(--text-accent);
    font-weight: bold;
}

#boot-text .boot-ready {
    color: #4ae04a;
    font-weight: bold;
}

.boot-skip {
    position: fixed;
    bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.625rem;
    color: var(--text-secondary);
    opacity: 0;
    animation: bootSkipFadeIn 0.5s ease 1s forwards;
}

@keyframes bootSkipFadeIn {
    to { opacity: 0.5; }
}

/* Boot: respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    #boot-overlay {
        display: none !important;
    }
}
