/* EML viewer (/tools/eml-viewer). Sits on docs.css's .tool card and .drop zone; colours from style.css's Day + Dusk tokens.
   The letter itself is always on white paper, as Roost shows designed letters in Dusk. */
.eml-drop { cursor: default; }
.eml-drop > .ic { width: 30px; height: 30px; color: var(--ink-3); }
.eml-dropline { display: grid; gap: 2px; cursor: pointer; }
.eml-dropline b { font-size: 16.5px; font-weight: 600; color: var(--ink); }
.eml-dropline span { font-size: 14px; color: var(--ink-3); }
.eml-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
.eml-drop.small { min-height: 0; grid-template-columns: auto minmax(0, 1fr) auto; place-items: center start; gap: 12px; padding: 12px 14px; text-align: left; }
.eml-drop.small > .ic { width: 22px; height: 22px; }
.eml-drop.small .eml-dropline b { font-size: 14.5px; }
.eml-drop.small .eml-dropline span { display: none; }
.eml-drop.small .eml-actions { margin: 0; justify-content: flex-end; }
.eml-drop.small .b { height: 32px; padding: 0 12px; font-size: 13.5px; }

.eml-out:empty { display: none; }
.eml-out { display: grid; gap: 14px; }
.eml-msg { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--sub); font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.eml-msg.err { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.eml-msg.err::before { content: ""; flex: none; align-self: flex-start; margin-top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--cr-red); }
.eml-spin { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--ink-2); animation: eml-spin .8s linear infinite; }
@keyframes eml-spin { to { transform: rotate(360deg); } }

.eml-file { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13.5px; color: var(--ink-3); }
.eml-file .ic { width: 16px; height: 16px; }
.eml-file b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.eml-local { margin-left: auto; padding: 2px 9px; border-radius: 99px; background: var(--sub); color: var(--ink-2); font-size: 12.5px; }
.eml-note { padding: 10px 14px; border-left: 3px solid var(--cr-amber); border-radius: 0 10px 10px 0; background: var(--card-2); font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }

.eml-letter { border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line-2); background: var(--card-2); overflow: hidden; }
.eml-head { padding: 16px 18px 12px; }
.eml-head .eml-subj { margin: 0; font: 650 21px/1.3 var(--display); letter-spacing: -.015em; color: var(--ink); overflow-wrap: anywhere; }
.eml-head dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin-top: 10px; font-size: 14.5px; line-height: 1.45; }
.eml-head dt { color: var(--ink-3); }
.eml-head dd { font-size: 14.5px; line-height: 1.45; color: var(--ink-2); overflow-wrap: anywhere; }
.eml-head dd b { color: var(--ink); font-weight: 600; }
.eml-addr { color: var(--ink-3); }

.eml-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 9px 18px; border-top: 1px solid var(--line-2); font-size: 13.5px; color: var(--ink-2); }
.eml-shield { display: inline-flex; align-items: center; gap: 7px; }
.eml-shield .ic { width: 15px; height: 15px; color: var(--cr-green); }
.eml-shield.quiet { color: var(--ink-3); }
.eml-link { color: var(--cr-blue); font-weight: 600; font-size: 13.5px; }
.eml-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.eml-views { margin-left: auto; display: inline-flex; padding: 2px; border-radius: 8px; background: var(--seg); }
.eml-views button { padding: 3px 10px; border-radius: 6px; font-size: 13px; color: var(--ink-3); }
.eml-views button[aria-pressed="true"] { background: var(--seg-on); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(14,20,48,.12); }

.eml-body { border-top: 1px solid var(--line-2); }
.eml-paper { background: #fff; color-scheme: light; }
.eml-frame { display: block; width: 100%; height: 360px; border: 0; background: #fff; }
.eml-text { padding: 16px 18px 20px; white-space: pre-wrap; overflow-wrap: anywhere; font: 15px/1.6 var(--sans); color: var(--letter); }
.eml-body .eml-msg { margin: 14px 18px; }

.eml-files h4, .eml-headers summary { font: 600 14px var(--sans); color: var(--ink); }
.eml-files ul { list-style: none; padding: 0; margin-top: 8px; display: grid; gap: 8px; }
.eml-files li { display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px 12px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 14px; }
.eml-files li > .ic { width: 22px; height: 22px; color: var(--ink-3); flex: none; }
.eml-thumb { width: 40px; height: 40px; flex: none; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); }
.eml-fmeta { display: grid; min-width: 0; flex: 1; }
.eml-fmeta b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.eml-fmeta span { font-size: 12.5px; color: var(--ink-3); }
.prose .eml-files a.b, .eml-sm { height: 30px; padding: 0 11px; font-size: 13px; color: var(--ink); text-decoration: none; flex: none; }

.eml-headers { border-radius: 12px; background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.eml-headers summary { padding: 11px 14px; cursor: pointer; list-style: none; }
.eml-headers summary::-webkit-details-marker { display: none; }
.eml-headers summary::after { content: "+"; margin-left: auto; color: var(--ink-4); font-weight: 400; }
.eml-headers[open] summary::after { content: "–"; }
.eml-headers pre { margin: 0 14px 14px; padding: 12px; max-height: 420px; overflow: auto; border-radius: 10px; background: var(--sub); font: 12.5px/1.55 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 560px) {
  .eml-drop.small { grid-template-columns: auto minmax(0, 1fr); }
  .eml-drop.small .eml-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .eml-head { padding: 14px 14px 10px; }
  .eml-head dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .eml-head dt { margin-top: 6px; font-size: 12.5px; }
  .eml-bar { padding: 9px 14px; }
  .eml-views { margin-left: 0; }
  .eml-local { margin-left: 0; }
  .eml-files li { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .eml-spin { animation-duration: 2.4s; } }
