/*
 * NDAWN current-weather component styles.
 *
 * Load this file after the existing NDAWN theme/custom styles. Every selector
 * is scoped to #currentwx-app so Bootstrap and the legacy theme can continue to
 * style the surrounding site without being changed by this component.
 */

#currentwx-app {
  --wx-surface: #ffffff;
  --wx-surface-soft: #f7f8f9;
  --wx-ink: #15191d;
  --wx-muted: #66717c;
  --wx-line: #d7dce1;
  --wx-green: #4b9130;
  --wx-green-dark: #347121;
  --wx-green-soft: #eaf4e6;
  --wx-yellow: #f4c542;
  --wx-yellow-ink: #5b4300;
  --wx-red: #b42318;
  --wx-red-soft: #fff0ee;
  --wx-freezing-blue: #2f7fae;
  --wx-control-shadow: 0 4px 16px rgba(34, 42, 49, 0.07);

  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
  padding-block: 28px 48px;
  color: var(--wx-ink);
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 1.5;
}

#currentwx-app,
#currentwx-app *,
#currentwx-app *::before,
#currentwx-app *::after {
  box-sizing: border-box;
}

#currentwx-app button,
#currentwx-app select {
  font: inherit;
}

#currentwx-app button:focus-visible,
#currentwx-app select:focus-visible {
  outline: 3px solid rgba(75, 145, 48, 0.38);
  outline-offset: 2px;
}

#currentwx-app [hidden] {
  display: none !important;
}

#currentwx-app .station-tools,
#currentwx-app .conditions,
#currentwx-app .status,
#currentwx-app .data-note {
  width: min(800px, 100%);
  margin-inline: auto;
}

#currentwx-app .station-tools {
  padding: 14px;
  border: 1px solid var(--wx-line);
  border-radius: 6px;
  background: var(--wx-surface-soft);
  box-shadow: var(--wx-control-shadow);
}

#currentwx-app .station-tool-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#currentwx-app .station-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

#currentwx-app .station-tool-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--wx-line);
}

#currentwx-app .favorite-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

#currentwx-app .favorite-list:empty {
  margin-top: 0;
}

#currentwx-app .station-tool-panel .favorite-list {
  margin-top: 0;
}

#currentwx-app .favorite-item {
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--wx-line);
  border-radius: 5px;
  background: var(--wx-surface);
}

#currentwx-app .favorite-item.is-selected {
  border-color: var(--wx-green);
  background: var(--wx-green-soft);
}

#currentwx-app .favorite-select,
#currentwx-app .favorite-remove {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--wx-ink);
  cursor: pointer;
  line-height: 1.4;
  text-shadow: none;
  box-shadow: none;
}

#currentwx-app .favorite-select {
  min-height: 42px;
  padding: 8px 12px;
  font-weight: 600;
}

#currentwx-app .favorite-remove {
  min-width: 38px;
  padding: 8px;
  border-left: 1px solid var(--wx-line);
  color: var(--wx-muted);
}

#currentwx-app .favorite-remove:hover {
  color: var(--wx-red);
  background: var(--wx-red-soft);
}

#currentwx-app .empty-message {
  margin: 14px 0 0;
  color: var(--wx-muted);
}

#currentwx-app .picker-controls {
  display: grid;
  grid-template-columns: minmax(110px, 0.55fr) minmax(220px, 1.6fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 15px;
}

#currentwx-app .picker-controls label {
  display: block;
  margin: 0;
  color: var(--wx-ink);
  font-weight: 400;
}

#currentwx-app .picker-controls label > span {
  display: block;
  margin-bottom: 5px;
  color: var(--wx-muted);
  font-size: 0.82em;
  font-weight: 600;
}

#currentwx-app select {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 8px 36px 8px 11px;
  border: 1px solid #b9c2ca;
  border-radius: 4px;
  background-color: var(--wx-surface);
  color: var(--wx-ink);
  line-height: 1.4;
  box-shadow: none;
}

#currentwx-app .button {
  min-height: 44px;
  margin: 0;
  padding: 9px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  text-shadow: none;
  box-shadow: none;
}

#currentwx-app .button:disabled {
  cursor: wait;
  opacity: 0.55;
}

#currentwx-app .button-favorite,
#currentwx-app .button-refresh {
  border: 1px solid var(--wx-green-dark);
  background: var(--wx-green);
  color: #fff;
}

#currentwx-app .button-favorite:hover:not(:disabled),
#currentwx-app .button-refresh:hover:not(:disabled),
#currentwx-app .button-favorite:focus:not(:disabled),
#currentwx-app .button-refresh:focus:not(:disabled) {
  border-color: var(--wx-green-dark);
  background: var(--wx-green-dark);
  color: #fff;
}

