/* ==========================================================================
   filipemelo.ch — printed CV, "Signal Dark"
   Loaded with media="print": Ctrl+P on the site and `npm run pdf` both use it.
   Full-bleed dark A4. The page background and the footer live on @page so
   they also cover the page margins. No boxes: a strict grid and hairlines.
   ========================================================================== */

@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
}

:root {
  --ink: #0d1117;
  --line: #2a313b;
  --text: #e6edf3;
  --text-2: #b6c2ce;
  --muted: #7d8590;
  --signal: #c6f432;
  --signal-glow: rgb(198 244 50 / 18%);
  --sans: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, consolas, monospace;
  --gutter: 16mm;
  --col-gap: 8mm;
  --dates: 23mm;
}

@page {
  size: a4;
  margin: 11mm 0 13mm;
  background: #0d1117;

  @bottom-left {
    content: "filipemelo.ch";
    padding-left: 16mm;
    color: #7d8590;
    font-family: "JetBrains Mono", monospace;
    font-size: 6.5pt;
  }

  @bottom-right {
    content: counter(page) " / " counter(pages);
    padding-right: 16mm;
    color: #7d8590;
    font-family: "JetBrains Mono", monospace;
    font-size: 6.5pt;
  }
}

/* Page 1 runs to the top edge so the signal field behind the portrait bleeds. */
@page :first {
  margin-top: 0;
}

/* Language visibility (same contract as style.css). */
:root[data-ui-lang="en"] body [lang]:not([lang="en"], [data-fixed-lang]),
:root[data-ui-lang="de"] body [lang]:not([lang="de"], [data-fixed-lang]),
:root[data-ui-lang="pt"] body [lang]:not([lang="pt"], [data-fixed-lang]) {
  display: none !important;
}

/* Website-only parts. */
.skip-link,
.site-header,
.cta-row,
.cursor,
.contact,
.site-footer,
.role .tags,
.certs-title,
.visually-hidden {
  display: none !important;
}

/* Base -------------------------------------------------------------------- */

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

html {
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 8.5pt;
  line-height: 1.5;
  print-color-adjust: exact;
}

body {
  margin: 0;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
}

/* Grid: everything full width, except the closing band on page 2:
   degrees | certifications | skills (education spans the first two columns
   and repeats the same ratios inside). Writing moves to the very end. */
main {
  display: grid;
  grid-template-columns: 1.15fr 1.35fr 0.85fr;
  column-gap: var(--col-gap);
  padding-inline: var(--gutter);
}

main > section {
  grid-column: 1 / -1;
}

#education {
  grid-column: 1 / 3;
}

#skills {
  grid-column: 3;
}

#writing {
  order: 1;
}

.section {
  padding-top: 5mm;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 2.4mm;
  margin-bottom: 3.4mm;
  color: var(--signal);
  font-family: var(--mono);
  font-size: 7pt;
  font-weight: 500;
  break-after: avoid;
}

