/* Roommate agreement generator (/tools/roommate-agreement-generator): presets, the step-by-step
   form, the live preview (a paper document) and a print layout that prints only the agreement.
   Builds on the .nk-* tools block in site.css. */

.ra-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Form left, preview right; one column on phones (form first). */
.ra-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (min-width: 960px) {
  .ra-grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  }
}
.ra-form-col,
.ra-preview-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Presets */
.ra-presets {
  padding: clamp(20px, 3vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ra-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.ra-preset {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  padding: 14px 14px 15px;
  border-radius: 16px;
  border: 1.5px solid #e5ddd2;
  background: #f7f1e8;
  cursor: pointer;
  font-family: inherit;
  color: #3b302b;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.ra-preset strong {
  font-size: 15px;
  font-weight: 700;
  color: #2e2018;
}
.ra-preset span {
  font-size: 13px;
  line-height: 1.4;
  color: #7a6a5c;
}
.ra-preset:hover {
  border-color: rgba(59, 48, 43, 0.3);
}
.ra-preset[aria-pressed='true'] {
  background: #fffdf9;
  border-color: #ffb900;
  box-shadow: 0 0 0 2px rgba(255, 185, 0, 0.35);
}
.ra-preset:focus-visible {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}

/* Steps: one collapsible card per topic. */
.ra-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}
.ra-step {
  background: #fffdf9;
  border-radius: 20px;
  box-shadow: 0 0 0 1px rgba(59, 48, 43, 0.06);
  scroll-margin-top: 12px;
}
.ra-step summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  min-height: 56px;
  box-sizing: border-box;
  cursor: pointer;
  border-radius: 20px;
}
.ra-step summary::-webkit-details-marker {
  display: none;
}
.ra-step summary:focus-visible {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}
.ra-step__n {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: #f2ebe0;
  color: #8b5e3c;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ra-step[open] .ra-step__n {
  background: #ffb900;
  color: #2e2018;
}
.ra-step__title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #2e2018;
}
.ra-step__chev {
  width: 10px;
  height: 10px;
  flex: none;
  margin-right: 4px;
  border-right: 2px solid #8b5e3c;
  border-bottom: 2px solid #8b5e3c;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s ease;
}
.ra-step[open] .ra-step__chev {
  transform: rotate(-135deg) translate(-2px, -2px);
}
.ra-step__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 2px 18px 18px;
}
.ra-next {
  align-self: flex-end;
}

/* Fields */
.ra-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ra-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.ra-label {
  font-size: 13px;
  font-weight: 600;
  color: #7a6a5c;
}
.ra-sublabel {
  font-size: 12px;
  font-weight: 500;
  color: #9a8570;
}
.ra-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 12px;
}
/* From / to times stay side by side, even on phones. */
.ra-times .ra-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ra-narrow {
  max-width: 200px;
}
.ra-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #7a6a5c;
}
.ra-hint a {
  color: #8b5e3c;
}
.ra-warn,
.ra-sum[data-ok='false'] {
  color: #a5532f;
  font-weight: 600;
}
.ra-sum[data-ok='true'] {
  color: #5f7a57;
}
.ra-select {
  padding-right: 36px;
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238b5e3c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  text-overflow: ellipsis;
}
.ra-textarea {
  height: auto;
  min-height: 120px;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.5;
  resize: vertical;
}
.ra-times {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.ra-times legend {
  padding: 0;
  margin-bottom: 7px;
}
.ra-seg {
  display: flex;
  flex-wrap: wrap;
  border-radius: 22px;
  align-self: flex-start;
  max-width: 100%;
}

/* People */
.ra-people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  gap: 8px;
}
.ra-person {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 4px;
  align-items: center;
}
.ra-person .nk-icon-btn:disabled {
  visibility: hidden;
}

/* Rent shares */
.ra-shares {
  list-style: none;
  margin: 0;
  padding: 4px 14px;
  border-radius: 16px;
  background: #f7f1e8;
}
.ra-share {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border-bottom: 1px solid #e5ddd2;
  font-size: 15px;
  color: #3b302b;
}
.ra-share:last-child {
  border-bottom: 0;
}
.ra-share__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.ra-share__value {
  font-variant-numeric: tabular-nums;
}
.ra-share__input {
  width: 110px;
  height: 42px;
  flex: none;
  font-size: 16px;
}
.ra-share__unit {
  flex: none;
  min-width: 44px;
  font-size: 13px;
  color: #7a6a5c;
  font-variant-numeric: tabular-nums;
}
.ra-shares + .ra-sum {
  margin-top: -2px;
}

/* Checkbox chips (bills, shared spaces) */
.ra-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ra-chip {
  position: relative;
  cursor: pointer;
}
.ra-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.ra-chip span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  box-sizing: border-box;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid #ddd5c8;
  font-size: 14px;
  font-weight: 500;
  color: #7a6a5c;
  background: #fffdf9;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ra-chip span::before {
  content: '+';
  font-weight: 700;
  color: #b9a998;
}
.ra-chip input:checked + span {
  background: #fbf3df;
  border-color: #ffb900;
  color: #2e2018;
}
.ra-chip input:checked + span::before {
  content: '✓';
  color: #8b5e3c;
}
.ra-chip input:focus-visible + span {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}

/* Phones: a pill that stays at the bottom of the screen while you answer. */
.ra-jump {
  position: sticky;
  bottom: 14px;
  z-index: 5;
  align-self: center;
  padding: 13px 22px;
  border-radius: 999px;
  background: #2e2018;
  color: #fffdf9;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(46, 32, 24, 0.25);
}
@media (min-width: 960px) {
  .ra-jump {
    display: none;
  }
}

