/* BoulderCAST seasonal snowfall widget (snow-widget.js builds it): two
   snow stakes on a winter night, buried to this season's snowfall.
   The WP Dark Mode plugin rewrites the colors of every rule it can read but
   leaves rules inside @container alone, so the widget is a container and its
   styles sit in one query that always matches. The card is a night scene in
   both of the site's modes; dark mode only adds an edge to it. */

/* Out here because @container rules reach only what's inside the box, not
   the box itself (no colors, so nothing for the plugin to change) */
.bcsn {
  container-type: inline-size;
  position: relative;
  margin: 0 0 1.5em;
}

/* Falling snow and rising piles (no colors) */
@keyframes bcsn-fall {
  from { transform: translate3d(0, -12px, 0); }
  to { transform: translate3d(var(--sx, 0px), 560px, 0); }
}

@container (min-width: 0px) {

.bcsn .bcsn-card {
  --bcsn-text: #F3F8FD;
  --bcsn-muted: #A9C0D6;
  --bcsn-faint: rgba(255, 255, 255, 0.14);
  --bcsn-stake-a: #E2412F;
  --bcsn-stake-b: #F4F7FA;
  --bcsn-snow-top: #FFFFFF;
  --bcsn-snow-bot: #C9DDF0;
  --bcsn-normal: #FFC857;
  --bcsn-above: #8FD0FF;
  --bcsn-below: #FFB25C;
  --bcsn-even: #C8D6E4;

  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 16px 16px 12px;
  border-radius: 14px;
  color: var(--bcsn-text);
  background:
    radial-gradient(120% 70% at 85% 0%, rgba(120, 170, 230, 0.28), transparent 60%),
    linear-gradient(180deg, #0A182B 0%, #12294A 55%, #1B3A63 100%);
  box-shadow: 0 6px 22px rgba(10, 24, 43, 0.28);
  font-family: "Barlow Semi Condensed", "Barlow", Ubuntu, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.25;
  text-align: left;
}
html[data-wp-dark-mode-active] .bcsn .bcsn-card {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 6px 22px rgba(0, 0, 0, 0.4);
}

/* ---------- Falling snow ---------- */

.bcsn .bcsn-flakes { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.bcsn .bcsn-flakes i {
  position: absolute;
  top: -8px;
  left: var(--x);
  width: var(--z);
  height: var(--z);
  border-radius: 50%;
  background: #FFFFFF;
  opacity: var(--o);
  animation: bcsn-fall var(--d) linear var(--w) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .bcsn .bcsn-flakes i { animation: none; top: calc(var(--o) * 90%); }
}

/* ---------- Heading ---------- */

.bcsn .bcsn-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.bcsn .bcsn-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.bcsn .bcsn-icon svg { width: 24px; height: 24px; display: block; }
.bcsn .bcsn-card[data-state="ready"] .bcsn-icon svg { animation: bcsn-spin 24s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  .bcsn .bcsn-card[data-state="ready"] .bcsn-icon svg { animation: none; }
}
.bcsn .bcsn-kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bcsn-muted);
}
.bcsn .bcsn-title {
  margin: 0;
  padding: 0;
  border: 0;
  font-family: inherit;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--bcsn-text);
  text-transform: none;
  background: none;
}

/* ---------- The scene: stakes in the snow ---------- */

.bcsn .bcsn-scene {
  position: relative;
  height: 210px;
  margin: 0 -16px;
}
.bcsn .bcsn-peaks {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  height: 92px;
  background: linear-gradient(180deg, rgba(160, 195, 235, 0.22), rgba(160, 195, 235, 0.06));
  /* Flatiron-style slabs leaning east */
  clip-path: polygon(0 100%, 0 62%, 9% 40%, 15% 55%, 24% 18%, 33% 48%, 40% 30%, 47% 52%, 58% 8%, 70% 50%, 78% 34%, 88% 56%, 95% 42%, 100% 50%, 100% 100%);
}
.bcsn .bcsn-peaks-front {
  height: 56px;
  background: linear-gradient(180deg, rgba(10, 24, 43, 0.75), rgba(10, 24, 43, 0.9));
  clip-path: polygon(0 100%, 0 70%, 12% 30%, 18% 52%, 30% 12%, 36% 40%, 52% 26%, 63% 58%, 74% 20%, 82% 46%, 100% 30%, 100% 100%);
}
.bcsn .bcsn-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14px;
  background: linear-gradient(180deg, #2B3B4E, #1A2633);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.08);
}