.section-label::before {
  content: "//" / "";
  color: var(--muted);
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Header: the one loud element ------------------------------------------- */

/* Nothing that carries text is positioned anywhere in this file: Chrome writes
   positioned boxes into the PDF last, which scrambles the reading order that
   applicant-tracking systems extract. Decoration is done with backgrounds. */

/* The signal field: a dot grid behind the portrait, faded out by an ink
   gradient layered on top of it. */
.hero {
  margin-inline: calc(-1 * var(--gutter));
  padding: 12mm var(--gutter) 0;
  background-image:
    radial-gradient(ellipse 92mm 58mm at 32mm 30mm, rgb(13 17 23 / 0%) 0%, #0d1117 76%),
    radial-gradient(rgb(198 244 50 / 22%) 0.3mm, transparent 0.36mm);
  background-size: 100% 100%, 3.2mm 3.2mm;
  background-repeat: no-repeat, repeat;
}

.hero-inner {
  display: grid;
  grid-template-columns: 36mm 1fr;
  column-gap: 10mm;
}

.hero-text {
  display: contents;
}

.hero-photo {
  grid-row: 1 / span 3;
  align-self: center;
}

.hero-photo img {
  width: 36mm;
  height: 36mm;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 1.5mm var(--ink),
    0 0 0 1.8mm var(--signal);
}

h1 {
  grid-column: 2;
  align-self: end;
  width: min-content;
  font-size: 42pt;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.035em;
}

.hero-role {
  grid-column: 2;
  margin-top: 4mm;
  color: var(--signal);
  font-family: var(--mono);
  font-size: 8.5pt;
}

.prompt {
  margin-inline-end: 0.4em;
}

.hero-pitch {
  grid-column: 2;
  align-self: start;
  max-width: 108mm;
  margin-top: 2.4mm;
  color: var(--text-2);
  font-size: 9.6pt;
  line-height: 1.5;
}

.print-contact {
  grid-column: 1 / -1;
  display: flex;
  gap: 9mm;
  margin-top: 6.5mm;
  padding-block: 2.6mm;
  border-block: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 7pt;
}

/* Key facts strip + profile ---------------------------------------------- */

#profile {
  padding-top: 0;
}

#profile .container {
  display: grid;
}

.profile-grid {
  display: contents;
}

.facts {
  order: -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 4.5mm;
  border-bottom: 1px solid var(--line);
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 1.4mm;
  padding: 3.4mm 0 3mm;
}

.fact + .fact {
  padding-left: 4mm;
  border-left: 1px solid var(--line);
}

.fact-value {
  color: var(--signal);
  font-family: var(--mono);
  font-size: 17pt;
  line-height: 1;
}

.fact-label {
  color: var(--muted);
  font-size: 7pt;
  line-height: 1.35;
}

.profile-text > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--col-gap);
}

.profile-text p {
  color: var(--text-2);
  font-size: 8.5pt;
  line-height: 1.55;
}

/* Approach ---------------------------------------------------------------- */

.principles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.8mm var(--col-gap);
}

.principle {
  break-inside: avoid;
}

.principle h3 {
  font-size: 9.4pt;
  font-weight: 600;
  line-height: 1.3;
}

.principle p {
  margin-top: 0.8mm;
  color: var(--text-2);
  font-size: 8pt;
  line-height: 1.5;
}

/* Career: a real sequence, so it gets a timeline ------------------------- */

/* The timeline rule is a 1px background stripe, so it continues across the
   page break without positioning anything. */
#career .container {
  background: linear-gradient(var(--line), var(--line)) no-repeat 0.95mm 9.6mm / 1px calc(100% - 12.6mm);
}

.role,
.earlier-list > li {
  display: grid;
  grid-template-columns: var(--dates) 1fr;
  column-gap: 4mm;
}

/* A role may continue on the next page, but never splits a bullet or
   leaves its title behind. */
.role {
  padding-bottom: 3.8mm;
}

.earlier-list > li,
.role-points li {
  break-inside: avoid;
}

.role-title,
.role-org {
  break-after: avoid;
}

.role-dates {
  display: flex;
  align-items: center;
  align-self: start;
  gap: 2.4mm;
  padding-top: 0.7mm;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 6.8pt;
  white-space: nowrap;
}

.role-dates::before {
  content: "";
  flex: none;
  width: 2mm;
  height: 2mm;
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: var(--ink);
}

.role-current .role-dates::before {
  border-color: var(--signal);
  background: var(--signal);
  box-shadow: 0 0 0 0.9mm var(--signal-glow);
}

.role-title {
  font-size: 10.5pt;
  font-weight: 600;
  line-height: 1.3;
}

.role-note,
.role-org-inline {
  color: var(--text-2);
  font-weight: 400;
}

.role-org {
  margin-top: 0.4mm;
  color: var(--text-2);
  font-size: 7.8pt;
}

.role-points {
  display: grid;
  gap: 0.8mm;
  margin-top: 1.8mm;
}

