/* Ministry of Small Joys — a two-tone office wall, a printed form and violet stamp ink. */
:root {
  --wall-top: #e8eee9;
  --wall-low: #a9cbbf;
  --wall-line: #2c5f55;
  --ui-ink: #1d3a35;
  --ui-soft: #4b6862;
  --field: #fbfcfa;
  --field-line: #8aa89e;
  --paper: #fbfbf6;
  --form-ink: #2b3a67;
  --type: #1b1b1b;
  --serial: #b2352a;
  --stamp: #5b3db0;
  --pen: #2340a0;
  --serif: 'PT Serif', Georgia, 'Times New Roman', serif;
  --sans: 'PT Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'PT Mono', ui-monospace, 'Courier New', monospace;
  --split: 380px;

  --pay-paper: #fbfbf6;
  --pay-ink: #1d3a35;
  --pay-muted: #4b6862;
  --pay-line: rgba(29, 58, 53, 0.16);
  --pay-accent: #5b3db0;
  --pay-accent-ink: #ffffff;
  --pay-font: var(--sans);
  --pay-display: var(--serif);
  --pay-radius: 14px;
  --pay-btn-radius: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(var(--wall-top) 0 var(--split), var(--wall-line) var(--split) calc(var(--split) + 3px), var(--wall-low) calc(var(--split) + 3px));
  color: var(--ui-ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
}
:focus-visible {
  outline: 3px solid var(--stamp);
  outline-offset: 3px;
}

/* ── top ── */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(1180px, 100% - 32px);
  margin: 0 auto;
  padding: 16px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ui-ink);
  text-decoration: none;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.15;
}
.brand > span:last-child {
  min-width: 0;
}
.brand-crest {
  flex: none;
  width: 36px;
  height: 36px;
  color: var(--form-ink);
}
.brand-crest svg,
.doc-crest svg {
  display: block;
  width: 100%;
  height: 100%;
}
.top-tools {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-tools select {
  appearance: none;
  min-height: 40px;
  padding: 6px 30px 6px 12px;
  border: 1.5px solid var(--field-line);
  border-radius: 8px;
  background: var(--field)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d3a35' stroke-width='2'/%3E%3C/svg%3E")
    no-repeat right 11px center;
  color: var(--ui-ink);
  font: 400 15px/1 var(--sans);
  cursor: pointer;
}
.sound {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--field-line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ui-ink);
  cursor: pointer;
}
.sound svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sound svg path:first-child {
  fill: currentColor;
}
.sound .mute {
  display: none;
}
.sound[aria-pressed='false'] .wave {
  display: none;
}
.sound[aria-pressed='false'] .mute {
  display: block;
}

/* ── layout ── */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 470px) minmax(0, 1fr);
  grid-template-areas:
    'intro desk'
    'ask desk'
    'result desk';
  grid-template-rows: auto auto 1fr;
  gap: 0 64px;
  width: min(1180px, 100% - 32px);
  margin: 0 auto;
  padding-top: 18px;
}
.intro {
  grid-area: intro;
}
.desk {
  grid-area: desk;
  position: sticky;
  top: 20px;
  align-self: start;
}
.ask {
  grid-area: ask;
}
.result {
  grid-area: result;
}

