/*
 * patient-letters.css - "Letters from your clinician" on the patient's Report tab
 * (#111, shell-report-tab.js): one row per sent letter with a download link, and the
 * one-time highlight on a letter the person has not seen since it was sent (owner,
 * 2026-12-02; is_new from app/services/letters/letter_seen.py).
 *
 * Its own file because aci-patient.css is past 1,500 lines: the letter rows moved here
 * with the highlight. Loaded on the patient page only (patient_shell.html), the one page
 * that draws these rows.
 */

.acp-letters-card { margin-top: 14px; }

.acp-letter-list {
  gap: 8px;
}

.acp-letter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  background: var(--color-card);
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.acp-letter-row:hover {
  border-color: var(--color-line);
  background: var(--color-selected-row);
  box-shadow: 0 2px 10px rgba(21, 37, 30, 0.08);
}

.acp-letter-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-selected-row);
  color: var(--color-main);
  font-size: var(--fs-16, 16px);
}

.acp-letter-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.acp-letter-title {
  font-size: var(--fs-14, 14px);
  font-weight: 600;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.acp-letter-meta {
  font-size: var(--fs-12, 12px);
  color: var(--color-muted);
  margin-top: 1px;
}

.acp-letter-dl {
  flex: 0 0 auto;
  color: var(--color-main);
  font-size: var(--fs-14, 14px);
}

/* A letter new to this person: a forest ring and a "New" tag, still for the whole visit. */
.acp-letter-row--new {
  border-color: var(--color-main);
  background: color-mix(in srgb, var(--color-selected-row) 55%, var(--color-card));
}

.acp-letter-new {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--color-main);
  color: var(--color-on-main);
  font-size: var(--fs-11, 11px);
  font-weight: 700;
  line-height: 1.6;
  vertical-align: 1px;
}

/* Once the person can see the page (no first-run screen over it, the browser tab in front:
   shell-report-tab.js adds --arrive), the ring breathes three times, then rests; the icon
   lifts once. Nothing moves for a person who asked their device for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .acp-letters-card--arrive .acp-letter-row--new {
    animation: acp-letter-arrive 1.3s ease-in-out 0.4s 3;
  }

  .acp-letters-card--arrive .acp-letter-row--new .acp-letter-icon {
    animation: acp-letter-lift 0.6s ease-out 0.4s;
  }
}

@keyframes acp-letter-arrive {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-main) 0%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--color-main) 20%, transparent); }
}

@keyframes acp-letter-lift {
  0%, 100% { transform: none; }
  45% { transform: translateY(-3px) scale(1.08); }
}
