/* ==========================================================================
   Propdex — /rules/* answer-receipt pages.
   Loaded in addition to styles.css, which supplies every design token
   (:root palette, radii, shadows, --font Manrope + fallback chain).
   No new colours, no new typeface, no webfont request of its own.
   ========================================================================== */

.rules-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 24px 4.5rem;
}

.rules-page h1 {
  font-size: clamp(1.875rem, 4.2vw, 2.625rem);
  margin-bottom: 0.75rem;
}

.rules-page h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 3rem;
}

.rules-page h3 {
  font-size: 1.0625rem;
  margin-top: 1.75rem;
}

.rules-page ul,
.rules-page ol {
  padding-left: 1.25rem;
  margin: 0 0 1rem;
}

.rules-page li {
  margin-bottom: 0.5rem;
}

/* --- Breadcrumbs -------------------------------------------------------- */

.breadcrumb {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb li {
  margin: 0;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--border);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumb a:focus-visible {
  color: var(--emerald-deep);
  text-decoration: underline;
}

/* --- Effective-date badge ----------------------------------------------- */

.effective-date {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 6px 14px;
  border: 1px solid var(--mint-soft);
  border-radius: 999px;
  background: var(--tint);
  color: var(--emerald-darker);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.effective-date.is-fresh {
  border-color: var(--emerald);
  background: var(--tint-2);
}

.rules-lede {
  font-size: 1.1875rem;
  color: var(--text-body);
  margin: 1.25rem 0 0;
}

/* --- The rule box ------------------------------------------------------- */

.rule-box {
  margin: 1.5rem 0;
  padding: 1.5rem 1.5rem 1.25rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--emerald);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  box-shadow: var(--shadow-sm);
}

.rule-box > :last-child {
  margin-bottom: 0;
}

.rule-headline {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-strong);
}

/* --- Worked example ----------------------------------------------------- */

.worked-example {
  margin: 1.5rem 0;
  padding: 1.5rem;
  border: 1px solid var(--mint-soft);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-md);
}

.worked-example > :last-child {
  margin-bottom: 0;
}

.worked-example .facts {
  list-style: none;
  padding: 0 0 1rem;
  margin: 0 0 1.25rem;
  border-bottom: 1px solid var(--border);
}

.worked-example .facts li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
  color: var(--text-body);
}

.worked-example .facts .fact-value {
  font-weight: 700;
  color: var(--text-strong);
}

.arithmetic {
  margin: 0 0 1.25rem;
  padding: 1rem 1.125rem;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  font-variant-numeric: tabular-nums;
  overflow-x: auto;
}

.arithmetic ol {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}

.arithmetic li {
  counter-increment: step;
  margin-bottom: 0.5rem;
  padding-left: 2rem;
  position: relative;
  line-height: 1.6;
}

.arithmetic li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: var(--tint-2);
  color: var(--emerald-darker);
  font-size: 0.75rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.arithmetic .sum {
  font-weight: 700;
  color: var(--text-strong);
}

.answer-line {
  margin: 0;
  padding: 1rem 1.125rem;
  border-radius: var(--radius-sm);
  background: var(--forest);
  color: var(--white);
  font-size: 1.0625rem;
  font-weight: 700;
}

.answer-line .answer-label {
  display: block;
  color: var(--mint-soft);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

/* --- Rate tables --------------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.rate-table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.rate-table caption {
  caption-side: top;
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
}

.rate-table th,
.rate-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.rate-table thead th {
  font-weight: 700;
  color: var(--text-strong);
  background: var(--surface-subtle);
}

.rate-table tbody tr:last-child th,
.rate-table tbody tr:last-child td {
  border-bottom: 0;
}

.rate-table tbody th {
  font-weight: 600;
  color: var(--text-strong);
}

/* --- What changes the answer -------------------------------------------- */

.changes-answer {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
}

.changes-answer li {
  padding: 0.875rem 0 0.875rem 1.75rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  margin: 0;
}

.changes-answer li:last-child {
  border-bottom: 0;
}

.changes-answer li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 1.4rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
}

.changes-answer strong {
  color: var(--text-strong);
}

/* --- Sources ------------------------------------------------------------- */

.sources {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  font-size: 0.9375rem;
}

.sources li {
  padding-left: 1.25rem;
  text-indent: -1.25rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  word-break: break-word;
}

.sources a {
  font-weight: 600;
}

/* --- In-page CTA --------------------------------------------------------- */

.ask-dex {
  margin: 3rem 0 0;
  padding: 2rem 1.75rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--forest) 0%, var(--forest-deep) 100%);
  color: var(--text-on-forest);
  text-align: center;
}

.ask-dex h2 {
  color: var(--white);
  margin-top: 0;
  font-size: 1.375rem;
}

.ask-dex p {
  color: var(--text-on-forest);
  max-width: 46ch;
  margin: 0 auto 1.25rem;
}

.ask-dex .form-note {
  margin: 1rem auto 0;
  font-size: 0.8125rem;
  color: var(--mint-soft);
}

/* --- Disclaimer ---------------------------------------------------------- */

.rules-disclaimer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* --- Rules index --------------------------------------------------------- */

.rules-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.rules-index-grid li {
  margin: 0;
}

.rules-index-grid a {
  display: block;
  height: 100%;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.rules-index-grid a:hover,
.rules-index-grid a:focus-visible {
  border-color: var(--emerald);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.rules-index-grid h2 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 0.625rem 0 0.5rem;
  line-height: 1.35;
}

.rules-index-grid p {
  font-size: 0.9375rem;
  color: var(--text-body);
  margin: 0;
}

/* --- Related links ------------------------------------------------------- */

.related-rules {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.related-rules h2 {
  font-size: 1.0625rem;
  margin: 0 0 0.75rem;
}

.related-rules ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-rules li {
  margin-bottom: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  .rules-index-grid a:hover,
  .rules-index-grid a:focus-visible {
    transform: none;
  }
}
