/* iPad / tablet Blotter layout v5
   WEEK/DAY + G/M/X on one row; Sep|Oct natural width side-by-side (no stretch gap).
   Tablet 641–980 + landscape 981–1180. Phone (<640) unchanged.
*/

.day-page--left,
.day-page--right {
  container-type: inline-size;
  container-name: day-page;
}

@media (max-width: 980px) and (min-width: 641px) {
  .day-header__identity,
  .day-header__minis {
    display: contents;
  }

  .day-header {
    display: grid;
    grid-template-columns: max-content max-content 1fr;
    grid-template-areas:
      "top top top"
      "rule rule rule"
      "week nav nav"
      "m1 m2 .";
    column-gap: 12px;
    row-gap: 8px;
    align-items: end;
    justify-items: start;
  }

  .day-header__top {
    grid-area: top;
    width: 100%;
    justify-self: stretch;
  }
  .day-header__rule {
    grid-area: rule;
    width: 100%;
    justify-self: stretch;
  }
  .day-header__week {
    grid-area: week;
    margin: 0;
    padding: 0;
    align-items: flex-end;
    gap: 16px;
  }
  .day-header__month-nav {
    grid-area: nav;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 8px;
    padding-top: 0;
    padding-bottom: 2px;
    justify-self: start;
  }
  .day-header__month-nav + .mini-month {
    grid-area: m1;
    width: 158px !important;
    max-width: 158px !important;
    flex: none !important;
    justify-self: start;
  }
  .day-header__month-nav + .mini-month + .mini-month {
    grid-area: m2;
    width: 158px !important;
    max-width: 158px !important;
    flex: none !important;
    justify-self: start;
  }

  .mini-month-nav,
  .mini-month-nav--action {
    min-width: 40px;
    min-height: 40px;
  }

  .appt-grid {
    --appt-visible-slots: 26;
    max-height: min(
      calc(var(--appt-row-h, 22px) * var(--appt-visible-slots)),
      calc((100dvh - 220px) * 0.67)
    ) !important;
    height: auto;
  }

  .reserved {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .reserved__block--todos {
    grid-row: auto;
    grid-column: auto;
  }
}

@media (max-width: 1180px) and (min-width: 981px) {
  .day-header__identity,
  .day-header__minis {
    display: contents;
  }
  .day-header {
    display: grid;
    grid-template-columns: max-content max-content 1fr;
    grid-template-areas:
      "top top top"
      "rule rule rule"
      "week nav nav"
      "m1 m2 .";
    column-gap: 10px;
    row-gap: 8px;
    align-items: end;
    justify-items: start;
  }
  .day-header__top { grid-area: top; width: 100%; justify-self: stretch; }
  .day-header__rule { grid-area: rule; width: 100%; justify-self: stretch; }
  .day-header__week {
    grid-area: week;
    margin: 0;
    padding: 0;
    align-items: flex-end;
    gap: 14px;
  }
  .day-header__month-nav {
    grid-area: nav;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 6px;
    padding-top: 0;
    padding-bottom: 2px;
    justify-self: start;
  }
  .day-header__month-nav + .mini-month,
  .day-header__month-nav + .mini-month + .mini-month {
    width: 158px !important;
    max-width: 158px !important;
    flex: none !important;
    justify-self: start;
  }
  .day-header__month-nav + .mini-month { grid-area: m1; }
  .day-header__month-nav + .mini-month + .mini-month { grid-area: m2; }

  .reserved {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .reserved__block--todos {
    grid-row: auto;
    grid-column: auto;
  }
  .appt-grid {
    --appt-visible-slots: 28;
    max-height: min(
      calc(var(--appt-row-h, 22px) * var(--appt-visible-slots)),
      calc((100dvh - 200px) * 0.67)
    ) !important;
  }
}

@container day-page (max-width: 620px) {
  .reserved {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .reserved__block--todos {
    grid-row: auto;
    grid-column: auto;
  }
}
