/* ==========================================================================
   The Foom York Times / The Overshoot
   NYT Upshot-inspired visual layer for a satirical calculator.
   Chomsky is distributed under the SIL Open Font License; used here only for
   the parody nameplate, with font-display: swap.
   ========================================================================== */

@font-face {
  font-family: "Chomsky";
  src: url("assets/fonts/Chomsky.otf") format("opentype");
  font-display: swap;
}

:root {
  --paper: #fff;
  --ink: #121212;
  --text: #363636;
  --secondary: #727272;
  --faint: #999;
  --rule: #ddd;
  --rule-light: #e2e2e2;
  --link: #326891;
  --action: #567b95;
  --rent: #3498db;
  --buy: #6B45CF;
  --neutral: #ccc;
  --slider-track: #eee;
  --slider-stroke: #bbb;
  --slider-tick: #aaa;
  --header-height: 44px;
  --article-width: 660px;
  --page-width: 1100px;
  --franklin: "Libre Franklin", Arial, Helvetica, sans-serif;
  --cheltenham: "Domine", Georgia, "Times New Roman", serif;
  --imperial: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--imperial);
  font-size: 20px;
  line-height: 1.5;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input {
  font: inherit;
}

main {
  padding: 0 20px 80px;
}

/* ---------- sticky masthead ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-height);
  background: var(--paper);
  border-bottom: 1px solid var(--rule-light);
  box-shadow: rgba(0, 0, 0, 0.08) 0 0 5px 1px;
}

.site-header-inner {
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.header-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.05;
}

.header-section {
  font-family: var(--franklin);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
}

.paperclip-link {
  margin-top: 3px;
  font-family: var(--franklin);
  font-size: 11px;
  font-weight: 500;
  color: var(--link);
}

.nameplate {
  justify-self: center;
  color: var(--ink);
  font-family: "Chomsky", Georgia, serif;
  font-size: 29px;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}

.nameplate:hover {
  text-decoration: none;
}

.header-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 14px;
}

.subscribe-link {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--link);
  border-radius: 3px;
  background: var(--action);
  color: #fff;
  font-family: var(--franklin);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.subscribe-link:hover,
.subscribe-link:focus-visible {
  background: var(--link);
  text-decoration: none;
}

.login-link {
  font-family: var(--franklin);
  font-size: 13px;
  font-weight: 500;
  color: var(--link);
  white-space: nowrap;
}

/* ---------- article head and body ---------- */

article {
  max-width: var(--page-width);
  margin: 0 auto;
}

.article-head {
  max-width: var(--page-width);
  margin: 44px auto 0;
  text-align: left;
}

.article-head > * {
  max-width: var(--article-width);
}

.overshoot-wordmark {
  margin-bottom: 22px;
}

.overshoot-logo {
  margin: 0;
  font-family: var(--franklin);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  letter-spacing: 0;
}

.overshoot-tagline {
  margin: 4px 0 0;
  font-family: var(--franklin);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--cheltenham);
  font-size: 48px;
  font-style: italic;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0;
}

.dek {
  margin: 20px 0 0;
  color: var(--text);
  font-family: var(--imperial);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.5;
}

.byline {
  margin: 18px 0 0;
  color: var(--text);
  font-family: var(--franklin);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.333;
}

.byline-name {
  font-weight: 600;
}

.update-alert {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  background: #fffcd9;
  color: rgba(0, 0, 0, 0.65);
  font-family: var(--franklin);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
}

.article-body {
  max-width: var(--article-width);
  margin: 34px 0 0;
}

.graf {
  margin: 0 0 1.2em;
  color: var(--text);
  font-family: var(--imperial);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.5;
}

.graf em {
  font-style: italic;
}

.you-are-here {
  margin: 34px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--rule-light);
  background: var(--paper);
  color: var(--text);
  font-family: var(--franklin);
  font-size: 15px;
  line-height: 1.45;
}

.you-are-here p {
  margin: 0;
}

