/*
 * Computers and tablets in landscape. The phone layout is one column; here the main screens open
 * into two, like a diary lying open, so the wide screen is not one narrow strip with blank sides.
 * Every rule places existing parts; nothing here is needed to use the page.
 */
@media (min-width: 72rem) {
  /* Write and history open as two facing pages that fill the screen down to its bottom edge:
     the page fills the window, the spread takes what the masthead leaves, and the left page
     stretches to it. The right page scrolls on its own; contain: size keeps a long list from
     making the row, and so the left page, taller than the window. */
  body:has(.spread) {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }

  body:has(.spread) > main {
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 100%;
    max-width: 76rem;
    padding-bottom: 0;
  }

  .spread {
    display: grid;
    flex: 1;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--space-8);
  }

  .spread > :last-child {
    contain: size;
    overflow-y: auto;
    /* Room inside the scroller for the cards' shadows, which it would otherwise clip. */
    margin-inline: calc(-1 * var(--space-3));
    padding-inline: var(--space-3);
  }

  .spread > .composer,
  .spread > .calendar {
    margin-bottom: 0;
  }

  .spread > .day {
    margin-top: var(--space-6);
  }

  /* The body takes the page's spare height, through the photo field's wrappers when it has one,
     so the save button sits at the bottom edge. */
  .composer > .field:has(textarea),
  .composer .photo-body {
    display: flex;
    flex: 1;
    flex-direction: column;
  }

  .composer .photo-field {
    flex: 1;
  }

  .composer textarea {
    flex: 1;
    resize: none;
  }

  /* History: the search and insights entrances over the month at the left, the picked day and
     the earlier days at the right. The weeks share the calendar's height, so the month reaches
     the bottom too. */
  .spread:has(> .calendar) {
    grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
    grid-template-rows: min-content 1fr;
  }

  .spread > .history-tools {
    grid-area: 1 / 1;
  }

  .spread > .calendar {
    grid-area: 2 / 1;
  }

  .spread > .spread-side {
    display: block;
    grid-area: 1 / 2 / span 2;
    padding-top: var(--space-6);
  }

  .spread > .calendar .month-grid {
    flex: 1;
    grid-auto-rows: 1fr;
  }

  .spread > .calendar .month-grid > li {
    display: grid;
  }

  .spread > .calendar .day-cell {
    align-self: center;
  }

  /* Login: the cover fills the left half and stays; the sheet with the form is the right half. */
  body.login {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 40rem);
    min-height: 100dvh;
  }

  body.login .login-hero {
    position: sticky;
    top: 0;
    height: 100dvh;
  }

  body.login .login-hero .mascot {
    width: 13rem;
    height: 13rem;
  }

  body.login .login-hero h1 {
    font-size: 3rem;
  }

  .login main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: var(--space-8) 3.5rem;
    border-radius: var(--radius-sheet) 0 0 var(--radius-sheet);
    box-shadow: -1rem 0 2.5rem -1.5rem rgb(31 42 27 / 0.25);
  }

  .login main::before {
    display: none;
  }

  /* Insights: the four tiles in one row; it and the operator dashboard set charts two by two. */
  .stats-range ~ .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stats-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Nine tiles fill three rows; four across would wrap the longer labels onto three lines. */
  .admin-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
