/* HonestSums site styles. One stylesheet, no external fonts.
   Look follows the spreadsheets: navy and teal, light grey page,
   yellow = what you type, white = worked out, green = the answer. */

:root {
  --navy: #1F3A5F;
  --navy-dark: #162B47;
  --teal: #2A7F7F;
  --teal-dark: #1F6363;
  --page: #F4F6F9;
  --card: #FFFFFF;
  --band: #E8ECF4;
  --line: #CDD5E0;
  --text: #1C2430;
  --muted: #4F5B6B;
  --input-fill: #FFF6CC;
  --input-line: #C9B456;
  --input-text: #0B3A8C;
  --result-fill: #E3F2E7;
  --result-line: #9CCBAA;
  --error: #A4161A;
  --focus: #D98E04;
  --radius: 8px;
  --font: Arial, "Helvetica Neue", Helvetica, system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  border-top: 8px solid var(--navy);
}

img, svg { max-width: 100%; height: auto; }

a { color: var(--navy); text-underline-offset: 2px; }
a:hover { color: var(--teal-dark); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  background: var(--navy);
  color: #fff;
  padding: 8px 14px;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 10;
}
.skip-link:focus { top: 0; color: #fff; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------------------------------------------------------------- header */
.site-header { padding: 18px 0 8px; }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-weight: 700;
  font-size: 1.5rem;
  text-decoration: none;
}
.brand svg { width: 34px; height: 34px; flex: none; }
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.98rem;
  padding: 6px 0;
  display: inline-block;
}
.site-nav a:hover { color: var(--navy); text-decoration: underline; }
.site-nav a[aria-current="page"] {
  color: var(--navy);
  font-weight: 700;
  border-bottom: 3px solid var(--teal);
}

/* ---------------------------------------------------------------- type */
main { padding: 12px 0 40px; }
h1 {
  color: var(--navy);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.15;
  margin: 18px 0 10px;
}
h2 { color: var(--navy); font-size: 1.45rem; margin: 36px 0 10px; line-height: 1.25; }
h3 { color: var(--navy); font-size: 1.12rem; margin: 22px 0 6px; }
.lede { font-size: 1.2rem; color: var(--muted); margin: 0 0 18px; max-width: 46em; }
.prose { max-width: 46em; }
.prose p, .prose li { margin: 0 0 12px; }
.small { font-size: 0.92rem; color: var(--muted); }

/* ---------------------------------------------------------------- tags line */
.strap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.95rem;
}
.strap li + li::before { content: "|"; margin-right: 14px; color: var(--line); }

/* ---------------------------------------------------------------- cards and grids */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(31, 58, 95, 0.08);
}
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.tool-card { display: flex; flex-direction: column; }
.tool-card h3 { margin-top: 0; font-size: 1.2rem; }
.tool-card p { margin: 0 0 14px; flex: 1; }
.product-card h3, .product-card h4 { color: var(--navy); margin: 0 0 6px; font-size: 1.02rem; }
#spreadsheets h3 { margin: 28px 0 12px; }
.product-card p { margin: 0 0 12px; font-size: 0.97rem; color: var(--muted); flex: 1; }
.product-card { display: flex; flex-direction: column; }

