@import url("../design/tokens.cf68e2506a35.css");

/*
 * Agenda V2-B.
 *
 * The composition order is normative and depends on the viewport and on whether
 * the current day is occupied. The template renders the horizon at both
 * contractual positions when a current-day section exists; this file reveals
 * exactly one per viewport with `display: none`, so the hidden variant leaves
 * both the tab order and the accessibility tree. No `order`, no reverse
 * direction and no absolute positioning is used to move a main region: the
 * visual order always equals the DOM order of the rendered elements.
 */

.agenda-v2 {
  display: grid;
  gap: var(--space-5);
  min-width: 0;
}

/* Focus is level 1: it stays quiet but comes first and reads largest. */
.agenda-focus {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
  padding: var(--space-3) 0;
  border-bottom: var(--border-width-default) solid var(--color-line);
}

.agenda-focus-state {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
  font-weight: var(--typography-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agenda-focus-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: var(--typography-weight-semibold);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.agenda-focus-title a,
.agenda-focus-next a,
.agenda-focus-conflict a {
  color: inherit;
}

/* M2 tient la ligne « Ensuite » sur une seule ligne tronquée : le titre complet
   reste lisible dans la chronologie et dans Détails. */
.agenda-focus-next {
  margin: 0;
  overflow: hidden;
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* M2 pose le titre et son espace sur la même ligne : la provenance reste
   textuelle et lisible sans consommer une ligne de plus. */
.agenda-focus-space {
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
  font-weight: var(--typography-weight-regular);
}

/* One signal, one sense: the conflict is legible without looking like an outage. */
.agenda-focus-conflict,
.agenda-entry-conflicts {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
}

.agenda-focus-conflict a,
.agenda-entry-conflicts a {
  text-decoration-style: dotted;
}

/* Horizon is level 2: no card, no shadow, no competing border. */
.agenda-horizon {
  min-width: 0;
}

.agenda-horizon-title {
  margin: 0 0 var(--space-1);
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
  font-weight: var(--typography-weight-semibold);
}

.agenda-horizon-cells {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
}

.agenda-horizon-cell > a,
.agenda-horizon-cell > span {
  display: grid;
  gap: 2px;
  min-height: 44px;
  padding: var(--space-1);
  border-radius: var(--radius-control);
  color: var(--color-ink);
  text-align: center;
  text-decoration: none;
}

.agenda-horizon-cell > a:hover,
.agenda-horizon-cell > a:focus-visible {
  background: var(--color-surface);
}

.agenda-horizon-cell > a:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus);
  outline-offset: 2px;
}

.agenda-horizon-cell--today > a,
.agenda-horizon-cell--today > span {
  font-weight: var(--typography-weight-semibold);
}

.agenda-horizon-day {
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
}

.agenda-horizon-value {
  font-variant-numeric: tabular-nums;
}

.agenda-horizon-marks {
  min-height: 1em;
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
}

/* Chronology */
.agenda-chronology {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.agenda-day {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  scroll-margin-top: var(--space-5);
}

.agenda-day-title {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  margin: 0;
  font-size: var(--typography-size-caption);
  font-weight: var(--typography-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.agenda-day-today {
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-ink);
}

.agenda-day-facts {
  text-transform: none;
  letter-spacing: 0;
  font-weight: var(--typography-weight-regular);
}

/* One day label is rendered per viewport; the other is removed outright. */
.agenda-day-date--short {
  display: none;
}

@media (max-width: 899px) {
  .agenda-day-date--long {
    display: none;
  }

  .agenda-day-date--short {
    display: inline;
  }
}

.agenda-entries {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.agenda-entry {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: var(--space-2) 0;
  scroll-margin-top: var(--space-5);
}

.agenda-entry--current .agenda-entry-title {
  font-weight: var(--typography-weight-semibold);
}

.agenda-entry-time {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: baseline;
  margin: 0;
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
  font-variant-numeric: tabular-nums;
}

.agenda-entry-state {
  color: var(--color-ink);
  font-weight: var(--typography-weight-semibold);
}

.agenda-allday-pill {
  padding: 0 var(--space-1);
  border: var(--border-width-default) solid var(--color-line);
  border-radius: var(--radius-control);
}

.agenda-entry-title {
  margin: 0;
  font-size: 1rem;
  font-weight: var(--typography-weight-regular);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.personal-involvement-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.25rem;
  border: var(--border-width-default) solid var(--color-line);
  border-radius: 999px;
  padding: 0 var(--space-1);
  background: var(--color-brand-soft);
  color: var(--color-brand-strong);
  font-size: var(--typography-size-caption);
  font-weight: var(--typography-weight-semibold);
  line-height: 1;
}

.agenda-entry-context {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
  overflow-wrap: anywhere;
}

/* Colour keeps representing the calendar; the workspace stays textual. */
.agenda-entry-calendar::before {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-right: 0.35em;
  border-radius: 50%;
  background: var(--calendar-color, var(--color-line));
}

.agenda-entry-details > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
  cursor: pointer;
}

.agenda-entry-details > summary:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus);
  outline-offset: 2px;
}

.agenda-entry-details-body {
  display: grid;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
}

.agenda-entry-meta {
  display: grid;
  gap: var(--space-1);
  margin: 0;
}

.agenda-entry-meta > div {
  display: grid;
  grid-template-columns: minmax(0, 10rem) minmax(0, 1fr);
  gap: var(--space-2);
}

.agenda-entry-meta dt {
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
}

.agenda-entry-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.agenda-entry-resources {
  margin: 0;
  padding-left: var(--space-3);
}

.agenda-now {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-muted);
  font-size: var(--typography-size-caption);
}

