@layer sketches {
  /* List, all layouts: the place line under the name shows on desktop once Location leaves. */
  .projects--note-b .projects__place,
  .projects--note-c .projects__place {
    display: block;
  }

  .projects__note--a,
  .projects__note--b {
    display: none;
  }

  /* A: the note is the row's last line, from the name to the sheet's edge. */
  .projects__row:has(+ .projects__note-row) > * {
    padding-bottom: var(--space-sm);
    border-bottom: 0;
  }

  .projects__note-row {
    position: relative;
    cursor: pointer;
    transition: background var(--transition-fast);

    & td {
      padding: 0 var(--space-md) 0.75rem;
      border-bottom: 1px solid var(--hairline);
    }

    tbody:last-child &:last-child td {
      border-bottom: 0;
    }
  }

  .projects__row:hover + .projects__note-row,
  .projects__row:has(+ .projects__note-row:hover),
  .projects__note-row:hover {
    background: var(--sheet-head);
  }

  .projects__row:has(+ .projects__note-row:hover) .projects__name {
    color: var(--blue);
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .projects__note-line {
    display: flex;
    align-items: flex-start;
    gap: var(--space-xs);
    color: var(--ink-body);

    &::after {
      content: "";
      position: absolute;
      inset: 0;
    }

    & .icon {
      flex: none;
      width: 0.95rem;
      height: 0.95rem;
      margin-top: 0.22rem;
      color: var(--ink-faint);
    }
  }

  /* B: the note as a column of its own. */
  .projects__why {
    width: 30%;
    color: var(--ink-body);
  }

  .projects--note-b thead th:nth-child(2) {
    min-width: 15rem;
  }

  .projects__why-text {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }

  /* Below about 1,100px the column would squeeze the names, so the note goes back under the name. */
  @media (max-width: 1100px) {
    .projects__why {
      display: none;
    }

    .projects__note--b {
      display: flex;
      max-width: none;
      color: var(--ink-body);
    }
  }

  /* C: the note under the name, the project cell holding place and stage. */
  .projects--note-c thead th:nth-child(2) {
    width: 45%;
  }

  .projects__note--c {
    max-width: none;
    color: var(--ink-body);
  }

  @media (max-width: 720px) {
    .projects__note-row {
      display: none;
    }

    .projects__note--a,
    .projects__note--b {
      display: flex;
    }

    .projects__note--a,
    .projects__note--b,
    .projects__note--c {
      max-width: none;
      color: var(--ink-body);
    }

    .projects__place-stage {
      display: none;
    }
  }

  /* The note on the project page. */
  .decision-note__title {
    font-size: var(--text-label);
    font-weight: var(--weight-emphasis);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-muted);
  }

  .decision-note__text {
    max-width: 75ch;
    margin-top: var(--space-xs);
    line-height: 1.5;
    text-wrap: pretty;
    color: var(--ink);
  }

  .decision-note__words {
    white-space: pre-line;
  }

  .decision-note__edit {
    font-weight: var(--weight-emphasis);
    color: var(--blue);
    cursor: pointer;

    .decision-note__words + & {
      margin-left: var(--space-sm);
    }

    &:hover {
      text-decoration: underline;
      text-underline-offset: 3px;
    }
  }

  /* A: the header band's last line. */
  .decision-note--a {
    margin-top: var(--space-lg);
  }

  /* B: the top of the right-hand column, in On this page's grammar. */
  .decision-note--b {
    margin-bottom: var(--space-xl);
    padding-inline: var(--space-sm);
    font-size: var(--text-sm);

    & .decision-note__title {
      padding-bottom: var(--space-sm);
      font-size: var(--text-sm);
      letter-spacing: 0;
      text-transform: none;
      border-bottom: 1px solid var(--border);
      margin-inline: calc(-1 * var(--space-sm));
      padding-inline: var(--space-sm);
    }

    & .decision-note__text {
      margin-top: var(--space-sm);
      color: var(--ink-body);
    }

    & .decision-note__edit {
      display: block;
      margin: var(--space-sm) 0 0;
    }
  }

  /* C: the reading column's first block, above the summary. */
  .decision-note--c .decision-note__text {
    font-size: var(--text-md);
  }

  @media (max-width: 960px) {
    .project__rail:has(.decision-note--b) {
      display: block;
      position: static;
      order: -1;

      & .section-nav {
        display: none;
      }

      & .decision-note--b {
        margin-bottom: 0;
        padding-inline: 0;
      }

      & .decision-note__title {
        margin-inline: 0;
        padding-inline: 0;
      }
    }
  }

  /* The options page. */
  .note-options {
    gap: var(--space-2xl);

    & .page {
      width: 100%;
    }
  }

  .note-options__subtitle {
    margin-top: var(--space-md);
    font-size: var(--text-md);
    font-weight: var(--weight-display);
    color: var(--ink);
  }

  .note-options__direction {
    display: grid;
    gap: var(--space-lg);
  }

  .note-options__facts {
    display: grid;
    gap: var(--space-sm);
    max-width: 90ch;
    font-size: var(--text-sm);
  }

  .note-options__fact {
    display: grid;
    grid-template-columns: var(--label-column) minmax(0, 1fr);
    gap: var(--space-md);

    & dt {
      font-weight: var(--weight-emphasis);
      color: var(--ink);
    }

    & dd {
      color: var(--ink-body);
    }
  }

  .note-options__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-lg);
  }

  .note-options__frame {
    display: grid;
    gap: var(--space-sm);
  }

  .note-options__screen {
    display: block;
    width: 100%;
    height: 760px;
    border-block: 1px solid var(--border);
  }

  .note-options__phone {
    height: 640px;
  }

  @media (max-width: 720px) {
    .note-options__fact {
      grid-template-columns: minmax(0, 1fr);
      gap: 0;
    }
  }
}
