/* =========================================================================
   doc.css · secondary pages of the sematicon site: CV (screen + one A4 page), notice,
   404 and the cover letter (private build, two A4 pages). 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 look of sematicon.eu (logo and design of sematicon are used for this application):
   a white sheet on the dark stage, the hero gradient with the crimson glow as head,
   white wordmark, red as the mark and action colour, blue sparingly, cards with a 24px
   radius, pills 100px, no shadows, no border lines.
   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). Manrope comes in 300, 400, 600, 700, 800
   (fonts.css); this file uses 300, 400, 600 and 700.
   ========================================================================= */

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

/* 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-semi); 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 20px; border-radius: var(--r-pill); border: 1px solid var(--line-dark-2); color: var(--ink); font-weight: var(--fw-semi); text-decoration: none; transition: background .25s, border-color .25s; }
.doc .cv-back:hover { border-color: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.08); }
.cv-print { appearance: none; min-height: 44px; padding: 0 22px; border: 0; border-radius: var(--r-pill); background: var(--red); color: #FFFFFF; font: inherit; font-weight: var(--fw-semi); cursor: pointer; transition: background .25s; }
.cv-print:hover { background: var(--red-hover); }

/* ---------- 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-sheet); font-size: 0.9375rem; line-height: 1.5; }
.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; }
/* the document label is a small red pill, as the badges on sematicon.eu */
.cv-top__doc { display: inline-block; padding: 3px 11px 2px; border-radius: var(--r-pill); background: var(--red); color: #FFFFFF; font-size: 0.6875rem; font-weight: var(--fw-semi); letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.5; }
.cv-top__name { margin-top: 4px; font-size: 2.125rem; font-weight: var(--fw-bold); line-height: 1.1; letter-spacing: -0.02em; color: var(--ink); }
.cv-top__target { margin-top: 4px; font-size: 1.0625rem; font-weight: var(--fw-light); 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-semi); letter-spacing: 0.14em; text-transform: uppercase; color: var(--red); }
.cv-head__name { margin-top: 6px; font-size: clamp(1.875rem, 4vw, 2.5rem); font-weight: var(--fw-bold); line-height: 1.1; letter-spacing: -0.02em; }

/* wordmark in the head: white logo with the red mark (assets/img/sematicon-logo-weiss.svg, unchanged), left,
   with the document label next to it; name and target line below it */
.cv-top__main > div, .letter__top { display: flex; flex-wrap: wrap; align-items: center; column-gap: 4mm; }
.cv-top__main > div::before, .letter__top::before { content: ""; flex: none; width: 33mm; height: 9.08mm; background: url(img/sematicon-logo-weiss.svg) left center / contain no-repeat; }
.cv-top__main > div > .cv-top__name, .cv-top__main > div > .cv-top__target, .letter__top > .cv-top__name, .letter__top > .letter__contact { flex: 1 0 100%; }
.cv-top__main > div > .cv-top__name, .letter__top > .cv-top__name { margin-top: 4mm; }

/* ---------- CV tiles ---------- */
.cv-sheet--tiles .cv-top { padding: 8mm 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.3); }
.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.3mm 3mm 2mm; border-radius: var(--r-kpi); background: rgba(255, 255, 255, 0.1); }
.cv-kpis__v { display: block; font-size: 1.0625rem; font-weight: var(--fw-bold); line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.cv-kpis__l { display: block; margin-top: 1px; font-size: 0.8125rem; font-weight: var(--fw-reg); 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__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.5mm 3mm; border-radius: var(--r-card); background: var(--paper-2); -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-bold); letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.3; color: var(--red); }
.doc .cv-jump { display: inline-flex; align-items: center; gap: 3px; font-size: 0.8125rem; font-weight: var(--fw-semi); 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.45; }
.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.45; }
.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-bold); }
.cv-entry__sep { color: var(--tx-3); }
.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; font-weight: var(--fw-light); 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.45; color: var(--tx-2); }
.cv-entry__list li { margin-top: 0.3mm; }
.cv-entry__list li::marker { color: var(--red); }
.cv-entry__list strong, .cv-skills strong, .cv-profile strong { font-weight: var(--fw-bold); 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.08em; }
.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.45; 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 → two-page PDF) ---------- */
.letter .cv-top { padding: 9mm 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: 10mm 18mm 12mm; font-size: 1rem; line-height: 1.55; color: var(--tx-1); }
.letter__body > * + * { margin-top: 3mm; }
.letter__date { text-align: right; color: var(--tx-3); }
.letter__subject { margin-top: 6mm !important; font-size: 1rem; line-height: 1.45; letter-spacing: -0.01em; }
.doc .letter__link a { font-weight: var(--fw-semi); color: var(--blue); }
.letter__close { margin-top: 5mm !important; }
.letter__sign { margin-top: 1mm !important; font-weight: var(--fw-semi); }

/* two pages (src/templates/sematicon-letter.mjs): page 2 has a slim running head with the logo, both pages "Seite n von N" */
.letter--pages { position: relative; }
.letter--pages .letter__body { padding-bottom: 20mm; }
.letter .letter__top--run { flex-wrap: nowrap; justify-content: space-between; padding: 6mm 18mm 5mm; }
.letter__run { font-size: 0.8125rem; color: var(--muted); }
.letter__continuation { color: var(--tx-3); }
.letter__page-number { position: absolute; bottom: 9mm; right: 18mm; font-size: 0.75rem; color: var(--tx-3); }

/* 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)); }
}

/* phones: tiles stack, key facts in two columns, long values may wrap */
@media screen and (max-width: 700px) {
  .cv-sheet { border-radius: 20px; }
  .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; }
  .cv-top__main > div::before, .letter__top::before { width: 30mm; height: 8.25mm; }
}
@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.75rem; }
  .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 (one A4 page) and the letter (two A4 pages) 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; }
  body.page-cv--tiles { background: var(--paper) !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: 7mm 10mm 5mm; }
  .cv-sheet--tiles .cv-body { gap: 3mm; 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 a little larger than on the other CVs (0.8125rem there): Manrope sets small and this CV
     has room (the guard in scripts/pdf.mjs keeps it to one page) */
  .cv-profile, .cv-line, .cv-contact, .cv-entry__head, .cv-entry__note, .cv-entry__list, .cv-skills { font-size: 0.8438rem; line-height: 1.42; }
  .letter__body { font-size: 1.0625rem; line-height: 1.58; }
  /* each letter page is one A4 sheet; the break is set in the template, after a full paragraph */
  .page-letter .letter--pages { height: 297mm; margin: 0; break-inside: avoid; break-after: page; }
  .page-letter .letter--pages:last-child { break-after: auto; }
  .letter--pages .letter__body p { orphans: 3; widows: 3; }
}
