/*
 * Dezzi's design system: the tokens, the base and the components every page shares (site, docs, dashboard).
 * Warm cream ground, ink text, and bold ink outlines with a hard offset shadow on what can be pressed.
 * Neutrals follow one 10-step scale used by role: 1–3 surfaces, 4–6 dividers, 7–8 quiet text, 9–10 text.
 * Tomato is the one call to act on a page (start free, the next step). Four pastels each have one job, in both
 * light and dark: butter waits for you, sky is your team, lilac is bugs, mint is done. Text on tomato or a pastel is
 * always ink, never white.
 */
@font-face {
  font-family: 'DM Sans';
  src: url('/fonts/dm-sans-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --gray-1: #fff7ec;
  --gray-2: #fff0d9;
  --gray-3: #f8e9d2;
  --gray-4: #ecdec8;
  --gray-5: #ddcdb4;
  --gray-6: #c4b49b;
  --gray-7: #918b80;
  --gray-8: #66667a;
  --gray-9: #4a4a5e;
  --gray-10: #1a1a2e;
  --surface: #ffffff;
  --ink: #1a1a2e;
  --on-ink: #ffffff;
  --line: #1a1a2e;
  --hard: #1a1a2e;
  --tomato: #ff5a36;
  --tomato-strong: #f2471f;
  --sky: #bfe3ff;
  --butter: #ffe58a;
  --mint: #bdf2d5;
  --lilac: #e2d9ff;
  --blush: #ffd9cf;
  /* Ink stays ink on tomato and the pastels, whatever the mode. */
  --on-color: #1a1a2e;
  --ok: #14633a;
  --warn: #6b4e00;
  --bad: #b42318;
  --info: #1d4f86;
  --focus: #1a1a2e;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --sans: 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', 'DM Sans', ui-sans-serif, system-ui, sans-serif;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root {
    --gray-1: #15152a;
    --gray-2: #1c1c34;
    --gray-3: #24243f;
    --gray-4: #2f2f4e;
    --gray-5: #3b3b5e;
    --gray-6: #4f4f76;
    --gray-7: #7c7c9e;
    --gray-8: #a5a5c0;
    --gray-9: #c6c6d8;
    --gray-10: #fff7ec;
    --surface: #1e1e38;
    --ink: #fff7ec;
    --on-ink: #1a1a2e;
    --line: #6c6c98;
    --hard: #07070f;
    --ok: #7ee0a8;
    --warn: #ffd65c;
    --bad: #ff9a85;
    --info: #9ccfff;
    --focus: #ffe58a;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--gray-1); color: var(--gray-10); }
img, svg { max-width: 100%; }
a { color: inherit; text-decoration-color: var(--gray-6); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--butter); color: var(--on-color); }
h1, h2, h3, h4 { font-family: var(--display); color: var(--gray-10); letter-spacing: -0.025em; line-height: 1.12; text-wrap: balance; }
h1 { font-size: 30px; font-weight: 800; margin: 0 0 6px; }
h2 { font-size: 20px; font-weight: 800; margin: 32px 0 12px; }
h3 { font-size: 16px; font-weight: 700; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
strong, b { font-weight: 700; }
small, .small { font-size: 13px; }
.muted { color: var(--gray-9); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code, pre, kbd, textarea.code { font-family: var(--mono); font-size: 13px; }
:not(pre) > code { background: var(--gray-2); border: 1.5px solid var(--gray-5); border-radius: 6px; padding: 0 5px; overflow-wrap: anywhere; }
pre { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; overflow-x: auto; line-height: 1.65; margin: 0 0 16px; }
kbd { border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 5px; background: var(--surface); }
hr { border: 0; border-top: 2px dashed var(--gray-5); margin: 24px 0; }

/* Layout helpers the pages use. */
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spaced { justify-content: space-between; }
.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }

/* Buttons: round and outlined. Ink is the default, tomato the one call to act on a page, the rest are quiet. */
button, .button {
  font: inherit; font-weight: 700; font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 16px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--ink); color: var(--on-ink);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 0.08s, box-shadow 0.08s, background-color 0.15s;
}
button:hover, .button:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--hard); }
button:active, .button:active { transform: translate(1px, 1px); box-shadow: none; }
button:disabled, .button[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
button.secondary, .button.secondary { background: var(--surface); color: var(--gray-10); }
button.primary, .button.primary { background: var(--tomato); color: var(--on-color); border-color: var(--hard); box-shadow: 3px 3px 0 var(--hard); }
button.primary:hover, .button.primary:hover { background: var(--tomato-strong); box-shadow: 4px 4px 0 var(--hard); }
button.primary:active, .button.primary:active { box-shadow: 1px 1px 0 var(--hard); }
button.danger, .button.danger { background: #b42318; border-color: #7a1209; color: #fff; }
button.link, .button.link { background: none; border: 0; box-shadow: none; padding: 0; min-height: 0; color: var(--gray-9); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; transform: none; }
button.link:hover { color: var(--gray-10); box-shadow: none; transform: none; }
.button.lg, button.lg { min-height: 50px; padding: 0 24px; font-size: 16px; }
.button.sm, button.sm { min-height: 32px; padding: 0 12px; font-size: 13px; }

/* Forms. */
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--gray-10);
  width: 100%; min-height: 42px; padding: 8px 12px;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-sm);
  transition: box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--gray-8); }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 4px var(--butter); }
