/* Import the theme definition */
@import 'theme.css';

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

body {
    font-family: var(--font-mono);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    background-image: radial-gradient(circle at 10% 20%, #252122 0%, var(--background-color) 80%);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3 {
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 3.5rem;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--highlight-glow);
}

h2 {
    font-size: 2rem;
    color: var(--secondary-color);
}

h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Header & contact links */
header {
    padding: 1rem;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    background-color: rgba(25, 21, 22, 0.9);
    backdrop-filter: blur(5px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.contact-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

/* Dropdown Menu Styles */
.nav-menu {
    display: flex;
    align-items: center;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background-color: transparent;
    color: var(--light-gray);
    border: 1px solid var(--light-gray);
    padding: 0.3rem 1rem;
    border-radius: 3px;
    cursor: pointer;
    font-family: var(--font-mono);
    transition: var(--transition);
}

.dropdown-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--dark-gray);
    min-width: 160px;
    box-shadow: var(--shadow);
    z-index: 1;
    border-radius: 3px;
    border: 1px solid var(--border-highlight);
}

.dropdown-content a {
    color: var(--light-gray);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: var(--transition);
}

.dropdown-content a:hover {
    background-color: rgba(3, 247, 235, 0.1);
    color: var(--primary-color);
    text-decoration: none;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.contact-link, .cv-link {
    font-size: 1.2rem;
    color: var(--light-gray);
    transition: var(--transition);
}

.contact-link:hover, .cv-link:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
    text-decoration: none;
}

.cv-link {
    padding: 0.3rem 1rem;
    border: 1px solid var(--light-gray);
    border-radius: 3px;
}

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

/* Main content */
main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Intro container with typing animation */
.intro-container {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeIn 1s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.type-container {
    height: 1.6em;
    margin: 1rem 0 2rem;
}

#name {
    margin-bottom: 1rem;
}

#title {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 0.15em solid var(--primary-color);
    animation: typing 3.5s steps(30, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--primary-color) }
}

/* Terminal button */
.terminal-btn {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.8rem 2rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

.terminal-btn::after {
    content: '';
    position: absolute;
    background-color: var(--primary-color);
    height: 100%;
    width: 0;
    top: 0;
    left: 0;
    z-index: -1;
    transition: width 0.3s ease;
}

.terminal-btn:hover {
    color: var(--background-color);
}

.terminal-btn:hover::after {
    width: 100%;
}

/* Interactive System */
#interactive-system {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#interactive-system.visible {
    opacity: 1;
    transform: translateY(0);
}

#interactive-system.hidden {
    display: none;
}

.system-container {
    position: relative;
    padding: 2rem;
    background-color: var(--dark-gray);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-highlight);
}

.node-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
}

/* System description with text shimmer effect */
.system-description {
    text-align: center;
    margin-top: 1.5rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.system-description p {
    margin-bottom: 0;
    font-weight: 500;
    color: var(--light-gray);
    font-size: 1.05rem;
}

.shimmer-text {
    background: linear-gradient(
        to right,
        var(--light-gray) 0%,
        var(--primary-color) 20%,
        var(--light-gray) 40%
    );
    background-size: 200% auto;
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer-text 3s linear infinite;
}

@keyframes shimmer-text {
    0% { background-position: 200% center; }
    100% { background-position: 0% center; }
}

.node {
    position: relative;
    width: 110px;
    height: 100px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    background-color: var(--dark-gray);
    overflow: hidden;
    margin: 1rem;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(5px);
}

.node::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    transition: var(--transition);
}

#api-gateway::before { background-color: var(--api-gateway-color); }
#queue::before { background-color: var(--queue-color); }
#worker::before { background-color: var(--worker-color); }
#db::before { background-color: var(--db-color); }
#cache::before { background-color: var(--cache-color); }
#result::before { background-color: var(--result-color); }

.node:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3), 0 0 15px var(--highlight-glow);
}

.node:hover::before {
    height: 100%;
    opacity: 0.15;
}

.icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

#api-gateway .icon { color: var(--api-gateway-color); }
#queue .icon { color: var(--queue-color); }
#worker .icon { color: var(--worker-color); }
#db .icon { color: var(--db-color); }
#cache .icon { color: var(--cache-color); }
#result .icon { color: var(--result-color); }

