/**
 * @file
 * Tuition Support theme.
 *
 * The estimator is the reason this site exists, and people fill it in with a
 * paper tax return beside them. So the pages are built as a worksheet: income
 * tax line numbers in a gutter to match against the printed return, ruled
 * rows, figures in tabular numerals, and a result that shows its arithmetic
 * instead of hiding it.
 */

:root {
  /* Carried over from the previous genesis_education theme, extended into one
     hue family so the dark text relates to the brand rather than being a
     neutral grey. */
  --ts-ink: #1b2a2e;
  --ts-ink-soft: #46585c;
  --ts-teal: #356067;
  --ts-teal-deep: #24454a;
  --ts-blue: #006699;
  --ts-red: #c00000;
  --ts-paper: #f3f6f6;
  --ts-white: #fff;
  --ts-rule: #c9d6d8;
  --ts-rule-soft: #e3eaeb;

  /* 1.125 at the small end, widening to 1.333 for headings. */
  --ts-step--1: 0.875rem;
  --ts-step-0: 1.0625rem;
  --ts-step-1: 1.1875rem;
  --ts-step-2: 1.5rem;
  --ts-step-3: 2rem;
  --ts-step-4: 2.625rem;

  --ts-measure: 66ch;
  --ts-gutter: 1.25rem;

  /* No webfonts: a government site should not make third party requests for
     type, and rural connections should not wait on them. */
  --ts-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--ts-paper);
  color: var(--ts-ink);
  font-family: var(--ts-sans);
  font-size: var(--ts-step-0);
  line-height: 1.6;
}

/* Figures line up in columns wherever they appear. */
input[type="number"],
.ts-figure,
.ts-worksheet td,
.ts-result__row-value,
.ts-result__amount {
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--ts-blue);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--ts-teal-deep);
}

:focus-visible {
  outline: 3px solid var(--ts-blue);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  color: var(--ts-teal-deep);
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  margin: 0 0 0.25em;
  font-size: var(--ts-step-4);
  font-weight: 650;
  letter-spacing: -0.02em;
}

h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: var(--ts-step-2);
  font-weight: 620;
  letter-spacing: -0.01em;
}

h3 {
  margin: 2rem 0 0.5rem;
  font-size: var(--ts-step-1);
  font-weight: 620;
}

p,
li {
  max-width: var(--ts-measure);
}

/* Layout -------------------------------------------------------------- */

.ts-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.ts-width {
  width: 100%;
  max-width: 54rem;
  margin-inline: auto;
  padding-inline: var(--ts-gutter);
}

.ts-skip {
  position: absolute;
  left: -100vw;
}

.ts-skip:focus {
  position: static;
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--ts-white);
  color: var(--ts-blue);
}

/* Header -------------------------------------------------------------- */

.ts-header {
  border-bottom: 3px solid var(--ts-teal);
  background: var(--ts-white);
}

.ts-header__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  padding-block: 1rem;
}

.ts-header__name {
  margin: 0;
  color: var(--ts-teal-deep);
  font-size: var(--ts-step-1);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.ts-header__name a {
  color: inherit;
  text-decoration: none;
}

.ts-header__name a:hover {
  text-decoration: underline;
}

.ts-header__dept {
  display: block;
  color: var(--ts-ink-soft);
  font-size: var(--ts-step--1);
  font-weight: 400;
  letter-spacing: 0;
}

/* Eleven links with long titles: a wrapping row of pills on wide screens,
   a plain stacked list on a phone. */
.ts-nav {
  border-top: 1px solid var(--ts-rule-soft);
  background: var(--ts-white);
}

.ts-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin: 0;
  padding: 0.5rem 0 0.75rem;
  list-style: none;
}

.ts-nav li {
  max-width: none;
}

.ts-nav a {
  display: block;
  padding: 0.3rem 0;
  font-size: var(--ts-step--1);
  text-decoration: none;
}