.agenda-now::after {
  content: "";
  flex: 1;
  height: var(--border-width-default);
  background: var(--color-line);
}

.agenda-empty {
  margin: 0;
  color: var(--color-muted);
}

.schedule-relative-periods {
  display: flex;
  /* Le panneau de contrôles devient une grille à trois colonnes au-delà de
     1040 px : la période relative occupe sa propre rangée plutôt que de décaler
     la portée, la perspective et l'éditeur de période hors du viewport. */
  grid-column: 1 / -1;
  flex: 1 0 100%;
  gap: var(--space-1);
}

.schedule-relative-periods a {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  border: var(--border-width-default) solid var(--color-line);
  border-radius: var(--radius-control);
  color: var(--color-ink);
  text-decoration: none;
}

.schedule-relative-periods a[aria-current="page"] {
  border-color: var(--color-ink);
  font-weight: var(--typography-weight-semibold);
}

.schedule-relative-periods a:focus-visible {
  outline: var(--border-width-focus) solid var(--color-focus);
  outline-offset: 2px;
}

/*
 * Exactly one horizon instance is rendered at any viewport.
 * `display: none` removes the other from the tab order and from the
 * accessibility tree, so the rendered order is unambiguous.
 */
.agenda-horizon--mobile {
  display: block;
}

.agenda-horizon--desktop {
  display: none;
}

@media (min-width: 900px) {
  .agenda-horizon--mobile {
    display: none;
  }

  .agenda-horizon--desktop {
    display: block;
  }

  /* Controlled reading width; focus and horizon share the first band.
     Two-dimensional placement, not a reorder: reading the first band left to
     right then moving down yields focus, horizon, chronology — the DOM order. */
  .agenda-v2 {
    max-width: 980px;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
    column-gap: var(--space-4);
  }

  .agenda-v2 > .agenda-focus {
    grid-column: 1;
  }

  .agenda-v2 > .agenda-horizon--desktop,
  .agenda-v2 > .agenda-horizon--single {
    grid-column: 2;
  }

  .agenda-v2 > .agenda-chronology,
  .agenda-v2 > .agenda-empty {
    grid-column: 1 / -1;
  }

  .agenda-entry {
    grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr);
    column-gap: var(--space-3);
  }

  /* Two-dimensional placement, not a reorder: reading left to right then top to
     bottom still yields time, title, context, conflict, Détails — the DOM order. */
  .agenda-entry-time {
    grid-column: 1;
    grid-row: 1 / -1;
  }

  .agenda-entry-title,
  .agenda-entry-context,
  .agenda-entry-conflicts,
  .agenda-entry-details {
    grid-column: 2;
  }
}

@media (max-width: 640px) {
  /* La bande de contrôles est le bloc non-contenu le plus coûteux en hauteur.
     Perspective et période relative sont deux commandes compactes de même
     nature : les poser sur une rangée partagée rend l'accès explicite à
     14 jours sans repousser le premier engagement hors de l'enveloppe de
     visibilité validée par M1 et M2. Les deux reçoivent le même `order` pour
     que leur placement explicite ne crée pas de rangée supplémentaire. */
  .schedule-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule-controls > .schedule-controls-close,
  .schedule-controls > .schedule-mobile-settings {
    grid-column: 1 / -1;
  }

  .schedule-controls > .schedule-mobile-view-switch {
    grid-column: 1;
    order: 1;
  }

  .schedule-controls > .schedule-relative-periods {
    grid-column: 2;
    order: 1;
  }

  .schedule-relative-periods a {
    flex: 1;
    justify-content: center;
    padding: 0 var(--space-2);
  }
}

@media (max-width: 899px) {
  .agenda-v2 {
    gap: var(--space-3);
  }

  /* La portée est déjà annoncée par le résumé des réglages mobiles : la répéter
     ici ne fait que repousser le premier engagement hors du budget perceptuel. */
  .schedule-context-line {
    display: none;
  }

  .agenda-focus {
    padding: var(--space-2) 0;
  }

  .agenda-horizon-title {
    margin-bottom: 2px;
  }

  /* L'horizon est de niveau 2 : sous le point de rupture desktop il reste une
     bande de repères dense, jamais un second bloc de premier plan. */
  .agenda-horizon-cell > a,
  .agenda-horizon-cell > span {
    gap: 0;
    padding: 2px 0;
    line-height: 1.15;
  }

  .agenda-horizon-day,
  .agenda-horizon-value,
  .agenda-horizon-marks {
    font-size: var(--typography-size-caption);
  }

  .agenda-horizon-marks {
    min-height: 0;
  }

  .agenda-horizon-marks:empty {
    display: none;
  }

  .agenda-chronology {
    gap: var(--space-3);
  }

  /* M2 annonce le jour par sa date courte et ses faits, sans badge : le focus
     dit déjà ce qui est en cours, et la ligne doit tenir sans repli. */
  .agenda-day-today {
    display: none;
  }

  /* Le titre du focus reste lisible mais borné : son texte intégral vit dans la
     chronologie et dans Détails, et le premier engagement doit rester dans
     l'enveloppe de visibilité validée par M1 et M2. */
  .agenda-focus-title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
}
