/* Fonts: Archivo + DM Mono, SIL Open Font License 1.1, self hosted (latin subset) */
@font-face {
  font-family: Archivo;
  font-style: italic;
  font-weight: 900;
  font-display: swap;
  src: url(/fonts/archivo-black-italic.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/dmmono-400.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/dmmono-500.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --accent: #ffd400;
  --accent-ink: #111111;
  --ink: #111111;
  --ground: #fafafa;
  --panel: #ffffff;
  --mid: #555555;
  --faint: #888888;
  --rule: #dcdcdc;
  --input-bd: #c8c8c8;
  --lede: #444444;
  --ghost: #999999;
}

:root[data-theme=dark] {
  --accent: #ffd400;
  --accent-ink: #111111;
  --ink: #f0efec;
  --ground: #0f0f0f;
  --panel: #191919;
  --mid: #a9a6a0;
  --faint: #86837d;
  --rule: #2f2f2f;
  --input-bd: #3d3d3d;
  --lede: #c3c0ba;
  --ghost: #7b7873;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --ink: #f0efec;
    --ground: #0f0f0f;
    --panel: #191919;
    --mid: #a9a6a0;
    --faint: #86837d;
    --rule: #2f2f2f;
    --input-bd: #3d3d3d;
    --lede: #c3c0ba;
    --ghost: #7b7873;
  }
}

* { box-sizing: border-box; }

/* the hidden attribute must win over the display rules below */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

.wrap {
  max-width: 1010px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--mid); }

:is(input, textarea, select, button, a):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Masthead */
.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 44px 0 26px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: Archivo, system-ui, sans-serif;
  font-style: italic;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}

.logo-mark {
  width: 26px;
  height: 26px;
  flex: none;
  display: block;
}

#theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--rule);
  background: var(--ground);
  color: var(--mid);
  cursor: pointer;
}

#theme:hover { border-color: var(--ink); color: var(--ink); }
.i-sun { display: none; }
:root[data-theme=dark] .i-sun { display: block; }
:root[data-theme=dark] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .i-sun { display: block; }
  :root:not([data-theme=light]) .i-moon { display: none; }
}

h1 {
  margin: 0;
  font-family: Archivo, system-ui, sans-serif;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  font-size: clamp(38px, 7vw, 68px);
  line-height: 0.95;
  letter-spacing: -0.035em;
}

h1 .hl {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0 14px 0 8px;
}

h1 .outline {
  color: transparent;
  -webkit-text-stroke: 2px var(--ink);
}

.lede {
  margin: 22px 0 0;
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.8;
  color: var(--lede);
}

.lede mark {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 1px 4px;
}

/* Tool layout */
.tool {
  display: flex;
  flex-wrap: wrap;
  gap: 44px;
  align-items: flex-start;
  padding-top: 36px;
  padding-bottom: 56px;
}

.controls { flex: 1 1 480px; min-width: 0; }

.preview {
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Spec sheet rows */
.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}

.row-top { border-top: 1px solid var(--ink); }
.row-last { border-bottom: 1px solid var(--ink); }

.row-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  line-height: 1.5;
}

.fields .row { padding: 16px 0; }

.tabs, .seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tab, .opt {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--rule);
  background: var(--ground);
  color: var(--mid);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
}

.opt { min-width: 46px; padding: 0 14px; }
.tab:hover, .opt:hover { border-color: var(--ink); color: var(--ink); }

.tab.is-active, .opt.is-active {
  background: var(--ink);
  color: var(--accent);
  border-color: var(--ink);
}

input[type="text"], input[type="email"], input[type="tel"], textarea, select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--input-bd);
  border-radius: 0;
  background: var(--panel);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
}

textarea { resize: vertical; }
::placeholder { color: var(--ghost); opacity: 1; }

.colors { display: flex; gap: 18px; }

.colors label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--mid);
  cursor: pointer;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(128, 128, 128, 0.5); }

/* Preview */
.code-box {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 420px;
  border: 2px solid var(--ink);
  background: #ffffff;
  box-shadow: 10px 10px 0 var(--accent);
}

.code-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.code-empty {
  position: absolute;
  inset: 0;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
}

.code-empty p {
  margin: 0;
  font-size: 12px;
  line-height: 1.8;
  color: var(--ghost);
  text-align: center;
}

.spec {
  margin: 14px 0 0;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--faint);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 420px;
}

.actions-row { display: flex; gap: 8px; }

.btn-primary {
  min-height: 52px;
  border: 1px solid var(--ink);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: Archivo, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.btn-primary:hover { background: var(--ink); color: var(--ground); }

.btn-secondary {
  flex: 1 1 0;
  min-height: 46px;
  border: 1px solid var(--ink);
  background: var(--ground);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.btn-secondary:hover { background: var(--ink); color: var(--ground); }

/* Prose pages: faq, terms, privacy */
.page { padding-bottom: 60px; }

.page h1 {
  font-size: clamp(30px, 5vw, 48px);
  max-width: 20ch;
}

.prose { max-width: 68ch; }

.prose h2 {
  margin: 44px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--ink);
  font-family: Archivo, system-ui, sans-serif;
  font-style: italic;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.prose h3 {
  margin: 30px 0 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}

.prose h3::before {
  content: "";
  display: block;
  width: 22px;
  height: 4px;
  background: var(--accent);
  margin-bottom: 12px;
}

.prose p {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.85;
  color: var(--lede);
}

.prose ul { margin: 10px 0 0; padding-left: 18px; }

.prose li {
  font-size: 14px;
  line-height: 1.85;
  color: var(--lede);
  margin: 4px 0;
}

.prose a { color: var(--ink); }

.note {
  margin-top: 34px;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  background: var(--panel);
  font-size: 13px;
  line-height: 1.75;
  color: var(--mid);
}

/* Footer */
footer { border-top: 1px solid var(--ink); }

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
  font-size: 12px;
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.foot a { color: var(--mid); text-decoration: none; }
.foot a:hover { color: var(--ink); }
.foot-brand { color: var(--ghost); }

@media (min-width: 768px) {
  .row {
    grid-template-columns: 130px 1fr;
    gap: 14px;
    align-items: center;
  }
  .fields .row, .row-label { align-items: start; }
  .fields .row .row-label, .row-top .row-label { padding-top: 14px; }
  .preview { flex: 0 1 340px; min-width: 290px; }
  .controls { min-width: 360px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