h1 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(34px, 4.4vw, 50px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.lead {
  margin: 0 0 30px;
  color: var(--ui-soft);
  font-size: 18px;
  line-height: 1.55;
}

/* ── the application form ── */
.field {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
  min-width: 0;
}
.field label,
.field legend {
  display: block;
  margin: 0 0 8px;
  padding: 0;
  font-weight: 700;
  font-size: 15px;
}
.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--field-line);
  border-radius: 8px;
  background: var(--field);
  color: var(--type);
  font: 400 18px/1.4 var(--mono);
  resize: vertical;
}
.field textarea {
  min-height: 80px;
  margin-top: 10px;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--stamp);
  box-shadow: 0 0 0 3px rgba(91, 61, 176, 0.18);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.chip {
  min-height: 38px;
  padding: 6px 12px;
  border: 1.5px solid var(--field-line);
  border-radius: 999px;
  background: var(--field);
  color: var(--ui-ink);
  font: 400 15px/1.25 var(--sans);
  text-align: left;
  cursor: pointer;
}
.chip:hover {
  border-color: var(--ui-ink);
}
.chip[aria-pressed='true'] {
  border-color: var(--wall-line);
  background: var(--wall-line);
  color: #fff;
}
.note {
  margin: 0;
  color: var(--ui-ink);
  font-size: 14px;
}
.form-error {
  margin: 14px 0 0;
  color: var(--serial);
  font-weight: 700;
}
.guard {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--paper);
  border: 1.5px solid var(--field-line);
}
.guard p {
  margin: 0;
}
.guard a {
  color: var(--stamp);
  font-weight: 700;
}
.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 14px;
  width: 100%;
  min-height: 64px;
  margin-top: 24px;
  padding: 14px 24px;
  border: 0;
  border-radius: 10px;
  background: var(--stamp);
  color: #fff;
  font: 700 19px/1.2 var(--sans);
  cursor: pointer;
  box-shadow:
    inset 0 0 0 3px var(--stamp),
    inset 0 0 0 4.5px rgba(255, 255, 255, 0.55),
    0 10px 24px rgba(59, 35, 130, 0.3);
  transition: transform 0.1s ease;
}
.cta:hover {
  filter: brightness(1.08);
}
.cta:active {
  transform: translateY(2px);
}
.cta-price {
  font-weight: 400;
  font-size: 15px;
  opacity: 0.85;
}

