/* Interactive resume / CV document. Sized in real millimetres so it prints at
   exact scale via the shared @page engine. On screen the doc is shrunk with
   CSS `zoom` (layout-affecting) so it fits the preview column with no
   horizontal scrollbar; print resets zoom to 1 for true mm output. */

#preview { display: block; width: 100%; }
/* Never scroll horizontally; panel hugs the sheet (no big empty grey gap). */
.ps-preview-wrap { overflow-x: hidden; align-items: flex-start; height: auto; }

.cv-doc {
  /* width/min-height set inline by JS in mm */
  box-sizing: border-box;
  background: #fff;
  color: #1f2937;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  margin: 0 auto;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
  zoom: var(--cv-scale, 1);
  --accent: #0f766e;
  --fs: 1;
  line-height: 1.32;
}

/* ---- editable fields ---- */
.cv-doc .edit { outline: none; border-radius: 2px; transition: background .1s; min-height: 1em; }
.cv-doc .edit:hover { background: #eefaf6; }
.cv-doc .edit:focus { background: #e3f5ef; box-shadow: 0 0 0 1px var(--accent); }
.cv-doc .edit:empty::before { content: attr(data-ph); color: #b3bcc4; }

/* ---- single-column body wrapper ---- */
.cv-doc { --cv-pad: 14mm; }
.cv-body { padding: var(--cv-pad); }

/* ---- header ---- */
.cv-head { display: flex; gap: 6mm; align-items: flex-start; }
.cv-head .cv-id { flex: 1; min-width: 0; }
.cv-name { font-size: calc(8mm * var(--fs)); font-weight: 800; letter-spacing: .2mm; color: #111827; }
.cv-role { font-size: calc(4.2mm * var(--fs)); color: var(--accent); font-weight: 700; margin-top: .5mm; }
.cv-contact { font-size: calc(3.1mm * var(--fs)); color: #374151; margin-top: 2mm; }
.cv-photo {
  width: 26mm; height: 26mm; flex: none; border-radius: 2mm; overflow: hidden;
  border: 0.3mm dashed #c9ced6; display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; background: #fafbfc;
}
.cv-photo.has-photo { border: none; }
.cv-photo img { width: 100%; height: 100%; object-fit: cover; }
.cv-photo .cv-photo-ph { color: #c0c5cd; font-size: 2.7mm; text-align: center; padding: 2mm; }
.cv-head-rule { height: 0.4mm; background: var(--accent); margin: 3mm 0 0; opacity: .85; }

/* ---- sections ---- */
.cv-section { margin-top: 6mm; }
.cv-sec-title {
  font-size: calc(3.8mm * var(--fs)); font-weight: 800; letter-spacing: .5mm;
  color: var(--accent); text-transform: uppercase; display: flex; align-items: center; gap: 2mm;
}
.cv-sec-title::after { content: ""; flex: 1; height: 0.3mm; background: #dfe4e8; }
.cv-sec-body { margin-top: 2.5mm; font-size: calc(3.2mm * var(--fs)); }

/* entries (experience / education) */
.cv-entry { margin-bottom: 3.5mm; position: relative; }
.cv-entry-head { display: flex; justify-content: space-between; gap: 4mm; align-items: baseline; }
.cv-entry-role { font-weight: 700; font-size: calc(3.4mm * var(--fs)); color: #111827; }
.cv-entry-org { color: var(--accent); font-weight: 600; }
.cv-entry-meta { color: #6b7280; font-size: calc(3mm * var(--fs)); white-space: nowrap; text-align: right; }
.cv-entry-desc { color: #374151; margin-top: 1mm; }

.cv-summary { color: #374151; }
.cv-skills { color: #374151; }

/* add / remove controls (screen only) */
.cv-add {
  display: inline-flex; align-items: center; gap: 1mm; margin-top: 1mm;
  font-size: 2.9mm; color: var(--accent); background: none; border: 0.3mm dashed var(--accent);
  border-radius: 1.5mm; padding: 0.8mm 2.5mm; cursor: pointer;
}
.cv-add:hover { background: #eefaf6; }
.cv-del {
  position: absolute; top: -1mm; right: -1mm; width: 5mm; height: 5mm; border-radius: 50%;
  border: none; background: #f1f5f4; color: #94a3b8; cursor: pointer; font-size: 3.2mm; line-height: 1;
  display: none; align-items: center; justify-content: center;
}
.cv-entry:hover .cv-del, .cv-skill:hover .cv-del { display: flex; }
.cv-del:hover { background: #fee2e2; color: #ef4444; }

/* ---- sidebar layout ---- */
.cv-doc.sidebar { display: flex; }
.cv-doc.sidebar .cv-body { display: flex; padding: 0; flex: 1; align-items: stretch; min-height: inherit; }
.cv-doc.sidebar .cv-aside {
  width: 34%; background: #f4f7f6;
  padding: var(--cv-pad) calc(var(--cv-pad) * 0.57) var(--cv-pad) calc(var(--cv-pad) * 0.86);
  box-sizing: border-box;
}
.cv-doc.sidebar .cv-main {
  flex: 1; padding: var(--cv-pad) calc(var(--cv-pad) * 0.86) var(--cv-pad) calc(var(--cv-pad) * 0.57);
  box-sizing: border-box; min-width: 0;
}
.cv-doc.sidebar .cv-aside .cv-sec-title::after { background: #d3ddd9; }
/* in single-column mode, hide the aside container and fold its content into main */
.cv-doc:not(.sidebar) .cv-aside { display: none; }

.btn.tiny { padding: 4px 10px; font-size: .8rem; margin-top: 6px; }

@media (max-width: 820px) { .cv-body, .cv-doc.sidebar .cv-main, .cv-doc.sidebar .cv-aside { padding: 10mm; } }

/* ---- print: exact mm, hide UI chrome ---- */
@media print {
  .site-header, .site-footer, .controls, .print-note, .ad-slot, .tool-copy, .no-print { display: none !important; }
  .container, .tool-layout, .preview-col, .ps-preview-wrap, #preview {
    display: block !important; margin: 0 !important; padding: 0 !important;
    max-width: none !important; width: auto !important; background: #fff !important;
    box-shadow: none !important; overflow: visible !important;
  }
  .cv-doc { zoom: 1 !important; transform: none !important; box-shadow: none !important; margin: 0 !important; }
  .cv-doc .edit:empty::before, .cv-photo-ph { visibility: hidden !important; }
  .cv-add, .cv-del { display: none !important; }
  .cv-doc .edit:hover, .cv-doc .edit:focus { background: transparent !important; box-shadow: none !important; }
  /* keep the shaded sidebar visible on print */
  .cv-doc.sidebar .cv-aside { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