.you-are-here-label {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--franklin);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ---------- calculator layout ---------- */

.calculator {
  max-width: var(--page-width);
  margin: 52px auto 0;
  padding: 30px 0 0;
  border-top: 1px solid var(--rule);
}

.calc-grid {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}

.inputs {
  flex: 1;
  min-width: 0;
}

.input-section + .input-section {
  margin-top: 58px;
}

.inputs-heading {
  margin: 0;
  color: #333;
  font-family: var(--franklin);
  font-size: 42px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
}

.section-intro {
  max-width: var(--article-width);
  margin: 10px 0 4px;
  color: #333;
  font-family: var(--franklin);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.4;
}

.control {
  --pct: 0%;
  max-width: 680px;
  margin-top: 30px;
  display: flex;
  align-items: flex-start;
}

.control-meta {
  width: 25%;
  min-width: 0;
  padding-right: 20px;
}

.control-meta label,
.toggle-label {
  display: block;
  color: #555;
  font-family: var(--franklin);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
}

.value-input {
  width: 100%;
  min-height: 30px;
  margin-top: 7px;
  padding: 4px 0 3px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--franklin);
  font-size: 20px;
  font-weight: 200;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.value-input:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.control-note {
  margin: 8px 0 0;
  color: var(--faint);
  font-family: var(--franklin);
  font-size: 13.5px;
  font-style: italic;
  font-weight: 500;
  line-height: 1.3;
}

.slider-column {
  width: 75%;
  min-width: 0;
}

.slider-shell {
  position: relative;
  height: 62px;
}

.slider-shell::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 22px;
  height: 11px;
  background-image: repeating-linear-gradient(
    to right,
    var(--slider-tick) 0,
    var(--slider-tick) 1px,
    transparent 1px,
    transparent calc(100% / 39)
  );
  pointer-events: none;
}

.slider-shell::after {
  content: "";
  position: absolute;
  top: 20px;
  left: var(--pct);
  width: 1px;
  height: 15px;
  background: #000;
  transform: translateX(-0.5px);
  pointer-events: none;
}

.slider-value-cursor {
  position: absolute;
  top: 0;
  left: clamp(42px, var(--pct), calc(100% - 42px));
  transform: translateX(-50%);
  max-width: 118px;
  padding: 1px 3px;
  background: var(--paper);
  color: #333;
  font-family: var(--franklin);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  left: 0;
  top: 36px;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border: 1px solid var(--slider-stroke);
  border-radius: 3px;
  background:
    linear-gradient(to right, #ddd 0, #ddd var(--pct), var(--slider-track) var(--pct), var(--slider-track) 100%);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border: 1px solid var(--slider-stroke);
  border-radius: 3px;
  background: var(--slider-track);
}

input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: #ddd;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 16px;
  margin-top: -6px;
  border: 1px solid var(--slider-stroke);
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 16px;
  border: 1px solid var(--slider-stroke);
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

input[type="range"]:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 14px;
}

