/* Base theme variables */
:root {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --overlay-color: rgba(255, 255, 255, 0.275);
    --accent-color: #9a2222;
    --secondary-color: rgba(70, 70, 70, 0.8);
    --skill-bg: rgba(130, 30, 30, 0.08);
    --skill-border: rgba(130, 30, 30, 0.3);
    --transition-time: 0.5s;
    --blur-amount: 50px;
    --glitch-color-1: rgba(154, 34, 34, 0.7);
    --glitch-color-2: rgba(100, 20, 20, 0.7);
    --glitch-shadow-1: #9a2222;
    --glitch-shadow-2: #ce3a3a;
    --wrapper-bg: rgba(255, 255, 255, 0.15);
}

/* Dark mode theme */
.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --overlay-color: #151515;
    --accent-color: rgba(140, 30, 30, 0.9);
    --secondary-color: rgba(120, 120, 120, 0.7);
    --skill-bg: rgba(130, 30, 30, 0.15);
    --skill-border: rgba(130, 30, 30, 0.5);
    --wrapper-bg: #121212;
}

/* Base styles */
body, html {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100%;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color var(--transition-time), color var(--transition-time);
}

/* Main layout containers */
.content-wrapper {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 0;
    background-color: var(--wrapper-bg);
    transition: background-color var(--transition-time);
}

.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    background-color: var(--overlay-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    min-height: calc(100vh - 4rem);
    height: auto;
    border-radius: 0.5rem;
    border: none;
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    transition: background-color var(--transition-time), border-color var(--transition-time);
}

/* Screen layout */
.print-page-2 {
    display: grid;
    grid-template-columns: 153px 1fr; /* ~15% narrower left column (reduced from 180px to 153px) */
    grid-gap: 2rem;
}

.dark-mode .container {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Header styling */
header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    transition: border-color var(--transition-time);
    grid-column: 1 / -1;
}

h1 {
    display: block;
    font-size: 3em;
    margin: 0.48em 0;
    font-weight: bold;
    color: var(--accent-color);
    transition: color var(--transition-time);
}

/* Glitch effect for name */
.glitch {
  position: relative;
  margin: 0 auto;
  font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  color: var(--accent-color);
}

.glitch.active-glitch {
  background: var(--bg-color);
  font-family: 'Press Start 2P', cursive;
  font-size: 0.7em;
}

.glitch.active-glitch::before,
.glitch.active-glitch::after {
  animation-iteration-count: infinite;
  animation-timing-function: linear;
  animation-direction: alternate-reverse;
  overflow: hidden;
  position: absolute;
  top: 0;
  clip: rect(0, 900px, 0, 0);
  content: attr(data-text);
  background: var(--bg-color);
  left: 0;
  width: 100%;
}

.glitch.active-glitch::after {
  animation-name: glitch-animation;
  animation-duration: 0.3s;
  left: 4px;
  text-shadow: -1px 0 var(--glitch-shadow-1);
}

.glitch.active-glitch::before {
  animation-name: glitch-animation-2;
  animation-duration: 0.4s;
  left: -4px;
  text-shadow: 1px 0 var(--glitch-shadow-2);
}

/* Glitch animations */
@keyframes glitch-animation {
  0% { clip: rect(42px, 9999px, 44px, 0); }
  5% { clip: rect(12px, 9999px, 59px, 0); }
  10% { clip: rect(48px, 9999px, 29px, 0); }
  15.0% { clip: rect(42px, 9999px, 73px, 0); }
  20% { clip: rect(63px, 9999px, 27px, 0); }
  25% { clip: rect(34px, 9999px, 55px, 0); }
  30.0% { clip: rect(86px, 9999px, 73px, 0); }
  35% { clip: rect(20px, 9999px, 20px, 0); }
  40% { clip: rect(26px, 9999px, 60px, 0); }
  45% { clip: rect(25px, 9999px, 66px, 0); }
  50% { clip: rect(57px, 9999px, 98px, 0); }
  55.0% { clip: rect(5px, 9999px, 46px, 0); }
  60.0% { clip: rect(82px, 9999px, 31px, 0); }
  65% { clip: rect(54px, 9999px, 27px, 0); }
  70% { clip: rect(28px, 9999px, 99px, 0); }
  75% { clip: rect(45px, 9999px, 69px, 0); }
  80% { clip: rect(23px, 9999px, 85px, 0); }
  85.0% { clip: rect(54px, 9999px, 84px, 0); }
  90% { clip: rect(45px, 9999px, 47px, 0); }
  95% { clip: rect(37px, 9999px, 20px, 0); }
  100% { clip: rect(4px, 9999px, 91px, 0); }
}

