/* Fraunces for the name and headings, Inter for text: ours, in fonts/ (web/fonts.nix) */
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #f5f6f1;
  --surface: #ffffff;
  --text: #17201d;
  --muted: #5a6762;
  --line: #dde3dd;
  --accent: #1f6f5c;
  --accent-soft: #e3efe9;
  --accent-text: #ffffff;
  --ok: #1f6f5c;
  --wait: #9a6b00;
  --danger: #b3261e;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(23 32 29 / 4%), 0 4px 16px rgb(23 32 29 / 5%);
  --display: "Fraunces", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101412;
    --surface: #181e1c;
    --text: #e6ebe8;
    --muted: #9aa7a2;
    --line: #2a3330;
    --accent: #5cc3a5;
    --accent-soft: #1b2e28;
    --accent-text: #0b100e;
    --ok: #5cc3a5;
    --wait: #e0b04a;
    --danger: #f2827a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 20px;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main, header, footer { max-width: 960px; margin: 0 auto; }

/* --- Header and name ------------------------------------------------------ */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0;
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.logo img { border-radius: 7px; }
.logo em { color: var(--accent); }
.small-logo { font-size: 1.15rem; gap: 8px; }

nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--text); }
nav a.nav-button { color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 4px 14px; }
nav a.nav-button:hover { background: var(--accent); color: var(--accent-text); }
/* On a phone: the name and Sign in, side by side; the sections are a scroll away */
@media (max-width: 600px) {
  header { flex-wrap: nowrap; }
  nav a:not(.nav-button) { display: none; }
}

/* --- Type -------------------------------------------------------------------- */

h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: clamp(2.3rem, 6vw, 3.6rem); line-height: 1.08; margin: 40px 0 20px; }
h1 em { font-style: italic; color: var(--accent); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2rem); line-height: 1.2; margin: 72px 0 20px; }
h3 { font-size: 1.05rem; margin: 0 0 6px; }
h4 { font-size: 0.95rem; margin: 8px 0 0; }
p { margin: 0 0 12px; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 660px; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.eyebrow { margin: 32px 0 0; color: var(--accent); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

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

/* --- Controls ---------------------------------------------------------------- */

.button, button {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s;
}
.button:hover, button:hover { filter: brightness(1.08); }
.button.secondary, button.secondary { background: transparent; color: var(--accent); }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button:disabled { opacity: 0.6; cursor: wait; }

input, select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

label { display: grid; gap: 4px; font-size: 0.9rem; color: var(--muted); }

/* --- Layout and cards ------------------------------------------------------- */

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > label { flex: 1 1 180px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card > :last-child { margin-bottom: 0; }

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

ul.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
ul.checks li { padding-left: 30px; position: relative; }
ul.checks li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
@media (min-width: 760px) {
  ul.checks.columns { grid-template-columns: 1fr 1fr; gap: 18px 32px; }
}

/* --- Landing page --------------------------------------------------------- */

.hero { padding-bottom: 8px; }

/* Where mxferry stands: the internet, the ferry, your server; across, or down on narrow screens */
.flow {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.1fr 1.2fr 1fr;
  align-items: center;
  margin-top: 48px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow);
}
.flow .node {
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
  font-weight: 600;
}
.flow .node.ferry { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.flow .node.ferry strong { display: block; font-family: var(--display); font-size: 1.3rem; font-style: italic; }
.flow .node.ferry span { display: block; font-size: 0.8rem; font-weight: 500; opacity: 0.85; }
.flow .link { display: grid; gap: 6px; padding: 0 8px; color: var(--muted); font-size: 0.8rem; text-align: center; }
.flow .link .in::after { content: " →"; color: var(--accent); font-weight: 700; }
.flow .link .out::before { content: "← "; color: var(--accent); font-weight: 700; }
@media (max-width: 700px) {
  .flow { grid-template-columns: 1fr; gap: 10px; }
  .flow .link { grid-template-columns: 1fr 1fr; }
  .flow .link .in::after { content: " ↓"; }
  .flow .link .out::before { content: "↑ "; }
}

/* The four steps, numbered */
ol.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  counter-reset: step;
}
ol.steps li { counter-increment: step; }
ol.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
}

.card.plan h3 { font-family: var(--display); font-size: 1.4rem; }
.price { font-family: var(--display); font-size: 1.6rem; font-weight: 600; color: var(--accent); margin: 2px 0 10px; }

.questions { display: grid; gap: 12px; }
.questions details summary {
  color: var(--text);
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.questions details summary::-webkit-details-marker { display: none; }
.questions details summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; line-height: 1; }
.questions details[open] summary::after { content: "−"; }
.questions details p { margin: 12px 0 0; }

/* --- Dashboard ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
code, .mono { font-family: var(--mono); font-size: 0.9em; overflow-wrap: anywhere; }
/* Record names break only when they must, so long values (DKIM keys) take the wrapping */
.mono.name { overflow-wrap: break-word; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; border: 1px solid currentColor; }
.badge.ok { color: var(--ok); }
.badge.wait { color: var(--wait); }
.badge.fail { color: var(--danger); }
.badge.muted { color: var(--muted); }

.notice { border-left: 4px solid var(--wait); padding: 12px 16px; background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.notice.ok { border-left-color: var(--ok); }
.error { color: var(--danger); min-height: 1.6em; }

details summary { cursor: pointer; color: var(--accent); }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; overflow-x: auto; white-space: pre; margin: 8px 0 0; }

.key {
  font-family: var(--mono);
  font-size: 1rem;
  padding: 14px;
  background: var(--bg);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
  user-select: all;
}

/* Statistics: tiles, then the daily chart. Series colors: the reference categorical palette's
   first three slots (blue, orange, aqua), validated in both modes against these surfaces. */
:root { --series-1: #257de0; --series-2: #f47230; --series-3: #00b894; }
@media (prefers-color-scheme: dark) {
  :root { --series-1: #338ced; --series-2: #e76624; --series-3: #00a888; }
}
.stats { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.stat { display: flex; flex-direction: column; min-width: 120px; }
.stat-value { font-family: var(--display); font-size: 1.8rem; font-weight: 600; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 0.9rem; }
.chart-empty { padding: 16px 0; }
.chart-wrap { display: flex; flex-direction: column; gap: 6px; }
.chart-area { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .series-1 { fill: var(--series-1); }
.chart .series-2 { fill: var(--series-2); }
.chart .series-3 { fill: var(--series-3); }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 11px; }
.chart-hit { fill: transparent; }
.chart-day:focus { outline: none; }
.chart-day:hover .chart-hit, .chart-day:focus .chart-hit { fill: var(--line); fill-opacity: 0.35; }
.chart-tip {
  position: absolute; bottom: 100%; transform: translateX(-50%); margin-bottom: 4px; z-index: 1;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 8px 10px; font-size: 0.82rem; white-space: nowrap; pointer-events: none;
}
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; }
.swatch.series-1 { background: var(--series-1); }
.swatch.series-2 { background: var(--series-2); }
.swatch.series-3 { background: var(--series-3); }

/* Spam filtering: the levels as cards to choose from, the sender lists */
.levels { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.levels legend { font-weight: 600; margin-bottom: 4px; }
.level { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.level:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.level > span { display: flex; flex-direction: column; gap: 2px; }
.level input { margin-top: 4px; }
.senders, .test-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.test-results li { padding: 10px 0; border-bottom: 1px solid var(--line); }

/* --- Footer ------------------------------------------------------------------ */

footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 72px;
  padding: 28px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
footer p { margin: 0; }

[hidden] { display: none !important; }
.capitalize { text-transform: capitalize; }