.node:hover .icon {
    transform: scale(1.2);
}

.label {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
    line-height: 1.3;
    padding: 0 4px;
    width: 100%;
}

.arrow {
    width: 30px;
    height: 2px;
    background-color: var(--accent-color);
    position: relative;
    z-index: 1;
    opacity: 0.6;
}

.right-arrow::after {
    content: '';
    position: absolute;
    right: 0;
    top: -3px;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 8px solid var(--accent-color);
}

/* Remove old data-flow styling */
.data-flow {
    display: none; /* Hide the old data flow element */
}

@keyframes dataFlow {
    0% { background-position: 0 0; }
    100% { background-position: 40px 0; }
}

/* Processing animation for nodes */
.node.processing {
    animation: processing-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes processing-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); box-shadow: 0 0 15px rgba(95, 219, 167, 0.6); }
}

/* Data packet styling */
.data-packet {
    position: absolute;
    z-index: 10;
    pointer-events: none;
}

/* Node pulse animation */
.node-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    top: 0;
    left: 0;
    z-index: -1;
}

#api-gateway .node-pulse { box-shadow: 0 0 0 rgba(3, 247, 235, 0.4); animation: pulse-api-gateway 2s infinite; }
#queue .node-pulse { box-shadow: 0 0 0 rgba(0, 178, 149, 0.4); animation: pulse-queue 2s infinite; }
#worker .node-pulse { box-shadow: 0 0 0 rgba(201, 218, 234, 0.4); animation: pulse-worker 2s infinite; }
#db .node-pulse { box-shadow: 0 0 0 rgba(171, 35, 70, 0.4); animation: pulse-db 2s infinite; }
#cache .node-pulse { box-shadow: 0 0 0 rgba(3, 247, 235, 0.4); animation: pulse-cache 2s infinite; }
#result .node-pulse { box-shadow: 0 0 0 rgba(0, 178, 149, 0.4); animation: pulse-result 2s infinite; }

@keyframes pulse-api-gateway {
    0% { box-shadow: 0 0 0 0 rgba(3, 247, 235, 0.2); }
    70% { box-shadow: 0 0 0 5px rgba(3, 247, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(3, 247, 235, 0); }
}

@keyframes pulse-queue {
    0% { box-shadow: 0 0 0 0 rgba(0, 178, 149, 0.2); }
    70% { box-shadow: 0 0 0 5px rgba(0, 178, 149, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 178, 149, 0); }
}

@keyframes pulse-worker {
    0% { box-shadow: 0 0 0 0 rgba(201, 218, 234, 0.2); }
    70% { box-shadow: 0 0 0 5px rgba(201, 218, 234, 0); }
    100% { box-shadow: 0 0 0 0 rgba(201, 218, 234, 0); }
}

@keyframes pulse-db {
    0% { box-shadow: 0 0 0 0 rgba(171, 35, 70, 0.2); }
    70% { box-shadow: 0 0 0 5px rgba(171, 35, 70, 0); }
    100% { box-shadow: 0 0 0 0 rgba(171, 35, 70, 0); }
}

@keyframes pulse-cache {
    0% { box-shadow: 0 0 0 0 rgba(3, 247, 235, 0.2); }
    70% { box-shadow: 0 0 0 5px rgba(3, 247, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(3, 247, 235, 0); }
}

@keyframes pulse-result {
    0% { box-shadow: 0 0 0 0 rgba(0, 178, 149, 0.2); }
    70% { box-shadow: 0 0 0 5px rgba(0, 178, 149, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 178, 149, 0); }
}

/* Info Panel */
#info-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 600px;
    background-color: var(--dark-gray);
    border-radius: 10px;
    border: 1px solid rgba(3, 247, 235, 0.2);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4), 0 0 20px var(--highlight-glow);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

#info-panel.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

.panel-header {
    padding: 1rem 1.5rem;
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-highlight);
}

.close-btn {
    cursor: pointer;
    font-size: 1.5rem;
    transition: var(--transition);
    background: transparent;
    border: none;
    color: var(--light-gray);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:hover {
    transform: scale(1.2);
    color: var(--primary-color);
}

.panel-body {
    padding: 1rem 1.5rem;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-highlight);
    margin-bottom: 1rem;
}

