/* ==========================================================================
   Writings — the app's own layout hooks.
   --------------------------------------------------------------------------
   The dress is the Search standard (static/design-system.css, loaded
   before this file). This file holds only what the standard
   deliberately does not carry: a handful of layout patterns of this
   house. Every rule lives in the `app` layer, which stacks after the
   standard's own layers, so these hooks extend the standard without
   ever restyling it.

   The hooks:
   - .stats   the dashboard's stat grid (the system has no grid pattern)
   - .rows    two-sided rows inside a structured list: a title block on
              the left, the standing and dates on the right
   - .post-body  the rendered-Markdown region of a post, where ordinary
              prose lists keep their markers (inside <article> the system
              renders lists as structured rows — right for the desk's
              lists, wrong for a writing's own lists)
   - .signin  the sign-in page's one narrow, centered card
   - .actions a row of buttons standing together in a form
   - .danger  danger-colored text (a failed delivery, an error line);
              the system's classless layer gives danger to notices and
              buttons, not to bare text
   ========================================================================== */

@layer app {
  /* --- The dashboard's stat grid ------------------------------------- */
  .stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-3);
  }

  .stats > * {
    margin-block: 0;
  }

  /* --- Two-sided rows in the desk's structured lists ------------------ */
  .rows li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-1) var(--space-4);
  }

  .rows li > span {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
  }

  .rows li > span:last-child {
    align-items: flex-end;
    text-align: end;
  }

  .rows progress {
    width: 160px;
  }

  @media (max-width: 560px) {
    .rows li > span {
      flex-basis: 100%;
    }

    .rows li > span:last-child {
      align-items: flex-start;
      text-align: start;
    }

    .rows progress {
      width: 100%;
    }
  }

  /* --- The admin nav marks where the owner stands ---------------------- */
  main nav a[aria-current="page"] {
    background: var(--wash);
    color: var(--ink);
    font-weight: 600;
  }

  /* --- A row of buttons in a form -------------------------------------- */
  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
  }

  /* A card form's submit spans the card: the system's button label
     never wraps, so a long label ("Subscribe to …") would otherwise
     push past the card's edge on a narrow screen. */
  .card form button[type="submit"] {
    width: 100%;
    white-space: normal;
  }

  /* --- The writing editor wants a tall field ---------------------------- */
  textarea[name="body"] {
    min-height: 320px;
  }

  /* --- The sign-in page: one narrow card, centered ----------------------- */
  .signin > .card {
    max-width: 26rem;
    margin-inline: auto;
  }

  /* --- Danger-colored text ------------------------------------------------ */
  .danger {
    color: var(--color-danger-500);
  }

  /* --- A post's title stands at the statement's scale ---------------------- */
  article.card:has(.post-body) h1 {
    font-size: 34px;
    line-height: 1.15;
    margin-block: var(--space-2) var(--space-4);
  }

  /* --- A post's own lists are prose lists, not structured rows ----------- */
  .post-body ul {
    list-style: disc;
    padding-inline-start: var(--space-4);
  }

  .post-body ol {
    padding-inline-start: var(--space-4);
  }

  .post-body li {
    padding-block: 0;
    border-bottom: none;
    margin-block-end: var(--space-2);
  }

  .post-body li:first-child {
    border-top: none;
  }
}
