/* ==========================================================================
   cv.css — Portfolio v2 CV Page Styles
   Loaded ONLY on cv.html. Single green via tokens.
   Harvard-style resume sheet — aligned with v1 cv-harvard.html.
   US Letter size: 8.5in x 11in (Carta).
   ========================================================================== */

/* ---------------------------------------------------------------------------
   CV page body — paper-on-desk effect
   --------------------------------------------------------------------------- */
body {
  background-color: var(--color-bg-alt) !important;
}

/* ---------------------------------------------------------------------------
   CRITICAL: Neutralize global layout.css leaks on CV page
   layout.css sets: section { padding: 4rem/5rem 0 } and
   main { padding-top: 76px }. These destroy CV spacing.
   --------------------------------------------------------------------------- */
body.cv-page main {
  padding-top: 0 !important;
}

body.cv-page .cv-sheet section,
body.cv-page .cv-sheet .cv-section {
  padding: 0 !important;
}

/* ---------------------------------------------------------------------------
   CV navbar — sticky, hidden on print
   --------------------------------------------------------------------------- */
.cv-navbar {
  position: sticky;
  top: 0;
  z-index: 1050;
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 8px 0;
  box-shadow: var(--shadow-sm);
}

.cv-navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 8.5in; /* 816px — US Letter width */
  margin: 0 auto;
  padding: 0 16px;
}

.cv-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 8px 16px;
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-text);
  background-color: transparent;
  border: 1px solid var(--color-primary);
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  min-height: 44px;
  line-height: 1.4;
  transition: background-color var(--transition-fast),
              color var(--transition-fast);
}

.cv-btn:hover {
  background-color: var(--color-primary);
  color: #fff;
}

.cv-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.cv-btn--ghost {
  border-color: transparent;
  color: var(--color-body);
}

