/* ==========================================================================
   CV styles
   Everything you are likely to change is in the SETTINGS block below.
   The rest of the file maps one HTML element to one style, top to bottom.
   ========================================================================== */

/* ------------------------------- SETTINGS -------------------------------- */
:root {
  /* Colours */
  --accent: #1f5a6b;      /* top bar, headline, section titles, company, bullets */
  --ink: #10181b;         /* name, job titles, skill labels */
  --text: #28343a;        /* body text */
  --text-soft: #3c484c;   /* contact details */
  --muted: #5a676b;       /* dates and tech stack */
  --rule: #d5dcde;        /* thin divider lines */

  /* Fonts (loaded in cv.html from Google Fonts) */
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;

  /* Font sizes */
  --size-name: 40px;
  --size-headline: 14px;
  --size-job: 15px;
  --size-body: 11px;
  --size-small: 10.5px;     /* contact, dates, skills */
  --size-stack: 10px;
  --size-section: 10px;

  /* Spacing */
  --page-margin: 44px;    /* left and right edge of the sheet */
  --line: 1.36;           /* line height of body text */
  --gap-section: 13px;    /* space above a section title */
  --gap-job: 5px;         /* space between two jobs */
  --gap-bullet: 2.3px;    /* space between two bullets */
  --label-width: 104px;   /* first column of the skills table */
  --bar-height: 10px;     /* coloured bar at the top */
}

