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

@layer base {
  html {
    scrollbar-gutter: stable;
  }

  a {
    transition: color 0.15s ease;
  }
}

@layer components {
  .code-block-wrapper.is-collapsed {
    max-height: 28rem;
    overflow: hidden;
  }

  .code-block-wrapper.is-collapsed::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6rem;
    background: linear-gradient(to bottom, transparent, #ffffff);
    pointer-events: none;
    border-radius: 0 0 0.5rem 0.5rem;
  }

  .code-expand-btn {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
  }

  .cv-page {
    color: #27272a;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  .cv-page a {
    color: #0f4f57;
    text-decoration: underline;
    text-underline-offset: 0.15em;
  }

  .cv-header {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid #d4d4d8;
  }

  .cv-header h1 {
    font-size: 1.85rem;
    line-height: 1;
    font-weight: 750;
    letter-spacing: 0;
  }

  .cv-role {
    margin-top: 0.3rem;
    color: #52525b;
    font-size: 1rem;
  }

  .cv-contact {
    list-style: none;
    padding: 0;
    margin: 0;
    color: #52525b;
    font-size: 0.85rem;
    line-height: 1.35;
    text-align: right;
  }

  .cv-contact li {
    white-space: nowrap;
  }

  .cv-contact a {
    font-weight: 500;
  }

  .cv-section {
    padding-top: 0.85rem;
  }

  .cv-section h2 {
    margin-bottom: 0.5rem;
    color: #18181b;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
  }

  .cv-subsection-heading {
    margin-top: 0.85rem;
  }

  .cv-summary p,
  .cv-skills p,
  .cv-item p,
  .cv-item li,
  .cv-compact-list li {
    line-height: 1.42;
  }

  .cv-training {
    margin-top: 0.35rem;
  }

  .cv-item + .cv-item {
    margin-top: 0.78rem;
  }

  .cv-item-heading {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.28rem;
  }

  .cv-item-heading h3 {
    color: #18181b;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.12;
  }

  .cv-item-heading p,
  .cv-date {
    color: #71717a;
    font-size: 0.78rem;
  }

  .cv-date {
    white-space: nowrap;
  }

  .cv-item ul,
  .cv-compact-list {
    list-style: none;
    padding-left: 0;
  }

  .cv-item li,
  .cv-compact-list li {
    position: relative;
    padding-left: 1rem;
  }

  .cv-item li + li,
  .cv-compact-list li + li {
    margin-top: 0.08rem;
  }

  .cv-item li::before,
  .cv-compact-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #52525b;
  }

  .cv-grid-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
  }

  .cv-footer {
    margin-top: 1.75rem;
    padding-top: 1rem;
    border-top: 1px solid #e4e4e7;
  }

  @media (max-width: 640px) {
    .cv-header,
    .cv-item-heading {
      display: grid;
    }

    .cv-contact {
      text-align: left;
    }

    .cv-contact li {
      white-space: normal;
    }

    .cv-grid-section {
      grid-template-columns: 1fr;
      gap: 1rem;
    }
  }

  @media print {
    @page {
      size: A4;
      margin: 10mm;
    }

    body {
      color: #18181b;
      font-size: 10pt;
    }

    body > div,
    body > header,
    .no-print {
      display: none !important;
    }

    main {
      max-width: none !important;
      padding: 0 !important;
    }

    .cv-page a {
      color: #0f4f57;
      text-decoration: underline;
      text-underline-offset: 0.15em;
    }

    .cv-header {
      padding-bottom: 0.55rem;
    }

    .cv-section {
      padding-top: 0.58rem;
    }

    .cv-item,
    .cv-section h2 {
      break-inside: avoid;
    }

    .cv-subsection-heading {
      break-before: page;
      margin-top: 0;
    }
  }
}
