/* What the DSFR does not cover, in DSFR colour tokens so the dark theme follows.
   Every rule is scoped under .fico, the class each element puts on itself. */

.fico {
  .line {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
  }

  /* Each component grows in proportion to its share of the line; below 20rem
     it wraps to a line of its own. */
  .line > * {
    display: block;
    flex: var(--width, 1) 1 0;
    min-width: min(20rem, 100%);
  }

  /* Panels side by side keep the height of the tallest. */
  .fr-callout {
    height: 100%;
  }

  .muted {
    color: var(--text-mention-grey);
  }

  .definitions {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.2rem 1.2rem;
    margin: 0;

    dt {
      color: var(--text-mention-grey);
    }

    dd {
      margin: 0;
      font-weight: 500;
    }
  }

  /* Chiffres */

  .tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 1rem;
  }

  .histogram {
    position: relative;
    height: 9rem;
    margin: 0.5rem 0 1.5rem 3.5rem;
  }

  .histogram-tick {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(var(--share) * 100%);
    border-top: 1px solid var(--border-default-grey);

    span {
      position: absolute;
      right: calc(100% + 0.4rem);
      transform: translateY(-50%);
      font-size: 0.7rem;
      color: var(--text-mention-grey);
      white-space: nowrap;
    }
  }

  .histogram-bars {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
  }

  .histogram-bar {
    position: relative;
    flex: 1;
    height: calc(var(--share) * 100%);
    background: var(--background-action-high-blue-france);

    span {
      position: absolute;
      top: 100%;
      left: 50%;
      transform: translateX(-50%);
      font-size: 0.7rem;
      color: var(--text-mention-grey);
    }
  }

  .amounts {
    width: 100%;

    td:last-child {
      text-align: right;
      font-weight: 500;
    }
  }

  /* Carto */

  .maps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 1rem;
  }

  .map {
    display: block;
    width: 100%;
    height: 18rem;

    path {
      vector-effect: non-scaling-stroke;
      stroke-width: 0.6px;
    }

    path.focus {
      stroke-width: 2px;
    }

    path:hover {
      opacity: 0.75;
    }
  }

  .legend {
    color: var(--text-mention-grey);
  }

  .legend-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.2rem;
  }

  .swatch {
    display: inline-block;
    width: 1rem;
    height: 0.5rem;
  }
}