.slider-minmax {
  display: flex;
  justify-content: space-between;
  margin-top: 0;
  color: var(--faint);
  font-family: var(--franklin);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.toggle-control {
  min-height: 0;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle-track {
  position: relative;
  width: 38px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid var(--slider-stroke);
  border-radius: 20px;
  background: var(--slider-track);
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border: 1px solid var(--slider-stroke);
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.toggle input:checked + .toggle-track {
  background: var(--buy);
  border-color: var(--buy);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

/* ---------- sticky results rail ---------- */

.results {
  width: 30%;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  background: var(--paper);
}

.verdict-card {
  margin: 0;
}

.verdict-box {
  margin: 0 0 12px;
  padding: 12px 10px;
  border-radius: 4px;
  background: var(--neutral);
  color: #333;
  font-family: var(--franklin);
  font-size: 20px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
}

.verdict-box.verdict-rent {
  background: var(--rent);
  color: #fff;
}

.verdict-box.verdict-buy {
  background: var(--buy);
  color: #fff;
}

.verdict-box.verdict-neutral {
  background: var(--neutral);
  color: #333;
}

.verdict {
  margin: 0 0 12px;
  color: var(--ink);
  font-family: var(--franklin);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.38;
}

.verdict strong {
  font-weight: 700;
}

.verdict-sub {
  max-width: 660px;
  margin: 0;
  color: #363636;
  font-family: var(--franklin);
  font-size: 14px;
  line-height: 1.5;
}

.verdict .num,
.verdict-sub .num {
  font-weight: 700;
  white-space: nowrap;
}

.verdict-fineprint {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid #ddd;
}

.verdict-fineprint h3 {
  margin: 40px 0 10px;
  color: #333;
  font-family: var(--franklin);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
}

.chart-block {
  margin: 16px 0 0;
}

.chart-title {
  margin: 0 0 6px;
  color: var(--ink);
  font-family: var(--franklin);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.chart {
  width: 100%;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart .tick-label {
  fill: var(--faint);
  font-family: var(--franklin);
  font-size: 12px;
  font-weight: 500;
}

.chart .grid-line {
  stroke: var(--rule-light);
  stroke-width: 1;
}

.chart .zero-line {
  stroke: var(--rule);
  stroke-width: 1.2;
}

.chart .line-buy,
.chart .line-rent {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart .line-buy {
  stroke: var(--buy);
}

.chart .line-rent {
  stroke: var(--rent);
}

.chart .series-label {
  font-family: var(--franklin);
  font-size: 12px;
  font-weight: 700;
}

.chart .agi-line {
  stroke: #333;
  stroke-width: 1.4;
  stroke-dasharray: 5 4;
}

.chart .agi-label {
  fill: #333;
  font-family: var(--franklin);
  font-size: 12px;
  font-weight: 700;
}

.chart .void-label {
  fill: var(--secondary);
  font-family: var(--imperial);
  font-size: 13px;
  font-style: italic;
}

.chart .breakeven-dot {
  fill: #fff;
  stroke: #121212;
  stroke-width: 2;
}

.chart .breakeven-label {
  fill: var(--ink);
  font-family: var(--franklin);
  font-size: 12px;
  font-weight: 700;
}

.chart-caption {
  display: -webkit-box;
  max-height: calc(12px * 1.35 * 2);
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--secondary);
  font-family: var(--imperial);
  font-size: 12px;
  font-style: italic;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.readouts {
  margin: 14px 0 0;
  border-top: 1px solid var(--rule);
}

.readout-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--franklin);
  font-size: 12.5px;
  line-height: 1.28;
}

.readout-row dt {
  color: var(--faint);
  font-weight: 500;
}

.readout-row dd {
  margin: 0;
  color: #333;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.readout-row dd.accent {
  color: var(--buy);
}

@media (max-height: 700px) {
  .chart svg {
    max-height: 150px;
    width: auto;
    margin: 0 auto;
  }

  .readout-row {
    padding: 3px 0;
  }
}

/* ---------- below-calculator article sections ---------- */

.calc-rule {
  max-width: var(--article-width);
  margin: 64px 0 22px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

.calc-rule span {
  color: #333;
  font-family: var(--franklin);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
}

.scenarios,
.faq,
.methodology,
.article-footer {
  max-width: var(--article-width);
}

.scenario-list {
  margin-top: 26px;
  border-top: 1px solid var(--rule);
}

.scenario {
  padding: 18px 0;
  border-bottom: 1px solid var(--rule-light);
}

.scenario h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--franklin);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.scenario p {
  margin: 0;
  color: var(--text);
  font-family: var(--imperial);
  font-size: 17px;
  line-height: 1.45;
}

.scenario-verdict {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-family: var(--franklin);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.scenario-verdict.rent {
  color: var(--rent);
}

.scenario-verdict.buy {
  color: var(--buy);
}

.qa {
  border-bottom: 1px solid var(--rule);
}

.qa:first-of-type {
  border-top: 1px solid var(--rule);
}

.qa summary {
  position: relative;
  padding: 16px 30px 16px 0;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-family: var(--franklin);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.qa summary::-webkit-details-marker {
  display: none;
}

.qa summary::after {
  content: "+";
  position: absolute;
  top: 15px;
  right: 2px;
  color: var(--secondary);
  font-family: var(--franklin);
  font-size: 18px;
  font-weight: 500;
}

.qa[open] summary::after {
  content: "-";
}

.qa summary:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.qa-body {
  padding: 0 0 17px;
}

.qa-body p {
  margin: 0;
  color: var(--text);
  font-family: var(--imperial);
  font-size: 17px;
  line-height: 1.45;
}

.qa-body a {
  color: var(--link);
  text-decoration: underline;
}

.methodology .calc-rule {
  margin-top: 58px;
}

.fine-print p {
  margin: 0 0 13px;
  color: var(--text);
  font-family: var(--imperial);
  font-size: 16px;
  line-height: 1.44;
}

.article-footer {
  margin-top: 58px;
  padding-top: 18px;
  border-top: 1px solid var(--rule-light);
  color: var(--secondary);
  text-align: center;
}

.article-footer p {
  margin: 0;
  font-family: var(--franklin);
  font-size: 12px;
  line-height: 1.45;
}

.article-footer .colophon {
  margin-top: 8px;
}

.verdict.settling,
.verdict-sub.settling,
.verdict-box.settling {
  animation: settle 0.28s ease both;
}

@keyframes settle {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

@media (max-width: 1080px) {
  .site-header-inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr);
  }

  .paperclip-link,
  .login-link {
    display: none;
  }

  .nameplate {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    font-size: 24px;
    text-overflow: ellipsis;
  }
}

@media (max-width: 975px) {
  body {
    padding-bottom: 120px;
  }

  main {
    padding: 0 18px 64px;
  }

  .article-head {
    margin-top: 34px;
  }

  h1 {
    font-size: 31px;
    line-height: 1.18;
  }

  .dek,
  .graf {
    font-size: 18px;
  }

  .calc-grid {
    display: block;
  }

  .inputs-heading {
    font-size: 36px;
  }

  .control {
    display: block;
    max-width: none;
  }

  .control-meta,
  .slider-column {
    width: 100%;
    padding-right: 0;
  }

  .control-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(112px, auto);
    column-gap: 18px;
    align-items: start;
  }

  .control-note {
    grid-column: 1 / -1;
  }

  .value-input {
    margin-top: 0;
    text-align: right;
  }

  .slider-column {
    margin-top: 10px;
  }

  .results {
    position: static;
    width: auto;
    max-height: none;
    margin-top: 38px;
    padding-top: 20px;
    overflow: visible;
  }

  /* Mobile option chosen: results stay inline after the controls, while only
     the computed verdict box is promoted into a fixed NYT-style bottom rail. */
  .verdict-rail {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    padding: 5px 10px;
    padding-bottom: calc(5px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #ccc;
    background: #fff;
  }

  .verdict-box {
    margin: 0;
    padding: 10px 5px;
    font-size: 18px;
    font-weight: 400;
    line-height: 22px;
  }

  .verdict-prose {
    margin-top: 0;
  }

  .chart-block {
    max-width: var(--article-width);
  }
}

@media (max-width: 700px) {
  .site-header-inner {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 0 10px;
  }

  .header-left,
  .login-link {
    display: none;
  }

  .nameplate {
    min-width: 0;
    font-size: clamp(20px, 5.4vw, 26px);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-right {
    flex: 0 0 auto;
  }

  .subscribe-link {
    min-height: 26px;
    padding: 0 8px;
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  main {
    padding-right: 14px;
    padding-left: 14px;
  }

  .control-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .value-input {
    width: min(100%, 190px);
    margin-top: 8px;
    text-align: left;
  }

  .scenario h3 {
    display: block;
  }

  .scenario-verdict {
    margin-left: 0;
    margin-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}
