/* timeline.css */
:root {
  --tl-text: currentColor;
  --tl-fg: currentColor;
  --tl-bg: rgba(255, 255, 255, 0.06);
  --tl-border: rgba(255, 255, 255, 0.35);
  --tl-muted: rgba(255, 255, 255, 0.55);
  --tl-line-x: 18px;
}

#cv {
  width: 685px;
}

.timeline-wrapper {
  margin-top: 40px;
}

.timeline-print-panel {
  margin-top: 36px;
  padding: 0;
  border: none;
  background: transparent;
}

.timeline-print-panel h2 {
  margin: 0 0 10px;
  font-size: 24px;
}

.timeline-print-panel p {
  margin: 0 0 18px;
  line-height: 1.4;
}

.timeline-print-button {
  font: inherit;
  color: var(--print-fg);
  cursor: pointer;
  background: transparent !important;
  border-color: var(--print-fg);
  box-shadow: none;
}

.timeline-print-button:hover,
.timeline-print-button:focus,
.timeline-print-button:active {
  color: var(--print-bg) !important;
  background: var(--print-fg) !important;
  border-color: var(--print-fg) !important;
  box-shadow: none;
}

.timeline-print-actions {
  display: flex;
  width: auto;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.timeline-print-actions > li {
  display: block;
  width: auto;
  margin: 0;
  overflow: visible;
  text-align: center;
  vertical-align: middle;
}

.cv-print-sheet {
  display: none;
}

.cv-print-header h1,
.cv-print-header p,
.cv-print-block h2,
.cv-print-experience h3,
.cv-print-experience p,
.cv-print-definition-list,
.cv-print-definition-row,
.cv-print-bullets {
  margin: 0;
}

.cv-print-definition-list {
  display: grid;
  gap: 10px;
}

.cv-print-definition-row dt {
  font-weight: 700;
  margin-bottom: 2px;
}

.cv-print-definition-row dd {
  margin: 0;
}

.cv-print-bullets {
  padding-left: 18px;
}

.cv-print-bullets li + li {
  margin-top: 4px;
}

.cv-print-bullets-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding-left: 18px;
}

.timeline-container {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  color: var(--tl-text);
}

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

.timeline-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--tl-border);
}

.timeline-header h1 {
  margin: 0;
  font-size: 2.2em;
  font-weight: 700;
}

.timeline-main {
  display: flex;
  gap: 20px;
  position: relative;
}

.timeline-scale {
  width: 40px;
  flex-shrink: 0;
  position: relative;
}

.timeline-scale-item {
  position: absolute;
  left: 0;
  font-size: 14px;
  font-weight: 500;
  opacity: 0.4;
  transition: opacity 0.3s;
  padding: 4px 8px;
}

.timeline-scale-item.active {
  opacity: 1;
  font-weight: 700;
}

.timeline-rails {
  display: flex;
  flex: 1;
  position: relative;
}

.timeline-rail {
  flex: 1;
  min-width: 250px;
  position: relative;
  /* On ajoute un padding en haut pour laisser la place au label sans décaler le "0" */
  padding-top: 60px;
}

.timeline-rail-label {
  position: absolute;
  /* Sort du flux pour ne pas pousser la ligne et les événements */
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  font-weight: 600;
  padding: 8px 12px;
  /* background: var(--tl-bg);*/
  z-index: 5;
  text-align: center;
}

.timeline-rail-line {
  position: absolute;
  left: var(--tl-line-x);
  transform: translateX(-50%);
  width: 2px;
  background: var(--tl-border);
  top: 60px;
  /* Aligné avec le début des événements */
}

.timeline-event {
  position: absolute;
  /* CRUCIAL : l'événement ne doit pas pousser les autres */
  left: 0;
  right: 0;
  /* On retire le margin-bottom et le padding-left du flux normal */
  margin: 0;
  padding: 0;
}