/* ── the document ── */
.doc {
  position: relative;
  overflow: hidden;
  padding: 16px;
  background: var(--paper);
  color: var(--form-ink);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 2px 4px rgba(20, 40, 35, 0.12),
    0 28px 60px rgba(20, 40, 35, 0.28);
  transform: rotate(0.6deg);
}
.doc-inner {
  position: relative;
  padding: 34px 40px 22px;
  border: 1.5px solid var(--form-ink);
  outline: 1px solid var(--form-ink);
  outline-offset: -7px;
}
.doc-head {
  text-align: center;
}
.doc-crest {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
}
.doc-ministry {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.doc-dept {
  margin: 2px 0 0;
  font-size: 13px;
}
.doc-title {
  margin: 22px 0 2px;
  padding-top: 18px;
  border-top: 3px double var(--form-ink);
  text-align: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.doc-series {
  margin: 0 0 22px;
  text-align: center;
  font-family: var(--mono);
  font-size: 15px;
}
.doc-series b {
  color: var(--serial);
  font-weight: 400;
}
.doc-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 28px;
  margin: 0;
}
.doc-fields > div {
  min-width: 0;
}
.doc-fields .wide,
.doc-fields > div:first-child {
  grid-column: 1 / -1;
}
.doc-fields dt {
  font-size: 12.5px;
}
.doc-fields dd {
  min-height: 1.5em;
  margin: 3px 0 0;
  padding-bottom: 3px;
  border-bottom: 1px dotted var(--form-ink);
  color: var(--type);
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.doc-fields .wide dd {
  font-size: 21px;
}
.doc-fields dd.empty {
  color: rgba(27, 27, 27, 0.32);
}
.doc-foot {
  display: flex;
  justify-content: flex-start;
  margin-top: 34px;
  min-height: 92px;
}
.chief {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 220px;
  padding-top: 40px;
}
.chief-title {
  padding-top: 4px;
  border-top: 1px solid var(--form-ink);
  font-size: 13px;
}
.sig {
  position: absolute;
  left: 6px;
  bottom: 18px;
  width: 190px;
  height: 80px;
  color: var(--pen);
}
.sig svg {
  display: block;
  width: 100%;
  height: 100%;
}
.doc-fine {
  margin: 18px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  opacity: 0.85;
}
.watermark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.watermark span {
  padding: 4px 22px;
  border: 6px solid rgba(178, 53, 42, 0.2);
  border-radius: 14px;
  color: rgba(178, 53, 42, 0.2);
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(56px, 7.5vw, 96px);
  letter-spacing: 0.08em;
  transform: rotate(-27deg);
}
.stamp {
  position: absolute;
  right: 9%;
  bottom: 9%;
  width: 200px;
  height: 200px;
  color: var(--stamp);
  transform: rotate(var(--angle, -8deg));
  mix-blend-mode: multiply;
  pointer-events: none;
}
.stamp svg {
  display: block;
  width: 100%;
  height: 100%;
}
.verified {
  margin: 18px 0 0;
  color: var(--wall-line);
  font-weight: 700;
  text-align: center;
}

/* ── result ── */
.result {
  padding-top: 8px;
}
.shared-banner {
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--paper);
  border: 1.5px solid var(--field-line);
}
.shared-banner p {
  margin: 0 0 12px;
  font-weight: 700;
}
.shared-invalid {
  font-size: 19px;
  font-weight: 700;
}
.issued h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.15;
}
.issued p {
  margin: 0 0 20px;
  max-width: 30em;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 10px 22px;
  border: 0;
  border-radius: 10px;
  font: 700 16px/1.1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn-ink {
  background: var(--stamp);
  color: #fff;
}
.btn-line {
  background: var(--field);
  color: var(--ui-ink);
  box-shadow: inset 0 0 0 1.5px var(--field-line);
}
.btn-line:hover {
  box-shadow: inset 0 0 0 1.5px var(--ui-ink);
}

/* ── footer ── */
.foot {
  width: min(1180px, 100% - 32px);
  margin: 72px auto 0;
  padding: 20px 0 40px;
  border-top: 1px solid rgba(29, 58, 53, 0.25);
  color: var(--ui-ink);
  font-size: 14px;
}
.foot p {
  margin: 0 0 8px;
}
.more {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.more a {
  color: var(--ui-ink);
  font-weight: 700;
}

@media (max-width: 900px) {
  :root {
    --split: 300px;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'intro'
      'desk'
      'ask'
      'result';
    grid-template-rows: auto;
    padding-top: 8px;
  }
  .desk {
    position: static;
    margin-bottom: 30px;
  }
  h1 {
    font-size: 32px;
  }
  .lead {
    font-size: 17px;
    margin-bottom: 22px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }
  .brand {
    font-size: 16px;
  }
  .brand-crest {
    width: 32px;
    height: 32px;
  }
  .doc {
    padding: 8px;
    transform: none;
  }
  .doc-inner {
    padding: 22px 16px 14px;
    outline-offset: -5px;
  }
  .doc-crest {
    width: 46px;
    height: 46px;
  }
  .doc-ministry {
    font-size: 12px;
  }
  .doc-dept {
    font-size: 11.5px;
  }
  .doc-title {
    font-size: 26px;
    letter-spacing: 0.1em;
    margin-top: 14px;
    padding-top: 12px;
  }
  .doc-series {
    font-size: 13px;
    margin-bottom: 14px;
  }
  .doc-fields {
    gap: 12px 16px;
  }
  .doc-fields dd {
    font-size: 15px;
  }
  .doc-fields .wide dd {
    font-size: 17px;
  }
  .doc-foot {
    margin-top: 22px;
    min-height: 74px;
  }
  .chief {
    width: 150px;
  }
  .sig {
    width: 140px;
    height: 60px;
  }
  .stamp {
    width: 132px;
    height: 132px;
    right: 5%;
    bottom: 7%;
  }
  .watermark span {
    font-size: 46px;
    border-width: 4px;
  }
  .doc-fine {
    font-size: 10.5px;
  }
  .actions .btn {
    flex: 1 1 auto;
  }
}
