/* WIA MessageCenter
 *
 * Palette: blue-black ink on cool stationery white. Colour means state, one job
 * each. Prussian blue is something you can act on, marigold (the logo's gold)
 * is coming up (the "Next out" strip, campaigns sending now), green arrived,
 * red didn't. The WIA brand lives in the logo. All text passes WCAG AA.
 */

:root {
  --ink: #1a2233;
  --muted: #5b6472;
  --canvas: #f3f4f1;
  --surface: #ffffff;
  --rule: #dde1e6;
  --accent: #1f4e79;
  --accent-dark: #163a5c;
  --marigold: #f5a800;
  --amber-text: #8a5a00;
  --green: #2e6b3f;
  --red: #b42318;
  --red-tint: #fbe7e5;

  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, sans-serif;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.75rem;

  --radius: 6px;
  --gutter: 24px;
  --width: 960px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: var(--text-xl);
  line-height: 1.2;
}

h2 {
  font-size: var(--text-lg);
  line-height: 1.3;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-dark);
}

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

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.page {
  max-width: var(--width);
  margin: 0 auto;
  padding: 32px var(--gutter) 64px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 24px;
}

.page-head p {
  color: var(--muted);
}

/* Header */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.site-header .inner {
  display: flex;
  align-items: center;
  gap: 32px;
  max-width: var(--width);
  margin: 0 auto;
  padding: 12px var(--gutter);
}

.site-header img {
  display: block;
  height: 28px;
}

.site-nav {
  display: flex;
  gap: 24px;
  flex: 1;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
}

.site-nav a:hover {
  color: var(--accent);
}

.sign-out {
  color: var(--muted);
  font-size: var(--text-sm);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #ffffff;
}

.btn-quiet {
  background: transparent;
  color: var(--accent);
}

.btn-quiet:hover {
  background: var(--surface);
  color: var(--accent-dark);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Next out: the one marigold element */

.next-out {
  margin-bottom: 40px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--marigold);
}

.next-out .when {
  font-weight: 700;
}

.next-out-subject {
  margin: 4px 0 8px;
  font-size: var(--text-xl);
  line-height: 1.2;
}

.next-out .details {
  margin-bottom: 16px;
}

.next-out .actions {
  justify-content: space-between;
}

/* On marigold the primary action stays blue (its edge is 4.3:1 against the
 * gold). The quiet action and focus rings use ink, since blue text on gold
 * falls just short of AA.
 */

.next-out .btn-quiet {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

.next-out .btn-quiet:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.next-out .menu > summary {
  color: var(--ink);
}

.next-out .menu > summary:hover,
.next-out .menu[open] > summary {
  background: rgba(255, 255, 255, 0.35);
}

.next-out :focus-visible {
  outline-color: var(--ink);
}

/* Campaign lists */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 8px;
}

.campaigns {
  margin: 0 0 40px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.campaign {
  display: grid;
  grid-template-columns: 8.5rem 1fr auto;
  gap: 4px 24px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}

.campaign .date {
  display: flex;
  flex-direction: column;
}

.campaign .day {
  font-weight: 700;
}

.campaign .time,
.campaign .meta {
  color: var(--muted);
  font-size: var(--text-sm);
}

.campaign .subject {
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
}

.campaign .subject:hover {
  color: var(--accent);
  text-decoration: underline;
}

.campaign .actions {
  justify-content: flex-end;
}

.campaign .btn-quiet {
  border-color: transparent;
}

.campaign .btn-quiet:hover {
  border-color: var(--rule);
}

.empty {
  padding: 24px 0;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 40px;
}

.result-sent {
  color: var(--green);
}

.result-failed {
  color: var(--red);
  font-weight: 700;
}

.result-sending {
  color: var(--amber-text);
  font-weight: 700;
}

.more-link {
  font-size: var(--text-sm);
}

/* The ⋯ menu */

.menu {
  position: relative;
}

.menu > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius);
  color: var(--accent);
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu > summary:hover,
.menu[open] > summary {
  background: var(--surface);
}