@keyframes glitch-animation-2 {
  0% { clip: rect(65px, 9999px, 100px, 0); }
  5% { clip: rect(52px, 9999px, 74px, 0); }
  10% { clip: rect(79px, 9999px, 85px, 0); }
  15.0% { clip: rect(75px, 9999px, 5px, 0); }
  20% { clip: rect(67px, 9999px, 61px, 0); }
  25% { clip: rect(14px, 9999px, 79px, 0); }
  30.0% { clip: rect(1px, 9999px, 66px, 0); }
  35% { clip: rect(86px, 9999px, 30px, 0); }
  40% { clip: rect(23px, 9999px, 98px, 0); }
  45% { clip: rect(85px, 9999px, 72px, 0); }
  50% { clip: rect(71px, 9999px, 75px, 0); }
  55.0% { clip: rect(2px, 9999px, 48px, 0); }
  60.0% { clip: rect(30px, 9999px, 16px, 0); }
  65% { clip: rect(59px, 9999px, 50px, 0); }
  70% { clip: rect(41px, 9999px, 62px, 0); }
  75% { clip: rect(2px, 9999px, 82px, 0); }
  80% { clip: rect(47px, 9999px, 73px, 0); }
  85.0% { clip: rect(3px, 9999px, 27px, 0); }
  90% { clip: rect(26px, 9999px, 55px, 0); }
  95% { clip: rect(42px, 9999px, 97px, 0); }
  100% { clip: rect(38px, 9999px, 49px, 0); }
}

/* Section styles */
.section {
    margin-bottom: 2rem;
}

/* Ensure consistent top margins for sections */
.main-content-page-2 .section:first-child h2,
.skills-sidebar .section:first-child h2 {
    margin-top: 0; /* Remove top margin for first headings to align them */
}

/* Experience and education items */
.experience-item, .education-item {
    margin-bottom: 1.5rem;
}

.job-title, .degree {
    font-weight: bold;
    font-size: 1.1rem;
}

.company, .school {
    font-style: italic;
}

.dates {
    color: var(--secondary-color);
    font-size: 0.9rem;
    transition: color var(--transition-time);
}

/* Sidebar styling */
.skills-sidebar {
    grid-column: 1;
    /* Removed border-right */
    padding-right: 1rem;
}

.skills-sidebar .section {
    margin-bottom: 1.5rem;
}

/* No extra padding */

/* Make left sidebar headings same size as main content headings */
.skills-sidebar h2 {
    font-size: 1.5rem; /* Same as main headings */
    margin-top: 2rem; /* Adjusted to match main content section h2 */
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--accent-color);
}

.main-content {
    grid-column: 2;
}

/* List styles */
ul.skills, 
ul.sidebar-list {
    padding-left: 1.5rem;
    list-style-type: disc;
    margin-bottom: 1rem;
}

.no-bullets,
.sidebar-list,
.skills {
    list-style-type: none !important;
    padding-left: 0.3rem !important;
}

ul.skills li,
ul.sidebar-list li {
    margin-bottom: 0.8rem;
    color: var(--text-color);
    font-size: 0.95rem;
}

.skills-sidebar .education-item {
    padding-left: 0.3rem;
    margin-bottom: 0;
}

.skills-sidebar .education-item .degree,
.skills-sidebar .education-item .school,
.skills-sidebar .education-item .dates {
    font-size: 0.95rem;
    line-height: 1.4;
}

ul {
    padding-left: 1.5rem;
    list-style-position: outside;
}

ul.regular-list {
    list-style-position: outside;
    margin-left: 0;
    column-count: 2;
    column-gap: 1.5rem;
}

ul.regular-list li {
    break-inside: avoid;
    margin-bottom: 0.5rem;
}

/* Contact info and links */
.contact-info {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.contact-info p {
    margin: 0.5rem 1rem;
}

.contact-link {
    color: var(--accent-color);
    text-decoration: none;
    transition: color var(--transition-time), opacity 0.3s;
}

.contact-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-time), transform 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.05);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    transition: transform 0.5s ease;
}

.theme-toggle:focus {
    outline: none;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .print-page-2 {
        grid-template-columns: 1fr;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
    }
    
    ul.regular-list {
        column-count: 1;
    }
    
    .skills-sidebar {
        grid-column: 1;
        border-right: none;
        border-bottom: 1px solid var(--skill-border);
        padding-right: 0;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }
    
    .main-content-page-2 {
        grid-column: 1;
    }
}

