/* ATS-friendly, print-optimized CV layout */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --cv-text: #172033;
  --cv-heading: #0f172a;
  --cv-muted: #526071;
  --cv-border: #d8e0e8;
  --cv-bg: #ffffff;
  --cv-accent: #0e7490;
  --cv-accent-strong: #155e75;
  --cv-accent-soft: #ecfeff;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #e5e7eb;
  color: var(--cv-text);
  line-height: 1.35;
  font-size: 10.5pt;
  orphans: 2;
  widows: 2;
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 0.85rem;
  background: #fff;
  color: var(--cv-text);
  text-decoration: none;
  border-radius: 0.35rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.skip-link:focus {
  top: 1rem;
}

:where(a, button):focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.cv-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: #0f172a;
}

.cv-toolbar a,
.cv-print-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid #64748b;
  background: transparent;
  color: #f8fafc;
  text-decoration: none;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.cv-print-btn {
  background: #22d3ee;
  border-color: transparent;
  color: #0b1120;
  font-weight: 600;
}

.cv-toolbar a:hover,
.cv-print-btn:hover {
  filter: brightness(1.08);
}

.cv-page {
  width: min(210mm, 100% - 2rem);
  margin: 1.25rem auto 2rem;
  padding: 14mm 15mm;
  background: var(--cv-bg);
  color: var(--cv-text);
  border-top: 5px solid var(--cv-accent);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}

.cv-header {
  margin-bottom: 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1.5px solid var(--cv-heading);
}

.cv-header-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem 1.25rem;
}

.cv-header h1 {
  margin: 0;
  color: var(--cv-heading);
  font-size: 1.45rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.cv-headline {
  margin: 0.08rem 0 0.22rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--cv-accent-strong);
}

.cv-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--cv-muted);
  font-size: 0.82rem;
}

.cv-contact li:not(:last-child)::after {
  content: "·";
  margin: 0 0.45rem;
  color: var(--cv-muted);
}

.cv-availability {
  margin: 0;
  color: var(--cv-accent-strong);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.cv-contact a {
  color: var(--cv-text);
  text-decoration: none;
}

.cv-contact a:hover {
  text-decoration: underline;
}

.cv-section {
  margin-top: 0.55rem;
}

.cv-section > h2 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.28rem;
  color: var(--cv-accent-strong);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.cv-section > h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--cv-border);
}

.cv-section > p {
  margin: 0;
}

.cv-section--profile {
  margin-top: 0.45rem;
  padding: 0.35rem 0.55rem;
  border-left: 3px solid var(--cv-accent);
  background: var(--cv-accent-soft);
}

.cv-section--profile > h2 {
  margin-bottom: 0.25rem;
}

.cv-section--profile > h2::after {
  display: none;
}

.cv-entry {
  margin-bottom: 0.42rem;
  break-inside: avoid;
  page-break-inside: avoid;
}

.cv-entry--compact {
  margin-bottom: 0.18rem;
}

.cv-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem 1rem;
}

.cv-entry h3 {
  margin: 0;
  color: var(--cv-heading);
  font-size: 0.95rem;
  line-height: 1.25;
}

.cv-dates {
  margin: 0;
  flex-shrink: 0;
  color: var(--cv-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cv-entry > p {
  margin: 0.1rem 0 0;
}

.cv-meta {
  margin: 0.05rem 0 0.2rem;
  color: var(--cv-muted);
  font-size: 0.85rem;
}

.cv-org {
  font-weight: 600;
  color: var(--cv-accent-strong);
}

.cv-entry ul {
  margin: 0.15rem 0 0;
  padding-left: 1.05rem;
}

.cv-entry li {
  margin-bottom: 0.1rem;
  padding-left: 0.08rem;
}

.cv-entry li::marker {
  color: var(--cv-accent);
}

.cv-section--experience .cv-entry {
  padding-left: 0.55rem;
  border-left: 2px solid #dbeafe;
}

.cv-section--projects .cv-entry {
  padding: 0.22rem 0.45rem;
  border-left: 2px solid var(--cv-accent);
  background: #f8fafc;
}

.cv-project-link {
  white-space: nowrap;
  color: var(--cv-accent-strong);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.cv-project-link:hover {
  text-decoration: underline;
}

.cv-skill-row {
  display: grid;
  grid-template-columns: 30mm 1fr;
  gap: 0.35rem;
  margin: 0;
  padding: 0.1rem 0;
  border-bottom: 1px solid #eef2f6;
  break-inside: avoid;
  page-break-inside: avoid;
}

.cv-skill-row:last-child {
  border-bottom: 0;
}

.cv-skill-label {
  color: var(--cv-heading);
  font-weight: 600;
}

@media (max-width: 720px) {
  .cv-page {
    width: calc(100% - 1rem);
    margin: 0.75rem auto 1.5rem;
    padding: 1.25rem 1rem;
  }

  .cv-header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.12rem;
  }

  .cv-header h1 {
    font-size: 1.35rem;
  }

  .cv-availability {
    text-align: left;
    white-space: normal;
  }

  .cv-entry-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.05rem;
  }

  .cv-contact {
    flex-direction: column;
    gap: 0.15rem;
  }

  .cv-contact li:not(:last-child)::after {
    display: none;
  }

  .cv-skill-row {
    display: block;
  }

  .cv-skill-label {
    display: block;
    margin-bottom: 0.08rem;
  }
}

@page {
  size: A4;
  margin: 8mm 11mm;
}

@media print {
  body {
    background: #fff;
    font-size: 9.2pt;
    line-height: 1.25;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print {
    display: none !important;
  }

  .cv-page {
    width: auto;
    margin: 0;
    padding: 0;
    border-top-width: 3px;
    box-shadow: none;
  }

  .cv-header {
    margin-bottom: 0.32rem;
    padding-bottom: 0.22rem;
  }

  .cv-header h1 {
    font-size: 1.32rem;
  }

  .cv-section {
    margin-top: 0.35rem;
    break-inside: auto;
  }

  .cv-section--profile {
    margin-top: 0.32rem;
    padding: 0.25rem 0.45rem;
  }

  .cv-entry {
    margin-bottom: 0.28rem;
  }

  .cv-entry--compact {
    margin-bottom: 0.1rem;
  }

  .cv-entry li {
    margin-bottom: 0.04rem;
  }

  .cv-skill-row {
    padding: 0.05rem 0;
  }

  .cv-header-top,
  .cv-entry-head {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  a {
    text-decoration: none !important;
  }

  .cv-entry,
  .cv-skill-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cv-section > h2 {
    margin-bottom: 0.18rem;
    break-after: avoid;
    page-break-after: avoid;
  }
}