.ts-nav a:hover,
.ts-nav a:focus-visible {
  text-decoration: underline;
}

.ts-nav a.is-active {
  color: var(--ts-teal-deep);
  font-weight: 650;
}

@media (max-width: 40rem) {
  .ts-nav ul {
    display: block;
  }

  .ts-nav li + li {
    border-top: 1px solid var(--ts-rule-soft);
  }

  .ts-nav a {
    padding: 0.55rem 0;
  }
}

/* Main ---------------------------------------------------------------- */

.ts-main {
  flex: 1 0 auto;
  padding-block: 2.5rem 4rem;
}

.ts-main > .ts-width > * + * {
  margin-top: 1rem;
}

/* The opening line of a page, set slightly larger. Scoped to the intro so it
   cannot catch the first paragraph of some later block. */
.estimator-intro > p:first-of-type {
  font-size: var(--ts-step-1);
}

/* Footer -------------------------------------------------------------- */

.ts-footer {
  border-top: 1px solid var(--ts-rule);
  background: var(--ts-white);
  color: var(--ts-ink-soft);
  font-size: var(--ts-step--1);
}

.ts-footer__inner {
  padding-block: 1.5rem 2.5rem;
}

.ts-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

/* Estimator worksheet -------------------------------------------------- */

.tuition-estimator {
  margin-top: 2rem;
}

.tuition-estimator fieldset {
  margin: 0 0 2.5rem;
  padding: 0;
  border: 0;
}

.tuition-estimator legend {
  display: block;
  width: 100%;
  margin-bottom: 0.25rem;
  padding: 0;
  color: var(--ts-teal-deep);
  font-size: var(--ts-step-2);
  font-weight: 620;
  letter-spacing: -0.01em;
}

.tuition-estimator .description,
.tuition-estimator .form-item__description {
  max-width: var(--ts-measure);
  margin-bottom: 1rem;
  color: var(--ts-ink-soft);
  font-size: var(--ts-step--1);
}

/* The ruled grid: line number gutter, label, then one column per parent. */
.ts-worksheet {
  border-top: 2px solid var(--ts-teal);
}

.ts-worksheet__head,
.ts-worksheet__row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) 7.5rem 7.5rem;
  gap: 0 1rem;
  align-items: center;
}

.ts-worksheet__head {
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--ts-rule);
  color: var(--ts-ink-soft);
  font-size: var(--ts-step--1);
}

.ts-worksheet__head span:nth-child(n+3) {
  text-align: right;
  font-weight: 620;
  color: var(--ts-ink);
}

.ts-worksheet__row {
  padding-block: 0.4rem;
  border-bottom: 1px solid var(--ts-rule-soft);
}

.ts-worksheet__row:hover {
  background: var(--ts-white);
}

.ts-worksheet__line {
  color: var(--ts-teal);
  font-size: var(--ts-step--1);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.ts-worksheet__label {
  padding-right: 0.5rem;
}

.tuition-estimator .ts-worksheet__row .form-item {
  margin: 0;
}

.tuition-estimator input[type="number"] {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--ts-rule);
  border-radius: 2px;
  background: var(--ts-white);
  color: inherit;
  font: inherit;
  text-align: right;
}

.tuition-estimator input[type="number"]:focus {
  border-color: var(--ts-blue);
}

/* The parent marker only earns its space once the columns stack. */
.ts-cell-label {
  display: none;
  color: var(--ts-ink-soft);
  font-size: var(--ts-step--1);
}

/* Tuition and household size sit outside the grid. */
.tuition-estimator .form-item-tuition input {
  max-width: 12rem;
}