.timeline-event-marker {
  position: absolute;
  left: var(--tl-line-x);
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  top: -2px;
  border-radius: 50%;
  background: var(--tl-fg);
  cursor: pointer;
  transition: all 0.3s;
  z-index: 3;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
  /* Default for others if any */
}

/* Hide marker for periods */
.timeline-event.is-period .timeline-event-marker {
  display: none;
}

/* Triangle for point events */
.timeline-event.is-point .timeline-event-marker {
  width: 0;
  height: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 10px solid var(--tl-fg);
  /* Adjust centering */
  transform: translateX(-10px) translateY(0);
}


.timeline-event.is-point .timeline-event-card {
  border: none;
  box-shadow: none !important;
  background: transparent;
  margin-top: -10px;
  padding-left: 0;
}

.timeline-event.is-point.active .timeline-event-card {
  /* Restore or keep distinct style for active points if needed? */
  /* User didn't specify, but often 'active' implies highlighting. 
     If we remove border/shadow, maybe we keep text color or just rely on marker. */
  box-shadow: none;
}

.timeline-event-period {
  position: absolute;
  left: var(--tl-line-x);
  transform: translateX(-50%);
  width: 6px;
  background: var(--tl-border);
  z-index: 2;
  border-radius: 999px;
}

.timeline-event.is-ongoing .timeline-event-card {
  border-bottom: 1px dashed var(--tl-fg);
  padding-bottom: 18px;
}

.timeline-event.is-ongoing .timeline-event-period {
  border-radius: 999px 999px 0 0;
}

.timeline-event-card {
  position: relative;
  overflow: visible;
  line-height: 0.9;
  background: var(--tl-bg);
  border: 1px solid var(--tl-fg);
  padding: 8px;
  margin-left: 8%;
  transition: all 0.3s;
}

.timeline-event.active .timeline-event-card {
  border-color: var(--tl-fg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.timeline-event-title {
  font-weight: 600;
  margin: 0 0 6px 0;
  font-size: 12px;
  line-height: 1;
  position: relative;
  /* Allow tooltip anchor */
  display: inline-block;
  cursor: help;
}

.timeline-event-title small {
  font-weight: 400;
  font-size: 10px;
  color: var(--tl-muted);
  margin-right: 6px;
  display: inline-block;
}

.timeline-event-text {
  display: none;
  position: absolute;
  bottom: 100%;
  /* Tooltip above */
  left: 0;
  width: 280px;
  background: #222;
  color: #eee;
  padding: 10px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 100;
  margin-bottom: 10px;
  pointer-events: none;
}

/* Light mode fallback for tooltip */
@media (prefers-color-scheme: light) {
  .timeline-event-text {
    background: #fff;
    color: #222;
    border: 1px solid #ddd;
  }
}

.timeline-event-title:hover+.timeline-event-text {
  display: block;
}

.timeline-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
}

.timeline-modal.is-open {
  display: flex;
}

.timeline-modal-dialog {
  width: min(100%, 460px);
  max-height: min(80vh, 700px);
  overflow: auto;
  background: var(--tl-bg);
  color: var(--tl-text);
  border: 1px solid var(--tl-fg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  padding: 16px;
}

.timeline-modal-title {
  margin: 0 0 10px 0;
  font-size: 16px;
  line-height: 1.2;
}

.timeline-modal-date {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--tl-muted);
}

.timeline-modal-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.timeline-modal-close {
  display: inline-block;
  margin-top: 14px;
}

/* Tooltip Arrow */
.timeline-event-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 20px;
  border-width: 6px;
  border-style: solid;
  border-color: #222 transparent transparent transparent;
}

@media (prefers-color-scheme: light) {
  .timeline-event-text::after {
    border-color: #fff transparent transparent transparent;
  }
}

.timeline-event-media {
  margin-top: 12px;
}

.timeline-event-media img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--tl-border);
}

.timeline-event-media-caption {
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.7;
}

.timeline-fallback {
  text-align: center;
  opacity: 0.7;
  padding: 20px 0;
}

