/*
 * Caden — Application Letter Styles
 *
 * Linked alongside style.css for letter.html.
 * Provides letter-specific layout and typography.
 * Uses CSS custom properties defined in style.css.
 */

/* ===== Letter body overrides ===== */
.letter-body {
  /* Remove full-height flex context; letter scrolls naturally */
  height: auto;
  min-height: 100vh;
}

/* ===== Letter Header ===== */
.letter-header {
  /* Inherits .app-header — fixed, branded */
}

.letter-header-content {
  /* Inherits .header-content layout */
}

.letter-back-link {
  margin-left: auto;
  flex-shrink: 0;
  padding: 6px 14px;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--border-radius-sm);
  color: var(--color-text-inverse);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}

.letter-back-link:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.9);
}

.letter-back-link:focus {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

/* ===== Letter Container ===== */
.letter-container {
  max-width: 768px;
  margin: 0 auto;
  padding: calc(var(--header-height) + 40px) 24px 80px;
}

/* ===== Letter Article ===== */
.letter-article {
  background-color: var(--color-surface);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-border);
  padding: 48px 56px;
  box-shadow: var(--shadow-sm);
}

/* ===== Letter Meta (From/To/Re header) ===== */
.letter-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.letter-meta p {
  margin: 0;
}

.letter-meta strong {
  color: var(--color-text);
}

/* ===== Horizontal Rules ===== */
.letter-rule {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 32px 0;
}

/* ===== Section Headings ===== */
.letter-article h2 {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 16px;
  line-height: 1.3;
}

/* ===== Paragraphs ===== */
.letter-article p {
  font-size: var(--font-size-base);
  line-height: 1.75;
  color: var(--color-text);
  margin-bottom: 16px;
}

.letter-article p:last-child {
  margin-bottom: 0;
}

/* ===== Section spacing ===== */
.letter-article section {
  margin-bottom: 0;
}

/* ===== Signature ===== */
.letter-signature {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  font-size: var(--font-size-base);
  line-height: 1.6;
}

/* ===== Footer ===== */
.letter-footer {
  margin-top: 0;
}

.letter-footer p {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 0;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .letter-container {
    padding: calc(var(--header-height) + 20px) 16px 60px;
  }

  .letter-article {
    padding: 28px 20px;
  }

  .letter-article h2 {
    font-size: 1.1em;
  }

  .letter-back-link {
    /* Truncate gracefully on small screens */
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
