:root {
  --ink: #1a1a1a;
  --muted: #666;
  --line: #e1e5e9;
  --line-strong: #cbd3d9;
  --soft: #f7f7f5;
  --soft-blue: #f2f7fa;
  --green: #2f6250;
  --green-dark: #244d3e;
  --green-light: #d7e5da;
  --blue: #315d78;
  --orange: #a76332;
  --orange-light: #f1ddd0;
  --white: #fff;
}

* {
  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 {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.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: 850px;
  margin-bottom: 24px;
}

.eyebrow,
.panel-label {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  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: 780px;
  margin: 0;
  color: #555;
  font-size: 18px;
}

.calculator {
  display: grid;
  grid-template-columns: minmax(320px, 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);
}

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

.segmented {
  display: grid;
  margin: 18px 0 0;
  border: 0;
  padding: 0;
}

.segmented legend {
  margin-bottom: 7px;
  padding: 0;
  color: #30343a;
  font-size: 13px;
  font-weight: 700;
}

.solve-control {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.segmented legend {
  grid-column: 1 / -1;
}

.segmented label {
  position: relative;
  min-width: 0;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 40px;
  place-items: center;
  border: 1px solid #bfc8cf;
  background: var(--white);
  color: #465058;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.segmented label:first-of-type span {
  border-radius: 4px 0 0 4px;
}

.segmented label:last-of-type span {
  border-radius: 0 4px 4px 0;
}

.segmented label + label span {
  border-left: 0;
}

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

.segmented label + label input:checked + span {
  box-shadow: -1px 0 0 var(--green);
}

.segmented input:focus-visible + span {
  position: relative;
  z-index: 2;
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.quick-result {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  border-left: 3px solid var(--green);
  padding: 9px 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: 16px;
  line-height: 1.2;
}

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

.field {
  margin-top: 18px;
}

.field > label,
.custom-dimensions label,
.input-field {
  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);
}

.field > 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;
}

.custom-dimensions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 10px;
  border-left: 2px solid var(--line-strong);
  padding-left: 10px;
}

.custom-dimensions label {
  display: grid;
  gap: 5px;
}

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

.number-wrap input {
  width: 92px;
  height: 38px;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 6px 4px 6px 8px;
  text-align: right;
}

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

.orientation-control,
.unit-control {
  margin-top: 17px;
}

.input-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.input-field {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.calculator[data-solve="coverage"] #frame-field,
.calculator[data-solve="lens"] #focal-field,
.calculator[data-solve="distance"] #distance-field {
  display: none;
}

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

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

.form-actions,
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.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: 144px;
  background: var(--green);
  color: var(--white);
}

.button--primary:hover {
  background: var(--green-dark);
}

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

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

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

.results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  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: 360px;
  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 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  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);
}

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

.figure-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
}

.figure-heading figcaption {
  color: #30343a;
  font-size: 13px;
  font-weight: 700;
}

.figure-heading span {
  color: #6b747b;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

#fov-diagram {
  display: block;
  width: 100%;
  height: 270px;
  border: 1px solid #d7dde1;
  background: #fafbfb;
}

.diagram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 10px;
  color: #59636a;
  font-size: 10px;
  font-weight: 700;
}

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

.diagram-legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  background: var(--green);
}

.diagram-legend .legend-camera {
  height: 8px;
  background: #26353d;
}

.diagram-legend .legend-plane {
  background: var(--orange);
}

.coverage-panel {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.coverage-window {
  position: relative;
  width: min(100%, 630px);
  aspect-ratio: 3 / 2;
  overflow: hidden;
  margin: 0 auto;
  border: 8px solid #26353d;
  background-color: #dce6e7;
  background-image:
    linear-gradient(to bottom, transparent 0 57%, rgba(80, 101, 94, .14) 57% 100%),
    linear-gradient(135deg, rgba(49, 93, 120, .18), transparent 55%),
    linear-gradient(45deg, rgba(167, 99, 50, .13), transparent 45%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7);
}

.coverage-window.is-portrait {
  width: min(68%, 430px);
}

.thirds {
  position: absolute;
  inset: 0;
  opacity: .62;
  pointer-events: none;
}

.thirds--vertical {
  border-right: 1px solid rgba(255, 255, 255, .9);
  border-left: 1px solid rgba(255, 255, 255, .9);
  right: 33.333%;
  left: 33.333%;
}

.thirds--horizontal {
  border-top: 1px solid rgba(255, 255, 255, .9);
  border-bottom: 1px solid rgba(255, 255, 255, .9);
  top: 33.333%;
  bottom: 33.333%;
}

.coverage-width,
.coverage-height {
  position: absolute;
  display: grid;
  min-height: 24px;
  place-items: center;
  padding: 3px 8px;
  background: rgba(24, 31, 35, .82);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.coverage-width {
  right: 50%;
  bottom: 8px;
  transform: translateX(50%);
}

.coverage-height {
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

.coverage-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11%;
  max-width: 46px;
  aspect-ratio: 1 / 2.35;
  border-radius: 45% 45% 20% 20%;
  background: rgba(38, 53, 61, .72);
  transform: translate(-50%, -37%);
}

.coverage-center::before {
  position: absolute;
  top: -23%;
  left: 50%;
  width: 55%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: inherit;
  content: "";
  transform: translateX(-50%);
}

.coverage-panel > p {
  margin: 9px 0 0;
  color: #626c73;
  font-size: 11px;
  text-align: center;
}

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

.secondary-results > div {
  min-width: 0;
  min-height: 75px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

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

.equivalence {
  margin-top: 25px;
  border-top: 1px solid var(--line);
  padding-top: 21px;
}

.equivalence h3 {
  margin: 5px 0 0;
  font-size: 19px;
  letter-spacing: 0;
  line-height: 1.2;
}

.equivalence-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.equivalence-grid span {
  min-width: 0;
  border-top: 3px solid var(--green);
  padding: 10px 11px;
  background: #edf5ef;
}

.equivalence-grid span:nth-child(2) {
  border-color: var(--blue);
  background: var(--soft-blue);
}

.equivalence-grid span:nth-child(3) {
  border-color: var(--orange);
  background: #fff4eb;
}

.equivalence-grid span:nth-child(4) {
  border-color: #6b667f;
  background: #f3f1f6;
}

.equivalence-grid small,
.equivalence-grid strong {
  display: block;
}

.equivalence-grid small {
  color: #657078;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.equivalence-grid strong {
  margin-top: 3px;
  font-size: 16px;
  line-height: 1.2;
}

.equivalence > p:last-child {
  margin: 10px 0 0;
  color: #636d74;
  font-size: 11px;
}

.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: 960px) {
  .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-top: 1px solid var(--line);
    border-left: 0;
  }

  .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;
  }

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

  .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;
  }

  #fov-diagram {
    height: 220px;
  }

  .figure-heading span {
    display: none;
  }

  .coverage-window {
    border-width: 6px;
  }

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

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

  .guide {
    margin-top: 34px;
  }

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

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

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

  .footer-inner {
    min-height: 92px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
  }
}

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

  .custom-dimensions {
    grid-template-columns: 1fr;
  }

  .quick-result strong {
    font-size: 14px;
  }

  .quick-result > b {
    max-width: 118px;
    font-size: 12px;
  }

  .input-field {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .input-field .number-wrap {
    width: 100%;
  }

  .input-field .number-wrap input {
    width: 100%;
  }

  #fov-diagram {
    height: 195px;
  }

  .coverage-width,
  .coverage-height {
    min-height: 21px;
    padding: 2px 5px;
    font-size: 9px;
  }
}

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