#currentwx-app .button-favorite.is-favorite {
  background: var(--wx-surface);
  color: var(--wx-green-dark);
}

#currentwx-app .button-secondary {
  border: 1px solid #b9c2ca;
  background: var(--wx-surface-soft);
  color: var(--wx-ink);
}

#currentwx-app .button-secondary:hover:not(:disabled),
#currentwx-app .button-secondary:focus:not(:disabled) {
  background: #e9edf0;
  color: var(--wx-ink);
}

#currentwx-app .station-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  text-align: center;
}

#currentwx-app .station-tool-button.is-active {
  border-color: var(--wx-green-dark);
  background: var(--wx-green-soft);
  color: var(--wx-green-dark);
}

#currentwx-app .status {
  min-height: 24px;
  margin-top: 14px;
  margin-bottom: 10px;
  color: var(--wx-muted);
  font-size: 0.9em;
  white-space: pre-line;
}

#currentwx-app .status.is-error {
  padding: 10px 12px;
  border-left: 4px solid var(--wx-red);
  background: var(--wx-red-soft);
  color: #7e1f17;
}

#currentwx-app .conditions {
  padding-top: 12px;
  color: #000;
}

#currentwx-app .station-heading {
  align-items: center;
  padding: 10px 0 18px;
  text-align: center;
}

#currentwx-app .station-heading > div {
  flex: 1;
  padding-left: 98px;
}

#currentwx-app .station-heading h2 {
  margin: 0 0 7px;
  color: #000;
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2em, 7vw, 2.5em);
  font-weight: 600;
  line-height: 1.15;
}

#currentwx-app .station-county {
  margin: 0;
  color: #000;
  font-size: 1.3em;
  font-style: italic;
  line-height: 1.4;
}

#currentwx-app .updated-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  max-width: 650px;
  margin: 0 auto 14px;
  font-size: 1em;
}

#currentwx-app .updated-row > span:first-child {
  padding-right: 10px;
  text-align: right;
  font-weight: 700;
}

#currentwx-app .updated-row time {
  padding-left: 10px;
  text-align: left;
}

#currentwx-app .freshness-badge {
  grid-column: 1 / -1;
  justify-self: center;
  margin-top: 9px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.82em;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#currentwx-app .freshness-badge.is-delayed {
  border: 1px solid #d2a500;
  background: var(--wx-yellow);
  color: var(--wx-yellow-ink);
}

#currentwx-app .freshness-badge.is-outdated {
  border: 1px solid #8f1d14;
  background: var(--wx-red);
  color: #fff;
}

#currentwx-app .freshness-message {
  margin: 8px auto 14px;
  padding: 10px 14px;
  border-left: 4px solid var(--wx-red);
  background: var(--wx-red-soft);
  color: #7e1f17;
  text-align: center;
}

#currentwx-app .temperature-hero {
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 8px 0 18px;
}

#currentwx-app .temperature {
  min-height: 1.2em;
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: clamp(3.25em, 12vw, 4.8em);
  font-weight: 700;
  line-height: 1.05;
}

#currentwx-app .temperature-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  min-height: 1.5em;
  font-size: 1.4em;
}

#currentwx-app .temperature-extreme {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
}

#currentwx-app .temperature-extreme-time {
  margin-top: 1px;
  color: var(--wx-muted);
  font-size: 0.68em;
  font-weight: 600;
  line-height: 1.3;
}

#currentwx-app .temperature-range-divider {
  line-height: 1.3;
}

#currentwx-app .conditions-list {
  margin: 0;
  padding: 18px 0 20px;
  border-top: 1px solid var(--wx-line);
  border-bottom: 1px solid var(--wx-line);
}

#currentwx-app .metric {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 31px;
  margin: 0;
  font-size: 1.05em;
  line-height: 1.5;
}

#currentwx-app .metric dt,
#currentwx-app .metric dd {
  float: none;
  width: auto;
  margin: 0;
  padding-block: 3px;
  color: #000;
  line-height: inherit;
}

#currentwx-app .metric dt {
  padding-right: 10px;
  text-align: right;
  font-weight: 400;
}

#currentwx-app .metric dd {
  min-height: 1.5em;
  padding-left: 10px;
  text-align: left;
  font-weight: 600;
}

#currentwx-app .metric.is-alert dt,
#currentwx-app .metric.is-alert dd {
  color: var(--wx-red);
  font-weight: 700;
}

#currentwx-app .tower-section,
#currentwx-app .soil-section {
  padding-top: 14px;
}

#currentwx-app .tower-section h3,
#currentwx-app .soil-section h3 {
  margin: 0 0 7px;
  color: #000;
  text-align: center;
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
  font-size: 1.35em;
  font-weight: 600;
  line-height: 1.2;
}

