/* KernelInk weather process: a compact environmental monitor for the home IDE. */
.nb-weather-slot {
  display: flex;
  min-width: 0;
  align-items: stretch;
}

.nb-weather-slot > .nb-weather-widget {
  flex: 1 1 auto;
}

.nb-weather-widget {
  --weather-cyan: var(--syntax-cyan, #79c0ff);
  --weather-blue: var(--syntax-blue, #82aaff);
  --weather-amber: var(--syntax-amber, #ffc466);
  position: relative;
  isolation: isolate;
  width: 100%;
  min-width: 0;
  min-height: 226px;
  overflow: hidden;
  border: 1px solid var(--line, rgba(148, 163, 184, 0.18));
  border-radius: var(--radius-control, 7px);
  background:
    radial-gradient(circle at 84% 28%, rgba(121, 192, 255, 0.09), transparent 34%),
    linear-gradient(145deg, rgba(var(--accent-rgb, 126, 231, 135), 0.045), transparent 48%),
    var(--editor-code, #08110f);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    inset 0 -1px 0 rgba(0, 0, 0, 0.22);
  color: var(--text, #e6edf3);
  font-family: var(--font-mono, "Cascadia Code", "SFMono-Regular", Consolas, monospace);
  contain: layout paint;
}

.nb-weather-widget::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 3px,
    rgba(255, 255, 255, 0.012) 3px,
    rgba(255, 255, 255, 0.012) 4px
  );
  content: "";
  opacity: 0.45;
  pointer-events: none;
}

.nb-weather-widget::after {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  width: 42px;
  height: 2px;
  background: var(--accent, #7ee787);
  box-shadow: 42px 0 0 rgba(var(--accent-rgb, 126, 231, 135), 0.25);
  content: "";
  pointer-events: none;
}

.nb-weather-scene,
.nb-weather-grid {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.nb-weather-scene {
  display: block;
}

.nb-weather-grid {
  background-image:
    linear-gradient(rgba(121, 192, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 192, 255, 0.026) 1px, transparent 1px);
  background-position: right top;
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(90deg, transparent 12%, #000 70%);
  mask-image: linear-gradient(90deg, transparent 12%, #000 70%);
  opacity: 0.58;
}

.nb-weather-head,
.nb-weather-core,
.nb-weather-metrics,
.nb-weather-foot,
.nb-weather-noscript {
  position: relative;
  z-index: 3;
}

.nb-weather-head {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 14px;
  border-bottom: 1px solid var(--line, rgba(148, 163, 184, 0.18));
  background: rgba(7, 17, 15, 0.58);
}

.nb-weather-eyebrow,
.nb-weather-sync,
.nb-weather-location,
.nb-weather-temperature,
.nb-weather-condition,
.nb-weather-updated {
  margin: 0;
}

.nb-weather-eyebrow,
.nb-weather-sync {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--text-dim, #80908a);
  font-size: 0.56rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.nb-weather-eyebrow {
  color: var(--weather-cyan);
}

.nb-weather-eyebrow > i,
.nb-weather-sync > i {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(121, 192, 255, 0.08);
}

.nb-weather-sync {
  justify-content: flex-end;
  overflow: hidden;
  text-align: right;
  white-space: nowrap;
}

.nb-weather-sync > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nb-weather-widget.is-loading .nb-weather-sync > i,
.nb-weather-widget.is-locating .nb-weather-sync > i {
  animation: nb-weather-pulse 1.25s ease-in-out infinite;
  color: var(--weather-blue);
}

.nb-weather-widget.is-ready .nb-weather-sync > i {
  color: var(--accent, #7ee787);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 126, 231, 135), 0.09);
}

.nb-weather-widget.is-stale .nb-weather-sync > i,
.nb-weather-widget.is-error .nb-weather-sync > i {
  color: var(--weather-amber);
  box-shadow: 0 0 0 3px rgba(255, 196, 102, 0.08);
}

.nb-weather-core {
  display: grid;
  min-height: 104px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 12px 14px 10px;
  gap: 16px;
}

.nb-weather-reading {
  min-width: 0;
}

.nb-weather-location {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: var(--text-soft, #b7c4bf);
  font-size: 0.67rem;
  font-weight: 720;
  line-height: 1.35;
}

.nb-weather-location svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--accent-strong, #7ee787);
}

.nb-weather-location > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-weather-location small {
  flex: 0 0 auto;
  padding-left: 6px;
  border-left: 1px solid var(--line, rgba(148, 163, 184, 0.18));
  color: var(--text-dim, #80908a);
  font-size: 0.5rem;
  font-weight: 600;
}

.nb-weather-temperature {
  display: flex;
  align-items: flex-start;
  margin-top: 2px;
  color: var(--text, #e6edf3);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
  line-height: 0.92;
}

.nb-weather-temperature strong {
  font-family: var(--font-mono, "Cascadia Code", Consolas, monospace);
  font-size: clamp(2.45rem, 5.2vw, 4rem);
  font-weight: 560;
}

.nb-weather-temperature span {
  margin: 4px 0 0 4px;
  color: var(--weather-cyan);
  font-size: 0.72rem;
  font-weight: 720;
  letter-spacing: 0;
}

.nb-weather-condition {
  margin-top: 5px;
  color: var(--weather-cyan);
  font-size: 0.69rem;
  font-weight: 720;
  line-height: 1.3;
}

.nb-weather-glyph {
  display: grid;
  width: clamp(74px, 11vw, 104px);
  justify-items: center;
  gap: 5px;
  color: var(--weather-cyan);
}

.nb-weather-glyph svg {
  width: clamp(52px, 7vw, 68px);
  height: clamp(52px, 7vw, 68px);
  overflow: visible;
  filter: drop-shadow(0 0 14px rgba(121, 192, 255, 0.12));
}

.nb-weather-widget.is-ready .nb-weather-glyph svg {
  animation: nb-weather-icon-in 320ms cubic-bezier(0.22, 0.8, 0.2, 1) both;
}

.nb-weather-glyph code {
  color: var(--text-dim, #80908a);
  font-family: inherit;
  font-size: 0.47rem;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.nb-weather-metrics {
  display: grid;
  min-height: 49px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line, rgba(148, 163, 184, 0.18));
  border-bottom: 1px solid var(--line, rgba(148, 163, 184, 0.18));
  background: rgba(7, 17, 15, 0.31);
}

.nb-weather-metrics > div {
  display: grid;
  min-width: 0;
  align-content: center;
  padding: 7px 10px;
  gap: 3px;
}

.nb-weather-metrics > div + div {
  border-left: 1px solid var(--line, rgba(148, 163, 184, 0.18));
}

.nb-weather-metrics dt {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  color: var(--text-dim, #80908a);
  font-size: 0.49rem;
  font-weight: 650;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.nb-weather-metrics dt svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  color: var(--weather-blue);
}

.nb-weather-metrics dd {
  margin: 0;
  overflow: hidden;
  color: var(--text-soft, #b7c4bf);
  font-size: 0.61rem;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-weather-foot {
  display: grid;
  min-height: 36px;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  align-items: center;
  padding: 4px 9px;
  gap: 9px;
  color: var(--text-dim, #80908a);
  font-size: 0.49rem;
}

.nb-weather-locate {
  display: inline-flex;
  min-width: 0;
  min-height: 27px;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  gap: 5px;
  border: 1px solid var(--line, rgba(148, 163, 184, 0.18));
  border-radius: 4px;
  background: var(--editor-active, rgba(255, 255, 255, 0.035));
  color: var(--text-soft, #b7c4bf);
  cursor: pointer;
  font: inherit;
  font-weight: 680;
  line-height: 1;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, transform 120ms ease;
}

.nb-weather-locate svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  color: var(--weather-cyan);
}

.nb-weather-locate > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-weather-locate:hover {
  border-color: var(--line-accent, rgba(126, 231, 135, 0.42));
  background: rgba(var(--accent-rgb, 126, 231, 135), 0.06);
  color: var(--text, #e6edf3);
}

.nb-weather-locate:focus-visible {
  outline: 2px solid var(--accent-strong, #7ee787);
  outline-offset: 2px;
}

.nb-weather-locate:active {
  transform: translateY(1px);
}

.nb-weather-locate:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.nb-weather-updated {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  overflow: hidden;
  white-space: nowrap;
}

.nb-weather-updated time {
  overflow: hidden;
  color: var(--text-soft, #b7c4bf);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.nb-weather-source {
  min-height: 24px;
  padding: 6px 4px 4px;
  border-bottom: 1px solid transparent;
  color: var(--weather-blue) !important;
  line-height: 1;
  text-decoration: none;
}

.nb-weather-source:hover,
.nb-weather-source:focus-visible {
  border-bottom-color: currentColor;
  color: var(--weather-cyan) !important;
}

.nb-weather-source:focus-visible {
  outline: 2px solid var(--accent-strong, #7ee787);
  outline-offset: 1px;
}

.nb-weather-noscript {
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--line, rgba(148, 163, 184, 0.18));
  color: var(--weather-amber);
  font-size: 0.58rem;
}

html[data-theme="light"] .nb-weather-widget {
  background:
    radial-gradient(circle at 84% 28%, rgba(28, 109, 155, 0.1), transparent 34%),
    linear-gradient(145deg, rgba(var(--accent-rgb, 36, 118, 58), 0.055), transparent 48%),
    var(--editor-code, #f4f7f5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

html[data-theme="light"] .nb-weather-widget::before {
  background: repeating-linear-gradient(180deg, transparent 0, transparent 3px, rgba(12, 42, 32, 0.02) 3px, rgba(12, 42, 32, 0.02) 4px);
}

html[data-theme="light"] .nb-weather-head,
html[data-theme="light"] .nb-weather-metrics {
  background: rgba(239, 246, 242, 0.66);
}

@keyframes nb-weather-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes nb-weather-icon-in {
  from { opacity: 0.3; transform: translateY(3px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* The desktop workbench owns a fixed first-screen height. Compact the weather
   process itself instead of making the surrounding editor scroll. */
@media (min-width: 821px) and (max-height: 1120px) {
  .nb-workbench-main .nb-weather-widget {
    display: grid;
    height: clamp(148px, 16vh, 176px);
    height: clamp(148px, 16dvh, 176px);
    min-height: 0;
    grid-template-rows: 28px minmax(0, 1fr) 32px 26px;
  }

  .nb-workbench-main .nb-weather-head {
    min-height: 0;
    padding-inline: 9px;
    gap: 9px;
  }

  .nb-workbench-main .nb-weather-core {
    min-height: 0;
    padding: 4px 10px 3px;
    gap: 8px;
  }

  .nb-workbench-main .nb-weather-temperature strong {
    font-size: 2rem;
  }

  .nb-workbench-main .nb-weather-temperature span {
    margin-top: 2px;
  }

  .nb-workbench-main .nb-weather-location {
    font-size: 0.59rem;
  }

  .nb-workbench-main .nb-weather-condition {
    margin-top: 3px;
    font-size: 0.61rem;
  }

  .nb-workbench-main .nb-weather-glyph {
    width: 58px;
    gap: 2px;
  }

  .nb-workbench-main .nb-weather-glyph svg {
    width: 40px;
    height: 40px;
  }

  .nb-workbench-main .nb-weather-metrics {
    min-height: 0;
  }

  .nb-workbench-main .nb-weather-metrics > div {
    padding: 3px 7px;
    gap: 1px;
  }

  .nb-workbench-main .nb-weather-foot {
    min-height: 0;
    padding: 1px 7px;
    gap: 6px;
  }

  .nb-workbench-main .nb-weather-locate {
    min-height: 22px;
    padding-block: 2px;
  }
}

@media (min-width: 821px) and (max-height: 850px) {
  .nb-workbench-main .nb-weather-widget {
    height: 136px;
    grid-template-rows: 26px minmax(0, 1fr) 30px 24px;
  }

  .nb-workbench-main .nb-weather-head {
    padding-inline: 8px;
  }

  .nb-workbench-main .nb-weather-core {
    padding: 2px 8px;
    gap: 6px;
  }

  .nb-workbench-main .nb-weather-location small,
  .nb-workbench-main .nb-weather-glyph code,
  .nb-workbench-main .nb-weather-updated > span {
    display: none;
  }

  .nb-workbench-main .nb-weather-temperature strong {
    font-size: 1.8rem;
  }

  .nb-workbench-main .nb-weather-glyph {
    width: 50px;
  }

  .nb-workbench-main .nb-weather-glyph svg {
    width: 35px;
    height: 35px;
  }

  .nb-workbench-main .nb-weather-metrics > div {
    padding: 2px 6px;
  }

  .nb-workbench-main .nb-weather-metrics dt {
    font-size: 0.45rem;
  }

  .nb-workbench-main .nb-weather-metrics dd {
    font-size: 0.55rem;
  }

  .nb-workbench-main .nb-weather-foot {
    padding-inline: 6px;
  }

  .nb-workbench-main .nb-weather-locate {
    min-height: 20px;
  }
}

@media (min-width: 821px) and (max-height: 680px) {
  .nb-workbench-main .nb-weather-widget {
    height: clamp(104px, 17vh, 112px);
    height: clamp(104px, 17dvh, 112px);
    grid-template-rows: 24px minmax(0, 1fr) 22px;
  }

  .nb-workbench-main .nb-weather-core {
    padding-block: 1px;
  }

  .nb-workbench-main .nb-weather-temperature strong {
    font-size: 1.65rem;
  }

  .nb-workbench-main .nb-weather-condition {
    margin-top: 1px;
    font-size: 0.56rem;
  }

  .nb-workbench-main .nb-weather-glyph {
    width: 46px;
  }

  .nb-workbench-main .nb-weather-glyph svg {
    width: 32px;
    height: 32px;
  }

  .nb-workbench-main .nb-weather-metrics {
    display: none;
  }

  .nb-workbench-main .nb-weather-foot {
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
    font-size: 0.45rem;
  }

  .nb-workbench-main .nb-weather-locate {
    min-height: 19px;
    padding-inline: 5px;
  }
}

@media (max-width: 620px) {
  .nb-weather-widget {
    min-height: 218px;
  }

  .nb-weather-head {
    padding-inline: 10px;
  }

  .nb-weather-core {
    min-height: 99px;
    padding-inline: 11px;
    gap: 9px;
  }

  .nb-weather-temperature strong {
    font-size: clamp(2.3rem, 14vw, 3.2rem);
  }

  .nb-weather-glyph {
    width: 70px;
  }

  .nb-weather-location small {
    display: none;
  }

  .nb-weather-metrics > div {
    padding-inline: 7px;
  }

  .nb-weather-foot {
    gap: 6px;
  }
}

@media (max-width: 390px) {
  .nb-weather-eyebrow,
  .nb-weather-sync {
    font-size: 0.5rem;
    letter-spacing: 0.045em;
  }

  .nb-weather-sync {
    max-width: 44%;
  }

  .nb-weather-locate {
    max-width: 118px;
  }

  .nb-weather-updated > span {
    display: none;
  }

  .nb-weather-metrics dt {
    font-size: 0.46rem;
  }

  .nb-weather-metrics dd {
    font-size: 0.56rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nb-weather-widget *,
  .nb-weather-widget *::before,
  .nb-weather-widget *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .nb-weather-widget,
  .nb-weather-head,
  .nb-weather-metrics,
  .nb-weather-metrics > div + div,
  .nb-weather-locate {
    border-color: CanvasText;
  }

  .nb-weather-grid,
  .nb-weather-scene {
    display: none;
  }
}

/* Fill the workbench track selected by features.css. Height-based rules above
   still control the compact internal typography; the surrounding editor never
   needs its own scrollbar. */
@media (min-width: 821px) {
  .nb-workbench-main .nb-weather-slot {
    align-self: stretch;
  }

  .nb-workbench-main .nb-weather-slot > .nb-weather-widget {
    height: 100%;
    min-height: 0;
  }
}

@media (min-width: 821px) and (min-height: 1121px) {
  .nb-workbench-main .nb-weather-slot > .nb-weather-widget {
    display: grid;
    grid-template-rows: 36px minmax(104px, 1fr) 49px 36px;
  }
}
