/* spread the word(list) — shared styles
   Deliberately light-only, monospace, low-chrome. */

:root {
  color-scheme: light;

  /* The geometric sans the wordlist's own site uses is Adobe's Motor, which
     cannot be redistributed; Poppins is the closest freely available match,
     with geometric fallbacks for when it does not load. */
  --font: "Poppins", "Century Gothic", "Avenir Next", -apple-system,
          BlinkMacSystemFont, "Segoe UI", sans-serif;

  --bg:            #ffffff;
  --surface:       #ffffff;
  --surface-sunk:  #f6f6f6;
  --field:         #f1f1f1;
  --field-hover:   #e9e9e9;
  --border:        #e4e4e4;
  --border-strong: #cfcfcf;
  --ink:           #141414;
  --ink-soft:      #3d3d3d;
  --muted:         #757575;
  /* The wordlist's own lavender, sampled from spreadthewordlist.com. */
  --lav:           #c4a8ff;
  --lav-soft:      #e6dbff;
  /* Deep enough for text that has to stay readable. */
  --lav-deep:      #6d4ade;

  --link:          var(--lav-deep);
  --btn:           #101010;

  --radius:   8px;
  --radius-s: 6px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--lav);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  /* The original sets its type light and open; 400 reads noticeably heavier
     in Poppins than Motor does at the same nominal weight. */
  font-weight: 300;
  line-height: 1.75;
}

b, strong { font-weight: 500; }

/* ---------------------------------------------------------------- layout */

/* The content sits on a white card inset from the lavender page, the way the
   original site frames itself. */
.wrap {
  /* An explicit width, not just `auto` side margins: those collapse to zero
     whenever the card fills its container, which left no lavender showing
     between 600px and 1240px. */
  /* Gutter and padding taper with the viewport rather than stepping at a
     breakpoint. They used to step at 600px, from 40/26 to 20/16, which made the
     content area 39px *wider* the moment the window got 1px narrower -- every
     block on the page jumped outwards as you shrank it. Tapering keeps the
     content area strictly increasing with the viewport: it loses 0.116px of
     gutter and padding per px of window, so the net is always positive. At
     1240px and up these resolve to the original 40 and 26. */
  width: calc(100% - clamp(20px, 3.2vw, 40px));
  max-width: 1200px;
  margin: clamp(10px, 1.6vw, 20px) auto;
  padding: clamp(20px, 3.4vw, 26px) clamp(16px, 4.2vw, 26px) 44px;
  background: var(--surface);
  border-radius: 12px;
}

@media (max-width: 600px) {
  .wrap { border-radius: 10px; }

  .downloads { grid-template-columns: 1fr; }
}

/* Monospace runs large against Poppins at the same nominal size. */
code { font-size: 0.92em; }

/* ------------------------------------------------------------------- nav */

/* Brand centred in the card with the nav still on its right, so the header
   costs one line rather than two. */
.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 640px) {
  .masthead { grid-template-columns: 1fr; justify-items: center; gap: 12px; }
}

.masthead__brand {
  grid-column: 2;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.masthead__mark {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--lav);
  text-decoration: none;
}

.masthead__nav {
  grid-column: 3;
  justify-self: end;
  display: flex;
  gap: 18px;
}

@media (max-width: 640px) {
  .masthead__brand, .masthead__nav { grid-column: 1; justify-self: center; }
}

.masthead__nav a {
  color: var(--lav);
  text-decoration: none;
}

.masthead__nav a:hover { color: var(--lav-deep); }

.masthead__nav a[aria-current="page"] {
  color: var(--lav-deep);
  text-decoration: underline;
  text-decoration-color: var(--lav);
  text-underline-offset: 4px;
}

/* The text pages centre everything inside the white card, as the original
   site does. The analyzer keeps its left-aligned, wide-tool layout. */
.wrap--centered { text-align: center; }

.wrap--centered p,
.wrap--centered .lede,
.wrap--centered .qa,
.wrap--centered .stat,
.wrap--centered .downloads,
.wrap--centered .license {
  margin-left: auto;
  margin-right: auto;
}

/* -------------------------------------------------------------- headings */

/* The home page's opening line is a section heading like any other. */
h1, h2 {
  font-size: 15px;
  font-weight: 500;
  margin: 36px 0 12px;
  color: var(--lav);
}

/* The first block sits as far from the masthead as blocks sit from each other. */
main > :first-child { margin-top: 36px; }

p { margin: 0 0 18px; max-width: 76ch; }

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

a:hover { color: var(--lav-deep); }

.lede { font-size: 15px; max-width: 74ch; }

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

.small { font-size: 12.5px; }

/* ------------------------------------------------------------------ q&a */

.qa { margin: 0 0 26px; max-width: 76ch; }

.qa__q {
  font-weight: 500;
  margin: 0 0 4px;
}

.qa__a { margin: 0; color: var(--ink-soft); }

/* --------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.panel__body { padding: 16px; }

.panel--sunk {
  background: var(--surface-sunk);
  border-color: var(--border);
}

/* --------------------------------------------------------------- fields */

.field { display: block; margin-bottom: 4px; }

.field__label { font-weight: 500; display: block; margin-bottom: 8px; }

select,
input[type="text"],
input[type="number"] {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--field);
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 9px 11px;
  appearance: none;
  cursor: pointer;
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

select:hover { background-color: var(--field-hover); }

select:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}

.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: var(--btn);
  border: 1px solid var(--btn);
  border-radius: var(--radius-s);
  padding: 11px 18px;
  cursor: pointer;
}

.btn:hover { background: #2c2c2c; }

.btn--ghost {
  color: var(--ink);
  background: var(--field);
  border-color: transparent;
  font-weight: 400;
}

.btn--ghost:hover { background: var(--field-hover); }

.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* --------------------------------------------------------- download grid */

.downloads {
  display: grid;
  /* Two by two, as on the original, rather than an orphaned fourth button. */
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0 0 18px;
  max-width: 76ch;
}

.downloads a {
  display: block;
  text-align: center;
  padding: 13px 10px;
  border: 1px solid var(--lav);
  border-radius: 999px;
  color: var(--lav-deep);
  text-decoration: none;
}

.downloads a:hover { background: var(--lav-soft); }

.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  max-width: 76ch;
  margin: 0 0 18px;
}

.license {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding-top: 20px;
  font-size: 12.5px;
  color: var(--muted);
}