#currentwx-app .tower-list {
  border-bottom: 1px solid var(--wx-line);
}

#currentwx-app .soil-section {
  margin-top: 14px;
  padding-top: 0;
}

#currentwx-app .soil-section h3 {
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid var(--wx-line);
}

#currentwx-app .soil-data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-top: 14px;
}

#currentwx-app .soil-data-panel {
  min-width: 0;
}

#currentwx-app .soil-data-panel h4 {
  margin: 0;
  color: #000;
  text-align: center;
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
  font-size: 1.08em;
  font-weight: 700;
  line-height: 1.3;
}

#currentwx-app .soil-updated {
  margin: 2px 0 7px;
  color: var(--wx-muted);
  text-align: center;
  font-size: 0.78em;
  line-height: 1.4;
}

#currentwx-app .soil-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--wx-line);
  border-radius: 5px;
}

#currentwx-app .soil-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  background: var(--wx-surface);
  color: var(--wx-ink);
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
}

#currentwx-app .soil-table th,
#currentwx-app .soil-table td {
  padding: 5px 9px;
  border: 0;
  border-bottom: 1px solid var(--wx-line);
  text-align: right;
  white-space: nowrap;
}

#currentwx-app .soil-table th {
  background: var(--wx-surface-soft);
  color: #000;
  font-weight: 700;
}

#currentwx-app .soil-table th:first-child,
#currentwx-app .soil-table td:first-child {
  text-align: left;
}

#currentwx-app .soil-table tbody tr:last-child td {
  border-bottom: 0;
}

#currentwx-app .soil-temperature.is-freezing {
  color: var(--wx-freezing-blue);
  font-weight: 700;
}

#currentwx-app .station-photo-section {
  margin: 30px auto 0;
  text-align: center;
}

#currentwx-app .station-photo-section.is-pending {
  height: 0;
  margin: 0;
  overflow: hidden;
  visibility: hidden;
}

#currentwx-app .station-photo-section img {
  display: block;
  width: min(100%, 800px);
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  border: 1px solid var(--wx-line);
}

#currentwx-app .station-photo-section figcaption {
  padding-top: 8px;
  color: var(--wx-muted);
  font-size: 0.9em;
}

#currentwx-app .data-note {
  margin-top: 22px;
  color: var(--wx-muted);
  text-align: center;
  font-size: 0.9em;
  font-style: italic;
}

@media (max-width: 720px) {
  #currentwx-app {
    width: min(100% - 22px, 1120px);
  }

  #currentwx-app .picker-controls {
    grid-template-columns: 1fr;
  }

  #currentwx-app .station-heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  #currentwx-app .station-heading > div {
    width: 100%;
    padding-left: 0;
    text-align: center;
  }

  #currentwx-app .station-heading .button {
    align-self: center;
    margin: 7px auto 0;
  }

  #currentwx-app .updated-row {
    grid-template-columns: minmax(110px, 0.8fr) 1.2fr;
  }

  #currentwx-app .temperature-range {
    font-size: 1.2em;
  }

  #currentwx-app .conditions-list {
    padding: 10px 0 12px;
  }

  #currentwx-app .soil-data-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  #currentwx-app .metric {
    grid-template-columns: minmax(0, 44%) minmax(0, 56%);
    min-height: 28px;
    gap: 0;
    padding: 0;
    font-size: 1.05em;
    line-height: 1.25;
  }

  #currentwx-app .metric dt,
  #currentwx-app .metric dd {
    padding-block: 4px;
  }

  #currentwx-app .metric dt {
    padding-right: 7px;
    text-align: right;
    font-weight: 500;
  }

  #currentwx-app .metric dd {
    padding-left: 7px;
    text-align: left;
  }
}

@media (max-width: 430px) {
  #currentwx-app .station-tools {
    padding: 12px;
  }

  #currentwx-app .station-tool-buttons {
    grid-template-columns: 1fr 0.85fr 1.25fr;
    gap: 6px;
  }

  #currentwx-app .station-tool-button {
    min-height: 54px;
    padding: 7px 5px;
    font-size: 0.84em;
    line-height: 1.2;
  }

  #currentwx-app .metric {
    grid-template-columns: minmax(0, 44%) minmax(0, 56%);
    font-size: 1em;
  }

  #currentwx-app .metric dt,
  #currentwx-app .metric dd {
    padding-block: 3px;
  }

  #currentwx-app .soil-table {
    font-size: 0.86em;
  }

  #currentwx-app .soil-table th,
  #currentwx-app .soil-table td {
    padding: 5px 6px;
  }
}
