/* Email viewer, on tokens.css, site.css and ../tool.css; prefix vw-. The message is styled in its frame by frame.js. */

.vw-tool .e2p-drop-hint { margin-top: 12px; }
.vw { margin-top: 18px; }
.vw-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: 0 0 10px; }
.vw-bar h2 { margin: 0; font-size: clamp(1.15rem, 2.6vw, 1.35rem); }
.vw-bar .btn-sm { min-height: 44px; }
.vw-layout { display: grid; gap: 14px; align-items: start; }
@media (min-width: 1000px) { .vw-layout:has(> .vw-list-wrap:not([hidden])) { grid-template-columns: 290px minmax(0, 1fr); } }
.vw-main { min-width: 0; }

/* The list of opened emails */
.vw-list-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: auto; max-height: 260px; }
@media (min-width: 1000px) { .vw-list-wrap { max-height: min(75vh, 760px); position: sticky; top: 76px; } }
.vw-list { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; }
.vw-list li.is-child { padding-left: 16px; }
.vw-item { display: block; width: 100%; min-height: 44px; text-align: start; font: inherit; color: var(--ink); background: none;
  border: 1px solid transparent; border-radius: 10px; padding: 8px 11px; cursor: pointer; }
.vw-item:hover { background: var(--well); }
.vw-item[aria-current="true"] { background: var(--brass-soft); border-color: #e3cd9c; }
.vw-item-subj { display: block; font-weight: 600; font-size: 0.92rem; line-height: 1.35; overflow-wrap: anywhere; }
.vw-item-sub { display: block; font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.vw-item.is-bad .vw-item-sub { color: var(--e2p-err); }

/* One email */
.vw-status { margin: 0 0 10px; font-size: 0.9rem; color: var(--muted); }
.vw-msg { margin-top: 0; min-width: 0; }
.vw-msg[aria-busy="true"] { opacity: 0.55; }
.vw-msg:empty { display: none; }
.vw-parent { margin: 0 0 4px; font-size: 0.88rem; color: var(--muted); }
.vw-parent .e2p-linkbtn { padding: 0 2px; min-height: 0; font-size: inherit; }
.vw-subject { font: 700 clamp(1.25rem, 3vw, 1.6rem)/1.25 var(--font-serif); margin: 0 0 12px; overflow-wrap: anywhere; outline: none; }
.vw-head { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; margin: 0 0 12px; font-size: 0.93rem; }
.vw-head dt { font: 600 0.72rem/1.95 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.vw-head dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }
.vw-head dd.muted { color: var(--muted); }
.vw-more { padding: 0 2px; min-height: 0; font-size: inherit; }
.vw-receipt { margin: 0 0 12px; }
.vw-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 14px; }
.vw-actions .btn { min-height: 44px; }
.vw-actions .btn svg { width: 18px; height: 18px; flex: none; }
.vw-pdf-msg { margin: 0; font-size: 0.88rem; color: var(--muted); flex: 1 1 240px; overflow-wrap: anywhere; }
.vw-pdf-msg:empty { display: none; }
.vw-pdf-msg.is-ok { color: var(--e2p-ok-ink); }
.vw-pdf-msg.is-err { color: var(--e2p-err); }
.vw-notes { list-style: none; margin: 0 0 14px; padding: 10px 12px; background: var(--e2p-warn-bg); border: 1px solid var(--e2p-warn-line); border-radius: 10px; color: var(--e2p-warn-ink); font-size: 0.88rem; }
.vw-notes li + li { margin-top: 4px; }

/* Attachments */
.vw-atts h3 { font-size: 0.95rem; margin: 0 0 8px; }
.vw-att-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.vw-att { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 8px 7px 10px; background: var(--card); }
.vw-att-icon { flex: none; color: var(--muted); }
.vw-att-icon svg { display: block; width: 22px; height: 22px; }
.vw-att-main { flex: 1 1 auto; min-width: 0; }
.vw-att-name { display: block; font-weight: 600; font-size: 0.92rem; overflow-wrap: anywhere; }
.vw-att-meta { font-size: 0.8rem; color: var(--muted); margin-right: 6px; }
.vw-att .e2p-chip { margin: 3px 4px 0 0; }
.vw-att-btns { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.vw-att-btns .btn { min-height: 44px; }
.vw-att-btns .btn svg { width: 16px; height: 16px; flex: none; }
/* Phone: only a row with Save and Open gives them their own line */
@media (max-width: 479px) {
  .vw-att.has-open { flex-wrap: wrap; }
  .vw-att.has-open .vw-att-main { flex-basis: calc(100% - 40px); }
  .vw-att.has-open .vw-att-btns { width: 100%; justify-content: flex-end; }
}
/* Pictures shown in the message: listed last, folded away */
.vw-att-inline { margin: 0 0 14px; }
.vw-att-inline > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 0.88rem; color: var(--ink-2); }
.vw-att-inline > summary::-webkit-details-marker { display: none; }
.vw-att-inline > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(-45deg); margin: 0 2px 0 4px; }
.vw-att-inline[open] > summary::before { transform: rotate(45deg); }
.vw-att-inline > .vw-att-list { margin-top: 4px; }
.vw-atts > h3:focus { outline: none; }
.vw-att-jump, .vw-links-hint { margin: 0 0 8px; font-size: 0.88rem; color: var(--muted); }
.vw-att-jump .e2p-linkbtn, .vw-links-hint .e2p-linkbtn { padding: 8px 2px; }

