/* PhantomShield dashboard.
   The look borrows from airmail stationery: pale blue paper, navy ink, the
   red-and-blue striped edge, typewritten addresses, and a rubber stamp for
   the one thing that needs attention (a possible leak). No web fonts and no
   third-party requests: everything here is served from this site. */

:root {
  --paper: #edf2f7;
  --sheet: #ffffff;
  --ink: #16213a;
  --graphite: #56617a;
  --rule: #c9d3e0;
  --blue: #1f44c4;
  --blue-wash: #e3eafb;
  --red: #c8102e;
  --red-wash: #fbe9ec;
  --ok-ink: #1e5b36;
  --ok-wash: #e6f2ea;
  --on-accent: #ffffff;

  --ui: "Gill Sans", "Gill Sans MT", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --typed: "American Typewriter", "Courier New", Courier, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 2.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1728;
    --sheet: #18233b;
    --ink: #e8edf7;
    --graphite: #9aa7bf;
    --rule: #2c3b59;
    --blue: #93abff;
    --blue-wash: #1d2c52;
    --red: #ff7387;
    --red-wash: #3a1a24;
    --ok-ink: #8fd6a9;
    --ok-wash: #16302a;
    --on-accent: #0f1728;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: var(--step-0);
  line-height: 1.5;
}

.airmail-edge {
  height: 10px;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 14px,
    var(--paper) 14px 28px,
    var(--blue) 28px 42px,
    var(--paper) 42px 56px
  );
}

.masthead,
main {
  max-width: 54rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.75rem;
  padding-top: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  color: var(--ink);
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.mainnav { display: flex; gap: 1.25rem; flex: 1; }
.mainnav a { color: var(--graphite); text-decoration: none; padding: 0.15rem 0; }
.mainnav a:hover { color: var(--ink); }
.mainnav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--blue); }

.badge {
  display: inline-block;
  min-width: 1.35em;
  padding: 0 0.35em;
  border-radius: 1em;
  background: var(--red);
  color: var(--on-accent);
  font-size: var(--step--1);
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.signout { margin: 0; }

main { padding-top: 2rem; padding-bottom: 4rem; }

h1 { font-size: var(--step-2); line-height: 1.15; font-weight: 600; margin: 0 0 0.5rem; }
h2 { font-size: var(--step-1); line-height: 1.3; font-weight: 600; margin: 0 0 0.5rem; }
p { margin: 0 0 1rem; max-width: 42rem; }
a { color: var(--blue); text-underline-offset: 0.15em; }
section { margin-top: 2.75rem; }

.lede { color: var(--graphite); margin-bottom: 1.75rem; }
.crumb { margin-bottom: 0.25rem; font-size: var(--step--1); }
.footnote, .hint { color: var(--graphite); font-size: var(--step--1); }
.footnote { margin-top: 0.75rem; }
.hint { margin: 0.25rem 0 0; }
.optional { color: var(--graphite); font-weight: 400; }
.narrow { max-width: 26rem; }
.empty { color: var(--graphite); padding: 1.25rem 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- addresses: set like a typed envelope */

.address {
  font-family: var(--typed);
  font-weight: 600;
  overflow-wrap: anywhere;
  user-select: all;
}
.address-large { font-size: 1.15rem; }
.address-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }

/* ---- notices */

.notice {
  max-width: none;
  padding: 0.7rem 1rem;
  border: 1px solid;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.notice-ok { background: var(--ok-wash); border-color: var(--ok-ink); color: var(--ok-ink); }
.notice-error { background: var(--red-wash); border-color: var(--red); color: var(--red); }

/* ---- forms */

.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 1rem; align-items: stretch; }
.stack .button { align-self: flex-start; }

label { font-size: var(--step--1); font-weight: 600; }

input, select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--graphite);
  border-radius: 4px;
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
}
input::placeholder { color: var(--graphite); opacity: 0.75; }

.button, .plain-button, .copy-button, .switch { font: inherit; cursor: pointer; }

.button {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--blue);
  border-radius: 4px;
  background: var(--blue);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.button:hover { filter: brightness(1.1); }
.button-quiet { background: transparent; color: var(--blue); }
.button-danger { background: var(--red); border-color: var(--red); }
.button-quiet-danger { background: transparent; border-color: var(--red); color: var(--red); }
.button-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0; }

.plain-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--graphite);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.plain-button:hover { color: var(--ink); }

