/* =========================================================================
   doc.css · secondary pages of the EGYM site: CV (screen + one A4 page),
   notice, 404 and the cover letter (private build, one A4 page). Loaded after
   fonts.css and tokens.css. The markup comes from the shared templates
   (src/templates/cv.mjs, notice.mjs, letter.mjs); the tile layout follows the
   tested CV of the other applications, in the colours of the start page:
   a light sheet on the dark stage, dark head with the warm motor light.
   One page in the PDF is checked by scripts/pdf.mjs (no text over a tile edge,
   sheet at most one A4 page, every PDF exactly one page).
   Inter Static comes in 400 and 500 (fonts.css): no other weight here.
   ========================================================================= */

.doc { min-height: 100vh; background: var(--bg); color: var(--ink); }
.doc a { color: var(--accent-ink); text-underline-offset: 3px; }
.doc a:hover { text-decoration-thickness: 2px; }
.no-js .js-only { display: none !important; }

/* draft builds only (node scripts/build.mjs): yellow note, open facts marked */
.draft-banner { margin: 0; padding: 10px 16px 8px; background: var(--hint-bg); color: var(--hint); font-size: 0.875rem; font-weight: var(--fw-med); text-align: center; }
mark.todo { background: #ffe066; color: #3d3000; padding: 0 3px; border-radius: 3px; }

/* ---------- toolbar above the sheet (on the dark stage) ---------- */
.cv-toolbar { max-width: 210mm; margin: 0 auto; padding: 16px 16px 12px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; font-size: 0.875rem; }
.cv-toolbar__right { display: flex; gap: 6px; align-items: center; }
.doc .cv-back { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: var(--r-pill); border: 1px solid var(--line-dark-2); color: var(--ink); font-weight: var(--fw-med); text-decoration: none; transition: border-color .25s, background .25s; }
.doc .cv-back:hover { border-color: rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.04); }
.cv-print { appearance: none; min-height: 44px; padding: 0 20px; border: 0; border-radius: var(--r-pill); background: var(--orange-ui); color: #fff; font: inherit; font-weight: var(--fw-med); cursor: pointer; transition: background .25s; }
.cv-print:hover { background: #a94907; }

/* ---------- sheet ---------- */
/* a sheet without a toolbar above it (404) keeps a gap to the window edge */
.doc > .cv-sheet:first-child { margin-top: 32px; }
.cv-sheet { max-width: 210mm; margin: 0 auto 32px; overflow: hidden; background: var(--paper); color: var(--tx-1); border-radius: var(--r-md); box-shadow: var(--sh-sheet); font-size: 0.9375rem; line-height: 1.45; }
.cv-top { position: relative; isolation: isolate; overflow: hidden; padding: 12mm 16mm 9mm; background: var(--grad-head); color: var(--ink); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.cv-top__doc { font-size: 0.75rem; font-weight: var(--fw-med); letter-spacing: 0.16em; text-transform: uppercase; color: var(--orange-hi); }
.cv-top__name { margin-top: 4px; font-size: 2.125rem; font-weight: var(--fw-med); line-height: 1.05; letter-spacing: -0.03em; color: var(--ink); }
.cv-top__target { margin-top: 5px; font-size: 1.0625rem; color: var(--muted); }
.cv-body { padding: 7mm 16mm 12mm; }
.cv-head { padding: 12mm 16mm 0; }
.cv-head__doc { font-size: 0.75rem; font-weight: var(--fw-med); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-ink); }
.cv-head__name { margin-top: 6px; font-size: clamp(2rem, 4vw, 2.75rem); font-weight: var(--fw-med); line-height: 1.06; letter-spacing: -0.035em; }

/* ---------- CV tiles ---------- */
.cv-sheet--tiles { background: var(--paper-2); }
.cv-sheet--tiles .cv-top { padding: 9mm 10mm 6mm; }
.cv-top__main { display: flex; justify-content: space-between; align-items: center; gap: 6mm; }
.cv-photo { flex: none; width: 26mm; height: 26mm; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, 0.28); }
.cv-kpis { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2mm; margin-top: 4mm; }
.cv-kpis li { padding: 2.2mm 2.8mm 1.8mm; border-radius: 10px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-dark); }
.cv-kpis__v { display: block; font-size: 1.125rem; font-weight: var(--fw-med); line-height: 1.2; letter-spacing: -0.015em; color: var(--ink); font-variant-numeric: tabular-nums; }
.cv-kpis__l { display: block; margin-top: 1px; font-size: 0.8125rem; line-height: 1.3; color: var(--muted); }
/* even line breaks in the head: "Schnitt 1,8 · / Abschluss 03/2027" instead of a lone "03/2027" */
.cv-top__doc, .cv-top__name, .cv-kpis__v, .cv-kpis__l { text-wrap: balance; }
.cv-sheet--tiles .cv-body { padding: 5mm 10mm 4mm; display: grid; gap: 3mm; }
.cv-row { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 3mm; }
.cv-tile { min-width: 0; padding: 3mm 4.2mm 3mm; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
.cv-tile__head { display: flex; justify-content: space-between; align-items: baseline; gap: 3mm; margin-bottom: 1mm; }
.cv-tile h2 { font-size: 0.75rem; font-weight: var(--fw-med); letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.3; color: var(--accent-ink); }
.doc .cv-jump { display: inline-flex; align-items: center; gap: 3px; font-size: 0.8125rem; font-weight: var(--fw-med); text-decoration: none; white-space: nowrap; }
.doc .cv-jump:hover { text-decoration: underline; }
.cv-jump__icon { width: 0.72em; height: 0.72em; flex: none; }
.cv-profile, .cv-line { font-size: 0.875rem; line-height: 1.42; }
.cv-contact { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 3mm; row-gap: 0.3mm; font-size: 0.875rem; line-height: 1.42; }
.cv-contact > div { display: contents; }
.cv-contact dt { color: var(--tx-3); }
.cv-contact dd { margin: 0; }
.cv-muted { color: var(--tx-3); }
.cv-entry + .cv-entry { margin-top: 2mm; padding-top: 2mm; border-top: 1px solid var(--line); }
.cv-entry__head { display: flex; justify-content: space-between; align-items: baseline; gap: 4mm; font-size: 0.875rem; font-weight: var(--fw-reg); line-height: 1.35; }
.cv-entry__title { font-weight: var(--fw-med); }
.cv-entry__sep { color: var(--line-strong); }
.cv-entry__when { flex: none; color: var(--tx-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cv-entry__when .todo { white-space: normal; }
.cv-entry__note { margin-top: 0.3mm; font-size: 0.875rem; line-height: 1.4; color: var(--tx-3); }
.cv-entry__list { margin: 0.8mm 0 0 1.05em; padding: 0; font-size: 0.875rem; line-height: 1.42; color: var(--tx-2); }
.cv-entry__list li { margin-top: 0.3mm; }
.cv-entry__list li::marker { color: var(--orange); }
.cv-entry__list strong, .cv-skills strong { font-weight: var(--fw-med); color: var(--tx-1); }
.cv-tile--kv { display: grid; gap: 1.6mm; }
.cv-kv { display: grid; grid-template-columns: 30mm minmax(0, 1fr); gap: 3mm; align-items: baseline; }
.cv-kv h2 { letter-spacing: 0.1em; }
.cv-kv + .cv-kv { padding-top: 1.6mm; border-top: 1px solid var(--line); }
.cv-skills { list-style: none; display: grid; gap: 0.4mm; font-size: 0.875rem; line-height: 1.42; color: var(--tx-2); }

/* ---------- notice and 404 ---------- */
/* before the phone rules below, which narrow the side padding of .notice__sec */
.notice { padding-bottom: 12mm; }
.notice__sec { padding: 0 16mm; }
.notice__sec h2 { margin-top: 22px; font-size: 1.1875rem; line-height: 1.3; letter-spacing: -0.01em; }
.notice__sec p { max-width: 72ch; margin-top: 8px; font-size: 1rem; line-height: 1.6; color: var(--tx-2); }

/* ---------- cover letter (private build → one-page PDF) ---------- */
.letter .cv-top { padding: 10mm 18mm 7mm; }
.letter__contact { margin-top: 3mm; font-size: 0.8125rem; color: var(--muted); }
.doc .letter__contact a { color: inherit; text-decoration: none; }
.letter__body { padding: 11mm 18mm 13mm; font-size: 1.0625rem; line-height: 1.55; color: var(--tx-1); }
.letter__body > * + * { margin-top: 3.2mm; }
.letter__date { text-align: right; color: var(--tx-3); }
.letter__subject { margin-top: 7mm !important; font-size: 1.0625rem; line-height: 1.45; }
.doc .letter__link a { font-weight: var(--fw-med); color: var(--accent-ink); }
.letter__close { margin-top: 6mm !important; }
.letter__sign { margin-top: 1mm !important; }

/* on screen the stacked contact links need room to be tapped (target size 24 px); print stays tight.
   The sheet keeps a 16 px gutter to the window edge on narrow screens (the dark stage stays visible). */
@media screen {
  .cv-contact { row-gap: 7px; }
  .cv-sheet { max-width: min(210mm, calc(100% - 32px)); }
}
/* screens with four key facts in a row: the first one ("B.Eng. Elektrotechnik") gets more room,
   so it stays on one line (the PDF keeps four equal columns, it fits there) */
@media screen and (min-width: 701px) {
  .cv-kpis { grid-template-columns: minmax(0, 1.32fr) repeat(3, minmax(0, 1fr)); }
  .cv-kpis__v { font-size: 1.0625rem; }
}

/* phones: tiles stack, key facts in two columns, long values may wrap */
@media screen and (max-width: 700px) {
  .cv-sheet { border-radius: var(--r-sm); }
  .cv-sheet--tiles .cv-top, .cv-sheet--tiles .cv-body { padding-left: 16px; padding-right: 16px; }
  .cv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cv-photo { width: 72px; height: 72px; }
  .cv-row { grid-template-columns: minmax(0, 1fr); }
  .cv-contact dd { white-space: normal; overflow-wrap: anywhere; }
  .cv-tile__head, .cv-entry__head { flex-wrap: wrap; column-gap: 4mm; row-gap: 0; }
  .cv-kv { grid-template-columns: minmax(0, 1fr); gap: 0.5mm; }
  .cv-head, .notice__sec { padding-left: 20px; padding-right: 20px; }
}
@media screen and (max-width: 400px) {
  .cv-kpis__v { overflow-wrap: anywhere; }
  /* the name in two lines next to a smaller photo, not three */
  .cv-top__name { font-size: 1.875rem; }
  .cv-photo { width: 60px; height: 60px; }
}

/* ---------- footer (on the dark stage) ---------- */
.foot { max-width: 210mm; margin: 0 auto; padding: 0 16px 32px; display: grid; gap: 6px; text-align: center; font-size: 0.8125rem; line-height: 1.6; color: var(--dim); }
.doc .foot a { color: var(--muted); }
.doc .foot a:hover { color: var(--ink); }

/* ---------- print: the CV and the letter as one A4 page without margins ---------- */
@page { size: A4; margin: 12mm 14mm; }
@page cv { size: A4; margin: 0; }
.page-cv .cv-sheet { page: cv; }
@media print {
  html { font-size: 10pt; }
  body.doc { min-height: 0; background: #fff; color: var(--tx-1); }
  .draft-banner, .cv-toolbar, .foot { display: none !important; }
  .cv-sheet, .doc > .cv-sheet:first-child { max-width: none; margin: 0; border-radius: 0; box-shadow: none; }
  body.page-cv--tiles { background: var(--paper-2) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc a { text-decoration: none; }
  /* a little headroom below the one-page limit */
  .cv-sheet--tiles .cv-top { padding: 8mm 10mm 5.5mm; }
  .cv-sheet--tiles .cv-body { gap: 2.6mm; padding-bottom: 3mm; }
  /* tight tracking in the PDF: wide letter-spacing splits the headings into single letters for
     text extraction (resume parsers, pdftotext) */
  .cv-tile h2, .cv-kv h2, .cv-top__doc, .cv-head__doc { letter-spacing: 0.04em; }
  /* body text of the tiles as on the other CVs (0.8125rem in print) */
  .cv-profile, .cv-line, .cv-contact, .cv-entry__head, .cv-entry__note, .cv-entry__list, .cv-skills { font-size: 0.8125rem; line-height: 1.37; }
}
