/* The document. Ported from the approved prototype; the visual decisions here
   are settled, so treat a change to spacing, color or type scale as a design
   change rather than a cleanup. */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--serif-body);
  font-weight: 400;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  /* Paper grain. Inline SVG rather than an image request: same reason the fonts
     are self-hosted, and it is under 400 bytes. */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.07 0 0 0 0 0.05 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: 'kern', 'liga', 'calt', 'onum';
}

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
  position: relative;
}

@media (min-width: 720px) {
  html { font-size: 18px; }
  main { padding: 6rem 2rem 8rem; }
}

/* Past a tablet the column stops growing, and on a desktop that reads as a
   phone layout scaled up. One step wider, applied at :root so main, footer and
   anything else measured against the token move together. */
@media (min-width: 1000px) {
  :root { --measure: var(--measure-wide); }
}

/* Links in body copy. Without this they fall back to browser blue with a hard
   underline, which on a cream page reading as a printed document is the one
   thing that looks like a mistake. Seal red, and the underline is quiet until
   the link is hovered. */
main a {
  color: var(--seal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--seal) 35%, transparent);
  transition: color 0.2s, text-decoration-color 0.2s;
}

main a:hover {
  color: var(--seal-deep);
  text-decoration-color: currentColor;
}

/* ---------- Masthead ---------- */

.masthead {
  text-align: center;
  margin-bottom: 4rem;
  animation: fade-up 1.2s ease-out both;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--seal);
  margin-bottom: 2.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.eyebrow::before,
.eyebrow::after {
  content: '';
  display: inline-block;
  width: 1.5rem;
  height: 1px;
  background: var(--seal);
  opacity: 0.6;
}

.masthead h1 {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: clamp(3.2rem, 11vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.025em;
  margin-bottom: 1.25rem;
  font-variation-settings: 'opsz' 144, 'SOFT' 30;
}

.masthead .tagline {
  font-family: var(--serif-display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(1.15rem, 3vw, 1.5rem);
  color: var(--ink-soft);
  letter-spacing: -0.005em;
  font-variation-settings: 'opsz' 24;
}

.ornament {
  text-align: center;
  font-family: var(--serif-display);
  color: var(--seal);
  font-size: 1rem;
  letter-spacing: 1.5rem;
  padding-left: 1.5rem;
  margin: 3.5rem 0;
  opacity: 0.7;
}

/* Utility pages: the confirmation landing, the submission result. They reuse
   the masthead and preamble blocks so they feel like the same document, but at
   full document scale a two-word heading fills the screen, and the Pledge's
   small-caps opening line reads as a rendering fault on a page that is not the
   Pledge. */
.utility .masthead { margin-bottom: 2.5rem; }

.utility .masthead h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.05;
}

.utility .preamble p:first-of-type::first-line {
  font-variant: normal;
  letter-spacing: 0;
  color: inherit;
}

.utility .sign-form { margin: 2.5rem 0; }

/* ---------- Preamble ---------- */

.preamble { animation: fade-up 1.2s 0.2s ease-out both; }

.preamble p {
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.preamble p:first-of-type::first-line {
  font-variant: small-caps;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.preamble .agreement {
  font-family: var(--serif-display);
  font-weight: 500;
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ink);
  margin-top: 2rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--seal);
}

/* ---------- The Purpose Test ---------- */

.purpose-test {
  margin: 3rem 0;
  padding: 2rem 1.75rem;
  background: var(--paper-deep);
  border-left: 3px solid var(--seal);
  animation: fade-up 1s ease-out both;
}

@media (min-width: 600px) {
  .purpose-test { padding: 2.25rem 2.5rem; }
}

.purpose-test-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--seal);
  margin-bottom: 1rem;
}

.purpose-test-title {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 72;
}

.purpose-test p {
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.purpose-test .test {
  font-family: var(--serif-display);
  font-weight: 500;
  font-style: italic;
  color: var(--ink);
  font-variation-settings: 'opsz' 36;
}

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

.section-title {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2rem);
  letter-spacing: -0.015em;
  text-align: center;
  margin: 4rem 0 2.5rem;
  font-variation-settings: 'opsz' 72;
}

.terms-title {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--seal);
  text-align: center;
  margin: 4rem 0 3rem;
}

.subsection {
  margin: 4rem 0;
  animation: fade-up 1s ease-out both;
}

.subsection-header {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--hairline);
}

.subsection-roman {
  font-family: var(--serif-display);
  font-weight: 400;
  font-style: italic;
  font-size: 1.6rem;
  color: var(--seal);
  letter-spacing: 0.02em;
}

.subsection-title {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 72;
}

/* ---------- Commitments ---------- */

.commitment {
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
}

.commitment-number {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--seal);
  padding-top: 0.25rem;
  letter-spacing: 0.02em;
}

.commitment-body {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.commitment-title {
  font-family: var(--serif-display);
  font-weight: 600;
  color: var(--ink);
  font-variation-settings: 'opsz' 36;
}

/* ---------- Acceptance ---------- */

.acceptance {
  margin-top: 6rem;
  animation: fade-up 1s ease-out both;
}

.acceptance p {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
  text-wrap: pretty;
}

.closing-line {
  font-family: var(--serif-display);
  font-weight: 700;
  font-style: italic;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  color: var(--ink);
  text-align: center;
  margin: 3rem 0;
  letter-spacing: -0.015em;
  line-height: 1.2;
  font-variation-settings: 'opsz' 72;
}

/* ---------- The signature card ---------- */

.signature-card {
  background: var(--paper-deep);
  border: 1px solid var(--hairline);
  padding: 2.5rem 1.75rem;
  margin: 3.5rem 0;
  position: relative;
  box-shadow: 0 1px 0 rgba(20, 17, 14, 0.04), 0 8px 24px -8px rgba(20, 17, 14, 0.12);
}

@media (min-width: 600px) {
  .signature-card { padding: 3rem; }
}

/* The two pins holding the card to the page. */
.signature-card::before,
.signature-card::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--seal);
  border-radius: 50%;
  opacity: 0.85;
  top: -6px;
}
.signature-card::before { left: 1.5rem; }
.signature-card::after { right: 1.5rem; }

