/* Import Google Fonts directly to ensure print engine has access to the typography files */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Montserrat:wght@700;800;900&display=swap');

/* Language Visibility Rules (Applied to both preview and print) */
body.lang-en-active .lang-vi {
  display: none !important;
}
body:not(.lang-en-active) .lang-en {
  display: none !important;
}

/* CV Print and Preview Styling */

/* In-browser preview styling for the CV sheet (Active on Screen only) */
@media screen {
  .cv-preview-shell {
    background: #0f172a;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--border-color);
  }

  .cv-document {
    background: #ffffff;
    color: #0f172a;
    width: 100%;
    max-width: 800px;
    min-height: 1050px; /* A4 Ratio Approximate for screen preview */
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    font-family: 'Inter', 'Segoe UI', 'Arial', 'Helvetica', sans-serif;
    line-height: 1.5;
    font-size: 13px;
    box-sizing: border-box;
  }

  /* Header layout of the CV */
  .cv-header {
    border-bottom: 2px solid #0f172a;
    padding-bottom: 16px;
    margin-bottom: 20px;
  }

  .cv-name {
    font-family: 'Montserrat', 'Arial', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0f172a;
    line-height: 1.1;
    text-transform: uppercase;
  }

  .cv-title {
    font-family: 'Montserrat', 'Arial', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #c49a2a; /* Gold accent */
    text-transform: uppercase;
    margin-top: 4px;
  }

  .cv-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 12px;
    font-size: 0.8rem;
    color: #475569;
  }

  .cv-contact span {
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .cv-contact a {
    color: #475569;
    text-decoration: none;
  }

  .cv-contact a:hover {
    text-decoration: underline;
    color: #0f172a;
  }

  /* CV Layout structure */
  .cv-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
  }

  @media (min-width: 600px) {
    .cv-body {
      grid-template-columns: 1.7fr 1.3fr;
      gap: 30px;
    }
  }

  .cv-section {
    margin-bottom: 18px;
  }

  .cv-section-title {
    font-family: 'Montserrat', 'Arial', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0f172a;
    border-bottom: 1.5px solid #0f172a;
    padding-bottom: 4px;
    margin-bottom: 10px;
  }

  /* Timeline entries inside CV */
  .cv-item {
    margin-bottom: 12px;
  }

  .cv-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-weight: 700;
    font-size: 0.9rem;
    color: #0f172a;
  }

  .cv-item-title {
    font-weight: 700;
  }

  .cv-item-date {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
  }

  .cv-item-company {
    font-size: 0.8rem;
    color: #0284c7; /* Sky blue highlights */
    font-weight: 600;
    margin-bottom: 3px;
  }

  .cv-item-desc {
    font-size: 0.8rem;
    color: #334155;
  }

  .cv-item-bullet-list {
    list-style: none;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .cv-item-bullet-list li {
    font-size: 0.8rem;
    color: #334155;
    position: relative;
    padding-left: 10px;
  }

  .cv-item-bullet-list li::before {
    content: '•';
    color: #c49a2a;
    position: absolute;
    left: 0;
    font-weight: bold;
  }

  /* Skills list */
  .cv-skill-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .cv-skill-category {
    font-size: 0.8rem;
  }

  .cv-skill-category strong {
    color: #0f172a;
    display: block;
    margin-bottom: 2px;
  }

  .cv-skill-category span {
    color: #475569;
  }

  /* Languages and certifications */
  .cv-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .cv-list-item {
    font-size: 0.8rem;
    color: #334155;
  }

  .cv-list-item strong {
    color: #0f172a;
  }
}

/* Printable PDF specific styles (Active on Print only) - COMPACT SINGLE-PAGE A4 FORMAT */
@media print {
  /* Reset page margins for A4 printing */
  @page {
    size: A4 portrait;
    margin: 12mm 15mm 12mm 15mm;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: 'Inter', 'Segoe UI', 'Arial', 'Helvetica', sans-serif !important;
    font-size: 11px !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Explicitly hide other sections by name to bypass general selectors issues */
  .site-header,
  .mobile-nav,
  .hero-section,
  #about,
  #ventures,
  #experience,
  #contact,
  .site-footer,
  .cv-preview-section .section-header,
  .cv-preview-section .reveal:not(.cv-preview-shell),
  .cv-preview-section button {
    display: none !important;
  }

  /* Display ONLY the CV Preview section and its wrappers */
  main,
  .cv-preview-section {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
  }
  
  .cv-preview-shell {
    display: block !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    opacity: 1 !important;
    transform: none !important;
  }
  
  .cv-document {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    color: #000000 !important;
    background: #ffffff !important;
    min-height: auto !important;
    opacity: 1 !important;
    transform: none !important;
    box-sizing: border-box !important;
  }

  .cv-document * {
    visibility: visible !important;
  }

  /* Header Layout */
  .cv-header {
    border-bottom: 2px solid #000000 !important;
    padding-bottom: 8px !important;
    margin-bottom: 12px !important;
  }

  .cv-name {
    color: #000000 !important;
    font-family: 'Montserrat', 'Arial', sans-serif !important;
    font-size: 1.6rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    line-height: 1.1 !important;
  }
  
  .cv-title {
    color: #b58a18 !important; /* Gold bronze accent */
    font-family: 'Montserrat', 'Arial', sans-serif !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    margin-top: 2px !important;
  }

  .cv-contact {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    margin-top: 6px !important;
    font-size: 0.72rem !important;
    color: #475569 !important;
  }

  .cv-contact a {
    color: #475569 !important;
    text-decoration: none !important;
  }

  /* Force 2-columns layout in A4 print */
  .cv-body {
    display: grid !important;
    grid-template-columns: 1.7fr 1.3fr !important;
    gap: 20px !important;
  }

  .cv-section {
    margin-bottom: 10px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .cv-section-title {
    font-family: 'Montserrat', 'Arial', sans-serif !important;
    font-size: 0.8rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    border-bottom: 1.5px solid #000000 !important;
    color: #000000 !important;
    padding-bottom: 2px !important;
    margin-bottom: 6px !important;
  }

  /* Items */
  .cv-item {
    margin-bottom: 6px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .cv-item-header {
    display: flex !important;
    justify-content: space-between !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
  }

  .cv-item-company {
    font-size: 0.72rem !important;
    color: #0284c7 !important;
    font-weight: 600 !important;
    margin-bottom: 1px !important;
  }

  .cv-item-desc {
    font-size: 0.72rem !important;
    color: #334155 !important;
  }

  .cv-item-bullet-list {
    margin-top: 2px !important;
    gap: 1px !important;
  }

  .cv-item-bullet-list li {
    font-size: 0.72rem !important;
    color: #334155 !important;
    position: relative !important;
    padding-left: 8px !important;
  }

  .cv-item-bullet-list li::before {
    content: '•' !important;
    color: #b58a18 !important;
    position: absolute !important;
    left: 0 !important;
  }

  /* Skills & Lists */
  .cv-skill-grid {
    gap: 5px !important;
  }

  .cv-skill-category {
    font-size: 0.72rem !important;
  }

  .cv-skill-category strong {
    color: #000000 !important;
  }

  .cv-list-item {
    font-size: 0.72rem !important;
    color: #334155 !important;
  }

  .cv-list-item strong {
    color: #000000 !important;
  }
}