.cv-btn--ghost:hover {
  background-color: transparent;
  color: var(--color-primary-text);
  text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   CV preview — desk surface for stacked Letter sheets
   --------------------------------------------------------------------------- */
.cv-preview {
  max-width: 8.5in;
  margin: 12px auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------------------------------------------------------------------------
   CV sheet — US Letter size (8.5in x 11in)
   Each sheet is a separate Letter page in web preview and print.
   Width matches Letter paper. min-height matches Letter height.
   Padding 0.75in gives 1in total margin with @page 0.25in margins.
   --------------------------------------------------------------------------- */
.cv-sheet {
  width: 8.5in;
  max-width: 8.5in;
  padding: 0.75in;
  background-color: #ffffff !important;
  box-shadow: 0 4px 20px rgba(22, 32, 42, 0.10),
              0 1px 4px rgba(22, 32, 42, 0.06);
  min-height: 11in;
}

/* Page 1 top margin — first sheet needs spacing below navbar */
.cv-sheet.cv-page-1 {
  margin-top: 0;
}

/* Page 2 — no extra top margin, gap from .cv-preview handles it */
.cv-sheet.cv-page-2 {
  margin-top: 0;
}

@media (max-width: 900px) {
  .cv-preview {
    max-width: none;
    gap: 16px;
  }

  .cv-sheet {
    width: 100%;
    max-width: none;
    padding: 0.5in;
    box-shadow: 0 4px 16px rgba(22, 32, 42, 0.06);
  }
}

@media (max-width: 600px) {
  .cv-preview {
    gap: 0;
  }

  .cv-sheet {
    padding: 0.4in;
    box-shadow: none;
    min-height: auto;
  }
}

/* ---------------------------------------------------------------------------
   CV header
   --------------------------------------------------------------------------- */
.cv-header {
  margin-bottom: 4pt;
}

.cv-name {
  font-family: var(--font-family);
  font-size: 18pt;
  font-weight: var(--font-weight-bold);
  color: var(--color-heading) !important;
  letter-spacing: -0.01em;
  line-height: 1.4;
  margin: 0 0 4pt 0 !important;
}

@media (max-width: 600px) {
  .cv-name {
    font-size: 22pt;
  }
}

.cv-contact-info {
  font-family: var(--font-family);
  font-size: 10.5pt;
  font-weight: var(--font-weight-medium);
  color: var(--color-heading) !important;
  margin-top: 4pt;
  line-height: 1.6;
}

/* ---------------------------------------------------------------------------
   CV sections
   --------------------------------------------------------------------------- */
.cv-section {
  margin-top: 20pt;
  break-inside: avoid;
  page-break-inside: avoid;
}

.cv-section-title {
  font-family: var(--font-family);
  font-size: 14pt;
  font-weight: var(--font-weight-bold);
  color: var(--color-heading) !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 3pt;
  margin: 0 0 8pt 0 !important;
  break-after: avoid;
  page-break-after: avoid;
}

/* ---------------------------------------------------------------------------
   CV entry
   --------------------------------------------------------------------------- */
.cv-entry {
  margin-bottom: 12pt;
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Entry header wrapper — flex column for role + date alignment */
.cv-entry-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1pt;
  margin-bottom: 1pt;
}

.cv-entry-role {
  font-family: var(--font-family);
  font-size: 12pt;
  font-weight: var(--font-weight-bold);
  color: var(--color-heading) !important;
  margin: 0 !important;
  line-height: 1.4;
}

.cv-entry-date {
  font-family: var(--font-family);
  font-size: 10pt;
  color: var(--color-muted) !important;
  white-space: nowrap;
}

.cv-entry-meta {
  font-family: var(--font-family);
  font-size: 10pt;
  color: var(--color-muted) !important;
  font-style: italic;
  margin: 1pt 0 3pt 0 !important;
}

.cv-bullets {
  font-family: var(--font-family);
  font-size: 10.5pt;
  color: var(--color-heading) !important;
  line-height: 1.5;
  margin: 4pt 0 0;
  padding-left: 16pt;
}

.cv-bullets li {
  margin-bottom: 4pt;
}

.cv-summary {
  font-family: var(--font-family);
  font-size: 10.5pt;
  color: var(--color-heading) !important;
  line-height: 1.5;
  text-align: justify;
}

.cv-keywords {
  font-family: var(--font-family);
  font-size: 10.5pt;
  color: var(--color-heading) !important;
  line-height: 1.6;
  margin: 4pt 0 0;
}

/* Meta block (languages) */
.cv-meta-block-title {
  font-family: var(--font-family);
  font-size: 11pt;
  font-weight: var(--font-weight-semibold);
  color: var(--color-heading) !important;
  margin: 0 0 2pt 0 !important;
}

.cv-meta-block-sub {
  font-family: var(--font-family);
  font-size: 10pt;
  color: var(--color-muted) !important;
  margin: 0 !important;
}

/* Meta block wrapper spacing */
.cv-meta-block {
  margin-bottom: 8pt;
}

/* Links inside CV */
.cv-link {
  color: var(--color-primary-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cv-link:hover {
  color: var(--color-primary);
}

.cv-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Back to portfolio */
.cv-back-section {
  text-align: center;
  padding: 2rem 0 2rem;
}

/* ---------------------------------------------------------------------------
   Print styles — US Letter, two pages, ATS critical
   @page size: letter (8.5in x 11in = Carta).
   Margins 0.25in so content area = 8in x 10.5in.
   Each .cv-sheet prints as its own page via break-after.
   --------------------------------------------------------------------------- */
@media print {
  @page {
    size: letter;
    margin: 0.25in;
  }

  html, body, .cv-sheet, .cv-header, .cv-section, .cv-section-title,
  .cv-entry, .cv-entry-role, .cv-entry-meta, .cv-bullets, .cv-bullets li,
  .cv-contact-info, .cv-keywords, .cv-summary, .cv-meta-block-title,
  .cv-meta-block-sub, h1, h2, h3, h4, p, span, li, strong {
    font-family: Arial, Helvetica, "Liberation Sans", sans-serif !important;
  }

  body {
    background: #ffffff !important;
    margin: 0;
    padding: 0;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide all non-content elements */
  .cv-navbar,
  .cv-back-section,
  footer,
  .skip-link,
  .cv-actions {
    display: none !important;
  }

  /* Preview wrapper — no layout interference */
  .cv-preview {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    display: block !important;
  }

  /* Each sheet fills one printed page — no shadow, no margin */
  .cv-sheet {
    width: 100% !important;
    max-width: none !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
  }

  /* Break after every sheet except the last one */
  .cv-sheet.cv-page-1 {
    break-after: page;
    page-break-after: always;
  }

  /* Neutralize global section padding from layout.css */
  .cv-sheet section,
  .cv-sheet .cv-section {
    padding: 0 !important;
  }

  /* Print font sizes */
  .cv-name {
    font-size: 24pt !important;
  }

  .cv-section-title {
    font-size: 13.5pt !important;
  }

  .cv-bullets li,
  .cv-summary {
    font-size: 10pt !important;
  }

  /* Prevent orphaned entries */
  .cv-entry {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cv-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }

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

/* ---------------------------------------------------------------------------
   prefers-reduced-motion
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .cv-btn {
    transition: none;
  }
}