.signature-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--seal);
  text-align: center;
  margin-bottom: 1rem;
}

.signature-heading {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 72;
}

.signature-sub {
  font-style: italic;
  color: var(--ink-muted);
  text-align: center;
  margin-bottom: 2.25rem;
  font-size: 0.95rem;
}

/* While the record is unpublished the card carries a second one of these,
   saying when a name appears. Two paragraphs, one voice: only the last of them
   holds the gap above the form. */
.signature-sub:not(:last-of-type) {
  margin-bottom: 0.75rem;
}

form.sign-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.field input {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink-muted);
  padding: 0.4rem 0;
  outline: none;
  transition: border-color 0.2s;
  font-variation-settings: 'opsz' 36;
}

.field input:focus-visible { border-bottom-color: var(--seal); }

.field input::placeholder {
  color: var(--ink-muted);
  opacity: 0.5;
  font-style: italic;
  font-weight: 400;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 540px) {
  .field-row { grid-template-columns: 1fr 1fr; }
}

.checkbox {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-muted);
  cursor: pointer;
}

.checkbox input {
  margin-top: 0.25rem;
  accent-color: var(--seal);
  width: 1rem;
  height: 1rem;
}

.form-error {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--seal-deep);
  background: var(--seal-soft);
  padding: 0.75rem 1rem;
}

.form-error[hidden] { display: none; }

.submit-btn {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--seal);
  border: none;
  padding: 1.1rem 1.5rem;
  margin-top: 1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.submit-btn:hover { background: var(--seal-deep); }
.submit-btn:active { transform: translateY(1px); }
.submit-btn[disabled] { opacity: 0.6; cursor: progress; }

.form-success {
  padding: 2rem 1rem;
  text-align: center;
  animation: fade-up 0.6s ease-out;
}

.form-success[hidden] { display: none; }

.form-success .seal {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--seal);
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  font-family: var(--serif-display);
  font-weight: 700;
  font-style: italic;
  font-size: 1.6rem;
  box-shadow: 0 2px 8px rgba(139, 26, 26, 0.3);
}

.form-success p {
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--ink);
}

.form-success small {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 1rem;
}

/* ---------- The public record ---------- */

.counter {
  text-align: center;
  margin: 3rem 0 4rem;
  padding: 2.5rem 1.5rem;
  background: var(--paper-deep);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.counter-number {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: clamp(3rem, 12vw, 5rem);
  line-height: 1;
  color: var(--seal);
  letter-spacing: -0.03em;
  font-variation-settings: 'opsz' 144;
  /* Tabular figures, so the number does not reflow as it grows. */
  font-feature-settings: 'kern', 'liga', 'tnum';
}

.counter-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 1rem;
}

.counter-note {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-top: 1.25rem;
  max-width: 26rem;
  margin-left: auto;
  margin-right: auto;
}

.group { margin: 3.5rem 0; }

.group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--hairline);
}

.group-name {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 72;
}

.group-count {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}

.signatures {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
}

@media (min-width: 640px) {
  .signatures { grid-template-columns: 1fr 1fr; gap: 2rem 2.5rem; }
}

.sig-name {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  font-variation-settings: 'opsz' 36;
}

.sig-role {
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.sig-org {
  font-size: 0.92rem;
  line-height: 1.45;
  font-style: italic;
  color: var(--ink-muted);
}

.empty {
  font-style: italic;
  color: var(--ink-muted);
  text-align: center;
  padding: 3rem 0;
}

/* ---------- Disclaimer and footer ---------- */

.disclaimer {
  margin: 4rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
  font-style: italic;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink-muted);
  text-align: center;
  max-width: 32rem;
}

footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  text-align: center;
  border-top: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

footer a {
  color: var(--seal);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--seal-deep);
  text-decoration: underline;
  text-underline-offset: 4px;
}

footer .domain {
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.05rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  margin-bottom: 1rem;
  display: block;
}

footer nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* ---------- Press ---------- */

.pull-quote {
  margin: 3rem 0;
  padding-left: 1.5rem;
  border-left: 3px solid var(--seal);
}

.pull-quote p {
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ink);
  font-variation-settings: 'opsz' 36;
}

.pull-quote cite {
  display: block;
  margin-top: 1rem;
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* The press kit exists to be printed to PDF and attached to an email. */
@media print {
  html { font-size: 11pt; }

  body {
    background: #fff;
    background-image: none;
    color: #000;
  }

  main { max-width: none; padding: 0; }

  .masthead { margin-bottom: 2rem; }
  .masthead h1 { font-size: 2.5rem; }

  .commitment { margin-bottom: 0.75rem; page-break-inside: avoid; }
  .subsection, .purpose-test, .acceptance { margin: 1.5rem 0; page-break-inside: avoid; }
  .purpose-test { background: none; }

  a { color: #000; text-decoration: none; }
  footer nav { display: none; }
}

/* ---------- Motion and selection ---------- */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

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

::selection {
  background: var(--seal);
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 3px;
}
