/* Styles of the viewer page. The email itself renders in a sandboxed frame with its own styles. */
@font-face {
  font-family: "Lora";
  src: url("/fonts/Lora-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --font-reading: "Lora", Georgia, "Times New Roman", serif;
  --page: #f4f5f7;
  --surface: #ffffff;
  --text: #15171c;
  --muted: #565d6b;
  --line: #d9dde4;
  --accent: #1d5fd1;
  --accent-text: #ffffff;
  --notice: #fff4d6;
  --notice-line: #e2c36a;
  --danger: #a4262c;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #111318;
    --surface: #1b1e25;
    --text: #eceef2;
    --muted: #a6adba;
    --line: #333844;
    --accent: #7fb0ff;
    --accent-text: #0c1730;
    --notice: #3a3115;
    --notice-line: #7d6a2a;
    --danger: #ff9a9f;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans CJK SC", "Hiragino Sans", "Malgun Gothic", sans-serif;
}

[hidden] {
  display: none !important;
}

.bar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-reading);
  font-size: 1.1rem;
  font-weight: 600;
}

/* Headings use Lora, the font of Mailglade. Lora has no glyphs for Japanese, Korean, and Chinese, so those languages keep the font of the page. */
h1,
h2 {
  font-family: var(--font-reading);
  font-weight: 500;
}

:lang(ja) h1,
:lang(ko) h1,
:lang(zh) h1,
:lang(ja) h2,
:lang(ko) h2,
:lang(zh) h2 {
  font-family: inherit;
  font-weight: 600;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px;
}

.notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--notice-line);
  border-radius: var(--radius);
  background: var(--notice);
  font-size: 0.95rem;
}

.panel,
article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel h1,
article h1 {
  margin: 0 0 12px;
  font-size: 1.35rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.panel p {
  margin: 0 0 12px;
}

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

.failure h1 {
  font-size: 1.1rem;
}

.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 12px;
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.meta dt {
  color: var(--muted);
}

.meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* An email assumes a white page, so the frame stays white in the dark theme. */
.body-frame {
  display: block;
  width: 100%;
  height: 70vh;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.body-text {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#files h2 {
  margin: 20px 0 8px;
  font-size: 1.05rem;
}

.files {
  margin: 0;
  padding: 0;
  list-style: none;
}

.files li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.files .name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.files .size {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.files .file-error {
  flex-basis: 100%;
  color: var(--danger);
  font-size: 0.9rem;
}

label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

input[type="password"] {
  display: block;
  width: 100%;
  max-width: 360px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--page);
  color: var(--text);
  font: inherit;
}

.field-error {
  color: var(--danger);
}

button {
  padding: 8px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: progress;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

footer p {
  margin: 0 0 6px;
}

footer a {
  color: inherit;
}

@media (max-width: 520px) {
  .panel,
  article {
    padding: 14px;
  }

  .files li {
    flex-wrap: wrap;
  }
}
