/* Layered home page (v2.9.10).
 *
 * body[data-view] is set by /layers.js from the URL hash:
 *   app  - hero + rent check + result + legal note        (layer 1)
 *   hub  - #tools, a list of tiles                         (layer 2)
 *   tool - one section[data-layer="2"], alone on screen    (layer 3)
 *
 * The rules below hide layer 2 even before the script runs, so a slow
 * connection never flashes the 22-screen page. */

/* Only the active tool is ever shown. */
section[data-layer="2"]:not(.rg-active-tool) {
  display: none !important;
}

/* The rent check steps aside while the reader is in the tools. */
body[data-view="hub"] [data-layer="1"],
body[data-view="tool"] [data-layer="1"],
body[data-view="hub"] #calculator,
body[data-view="tool"] #calculator {
  /* The ID selectors are needed: r23-experience.css pins #calculator's
     display with an ID-level !important rule that outranks the attribute. */
  display: none !important;
}

.rg-hub[hidden],
.rg-viewbar[hidden] {
  display: none !important;
}

/* ---- View bar: always-visible way back ---------------------------------- */

.rg-viewbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin: 0 auto 12px;
  padding: 6px 16px;
  width: min(1180px, calc(100% - 32px));
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(15, 42, 74, 0.1);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
}

.rg-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px 0 6px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  color: #087c70;
  white-space: nowrap;
}

.rg-back:hover,
.rg-back:focus-visible {
  background: #eaf7f2;
}

.rg-back-arrow {
  font-size: 1.6rem;
  line-height: 1;
}

.rg-viewbar-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: #0f2a4a;
}

/* ---- Tools hub ------------------------------------------------------------ */

.rg-hub h1 {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 4vw, 2rem);
  outline: none;
}

.rg-hub > .small-note {
  margin: 0 0 16px;
}

.rg-tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

@media (min-width: 760px) {
  .rg-tiles { grid-template-columns: 1fr 1fr; }
}

.rg-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 14px 16px;
  border: 1px solid rgba(15, 42, 74, 0.12);
  border-radius: 14px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.rg-tile:hover,
.rg-tile:focus-visible {
  border-color: #087c70;
  background: #f4fbf8;
}

.rg-tile-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.rg-tile strong {
  font-size: 1rem;
  color: #0f2a4a;
}

.rg-tile small {
  font-size: 0.875rem;
  line-height: 1.4;
  color: #4a5b73;
}

.rg-chevron {
  flex: 0 0 auto;
  font-size: 1.5rem;
  line-height: 1;
  color: #087c70;
}

/* ---- Entry card under the rent check ------------------------------------ */

.rg-layer-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.rg-layer-toggle h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.rg-layer-toggle .small-note {
  margin: 0;
  max-width: 60ch;
}

.rg-layer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 44px;
  text-decoration: none;
}

@media (max-width: 640px) {
  .rg-layer-toggle { flex-direction: column; align-items: stretch; }
  .rg-layer-button { width: 100%; }
}

/* ---- Lighter layer 1 ------------------------------------------------------- */

/* The legal notice stays on every screen, but it does not need a hero-sized
 * heading to do its job. The wording itself is unchanged. */
#legal h2 {
  /* !important because r18-qa.css sets every h2 with !important. */
  font-size: clamp(1.15rem, 3.2vw, 1.5rem) !important;
  line-height: 1.3 !important;
}

/* Five provinces stacked one per row took most of a phone screen. Two per
 * row on phones, with the same 44px minimum tap target. */
@media (max-width: 640px) {
  /* r18-qa.css ends its breakpoint chain at a single column with
     !important, which is what stacked the five provinces. */
  #calcForm .segmented.province-options {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
}

/* ---- Phone menu fix (pre-existing defect, found in v2.9.9) ---------------
 *
 * .nav has z-index:20 plus backdrop-filter, which makes it a stacking context.
 * The open menu (.nav-actions, z-index:1002) is inside it, so its effective
 * level is 20, and the dimming backdrop (z-index:999) sat on top of it: on a
 * phone the menu opened and every link in it was untappable.
 *
 * !important is required, not a shortcut: r18-qa.css pins
 * `.nav{z-index:20!important}`. styles.css originally gave .nav z-index:1002,
 * which worked; the R18 override is what broke the menu. */