/* Inch marks up the left side */
.bcsn .bcsn-axis {
  position: absolute;
  left: 16px;
  width: 28px;
  top: 12px;
  bottom: 14px;
}
.bcsn .bcsn-axis span {
  position: absolute;
  right: 0;
  bottom: var(--at);
  transform: translateY(50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--bcsn-muted);
  opacity: 0.85;
}
.bcsn .bcsn-axis span:first-child { transform: translateY(0); }

.bcsn .bcsn-cols {
  position: absolute;
  left: 48px;
  right: 12px;
  top: 12px;
  bottom: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.bcsn .bcsn-col { position: relative; --stake-x: 30%; }

/* A snow stake: red and white, a stripe per foot */
.bcsn .bcsn-stake {
  position: absolute;
  left: var(--stake-x);
  bottom: 0;
  height: 100%;
  width: 11px;
  transform: translateX(-50%);
  border-radius: 3px 3px 0 0;
  background: repeating-linear-gradient(0deg, var(--bcsn-stake-a) 0 var(--band), var(--bcsn-stake-b) var(--band) calc(var(--band) * 2));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 2px 0 0 rgba(0, 0, 0, 0.18) inset;
}
.bcsn .bcsn-stake::after {
  /* the cap */
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  top: -4px;
  height: 5px;
  border-radius: 3px;
  background: var(--bcsn-stake-a);
}

/* The snow it's buried in */
.bcsn .bcsn-pile {
  position: absolute;
  left: var(--stake-x);
  bottom: 0;
  width: 92px;
  height: 0;
  transform: translateX(-50%);
  /* a drift with a nearly flat top, so its height reads true on the stake */
  border-radius: 38px 48px 0 0 / 8px 12px 0 0;
  background: linear-gradient(180deg, var(--bcsn-snow-top) 0%, var(--bcsn-snow-bot) 100%);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.9), 0 -2px 12px rgba(190, 220, 255, 0.35);
  transition: height 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s;
}
.bcsn .bcsn-card[data-state="ready"] .bcsn-pile { height: max(var(--fill), 0px); }
@media (prefers-reduced-motion: reduce) {
  .bcsn .bcsn-pile { transition: none; }
}

/* Normal snowfall by today: a dashed mark across the stake */
.bcsn .bcsn-norm {
  position: absolute;
  left: calc(var(--stake-x) - 16px);
  right: 0;
  bottom: var(--at);
  height: 0;
  border-top: 2px dashed var(--bcsn-normal);
  z-index: 2;
}
.bcsn .bcsn-norm span {
  position: absolute;
  left: 26px;
  bottom: 3px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.45;
  white-space: nowrap;
  color: var(--bcsn-normal);
  /* readable on the night sky and on the snow alike */
  background: rgba(10, 24, 43, 0.82);
}

/* A normal whole season: a pennant on the stake */
.bcsn .bcsn-flag {
  position: absolute;
  left: calc(var(--stake-x) + 6px);
  bottom: var(--at);
  transform: translateY(50%);
  padding: 1px 6px 1px 9px;
  font-size: 10px;
  white-space: nowrap;
  color: #0A182B;
  background: rgba(255, 255, 255, 0.88);
  clip-path: polygon(0 50%, 7px 0, 100% 0, 100% 100%, 7px 100%);
  z-index: 2;
}
.bcsn .bcsn-flag b { font-weight: 700; }

/* ---------- Totals ---------- */

.bcsn .bcsn-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 0;
}
.bcsn .bcsn-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 8px 10px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px var(--bcsn-faint);
  color: var(--bcsn-text);
  text-decoration: none;
  transition: background 0.15s;
}
.bcsn a.bcsn-stat:hover,
.bcsn a.bcsn-stat:focus-visible { background: rgba(255, 255, 255, 0.13); color: var(--bcsn-text); text-decoration: none; }
.bcsn .bcsn-city {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bcsn-muted);
}
.bcsn .bcsn-num {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  margin: 2px 0 4px;
  font-variant-numeric: tabular-nums;
  color: #FFFFFF;
  text-shadow: 0 2px 14px rgba(150, 200, 255, 0.35);
}
.bcsn .bcsn-in { font-size: 0.7em; vertical-align: 0.32em; margin-left: 1px; opacity: 0.85; }
.bcsn .bcsn-delta {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: #0A182B;
}
.bcsn .bcsn-delta.is-above { background: var(--bcsn-above); }
.bcsn .bcsn-delta.is-below { background: var(--bcsn-below); }
.bcsn .bcsn-delta.is-even { background: var(--bcsn-even); }
.bcsn .bcsn-last { margin-top: 5px; font-size: 12px; color: var(--bcsn-muted); }

