/* Project Rebuilt intake. Clinical light with brand framing.
   Palette and rules from REBUILT.md: gold #D4AF37 accents, deep black ink,
   squared corners, thin gold rules, no gradients, premium clinical restraint.

   Type: brand primary is URW Grotesk, which has no free webfont and this page
   must stay self-contained, so we use a close grotesk system stack. To adopt
   the real face later, drop the licensed woff2 files in /assets and uncomment
   the @font-face block below. */

/*
@font-face {
  font-family: "URW Grotesk";
  src: url("assets/urw-grotesk-regular.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "URW Grotesk";
  src: url("assets/urw-grotesk-medium.woff2") format("woff2");
  font-weight: 500; font-display: swap;
}
*/

:root {
  --gold: #d4af37;
  --gold-deep: #b8952f;
  --ink: #0a0a0a;
  --body: #1c1c1c;
  --muted: #6f6f6f;
  --line: #e4e2dc;
  --line-strong: #c9c6bd;
  --bg: #ffffff;
  --danger: #b42318;
  --font: "URW Grotesk", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* flex/grid display on .progress and .row would otherwise beat the [hidden]
   attribute, leaving hidden elements on screen. Keep hidden meaning hidden. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- header */
.site-header {
  border-bottom: 1px solid var(--line);
  padding: 26px 20px 24px;
  text-align: center;
}

.site-header img {
  height: 66px;
  width: auto;
}

/* thin gold rule that sits directly under the header band */
.site-header::after {
  content: "";
  display: block;
  width: 44px;
  height: 2px;
  background: var(--gold);
  margin: 22px auto 0;
}

/* --------------------------------------------------------------- progress */
.progress {
  max-width: 620px;
  margin: 0 auto;
  padding: 28px 20px 0;
  display: flex;
  gap: 6px;
}

.progress span {
  flex: 1;
  height: 2px;
  background: var(--line-strong);
  transition: background 0.25s ease;
}

.progress span.done { background: var(--gold); }

/* ------------------------------------------------------------------- main */
#app {
  max-width: 620px;
  margin: 0 auto;
  padding: 40px 20px 96px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 0 0 14px;
}

h1 {
  font-size: 29px;
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 18px;
}

.lede {
  color: var(--muted);
  margin: 0 0 16px;
  max-width: 52ch;
}

/* ----------------------------------------------------------------- fields */
.field { margin: 0 0 30px; padding: 0; border: 0; }

label, legend {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 10px;
  padding: 0;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  font: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder, textarea::placeholder { color: #a6a29a; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}

input[readonly] {
  background: #f6f5f2;
  color: var(--muted);
  border-style: dashed;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%236f6f6f' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.row { display: flex; gap: 16px; }
.row .field { flex: 1; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 18px;
}

/* accent color drives native checkbox and radio marks gold */
.choice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-weight: 400;
  color: var(--body);
  padding: 9px 0;
  margin: 0;
  cursor: pointer;
}

.choice input {
  margin-top: 3px;
  flex: none;
  width: 17px;
  height: 17px;
  accent-color: var(--gold);
  cursor: pointer;
}

.note { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

/* a red flag left blank is not a "no". Keep the safety cue unmistakable. */
.rf {
  border-left: 2px solid var(--line);
  padding-left: 16px;
  margin-bottom: 22px;
  transition: border-color 0.15s ease;
}
.rf legend { font-weight: 400; color: var(--ink); }
.rf.invalid { border-left-color: var(--danger); }
input.invalid { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }

/* --------------------------------------------------------------- history */
.history-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}
.history-row .h-name { flex: 2; }
.history-row .h-side, .history-row .h-resolved { flex: 1; }
.history-row .h-year { flex: 0 0 96px; }

/* ---------------------------------------------------------------- buttons */
button {
  font: inherit;
  font-weight: 600;
  padding: 13px 26px;
  border-radius: 0;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

button:hover { border-color: var(--ink); }

button.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 15px;
}

button.primary:hover { background: var(--gold-deep); border-color: var(--gold-deep); }

button:disabled { opacity: 0.45; cursor: default; }
button.primary:disabled:hover { background: var(--gold); border-color: var(--gold); }

/* quiet tertiary controls: add row, remove row */
button.add, button.remove {
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-color: var(--line);
  text-transform: none;
  letter-spacing: 0;
}
button.add { margin-top: 4px; }
button.add:hover, button.remove:hover { color: var(--ink); border-color: var(--line-strong); }

.actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

/* push Back to the left, primary to the right */
.actions [data-back] { margin-right: auto; }

.error { color: var(--danger); margin-top: 16px; font-weight: 500; }

/* ------------------------------------------------------------------ exits */
.exit { text-align: center; padding-top: 24px; }

/* .exit p sets body color and would outrank .eyebrow, which is also a <p>.
   Restore the gold on the exit eyebrow explicitly. */
.exit .eyebrow { color: var(--gold-deep); margin-bottom: 20px; }

.exit h1 {
  margin: 0 auto 24px;
  max-width: 20ch;
}

.exit p {
  margin: 0 auto 18px;
  max-width: 46ch;
  color: var(--body);
}

/* a centered gold hairline to close the exit, quiet and final */
.exit::after {
  content: "";
  display: block;
  width: 44px;
  height: 2px;
  background: var(--gold);
  margin: 34px auto 0;
}

/* --------------------------------------------------------------- responsive */
@media (max-width: 560px) {
  body { font-size: 16px; }
  h1 { font-size: 25px; }
  .site-header img { height: 54px; }
  .row { flex-direction: column; gap: 0; }
  .grid { grid-template-columns: 1fr; }
  .history-row { flex-wrap: wrap; }
  .history-row .h-name { flex: 1 0 100%; }
  .actions { margin-top: 32px; }
}
