/* ==========================================================================
   1. CSS VARIABLES & SYSTEM SETUP
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;600&display=swap');

:root {
    /* Color Palette */
    --bg-dark: #050505;
    --bg-card: #0a0d0a;
    --bg-nav: #0f140f;
    --primary: #ff3344;
    --primary-hover: #ff5566;
    --primary-dark: #cc2233;
    --text-bright: #ffffff;
    --text-body: #ff8899;
    --text-muted: #888888;
    --text-dim: #555555;
    --success: #00ff66;

    /* Styling Properties */
    --font-mono: 'Fira Code', 'Courier New', monospace;
    --border-red: 1px solid var(--primary);
    --glow-red: 0 0 15px rgba(255, 51, 68, 0.2);
    --radius-sm: 4px;
    --radius-md: 6px;
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.6s ease;
}

/* ==========================================================================
   2. RESET & BASE TYPOGRAPHY
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-mono);
}

body {
    background-color: var(--bg-dark);
    color: var(--primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

p, li {
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    line-height: 1.6;
    color: var(--text-body);
    word-break: break-word;
}

p {
    margin-bottom: 0.85rem;
}

ul {
    list-style-type: none;
}

a {
    text-decoration: none;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    transition: color var(--transition-fast), text-shadow var(--transition-fast);
}

a:hover {
    color: var(--primary);
    text-shadow: 0 0 5px var(--primary);
}

.hidden {
    display: none !important;
}

/* Page Load Fade-In */
.page-header,
.terminal-layout {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-smooth) 0.2s, transform var(--transition-smooth) 0.2s;
}