input[type='checkbox'], input[type='radio'] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--tomato); box-shadow: none; flex: none; margin: 0; }
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
textarea.code { min-height: 140px; }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--gray-10) 50%), linear-gradient(135deg, var(--gray-10) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 11px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 700; font-size: 14px; }
.field small { color: var(--gray-9); }
label.row { gap: 8px; font-size: 15px; cursor: pointer; }
fieldset { border: 2px solid var(--line); border-radius: var(--r-lg); padding: 12px 16px 16px; margin: 0; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
legend { font-weight: 700; font-size: 13px; padding: 2px 10px; border: 2px solid var(--hard); border-radius: 999px; background: var(--butter); color: var(--on-color); }

/* Surfaces: white blocks with an ink outline. */
.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; }
.card > :last-child { margin-bottom: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
details { border: 2px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
details > summary { cursor: pointer; padding: 12px 16px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 10px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ''; flex: none; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; }
details[open] > summary::before { transform: rotate(45deg); }
details > :not(summary) { margin-left: 16px; margin-right: 16px; }
details[open] > :last-child { margin-bottom: 16px; }

/* Status: pastel stickers with ink text, the same in light and dark. */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; line-height: 1; padding: 4px 10px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--gray-10); white-space: nowrap; vertical-align: middle; }
.badge.ok, .badge.warn, .badge.bad, .badge.info, .badge.new { color: var(--on-color); border-color: var(--hard); }
.badge.ok { background: var(--mint); }
.badge.warn { background: var(--butter); }
.badge.bad { background: var(--blush); }
.badge.info { background: var(--sky); }
.badge.new { background: var(--lilac); }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-md); border: 2px solid var(--hard); margin: 0 0 20px; font-weight: 600; color: var(--on-color); }
.flash.ok { background: var(--mint); }
.flash.error { background: var(--blush); }
.empty { text-align: center; color: var(--gray-9); padding: 32px 20px; border: 2px dashed var(--gray-6); border-radius: var(--r-lg); background: var(--gray-2); margin: 0; }

/* Tables. */
.table-wrap { overflow-x: auto; background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-lg); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-weight: 700; font-size: 13px; color: var(--gray-9); padding: 12px 16px; background: var(--gray-2); border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1.5px dashed var(--gray-5); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--gray-2); }
td.actions { white-space: nowrap; text-align: right; }
td.actions form + form { margin-left: 6px; }

/* Numbers. */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat strong, .stat b { font-family: var(--display); font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.05; color: var(--gray-10); }
.stat span, .stat small { color: var(--gray-9); font-size: 13px; }

/* Secrets and code to copy. */
.secret { font-family: var(--mono); font-size: 13px; background: var(--gray-2); border: 2px dashed var(--gray-6); border-radius: var(--r-sm); padding: 8px 10px; overflow-wrap: anywhere; user-select: all; }
.code { position: relative; }

/* A tag: a small outlined pill, filled with one of the pastels by its job. */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--gray-10); font-weight: 700; font-size: 13px; line-height: 1.4; white-space: nowrap; }
.tag.butter, .tag.sky, .tag.mint, .tag.lilac, .tag.tomato { color: var(--on-color); border-color: var(--hard); }
.tag.butter { background: var(--butter); }
.tag.sky { background: var(--sky); }
.tag.mint { background: var(--mint); }
.tag.lilac { background: var(--lilac); }
.tag.tomato { background: var(--tomato); }

/* Inside a tomato or pastel block everything keeps its light-mode colours, so the block reads the same in dark mode. */
.on-color { color-scheme: light; --gray-1: #fff7ec; --gray-2: #fff0d9; --gray-3: #f8e9d2; --gray-4: #ecdec8; --gray-5: #ddcdb4; --gray-6: #c4b49b; --gray-7: #918b80; --gray-8: #55556a; --gray-9: #3d3d52; --gray-10: #1a1a2e; --surface: #ffffff; --ink: #1a1a2e; --on-ink: #ffffff; --line: #1a1a2e; --hard: #1a1a2e; --focus: #1a1a2e; color: var(--gray-10); }

/* The logo: the smiling bubble and the word, in lower case. */
/* The wordmark is slanted, as in the emails; Bricolage has no italic, so the browser slants it. */
.logo { display: inline-flex; align-items: center; gap: 5px; font-family: var(--display); font-weight: 800; font-style: italic; font-size: 23px; letter-spacing: -0.025em; text-transform: lowercase; color: var(--gray-10); text-decoration: none; }
.logo::before { content: ''; flex: none; width: 30px; height: 30px; background: url("/logo-mark.svg") center / contain no-repeat; }
/* The mark blinks on its own (in logo-mark.svg) and waves from its tail when pointed at. */
.logo::before { transform-origin: 20% 90%; }
.logo:hover::before, .logo:focus-visible::before { animation: logo-wiggle 0.6s ease-in-out; }
@keyframes logo-wiggle { 20% { transform: rotate(-12deg) scale(1.06); } 45% { transform: rotate(9deg) scale(1.06); } 70% { transform: rotate(-5deg); } 100% { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
