@page {
  size: A4;
  margin: 12mm;
}

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

  html,
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 10.5pt;
    line-height: 1.4;
    margin: 0 !important;
    padding: 0 !important;
  }

  dialog,
  script,
  .site-header,
  .top-nav,
  .language-switcher,
  .print-btn,
  .lightbox,
  .lightbox * {
    display: none !important;
  }

  .page-shell,
  .layout,
  .sidebar,
  .content {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  .layout {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }

  .sidebar,
  .content {
    display: contents !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #d0d0d0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .section-card,
  .hero {
    margin-bottom: 8mm !important;
  }

  .hero {
    order: 1;
    display: block !important;
  }

  .contact-card {
    order: 2;
  }

  .social-card {
    order: 3;
  }

  #experience {
    order: 4;
  }

  #education {
    order: 5;
  }

  .expertise-wrapper {
    order: 6;
  }

  .intro-card {
    order: 7;
  }

  .traits-card {
    order: 8;
  }

  .hobbies-card {
    order: 9;
  }

  #gallery {
    order: 10;
  }

  .hero-photo {
    width: 38mm !important;
    height: 48mm !important;
    object-fit: cover;
    float: right;
    margin: 0 0 5mm 8mm !important;
    border: 0 !important;
  }

  .hero-copy,
  .hero-actions {
    padding: 0 !important;
  }

  .hero-actions {
    display: none !important;
  }

  a {
    color: #000000 !important;
    text-decoration: underline;
  }

  .button,
  .inline-links a {
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
  }

  .tone-4 {
    background: var(--tone-4-bg) !important;
    color: var(--tone-4-text) !important;
  }

  .tone-3 {
    background: var(--tone-3-bg) !important;
    color: var(--tone-3-text) !important;
  }

  .tone-2 {
    background: var(--tone-2-bg) !important;
    color: var(--tone-2-text) !important;
  }

  .tone-1 {
    background: var(--tone-1-bg) !important;
    color: var(--tone-1-text) !important;
  }

  .skill-tag,
  .chip,
  .legend-item,
  .tool-card {
    border-color: transparent !important;
  }

  .expertise-wrapper {
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  .expertise-intro {
    break-after: avoid !important;
    page-break-after: avoid !important;
    margin-bottom: 4mm !important;
    padding: 4mm !important;
  }

  .expertise-intro .lead {
    margin-bottom: 2mm !important;
  }

  .skill-legend {
    margin-top: 2mm !important;
    gap: 2mm !important;
  }

  .legend-item {
    min-height: auto !important;
    padding: 1.5mm 3mm !important;
    font-size: 9pt !important;
  }

  .domain-columns {
    display: block !important;
    break-before: avoid !important;
    page-break-before: avoid !important;
  }

  #it-skills {
    break-before: avoid !important;
    page-break-before: avoid !important;
  }

  .domain-card {
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  #gallery {
    display: block !important;
    break-before: auto !important;
    page-break-before: auto !important;
    break-after: auto !important;
    page-break-after: auto !important;
    break-inside: auto !important;
    page-break-inside: auto !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  #gallery.card,
  #gallery.section-card {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  #gallery .section-heading {
    display: block !important;
  }

  .gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 5mm;
    break-inside: auto !important;
    page-break-inside: auto !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  .gallery-item {
    display: block !important;
    border: 1px solid #cccccc !important;
    padding: 0 !important;
    background: #ffffff !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .gallery-item img {
    width: 100% !important;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block !important;
  }

  .hobbies-card,
  #gallery,
  .page-shell,
  .layout,
  .content,
  .sidebar {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
}

@media print {
  html,
  body,
  .page-shell,
  .layout,
  .content,
  .sidebar {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .page-shell {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body {
    margin: 0 !important;
  }

  #gallery {
    break-after: avoid !important;
    page-break-after: avoid !important;
  }

  #gallery::after,
  .layout::after,
  .page-shell::after,
  body::after {
    display: none !important;
    content: none !important;
  }
}