/* The yellow / white / green cell motif, used as a small mark on cards. */
.cells {
  display: grid;
  gap: 4px;
  width: 42px;
  margin-bottom: 12px;
}
.cells span { display: block; height: 9px; border-radius: 3px; border: 1px solid var(--line); }
.cells span:nth-child(1) { background: var(--input-fill); border-color: var(--input-line); }
.cells span:nth-child(2) { background: #fff; }
.cells span:nth-child(3) { background: var(--result-fill); border-color: var(--result-line); }

/* ---------------------------------------------------------------- buttons */
.button {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}
.button:hover { background: var(--teal-dark); color: #fff; }
.button.secondary { background: var(--navy); }
.button.secondary:hover { background: var(--navy-dark); }
.button.ghost {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
  padding: 9px 16px;
}
.button.ghost:hover { background: var(--navy); color: #fff; }
.text-link { font-weight: 700; }

/* ---------------------------------------------------------------- calculator layout */
.calc {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}
.panel-head {
  background: var(--band);
  color: var(--navy);
  font-weight: 700;
  font-size: 1.1rem;
  margin: -20px -20px 16px;
  padding: 10px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.field { margin: 0 0 16px; }
.field > label,
.field > .label,
fieldset legend {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
  padding: 0;
}
.hint { display: block; font-size: 0.92rem; color: var(--muted); margin: 0 0 6px; }
fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }

input[type="text"],
select {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 10px 12px;
  border: 1px solid var(--input-line);
  border-radius: 6px;
  background: var(--input-fill);
  color: var(--input-text);
  min-height: 46px;
}
input[type="text"] { text-align: right; font-variant-numeric: tabular-nums; }
input[aria-invalid="true"] { border: 2px solid var(--error); }

.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-fields .field { margin-bottom: 0; }

.check, .radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 10px;
  font-weight: 400;
  cursor: pointer;
}
.check input, .radio input {
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--teal);
}

.error { color: var(--error); font-size: 0.93rem; font-weight: 700; margin: 4px 0 0; }

.calc-submit { margin-top: 4px; }

/* Results */
.headline {
  background: var(--result-fill);
  border: 1px solid var(--result-line);
  border-radius: 6px;
  padding: 14px 16px;
  margin: 0 0 16px;
}
.headline .big {
  display: block;
  font-size: clamp(1.7rem, 6vw, 2.2rem);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.headline .sub { color: var(--muted); font-size: 0.97rem; }

.is-stale .headline,
.is-stale table { opacity: 0.45; }

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
caption { text-align: left; font-weight: 700; color: var(--navy); padding: 0 0 6px; }
th, td { padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--band); color: var(--navy); font-size: 0.95rem; text-align: right; }
thead th:first-child { text-align: left; }
tbody th { text-align: left; font-weight: 400; }
td { text-align: right; white-space: nowrap; }
tr.total th, tr.total td {
  font-weight: 700;
  background: var(--result-fill);
  border-bottom: 2px solid var(--result-line);
}
.result-list { margin: 0; }
.result-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.result-list dt { margin: 0; }
.result-list dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.result-list div.key dd { color: var(--navy); }
.result-list div.key { background: var(--result-fill); padding: 8px; border-bottom-color: var(--result-line); }

.note {
  background: #FFF8E0;
  border-left: 4px solid var(--focus);
  padding: 10px 14px;
  margin: 14px 0 0;
  font-size: 0.97rem;
}

.disclaimer {
  margin: 16px 0 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--page);
  font-size: 0.95rem;
}
.disclaimer strong { color: var(--navy); }

/* Call to action band */
.cta {
  margin: 32px 0 0;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
}
.cta h2 { color: #fff; margin-top: 0; }
.cta p { margin: 0 0 14px; max-width: 46em; }
.cta ul { margin: 0 0 18px; padding-left: 1.2em; }
.cta li { margin-bottom: 4px; }
.cta .button { background: #fff; color: var(--navy); }
.cta .button:hover { background: var(--input-fill); color: var(--navy); }
.cta .actions { display: flex; flex-wrap: wrap; gap: 12px; }
/* Space between a button row and whatever follows it (another offer or a note). */
.cta .actions + *, .cta [data-product-card] + * { margin-top: 18px; }
.cta a:not(.button) { color: #fff; }

/* ---------------------------------------------------------------- hero (home) */
.hero { padding: 6px 0 4px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 34px;
  color: var(--muted);
  font-size: 0.93rem;
}
.site-footer ul {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--navy); }
.site-footer p { margin: 0 0 6px; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 760px) {
  body { font-size: 1rem; }
  .calc { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .panel-head { margin: -16px -16px 14px; padding: 10px 16px; }
  th, td { padding: 7px 4px; }
  .cta { padding: 18px; }
  .cta .button, .hero .button { width: 100%; }
}

@media (max-width: 400px) {
  .inline-fields { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .inline-fields .field { margin-bottom: 16px; }
  td { white-space: normal; }
  .strap li + li::before { content: none; }
  table { font-size: 0.9rem; }
  th, td { padding: 7px 3px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  body { border-top: 0; background: #fff; }
  .site-nav, .cta, .skip-link, .calc-submit { display: none; }
}
