/* Prevent Flash of Unstyled Content (FOUC) */
body {
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

body.loaded {
  visibility: visible;
  opacity: 1;
}

/* Fallback: show page after 1 second even if JS doesn't load */
body:not(.loaded) {
  animation: showPage 0.1s ease-in-out 1s forwards;
}

@keyframes showPage {
  to {
    visibility: visible;
    opacity: 1;
  }
}

/* Terminal-style color scheme */
:root { --bg:#000; --fg:#0f0; --fg-soft:#6f6; --accent:#060; }
html,body { margin:0; height:100%; font-family:'Fira Mono',monospace; color:var(--fg); background:var(--bg); overflow-x:hidden; }
.container { 
  width: min(95vw, 900px); 
  margin:0 auto; 
  padding:clamp(8px, 2vw, 16px); 
  white-space:pre-line; 
  line-height:1.2; 
  position: relative;
  z-index: 1;
}
#resume-content {
  min-height: 60vh;
  position: relative;
  top: 0;
  left: 0;
  right: 0;
}
.content-area {
  position: fixed;
  top: 330px; /* Increased to ensure no overlap with navigation */
  left: 50%;
  transform: translateX(-50%);
  width: min(95vw, 900px);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 1; /* Ensure content is below navigation */
}
.content-area .section {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
}
.content-area .content-text,
.content-area .skills-grid,
.content-area .projects-list,
.content-area .github-box {
  position: absolute;
  top: 30px; /* Space for section header */
  left: 0;
  right: 0;
  width: 100%;
  margin-left: 8px; /* Add space for green bar */
  width: calc(100% - 16px); /* Account for margin and padding */
}
.title { font-size:1.6rem; font-weight:700; margin-bottom:2px; }
.divider { color:var(--accent); font-size:0.8rem; margin:2px 0; }
a { color:var(--fg); text-decoration:none; }
a:hover { background:var(--fg); color:var(--bg); }
.section { font-weight:700; color:var(--fg-soft); margin-top:8px; }
.content-text { max-width:min(70ch, 100%); line-height:1.3; margin:4px 0; }
.skills-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(320px, 1fr)); gap:4px; margin:4px 0; }
.skill-category { margin:2px 0; }
.projects-list { margin:4px 0; }
.project-item { margin:2px 0; padding-left:4px; }
code { background:#010; padding:0 4px; border-radius:3px; }
/* Navigation */
.nav {
  z-index: 2; /* Ensure navigation is above content */
  margin:2px 0; 
  display:flex !important; 
  flex-wrap:wrap; 
  gap:4px; 
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure navigation is always visible in normal display */
@media screen {
  .nav {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}
.nav a { padding:2px 8px; border:1px solid var(--fg); background:#010; font-size:0.8rem; color:var(--fg); cursor:pointer; }
.nav a:hover { background:var(--fg); color:var(--bg); }
.nav a.active { background:var(--fg); color:var(--bg); border-color:var(--fg); }
.divider-nav { color:var(--accent); font-size:0.8rem; margin:2px 0; }
/* GitHub integration */
.github-box { 
  margin:4px 0; 
  border-left:2px solid var(--accent);
  padding-left:12px;
}

/* Content area styling */
.content-text, 
.skills-grid, 
.projects-list {
  position: relative;
  padding-left: 12px;
  border-left: 2px solid var(--accent);
}

/* Typing animation cursor effect */
.typing-active::after {
  content: '|';
  animation: blink 1s infinite;
  color: var(--accent);
}

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

/* Smooth transition for typing animation */
.content-text {
  transition: opacity 0.2s ease-in-out;
}

/* Hide scrollbars */
.content-area::-webkit-scrollbar {
  display: none;
}

.content-area {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.github-box img { max-width:100%; margin:2px 0; }
#commitFeed { 
  max-height:200px; 
  overflow-y:auto; 
  overflow-x:hidden;
  margin-top:4px; 
  background:#262626; 
  padding:8px; 
  border-radius:4px;
  white-space: normal;
  word-wrap: break-word;
}
#commitFeed li { 
  margin:1px 0; 
  font-size:0.9rem; 
  white-space: normal;
  word-wrap: break-word;
}
.github-stats { display:flex; gap:4px; flex-wrap:wrap; margin:4px 0; }
.github-stat { font-size:0.9rem; }
@media (max-width:768px) { 
  body { font-size:14px; } 
  .container { width: 98vw; padding:8px; }
  .title { font-size:1.3rem; margin-bottom:4px; }
  .nav { 
    gap: 3px; 
    justify-content: center;
    flex-wrap: wrap;
    padding: 6px 0;
  }
  .nav a { 
    padding: 6px 10px; 
    font-size: 0.75rem;
    border-radius: 4px;
    transition: all 0.2s ease;
  }
  .nav a:hover {
    transform: translateY(-1px);
  }
  .skills-grid { grid-template-columns:1fr; gap:2px; }
  .content-text { max-width:100%; font-size:0.9rem; }
  .content-area {
    top: 280px;
    max-height: 65vh;
    width: 98vw;
  }
  .github-box { padding-left:4px; }
  #commitFeed { 
    max-height:120px; 
    padding:6px; 
    font-size:0.8rem;
  }
  .github-stats { gap:2px; }
  .github-stat { font-size:0.8rem; }
  .project-item { padding-left:2px; font-size:0.9rem; }
}

@media (max-width:480px) {
  body { font-size:13px; }
  .container { width: 100vw; padding:4px; }
  .title { font-size:1.1rem; text-align:center; }
  
  /* Mobile Navigation - Horizontal scrollable tabs */
  .nav { 
    display: flex;
    flex-direction: row;
    gap: 2px;
    align-items: center;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 4px;
    margin: 4px 0;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav a { 
    padding: 8px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: 6px;
    border: 1px solid var(--accent);
    background: #010;
    min-width: fit-content;
    text-align: center;
    transition: all 0.2s ease;
  }
  .nav a:hover {
    background: var(--fg-soft);
    color: var(--bg);
    transform: translateY(-1px);
  }
  .nav a.active {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
    box-shadow: 0 2px 4px rgba(0, 255, 0, 0.2);
  }
  .content-area {
    top: 400px;
    max-height: 55vh;
    width: 100vw;
    padding: 0 4px;
  }
  .content-text { font-size:0.85rem; line-height:1.4; }
  .skills-grid { margin:2px 0; }
  .skill-category { font-size:0.85rem; }
  .github-box { 
    border-left:1px solid var(--accent);
    padding-left:2px; 
  }
  #commitFeed { 
    max-height:100px; 
    padding:4px; 
    font-size:0.75rem;
  }
  #commitFeed li { font-size:0.75rem; }
  .github-stats { 
    flex-direction:column; 
    gap:1px; 
  }
  .github-stat { font-size:0.75rem; }
  .project-item { font-size:0.85rem; }
  .divider, .divider-nav { font-size:0.7rem; }
  
  /* Hide footer on mobile */
  div[style*="position: fixed"][style*="bottom: 10px"] {
    display: none;
  }
} 

@media print {
  /* Print page setup */
  @page {
    size: letter;
    margin: 0.75in;
  }
  
  /* Remove backgrounds for print */
  * {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
  }
  
  /* Hide everything except print-only content */
  body > *:not(.print-only) {
    display: none !important;
  }
  
  body {
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Show and style print-only content */
  .print-only {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt !important;
    font-family: 'Times New Roman', serif !important;
    line-height: 1.3 !important;
    overflow: visible !important;
    page-break-inside: auto !important;
  }
  
  .print-only * {
    position: static !important;
    float: none !important;
    max-height: none !important;
    overflow: visible !important;
  }
  
  .print-only a { 
    color: #000 !important; 
    text-decoration: none !important; 
  }
  
  /* Header styling */
  .print-only .title {
    font-size: 16pt !important;
    font-weight: bold !important;
    margin-bottom: 6pt !important;
    text-align: center !important;
    page-break-after: avoid !important;
  }
  
  /* Section headers */
  .print-section-header {
    font-weight: bold !important;
    font-size: 13pt !important;
    margin-top: 18pt !important;
    margin-bottom: 8pt !important;
    page-break-after: avoid !important;
    page-break-before: auto !important;
    text-decoration: underline !important;
    text-transform: uppercase !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  /* Ensure first section doesn't have top margin */
  .print-section-header:first-of-type {
    margin-top: 12pt !important;
  }
  
  /* Allow long sections to break across pages */
  .print-content.content-text {
    page-break-inside: auto !important;
  }
  
  /* Cover letter can break across pages if needed */
  .print-content.content-text:first-of-type {
    page-break-inside: auto !important;
  }
  
  /* Content styling */
  .print-content {
    display: block !important;
    margin-bottom: 12pt !important;
    line-height: 1.4 !important;
    orphans: 2 !important;
    widows: 2 !important;
    visibility: visible !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    page-break-inside: auto !important;
  }
  
  /* All content elements should be visible */
  .print-content * {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  
  /* Skills grid as simple list */
  .print-content.skills-grid,
  .print-content .skills-grid { 
    display: block !important;
    margin-bottom: 12pt !important;
  }
  
  .print-content .skill-category { 
    margin-bottom: 4pt !important; 
    display: block !important;
    line-height: 1.3 !important;
  }
  
  /* Projects list */
  .print-content.projects-list,
  .print-content .projects-list {
    display: block !important;
    margin-bottom: 12pt !important;
  }
  
  .print-content .project-item { 
    margin-bottom: 3pt !important; 
    display: block !important;
    line-height: 1.3 !important;
  }
  
  /* Content text sections */
  .print-content.content-text,
  .print-content .content-text {
    display: block !important;
    margin-bottom: 12pt !important;
    line-height: 1.4 !important;
  }
  
  /* GitHub section */
  .print-content.github-box { 
    border: none !important; 
    padding: 0 !important;
    margin-bottom: 12pt !important;
  }
  
  .print-content #commitFeed { 
    max-height: none !important; 
    overflow: visible !important;
    background: #f9f9f9 !important;
    border: 1pt solid #ccc !important;
    padding: 6pt !important;
    font-size: 9pt !important;
    margin-top: 6pt !important;
  }
  
  .print-content #commitFeed ul {
    margin: 0 !important;
    padding-left: 12pt !important;
    list-style-type: disc !important;
  }
  
  .print-content #commitFeed li {
    margin-bottom: 2pt !important;
    font-size: 9pt !important;
    line-height: 1.2 !important;
  }
  
  /* Hide images and interactive elements */
  .print-content .github-box img,
  .print-only .nav,
  .print-only #printBtn,
  .print-only .divider,
  .print-only .divider-nav {
    display: none !important;
  }
  
  /* GitHub stats */
  .print-content .github-stats {
    display: none !important;
  }
} 

/* 3D background canvas */
#bg3d {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Idle Popup ---------- */
.idle-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease-out;
  z-index: 9999;
}

.idle-popup-overlay.active {
  visibility: visible;
  opacity: 1;
}

.idle-popup {
  background: #010;
  border: 2px solid var(--accent);
  padding: 24px;
  max-width: 90vw;
  width: 360px;
  text-align: center;
  box-shadow: 0 0 12px var(--accent);
  animation: popup-show 0.3s ease-out forwards;
}

@keyframes popup-show {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.idle-popup h2 {
  margin-top: 0;
  color: var(--fg-soft);
}

.idle-popup button {
  margin-top: 16px;
  padding: 8px 16px;
  background: var(--fg);
  color: var(--bg);
  border: none;
  cursor: pointer;
  font-weight: bold;
}

.idle-popup button:hover {
  background: var(--fg-soft);
}