/* ==========================================================================
   Range & Reason — shared stylesheet
   Design direction: precision instrument. Tick marks, gradations, brass
   needle readouts. Every number is shown in the context of its range.
   ========================================================================== */

:root {
  --ink:        #16211F;
  --ink-2:      #3D4C48;
  --ink-3:      #6B7A75;
  --paper:      #EDEFE9;
  --panel:      #FFFFFF;
  --rule:       #C9CFC4;
  --rule-soft:  #DFE3DA;

  --moss:       #4A7A6B;
  --moss-deep:  #2F5347;
  --brass:      #B07C1E;

  --band-1:     #CBD7CF;
  --band-2:     #8FB2A1;
  --band-3:     #5C8C79;
  --band-4:     #D3B269;
  --band-5:     #C4795A;

  --shadow:     0 1px 2px rgba(22,33,31,.06), 0 8px 24px -16px rgba(22,33,31,.28);

  --measure:    68ch;
  --radius:     3px;

  --display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body:    "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}

/* --- tick rule motif -------------------------------------------------- */
.ticks {
  height: 9px;
  background-image: repeating-linear-gradient(
    to right,
    var(--rule) 0 1px,
    transparent 1px 8px
  );
  background-position: bottom;
  background-repeat: repeat-x;
  border-bottom: 1px solid var(--rule);
}

/* --- layout ----------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 20px;
}

.stack > * + * { margin-top: 1em; }

/* --- masthead --------------------------------------------------------- */
.masthead {
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 66px;
  flex-wrap: wrap;
}
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding-block: 12px;
}
.wordmark span {
  font-family: var(--mono);
  font-size: .6875rem;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brass);
}
.nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding-block: 8px;
}
.nav a {
  font-family: var(--display);
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  padding-block: 4px;
  border-bottom: 2px solid transparent;
}
.nav a:hover,
.nav a[aria-current="page"] { color: var(--moss-deep); border-bottom-color: var(--brass); }

@media (max-width: 620px) {
  .masthead__inner { min-height: 0; gap: 4px; padding-block: 8px 4px; }
  .wordmark { padding-block: 6px; }
  .nav { gap: 6px 14px; padding-block: 0 6px; }
  .nav a { font-size: .8125rem; }
  .pagehead { padding-block: 30px 22px; }
}

/* --- page head -------------------------------------------------------- */
.pagehead { padding-block: 44px 28px; }
.eyebrow {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 14px;
}
h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 5.2vw, 3.125rem);
  line-height: 1.04;
  letter-spacing: -0.033em;
  margin: 0 0 .5em;
  max-width: 20ch;
}
.lede {
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 58ch;
  margin: 0;
}

/* --- the instrument (calculator shell) -------------------------------- */
.instrument {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  overflow: hidden;
  margin-bottom: 40px;
}
@media (max-width: 800px) {
  .instrument { grid-template-columns: 1fr; }
}

.controls { padding: 26px 26px 30px; border-right: 1px solid var(--rule-soft); }
@media (max-width: 800px) {
  .controls { border-right: 0; border-bottom: 1px solid var(--rule-soft); }
}
.readout  { padding: 26px 26px 30px; background: linear-gradient(180deg,#FAFBF8,#F4F6F1); }

.panel-label {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule-soft);
}

/* --- form controls ---------------------------------------------------- */
.field { margin-bottom: 18px; }
.field > label,
.fieldset > legend {
  display: block;
  font-family: var(--display);
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .005em;
  color: var(--ink-2);
  margin-bottom: 7px;
  padding: 0;
}
.hint {
  font-family: var(--display);
  font-size: .75rem;
  color: var(--ink-3);
  margin: 6px 0 0;
  line-height: 1.45;
}

input[type="number"],
input[type="time"],
select {
  width: 100%;
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='11' height='7' viewBox='0 0 11 7' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%236B7A75' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

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

/* segmented toggle — reads like a switch on an instrument */
.seg { display: flex; position: relative; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  flex: 1;
  text-align: center;
  font-family: var(--display);
  font-size: .8125rem;
  font-weight: 500;
  padding: 9px 6px;
  cursor: pointer;
  color: var(--ink-2);
  background: var(--panel);
  border-right: 1px solid var(--rule);
  margin: 0;
}
.seg label:last-of-type { border-right: 0; }
.seg input:checked + label { background: var(--moss-deep); color: #fff; }
.seg input:focus-visible + label { outline: 2px solid var(--brass); outline-offset: -2px; }

.fieldset { border: 0; padding: 0; margin: 0 0 18px; }

/* --- readout ---------------------------------------------------------- */
.value {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(2.75rem, 8vw, 4rem);
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--ink);
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.value .unit {
  font-size: .9375rem;
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--ink-3);
}
.verdict {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  margin: 14px 0 0;
}
.verdict-note {
  font-size: .9375rem;
  color: var(--ink-2);
  margin: 6px 0 0;
  max-width: 44ch;
}

/* --- SIGNATURE: the gauge -------------------------------------------- */
.gauge { margin: 26px 0 0; }
.gauge__track {
  position: relative;
  height: 26px;
  display: flex;
  border: 1px solid var(--rule);
  /* deliberately not clipped: the needle's marker sits outside the track */
}
.gauge__band { height: 100%; }
.gauge__ticks {
  height: 7px;
  margin-top: 2px;
  background-image: repeating-linear-gradient(to right, var(--rule) 0 1px, transparent 1px 10%);
}
.gauge__needle {
  position: absolute;
  top: -7px;
  bottom: -7px;
  width: 2px;
  background: var(--ink);
  transform: translateX(-1px);
  transition: left .42s cubic-bezier(.22,1,.36,1);
  z-index: 2;
}
.gauge__needle::before {
  content: "";
  position: absolute;
  top: -4px; left: 50%;
  width: 9px; height: 9px;
  background: var(--brass);
  transform: translateX(-50%) rotate(45deg);
}
.gauge__scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: .6875rem;
  color: var(--ink-3);
  margin-top: 7px;
}
.gauge__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 14px;
  padding: 0;
  list-style: none;
  font-family: var(--display);
  font-size: .75rem;
  color: var(--ink-2);
}
.gauge__legend li { display: flex; align-items: center; gap: 7px; }
.gauge__legend i {
  width: 11px; height: 11px;
  border-radius: 2px;
  display: inline-block;
  flex: none;
}
.gauge__legend b { font-weight: 700; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .gauge__needle { transition: none; }
  html { scroll-behavior: auto; }
}

