@font-face {
  font-family: "Assistant";
  src: url("/fonts/Assistant-VariableFont_wght.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #8cc540;
  --brand-dark: #5f8a24;
  --teal: #007a9e;
  --teal-soft: #e6f6fb;
  --ink: #2e3233;
  --muted: #5c6366;
  --bg: #f3f6f2;
  --paper: #ffffff;
  --line: #d9e0d4;
  --down: #1f6b2a;
  --down-soft: #e5f5e3;
  --up: #9f1d1d;
  --up-soft: #fdecec;
  --flat: #5c6366;
  --shadow: 0 8px 24px rgba(46, 50, 51, 0.08);
  --header: #1d3a12;
  --radius: 14px;
  --max: 720px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation: none !important;
    transition: none !important;
  }
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Assistant", "Arial Hebrew", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  direction: rtl;
  text-align: right;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--teal);
}

.skip {
  position: absolute;
  right: 12px;
  top: -40px;
  background: var(--header);
  color: #fff;
  padding: 8px 12px;
  z-index: 100;
}
.skip:focus {
  top: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  background: var(--header);
  color: #fff;
  padding: 20px 16px 24px;
  border-bottom: 6px solid var(--brand);
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.brand {
  display: block;
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  flex: none;
}

.brand img {
  display: block;
  width: 168px;
  height: auto;
}

.header-text {
  flex: 1;
  min-width: 200px;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: #e5f5e3;
}

.site-header h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.asof {
  margin: 6px 0 0;
  font-size: 14px;
  color: #dce8d4;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.guide {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 15px;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 14px 12px 16px;
  text-align: right;
  cursor: pointer;
  box-shadow: var(--shadow);
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.card:hover,
.card:focus-visible {
  border-color: var(--brand-dark);
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.card[aria-pressed="true"] {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(0, 122, 158, 0.25), var(--shadow);
}

.card .kicker {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.card .name {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.3;
}

.card .value {
  font-size: 1.55rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.card .value.down {
  color: var(--down);
}
.card .value.up {
  color: var(--up);
}
.card .value.flat {
  color: var(--flat);
}

.card .extra,
.card .when {
  font-size: 13px;
  color: var(--muted);
}

.card .period {
  font-size: 12px;
  color: var(--muted);
}

.calc-open {
  width: 100%;
  margin: 16px 0 0;
  appearance: none;
  border: 0;
  cursor: pointer;
  background: var(--teal);
  color: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: var(--shadow);
  text-align: right;
}

.calc-open:hover,
.calc-open:focus-visible {
  background: #006280;
  outline: 2px solid var(--header);
  outline-offset: 2px;
}

.calc-open-kicker {
  font-size: 12px;
  font-weight: 650;
  opacity: 0.9;
}

.panel {
  margin-top: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.panel-meta,
.panel-next,
.panel-source,
.chart-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.icon-btn:focus-visible,
.icon-btn:hover {
  border-color: var(--teal);
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.chart-wrap {
  margin-top: 12px;
}

.chart {
  width: 100%;
  height: auto;
  display: block;
  background: linear-gradient(#f8faf6, #fff);
  border-radius: 10px;
}

.insights {
  margin-top: 28px;
}

.insights h2,
.explain h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
}

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

.insights li {
  background: var(--paper);
  border-radius: var(--radius);
  border-right: 5px solid var(--brand);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.insights li h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.insights li p {
  margin: 0;
  color: var(--muted);
}

.refinance {
  margin-top: 20px;
  text-align: center;
}

.refinance-btn {
  display: inline-block;
  background: var(--header);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  padding: 12px 22px;
  border-radius: 999px;
}

.refinance-btn:hover,
.refinance-btn:focus-visible {
  background: var(--brand-dark);
  outline: 2px solid var(--header);
  outline-offset: 3px;
}

.placeholder-note {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.explain {
  margin-top: 28px;
}

.ex {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  margin-bottom: 8px;
}

.ex summary {
  cursor: pointer;
  font-weight: 800;
  padding: 12px 0;
}

.ex .exb {
  padding: 0 0 14px;
  color: var(--muted);
}

.ex .exb p {
  margin: 0 0 8px;
}

.formula {
  background: var(--teal-soft);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  font-weight: 700;
  margin: 8px 0;
}

.site-footer {
  background: #16260e;
  color: #dce8d4;
  padding: 24px 16px 32px;
}

.site-footer a {
  color: #fff;
}

.disclaimer,
.footer-meta {
  max-width: var(--max);
  margin: 0 auto 12px;
  font-size: 14px;
}

.footer-meta {
  margin-bottom: 0;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet[hidden] {
  display: none !important;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 38, 14, 0.5);
}

.sheet-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow: auto;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(22, 38, 14, 0.2);
}

.calc-form {
  display: grid;
  gap: 14px;
}

.field label,
fieldset legend {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.field input {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.field input:focus {
  outline: 2px solid var(--teal);
  border-color: var(--teal);
}

.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.seg button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 4px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.seg button[aria-checked="true"] {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.calc-res {
  display: grid;
  gap: 8px;
}

.calc-res > div {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.calc-res .big {
  background: var(--teal-soft);
  font-size: 1.15rem;
  font-weight: 800;
}

.calc-res .big.down {
  background: var(--down-soft);
  color: var(--down);
}
.calc-res .big.up {
  background: var(--up-soft);
  color: var(--up);
}

.calc-hint,
.rule {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.status {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  max-width: 720px;
  margin: 0 auto;
  background: var(--header);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  z-index: 30;
}

@media (min-width: 700px) {
  .cards {
    grid-template-columns: repeat(4, 1fr);
  }
  .sheet {
    align-items: center;
    padding: 24px;
  }
  .sheet-card {
    border-radius: 16px;
    max-height: 85vh;
  }
  .brand img {
    width: 200px;
  }
}

.card .kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge {
  display: inline-block;
  background: #fff4d6;
  color: #6b4b00;
  border: 1px solid #e6c56e;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
}

.badge.quiet {
  background: var(--teal-soft);
  color: var(--teal);
  border-color: #b5d8e6;
}

.formula-note {
  display: block;
  font-weight: 650;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.cbs-credit {
  max-width: var(--max);
  margin: 0 auto 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #c5d4b8;
  overflow-wrap: anywhere;
}

/* Source attribution next to every data item */
.card-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.card-item .card {
  flex: 1;
}
.src {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}
.card-item .src {
  padding: 0 4px;
}
.src a {
  color: inherit;
  text-decoration: underline;
}
.panel-source .src + .src,
.insights li .src {
  margin-top: 4px;
}
.data-note {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.calc-source {
  margin-top: 6px;
}