body.r16-nav-open .site-header .nav {
  z-index: 1001 !important;
}

/* Second half of the same defect. .site-header has overflow:clip, and the
 * open menu is position:fixed inside .nav, whose backdrop-filter makes .nav
 * (not the viewport) its containing block. So the menu is clipped to the
 * header's box. On the rent check the header also contains the tall hero, so
 * the menu fitted by luck; on the tools screens the hero is hidden, the
 * header shrinks to the 67px bar, and the whole menu was clipped away. */
body.r16-nav-open .site-header {
  overflow: visible !important;
}

/* ---- Selected province chip contrast (pre-existing defect) ---------------
 *
 * The checked chip paints white text on teal (#087C70), but the translated
 * label is wrapped in an inner <span data-i18n-key>, and a descendant rule
 * coloured that inner span #4A5B73: about 1.3:1, so the province the user just
 * picked was the only one they could not read. */
.segmented input:checked + span span {
  color: inherit !important;
}


/* ---- Checkout availability (v2.9.11) -------------------------------------
 *
 * A buy button that cannot succeed (Stripe not configured, or the package is
 * already covered by the user's team plan) is disabled rather than hidden, so
 * the price list still reads as a price list, with the reason underneath. */
.price-card button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.rg-price-note,
.rg-ocr-note {
  margin: 8px 0 0;
}


/* ---- Field-level validation (v2.9.12) -----------------------------------
 *
 * Every problem names its field and is a full-width button that takes the
 * user to it. The field itself turns red with the reason underneath. */
.calc-validation ul {
  list-style: none;
  padding-left: 0 !important;
}

.calc-validation li.r26-issue-static,
.calc-validation .r25-error-link,
#calculator .calc-validation .r25-error-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px !important;
  border: 1px solid #fdba74 !important;
  border-inline-start: 4px solid #b44727 !important;
  border-radius: 12px;
  background: #fff !important;
  color: #7c2d12 !important;
  text-align: start !important;
  text-decoration: none !important;
  font: inherit;
  cursor: pointer;
}

.calc-validation li.r26-issue-static {
  flex-wrap: wrap;
  cursor: default;
}

.calc-validation .r25-error-link:hover,
.calc-validation .r25-error-link:focus-visible {
  background: #ffedd5 !important;
}

.calc-validation .r25-error-link strong,
.calc-validation li.r26-issue-static strong {
  flex: 0 0 auto;
  font-weight: 800;
}

/* Label on the first line, reason under it, chevron on the right. */
.calc-validation .r25-error-link,
#calculator .calc-validation .r25-error-link {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 2px;
  height: auto !important;
  white-space: normal !important;
  line-height: 1.35;
}

.calc-validation .r25-error-link strong,
.calc-validation .r25-error-link span {
  grid-column: 1;
  display: block !important;
  margin: 0 !important;
  min-width: 0;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

.calc-validation .r25-error-link span {
  font-weight: 500;
}

.calc-validation .r25-error-link b {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 1.4rem;
  line-height: 1;
  color: #b44727;
}

.calc-validation li.r26-issue-static {
  display: grid !important;
  gap: 2px;
}

.calc-validation li.r26-issue-static strong,
.calc-validation li.r26-issue-static span {
  display: block;
  margin: 0;
}

[dir="rtl"] .calc-validation .r25-error-link b {
  transform: scaleX(-1);
}

.calc-validation .r26-technical {
  flex-basis: 100%;
  font-style: italic;
  color: #6b4a3a;
}

.calc-validation .r26-hint {
  margin: 8px 0 0;
  font-size: 0.875rem;
  color: #8a4727;
}

/* Red frame on any invalid control, in any form (the rent check already had
 * its own rule). */
form [aria-invalid="true"]:not([type="radio"]):not([type="checkbox"]) {
  border: 2px solid #b42318 !important;
  background: #fff7f5 !important;
}

.r26-invalid-group {
  outline: 2px solid #b42318;
  outline-offset: 4px;
  border-radius: 12px;
}

.r25-field-error,
form .r25-field-error {
  display: block;
  margin-top: 4px;
  color: #9a3412 !important;
  font-weight: 600;
}

@keyframes r26-flash {
  0% { box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.55); }
  100% { box-shadow: 0 0 0 10px rgba(180, 35, 24, 0); }
}