/* --------------------------------- PAGE ---------------------------------- */
@page { size: A4; margin: 12mm 0; }
@page :first { margin-top: 0; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

body {
  width: 210mm;
  padding: 0 var(--page-margin);
  border-top: var(--bar-height) solid var(--accent);
  font: 400 var(--size-body) / var(--line) var(--sans);
  color: var(--text);
  background: #fff;
}

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

/* -------------------------------- HEADER --------------------------------- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 25px 0 14px;
  border-bottom: 1px solid var(--rule);
}

.photo {
  flex: none;
  width: 62px;
  height: 62px;
  margin-right: 14px;
  border-radius: 50%;
  object-fit: cover;
}

/* The name block takes the free space, so the contact details stay right. */
.header > div { flex: 1; }

h1 {
  font: 600 var(--size-name) / 1.1 var(--serif);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.headline {
  font-size: var(--size-headline);
  font-weight: 500;
  line-height: 1.3;
  margin: 2px 0 1px;
  color: var(--accent);
}

.contact {
  list-style: none;
  text-align: right;
  font-size: var(--size-small);
  line-height: 1.475;
  color: var(--text-soft);
}

/* ------------------------------- SECTIONS -------------------------------- */
section { margin-top: var(--gap-section); }

h2 {
  margin-bottom: 4px;
  font: 500 var(--size-section) / 1.6 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

/* A section with a divider line above it */
section.divided {
  margin-top: 15px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}

/* --------------------------------- JOBS ---------------------------------- */
.job {
  padding-top: 4px;
  break-inside: avoid;
}
.job + .job { margin-top: var(--gap-job); }

.job header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

h3 {
  font: 600 var(--size-job) / 1.3 var(--serif);
  color: var(--ink);
}

.company {
  font-weight: 500;
  color: var(--accent);
}
.company::before { content: "— "; }

time {
  font-size: var(--size-small);
  color: var(--muted);
  white-space: nowrap;
}

.stack {
  margin: 5px 0;
  font-size: var(--size-stack);
  color: var(--muted);
}

/* -------------------------------- BULLETS -------------------------------- */
.job ul { list-style: none; }

.job li {
  position: relative;
  padding-left: 12px;
}
.job li + li { margin-top: var(--gap-bullet); }

/* Company names inside a bullet */
.job li strong {
  font-weight: 600;
  color: var(--ink);
}

.job li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.48em;
  width: 4px;
  height: 4px;
  background: var(--accent);
}

/* ----------------------------- SKILLS TABLE ------------------------------ */
dl {
  display: grid;
  grid-template-columns: var(--label-width) 1fr;
  row-gap: 2px;
  font-size: var(--size-small);
  color: var(--ink);
}

dt { font-weight: 600; }

/* ------------------------------- WEB PAGE -------------------------------- */
/* Everything below changes only how the page looks in a browser.
   The PDF always uses SETTINGS above.

   There are two browser layouts:
   1. Reading layout: one column. Used on phones and narrow windows.
   2. Sidebar layout: a centered sheet with name, contact details and
      skills on the left, profile and experience on the right.
      Used when the window is at least 960px wide. */
.download { display: none; }

/* ----- 1. Reading layout ----- */
@media screen {
  :root {
    --size-name: clamp(34px, 7vw, 50px);
    --size-headline: 19px;
    --size-job: 20px;
    --size-body: 16px;
    --size-small: 15px;
    --size-stack: 14px;
    --size-section: 12.5px;

    --page-margin: clamp(20px, 6vw, 64px);
    --line: 1.55;
    --gap-section: 30px;
    --gap-job: 22px;
    --gap-bullet: 6px;
    --label-width: 150px;
  }

  html { background: #e8ebec; }

  body {
    width: auto;
    max-width: 860px;
    margin: 32px auto 96px;
    padding-bottom: 56px;
    box-shadow: 0 2px 16px rgb(0 0 0 / 0.15);
  }

  .header {
    gap: 24px;
    padding: 40px 0 24px;
  }
  .photo {
    width: 72px;
    height: 72px;
    margin-right: 0;
  }
  .headline { margin-top: 6px; }
  .contact { line-height: 1.6; }
  a:hover { text-decoration: underline; }
  .contact a:hover { color: var(--accent); }
  .download {
    display: block;
    font-weight: 600;
    color: var(--accent);
  }

  h2 { margin-bottom: 10px; }
  section.divided {
    margin-top: 30px;
    padding-top: 22px;
  }

  .job header { gap: 16px; }
  .company { white-space: nowrap; }
  .stack { margin: 6px 0 10px; }
  .job li { padding-left: 18px; }
  .job li::before {
    top: calc((1lh - 5px) / 2);
    width: 5px;
    height: 5px;
  }

  dl { row-gap: 8px; }
}

/* Phones and narrow windows: one column, edge to edge. */
@media screen and (max-width: 700px) {
  body {
    margin: 0;
    box-shadow: none;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding-top: 28px;
  }
  .contact { text-align: left; }

  .job header {
    flex-direction: column;
    gap: 2px;
  }
  .company { white-space: normal; }

  dl {
    grid-template-columns: 1fr;
    row-gap: 0;
  }
  dd { margin-bottom: 12px; }
}

/* ----- 2. Sidebar layout ----- */
@media screen and (min-width: 960px) {
  :root {
    --side: 330px;          /* width of the sidebar */
    --size-name: 40px;
    --size-headline: 17px;
    --size-job: 19px;
    --size-body: 15.5px;
    --size-small: 14px;
    --size-stack: 13.5px;
    --size-section: 12px;
    --gap-job: 26px;
  }

  body {
    display: grid;
    grid-template-columns: var(--side) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 48px;
    max-width: 1200px;
    margin: 32px auto 64px;
    padding: 0 56px 0 0;
    background: linear-gradient(90deg, #eef3f4 var(--side), #fff 0);
  }

  /* Left: name and contact details, then skills */
  .header,
  body > section.divided {
    grid-column: 1;
    margin: 0;
    border: 0;
    padding: 0 30px 0 40px;
  }
  .header {
    grid-row: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 22px;
    padding-top: 40px;
  }
  .photo {
    width: 104px;
    height: 104px;
  }
  .contact { text-align: left; }
  body > section.divided {
    grid-row: 2;
    padding-top: 36px;
    padding-bottom: 48px;
  }
  dl {
    grid-template-columns: 1fr;
    row-gap: 0;
  }
  dd { margin-bottom: 12px; }

  /* Right: profile, then experience */
  main {
    grid-area: 1 / 2 / 3 / 3;
    padding: 46px 0 56px;
  }
  .profile { margin: 0; }
  main > section + section {
    margin-top: 30px;
    padding-top: 28px;
    border-top: 1px solid var(--rule);
  }
}
