/*
 * Calculator pages use the same quiet editorial frame as the Learn pages.
 *
 * The calculator HTML keeps a small inline fallback for standalone rendering.
 * This file loads last and intentionally owns the final production layout.
 */

body {
  color: var(--ink);
  background: var(--canvas);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.tool-header,
.tool-main,
.tool-footer {
  width: min(var(--page-width), calc(100% - 48px));
  margin-inline: auto;
}

.tool-header {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0;
}

.tool-brand {
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.tool-brand img {
  width: 22px;
  height: 22px;
  border-radius: 5px;
}

.tool-nav {
  display: flex;
  gap: 22px;
  color: #55574f;
  font-size: 0.78rem;
}

.tool-nav a {
  color: inherit;
  text-decoration: none;
}

.tool-nav a:hover {
  color: var(--ink);
}

.tool-main {
  padding: 0 0 104px;
}

.tool-hero {
  display: grid;
  max-width: none;
  grid-template-columns: var(--rail-width) minmax(0, var(--content-width)) 1fr;
  column-gap: var(--grid-gap);
  align-items: start;
  padding: 62px 0 56px;
}

.tool-hero > .tool-eyebrow {
  grid-column: 1;
  grid-row: 1;
  padding-top: 7px;
}

.tool-hero > :not(.tool-eyebrow) {
  grid-column: 2;
}

.tool-eyebrow,
.tool-result-kicker,
.tool-section-label {
  margin: 0;
  color: #6c6e67;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.45;
  text-transform: uppercase;
}

.tool-hero h1 {
  max-width: var(--content-width);
  margin: 0 0 20px;
  font-size: clamp(2.25rem, 3.2vw, 2.5rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.18;
}

.tool-lede {
  max-width: 620px;
  margin: 0;
  color: #55574f;
  font-size: 1rem;
  line-height: 1.62;
}

.tool-card {
  display: grid;
  width: var(--content-width);
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  overflow: visible;
  margin-left: calc(var(--rail-width) + var(--grid-gap));
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tool-form-wrap,
.tool-result {
  padding: 34px 0;
}

.tool-form-wrap {
  max-width: var(--content-width);
}

.tool-form-heading {
  margin: 0 0 8px;
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.28;
}

.tool-form-intro {
  max-width: 580px;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.tool-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 16px;
}

.tool-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.tool-field--wide {
  grid-column: 1 / -1;
}

.tool-field label {
  color: #43453f;
  font-size: 0.82rem;
  font-weight: 600;
}

.tool-field small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.42;
}

.tool-field input,
.tool-field select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: none;
}

.tool-field input:hover,
.tool-field select:hover {
  border-color: #a9aca1;
}

.tool-field input:focus,
.tool-field select:focus {
  border-color: var(--gold-ink);
  outline: 2px solid rgba(245, 183, 0, 0.18);
}

.tool-field [aria-invalid="true"] {
  border-color: var(--danger);
}

.tool-submit {
  width: auto;
  min-height: 40px;
  margin-top: 24px;
  padding: 0.65rem 0.98rem;
  border: 1px solid var(--ink);
  border-radius: 3px;
  font-size: 0.82rem;
  font-weight: 600;
}

.tool-submit:hover {
  background: #393a34;
}

.tool-error {
  margin: 0 0 20px;
  padding: 10px 12px;
  border: 1px solid rgba(185, 55, 36, 0.22);
  border-left: 3px solid var(--danger);
  border-radius: 2px;
  color: var(--danger);
  background: #fff0ed;
  font-size: 0.84rem;
  line-height: 1.45;
}

.tool-result {
  display: flex;
  min-height: 0;
  flex-direction: column;
  justify-content: flex-start;
  margin: 12px 0 0;
  padding: 26px 24px 28px;
  border: 0;
  border-top: 2px solid var(--gold);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
}

.tool-result[data-result-state="ready"] {
  justify-content: flex-start;
}

.tool-result-kicker {
  margin-bottom: 16px;
  color: var(--gold-ink);
}

.tool-empty strong {
  display: block;
  max-width: 460px;
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.tool-empty p {
  max-width: 510px;
  margin: 12px 0 0;
  color: #64665f;
  font-size: 0.9rem;
  line-height: 1.55;
}

.tool-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

.tool-metric {
  display: grid;
  gap: 4px;
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--line-strong);
}

.tool-metric:nth-child(-n + 2) {
  padding-top: 0;
}

.tool-metric span {
  color: #64665f;
  font-size: 0.75rem;
  font-weight: 600;
}

.tool-metric strong {
  font-size: clamp(1.65rem, 2.8vw, 2.15rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.tool-metric small {
  color: #64665f;
  font-size: 0.76rem;
  line-height: 1.42;
}

.tool-formula {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-strong);
}

.tool-formula p,
.tool-assumptions,
.tool-price-source {
  color: #5c5e57;
  font-size: 0.78rem;
  line-height: 1.55;
}

.tool-formula p,
.tool-price-source {
  margin-bottom: 0;
}

.tool-assumptions {
  margin: 14px 0 0;
  padding-left: 18px;
}

.tool-share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 12px;
  margin-top: 18px;
}

.tool-share {
  min-height: 34px;
  border-radius: 3px;
  cursor: pointer;
}

.tool-share-status {
  color: #64665f;
  font-size: 0.76rem;
}

.tool-explain,
.tool-related {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, var(--content-width)) 1fr;
  column-gap: var(--grid-gap);
  padding: 68px 0 0;
  border: 0;
}

.tool-explain .tool-section-label,
.tool-related .tool-section-label {
  grid-column: 1;
  grid-row: 1;
  padding-top: 7px;
}

.tool-explain h2,
.tool-related h2 {
  grid-column: 2;
  margin: 0 0 16px;
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.28;
}

.tool-explain p:not(.tool-section-label),
.tool-links {
  grid-column: 2;
}

.tool-explain p:not(.tool-section-label) {
  max-width: var(--content-width);
  margin: 0;
  color: #55574f;
  font-size: 1rem;
  line-height: 1.68;
}

.tool-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line-strong);
}