.r26-flash {
  animation: r26-flash 0.9s ease-out 2;
}

@media (prefers-reduced-motion: reduce) {
  .r26-flash { animation: none; }
}

/* Choice chips (role, province, case type) hid their radio with display:none,
 * which also made them unreachable by keyboard and impossible to focus when a
 * problem sends the user to them. Visually hidden instead; the chip shows the
 * focus ring. */
.segmented label {
  position: relative;
}

.segmented input[type="radio"],
.segmented input[type="checkbox"] {
  display: block !important;
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  opacity: 0 !important;
  cursor: pointer;
}

.segmented input:focus-visible + span {
  outline: 3px solid #087c70;
  outline-offset: 2px;
}

/* ---- Rules freshness strip (v2.9.15) -------------------------------------
 *
 * Shown on every result. A legal tool that cannot answer "are these rules
 * current?" is asking the reader to take it on faith. */
.rg-rules-freshness {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 10px 14px;
  border: 1px solid #cfe6de;
  border-radius: 12px;
  background: #f4fbf8;
  color: #0f2a4a;
  font-size: 0.9rem;
}

.rg-rules-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #087c70;
  flex: 0 0 auto;
}

.rg-rules-freshness a {
  color: #087c70;
  font-weight: 600;
}

.rg-rule-changes {
  margin: 8px 0 0;
  padding: 10px 14px;
  border: 1px solid #e3ecf6;
  border-radius: 12px;
  background: #fff;
}

.rg-rule-changes summary {
  cursor: pointer;
  font-weight: 600;
  color: #0f2a4a;
  min-height: 34px;
  display: flex;
  align-items: center;
}

.rg-rule-changes ul {
  margin: 8px 0 0;
  padding-inline-start: 20px;
  display: grid;
  gap: 6px;
  color: #33507a;
  font-size: 0.9rem;
}

/* ---- Quebec starting-rent check (v2.9.16) --------------------------------
 *
 * Section G (art. 1896) and clause F (art. 1955). The amount and the deadline
 * lead; the legal article is a footnote. */
.qc-disclosure {
  margin: 16px 0 0;
  padding: 16px 18px;
  border: 1.5px solid #f2c9a8;
  border-radius: 16px;
  background: #fffaf5;
}

.qc-disclosure h4 {
  margin: 0 0 4px;
  color: #8a4727;
  font-size: 1.05rem;
}

.qc-disclosure h5 {
  margin: 14px 0 6px;
  color: #0f2a4a;
  font-size: 0.95rem;
}

.qc-disclosure-block {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #f0dccb;
}

.qc-disclosure-amount {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #9a3412;
  line-height: 1.2;
}

.qc-disclosure-amount small {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #7c4a3a;
  margin-top: 2px;
}

.qc-disclosure-deadline {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eef5ff;
  color: #0f2a4a;
}

.qc-disclosure-deadline.danger {
  background: #fff1ef;
  color: #9a3412;
}

.qc-disclosure-steps {
  margin: 0;
  padding-inline-start: 22px;
  display: grid;
  gap: 8px;
  color: #33507a;
}

.qc-registry-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #087c70;
  font-weight: 700;
}