/* Meeting invites */
.vw-meeting { border: 1px solid var(--line); background: #f3f5f8; border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; }
.vw-meeting h3 { font-size: 0.95rem; margin: 0 0 6px; }
.vw-meeting-rows { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; margin: 0; font-size: 0.9rem; }
.vw-meeting-rows dt { font: 600 0.72rem/1.9 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.vw-meeting-rows dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }

/* The message frame (built by frame.js). width 1px + min-width 100%: iOS Safari otherwise widens a frame to its content. */
.vw-frame-wrap { margin: 0 0 12px; }
.vw-frame { display: block; width: 1px; min-width: 100%; height: 240px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.e2p-dragging .vw-frame { pointer-events: none; } /* dragged files pass through the frame to the page */
.vw-empty { margin: 0; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-style: italic; }

/* Links, listed under the message */
.vw-links { border: 1px solid var(--line); border-radius: 12px; background: #fdfcf9; }
.vw-links > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; border-radius: 12px; font-weight: 600; }
.vw-links > summary::-webkit-details-marker { display: none; }
.vw-links > summary::before { content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(-45deg); transition: transform .15s; margin: 0 4px 0 2px; }
.vw-links[open] > summary::before { transform: rotate(45deg); }
.vw-links > summary:hover { background: var(--well); }
.vw-links-note { margin: 0 14px 10px; font-size: 0.85rem; color: var(--muted); }
.vw-link-list { margin: 0; padding: 0 14px 12px 36px; font-size: 0.88rem; }
.vw-link-list li { margin: 0 0 8px; overflow-wrap: anywhere; }
.vw-link-text { display: block; color: var(--ink-2); }
.vw-link-host { display: block; color: var(--ink-2); }
.vw-link-host strong { color: var(--ink); overflow-wrap: anywhere; }
.vw-link-href { display: inline-block; padding: 2px 0; color: var(--ink); word-break: break-all; }
.vw-link-list .e2p-chip { margin-left: 6px; }

.vw-bad h2 { font-size: clamp(1.2rem, 3vw, 1.45rem); overflow-wrap: anywhere; outline: none; }
.vw-bad p { margin: 0 0 8px; color: var(--ink-2); }
.vw-bad .vw-bad-tip { color: var(--muted); font-size: 0.9rem; }

/* The calm line to the converter */
.vw-convert { margin: 18px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 0.93rem; color: var(--ink-2); }
.vw-convert strong { color: var(--ink); }

/* Guides: these cards hold steps as sentences */
.vw-guides .e2p-guide p { font-size: 0.95rem; color: var(--ink-2); }
.vw-guides .e2p-guide p.vw-source { margin-top: 8px; font-size: 0.85rem; color: var(--muted); }

/* Print: with an email open (.vw-has-email on <html>), that email and nothing around it; else the page as an article */
@media print {
  .vw-tool { display: none; }
  .vw-has-email .vw-tool { display: block !important; padding: 0; }
  .vw-has-email :is(.site-header, .site-footer, .skip, main > :not(#viewer), .vw-tool > :not(#vw), .vw-bar, .vw-list-wrap, .vw-status,
    .vw-receipt, .vw-actions, .vw-att-btns, .vw-att-jump, .vw-links-hint, .vw-links, .vw-parent) { display: none !important; }
  .vw-has-email .vw-layout { display: block !important; }
  .vw-has-email .vw-msg { border: 0 !important; box-shadow: none !important; padding: 0 !important; margin: 0; }
  .vw-has-email .vw-att { break-inside: avoid; }
  .vw-has-email .vw-frame { border: 0; border-radius: 0; }
}