.role-points li {
  padding-left: 3.6mm;
  color: var(--text-2);
  font-size: 8.1pt;
  line-height: 1.48;
}

/* Inline dash with a hanging indent (no positioning, see header note). */
.role-points li::before {
  content: "";
  display: inline-block;
  width: 1.8mm;
  height: 1px;
  margin: 0 1.8mm 0 -3.6mm;
  vertical-align: 0.34em;
  background: var(--signal);
}

.earlier summary {
  display: flex;
  align-items: baseline;
  gap: 2.4mm;
  margin: 0.4mm 0 3mm calc(var(--dates) + 4mm);
  color: var(--signal);
  font-family: var(--mono);
  font-size: 7pt;
  list-style: none;
}

.earlier summary::-webkit-details-marker {
  display: none;
}

/* Always print the collapsed earlier roles (print.js covers older browsers). */
.earlier::details-content {
  content-visibility: visible;
}

.earlier-range {
  color: var(--muted);
}

.earlier-list > li {
  padding-bottom: 2.2mm;
}

/* Earlier roles read as one paragraph each: bold title, then the summary. */
.earlier-list > li > div > * {
  display: inline;
}

.earlier-list .role-title {
  margin-inline-end: 1.6mm;
  font-size: 8.4pt;
}

.earlier-list p:not(.role-dates) {
  color: var(--text-2);
  font-size: 7.8pt;
  line-height: 1.5;
}

/* Education, certifications, skills: one three-column band --------------- */

.education-grid {
  display: grid;
  grid-template-columns: 1.15fr 1.35fr;
  column-gap: var(--col-gap);
}

/* Skills read as one sentence rather than another list. */
.tags-lg li {
  display: inline;
  color: var(--text);
  font-size: 7.8pt;
  line-height: 1.65;
}

.tags-lg li:not(:last-child)::after {
  content: ",";
  color: var(--muted);
}

/* The lists on page 2 share one row rhythm: hairline, small padding. */
.degrees > li,
.cert-list li,
.languages > div {
  padding-block: 1.1mm;
  border-top: 1px solid var(--line);
  break-inside: avoid;
}

.cert-list li,
.languages > div {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
  font-size: 7.6pt;
  line-height: 1.35;
}

.degrees > li:first-child,
.cert-list li:first-child,
.languages > div:first-child {
  padding-top: 0;
  border-top: 0;
}

.degrees .role-dates {
  padding-top: 0;
  font-size: 6.4pt;
}

.degrees .role-dates::before {
  content: none;
}

.degrees .role-title {
  margin-top: 0.3mm;
  font-size: 8.4pt;
}

.degrees .role-org,
.degrees p:not(.role-dates) {
  margin-top: 0.2mm;
  color: var(--text-2);
  font-size: 7.4pt;
  line-height: 1.4;
}

.cert-meta {
  padding-top: 0.3mm;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 6.2pt;
  white-space: nowrap;
}

.skills-grid {
  display: grid;
  gap: 4.5mm;
}

.languages dt {
  font-weight: 500;
}

.languages dd {
  color: var(--muted);
  font-size: 7pt;
  text-align: right;
}

/* Writing ----------------------------------------------------------------- */

/* One row per piece: what it is | title | where to read it. */
.card {
  display: grid;
  grid-template-columns: var(--dates) 1fr auto;
  column-gap: 4mm;
  align-items: baseline;
  padding-block: 1.1mm;
  border-top: 1px solid var(--line);
  break-inside: avoid;
}

.card:first-child {
  padding-top: 0;
  border-top: 0;
}

.card-kicker {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 6.4pt;
}

.card-title {
  font-size: 8.2pt;
  font-weight: 600;
  line-height: 1.35;
}

.card-accent .card-title {
  color: var(--signal);
}

/* The newsletter blurb stays on the website. */
.card p:not(.card-kicker) {
  display: none;
}

.card-link {
  color: var(--signal);
  font-family: var(--mono);
  font-size: 6.4pt;
  white-space: nowrap;
}
