:root {
  --ink: #1a1a1a;
  --muted: #666;
  --line: #e1e5e9;
  --line-strong: #cbd3d9;
  --soft: #f7f7f5;
  --soft-blue: #f2f7fa;
  --green: #2f6250;
  --green-light: #d7e5da;
  --blue: #315d78;
  --orange: #a76332;
  --white: #fff;
  --focus-left: 27%;
  --focus-width: 48%;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--white);
  color: var(--ink);
  font-family: Roboto, Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"],
input[type="radio"] {
  cursor: pointer;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  white-space: nowrap !important;
}

.site-header {
  border-bottom: 1px solid #e8eaed;
  background: var(--white);
  box-shadow: 0 4px 18px rgba(20, 28, 38, .05);
}

.header-inner,
.footer-inner,
.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: flex;
  width: 188px;
  height: 58px;
  align-items: center;
}

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

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.site-nav a {
  color: #16191d;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--blue);
}

.page-shell {
  padding: 22px 0 64px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 24px;
  color: #6b6b6b;
  font-size: 12px;
}

.breadcrumbs a {
  color: #555;
  text-decoration: none;
}

.page-intro {
  max-width: 820px;
  margin-bottom: 24px;
}

.eyebrow,
.panel-label {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.page-intro h1 {
  margin: 7px 0 10px;
  color: var(--ink);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.08;
}

.page-intro > p:last-child {
  max-width: 740px;
  margin: 0;
  color: #555;
  font-size: 18px;
}

.calculator {
  display: grid;
  grid-template-columns: minmax(310px, 390px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 18px 44px rgba(20, 28, 38, .07);
}

.controls,
.results {
  min-width: 0;
  padding: 24px;
}

.controls {
  border-right: 1px solid var(--line);
  background: var(--soft);
}

.controls-head,
.results-head,
.field-label-row,
.form-actions,
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.unit-toggle {
  display: flex;
  flex: 0 0 auto;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0;
  background: var(--white);
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  margin: 18px 0 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0;
  background: var(--white);
}

.mode-toggle label {
  position: relative;
}

.mode-toggle label + label {
  border-left: 1px solid var(--line-strong);
}

.mode-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-toggle span {
  display: block;
  min-height: 38px;
  padding: 8px 12px;
  color: #4f5961;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.mode-toggle input:checked + span {
  background: var(--green);
  color: var(--white);
}

.mode-toggle input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.quick-result {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  border-left: 3px solid var(--green);
  padding: 8px 11px;
  background: var(--white);
}

.quick-result span,
.quick-result small,
.quick-result strong {
  display: block;
}

.quick-result small {
  color: #68727a;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.quick-result strong {
  margin-top: 2px;
  color: #263039;
  font-size: 14px;
  line-height: 1.25;
}

.quick-result > b {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 13px;
  line-height: 1.2;
  text-align: right;
}

.unit-toggle label {
  position: relative;
}

.unit-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.unit-toggle span {
  display: block;
  min-width: 60px;
  padding: 7px 9px;
  color: #555;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.unit-toggle label + label span {
  border-left: 1px solid var(--line-strong);
}

.unit-toggle input:checked + span {
  background: var(--green);
  color: var(--white);
}

.unit-toggle input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.field {
  margin-top: 18px;
}

.field > label,
.field-label-row > label,
.advanced-grid > label {
  color: #30343a;
  font-size: 13px;
  font-weight: 700;
}

select,
input[type="number"] {
  border: 1px solid #bfc8cf;
  border-radius: 4px;
  background: var(--white);
  color: var(--ink);
}

select {
  width: 100%;
  min-height: 43px;
  margin-top: 7px;
  padding: 8px 36px 8px 11px;
}

select:focus,
input:focus,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.number-wrap {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  overflow: hidden;
  border: 1px solid #bfc8cf;
  border-radius: 4px;
  background: var(--white);
}

.stepper {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

.stepper-button {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  place-items: center;
  border: 1px solid #bfc8cf;
  border-radius: 4px;
  padding: 0;
  background: var(--white);
  color: #344049;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}

.stepper-button:hover {
  background: #edf1f2;
}

.stepper input[type="number"] {
  appearance: textfield;
}

.stepper input[type="number"]::-webkit-inner-spin-button,
.stepper input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.number-wrap input[type="number"] {
  width: 80px;
  height: 37px;
  border: 0;
  border-radius: 0;
  padding: 6px 5px 6px 9px;
  text-align: right;
}

.number-wrap span {
  min-width: 32px;
  padding: 0 8px 0 4px;
  color: #66717a;
  font-size: 12px;
  font-weight: 700;
}

.number-wrap--aperture > span {
  min-width: 26px;
  padding: 0 0 0 8px;
}

.number-wrap--aperture input[type="number"] {
  width: 74px;
  padding-left: 2px;
  text-align: left;
}

input[type="range"] {
  width: 100%;
  height: 22px;
  margin: 9px 0 0;
  accent-color: var(--green);
}

.field-help {
  margin: 5px 0 0;
  color: #5f686f;
  font-size: 11px;
  line-height: 1.35;
}

.calculator[data-mode="easy"] .precision-control,
.calculator[data-mode="easy"] .advanced-result {
  display: none;
}

.calculator[data-mode="easy"][data-custom="false"] .advanced {
  display: none;
}

.advanced {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.advanced summary {
  color: #394149;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.advanced-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.advanced-grid label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.advanced-grid .number-wrap input {
  width: 72px;
}

.form-error {
  margin: 14px 0 0;
  border-left: 3px solid #b42318;
  padding: 8px 10px;
  background: #fff1f0;
  color: #7a271a;
  font-size: 13px;
}

.form-actions {
  justify-content: flex-start;
  margin-top: 18px;
}

.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
}

.button--primary {
  min-width: 126px;
  background: var(--green);
  color: var(--white);
}

.button--primary:hover {
  background: #244d3e;
}

.button--quiet {
  border-color: var(--line-strong);
  background: var(--white);
  color: #3b434a;
}

.button--quiet:hover {
  background: #eef1f3;
}

.results {
  padding: 27px 30px 30px;
}

.results-head {
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.results h2 {
  margin: 5px 0 0;
  font-size: 25px;
  letter-spacing: 0;
  line-height: 1.2;
}

.result-summary {
  max-width: 310px;
  margin: 0;
  color: #4f5961;
  font-size: 13px;
  text-align: right;
}

.result-assumption {
  margin: 7px 0 0;
  color: #5d666d;
  font-size: 11px;
  font-weight: 600;
}

.primary-results,
.secondary-results {
  display: grid;
  margin: 0;
}

.primary-results {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.primary-results > div {
  min-width: 0;
  padding: 19px 14px 18px 0;
}

.primary-results > div + div {
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

dt {
  color: #67727b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

dd {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.primary-result-emphasis dd {
  color: var(--green);
}

.focus-figure {
  margin: 25px 0 0;
}

.focus-figure figcaption {
  margin-bottom: 38px;
  color: #30343a;
  font-size: 13px;
  font-weight: 700;
}

.focus-scale {
  position: relative;
  height: 20px;
  border: 1px solid #cfd6db;
  background: #e9edef;
}

.focus-zone {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: var(--focus-left);
  width: var(--focus-width);
  min-width: 2px;
  border: 1px solid var(--green);
  background: var(--green-light);
}

.marker {
  position: absolute;
  top: -26px;
  display: block;
  width: 1px;
  height: 44px;
  color: #4f5961;
}

.marker i {
  display: block;
  width: 1px;
  height: 44px;
  background: currentColor;
}

.marker b {
  position: absolute;
  top: -1px;
  left: 5px;
  font-size: 11px;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.marker--near {
  left: var(--focus-left);
  color: var(--green);
}

.marker--subject {
  left: 48%;
  color: var(--orange);
}

.marker--far {
  left: calc(var(--focus-left) + var(--focus-width));
  color: var(--green);
}

.marker--far b {
  right: 5px;
  left: auto;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: #626c73;
  font-size: 11px;
}

.focus-legend {
  display: none;
}

.figure-note {
  margin: 10px 0 0;
  color: #6b747b;
  font-size: 11px;
}

.secondary-results {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 22px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.secondary-results > div {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  background: var(--soft-blue);
}

.secondary-results dd {
  font-size: 16px;
}

.guide {
  max-width: 900px;
  margin: 48px auto 0;
}

.tool-representative {
  width: min(560px, 100%);
  margin: 34px auto 0;
}

.tool-representative img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--soft);
}

.tool-representative figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

.guide > section {
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.guide h2 {
  margin: 0 0 12px;
  font-size: 25px;
  letter-spacing: 0;
  line-height: 1.2;
}

.guide h3 {
  margin: 0 0 6px;
  font-size: 17px;
  letter-spacing: 0;
  line-height: 1.25;
}

.guide p {
  margin: 0;
  color: #444b51;
}

.guide p + p {
  margin-top: 12px;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 32px;
}

.faq details {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.faq summary {
  color: #2e3439;
  font-weight: 700;
  cursor: pointer;
}

.faq details p {
  padding: 10px 24px 2px 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #f6f7f7;
}

.footer-inner {
  min-height: 78px;
  color: #586168;
  font-size: 13px;
}

.footer-inner p {
  margin: 0;
}

.footer-inner nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-inner a {
  color: #3f494f;
}

@media (max-width: 900px) {
  .calculator {
    grid-template-columns: 1fr;
  }

  .controls {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .primary-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .primary-results > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .primary-results > div:nth-child(4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .header-inner,
  .footer-inner,
  .page-shell {
    width: min(100% - 24px, 1180px);
  }

  .header-inner {
    min-height: 58px;
    gap: 14px;
  }

  .brand {
    width: 132px;
    height: 52px;
  }

  .brand img {
    width: 130px;
  }

  .site-nav {
    gap: 12px;
  }

  .site-nav a {
    font-size: 11px;
  }

  .site-nav a:nth-child(2) {
    display: none;
  }

  .page-shell {
    padding-top: 15px;
  }

  .breadcrumbs {
    margin-bottom: 18px;
  }

  .page-intro h1 {
    font-size: 31px;
  }

  .page-intro > p:last-child {
    font-size: 16px;
  }

  .controls,
  .results {
    padding: 20px 16px;
  }

  .controls-head {
    align-items: flex-start;
  }

  .quick-result {
    position: sticky;
    top: 6px;
    z-index: 2;
    box-shadow: 0 3px 10px rgba(20, 28, 38, .08);
  }

  .unit-toggle span {
    min-width: 54px;
  }

  .results-head {
    display: block;
  }

  .result-summary {
    max-width: none;
    margin-top: 10px;
    text-align: left;
  }

  .primary-results > div,
  .primary-results > div + div {
    min-height: 80px;
    padding: 14px 10px;
  }

  .primary-results > div:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }

  .primary-results dd {
    font-size: 18px;
  }

  .focus-figure figcaption {
    margin-bottom: 32px;
  }

  .marker b {
    display: none;
  }

  .focus-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
    color: #59636b;
    font-size: 10px;
    font-weight: 700;
  }

  .focus-legend span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .focus-legend i {
    width: 11px;
    height: 2px;
    background: var(--green);
  }

  .focus-legend--subject i {
    background: var(--orange);
  }

  .secondary-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calculator[data-mode="easy"] .secondary-results {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calculator[data-mode="easy"] .secondary-results > div {
    padding: 11px 8px;
  }

  .calculator[data-mode="easy"] .secondary-results dt {
    font-size: 10px;
  }

  .calculator[data-mode="easy"] .secondary-results dd {
    font-size: 15px;
  }

  .guide {
    margin-top: 34px;
  }

  .guide > section {
    padding: 24px 0;
  }

  .guide h2 {
    font-size: 22px;
  }

  .guide-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .footer-inner {
    display: block;
    padding: 18px 0;
  }

  .footer-inner nav {
    margin-top: 7px;
  }
}

@media (max-width: 374px) {
  .site-nav a:nth-child(3) {
    display: none;
  }

  .controls-head {
    display: block;
  }

  .unit-toggle {
    width: max-content;
    margin-top: 12px;
  }

  .field-label-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .stepper {
    margin-left: auto;
  }

  .calculator[data-mode="advanced"] .secondary-results {
    grid-template-columns: 1fr;
  }
}

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