/*
 * The Chore Chart Builder (KID-1324): the form's custom chores and day boxes, and the printable weekly chart in its
 * theme's colors, which the service sets (--kp-chart-*), printed as they are.
 */
@layer pages {
  .kp-chore-chart__custom {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    gap: var(--kp-space-2);
  }

  .kp-chore-chart__days .kp-checks {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  @media (max-width: 30rem) {
    .kp-chore-chart__days .kp-checks {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
  }

  .kp-chore-chart {
    --kp-chart-primary: #3b82f6;
    --kp-chart-secondary: #1e40af;
    --kp-chart-accent: #93c5fd;
    --kp-chart-bg: #eff6ff;
    display: flex;
    flex-direction: column;
    gap: var(--kp-space-5);
  }

  .kp-chore-chart__head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--kp-space-2);
    text-align: center;
  }

  .kp-chore-chart__head > span {
    font-size: 2.75rem;
    line-height: 1;
  }

  .kp-chore-chart__head h2 {
    color: var(--kp-chart-secondary);
    font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
    line-height: var(--kp-heading-leading);
    overflow-wrap: anywhere;
  }

  .kp-chore-chart__head p {
    display: flex;
    align-items: baseline;
    gap: var(--kp-space-2);
    color: var(--kp-ink-2);
  }

  .kp-chore-chart__blank {
    display: inline-block;
    min-width: 8rem;
    border-block-end: 1.5px solid var(--kp-ink-2);
  }

  .kp-chore-chart .kp-result__table-wrap {
    border: 2px solid var(--kp-chart-primary);
  }

  /* The days share the width evenly; on a phone the chart scrolls sideways rather than squeezing them */
  .kp-chore-chart__grid {
    min-width: 46rem;
    table-layout: fixed;
  }

  .kp-chore-chart__grid thead th:first-child {
    width: 32%;
  }

  .kp-chore-chart__grid thead th {
    background: var(--kp-chart-primary);
    color: #ffffff;
    text-align: center;
  }

  .kp-chore-chart__grid thead th:first-child {
    text-align: start;
  }

  .kp-chore-chart__grid tbody th {
    background: var(--kp-chart-bg);
    overflow-wrap: anywhere;
  }

  .kp-chore-chart__grid td {
    border-inline-start: 1px solid var(--kp-border);
    text-align: center;
    vertical-align: middle;
  }

  .kp-chore-chart__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid var(--kp-chart-accent);
    border-radius: 0.375rem;
  }

  .kp-chore-chart__mark--star {
    border: 0;
    color: var(--kp-chart-accent);
    font-size: 1.75rem;
    line-height: 1;
  }

  .kp-chore-chart__foot {
    display: flex;
    flex-direction: column;
    gap: var(--kp-space-3);
    padding: var(--kp-space-5);
    border-radius: var(--kp-radius-md);
    background: var(--kp-chart-bg);
    break-inside: avoid;
  }

  .kp-chore-chart__foot p {
    color: var(--kp-ink-2);
    line-height: var(--kp-body-leading);
  }

  .kp-chore-chart__foot dl {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kp-space-3) var(--kp-space-8);
    margin: 0;
  }

  .kp-chore-chart__foot dl > div {
    display: flex;
    align-items: baseline;
    gap: var(--kp-space-2);
  }

  .kp-chore-chart__foot dt {
    color: var(--kp-chart-secondary);
    font-weight: 800;
  }

  .kp-chore-chart__foot dd {
    margin: 0;
    font-weight: 700;
  }
}
