/* Letters to the future (js/letters.js): the Letters section of Family History, its home card, and
   the letter sheets. Built on the Family History look (--fh-* in css/app.css: warm paper, serif),
   which follows light and dark mode. Loaded by js/letters.js on first use. */

.lt-hub { padding-bottom: 24px; }
.lt-head { margin: 10px 2px 14px; }
.lt-head h2 { font-family: var(--fh-serif); font-size: 26px; font-weight: 600; line-height: 1.15; margin: 0 0 6px; color: var(--fh-ink); }
.lt-head p { margin: 0; font-family: var(--fh-serif); font-size: 16px; line-height: 1.5; color: var(--fh-muted); }
.lt-summary { margin: -4px 2px 6px; font-size: 13px; color: var(--fh-muted); }
.lt-hub .section-label { color: var(--fh-muted); }
.lt-link { border: 0; background: none; padding: 8px 2px; font: inherit; font-size: 14px; font-weight: 700; color: var(--fh-accent); text-decoration: underline; text-underline-offset: 3px; }

/* a gentle suggestion: one at a time, easy to put off */
.lt-nudge {
  display: flex; gap: 12px; margin: 0 0 14px; padding: 14px; border-radius: 18px;
  background: var(--fh-card); color: var(--fh-ink); border: 1px solid var(--fh-line); box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.lt-nudge-icon { font-size: 26px; line-height: 1; flex: none; margin-top: 2px; }
.lt-nudge-text { flex: 1; min-width: 0; }
.lt-nudge-text b { display: block; font-family: var(--fh-serif); font-size: 17px; font-weight: 600; line-height: 1.3; }
.lt-nudge-text p { margin: 4px 0 10px; font-size: 13.5px; line-height: 1.45; color: var(--fh-muted); }
.lt-nudge-actions { display: flex; gap: 8px; }
.lt-nudge-actions .btn { width: auto; flex: 1; height: 42px; font-size: 15px; border-radius: 13px; margin: 0; }
.lt-nudge-actions .btn + .btn { margin-top: 0; }
.lt-nudge-actions .btn:not(.secondary) { background: var(--fh-accent); color: var(--fh-accent-fg); }
.lt-nudge-actions .btn.secondary { background: transparent; color: var(--fh-ink); border: 1px solid var(--fh-line); }

/* the people you write for */
.lt-people, .lt-who-list { display: grid; gap: 8px; }
.lt-who-list { margin: 8px 0 14px; }
.lt-person {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 16px; text-align: left; font: inherit;
  background: var(--fh-card); color: var(--fh-ink); border: 1px solid var(--fh-line);
}
.lt-avatar {
  width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--fh-serif); font-size: 20px; font-weight: 600; background: var(--fh-paper); color: var(--fh-accent); border: 1px solid var(--fh-line);
}
.lt-person.child .lt-avatar { background: color-mix(in srgb, var(--fh-accent) 16%, var(--fh-card)); }
.lt-ptext { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.lt-ptext b { font-size: 16px; font-weight: 700; }
.lt-ptext small { font-size: 12.5px; color: var(--fh-muted); line-height: 1.35; }
.lt-ptext small.lt-next { color: var(--fh-ink); opacity: .8; }
.lt-chev { font-size: 22px; color: var(--fh-muted); flex: none; }
.lt-progress { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.lt-bar { display: block; height: 6px; border-radius: 3px; background: var(--fh-line); overflow: hidden; }
.lt-bar i { display: block; height: 100%; border-radius: 3px; background: var(--fh-accent); }
.lt-progress small { color: var(--fh-muted); font-size: 12.5px; }
.lt-add {
  width: 100%; margin: 8px 0 0; padding: 12px; border-radius: 14px; font: inherit; font-weight: 700; font-size: 14.5px;
  background: transparent; color: var(--fh-muted); border: 1.5px dashed var(--fh-line);
}

/* the prompt library */
.lt-themes { display: flex; gap: 6px; overflow-x: auto; margin: 0 -14px 10px; padding: 0 14px 2px; scrollbar-width: none; }
.lt-themes::-webkit-scrollbar { display: none; }
.lt-theme {
  flex: none; border: 1px solid var(--fh-line); background: var(--fh-card); color: var(--fh-ink); border-radius: 999px;
  padding: 7px 12px; font: inherit; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.lt-theme[aria-pressed="true"] { background: var(--fh-ink); color: var(--fh-paper); border-color: var(--fh-ink); }
.lt-ideas { display: grid; gap: 8px; }
.lt-idea {
  display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 14px 16px; text-align: left; font: inherit; border-radius: 14px;
  background: var(--fh-card); color: var(--fh-ink); border: 1px solid var(--fh-line); border-left: 4px solid var(--fh-accent);
}
.lt-idea small { font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--fh-muted); }
.lt-idea span { font-family: var(--fh-serif); font-size: 17px; line-height: 1.4; }
.lt-another { display: block; margin: 4px auto 0; }

/* more than words */
.lt-ways { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 6px; }
.lt-ways > .lt-way:last-child:nth-child(odd) { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.lt-ways > .lt-way:last-child:nth-child(odd) .lt-way-icon { grid-row: span 2; margin: 0; }
.lt-way {
  display: flex; flex-direction: column; gap: 2px; padding: 14px; text-align: left; font: inherit; border-radius: 16px;
  background: var(--fh-card); color: var(--fh-ink); border: 1px solid var(--fh-line);
}
.lt-way-icon { font-size: 24px; margin-bottom: 4px; }
.lt-way b { font-size: 15px; }
.lt-way small { font-size: 12.5px; color: var(--fh-muted); line-height: 1.35; }

/* how they're kept safe */
.lt-safe { margin: 16px 0 8px; padding: 2px 14px; border-radius: 14px; background: var(--fh-card); border: 1px solid var(--fh-line); color: var(--fh-ink); }
.lt-safe summary { padding: 12px 0; font-weight: 700; cursor: pointer; }
.lt-safe ul, .lt-safe ol { margin: 0 0 12px; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.lt-safe li { margin: 0 0 6px; }
.lt-safe a, .lt-legacy-box a { color: var(--fh-accent); }
.lt-remind-row { margin: 10px 2px 0; color: var(--fh-muted); font-size: 13.5px; line-height: 1.4; }
.lt-remind-row input { accent-color: var(--fh-accent); flex: none; }

/* one person */
.lt-back { border: 0; background: none; padding: 8px 2px 0; font: inherit; font-weight: 700; color: var(--fh-accent); }
.lt-person-head { margin-top: 4px; }
.lt-write { margin: 0 0 14px; }
.lt-noborn { margin: -4px 2px 12px; }
.lt-set { margin: 0 0 12px; padding: 14px; border-radius: 18px; background: var(--fh-card); border: 1px solid var(--fh-line); color: var(--fh-ink); }
.lt-set-head { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 8px; }
.lt-set-icon { font-size: 24px; line-height: 1.1; flex: none; }
.lt-set-head b { display: block; font-family: var(--fh-serif); font-size: 18px; font-weight: 600; }
.lt-set-head small { display: block; font-size: 13px; color: var(--fh-muted); line-height: 1.4; margin-top: 2px; }
.lt-set > .lt-progress { margin: 0 0 12px; }
.lt-set .muted { color: var(--fh-muted); }
.lt-set .btn.secondary { background: var(--fh-paper); color: var(--fh-ink); border: 1px solid var(--fh-line); height: 46px; font-size: 15px; }

/* the 18 birthdays */
.lt-bdays { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.lt-bday {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 0;
  border-radius: 14px; font: inherit; color: var(--fh-ink); background: var(--fh-paper); border: 1.5px solid var(--fh-line);
}
.lt-bday b { font-family: var(--fh-serif); font-size: 18px; font-weight: 600; line-height: 1.1; }
.lt-bday small { font-size: 10.5px; color: var(--fh-muted); font-variant-numeric: tabular-nums; }
.lt-bday.written { background: var(--fh-accent); color: var(--fh-accent-fg); border-color: var(--fh-accent); }
.lt-bday.written small { color: inherit; opacity: .85; font-size: 12px; }
.lt-bday.passed { border-style: dashed; opacity: .6; }
.lt-set > .muted.small { margin: 10px 2px 0; }
.lt-leap { margin: 12px 0 0; }
.lt-leap small { display: block; color: var(--fh-muted); font-size: 12.5px; margin: 0 0 6px; }

/* open when…, milestones */
.lt-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lt-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px; text-align: left; font: inherit; border-radius: 14px;
  background: var(--fh-paper); color: var(--fh-ink); border: 1px solid var(--fh-line); min-height: 92px;
}
.lt-tile-icon { font-size: 20px; }
.lt-tile > span:not(.lt-tile-icon) { font-family: var(--fh-serif); font-size: 15px; line-height: 1.3; }
.lt-tile small { margin-top: auto; font-size: 12px; font-weight: 700; color: var(--fh-accent); }
.lt-tile.written { border-color: var(--fh-accent); background: color-mix(in srgb, var(--fh-accent) 12%, var(--fh-card)); }
.lt-tile.written small { color: var(--fh-ink); }
.lt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lt-chips .filter-chip, .lt-leap .filter-chip { background: var(--fh-paper); color: var(--fh-ink); border: 1px solid var(--fh-line); backdrop-filter: none; }
.lt-leap .filter-chip[aria-pressed="true"] { background: var(--fh-ink); color: var(--fh-paper); border-color: var(--fh-ink); }
.lt-legacy-count { margin: 0 0 10px; font-family: var(--fh-serif); font-size: 15.5px; }
.lt-legacy-how { margin: 10px 0 0; background: var(--fh-paper); }
.lt-list { margin: 0 0 12px; }
.lt-hub .cap-row { border-bottom-color: var(--fh-line); }
.lt-hub .cap-text small { color: var(--fh-muted); }
.lt-hub .cap-text b { white-space: normal; }
.lt-hub .cap-go { background: var(--fh-accent); color: var(--fh-accent-fg); }

/* ------------------------------------------------------------- the sheets, in the same warm look */
.sheet.lt-sheet { background: var(--fh-paper); color: var(--fh-ink); }
.sheet.lt-sheet h2 { font-family: var(--fh-serif); font-weight: 600; font-size: 23px; letter-spacing: 0; }
.sheet.lt-sheet .hint, .sheet.lt-sheet .muted, .sheet.lt-sheet .field > span { color: var(--fh-muted); }
.sheet.lt-sheet .field input, .sheet.lt-sheet .cap-letter-input {
  background-color: var(--fh-card); color: var(--fh-ink); border: 1.5px solid var(--fh-line);
}
.sheet.lt-sheet .cap-letter-input::placeholder, .sheet.lt-sheet .field input::placeholder { color: color-mix(in srgb, var(--fh-muted) 80%, transparent); }
.sheet.lt-sheet .field input:focus, .sheet.lt-sheet .cap-letter-input:focus { outline: 2px solid color-mix(in srgb, var(--fh-accent) 55%, transparent); outline-offset: 1px; }
.sheet.lt-sheet .btn:not(.secondary) { background: var(--fh-accent); color: var(--fh-accent-fg); }
.sheet.lt-sheet .btn.secondary { background: var(--fh-card); color: var(--fh-ink); border: 1px solid var(--fh-line); }
.sheet.lt-sheet .cap-presets .filter-chip { background: var(--fh-card); color: var(--fh-ink); border: 1px solid var(--fh-line); backdrop-filter: none; }
.sheet.lt-sheet .cap-presets .filter-chip[aria-pressed="true"] { background: var(--fh-ink); color: var(--fh-paper); border-color: var(--fh-ink); }
.sheet.lt-sheet .grab { background: var(--fh-line); }
.lt-sheet-kicker { font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--fh-accent); margin: 0 0 2px; }
.lt-prompt {
  display: flex; flex-direction: column; gap: 2px; margin: 0 0 14px; padding: 12px 14px; border-radius: 12px;
  background: var(--fh-card); border-left: 4px solid var(--fh-accent);
}
.lt-prompt-q { font-family: var(--fh-serif); font-style: italic; font-size: 16px; line-height: 1.45; }
.lt-prompt .lt-link { align-self: flex-start; padding: 4px 0 0; font-size: 13px; }
.lt-formats { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.lt-formats .filter-chip { background: var(--fh-card); color: var(--fh-ink); border: 1px solid var(--fh-line); backdrop-filter: none; padding: 8px 10px; }
.lt-formats .filter-chip[aria-pressed="true"] { background: var(--fh-ink); color: var(--fh-paper); border-color: var(--fh-ink); }
.lt-title-input { font-family: var(--fh-serif); }

/* writing paper */
.sheet.lt-sheet .cap-letter-input.lt-paper {
  font-family: var(--fh-serif); font-size: 17px; line-height: 28px; padding: 8px 14px 10px;
  background-color: var(--fh-card);
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, color-mix(in srgb, var(--fh-accent) 28%, transparent) 27px 28px);
  background-position: 0 8px; background-attachment: local;
}
.lt-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lt-family-recipe { display: block; margin: -6px 0 8px; }
.lt-linked { margin: 0 0 6px; padding: 8px 12px; border-radius: 10px; background: var(--fh-card); border: 1px solid var(--fh-line); font-size: 13.5px; }
.lt-see-recipe { margin-bottom: 8px; }

/* handwritten pages and photos: picked, then kept as they are */
.lt-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 10px; }
.lt-pick-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; text-align: left; font: inherit; border-radius: 14px;
  background: var(--fh-card); color: var(--fh-ink); border: 1.5px dashed color-mix(in srgb, var(--fh-accent) 60%, var(--fh-line));
}
.lt-pick-btn span { font-size: 24px; }
.lt-pick-btn small { color: var(--fh-muted); font-size: 12.5px; }
.lt-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 0 0 10px; }
.lt-thumbs:empty { display: none; }
.lt-thumb { position: relative; margin: 0; }
.lt-thumb img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; display: block; background: var(--fh-card); border: 1px solid var(--fh-line); }
.lt-thumb small { display: block; text-align: center; font-size: 11.5px; color: var(--fh-muted); margin-top: 2px; }
.lt-thumb-x {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 17px; line-height: 26px;
}
.lt-photos .cap-presets { margin-bottom: 6px; }