/* --- secondary readout rows ------------------------------------------ */
.rows { margin: 24px 0 0; border-top: 1px solid var(--rule-soft); }
.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.row dt {
  font-family: var(--display);
  font-size: .8125rem;
  font-weight: 500;
  color: var(--ink-2);
  margin: 0;
}
.row dd {
  font-family: var(--mono);
  font-size: 1rem;
  margin: 0;
  color: var(--ink);
  text-align: right;
}
.row small {
  display: block;
  font-family: var(--display);
  font-size: .6875rem;
  color: var(--ink-3);
}

/* --- article ---------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) 300px;
  gap: 48px;
  align-items: start;
  padding-bottom: 56px;
}
@media (max-width: 940px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}

.article { max-width: var(--measure); min-width: 0; }
.article h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 2.2em 0 .55em;
  padding-top: .9em;
  border-top: 1px solid var(--rule);
}
.article h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  margin: 1.7em 0 .4em;
}
.article p { margin: 0 0 1.1em; }
.article ul, .article ol { margin: 0 0 1.2em; padding-left: 1.3em; }
.article li { margin-bottom: .45em; }
.article a { color: var(--moss-deep); text-underline-offset: 2px; }

.datatable {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.4em;
  font-size: .9375rem;
}
.datatable th,
.datatable td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--rule-soft);
}
.datatable th {
  font-family: var(--display);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom-color: var(--rule);
}
.datatable td:last-child,
.datatable th:last-child { font-family: var(--mono); }

/* A three-column table can have a min-content width wider than a small phone.
   Let it scroll inside its own box rather than dragging the page with it. */
@media (max-width: 620px) {
  .datatable {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .datatable th,
  .datatable td { padding: 8px 9px; }
}

.callout {
  border-left: 3px solid var(--brass);
  background: #FBF8F0;
  padding: 16px 18px;
  margin: 0 0 1.4em;
  font-size: .9375rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { font-family: var(--display); }

/* --- ad slots --------------------------------------------------------- */
.adslot {
  margin: 32px 0;
  padding: 10px 0;
  text-align: center;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border-block: 1px solid var(--rule-soft);
  color: var(--ink-3);
}
.adslot::before {
  content: "Advertisement";
  font-family: var(--mono);
  font-size: .625rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.adslot--rail { border: 1px dashed var(--rule); border-radius: var(--radius); min-height: 600px; margin: 0; }
.rail { position: sticky; top: 24px; }
@media (max-width: 940px) { .rail { position: static; } }

/* --- calculator index cards ------------------------------------------ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 40px;
}
.card {
  background: var(--panel);
  padding: 24px 22px 26px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background .16s ease;
}
.card:hover { background: #F7F9F5; }
.card__no {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  color: var(--brass);
}
.card h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.018em;
  margin: 0;
}
.card p { margin: 0; font-size: .9375rem; color: var(--ink-2); }
.card__go {
  margin-top: auto;
  padding-top: 12px;
  font-family: var(--display);
  font-size: .8125rem;
  font-weight: 500;
  color: var(--moss-deep);
}

/* --- footer ----------------------------------------------------------- */
.footer {
  background: var(--ink);
  color: #C3CCC8;
  padding: 40px 0 48px;
  font-size: .875rem;
}
.footer a { color: #E4EAE7; }
.footer .wordmark { color: #fff; }
.footer__grid {
  display: grid;
  grid-template-columns: minmax(0,1.4fr) repeat(2, minmax(0,1fr));
  gap: 32px;
}
@media (max-width: 700px) { .footer__grid { grid-template-columns: 1fr; } }
.footer h3 {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #8C9A95;
  margin: 0 0 12px;
  font-weight: 400;
}
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 7px; }
.disclaimer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #2C3B37;
  font-size: .8125rem;
  color: #94A29D;
  max-width: 72ch;
}

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