:root {
  --accent: #849cff;
  --accent-strong: #737dff;
  --accent-soft: #ffb6b6;
  --accent-danger: #ff7373;
  --text: #2b2b2b;
  --muted: #5f5f5f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  padding: 24px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  background-color: #f2f2f2;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  line-height: 1.35;
}

@page {
  size: A4 portrait;
  margin: 8mm;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

h1 {
  margin: 0 0 0.8rem;
  text-align: center;
  font-family: 'Sen', serif;
  font-size: 1.7rem;
  letter-spacing: 0.04em;
  color: #222;
}

.hero {
  margin-bottom: 0.75rem;
}

.left {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.95rem 1.1rem;
  margin: 0;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

img {
  width: 120px;
  height: 120px;
  display: block;
  border-radius: 14px;
  object-fit: cover;
}

.contact-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 220px;
  font-size: 0.95rem;
}

.contact-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.contact-list i {
  color: var(--accent);
}

main {
  display: flex;
  width: 100%;
  gap: 18px;
  align-items: flex-start;
}

.left-side {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(32%, 260px);
  flex-shrink: 0;
}

.right {
  flex: 1;
  min-width: 0;
}

.skills-resume {
  position: relative;
  border: 2px dashed #d8c8f0;
  border-radius: 14px;
  padding: 20px 14px 12px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.skills-resume .title {
  display: inline-block;
  position: absolute;
  top: -10px;
  left: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.skills-resume > div {
  color: white;
  background: var(--accent);
  padding: 0.45rem 0.7rem;
  margin-bottom: 0.45rem;
  border-radius: 999px;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.skills-resume > div:last-child {
  margin-bottom: 0;
}

.skills-resume.green {
  border-color: #8fa0ff;
}

.skills-resume.green > div {
  background: var(--accent-strong);
}

.skills-resume.green > .title {
  background: var(--accent-strong);
}

.skills-resume.red {
  border-color: #ffcccc;
}

.skills-resume.red > div {
  background: var(--accent-danger);
}

.skills-resume.red > .title {
  background: var(--accent-danger);
}

.parcours {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0.8rem 0.95rem 0.35rem 0.7rem;
  margin-bottom: 0.7rem;
  border: 2px dashed #303030;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
  --year-width: 84px;
}

.parcours::before {
  content: "";
  position: absolute;
  left: calc(0.7rem + var(--year-width) / 2);
  top: 0.8rem;
  bottom: 0.7rem;
  width: 1px;
  background: linear-gradient(to bottom, rgba(48, 48, 48, 0.15), rgba(48, 48, 48, 0.8));
}

.parcours > .title {
  display: inline-block;
  align-self: flex-start;
  background: #000;
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.skill-line {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  width: 100%;
  padding: 0.5rem 0;
  border-bottom: 1px dashed #cfcfcf;
}

.skill-line:last-child {
  border-bottom: none;
}

.year {
  width: var(--year-width);
  flex-shrink: 0;
  display: grid;
  gap: 0.3rem;
  font-weight: 700;
  color: #444;
  font-size: 0.84rem;
  line-height: 1.1;
  padding-left: 0;
}

.date-line {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) 0.85rem minmax(0, 1fr);
  align-items: center;
  gap: 0.4rem;
}

.date-line::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(132, 156, 255, 0.2);
}

.date-month {
  grid-column: 1;
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

.date-year {
  grid-column: 3;
  justify-self: start;
  text-align: left;
  white-space: nowrap;
}

.year .date-value {
  display: none;
}

.skill {
  flex: 1;
  min-width: 0;
  text-align: start;
}

.skill p {
  margin: 0 0 0.3rem;
  font-size: 0.82rem;
  line-height: 1.2;
}

.skill > p:nth-child(1) {
  font-weight: 700;
  font-size: 0.9rem;
  color: #111;
}

.skill > p:nth-child(2) {
  font-weight: 700;
  margin-top: 0;
  color: #555;
}

.projects-section > .title {
  margin-bottom: 0.65rem;
  font-size: 1.05rem;
}

.projects-section .project-row {
  display: grid;
  grid-template-columns: var(--year-width) minmax(0, 1fr);
  align-items: start;
  gap: 0.9rem;
}

.projects-section .project-date {
  width: var(--year-width);
}

.project-details h3 {
  margin: 0 0 0.2rem;
  color: #111;
  font-size: 0.95rem;
  line-height: 1.2;
}

.project-details .project-link {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: #555;
  font-size: 0.82rem;
  font-weight: 700;
  text-underline-offset: 0.15em;
}

.project-details p {
  margin: 0;
}

@media screen and (max-width: 700px) {
  body {
    padding: 0 12px 24px;
  }

  main {
    flex-direction: column;
  }

  .left-side {
    width: 100%;
  }

  .left {
    width: 100%;
    height: auto;
    overflow: auto;
  }

  img {
    margin: 0 auto;
  }

  .skill-line {
    flex-direction: column;
    gap: 0.5rem;
  }

  .projects-section .project-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .projects-section .project-date {
    width: var(--year-width);
  }

  .year {
    width: auto;
  }

  /* Restore timeline position for narrow screens */
  .parcours::before {
    left: 0.7rem;
  }

  .date-line::before {
    left: 50%;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  html,
  body {
    width: 210mm;
    height: auto;
    overflow: visible;
    margin: 0;
    padding: 0;
    background: #fff;
    font-size: 8.4px;
  }

  body {
    padding: 0;
  }

  .page {
    width: 210mm;
    min-width: 210mm;
    max-width: 210mm;
    margin: 0;
    padding: 0;
    transform: scale(0.95);
    transform-origin: top left;
  }

  .hero {
    margin-bottom: 0.18rem;
  }

  h1 {
    margin-bottom: 0.18rem;
    font-size: 1rem;
  }

  .left {
    padding: 0.25rem 0.4rem;
    border-radius: 0;
    box-shadow: none;
    gap: 0.3rem;
  }

  img {
    width: 70px;
    height: 70px;
    border-radius: 8px;
  }

  .contact-list {
    min-width: 0;
    gap: 0.12rem;
    font-size: 0.66rem;
  }

  .contact-list li {
    gap: 0.2rem;
  }

  main {
    gap: 6px;
    align-items: flex-start;
  }

  .left-side {
    width: 24%;
    gap: 0.25rem;
  }

  .skills-resume {
    padding: 10px 8px 8px;
    border-radius: 6px;
    box-shadow: none;
    page-break-inside: avoid;
  }

  .skills-resume .title {
    top: -7px;
    left: 8px;
    padding: 2px 5px;
    font-size: 0.64rem;
  }

  .skills-resume > div {
    padding: 0.18rem 0.4rem;
    margin-bottom: 0.18rem;
    font-size: 0.62rem;
  }

  .parcours {
    padding: 0.18rem 0.45rem 0.08rem 1rem;
    border-radius: 6px;
    box-shadow: none;
    margin-bottom: 0.2rem;
    page-break-inside: avoid;
  }

  .parcours::before {
    left: calc(1rem + var(--year-width) / 2);
    top: 0.55rem;
    bottom: 0.3rem;
  }

  .parcours > .title {
    font-size: 0.74rem;
    padding: 0.14rem 0.36rem;
    margin-bottom: 0.16rem;
  }

  .skill-line {
    gap: 0.3rem;
    padding: 0.14rem 0;
    page-break-inside: avoid;
  }

  .year {
    width: var(--year-width);
    font-size: 0.58rem;
  }

  .skill p {
    margin-bottom: 0.1rem;
    font-size: 0.6rem;
    line-height: 1.04;
  }

  .skill > p:nth-child(1) {
    font-size: 0.64rem;
  }

  .skill > p:nth-child(2) {
    font-size: 0.6rem;
  }

  .parcours,
  .skill-line,
  .skills-resume {
    break-inside: avoid;
  }
}