.tuition-estimator .form-radios {
  display: grid;
  gap: 0.25rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.tuition-estimator .form-type-radio {
  margin: 0;
}

.tuition-estimator .form-type-radio label {
  font-variant-numeric: tabular-nums;
}

.tuition-estimator .form-actions {
  margin-block: 2rem;
}

.tuition-estimator input[type="submit"] {
  padding: 0.65rem 1.75rem;
  border: 0;
  border-radius: 2px;
  background: var(--ts-teal);
  color: var(--ts-white);
  font: inherit;
  font-weight: 620;
  cursor: pointer;
}

.tuition-estimator input[type="submit"]:hover {
  background: var(--ts-teal-deep);
}

/* Intro --------------------------------------------------------------- */

.estimator-intro ul {
  max-width: var(--ts-measure);
  padding-left: 1.1rem;
}

.estimator-schools {
  font-variant-numeric: tabular-nums;
}

/* Result: the one place the page raises its voice ---------------------- */

.estimator-result {
  margin-top: 3rem;
  padding: 1.75rem 0 0;
  border-top: 3px solid var(--ts-teal);
}

.estimator-result h2 {
  margin-top: 0;
}

.estimator-result__table {
  width: 100%;
  max-width: 30rem;
  border-collapse: collapse;
}

.estimator-result__table caption {
  margin-bottom: 0.5rem;
  color: var(--ts-ink-soft);
  font-size: var(--ts-step--1);
  text-align: left;
}

.estimator-result__table th,
.estimator-result__table td {
  padding: 0.35rem 0;
  font-weight: 400;
  text-align: left;
}

.estimator-result__table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* The running total, as on a paper worksheet. */
.estimator-result__subtotal th,
.estimator-result__subtotal td {
  border-top: 1px solid var(--ts-ink);
  font-weight: 620;
}

.estimator-result__total {
  margin: 2rem 0 1.5rem;
  color: var(--ts-teal-deep);
}

.estimator-result__total strong {
  display: block;
  font-size: var(--ts-step-4);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.estimator-result__max {
  display: block;
  margin-top: 0.35rem;
  color: var(--ts-ink-soft);
  font-size: var(--ts-step--1);
}

.estimator-result__disclaimer {
  max-width: var(--ts-measure);
  margin: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--ts-rule);
  color: var(--ts-ink-soft);
  font-size: var(--ts-step--1);
}

/* Errors -------------------------------------------------------------- */

.messages--error {
  border-left: 4px solid var(--ts-red);
  background: var(--ts-white);
  color: var(--ts-ink);
}

.form-item--error-message,
.messages--error a {
  color: var(--ts-red);
}

input.error {
  border-color: var(--ts-red);
  border-width: 2px;
}

/* Narrow screens: 58 inputs cannot sit in two columns on a phone, so each
   row becomes a stacked pair with its own parent marker. ---------------- */

@media (max-width: 40rem) {
  :root {
    --ts-step-4: 2rem;
    --ts-step-3: 1.625rem;
  }

  .ts-worksheet__head {
    display: none;
  }

  .ts-worksheet__row {
    grid-template-columns: 4.5rem minmax(0, 1fr);
    padding-block: 0.75rem;
  }

  .ts-worksheet__label {
    font-weight: 620;
  }

  .ts-worksheet__row .ts-worksheet__cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    grid-column: 2;
  }

  .ts-cell-label {
    display: inline;
    flex: 0 0 4.5rem;
  }

  .ts-worksheet__row input[type="number"] {
    max-width: 8rem;
  }
}

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

/* Content tables ------------------------------------------------------- */

/* Tables come from the old site's pages, so they are styled here rather than
   in the markup. Semantics are kept; only the sizing is the theme's. */
.ts-main table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  table-layout: auto;
}

.ts-main table caption {
  margin-bottom: 0.5rem;
  color: var(--ts-teal-deep);
  font-weight: 620;
  text-align: left;
}

.ts-main th,
.ts-main td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--ts-rule-soft);
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
}

.ts-main thead th,
.ts-main table tr:first-child th {
  border-bottom: 1px solid var(--ts-rule);
}

.ts-main table ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* Images in content never push the page sideways. */
.ts-main img {
  max-width: 100%;
  height: auto;
}
