/*
 * A financial resource's page (financial_resources#show), laid out like a
 * grant's (.grant-detail) and an objective's (.objective-detail): a header
 * line, the title, then the content beside a sticky sidebar of actions and
 * figures. Every field is edited in place.
 */
@layer components {
  .resource-detail__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-block-end: var(--space-4);
    border-block-end: var(--border);
  }

  .resource-detail__meta {
    font: var(--text-small);
    color: var(--color-muted);
  }

  .resource-detail__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16rem;
    gap: var(--space-8);
    padding-block: var(--space-6) var(--space-8);
    align-items: start;
  }

  .resource-detail__main {
    display: grid;
    gap: var(--space-7);

    & > * + * {
      margin-block-start: 0;
    }
  }

  .resource-detail__title {
    font: var(--text-title);
    color: var(--color-ink);
    max-inline-size: none;
  }

  /* Stays beside the content while it scrolls, below the sticky banner. */
  .resource-detail__sidebar {
    position: sticky;
    inset-block-start: calc(var(--app-header-height) + var(--space-6));
    display: grid;
    gap: var(--space-3);
    padding-inline-start: var(--space-6);
    border-inline-start: var(--border);

    & > * + * {
      margin-block-start: 0;
    }

    & > section {
      margin-block-start: var(--space-5);

      & > * + * {
        margin-block-start: var(--space-2);
      }
    }
  }

  /* The read-only Details block: a label/value record sheet. */
  .resource-detail__facts {
    margin: 0;
    max-inline-size: var(--width-reading);
  }

  /* Source and cost center, then the receipt: an ordinary form contract,
     kept to the reading width so the controls do not stretch. */
  .resource-detail__form {
    max-inline-size: var(--width-reading);
  }

  .resource-detail__total {
    font: var(--text-body-strong);
    color: var(--color-ink);
  }

  /*
   * Over-drawn (FR-002a): the attention role (DESIGN.md §2.3), never an
   * error -- the orange mark on the edge, ink text on the tinted surface,
   * the same look as .field-message--warning on a budget's page.
   */
  .resource-detail__warning {
    padding: var(--space-3) var(--space-5);
    border-inline-start: var(--space-1) solid var(--color-attention);
    border-radius: var(--radius-s);
    background: var(--color-attention-surface);
    color: var(--color-text);
    font: var(--text-small);
  }

  /* Archived: read-only for everyone, so the content below the title fades. */
  .resource-detail--archived .resource-detail__main > * {
    opacity: 0.6;
  }
}

/* The list of financial resources (index): an archived row still opens its
   page but reads as set aside -- muted text, the same treatment an archived
   budget row gets. */
@layer components {
  .is-archived {
    color: var(--color-muted);
  }
}