@media (max-width: 900px) {
  .timeline-container {
    --tl-line-x: 14px;
  }

  #cv {
    width: 100%;
    padding: 0;
    box-sizing: border-box;
  }

  .timeline-main {
    flex-direction: row;
    align-items: flex-start;
  }

  .timeline-scale {
    width: 52px;
  }

  .timeline-scale-item {
    flex-shrink: 0;
  }

  .timeline-rails {
    min-width: 0;
    flex-direction: row;
    gap: 12px;
  }

  .timeline-rail {
    min-width: 0;
    width: auto;
  }

  .timeline-event-card {
    margin-left: 24px;
    padding: 6px;
  }

  .timeline-event-title {
    font-size: 11px;
  }

  .timeline-event-title small {
    font-size: 9px;
  }

  .timeline-rail-label {
    font-size: 14px;
    padding: 8px 4px;
  }
}

@media (max-width: 520px) {
  .timeline-scale {
    width: 40px;
  }

  .timeline-main {
    gap: 8px;
  }

  .timeline-rails {
    gap: 8px;
  }

  .timeline-container {
    --tl-line-x: 10px;
  }

  .timeline-event-card {
    margin-left: 18px;
    padding: 5px;
  }

  .timeline-event-title {
    font-size: 10px;
    line-height: 1.05;
  }

  .timeline-event-title small {
    display: block;
    margin: 0 0 4px 0;
    font-size: 8px;
  }
}

@media (hover: none), (pointer: coarse) {
  .timeline-event-title {
    cursor: pointer;
  }

  .timeline-event-title:hover + .timeline-event-text {
    display: none;
  }
}

@media print {
  @page {
    size: A4;
    margin: 14mm 12mm;
  }

  html,
  body {
    background: #fff !important;
    color: #111 !important;
    font-family: Georgia, "Times New Roman", serif;
  }

  body > * {
    display: none !important;
  }

  #cv,
  #cv .cv-print-sheet {
    display: block !important;
  }

  #cv {
    width: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    color: #111 !important;
  }

  #cv > header,
  #cv .timeline-wrapper,
  #cv .timeline-print-panel,
  nav,
  footer,
  #front-end-dev,
  #references,
  #picPalette,
  #colorBar {
    display: none !important;
  }

  .cv-print-sheet {
    font-size: 11pt;
    line-height: 1.35;
  }

  .cv-print-header {
    border-bottom: 2px solid #111;
    padding-bottom: 8mm;
    margin-bottom: 8mm;
  }

  .cv-print-header h1 {
    font-size: 24pt;
    line-height: 1.1;
    margin-bottom: 3mm;
  }

  .cv-print-title {
    font-size: 13pt;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .cv-print-subtitle,
  .cv-print-contact {
    margin-top: 2mm;
    color: #444;
  }

  .cv-print-block + .cv-print-block {
    margin-top: 7mm;
  }

  .cv-print-block h2 {
    font-size: 12pt;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid #bbb;
    padding-bottom: 2mm;
    margin-bottom: 4mm;
  }

  .cv-print-experience + .cv-print-experience {
    margin-top: 5mm;
    padding-top: 4mm;
    border-top: 1px solid #ddd;
  }

  .cv-print-header {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cv-print-experience {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cv-print-experience-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 2mm;
  }

  .cv-print-experience-head h3 {
    font-size: 11.5pt;
    line-height: 1.2;
    font-weight: 700;
  }

  .cv-print-date {
    white-space: nowrap;
    color: #555;
    font-size: 10pt;
  }

  .cv-print-definition-list-inline {
    margin-top: 3mm;
  }

  .cv-print-definition-list-inline .cv-print-definition-row {
    margin-top: 2mm;
  }

  .cv-print-definition-list-inline dt {
    font-size: 9.5pt;
    text-transform: uppercase;
    color: #555;
  }

  .cv-print-definition-list-inline dd {
    font-size: 10pt;
  }

  a,
  a:visited {
    color: inherit !important;
    text-decoration: none !important;
  }
}