/* when it opens */
.lt-opens-fixed { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--fh-card); border: 1px solid var(--fh-line); font-size: 14.5px; line-height: 1.45; }
.lt-opens-fixed.legacy { background: color-mix(in srgb, var(--fh-ink) 8%, var(--fh-card)); }
.lt-opens-note { margin: 6px 2px 0; }

/* "Help me start": a few ways to begin, never the letter */
.lt-ai { display: flex; flex-direction: column; gap: 6px; margin: -4px 0 12px; }
.lt-ai-btn, .lt-ai-ask {
  align-self: flex-start; border: 1px solid var(--fh-line); background: var(--fh-card); color: var(--fh-ink); border-radius: 999px;
  padding: 8px 14px; font: inherit; font-size: 13.5px; font-weight: 700;
}
.lt-ai-ask { border-style: dashed; color: var(--fh-muted); margin: -4px 0 12px; }
.lt-ai small { font-size: 12px; }
.lt-ai-chips { display: grid; gap: 6px; }
.lt-ai-chip {
  text-align: left; font: inherit; font-family: var(--fh-serif); font-style: italic; font-size: 15px; line-height: 1.4; padding: 10px 12px; border-radius: 12px;
  background: var(--fh-card); color: var(--fh-ink); border: 1px solid var(--fh-line);
}