.tab-btn {
    background-color: transparent;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: var(--font-mono);
    font-weight: 500;
    transition: var(--transition);
    color: var(--light-gray);
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.tab-pane {
    display: none;
    padding: 1rem 0;
    color: var(--text-color);
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.5s;
}

.tab-pane ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.tab-pane li {
    margin-bottom: 0.5rem;
}

.panel-footer {
    padding: 1rem 1.5rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-highlight);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.metric-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--light-gray);
    font-weight: 500;
    font-size: 0.8rem;
}

.metric-bar {
    height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease-out;
}

#latency-fill {
    background: var(--latency-gradient);
    width: 0;
}

#throughput-fill {
    background: var(--throughput-gradient);
    width: 0;
}

#complexity-fill {
    background: var(--complexity-gradient);
    width: 0;
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--light-gray);
}

/* Responsive design */
@media screen and (max-width: 900px) {
    h1 {
        font-size: 2.5rem;
    }
    
    main {
        padding: 1rem;
    }
    
    /* System container improvements */
    .system-container {
        padding: 1.5rem 1rem;
        overflow: hidden;
    }
    
    /* Mobile-optimized node container */
    .node-container {
        flex-direction: column;
        margin: 0 auto;
        max-width: 280px; /* Constrain width for better appearance */
    }
    
    /* Mobile-optimized nodes */
    .node {
        width: 100%;
        height: 70px; /* Smaller height */
        margin: 0.5rem 0;
        flex-direction: row; /* Horizontal layout inside node */
        justify-content: flex-start;
        padding-left: 1rem;
    }
    
    /* Position icon to the left and label to the right */
    .icon {
        margin-right: 1rem;
        margin-bottom: 0;
        font-size: 1.3rem;
    }
    
    .label {
        text-align: left;
        font-size: 1rem;
    }
    
    /* Position arrow between nodes */
    .arrow {
        transform: rotate(90deg);
        margin: 0.25rem 0;
        width: 20px;
        height: 2px;
    }
    
    /* Panel improvements */
    .panel-header h3 {
        font-size: 1.2rem;
    }
    
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-btn {
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
    }
    
    /* Metrics display */
    .metrics {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .metric-label {
        font-size: 0.75rem;
    }
    
    #interactive-system {
        padding: 1rem 0.5rem;
    }
    
    /* Mobile data packet animation */
    .data-packet {
        font-size: 8px !important;
        padding: 1px 4px !important;
    }
}

/* Smaller mobile screens */
@media screen and (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }
    
    #title {
        font-size: 1rem;
    }
    
    .system-container {
        padding: 1rem 0.5rem;
    }
    
    .node {
        height: 60px;
    }
    
    .icon {
        font-size: 1.1rem;
    }
    
    .label {
        font-size: 0.9rem;
    }
    
    .system-description p {
        font-size: 0.9rem;
    }
    
    .tab-pane {
        font-size: 0.9rem;
    }
    
    /* Reduce tab button size */
    .tab-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }
    
    /* Handle animation */
    .data-packet {
        transform: scale(0.8) translateY(-50%) !important;
    }
    
    /* Contact links in header */
    .contact-links {
        gap: 1rem;
    }
    
    .contact-link, .cv-link {
        font-size: 1rem;
    }
    
    .cv-link {
        padding: 0.2rem 0.7rem;
    }
}

/* Screen reader only class for improved accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Optimize loading with modern font display strategy */
@font-face {
    font-family: 'Your-Font-Name';
    src: url('your-font.woff2') format('woff2');
    font-display: swap; /* Shows text immediately with a system font while custom font loads */
}

/* Add focus styles for keyboard navigation */
a:focus, button:focus, .node:focus {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}

/* Add CSS for print styles to improve SEO and user experience */
@media print {
    body {
        color: #000;
        background: #fff;
    }
    
    .interactive-system {
        display: none;
    }
    
    main {
        width: 100%;
        padding: 0;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* Add styles for reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .data-packet {
        display: none;
    }
}