body.site-loaded .page-header,
body.site-loaded .terminal-layout {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   3. HEADER & NAVIGATION
   ========================================================================== */
.page-header {
    width: 100%;
    max-width: 1150px;
    margin-top: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}

h1 {
    color: var(--primary);
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    text-shadow: 0 0 8px rgba(255, 51, 68, 0.4);
    word-break: break-word;
    margin-bottom: 1rem;
}

h1::before {
    content: "danilo@tivat:~$ ./portfolio.sh";
    color: var(--text-muted);
    display: block;
    font-size: 0.85em;
    margin-bottom: 6px;
}

nav ul {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 8px;
    background-color: var(--bg-nav);
    border: var(--border-red);
    border-radius: var(--radius-sm);
    padding: 8px;
}

nav li {
    padding: 2px;
}

.nav-link {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 2px;
}

.nav-link.active {
    background-color: var(--primary);
    color: var(--bg-dark);
    font-weight: bold;
}

/* ==========================================================================
   4. LAYOUT STRUCTURE
   ========================================================================== */
.terminal-layout {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
    max-width: 1150px;
    margin: 0 auto;
}

.main-content {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.container {
    width: 100%;
}

/* ==========================================================================
   5. CARDS & CONTENT SECTIONS
   ========================================================================== */
.card-section {
    display: none;
    background-color: var(--bg-card);
    border: var(--border-red);
    border-radius: var(--radius-md);
    padding: 25px;
    box-shadow: var(--glow-red);
}

.card-section.active-card {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
    animation: terminalPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.text-content {
    flex: 1;
    min-width: 0;
}

.text-content h2 {
    color: var(--text-bright);
    font-size: clamp(1.1rem, 3.5vw, 1.4rem);
    margin-top: 0;
    margin-bottom: 1.25rem;
    border-bottom: 1px dashed var(--primary);
    padding-bottom: 6px;
    text-align: left;
    word-break: break-word;
}

.text-content h2::before {
    content: "./cat ";
    color: var(--primary);
}

.text-content ul {
    margin-top: 0;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
}

.text-content ul li {
    margin-bottom: 10px;
}

.text-content ul li::before {
    content: "> ";
    color: var(--primary);
    font-weight: bold;
}

.text-content a {
    color: var(--primary-hover);
    text-decoration: underline;
}

.text-content a:hover {
    color: var(--text-bright);
}

.text-content > *:last-child {
    margin-bottom: 0;
}

.profile-image {
    width: 180px;
    max-width: 100%;
    height: auto;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    filter: grayscale(30%) contrast(120%);
    box-shadow: 0 0 10px rgba(255, 51, 68, 0.3);
    flex-shrink: 0;
}

/* ==========================================================================
   6. CERTIFICATES & LOGO BADGES
   ========================================================================== */
.cert-list li {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.cert-list li::before {
    content: "" !important; /* Remove arrow prefix for badge lists */
}

.logo-group {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
}

.cert-logo {
    height: 35px;
    width: auto;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.cert-logo.sub-logo {
    height: 20px;
    margin-left: -1rem;
    margin-top: 1rem;
    position: relative;
    z-index: 2;
    opacity: 0.95;
}
.badge {
    height: 10rem;
    width: auto;
    object-fit: contain;
    position: relative;
    z-index: 3;
    margin-left: 0.5rem;
}
.event-badge-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.event-badge-grid .logo-group {
    font-size: 1rem;
    padding: 4px 8px;
    gap: 6px;
}

/* ==========================================================================
   7. INTERACTIVE CLI WIDGET
   ========================================================================== */
.cli-container {
    margin-top: 20px;
    background-color: var(--bg-card);
    border: var(--border-red);
    border-radius: var(--radius-md);
    padding: 15px;
    box-shadow: 0 0 15px rgba(255, 51, 68, 0.15);
}

.cli-output {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
    word-break: break-word;
}

.cli-output::-webkit-scrollbar {
    width: 6px;
}

.cli-output::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.cli-output::-webkit-scrollbar-track {
    background: var(--bg-nav);
}

.cli-line {
    font-size: 0.9rem;
    line-height: 1.4;
}

.cli-command-echo { color: var(--text-muted); }
.cli-response     { color: var(--text-body); }
.cli-error        { color: var(--primary); }
.cli-success      { color: var(--success); }

.cli-input-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cli-input-line .prompt {
    color: var(--primary);
    font-weight: bold;
    white-space: nowrap;
}

#cli-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-bright);
    font-family: inherit;
    font-size: 0.95rem;
    caret-color: var(--primary);
}

/* ==========================================================================
   8. ASCII SIDEBAR & OVERLAY INTRO
   ========================================================================== */
.ascii-sidebar {
    width: 250px;
    padding: 15px 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
}

.ascii-art {
    color: var(--primary);
    font-size: 0.25rem;
    line-height: 1.25;
    white-space: pre;
    margin: 0;
    text-shadow: 0 0 5px rgba(255, 51, 68, 0.6);
    user-select: none;
}

#terminal-intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    cursor: pointer;
    padding: 20px;
    transition: transform var(--transition-smooth), opacity 0.5s ease;
}

#terminal-intro.slide-up {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.intro-content {
    font-size: clamp(0.85rem, 3.5vw, 1.3rem);
    color: var(--primary);
    text-shadow: 0 0 8px rgba(255, 51, 68, 0.5);
    text-align: left;
    width: 100%;
    max-width: 650px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.intro-ascii {
    align-self: center;
    font-size: clamp(3px, 0.6vw, 5px) !important;
    line-height: 1.3 !important;
    margin-bottom: 20px;
    transition: opacity 0.8s ease;
    padding-bottom: 1.5rem;
}

.intro-ascii.fade-out {
    opacity: 0;
}

.intro-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 1.8rem;
    word-break: break-word;
}

.intro-content .prompt {
    color: var(--text-muted);
    margin-right: 6px;
    white-space: nowrap;
}

.cursor {
    color: var(--primary);
    animation: blink 0.8s steps(2, start) infinite;
    margin-left: 2px;
}

.hint {
    font-size: clamp(0.7rem, 2.5vw, 0.85rem);
    color: var(--text-dim);
    margin-top: 15px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.hint.show {
    opacity: 1;
}
.social-links {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.social-icon {
    font-size: 2rem;               /* Controls icon size */
    color: #ff3333;               /* Set your exact custom red hex color here */
    transition: color 0.2s ease, transform 0.2s ease;
}

/* Hover effect */
.social-icon:hover {
    color: #ff6666;               /* Lighter red on hover */
    transform: translateY(-2px);
}
/* ==========================================================================
   9. ANIMATIONS
   ========================================================================== */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

@keyframes terminalPop {
    0% {
        opacity: 0;
        transform: scale(0.96) translateY(10px);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

/* ==========================================================================
   10. RESPONSIVE BREAKPOINTS
   ========================================================================== */
/* Tablet & Medium Screens */
@media (max-width: 850px) {
    body {
        padding: 12px;
    }

    .terminal-layout {
        flex-direction: column;
        align-items: center;
    }

    .card-section.active-card {
        flex-direction: column;
        align-items: center;
        padding: 20px;
    }

    .profile-image {
        width: 160px;
        align-self: center;
        margin-top: 10px;
    }

    .ascii-sidebar {
        width: 100%;
        max-width: 100%;
        padding: 10px 0;
    }

    .ascii-art {
        font-size: 0.22rem;
    }
}
/* Mobile and Small Screen Layout (< 850px) */
@media (max-width: 850px) {
  /* 1. Main Page: Stack sidebar ASCII art on top of main content and CLI */
  .terminal-layout {
    display: flex;
    flex-direction: column;
  }

  .ascii-sidebar {
    order: -1; /* Forces the ASCII sidebar to display above the main content */
    width: 100%;
    margin-bottom: 1.5rem;
    text-align: center;
  }

  /* 2. Intro Overlay: Ensure ASCII art sits directly above prompt line */
  .intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .intro-ascii {
    order: 1;
    margin-bottom: 1rem;
  }

  .intro-line {
    order: 2;
  }

  /* 3. Scale ASCII art down to fit small displays without wrapping or horizontal overflow */
  .ascii-art {
    font-size: 0.25rem;
    line-height: 1.05;
    letter-spacing: 0;
    white-space: pre;
    display: block;
    margin: 0 auto;
  }
}
/* Mobile Devices */
@media (max-width: 520px) {
    nav ul {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        text-align: center;
    }

    .nav-link {
        width: 100%;
        padding: 8px 4px; /* Larger touch target for mobile */
    }

    .card-section {
        padding: 15px;
    }

    .profile-image {
        width: 130px;
    }

    .cli-container {
        padding: 12px;
    }

    .intro-line {
        min-height: 1.4rem;
    }

    /* Hide heavy ascii sidebar on tiny screens to avoid overflow */
    .ascii-sidebar {
        display: none;
    }
}