/* builder.css: standalone /request-builder/ page.
   Ink-on-paper editorial look. No web fonts, images or other requests: local
   Cormorant Garamond / JetBrains Mono are used if installed, otherwise Georgia
   and the system monospace. */

:root {
  --paper: #f4ede0;
  --paper-2: #ebe2d0;
  --field: #fffdf7;
  --ink: #1a1410;
  --ink-2: #3b322a;
  --muted: #6b5d4f;
  --accent: #b8332b;
  --accent-2: #8c2318;
  --rule: #c8b896;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
}
p, ul, dl, h1, h2 { margin: 0; }
a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
code { font-family: var(--mono); font-size: 0.92em; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
}
.skip:focus { top: 1rem; color: var(--paper); }

.page { max-width: 50rem; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

/* ── Masthead: nameplate, gloss, dateline over a double rule ── */
.masthead {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.2rem;
  align-items: end;
  margin-bottom: 6px;
  padding-bottom: 0.8rem;
  border-bottom: 2px solid var(--ink);
}
.masthead::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 1px;
  background: var(--ink);
}
.nameplate {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.1;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}
.nameplate:hover { color: var(--ink); }
.nameplate .dot { color: var(--accent); }
.etym {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--muted);
  text-align: center;
}
.etym strong { font-style: normal; font-weight: 500; letter-spacing: 0.02em; color: var(--ink-2); }
.dateline {
  font-size: 0.68rem;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-align: right;
}

/* ── Title ── */
h1 {
  margin: 2rem 0 0.6rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 6vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.lede { max-width: 60ch; margin-bottom: 1.4rem; color: var(--ink-2); }
h2 {
  margin-bottom: 0.6rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.2;
}

/* ── Builder controls ── */
.rb { margin-bottom: 2.5rem; scroll-margin-top: 1rem; }
.rb-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.2rem;
}
.rb-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.rb-wide { grid-column: 1 / -1; }
.rb-field > label,
.rb-field > legend,
.rb-label,
.rb-dl dt {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}
.rb-field > label,
.rb-field > legend { display: block; padding: 0; margin-bottom: 0.35rem; }
.rb-field select,
.rb-field input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 16px; /* no iOS zoom on focus */
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--muted);
  border-radius: 0;
}
.rb-field input[type="text"]:disabled { background: var(--paper-2); color: var(--muted); }
.rb-field input[aria-invalid="true"] { border: 2px solid var(--accent-2); }

.rb-choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.rb-choice {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  min-height: 44px;
  padding: 0.45rem 0.8rem;
  background: var(--field);
  border: 1px solid var(--muted);
  cursor: pointer;
}
.rb-choice:has(input:checked) { background: var(--paper-2); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.rb-choice input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--accent-2); }
.rb-choice code { font-size: 0.78rem; color: var(--muted); }

.rb-hint { max-width: 62ch; margin-top: 0.35rem; font-size: 0.8rem; line-height: 1.5; color: var(--muted); }
.rb-mode { color: var(--ink-2); }
dd .rb-hint { display: block; }

.rb-avail { margin: 1rem 0 0.4rem; padding: 0.5rem 0.8rem; border-left: 4px solid var(--ink-2); }
.rb-avail[data-available="no"] {
  background: var(--paper-2);
  border: 2px dashed var(--accent-2);
  border-left-width: 6px;
  font-weight: 700;
}
.rb-error {
  margin: 1rem 0 0.4rem;
  padding: 0.5rem 0.8rem;
  border-left: 4px solid var(--accent-2);
  color: var(--accent-2);
  font-weight: 700;
}

.rb-note {
  max-width: 62ch;
  margin: 0.6rem 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--muted);
}
.rb-note code { font-style: normal; font-size: 0.82em; }

/* ── Request output (also the no-JS sample) ── */
.rb-request {
  margin-top: 1.2rem;
  padding: 1.1rem 1.2rem 1rem;
  background: var(--paper-2);
  border-left: 3px solid var(--accent);
}
.rb-caption {
  margin-bottom: 0.8rem;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.rb-dl { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 0.55rem 1rem; }
.rb-dl dt { padding-top: 0.15rem; }
.rb-dl dd { min-width: 0; margin: 0; }
.rb-break { overflow-wrap: anywhere; word-break: break-all; }
.rb-label { margin: 1rem 0 0.3rem; }
.rb-code {
  margin: 0;
  padding: 0.75rem 0.9rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.rb-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.7rem; }
.rb-actions:not(:has(.rb-copy:not([hidden]))) { display: none; }
.rb-copy {
  min-height: 44px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--paper);
  background: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
}
.rb-copy:hover { background: var(--accent-2); border-color: var(--accent-2); }

.rb-vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Lower sections ── */
.rb-section { margin: 2.5rem 0; padding-top: 1rem; border-top: 1px solid var(--ink); }
.rb-section > p { max-width: 62ch; }
.rb-list { margin-top: 0.4rem; padding-left: 1.2rem; }
.rb-list li { margin: 0.35rem 0; }
.rb-ds { margin: 0.6rem 0; padding: 0; list-style: none; border-top: 1px dashed var(--rule); }
.rb-ds li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.2rem 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px dashed var(--rule);
}
.rb-ds [data-available="no"] { color: var(--accent-2); font-weight: 700; }

.foot {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 2px solid var(--ink);
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Phones: compact masthead, one column, controls first ── */
@media (max-width: 40rem) {
  .page { padding: 1rem 1rem 2.5rem; }
  .masthead { grid-template-columns: 1fr auto; gap: 0.3rem 1rem; padding-bottom: 0.6rem; }
  .etym { display: none; }
  h1 { margin: 1.2rem 0 0.5rem; }
  .lede { margin-bottom: 1.1rem; }
  .rb-form { grid-template-columns: 1fr; gap: 0.85rem; }
  .rb-request { padding: 0.9rem 0.85rem; }
  .rb-dl { grid-template-columns: 1fr; gap: 0.1rem; }
  .rb-dl dd { margin-bottom: 0.55rem; }
  .rb-copy { flex: 1 1 10rem; }
}

@media (forced-colors: active) {
  .rb-choice:has(input:checked) { outline: 2px solid CanvasText; }
  .rb-avail[data-available="no"] { border-color: CanvasText; }
}
