:root {
  color-scheme: light;
  --ink: #102a43;
  --muted: #5d6b78;
  --line: #d9e2ec;
  --soft: #f4f7fa;
  --paper: #ffffff;
  --accent: #0b7285;
  --accent-deep: #075765;
  --accent-soft: #e7f5f7;
  --success: #13795b;
  --success-soft: #e7f6ef;
  --warning: #a15c00;
  --warning-soft: #fff4dc;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 16px 40px rgba(16, 42, 67, 0.075);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: linear-gradient(180deg, #f1f6f8 0, #f7f9fb 300px, #f7f9fb 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(11, 114, 133, 0.28);
  outline-offset: 2px;
}

.is-hidden {
  display: none !important;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid rgba(217, 226, 236, 0.92);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

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

.wordmark {
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.wordmark-logo {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 7px rgba(16, 42, 67, 0.1));
}

.wordmark-copy {
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.wordmark-owner {
  color: var(--accent-deep);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.wordmark-product {
  font-size: 14px;
  font-weight: 760;
  letter-spacing: -0.015em;
}

.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.85fr);
  grid-template-areas:
    "calculator weather"
    "safety weather";
  gap: 24px;
  padding-block: 32px 60px;
  align-items: start;
}

.calculator-card,
.weather-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.calculator-card {
  grid-area: calculator;
  padding: clamp(22px, 4vw, 34px);
}

.weather-card {
  grid-area: weather;
  padding: 24px;
  position: sticky;
  top: 92px;
}

.section-heading,
.line-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clear-button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--paper);
  font-size: 12px;
  font-weight: 760;
}

.clear-button:hover {
  color: var(--ink);
  border-color: #b7c5d1;
  background: var(--soft);
}

.section-heading h1,
.section-heading h2,
.line-heading h2 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.section-heading h1,
.section-heading h2 {
  font-size: 23px;
}

.line-heading h2 {
  font-size: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 999px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill-good {
  color: var(--success);
  background: var(--success-soft);
}

.pill-caution {
  color: var(--warning);
  background: var(--warning-soft);
}

.pill-delay {
  color: var(--danger);
  background: var(--danger-soft);
}

form {
  margin-top: 24px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

fieldset {
  min-width: 0;
}

.choice-group {
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-group legend,
.field > span:first-child {
  display: block;
  margin-bottom: 8px;
  color: #34495e;
  font-size: 13px;
  font-weight: 750;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--soft);
}

.segmented button {
  min-height: 46px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  color: #536170;
  background: transparent;
  font-weight: 720;
}

.segmented button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 2px 9px rgba(16, 42, 67, 0.09);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.field {
  display: block;
  min-width: 0;
}

.field select,
.field input,
.input-with-unit {
  width: 100%;
}

.field select,
.field input {
  min-height: 50px;
  border: 1px solid #c7d2dc;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--paper);
  padding: 0 13px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field select:hover,
.field input:hover {
  border-color: #9fb0bf;
}

.field select:focus,
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 114, 133, 0.11);
  outline: none;
}

.input-with-unit {
  display: flex;
  align-items: center;
  position: relative;
}

.input-with-unit input {
  padding-right: 48px;
}

.input-with-unit > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  pointer-events: none;
  position: absolute;
  right: 14px;
}

.line-section {
  margin-top: 30px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.line-total {
  color: var(--accent-deep);
  font-size: 14px;
  font-weight: 780;
}

.line-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.line-inputs .field:only-child {
  grid-column: 1 / -1;
}

.line-field {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f9fbfc;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.line-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  align-items: end;
  gap: 9px;
}

.line-size-control {
  display: block;
  min-width: 0;
}

.line-size-control > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.line-size-control select {
  width: 100%;
  min-height: 50px;
  padding-inline: 10px 28px;
  border: 1px solid #c7d2dc;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  font-weight: 720;
}

.field > span.field-label-row:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.line-name {
  color: #34495e;
  font-size: 13px;
  font-weight: 780;
}

.line-range {
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  white-space: nowrap;
}

.line-feedback {
  display: block;
  margin-top: 7px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 760;
}

.line-feedback:empty {
  display: none;
}

.line-field.field-invalid {
  border-color: #e6aaa5;
  background: var(--danger-soft);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.06);
}

.line-field.field-invalid input {
  border-color: #d77f77;
}

#height-field.field-invalid input {
  border-color: #d77f77;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.06);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 20px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
  cursor: pointer;
}