/* Print styles */
@media print {
    /* Set Light mode color scheme variables for print */
    :root {
        --bg-color: white !important;
        --text-color: black !important;
        --overlay-color: white !important;
        --accent-color: #9a2222 !important;
        --secondary-color: #555 !important;
        --skill-bg: white !important;
        --skill-border: white !important; /* No borders in print */
        --wrapper-bg: white !important;
    }
    
    /* Hide elements not needed for print */
    .theme-toggle, .contact-info {
        display: none !important;
    }
    
    /* Reset styles for printing */
    body, html {
        background-color: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 10pt !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    /* Container adjustments */
    .content-wrapper {
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
        min-height: auto !important;
        overflow: visible !important;
    }
    
    .container {
        background: white !important;
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 1cm !important;
        min-height: auto !important;
        height: auto !important;
        overflow: visible !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        display: block !important;
    }
    
    /* Ensure NO borders in print */
    * {
        border-color: transparent !important;
    }
    
    /* Header print styling */
    header {
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    /* Print layout approach */
    /* Reset container to block for print */
    .container {
        display: block !important;
    }
    
    /* Page break styling */
    .print-page-break {
        display: none; /* Hidden on screen */
    }
    
    @media print {
        .print-page-break {
            display: block !important;
            page-break-after: always !important;
            height: 0 !important;
        }
        
        /* First page content only */
        .print-page-2 {
            display: none !important;
        }
        
        /* Second page - display after page break */
        .print-page-break + .print-page-2 {
            display: grid !important;
            grid-template-columns: 105px 1fr !important; /* Ultra-narrow left column for print - 105px */
            grid-gap: 1cm !important;
            page-break-before: always !important;
        }
        
        /* Structure the second page */
        .print-page-2 .skills-sidebar {
            grid-column: 1 !important;
            display: block !important;
            border-right: none !important; /* Remove red line for print */
            border: none !important; /* Override any borders completely */
        }
        
        /* Remove any borders on last page */
        .print-page-2,
        .skills-sidebar {
            border: none !important;
            border-right: 0 !important;
            border-left: 0 !important;
            border-top: 0 !important;
            border-bottom: 0 !important;
        }
        
        /* Only keep borders on headings */
        h2 {
            border-bottom: 1px solid var(--accent-color) !important;
        }
        
        .print-page-2 .main-content-page-2 {
            grid-column: 2 !important;
        }
    }
    
    /* Align section headings - same size for all headings */
    .skills-sidebar h2,
    .main-content-page-2 h2,
    .first-page-content h2 {
        font-size: 13pt !important; /* Same size for all headings */
        padding-bottom: 5px !important; /* Align underlines */
        border-bottom: 1px solid var(--accent-color) !important;
        margin-bottom: 0.3cm !important;
        color: var(--accent-color) !important;
    }
    
    /* Ensure consistent top margins for first sections in print */
    .print-page-2 .skills-sidebar .section:first-child h2,
    .print-page-2 .main-content-page-2 .section:first-child h2 {
        margin-top: 0 !important; /* Align first headings in print */
    }
    
    /* No special print formatting needed */
    
    .skills-sidebar .section {
        margin-bottom: 0.5cm !important;
    }
    
        /* Special layout for .next-page */
    .next-page {
        page-break-before: always !important;
    }
    
    /* Ensure print-layout-helper is not visible on screen */
    #print-layout-helper {
        display: none;
    }
    
    /* Typography for print */
    h1 {
        font-size: 24pt !important;
    }
    
    h2 {
        font-size: 13pt !important;
        color: black !important;
        page-break-after: avoid !important;
    }
    
    
    .job-title, .degree {
        font-size: 11pt !important;
    }
    
    .dates, .company, .school {
        font-size: 10pt !important;
        color: #444 !important;
    }
    
    /* Remove glitch effects for print */
    .glitch, h2 {
        font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif !important;
        text-shadow: none !important;
        animation: none !important;
    }
    
    .glitch::before, .glitch::after,
    h2::before, h2::after {
        content: none !important;
    }
    
    /* Page break handling */
    .section {
        page-break-inside: avoid !important;
        margin-bottom: 1em !important;
    }
    
    .experience-item, .education-item {
        page-break-inside: avoid !important;
    }
    
    /* Ensure no scrollbars in print */
    * {
        overflow: visible !important;
    }
    
    /* Skills layout for print */
    ul.skills,
    ul.sidebar-list {
        break-inside: auto !important;
        page-break-inside: avoid !important;
        margin-bottom: 0.5cm !important;
    }
    
    .no-bullets {
        list-style-type: none !important;
        padding-left: 0 !important;
    }
    
    ul.skills li,
    ul.sidebar-list li {
        margin-bottom: 0.2cm !important;
        font-size: 9pt !important;
        color: black !important; /* Match the darker color of the right column */
    }
    
    .skills-sidebar .education-item .degree,
    .skills-sidebar .education-item .school,
    .skills-sidebar .education-item .dates {
        font-size: 9pt !important;
        line-height: 1.3 !important;
        margin-bottom: 0.1cm !important;
        color: black !important; /* Match the darker color of the right column */
    }
    
    /* Community involvement list in two columns for print */
    ul.regular-list {
        column-count: 2 !important;
        column-gap: 1.5rem !important;
        margin-bottom: 0 !important; /* Prevent margin from causing an extra page */
    }
    
    ul.regular-list li {
        break-inside: avoid !important;
    }
    
    /* Prevent the last section from causing an extra page */
    .main-content-page-2 section:last-child {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    /* Remove any bottom margins from the last elements */
    .main-content-page-2 section:last-child > *:last-child {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    /* Special styling for the DRBD-Proxy link in print */
    a[href="https://linbit.com/drbd-proxy/"] {
        color: #444 !important; /* Slightly lighter black for this specific link */
        text-decoration: none !important;
    }
    
    /* Force page size to exactly fit content to prevent blank page */
    @page {
        margin: 1cm 0.5cm 0.5cm 0.5cm !important; /* top right bottom left */
        size: auto !important;
    }
}
