/* Rent or buy: page styles on top of the shared style.css.
   Everything here is prefixed "rb-" so it never changes another page.
   Colours: buy = gold (the home you own), rent = slate. Money that's gone = rust. */

.rb-head { padding-block: 24px 4px; }
.rb-head h1 { font-size: var(--step-3); margin-top: 6px; }

.rb-work { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px 40px; align-items: start; padding-top: 16px; }
.rb-stage { display: grid; min-width: 0; }

.rb-answer { display: grid; gap: 2px; justify-items: start; }
.rb-answer .label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.rb-answer .big { font-size: clamp(2.6rem, 2rem + 2.4vw, 4rem); }
.rb-answer .big.is-rent { color: var(--slate); }
.rb-answer .big.is-buy { color: var(--gold); }
.rb-answer .big.is-even { color: var(--ink); }
.rb-answer-line { color: var(--muted); font-size: 0.93rem; max-width: 60ch; margin-top: 6px; }
.rb-answer-line strong { color: var(--ink); font-weight: 600; }

.rb-figure { margin: 0; padding-top: 12px; }
.rb-legend-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 24px; padding-top: 8px; }
.rb-legend-row .hint { font-size: 0.8rem; }
.rb-legend-row .legend { flex-wrap: wrap; }
.rb-key { display: inline-flex; align-items: center; gap: 7px; }
.chip.rb-chip-buy { border-color: var(--gold); }
.chip.rb-chip-rent { border-color: var(--slate); }
.rb-sw { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.rb-sw-int { background: var(--rust); opacity: 0.8; }
.rb-sw-own { background: var(--rust); opacity: 0.38; }
.rb-sw-prin { background: var(--gold-area); opacity: 0.75; }

/* chart marks */
.chart-box .rb-buy { fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .rb-rent { fill: none; stroke: var(--slate); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .rb-lead-buy { fill: var(--gold-area); fill-opacity: 0.16; }
.chart-box .rb-lead-rent { fill: var(--slate); fill-opacity: 0.14; }
.chart-box .rb-dot-buy { fill: var(--gold); stroke: var(--paper); stroke-width: 2; }
.chart-box .rb-dot-rent { fill: var(--slate); stroke: var(--paper); stroke-width: 2; }
.chart-box .rb-mark { font-size: 11.5px; font-weight: 700; fill: var(--ink); }
.chart-box .rb-mark-sub { font-size: 11px; fill: var(--muted); }
.chart-box .rb-gap { stroke: var(--ink); stroke-width: 1; }
.chart-box .rb-gap-label { font-family: var(--font-body); font-style: normal; font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.chart-box .rb-zone { fill: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.chart-box .rb-stay { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 3 3; }
.chart-box .rb-be-dot { fill: var(--paper); stroke: var(--ink); stroke-width: 1.8; }
.chart-box .rb-bar-int { fill: var(--rust); fill-opacity: 0.8; }
.chart-box .rb-bar-own { fill: var(--rust); fill-opacity: 0.38; }
.chart-box .rb-bar-prin { fill: var(--gold-area); fill-opacity: 0.75; }
.chart-box .rb-rentline { fill: none; stroke: var(--slate); stroke-width: 2.4; stroke-linejoin: round; }
.chart-box .rb-bar-hi { fill: var(--ink); fill-opacity: 0.06; }
.chart-box .rb-empty { fill: var(--muted); font-family: var(--font-body); font-style: normal; font-size: 13px; }
.chart-box .rb-halo { paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.tip .t-h { font-weight: 700; font-size: 0.78rem; margin-top: 4px; }
.tip .t-h.buy { color: var(--gold); }
.tip .t-h.rent { color: var(--slate); }
.tip .t-ahead { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 5px; font-weight: 600; }
.tip .t-sw { display: inline-flex; align-items: center; gap: 6px; }

/* stats */
.rb-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 22px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.rb-stat { padding: 12px 16px 14px 0; display: grid; gap: 2px; align-content: start; min-width: 0; }
.rb-stat + .rb-stat { padding-left: 16px; border-left: 1px solid var(--line); }
.rb-stat .label { font-size: 0.76rem; font-weight: 600; color: var(--muted); }
.rb-stat .v { font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; font-variant-numeric: lining-nums tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.rb-stat .sub { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* inputs */
.rb-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 16px; display: grid; gap: 4px; min-width: 0; position: sticky; top: 12px; }
.rb-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 12px; }
.rb-panel-head h2 { flex: none; font-size: 1.3rem; white-space: nowrap; }
.rb-panel-head .btn-row { flex: 0 1 auto; flex-wrap: nowrap; gap: 4px; min-width: 0; justify-content: flex-end; }
.rb-panel-head .inline-field { min-width: 0; flex: 0 1 auto; }
.rb-panel-head .inline-field select { max-width: 10rem; width: 100%; min-width: 0; }
.rb-panel-head .btn-ghost { padding-inline: 6px; }
.rb-form { display: grid; border-top: 1px solid var(--ink); }
.rb-group { border: 0; margin: 0; padding: 12px 0; display: grid; gap: 8px; min-width: 0; align-content: start; }
.rb-group + .rb-group { border-top: 1px solid var(--line); }
.rb-group:last-child { padding-bottom: 6px; }
.rb-group legend { float: left; width: 100%; padding: 0; font-family: var(--font-display); font-size: 1.05rem; }
.rb-group legend + * { clear: both; }
.rb-row2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
.rb-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
.rb-row3 .field label { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-group .hint { font-size: 0.8rem; }
.rb-panel .privacy { margin-top: 6px; }
.rb-panel input[type="text"] { min-height: 40px; }
.rb-errs:empty { display: none; }
.rb-errs { display: grid; }

/* sections */
.rb-section { padding-top: 64px; }
.rb-section-head { display: grid; gap: 8px; margin-bottom: 8px; }
.rb-msg { font-size: 1.05rem; max-width: 70ch; }
.rb-msg b { font-weight: 700; }
.rb-msg .c-buy { color: var(--gold); }
.rb-msg .c-rent { color: var(--slate); }
.rb-msg .c-gone { color: var(--rust); }

/* year by year */
.rb-yt-scroll { overflow-x: auto; margin-top: 8px; }
.rb-yt { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.93rem; border-top: 1px solid var(--ink); }
.rb-yt th, .rb-yt td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.rb-yt th:first-child, .rb-yt td:first-child { text-align: left; }
.rb-yt thead th { font-size: 0.76rem; color: var(--muted); font-weight: 600; }
.rb-yt .rb-yt-group th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; padding-top: 10px; text-align: center; border-bottom: 0; }
.rb-yt .rb-yt-group .g-buy { color: var(--gold); }
.rb-yt .rb-yt-group .g-rent { color: var(--slate); }
.rb-yt tbody th { font-weight: 600; }
.rb-yt td.z { color: var(--muted); }
.rb-yt td.ahead-buy { color: var(--gold); font-weight: 600; }
.rb-yt td.ahead-rent { color: var(--slate); font-weight: 600; }
.rb-yt tr.is-stay th, .rb-yt tr.is-stay td { border-bottom-color: var(--ink); }
.rb-yt tr.is-stay th::after { content: "your stay"; margin-left: 8px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.rb-yt td:nth-child(4), .rb-yt th:nth-child(4) { padding-right: 22px; }
.rb-yt-note { margin-top: 10px; }

@media (max-width: 1200px) and (min-width: 961px) { .rb-work { grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; } }
@media (max-width: 960px) {
  .rb-work { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rb-stage { display: contents; }
  .rb-answer { order: 1; }
  .rb-stage .rb-figure { order: 2; }
  .rb-panel { order: 3; margin-top: 18px; position: static; }
  .rb-stats { order: 4; margin-top: 28px; }
}
@media (max-width: 960px) and (min-width: 640px) {
  .rb-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 20px; }
  .rb-form .rb-group:last-child { grid-column: 1 / -1; }
  .rb-form .rb-group:nth-child(2) { border-top: 0; border-left: 1px solid var(--line); padding-left: 20px; }
}
@media (max-width: 640px) {
  .rb-stats { grid-template-columns: minmax(0, 1fr); }
  .rb-stat + .rb-stat { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .rb-stat { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 12px; padding-right: 0; }
  .rb-stat .label { grid-column: 1; }
  .rb-stat .v { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-size: 1.3rem; }
  .rb-stat .sub { grid-column: 1; grid-row: 2; }
}
@media (max-width: 600px) {
  .rb-head { padding-block: 16px 0; }
  .rb-head .eyebrow { display: none; }
  .rb-head h1 { font-size: 1.4rem; }
  .rb-answer .label { font-size: 0.76rem; }
  .rb-answer .big { font-size: 2.3rem; }
  .rb-answer-line { font-size: 0.86rem; }
  .rb-answer-line .rb-more { display: none; }
  .rb-figure { padding-top: 6px; }
  .rb-hover-hint { display: none; }
  .rb-panel { padding: 14px; margin-inline: -4px; }
  .rb-panel-head h2 { font-size: 1.2rem; }
  .rb-panel-head { padding-bottom: 10px; }
  .rb-section { padding-top: 52px; }
  .rb-yt { font-size: 0.84rem; }
  .rb-yt th, .rb-yt td { padding-right: 9px; }
  .rb-yt td:nth-child(4), .rb-yt th:nth-child(4) { padding-right: 14px; }
  .rb-yt tr.is-stay th::after { content: none; }
}

/* Tighter panel on desktop, so all the inputs fit beside the chart on one screen. */
@media (min-width: 961px) {
  .rb-panel { padding-top: 12px; }
  .rb-panel-head { padding-bottom: 8px; }
  .rb-group { padding: 9px 0; gap: 6px; }
  .rb-group .hint { font-size: 0.76rem; line-height: 1.4; }
}

/* Keep the currency picker readable: it used to shrink to an empty box once Share joined Reset.
   When "Your numbers" and the buttons don't fit on one line, the buttons move under the title. */
.rb-panel-head { flex-wrap: wrap; row-gap: 8px; }
.rb-panel-head .btn-row { flex: 0 0 auto; max-width: 100%; flex-wrap: wrap; row-gap: 6px; }
.rb-panel-head .inline-field { flex: 0 0 auto; }
.rb-panel-head .inline-field select { width: 8rem; min-width: 8rem; max-width: 8rem; }