.menu-items {
  position: absolute;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 13rem;
  margin-top: 4px;
  padding: 4px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(26, 34, 51, 0.12);
}

.menu-items a,
.menu-items button {
  padding: 8px 12px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-items a:hover,
.menu-items button:hover {
  background: var(--canvas);
}

.menu-items .danger {
  color: var(--red);
}

/* Forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

label,
.label {
  font-size: var(--text-sm);
  font-weight: 700;
}

.hint {
  color: var(--muted);
  font-size: var(--text-sm);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

h2.section-head {
  margin-bottom: 16px;
}

.notice {
  margin-bottom: 24px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--rule);
}

.error {
  color: var(--red);
  font-weight: 700;
}

.error:empty {
  display: none;
}

.error-box {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--red-tint);
  color: var(--red);
  font-weight: 700;
}

.error-box:empty {
  display: none;
}

/* Editor */

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.variables {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--accent);
}

.EasyMDEContainer .CodeMirror,
.editor-toolbar {
  border-color: var(--rule);
}

.EasyMDEContainer .CodeMirror {
  border-radius: 0 0 var(--radius) var(--radius);
  font-family: var(--font);
}

.editor-toolbar {
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

/* A rendered email, as a recipient sees it */

/* Email clients show messages about 600px wide, so previews match */

.email {
  max-width: 600px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
}

.email-head {
  padding: 12px 20px;
  border-bottom: 1px solid var(--rule);
  font-size: var(--text-sm);
  color: var(--muted);
}

.email-head strong {
  color: var(--ink);
}

.email-body {
  padding: 20px;
  overflow-wrap: anywhere;
}

.email-body .email-subject {
  margin-bottom: 16px;
  font-size: var(--text-lg);
  font-weight: 700;
}

.email-body p,
.email-body ul,
.email-body ol,
.email-body blockquote {
  margin: 0 0 1em;
}

.preview-sticky {
  position: sticky;
  top: 16px;
}

.preview-sticky > .label {
  display: block;
  margin-bottom: 6px;
}

.email-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.show-all > summary {
  list-style: none;
  align-self: flex-start;
}

.show-all > summary::-webkit-details-marker {
  display: none;
}

.show-all .when-open,
.show-all[open] .when-closed {
  display: none;
}

.show-all[open] .when-open {
  display: inline;
}

.show-all > .email-stack {
  margin-top: 24px;
}

/* Sent campaign summary */

.summary {
  margin-bottom: 32px;
}

.summary .result {
  font-size: var(--text-lg);
  margin: 8px 0 16px;
}

table.plain {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

table.plain th,
table.plain td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

table.plain th {
  font-size: var(--text-sm);
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 32px;
}

/* Lists page */

.list-sizes .campaign {
  grid-template-columns: 1fr auto;
}

/* Sign in */

.sign-in {
  max-width: 360px;
  margin: 12vh auto 0;
  padding: 0 var(--gutter);
}

.sign-in img {
  display: block;
  height: 40px;
  margin-bottom: 24px;
}

.sign-in h1 {
  margin-bottom: 24px;
}

.sign-in .btn {
  width: 100%;
  justify-content: center;
}

/* Phones */

@media (max-width: 720px) {
  :root {
    --gutter: 16px;
  }

  .site-header .inner {
    gap: 20px;
  }

  .site-nav {
    gap: 16px;
  }

  .page {
    padding-top: 24px;
  }

  .campaign {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "date actions"
      "main main";
  }

  .campaign .date {
    grid-area: date;
    flex-direction: row;
    gap: 8px;
    align-items: baseline;
  }

  .campaign .main {
    grid-area: main;
  }

  .campaign .actions {
    grid-area: actions;
  }

  .list-sizes .campaign {
    grid-template-areas: none;
  }

  .next-out {
    padding: 20px 16px;
  }

  .editor,
  .field-row {
    grid-template-columns: 1fr;
  }

  .preview-sticky {
    position: static;
  }
}
