/*
 * css/letters.css · The Long Game — Future-Self Letters feature styles
 * Purpose: Styles for the Letters list screen, arrived-letter banner, sealed-letter
 *          overlay, read-letter overlay, and the compose sheet. Uses design tokens
 *          from styles.css — never redefines them. Follows all naming/class conventions
 *          in CLAUDE.md: letter-*, overlay-*, sheet-*, .pill-*, .surface-card variants.
 * Related: js/letters.js (renders into these classes), css/styles.css (token source)
 *
 * All animations guarded by prefers-reduced-motion (matches global rule in styles.css).
 */

/* ===== LETTERS SCREEN HEADER ===== */
.letter-screen-header {
  margin-bottom: var(--space-5);
}

.letter-screen-sub {
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0 0 var(--space-2);
}

/* ===== ARRIVED BANNER (focal card — one at a time, gentle pacing) ===== */
/*
 * Accent-left-edge treatment, matching the revisit-card pattern in styles.css.
 * Warm teal feel: signals something worth noticing, not alarm.
 */
.letter-arrived-card {
  padding: 16px 18px 16px 20px;
  border-left: 3px solid var(--accent);
  cursor: pointer;
  margin-bottom: var(--space-3);
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.letter-arrived-card:hover {
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}
.letter-arrived-card:active {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.letter-arrived-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.letter-arrived-overline {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin-bottom: 6px;
}

.letter-arrived-body {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  margin-bottom: 8px;
}

.letter-arrived-cta {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent);
}

/* ===== LETTER LIST ROW ===== */
/*
 * Mirrors the .call-row pattern: flex, left icon glyph, body with title + meta.
 * First child has no top border (matching .call-row:first-child rule).
 */
.letter-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.letter-row:first-child {
  border-top: none;
}
.letter-row:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}
.letter-row:active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.letter-row:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -2px;
}

.letter-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.letter-row-body {
  flex: 1;
  min-width: 0;
}

.letter-row-date {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 3px;
}

.letter-row-preview {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink);
  margin-bottom: 5px;
  /* two-line clamp */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.letter-row-meta {
  font-size: 0.78rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* ===== ARRIVED OVERLAY (reading an arrived letter) ===== */

.letter-arrived-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: var(--space-5);
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.4;
}

.letter-arrived-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.letter-arrived-text {
  font-family: var(--serif);
  font-style: italic;
}

/* ===== LETTER READ CARD (the body content) ===== */
/*
 * Warmer than the bare .call-detail-letter: inset shadow, generous line-height,
 * Newsreader for the body. Feels like a physical letter on paper.
 */
.letter-read-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px;
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow);
}

.letter-read-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.letter-read-body {
  font-family: var(--serif);
  font-size: 1.07rem;
  line-height: 1.8;
  color: var(--ink);
  white-space: pre-wrap; /* preserve the user's line-breaks */
}

/* ===== REPLY / CTA SECTION IN READ OVERLAY ===== */
.letter-read-actions {
  margin-top: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.letter-read-nudge {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--ink-soft);
  text-align: center;
  margin: 0 0 var(--space-3);
  line-height: 1.55;
}

/* ===== SEALED LETTER OVERLAY ===== */
/*
 * No body text shown. Centres a lock icon + friendly copy.
 * Opening early is offered gently — no alarm, no guilt.
 */
.letter-sealed-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: var(--space-4);
}

.letter-sealed-lock {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: var(--space-4);
}

.letter-sealed-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 var(--space-3);
}

.letter-sealed-arrive {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 var(--space-4);
  line-height: 1.4;
}

.letter-sealed-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0;
}

/* ===== REDUCED MOTION GUARD ===== */
/*
 * Mirrors the global rule in styles.css.
 * The overlay uses the global .overlay animation (settle 180ms) which is
 * already guarded there; any local transitions are zapped here too.
 */
@media (prefers-reduced-motion: reduce) {
  .letter-arrived-card,
  .letter-row {
    transition: none;
  }
}
