/* ── Résumé page ────────────────────────────────────────────────────── */

.resume-page {
  max-width: 760px;
  padding-top: 2.5rem;
  padding-bottom: 4rem;
}

.resume-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
}

.resume-actions-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.6rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn-icon:hover { background: var(--ink); color: var(--paper); }
.btn-icon.is-copied { background: var(--red); border-color: var(--red); color: #f2efe8; }

.copy-toast {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  pointer-events: none;
}
.copy-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.raw-only { display: none; }
body.is-raw .raw-only { display: flex; }

#raw-toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.resume-header {
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}
.resume-header h1 {
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  letter-spacing: -0.01em;
}
.resume-role {
  margin: 0.6rem 0 0;
  font-style: italic;
  color: var(--red);
}

@media (max-width: 500px) {
  .resume-role {
    font-size: clamp(0.62rem, 3.6vw, 1rem);
    white-space: nowrap;
  }
}
.resume-contact {
  margin: 1rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-mid);
  overflow-wrap: break-word;
}
.resume-contact a { text-decoration: none; }
.resume-contact a:hover { color: var(--red); }
.resume-contact span { margin: 0 0.6rem; color: var(--ink-dim); }

.resume-section {
  padding: 0;
  margin-bottom: 2rem;
}
.resume-section h2 {
  font-size: 1.4rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--hairline-faint);
  padding-bottom: 0.5rem;
  display: block;
}

.resume-summary {
  font-size: 1.02rem;
  color: var(--ink-mid);
  max-width: 640px;
}
.resume-summary strong { color: var(--ink); font-weight: 400; font-style: italic; }

.resume-entry { margin-bottom: 1.5rem; }
.resume-entry:last-child { margin-bottom: 0; }

.resume-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.resume-entry-head h3 {
  font-size: 1.15rem;
  font-style: italic;
}
.resume-dates {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  white-space: nowrap;
}

.resume-org {
  margin: 0.3rem 0 0.8rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.resume-loc { opacity: 0.72; }
.resume-loc::before {
  content: "\00b7";
  margin: 0 0.45em;
  opacity: 0.7;
}

.resume-entry ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink-mid);
}
.resume-entry li { margin-bottom: 0.5rem; }
.resume-entry li:last-child { margin-bottom: 0; }
.resume-entry a { color: var(--red); }

.resume-pillars {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem;
}
.resume-pillar h3 {
  font-size: 1rem;
  font-style: italic;
  color: var(--red);
  margin-bottom: 0.6rem;
}
.resume-pillar p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-mid);
}
.resume-pillar a { color: inherit; text-decoration: underline; }

/* ── Plaintext view ─────────────────────────────────────────────────── */
.resume-plaintext {
  margin: 2rem 0 0;
  padding: 1.75rem;
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow-x: auto;
  max-width: 100%;
}

@media (max-width: 760px) {
  .resume-page { padding-top: 2rem; }
  .resume-pillars { grid-template-columns: 1fr; }
  .resume-plaintext { padding: 1.25rem; font-size: 0.8rem; }
}

@media (max-width: 420px) {
  .resume-entry-head { flex-direction: column; align-items: flex-start; gap: 0.3rem; }

  /* Download PDF + Raw always share one row, shrinking to fit; the
     copy-to-clipboard row (shown in raw mode) stays right-justified
     below them. */
  .resume-actions-row:not(.raw-only) .btn {
    flex: 1;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
    text-align: center;
    white-space: nowrap;
  }
}

/* ── Print ──────────────────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }

  body {
    background: #fff;
    color: #111;
    font-size: 12.5pt;
  }
  ::selection { background: transparent; }

  .resume-page {
    max-width: none;
    padding: 0;
    margin: 0;
  }

  .resume-header { border-bottom-color: #111; }
  .resume-role { color: #444; }
  .resume-contact { color: #333; }

  .resume-section h2 { border-bottom-color: #ccc; }
  .resume-loc { opacity: 0.85; }
  .resume-summary,
  .resume-org,
  .resume-dates,
  .resume-entry ul,
  .resume-pillar p { color: #222; }
  .resume-entry a,
  .resume-pillar a,
  .resume-role { color: #111; }

  /* Keeping whole SECTIONS off page boundaries is what produced a title page:
     Experience is taller than a sheet, so "never break inside" could only be
     satisfied by starting it on page two, leaving page one blank below the
     header. Entries are page-sized, so they are the right unit to keep whole. */
  .resume-section { margin-bottom: 1.6rem; }

  .resume-entry,
  .resume-pillar {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* A heading stranded at the foot of a page is the other way this reads
     badly, so headings stay with the entry they introduce. */
  .resume-header,
  .resume-section h2,
  .resume-entry-head,
  .resume-entry h3,
  .resume-org {
    page-break-after: avoid;
    break-after: avoid;
  }

  .resume-entry p,
  .resume-entry li,
  .resume-pillar p {
    orphans: 2;
    widows: 2;
  }

  /* The screen layout is centred in the viewport; on paper the sheet provides
     the margin, so give it a real one rather than running to the edge. */
  @page { margin: 14mm; }

  a[href]::after { content: ""; }
}