.check-row input {
  width: 19px;
  height: 19px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.check-row strong,
.check-row small {
  display: block;
}

.check-row strong {
  font-size: 14px;
}

.check-row small {
  margin-top: 3px;
  color: var(--muted);
}

.result-panel {
  margin-top: 24px;
  padding: clamp(22px, 4vw, 30px);
  border-radius: 18px;
  color: white;
  background: linear-gradient(145deg, #102a43, #163d56);
  overflow: hidden;
  position: relative;
}

.result-panel::after {
  content: "";
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.035);
  position: absolute;
  right: -90px;
  top: -115px;
  pointer-events: none;
}

.result-panel.result-success {
  background: linear-gradient(145deg, #0c4b43, #10675a);
}

.result-panel.result-action {
  background: linear-gradient(145deg, #684006, #8d5708);
}

.result-panel.result-danger {
  background: linear-gradient(145deg, #6f211c, #923229);
}

.result-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 7px;
}

.result-status {
  display: inline-flex;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 780;
}

.result-kicker {
  margin: 0;
  color: rgba(255, 255, 255, 0.67);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-panel h2 {
  margin: 0;
  color: white;
  font-size: clamp(27px, 4vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.result-summary {
  max-width: 630px;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.78);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 27px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  overflow: hidden;
}

.result-grid > div {
  min-width: 0;
  padding: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.result-grid > div:nth-child(even) {
  border-right: 0;
}

.result-grid > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.result-grid dt,
.weather-metrics dt {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.result-grid dd {
  margin: 4px 0 0;
  color: white;
  font-size: 14px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.result-details {
  display: grid;
  gap: 8px;
  margin-top: 19px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.detail-row strong {
  color: white;
  text-align: right;
}

.message-stack {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.message-stack:empty {
  display: none;
}

.message {
  margin: 0;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.message strong {
  color: white;
}

.weather-controls {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  font-weight: 760;
}

.primary-button {
  border: 1px solid var(--accent);
  color: white;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-deep);
}

.secondary-button {
  border: 1px solid #c7d2dc;
  color: var(--ink);
  background: white;
}

.secondary-button:hover {
  background: var(--soft);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.weather-result {
  margin-top: 23px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
}

.weather-place {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.weather-reading > p:last-child {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0;
}

.weather-temperature {
  font-size: 42px;
  line-height: 1;
  font-weight: 790;
  letter-spacing: -0.04em;
}

#weather-description {
  color: var(--muted);
  font-size: 14px;
}

.weather-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 20px 0 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.weather-metrics > div {
  padding: 12px;
}

.weather-metrics > div + div {
  border-left: 1px solid var(--line);
}

.weather-metrics dt {
  color: var(--muted);
}

.weather-metrics dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
}

.weather-guidance {
  margin: 17px 0 0;
  padding: 13px;
  border-radius: 10px;
  color: #34495e;
  background: var(--soft);
  font-size: 13px;
}

.weather-message {
  min-height: 20px;
  margin: 13px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.safety-note {
  grid-area: safety;
  padding: 17px 20px;
  border: 1px solid #bcdde2;
  border-radius: var(--radius-md);
  color: #2d5660;
  background: #eef9fa;
  font-size: 14px;
}

.site-footer {
  padding: 24px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: white;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 840px) {
  .page-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "calculator"
      "weather"
      "safety";
    padding-top: 38px;
  }

  .weather-card {
    position: static;
  }
}

@media (min-width: 1000px) {
  .result-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .result-grid > div,
  .result-grid > div:nth-child(even) {
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 0;
  }

  .result-grid > div:last-child {
    border-right: 0;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1120px);
  }

  .header-inner {
    min-height: 60px;
  }

  .wordmark-logo {
    width: 36px;
    height: 36px;
  }

  .wordmark-product {
    font-size: 13px;
  }

  .page-layout {
    gap: 16px;
    padding-block: 18px 44px;
  }

  .calculator-card,
  .weather-card {
    border-radius: 17px;
  }

  .calculator-card,
  .weather-card {
    padding: 20px;
  }

  .choice-grid,
  .field-grid,
  .line-inputs {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-wide,
  .line-inputs .field:only-child {
    grid-column: auto;
  }

  .result-panel {
    margin-inline: -7px;
    padding: 22px 19px;
  }

  .detail-row {
    display: block;
  }

  .detail-row strong {
    display: block;
    margin-top: 2px;
    text-align: left;
  }
}

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