/* Mirrors the LaTeX CV (RenderCV "sb2nov" look): Latin Modern Roman, black on white,
   bold section titles over a rule, italic dates on the right, hollow circle bullets. */

/* Latin Modern Roman, GUST Font License (http://www.gust.org.pl/fonts/licenses) */
@font-face { font-family: "Latin Modern Roman"; src: url("/fonts/lmroman10-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Latin Modern Roman"; src: url("/fonts/lmroman10-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Latin Modern Roman"; src: url("/fonts/lmroman10-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Latin Modern Roman"; src: url("/fonts/lmroman10-bolditalic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  --ink: #000000;
  --muted: #6b6b6b;
  --primary: #004f90;
  --primary-dark: #003a6b;
  --rule: #000000;
  --paper: #ffffff;
  --error: #a3312a;
  color-scheme: light;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Latin Modern Roman", "Computer Modern Serif", "CMU Serif", Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.45;
}

.page {
  max-width: 50rem;
  margin-inline: auto;
  padding: 2.5rem 1.25rem 2rem;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.1rem;
  border: 1px solid var(--primary);
  border-radius: 2px;
  background: var(--primary);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}

.button:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  text-decoration: none;
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.button i {
  font-size: 0.85em;
}

.text-button {
  padding: 0.45rem 0.6rem;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  cursor: pointer;
}

.text-button:hover {
  text-decoration: underline;
}

/* Header: centred name and contact line, round photo on the right */

.cv-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
}

.identity {
  text-align: center;
}

h1 {
  margin: 0 0 0.6rem;
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 1rem;
  line-height: 1.8;
}

.contact a {
  color: var(--ink);
}

.contact i {
  margin-right: 0.35rem;
  font-size: 0.8em;
}

/* Top download button: outlined so it reads as an action without competing with the name */
.identity .download-cv {
  margin-top: 0.9rem;
  padding: 0.3rem 0.95rem;
  background: transparent;
  color: var(--primary);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.identity .download-cv:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.photo {
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--primary);
}

/* Sections */

section {
  margin-top: 1.1rem;
}

h2 {
  margin: 0 0 0.5rem;
  padding-bottom: 0.1rem;
  border-bottom: 1px solid var(--rule);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
}

.entry,
.highlights,
.line,
.note,
.badge {
  margin-inline: 0.3rem;
}

.entry {
  display: grid;
  grid-template-columns: 1fr minmax(8rem, auto);
  gap: 0 1.5rem;
  margin-top: 0.55rem;
}

.entry.compact {
  margin-top: 0.3rem;
}

.entry .side {
  text-align: right;
  white-space: nowrap;
}

.highlights {
  margin-top: 0.2rem;
  margin-bottom: 0;
  padding-left: 1.6rem;
  list-style: "∘";
}

.highlights li {
  padding-left: 0.6rem;
}

.highlights li::marker {
  font-size: 1.25em;
  line-height: 1;
}

.highlights li + li {
  margin-top: 0.1rem;
}

.two-columns {
  columns: 2;
  column-gap: 1.5rem;
}

.two-columns li {
  break-inside: avoid;
}

.line,
.note {
  margin-top: 0.45rem;
  margin-bottom: 0;
}

.external::after {
  content: "\f35d";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.7em;
  margin-left: 0.3em;
  vertical-align: 0.1em;
}

.external + .external {
  margin-left: 1rem;
}

.badge {
  display: block;
  width: 7.5rem;
  height: auto;
  margin-top: 0.5rem;
}

.closing {
  margin: 2rem 0 0;
  text-align: center;
}

footer {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-style: italic;
  text-align: center;
}

/* Download dialog */

dialog {
  width: min(30rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.dialog-body {
  position: relative;
  padding: 1.25rem 1.25rem 1.1rem;
}

.dialog-body h2 {
  padding-right: 2rem;
}

.dialog-close {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-text {
  margin: 0.6rem 0 0;
}

#cv-form {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.field {
  display: grid;
  gap: 0.2rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

#cv-form label {
  font-weight: 700;
}

#cv-form .optional {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

#cv-form input,
#cv-form select,
#cv-form textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid #8a8a8a;
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

#cv-form textarea {
  min-height: 4.5rem;
  resize: vertical;
}

#cv-form input:focus-visible,
#cv-form select:focus-visible,
#cv-form textarea:focus-visible {
  border-color: var(--primary);
}

#cv-form .button {
  justify-self: start;
}

.cf-turnstile {
  min-height: 65px;
}

.status {
  margin: 0;
  color: var(--error);
}

.status:empty {
  display: none;
}

.notice {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 1rem 0 0;
}

/* Narrow screens: photo above the name, dates under titles, one column */

@media (max-width: 40rem) {
  body {
    font-size: 1.0625rem;
  }

  .page {
    padding-top: 1.75rem;
  }

  .cv-header {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 1rem;
  }

  .photo {
    grid-row: 1;
    width: 6rem;
    height: 6rem;
  }

  h1 {
    font-size: 2.2rem;
  }

  .entry {
    grid-template-columns: 1fr;
  }

  .entry .side {
    text-align: left;
    white-space: normal;
  }

  .two-columns {
    columns: 1;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .external + .external {
    margin-left: 0;
  }

  .external {
    display: inline-block;
    margin-right: 1rem;
  }
}

@media print {
  .download-cv,
  .closing,
  dialog,
  footer {
    display: none;
  }
}