/* Preview */
.ra-disclaimer {
  padding: 14px 18px;
  border-radius: 16px;
  background: #e5e6dc;
  font-size: 14px;
  line-height: 1.55;
  color: #3b302b;
}
.ra-disclaimer strong {
  color: #2e2018;
}
.ra-preview {
  display: flex;
  flex-direction: column;
}
.ra-preview__head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(20px, 3vw, 28px) clamp(20px, 3vw, 28px) 16px;
  border-bottom: 1px solid #e5ddd2;
}
.ra-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.ra-status {
  font-size: 14px;
  color: #5f7a57;
}
.ra-notice {
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: #fbf3df;
  font-size: 14px;
  line-height: 1.5;
  color: #3b302b;
}
.ra-notice .nk-text-btn {
  padding: 0 0 0 6px;
}
.ra-paper-wrap {
  padding: clamp(14px, 2.4vw, 22px);
  background: #f2ebe0;
}
@media (min-width: 960px) {
  .ra-paper-wrap {
    max-height: calc(100vh - 330px);
    min-height: 360px;
    overflow: auto;
  }
}
.ra-preview__foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px clamp(20px, 3vw, 28px) 20px;
}
.ra-promo {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  border-radius: 22px;
  background: #f7f1e8;
  color: #3b302b;
  text-decoration: none;
  box-shadow: 0 0 0 1px rgba(59, 48, 43, 0.06);
}

/* The agreement itself: a sheet of paper. */
.ra-doc {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(59, 48, 43, 0.08), 0 8px 24px rgba(59, 48, 43, 0.06);
  padding: clamp(20px, 4vw, 40px) clamp(18px, 4vw, 44px);
  color: #2e2018;
  font-size: 14.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.ra-doc__placeholder {
  margin: 0;
  color: #7a6a5c;
}
.ra-doc__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 2px solid #2e2018;
}
.ra-doc__kicker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8b5e3c;
}
.ra-doc__title {
  margin: 0 0 6px;
  font-size: clamp(24px, 3.4vw, 30px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.ra-doc__meta {
  margin: 0;
  font-size: 14px;
  color: #3b302b;
}
.ra-doc__intro {
  margin: 0 0 6px;
  color: #3b302b;
}
.ra-doc__sec {
  margin-top: 16px;
}
.ra-doc__sec h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #2e2018;
}
.ra-doc__sec ul {
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ra-doc__sec li::marker {
  color: #b9a998;
}
.ra-doc__rows {
  list-style: none;
  margin-left: -18px;
}
.ra-doc__rows table {
  width: 100%;
  max-width: 420px;
  border-collapse: collapse;
  margin: 2px 0 4px;
  font-variant-numeric: tabular-nums;
}
.ra-doc__rows th,
.ra-doc__rows td {
  padding: 4px 10px 4px 0;
  border-bottom: 1px dashed #e5ddd2;
  text-align: right;
  font-weight: 400;
}
.ra-doc__rows th {
  text-align: left;
  font-weight: 600;
}
.ra-doc__rows td:last-child {
  color: #7a6a5c;
  padding-right: 0;
}
.ra-doc__signers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 18px 28px;
  margin-top: 8px;
}
.ra-doc__signer {
  break-inside: avoid;
}
.ra-doc__signer-name {
  margin: 0 0 18px;
  font-weight: 600;
}
.ra-doc__line {
  margin: 0 0 18px;
  border-bottom: 1px solid #2e2018;
  height: 22px;
  position: relative;
}
.ra-doc__line span {
  position: absolute;
  left: 0;
  top: 100%;
  font-size: 11px;
  color: #7a6a5c;
}
.ra-doc__foot {
  margin-top: 22px;
  padding-top: 12px;
  border-top: 1px solid #e5ddd2;
  font-size: 12px;
  line-height: 1.5;
  color: #7a6a5c;
}
.ra-doc__foot p {
  margin: 0;
}
.ra-doc__made {
  margin-top: 4px !important;
  color: #9a8570;
}

/* Sample agreement below the generator. */
.ra-sample {
  margin: 0;
  max-height: 560px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: #3b302b;
}

/* Comparison table: text, not numbers. */
.ra-compare {
  min-width: 640px;
}
.ra-compare th,
.ra-compare td {
  text-align: left;
  vertical-align: top;
}
.ra-compare tbody th {
  font-weight: 700;
  color: #2e2018;
}

/* ---------- Print: only the agreement, on white paper ---------- */
@page {
  margin: 16mm 16mm 18mm;
}
@media print {
  body > div > :not(main),
  main > section:not(#generator),
  #generator > [aria-hidden],
  .ra-form-col,
  .ra-disclaimer,
  .ra-preview__head,
  .ra-preview__foot,
  .ra-promo,
  #cookie-banner,
  #locale-bar {
    display: none !important;
  }
  body,
  body > div,
  #generator,
  .ra-preview,
  .ra-paper-wrap {
    background: #fff !important;
  }
  #generator {
    padding: 0 !important;
  }
  .ra-grid {
    display: block !important;
  }
  .ra-preview,
  .ra-paper-wrap,
  .ra-doc {
    box-shadow: none !important;
    padding: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    border-radius: 0 !important;
  }
  .ra-preview-col {
    position: static !important;
  }
  .ra-doc {
    font-size: 10.5pt;
    line-height: 1.5;
    color: #000;
  }
  .ra-doc__title {
    font-size: 22pt;
  }
  .ra-doc__sec h3 {
    font-size: 11pt;
    break-after: avoid;
  }
  .ra-doc__sec li {
    break-inside: avoid;
  }
  .ra-doc__sign {
    break-inside: avoid;
  }
  .ra-doc * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
