:root {
  color-scheme: light;
  --bc-ink: #09101f;
  --bc-muted: #6b7280;
  --bc-blue: #003b8e;
  --bc-blue-2: #0b63ce;
  --bc-soft: #f3f6ff;
  --bc-soft-2: #eef2ff;
  --bc-line: rgba(209, 213, 219, 0.9);
  --bc-panel: #ffffff;
  --bc-danger: #9f2f36;
  --bc-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--bc-ink);
  font-family: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: #f4f7ff;
}

html {
  scroll-behavior: smooth;
}

.app-shell {
  width: min(1040px, calc(100% - 32px));
  flex: 1 0 auto;
  margin: 0 auto;
  padding: 32px 0 34px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--bc-line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(14px);
}

.site-header-inner {
  width: min(1120px, calc(100% - 32px));
  min-height: 70px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--bc-blue), var(--bc-blue-2));
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(0, 59, 142, 0.18);
}

.header-clock {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: max-content;
  color: var(--bc-muted);
  font-size: 12px;
  line-height: 1.2;
}

.header-clock strong {
  color: var(--bc-blue);
  font-size: 14px;
  font-weight: 850;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--bc-blue);
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  color: var(--bc-blue);
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0;
}

.muted,
small {
  color: var(--bc-muted);
}

.intro {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 20px;
  padding: 4px 2px;
}

.intro h2 {
  max-width: 720px;
  margin-bottom: 7px;
  font-size: 24px;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--bc-blue);
  font-size: 13px;
  font-weight: 850;
}

.tool,
.results,
.alert {
  border: 1px solid var(--bc-line);
  border-radius: 18px;
  background: var(--bc-panel);
  box-shadow: var(--bc-shadow);
}

.tool {
  padding: 22px;
}

.form-section {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #edf1f7;
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.form-section h2 {
  margin-bottom: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

label span {
  display: block;
  margin-bottom: 7px;
  color: #344054;
  font-size: 12px;
  font-weight: 750;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid #cfd7e3;
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--bc-ink);
  background: #ffffff;
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus {
  border-color: rgba(0, 59, 142, 0.62);
  box-shadow: 0 0 0 4px rgba(0, 59, 142, 0.08);
}

input[type="file"] {
  padding-top: 8px;
}

button,
.downloads a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 999px;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
}

button svg,
.downloads svg {
  width: 18px;
  height: 18px;
}

.secondary-action,
.icon-action {
  border: 1px solid rgba(0, 59, 142, 0.18);
  color: var(--bc-blue);
  background: #ffffff;
  cursor: pointer;
  box-shadow: none;
}

.secondary-action {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 14px;
}

.secondary-action:hover,
.icon-action:hover {
  background: #f3f6ff;
}

.icon-action {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
}

.icon-action[hidden] {
  display: none;
}

.wind-unit {
  width: min(240px, 100%);
  margin-bottom: 16px;
}

.wind-rows {
  display: grid;
  gap: 12px;
}

.wind-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px;
  gap: 14px;
  align-items: end;
  padding: 14px;
  border: 1px solid #edf1f7;
  border-radius: 12px;
  background: #fbfcff;
}

.wind-rows.is-single .wind-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--bc-blue), var(--bc-blue-2));
  border: 1px solid rgba(0, 59, 142, 0.1);
  box-shadow: 0 14px 28px rgba(0, 59, 142, 0.2);
  cursor: pointer;
}

.primary:hover {
  filter: brightness(0.96);
}

.submit {
  width: 100%;
  margin-top: 20px;
}

.alert {
  padding: 14px;
  margin-bottom: 16px;
}

.alert.danger {
  color: var(--bc-danger);
  background: #fff5f5;
  border-color: #ffc4c4;
}

.results {
  padding: 22px;
  margin-top: 20px;
}

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

.downloads a {
  justify-content: flex-start;
  padding: 13px 16px;
  border: 1px solid var(--bc-line);
  color: var(--bc-blue);
  background: #ffffff;
}

.downloads a.primary-download {
  color: #ffffff;
  background: linear-gradient(135deg, var(--bc-blue), var(--bc-blue-2));
  border-color: transparent;
  box-shadow: 0 14px 28px rgba(0, 59, 142, 0.18);
}

.downloads small {
  margin-left: auto;
  color: currentColor;
  opacity: 0.75;
}

body.modal-open {
  overflow: hidden;
}

.upload-modal[hidden] {
  display: none;
}

.upload-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.upload-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 16, 31, 0.38);
  backdrop-filter: blur(8px);
}

.upload-modal-card {
  position: relative;
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--bc-line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.upload-modal-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--bc-blue), var(--bc-blue-2));
  box-shadow: 0 14px 28px rgba(0, 59, 142, 0.18);
}

.upload-modal-icon svg {
  width: 22px;
  height: 22px;
}

.upload-modal-copy {
  display: grid;
  gap: 6px;
}

.upload-modal-copy p:last-child {
  color: var(--bc-muted);
}

.upload-progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f7;
}

.upload-progress span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--bc-blue), var(--bc-blue-2));
  transition: width 0.18s ease;
}

#dem-upload-percent {
  justify-self: end;
  color: var(--bc-blue);
  font-weight: 850;
}

.upload-modal[data-state="done"] .upload-modal-icon {
  background: linear-gradient(135deg, #0f6b43, #14a66a);
}

.upload-modal[data-state="done"] #dem-upload-percent {
  color: #0f6b43;
}

.upload-modal[data-state="error"] .upload-modal-icon {
  background: linear-gradient(135deg, #9f2f36, #ef3c26);
}

.upload-modal[data-state="error"] #dem-upload-percent {
  color: var(--bc-danger);
}

.site-footer {
  flex: 0 0 auto;
  border-top: 1px solid #102645;
  background: #031633;
  color: #e5e7eb;
}

.site-footer-inner {
  width: min(1120px, calc(100% - 32px));
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
  font-size: 14px;
}

.footer-copy {
  display: grid;
  gap: 6px;
}

.footer-copy p:first-child {
  color: #f8fafc;
  font-weight: 750;
}

.footer-small {
  color: #cbd5e1;
  font-size: 13px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px;
}

.footer-links a {
  color: #cbd5e1;
  font-weight: 700;
  text-decoration: none;
}

.footer-links a:hover {
  color: #ffffff;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 1040px);
    padding-top: 18px;
  }

  .site-header-inner {
    width: min(100% - 24px, 1120px);
    min-height: 64px;
    gap: 12px;
    padding: 12px 0;
  }

  .header-clock {
    font-size: 11px;
  }

  .header-clock strong {
    font-size: 12px;
  }

  .intro,
  .site-footer-inner {
    width: min(100% - 24px, 1120px);
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-links {
    justify-content: flex-start;
    gap: 12px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .wind-row {
    grid-template-columns: 1fr;
  }

  .icon-action {
    width: 100%;
  }

  .tool,
  .results,
  .alert {
    border-radius: 16px;
  }

  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .site-header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-clock {
    justify-items: start;
  }
}
