@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Newsreader:ital,opsz,wght@0,6..72,200..800;1,6..72,200..800&family=JetBrains+Mono:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --bg-primary: #F4F4F2;
  --bg-secondary: #EBEBE9;
  --text-primary: #1A1A1A;
  --text-secondary: #4A4A4A;
  --text-muted: #8E8E8E;
  --accent: #1A1A1A;
  --accent-subtle: rgba(26, 26, 26, 0.05);
  --border: rgba(0, 0, 0, 0.1);
  --grid-color: rgba(0, 0, 0, 0.03);
  --accent-it: #00FF94;
}

[data-theme="dark"] {
  --bg-primary: #0D0D0D;
  --bg-secondary: #141414;
  --text-primary: #EAEAEA;
  --text-secondary: #A0A0A0;
  --text-muted: #606060;
  --accent: #EAEAEA;
  --accent-subtle: rgba(234, 234, 234, 0.05);
  --border: rgba(255, 255, 255, 0.1);
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1), color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.06;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.font-creative-sans {
  font-family: 'Inter', sans-serif;
}

.font-creative-serif {
  font-family: 'Newsreader', serif;
}

.font-it-mono {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
}

/* Legacy mappings to prevent breakage during transition */
.font-display { @apply font-creative-sans; }
.font-serif { @apply font-creative-serif; }
.font-mono { @apply font-it-mono; }
.font-body { @apply font-it-mono; }

