/* The three widgets in "The 130-Day Test".
 *
 * Scoped to .post-page and rent-* class names, so nothing here reaches another page. Every colour
 * is a shared token from styles.css, which is what gives the light, dark and Auto schemes for
 * free. The orange always means rent or the four weeks the shortcut leaves out; the figures are
 * printed beside every graphic, so colour is never the only copy of an answer.
 */

/* ---------------------------------------------------------------- Shared bits */

.post-page .rent-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.post-page .rent-fields .field { margin-bottom: 0; min-width: 0; }
.post-page .rent-fields input { min-width: 0; }
.post-page .rent-fixed-note {
  margin: 0 0 14px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
}
.post-page .rent-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.post-page .rent-live {
  margin: 14px 0 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted);
}
.post-page .rent-live:empty { display: none; }
.post-page .rent-widget [hidden] { display: none; }
.post-page .rent-headline {
  margin: 0 0 14px;
  padding: 16px 18px;
  border-left: 4px solid var(--highlight);
  border-radius: 0 12px 12px 0;
  background: var(--accent);
}
.post-page .rent-headline-number {
  display: block;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.05;
  color: var(--highlight);
  font-variant-numeric: tabular-nums;
}
.post-page .rent-headline-label { display: block; margin-top: 2px; font-weight: 700; }
.post-page .rent-headline-sub { margin: 6px 0 0; color: var(--muted); font-size: 0.92rem; }

/* ---------------------------------------------------------------- 1. The calendar */

.post-page .rent-calendar-blocks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}
.post-page .rent-calendar-block {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.post-page .rent-calendar-block-label {
  margin: 0 0 6px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.post-page .rent-calendar-cells {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 3px;
}
.post-page .rent-calendar-cell {
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 2px;
}
.post-page .rent-calendar-cell.is-free { background: var(--accent); box-shadow: inset 0 0 0 1px var(--border); }
.post-page .rent-calendar-cell.is-rent { background: var(--highlight); }
.post-page .rent-calendar-caption {
  margin: 0 0 16px;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted);
}
.post-page .rent-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--muted);
}
.post-page .rent-legend li { display: flex; align-items: center; gap: 7px; }
.post-page .rent-legend-swatch {
  width: 13px;
  height: 13px;
  flex: none;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: inset 0 0 0 1px var(--border);
}
.post-page .rent-legend-swatch.is-rent { background: var(--highlight); box-shadow: none; }
.post-page .rent-stats,
.post-page .rent-weeks-stats,
.post-page .rent-change-stats {
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--border);
}
.post-page .rent-stats > div,
.post-page .rent-weeks-stats > div,
.post-page .rent-change-stats > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.post-page .rent-stats dt,
.post-page .rent-weeks-stats dt,
.post-page .rent-change-stats dt { color: var(--muted); font-size: 0.88rem; }
.post-page .rent-stats dd,
.post-page .rent-weeks-stats dd,
.post-page .rent-change-stats dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.post-page .rent-weeks-stats dd.is-active { color: var(--highlight); }

/* ---------------------------------------------------------------- 2. The four missing weeks */

.post-page .rent-weeks-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.post-page .rent-weeks-toggle .preset-chip { margin: 0; }
.post-page .rent-weeks-grid {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 10px 8px;
  margin: 0 0 14px;
}
.post-page .rent-weeks-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  min-width: 0;
}
.post-page .rent-weeks-group-label {
  grid-column: 1 / -1;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}
.post-page .rent-weeks-cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--primary);
}
.post-page .rent-weeks-group.is-missing .rent-weeks-cell {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--highlight);
  border: 1px dashed var(--highlight);
  border-radius: 3px;
}
.post-page .rent-weeks-group.is-added .rent-weeks-cell { background: var(--highlight); }
.post-page .rent-weeks-caption {
  margin: 0 0 6px;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted);
}
.post-page .rent-weeks-mode-note {
  margin: 0 0 16px;
  font-size: 0.82rem;
  line-height: 1.55;
  font-weight: 600;
}

/* ---------------------------------------------------------------- 3. The rent-change dial */

.post-page .rent-change-readout {
  margin: 0 0 16px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--accent);
}
.post-page .rent-change-sentence { margin: 0 0 8px; font-weight: 600; }
.post-page .rent-change-big {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  line-height: 1.15;
  font-weight: 700;
  color: var(--highlight);
  font-variant-numeric: tabular-nums;
}
.post-page .rent-change-money { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); }
.post-page .rent-change-slider { margin: 0 0 14px; }
.post-page .rent-change-slider .slider-label { margin-top: 0; }
.post-page .rent-change-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}
.post-page .rent-change-presets { margin: 0 0 16px; }
.post-page .rent-change-presets .preset-chip { min-height: 40px; padding: 7px 13px; }
.post-page .rent-change-stats dd { max-width: 62%; }

@media (max-width: 760px) {
  .post-page .rent-fields { grid-template-columns: minmax(0, 1fr); }
  .post-page .rent-calendar-blocks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-page .rent-weeks-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .post-page .rent-change-stats dd { max-width: 58%; }
}
@media (max-width: 430px) {
  .post-page .rent-calendar-blocks { grid-template-columns: minmax(0, 1fr); }
  .post-page .rent-calendar-block-label { font-size: 0.7rem; }
  .post-page .rent-weeks-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 6px; }
  .post-page .rent-change-stats > div { flex-wrap: wrap; gap: 2px 12px; }
  .post-page .rent-change-stats dd { max-width: 100%; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .post-page .rent-calendar-cell,
  .post-page .rent-weeks-cell { transition: none; }
}