.copy-button {
  padding: 0.05rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: transparent;
  color: var(--graphite);
  font-size: var(--step--1);
}
.copy-button:hover { border-color: var(--graphite); color: var(--ink); }

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

/* ---- new alias */

.new-alias {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.9rem;
  align-items: end;
  margin-bottom: 2rem;
  padding: 1.1rem 1.25rem 1.25rem;
  border: 1px dashed var(--graphite);
  border-radius: 6px;
}
.new-alias .button { justify-self: start; }

/* ---- the ledger of aliases */

.ledger { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }

.strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.3rem 1.25rem;
  padding: 0.9rem 1.25rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--sheet);
  scroll-margin-top: 1rem;
}
.strip:target { border-color: var(--blue); }
.strip .address-line, .strip-meta { grid-column: 1 / -1; }

.strip-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.1rem; min-width: 0; }
.strip-label { color: var(--ink); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.strip-label:hover { text-decoration: underline; }
.strip-meta { margin: 0.1rem 0 0; color: var(--graphite); font-size: var(--step--1); }

.is-off .address { color: var(--graphite); text-decoration: line-through; }
.strip.is-off { background: transparent; }

/* ---- the stamp: the one loud thing on the page */

.stamp {
  display: inline-block;
  margin: 0.3rem 0.25rem;
  padding: 0.1rem 0.65rem;
  border: 2px solid var(--red);
  border-radius: 4px;
  outline: 1px solid var(--red);
  outline-offset: 2px;
  color: var(--red);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transform: rotate(-3deg);
}
.stamp:hover { background: var(--red-wash); }
.stamp:focus-visible { outline: 3px solid var(--blue); }

/* ---- on/off switch */

.switch-form { margin: 0; align-self: start; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink);
}
.switch-track {
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  border: 2px solid var(--graphite);
  border-radius: 999px;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.5rem - 8px);
  height: calc(1.5rem - 8px);
  border-radius: 50%;
  background: var(--graphite);
}
.switch[aria-checked="true"] .switch-track { border-color: var(--blue); background: var(--blue); }
.switch[aria-checked="true"] .switch-thumb { left: calc(100% - 1.5rem + 6px); background: var(--on-accent); }
.switch-text { min-width: 1.8em; font-weight: 600; text-align: left; }
.switch[aria-checked="false"] .switch-text { color: var(--graphite); }

@media (prefers-reduced-motion: no-preference) {
  .switch-thumb { transition: left 120ms ease-out; }
}

/* ---- alias detail */

.detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin: 0.75rem 0 0.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--sheet);
}
.state-line { color: var(--graphite); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem 2rem; margin: 1.5rem 0 0; }
.facts dt { color: var(--graphite); font-size: var(--step--1); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.senders { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.sender {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 7.5rem minmax(0, 1fr) 16.5rem;
  gap: 0.1rem 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.sender-name { font-weight: 600; overflow-wrap: anywhere; }
.sender-count { font-variant-numeric: tabular-nums; }
.sender-since { color: var(--graphite); }
.sender.is-flagged .sender-name, .sender.is-flagged .sender-status { color: var(--red); }

.activity { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.activity li { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 0.25rem 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }
.activity time { color: var(--graphite); font-variant-numeric: tabular-nums; white-space: nowrap; }
.activity-blocked span, .activity-dropped span { color: var(--graphite); }

/* ---- leaks */

.leaks { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.leak { padding: 1.25rem; border: 1px solid var(--red); border-radius: 6px; background: var(--sheet); }
.leak h2 { overflow-wrap: anywhere; }

/* ---- account */

.inboxes { margin: 0 0 0.75rem; padding-left: 1.1rem; }
.tag { color: var(--red); font-size: var(--step--1); }

/* ---- small screens */

@media (max-width: 40rem) {
  h1 { font-size: 1.75rem; }
  .masthead { gap: 0.5rem 1rem; }
  .mainnav { order: 3; flex-basis: 100%; }
  .signout { margin-left: auto; }
  .strip, .detail-head { padding-left: 1rem; padding-right: 1rem; }
  .detail-head { grid-template-columns: minmax(0, 1fr); }
  .sender { grid-template-columns: minmax(0, 1fr) auto; }
  .sender-status, .sender-since { font-size: var(--step--1); }
  .sender-since { text-align: right; }
  .activity li { grid-template-columns: 1fr; gap: 0; }
}
