/* Theme */
:root {
  --primary: #0b69c7;
  --text: #0f172a;
  --muted: #475569;
  --border: #d7e3f3;
  --accent-bg: #f5f9ff;
}

html, body {
  padding: 0;
  margin: 0;
  background: #eef3f8;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.35;
  counter-reset: page;
  font-size: 13px;
}

/* A4 page for screen preview */
.page {
  box-sizing: border-box;
  width: 210mm;
  height: 297mm;
  margin: 10mm auto;
  padding: 12mm 14mm;
  background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  border: 1px solid #e6eef8;
  position: relative;
}
/* Reduce top padding on the very first page */
.page:first-of-type { padding-top: 8mm; }

/* Header */
.header { text-align: center; margin-bottom: 8mm; }
.name { font-size: 24px; letter-spacing: 0.2px; margin: 0 0 6px; }
.role { color: var(--primary); font-weight: 600; margin-bottom: 4px; }
.contacts { color: var(--muted); font-size: 11px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; align-items: center; }
.contacts a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--border); }
.contacts a:hover { color: var(--primary); border-color: var(--primary); }
/* contact icons */
.contacts .ci { display: inline-flex; align-items: center; gap: 4px; }
/* default icon style */
.contacts .ci svg,
.contacts .icon { width: 13px; height: 13px; color: var(--primary); stroke: currentColor; stroke-width: 2; fill: none; }
.contacts .ci a { border-bottom: 1px dotted var(--border); }
/* filled brand icon variant */
.contacts .icon.brand { fill: currentColor; stroke: none; }
/* small inline icon */
.contacts .icon { width: 12px; height: 12px; stroke: var(--muted); stroke-width: 2; fill: none; vertical-align: -2px; margin-left: 4px; }

/* Sections */
.section { margin-top: 5mm; }
.section h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 6px;
  margin: 0 0 3mm;
  color: var(--primary);
  border: 1px solid var(--border);
  background: var(--accent-bg);
}

.summary p { margin: 0; color: var(--text); }

/* Skills compact list */
.skills { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; margin: 3px 0 0; padding: 0; list-style: none; font-size: 11px; }
.skills li { margin: 0; }
.skills b { font-weight: 600; }
.skills li.full { grid-column: 1 / -1; }

.subhead { margin: 6px 0 4px; font-weight: 700; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px; }

/* Items */
.item { margin-bottom: 3mm; }
.item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.item-head h3 { margin: 0 0 2px; font-size: 13px; }
.item-head .meta { color: var(--muted); font-size: 11px; }
.item-head .date { color: var(--muted); font-size: 11px; white-space: nowrap; }
.two-line { align-items: start; flex-direction: column; }
.light { color: var(--muted); font-weight: 500; }
.item p { margin: 5px 0 0; }
.tech { margin-top: 2px; color: var(--muted); font-size: 11px; }
.item { page-break-inside: avoid; }

/* Compact mode can be applied to individual pages */
.page.compact .optional { display: none; }
/* Keep per-role Tech lines visible, but compact */
.page.compact .tech { font-size: 10.5px; opacity: 0.95; }
.page.compact .skills { gap: 2px 10px; }
.page.compact .section { margin-top: 3mm; }
.page.compact .name { font-size: 20px; }
.page.compact .contacts { font-size: 10.5px; }
.page.compact { padding: 9mm 12mm; }
.page.compact .item-head h3 { font-size: 12px; }
.page.compact ul li { margin: 1px 0; }

ul { margin: 1px 0 0 16px; }
ul li { margin: 1px 0; }
ul.tight { margin-left: 16px; }

.link { font-size: 11.5px; color: var(--primary); text-decoration: none; word-break: break-all; }
.link:hover { text-decoration: underline; }

/* Split layout */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10mm; margin-top: 8mm; }
/* Not used for certs/education anymore; leaving for other areas */

/* Clean two-line list rows */
.list.clean { list-style: none; margin: 4px 0 0; padding: 0; }
.list.clean li { margin: 3px 0; }
.row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 10px; }
.row .title { font-weight: 600; }
.row .meta { color: var(--muted); font-size: 11.5px; text-align: right; white-space: normal; }

/* Stacked variant: title first line, meta below */
.list.stacked { list-style: none; margin: 4px 0 0; padding: 0; }
.list.stacked li { margin: 6px 0 8px; }
.list.stacked .title { font-weight: 600; }
.list.stacked .meta { color: var(--muted); font-size: 11.5px; }

/* Projects list */
.projects .desc { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; }
.projects .row .title { font-weight: 600; }
.projects .row .meta .date { margin-right: 6px; }



.metric { color: var(--primary); font-weight: 600; }

/* References */
.refs .sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* Inline tag list (compact chips) */
.inline-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; }
.inline-tags li { border: 1px solid var(--border); background: #fff; padding: 3px 6px; border-radius: 999px; font-size: 11.5px; color: var(--muted); }

/* Signature block */
.signature p { margin: 0 0 6mm; }
.sig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20mm; align-items: end; }
.sig-row .line { border-bottom: 1px solid var(--muted); height: 28px; }
.sig-row .label { color: var(--muted); font-size: 11.5px; margin-top: 4px; }

/* Print styles */
@page { size: A4; margin: 0; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { background: #fff; }
  .page { margin: 12mm auto; width: 210mm; height: 297mm; box-shadow: none; border: none; page-break-after: always; padding: 14mm 16mm; }
  .page:first-of-type { padding-top: 10mm; }
  .page:last-child { page-break-after: auto; }
  a[href^="http"]::after { content: ""; } /* hide link URLs when printing */
  .page::after { content: none; }
  nav.toolbar, .toolbar, .toolbar * , .btn, #btn-pdf { display: none !important; }
  /* Avoid orphan section headers at the bottom */
  .section h2 { page-break-after: avoid; break-after: avoid-page; }
  /* Allow items to split across pages to prevent large gaps */
  .item { page-break-inside: auto !important; break-inside: auto !important; }
  .item-head { page-break-inside: avoid; break-inside: avoid; }
}
  
  /* Toolbar */
.toolbar { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,0.9); backdrop-filter: saturate(120%) blur(6px); border-bottom: 1px solid #e6eef8; padding: 10px 16px; display: flex; gap: 8px; justify-content: center; }
.btn { appearance: none; border: 1px solid var(--primary); color: #fff; background: var(--primary); border-radius: 8px; padding: 8px 12px; font-weight: 600; cursor: pointer; }
.btn.secondary { background: #fff; color: var(--primary); }
  .btn:hover { filter: brightness(0.95); }

/* Explicit printing class for JS fallback */
body.printing nav.toolbar, body.printing .toolbar, body.printing .toolbar * { display: none !important; }

/* Ensure print ignores any runtime scaling wrappers */
@media print {
  .page-wrap { margin: 0 !important; width: auto !important; height: auto !important; }
  .page-wrap .page { position: static !important; transform: none !important; margin: 0 !important; }
}