/* Grid background pattern */
.bg-grid-pattern {
  background-image: linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

.bg-dotted-pattern {
  background-image: radial-gradient(rgba(0,0,0,0.1) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Screen: hide print-only version */
.print-only-version {
  display: none !important;
}

/* Screen: show preview when toggled */
.print-portfolio.show-preview {
  display: block !important;
  background: #1e293b;
  padding: 20px;
}

.print-portfolio.show-preview .pdf-content {
  display: block !important;
}

.print-portfolio.show-preview .page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: block !important;
  background: #ffffff !important;
}

/* Screen: ensure inner pdf-content div is visible in preview */
.pdf-content {
  display: block !important;
}

/* Print: hide everything except print version */
@media print {
  @page {
    size: A4;
    margin: 0;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    color: black !important;
  }

  .app-main {
    display: none !important;
  }

  .fixed.inset-0 {
    display: none !important;
  }

  .print-only-version {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    background: white !important;
  }

  .pdf-content {
    display: block !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 210mm !important;
  }

  .pdf-content .page {
    width: 210mm !important;
    height: 297mm !important;
    page-break-after: always !important;
    break-after: page !important;
    position: relative !important;
    overflow: hidden !important;
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
  }

  .pdf-content .page:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  .pdf-content .page-content {
    padding: 18mm 16mm !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .pdf-content .cover-page {
    background: #111827 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .pdf-content .cover-content {
    text-align: center !important;
    color: #ffffff !important;
    padding: 35mm 30mm !important;
  }

  .pdf-content .cover-name {
    font-size: 38pt !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    margin: 0 !important;
    color: #ffffff !important;
  }

  .pdf-content .cover-accent {
    font-size: 38pt !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    margin: 0 !important;
    color: #60a5fa !important;
  }

  .pdf-content .cover-divider {
    width: 60px !important;
    height: 3px !important;
    background: #60a5fa !important;
    margin: 0 auto 35px auto !important;
  }

  .pdf-content .cover-title {
    font-size: 16pt !important;
    font-weight: 500 !important;
    color: #9ca3af !important;
    margin: 0 0 35px 0 !important;
    letter-spacing: 0.15em !important;
    text-transform: uppercase !important;
  }

  .pdf-content .cover-contact {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 6px 18px !important;
    font-size: 9pt !important;
    color: #9ca3af !important;
  }

  .pdf-content .cover-contact span {
    white-space: nowrap !important;
  }

  .pdf-content .section {
    margin-bottom: 7mm !important;
  }

  .pdf-content .section-title {
    font-size: 15pt !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin: 0 0 5mm 0 !important;
    padding-bottom: 2.5mm !important;
    border-bottom: 2px solid #1e40af !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
  }

  .pdf-content .summary-section {
    background: #f9fafb !important;
    padding: 5mm !important;
    border-left: 3px solid #1e40af !important;
  }

  .pdf-content .summary-text {
    font-size: 9.5pt !important;
    line-height: 1.7 !important;
    color: #374151 !important;
    margin: 0 !important;
  }

  .pdf-content .experience-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 4mm !important;
  }

  .pdf-content .experience-item {
    padding-bottom: 4mm !important;
    border-bottom: 1px solid #d1d5db !important;
  }

  .pdf-content .experience-item:last-child {
    border-bottom: none !important;
  }

  .pdf-content .experience-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    margin-bottom: 2mm !important;
  }

  .pdf-content .experience-role {
    font-size: 11pt !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin: 0 !important;
  }

  .pdf-content .experience-company {
    font-size: 9pt !important;
    color: #1e40af !important;
    margin: 1px 0 0 0 !important;
    font-weight: 600 !important;
  }

  .pdf-content .experience-period {
    font-size: 8pt !important;
    color: #6b7280 !important;
    white-space: nowrap !important;
    background: #f9fafb !important;
    padding: 2px 8px !important;
    border-radius: 3px !important;
    border: 1px solid #d1d5db !important;
  }

  .pdf-content .experience-highlights {
    margin: 2.5mm 0 0 0 !important;
    padding-left: 5mm !important;
  }

  .pdf-content .experience-highlights li {
    font-size: 8.5pt !important;
    line-height: 1.6 !important;
    color: #374151 !important;
    margin-bottom: 1.5mm !important;
  }

  .pdf-content .skills-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 3.5mm !important;
  }

  .pdf-content .skill-category {
    background: #f9fafb !important;
    padding: 3.5mm !important;
    border-left: 3px solid #1e40af !important;
  }

  .pdf-content .skill-category h3 {
    font-size: 9.5pt !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin: 0 0 1.5mm 0 !important;
  }

  .pdf-content .skill-category p {
    font-size: 8pt !important;
    color: #374151 !important;
    margin: 0 !important;
    line-height: 1.5 !important;
  }

  .pdf-content .portfolio-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 4mm !important;
  }

  .pdf-content .portfolio-item {
    display: flex !important;
    gap: 4mm !important;
    background: #ffffff !important;
    border-radius: 2mm !important;
    overflow: hidden !important;
    border: 1px solid #d1d5db !important;
  }

  .pdf-content .portfolio-image {
    width: 50mm !important;
    height: 38mm !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
    display: block !important;
  }

  .pdf-content .portfolio-info {
    padding: 2.5mm 3mm 2.5mm 0 !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }

  .pdf-content .portfolio-category {
    font-size: 7pt !important;
    font-weight: 600 !important;
    color: #1e40af !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    margin-bottom: 1mm !important;
  }

  .pdf-content .portfolio-title {
    font-size: 10.5pt !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin: 0 0 1.5mm 0 !important;
    line-height: 1.3 !important;
  }

  .pdf-content .portfolio-description {
    font-size: 7.5pt !important;
    color: #374151 !important;
    line-height: 1.5 !important;
    margin: 0 !important;
  }

  .pdf-content .contact-page {
    background: #111827 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .pdf-content .contact-content {
    text-align: center !important;
    color: #ffffff !important;
    padding: 35mm 30mm !important;
  }

  .pdf-content .contact-title {
    font-size: 28pt !important;
    font-weight: 800 !important;
    margin: 0 0 5mm 0 !important;
    color: #ffffff !important;
  }

  .pdf-content .contact-divider {
    width: 50px !important;
    height: 3px !important;
    background: #60a5fa !important;
    margin: 0 auto 10mm auto !important;
  }

  .pdf-content .contact-subtitle {
    font-size: 10pt !important;
    color: #9ca3af !important;
    margin: 0 0 10mm 0 !important;
  }

  .pdf-content .contact-details {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 4mm !important;
    text-align: left !important;
  }

  .pdf-content .contact-item {
    background: rgba(255, 255, 255, 0.05) !important;
    padding: 3.5mm !important;
    border-radius: 2mm !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
  }

  .pdf-content .contact-item strong {
    display: block !important;
    font-size: 7pt !important;
    color: #60a5fa !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    margin-bottom: 1.5mm !important;
    font-weight: 600 !important;
  }

  .pdf-content .contact-item span {
    font-size: 9pt !important;
    color: #d1d5db !important;
    word-break: break-all !important;
  }
}

/* Custom scrollbar for terminal */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0A0A0A;
}

::-webkit-scrollbar-thumb {
  background: #00FF94;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #00D9FF;
}

/* Image effects - Grayscale + pixelated to color */
.grayscale-blur {
  filter: grayscale(80%) blur(1px);
  image-rendering: pixelated;
  transition: all 0.5s ease-out;
}

.group:hover .grayscale-blur,
.grayscale-blur:hover {
  filter: grayscale(0%) blur(0);
  image-rendering: auto;
}

/* CRT Screen Effects */
.crt-screen::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1000;
}

.crt-screen::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none;
  z-index: 1001;
}

@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.8; }
  94% { opacity: 1; }
}

.crt-flicker {
  animation: crt-flicker 0.15s infinite;
}

@keyframes crt-scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

.crt-scanline::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0, 255, 148, 0.1);
  animation: crt-scanline 4s linear infinite;
  pointer-events: none;
  z-index: 1002;
}

/* Screensaver animations */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.animate-blink {
  animation: blink 1s step-end infinite;
}

.animate-float {
  animation: float 2s ease-in-out infinite;
}