.tool-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.8fr);
  gap: 28px;
  align-items: baseline;
  padding: 16px 0 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  text-decoration: none;
}

.tool-link:hover {
  border-color: var(--ink);
}

.tool-link:hover strong {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.tool-link strong {
  font-size: 0.94rem;
  font-weight: 600;
}

.tool-link span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.48;
}

.tool-footer {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.tool-footer nav {
  display: flex;
  gap: 22px;
}

@media (max-width: 1120px) {
  .tool-hero,
  .tool-explain,
  .tool-related {
    grid-template-columns: var(--rail-width) minmax(0, var(--content-width));
  }
}

@media (max-width: 900px) {
  .tool-hero,
  .tool-explain,
  .tool-related {
    display: block;
    max-width: var(--content-width);
    margin-inline: auto;
  }

  .tool-hero > .tool-eyebrow,
  .tool-explain .tool-section-label,
  .tool-related .tool-section-label {
    margin-bottom: 14px;
    padding-top: 0;
  }

  .tool-card {
    width: 100%;
    max-width: var(--content-width);
    margin-inline: auto;
  }
}

@media (max-width: 640px) {
  .tool-header,
  .tool-main,
  .tool-footer {
    width: min(100% - 28px, var(--page-width));
  }

  .tool-header {
    min-height: 52px;
  }

  .tool-nav {
    display: none;
  }

  .tool-hero {
    padding: 46px 0 44px;
  }

  .tool-hero h1 {
    margin-bottom: 16px;
    font-size: clamp(2rem, 10vw, 2.3rem);
    line-height: 1.18;
  }

  .tool-card {
    padding: 0;
  }

  .tool-form-wrap {
    padding: 28px 0 32px;
  }

  .tool-fields,
  .tool-result-grid {
    grid-template-columns: 1fr;
  }

  .tool-field--wide {
    grid-column: auto;
  }

  .tool-result {
    padding: 24px 18px 26px;
  }

  .tool-metric:nth-child(2) {
    padding-top: 14px;
  }

  .tool-explain,
  .tool-related {
    padding-top: 54px;
  }

  .tool-link {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .tool-footer {
    min-height: 96px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
  }
}
