/* ==========================================================================
   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: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;
  }
}

/* The owner's picture in the header, standing small before his
   name (Roberto, 2026-11-19): his GitHub profile picture, carried
   at static/avatar.png and serving as the site's favicon as well. */
body > header p a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

body > header p a img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}

/* On a phone the header's pieces — the name, The Gospel, and the
   envelope — stand on one row (Roberto, 2026-11-20): the gaps and
   the buttons' padding draw in, and the row does not wrap. */
@media (max-width: 560px) {
  body > header {
    flex-wrap: nowrap;
    gap: var(--space-2);
  }

  body > header nav ul {
    flex-wrap: nowrap;
    gap: var(--space-2);
  }

  body > header a[role="button"] {
    padding: 0 12px;
  }
}

/* The subscribe form: one form for the whole page — the address
   once, then every option as a row of its own (title over
   description on the ground, inside the card's wash), then one
   button. The sheet's generic margins stack into air here too, so
   the form keeps its own order: one 16px rhythm, the choice boxes
   aligned to the first line of their labels, and the field at 16px
   so a phone does not zoom into it. */
.subscribe-form {
  display: grid;
  gap: var(--space-3);
  margin: 0;
}

.subscribe-form label {
  margin: 0;
}

.subscribe-form input[type="email"] {
  margin: var(--space-2) 0 0;
  font-size: 16px;
}

.subscribe-form .sub-opts {
  display: grid;
  gap: var(--space-2);
}

.subscribe-form .sub-opt {
  align-items: flex-start;
  background: var(--ground);
  border: 1px solid var(--hair);
  border-radius: 12px;
  padding: 12px 14px;
}

.subscribe-form .sub-opt input[type="checkbox"] {
  margin-top: 1px;
}

.subscribe-form .sub-opt-text {
  display: grid;
  gap: var(--space-1);
}

.subscribe-form .sub-opt-text span {
  color: var(--ink-2);
}

.subscribe-form button[type="submit"] {
  width: 100%;
}

/* The Shop banner at the foot of the subscribe page — Roberto's own
   draft, refined at his word (2026-11-19): a wide rectangle holding
   the shirt alone, zoomed into its question, and the door a
   full-width pill at the banner's foot that says Buy. No line of
   text stands in it; the shirt carries the banner. */
.shop-banner {
  background: var(--ground);
  box-shadow: var(--lift-panel);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-top: var(--space-6);
}

.shop-banner-media {
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 16 / 8;
}

.shop-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 32% 22%;
  transform: scale(1.35);
}

.shop-banner-action {
  margin: var(--space-4) 0 0;
}

.shop-banner-action .btn-primary {
  display: flex;
  width: 100%;
  justify-content: center;
}

@media (max-width: 560px) {
  .shop-banner-media {
    aspect-ratio: 4 / 3;
  }
}