/* ---------- How this start ranks ---------- */

.bcsn .bcsn-notes {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.bcsn .bcsn-notes li {
  position: relative;
  margin: 0 0 5px;
  padding: 0 0 0 14px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--bcsn-text);
  list-style: none;
  background: none;
}
.bcsn .bcsn-notes li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bcsn-above);
}
.bcsn .bcsn-notes b { color: #FFFFFF; font-weight: 700; }

/* ---------- Footer ---------- */

.bcsn .bcsn-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 10px;
  margin: 10px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--bcsn-faint);
  font-size: 11.5px;
  color: var(--bcsn-muted);
}
.bcsn .bcsn-more {
  font-weight: 700;
  color: var(--bcsn-above);
  text-decoration: none;
  white-space: nowrap;
}
.bcsn .bcsn-more:hover { color: #FFFFFF; text-decoration: underline; }
.bcsn .bcsn-more[hidden] { display: none; }
.bcsn .bcsn-foot-r {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* The gear, bottom right */
.bcsn .bcsn-gear {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -4px -4px -4px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--bcsn-muted);
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, transform 0.4s;
}
.bcsn .bcsn-gear svg { width: 17px; height: 17px; display: block; }
.bcsn .bcsn-gear:hover,
.bcsn .bcsn-gear:focus-visible,
.bcsn .bcsn-gear[aria-expanded="true"] { color: #FFFFFF; background: rgba(255, 255, 255, 0.12); }
.bcsn .bcsn-gear:hover { transform: rotate(45deg); }
.bcsn .bcsn-gear:focus-visible { outline: 2px solid var(--bcsn-above); outline-offset: 1px; }

/* The city picker, over the card */
.bcsn .bcsn-pick {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  background: rgba(6, 16, 30, 0.72);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.bcsn .bcsn-pick[hidden] { display: none; }
.bcsn .bcsn-pick-box {
  width: 100%;
  padding: 14px 14px 12px;
  border-radius: 12px;
  background: #13294A;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 10px 30px rgba(0, 0, 0, 0.45);
}
.bcsn .bcsn-pick-title {
  margin: 0 0 10px;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: #FFFFFF;
}
.bcsn .bcsn-pick-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0 0 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bcsn-muted);
}
.bcsn .bcsn-pick select {
  width: 100%;
  height: auto;
  margin: 0;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #FFFFFF;
  background: #0A182B;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  cursor: pointer;
}
.bcsn .bcsn-pick select:focus-visible { outline: 2px solid var(--bcsn-above); outline-offset: 1px; }
.bcsn .bcsn-pick option { color: #FFFFFF; background: #0A182B; }
.bcsn .bcsn-pick-note { margin: 0 0 10px; padding: 0; font-size: 12px; color: var(--bcsn-muted); }
.bcsn .bcsn-pick-btns { display: flex; justify-content: space-between; gap: 8px; }
.bcsn .bcsn-pick-btns button {
  margin: 0;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.bcsn .bcsn-pick-reset { color: var(--bcsn-text); background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.bcsn .bcsn-pick-reset:hover { background: rgba(255, 255, 255, 0.18); }
.bcsn .bcsn-pick-done { color: #0A182B; background: var(--bcsn-above); }
.bcsn .bcsn-pick-done:hover { background: #FFFFFF; }

/* ---------- Loading and errors ---------- */

/* Before the first load the boxes are empty; on a reload (a new pick) the
   old ones stay put until the new ones are drawn */
.bcsn .bcsn-stats:empty,
.bcsn .bcsn-notes:empty,
.bcsn .bcsn-card[data-state="error"] .bcsn-stats,
.bcsn .bcsn-card[data-state="error"] .bcsn-notes { display: none; }

/* Narrow spots: smaller numbers so two fit side by side */
@container (max-width: 270px) {
  .bcsn .bcsn-num { font-size: 32px; }
  .bcsn .bcsn-delta { font-size: 11px; padding: 1px 5px; }
  .bcsn .bcsn-title { font-size: 21px; }
}

}

@keyframes bcsn-spin { to { transform: rotate(360deg); } }