/* reading one */
.lt-sheet .cap-state { color: var(--fh-muted); }
.lt-open-now { margin: 0 0 8px; }
.cap-envelope.lt-env.legacy { background: #3b3430; }
.cap-envelope.lt-env.legacy::before { background: linear-gradient(to top right, transparent 49.5%, #4a413b 50%) left / 50% 100% no-repeat, linear-gradient(to top left, transparent 49.5%, #4a413b 50%) right / 50% 100% no-repeat; }
.cap-envelope.lt-env.legacy .cap-flap { background: #2e2824; }
.cap-envelope.lt-env.legacy .cap-seal { background: #b8925a; color: #2e2824; }
.lt-legacy-box { margin: 4px 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--fh-card); border: 1px solid var(--fh-line); font-size: 14px; line-height: 1.5; }
.lt-legacy-box p { margin: 0 0 8px; }
.lt-legacy-box ol { margin: 0 0 8px; padding-left: 20px; }
.lt-legacy-box li { margin: 0 0 6px; }
.lt-open-prompt { margin: -6px 0 12px; text-align: center; font-family: var(--fh-serif); font-style: italic; color: var(--fh-muted); }
.lt-pages { display: grid; gap: 12px; margin: 0 0 14px; }
.lt-pages figure { margin: 0; }
.lt-pages img { width: 100%; display: block; border-radius: 4px; box-shadow: 0 2px 14px rgba(0,0,0,.18); background: #fff; }
.lt-pages figcaption { text-align: center; font-size: 12.5px; color: var(--fh-muted); margin-top: 4px; }

/* a recipe card, as it would sit on the counter (paper in light and dark) */
.lt-recipe {
  margin: 6px 0 14px; padding: 16px 18px 18px; border-radius: 6px; color: #2b2620; box-shadow: 0 2px 14px rgba(0,0,0,.14);
  background-color: #fffdf6;
  background-image: repeating-linear-gradient(to bottom, transparent 0 25px, #d9e4f0 25px 26px);
  font-family: var(--fh-serif); font-size: 16px; line-height: 26px;
}
.lt-recipe-head { margin: -16px -18px 12px; padding: 16px 18px 8px; background: #fffdf6; border-bottom: 2px solid #e9a9a9; border-radius: 6px 6px 0 0; }
.lt-recipe-head b { display: block; font-size: 21px; line-height: 1.25; }
.lt-recipe-head small { display: block; font-size: 13px; color: #7c6b57; line-height: 1.3; }
.lt-recipe-label { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: #9a6a3a; margin: 6px 0 0; line-height: 26px; }
.lt-recipe ul, .lt-recipe ol { margin: 0; padding-left: 22px; }
.lt-recipe-story { margin: 10px 0 0; font-style: italic; white-space: pre-wrap; }

/* the Family History home card */
.lt-home { margin: 0 0 14px; }
.lt-home-kicker { font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--fh-muted); margin: 0 2px 6px; }
.lt-home .lt-nudge { margin-bottom: 2px; }
.lt-home > .lt-link { display: block; margin-left: auto; }
.lt-home-quiet {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border-radius: 18px; text-align: left; font: inherit;
  background: var(--fh-card); color: var(--fh-ink); border: 1px solid var(--fh-line);
}
.lt-home-quiet .lt-way-icon { margin: 0; }
.lt-home-quiet b { display: block; font-family: var(--fh-serif); font-size: 17px; font-weight: 600; }
.lt-home-quiet small { display: block; font-size: 13px; color: var(--fh-muted); line-height: 1.4; }

@media (max-width: 360px) {
  .lt-bdays { grid-template-columns: repeat(5, 1fr); }
  .lt-two { grid-template-columns: 1fr; }
}