/* ---- Landlord tools (v2.9.16) ------------------------------------------- */
.notice-ok { color: #0b6b3a; font-weight: 700; }
.notice-bad { color: #9a3412; font-weight: 700; }

.notice-issues {
  margin: 8px 0 0;
  padding-inline-start: 20px;
  display: grid;
  gap: 6px;
}

.notice-issues li.danger { color: #9a3412; }
.notice-issues li.warning { color: #8a4727; }

.notice-text {
  margin: 8px 0 0;
  padding: 14px 16px;
  border: 1px solid #dce8f7;
  border-radius: 12px;
  background: #fbfdff;
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.55;
}

.portfolio-count {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.portfolio-count strong {
  font-size: 1.6rem;
  color: #9a3412;
}

.portfolio-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.portfolio-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 12px;
  border: 1px solid #e3ecf6;
  border-inline-start: 4px solid #9fb6d4;
  border-radius: 12px;
  background: #fff;
}

.portfolio-row.overdue { border-inline-start-color: #b42318; background: #fff7f5; }
.portfolio-row.urgent { border-inline-start-color: #b44727; background: #fffaf5; }
.portfolio-row.soon { border-inline-start-color: #c08a2e; }

.portfolio-badge {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #4a5b73;
}

.portfolio-row.overdue .portfolio-badge { color: #9a3412; }

.portfolio-date { font-variant-numeric: tabular-nums; font-weight: 700; color: #0f2a4a; }
.portfolio-label { font-weight: 600; color: #0f2a4a; }

.portfolio-kind {
  grid-column: 1 / -1;
  color: #4a5b73;
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------------------
   Task picker (v2.9.19)

   One question, then one tool. The choices are deliberately large and
   full-width on a phone: this is the control that decides whether a worried
   tenant finds the right form, and a row of small pills is how they give up.
   --------------------------------------------------------------------------- */
.task-picker {
  margin: 0 0 18px;
}

.task-prompt {
  margin: 0 0 10px;
  font-weight: 700;
  color: #1c2b44;
}

.task-choices {
  display: grid;
  gap: 8px;
}

@media (min-width: 620px) {
  .task-choices { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

.task-choice {
  appearance: none;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  text-align: start;
  font: inherit;
  font-weight: 600;
  color: #1c2b44;
  background: #f4f7fd;
  border: 1px solid #d5e0f2;
  border-radius: 14px;
  cursor: pointer;
}

.task-choice:hover,
.task-choice:focus-visible {
  border-color: #1769e8;
  background: #eaf2ff;
}

.task-choice-active {
  background: #1769e8;
  border-color: #1769e8;
  color: #ffffff;
}

/* A hidden form must be gone, not merely transparent: a screen reader should
   not read out three forms the user did not choose. */
[data-task][hidden] {
  display: none !important;
}

.partner-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.partner-card {
  padding: 14px 16px;
  border: 1px solid #e2e8f4;
  border-radius: 14px;
  background: #fbfcff;
}

.partner-card p { margin: 0 0 6px; }

/* 2.10.4: prevention steps (Understand → Act), landlord message, plan cards. */
.rg-steps-panel .rg-steps{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;counter-reset:none}
.rg-steps-panel .rg-steps .funnel-step{min-height:0;margin:0}
.rg-steps-panel .rg-steps h3{margin:.5rem 0 .25rem;font-size:1.05rem}
.rg-steps-panel .rg-steps p{margin:0;font-size:.92rem}
.rg-landlord-quote{margin:16px 0 0;padding:12px 16px;border-left:4px solid #0b63e6;background:#f5f9ff;border-radius:12px}
.rg-landlord-quote p{margin:0}
.rg-landlord-quote p + p{font-style:italic;margin-top:4px}
.rg-landlord-quote-inline{font-style:italic}
.hero-copy-secondary{font-size:.98rem;opacity:.9}
.rg-official-eyebrow{margin-bottom:6px}
.pricing-group-title{margin:18px 0 6px;font-size:1.1rem}
.pricing-grid-tenant{grid-template-columns:repeat(2,minmax(0,1fr))}
.pricing-grid-landlord{grid-template-columns:repeat(3,minmax(0,1fr))}
.price-positioning{font-weight:800;margin:.15rem 0 .35rem}
.price-units{margin:0;font-weight:700;color:var(--muted,#475569)}
.price-billing{margin-top:0}
.price.price-planned,.price.price-custom{font-size:1.6rem!important;line-height:1.25;overflow-wrap:break-word;word-break:normal;hyphens:none;white-space:normal;max-width:100%}
@media (max-width:560px){.price.price-planned,.price.price-custom{font-size:1.3rem!important}}
.price-features{margin:.5rem 0 .75rem;padding-left:1.1rem}
.price-features li{margin:.2rem 0}
.price-card .button-link{display:inline-block;text-align:center;text-decoration:none;padding:10px 14px}
.pricing-monthly-note{margin-top:12px}
@media (max-width:1100px){.rg-steps-panel .rg-steps{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:760px){.rg-steps-panel .rg-steps{grid-template-columns:repeat(2,minmax(0,1fr))}.pricing-grid-tenant,.pricing-grid-landlord{grid-template-columns:1fr}}
