/* ============================================================
   HAPPENINGS TOOL — the 1st Orbit tool.

   Built on Weather's list spine + sky dial. Two states only,
   matching Weather: collapsed (a dense single line) and expanded
   (Today + Coming up). The dial is a supporting glyph on the
   right, in a LOCKED column so it never moves between rows.
   Monochrome by default; tone is at most a whisper on the glyph.
   ============================================================ */

.hp {
  --hp-dial: 40px;
  --hp-hide: 30px;
  --hp-city: 184px;
  --hp-gap: 16px;
  --hp-pad: 20px;
  --hp-indent: calc(var(--hp-pad) + 32px);
  --hp-warm: var(--accent-warm);
  --hp-serious: var(--error);
}
.hp .num { font-family: inherit; font-variant-numeric: tabular-nums; }

/* -----------------------------------------------------------
   STICKY TOOLBAR — jump rail (left) + expand-all (right)
   ----------------------------------------------------------- */
.hp-toolbar {
  position: sticky; top: 0; z-index: 6;
  display: flex; align-items: center; gap: 16px;
  margin: 0 -32px 6px;
  padding: 10px 32px;
  min-height: 58px;
  background: var(--app-bg);
  border-bottom: 1px solid transparent;
  transition: box-shadow var(--wing-duration) var(--ease), border-color var(--wing-duration) var(--ease);
}
.hp-toolbar.is-stuck {
  border-bottom-color: var(--app-border);
  box-shadow: 0 6px 18px -12px color-mix(in oklab, var(--app-text) 50%, transparent);
}
.hp-jumpbar { flex: 1 1 auto; min-width: 0; display: flex; }
.hp-toolbar__summary {
  flex: 1 1 auto; min-width: 0;
  font-size: 12.5px; font-weight: 500; color: var(--app-text-muted);
  font-variant-numeric: tabular-nums;
}
.hp-jumpbar__scroll {
  display: flex; gap: 4px; overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px 0;
}
.hp-jumpbar__scroll::-webkit-scrollbar { display: none; }
.hp-jchip {
  flex: 0 0 auto;
  padding: 6px 12px;
  background: transparent; border: 1px solid transparent; border-radius: 3px;
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--app-text-muted);
  cursor: pointer; white-space: nowrap;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.hp-jchip:hover { color: var(--app-text); background: var(--app-surface-2); }
.hp-jchip.is-active { color: var(--app-text); background: var(--app-surface); }

.hp-toolbar__toggle {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 10px; background: transparent;
  border: 1px solid var(--app-border); border-radius: 3px;
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--app-text-muted); cursor: pointer; white-space: nowrap;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.hp-toolbar__toggle:hover { color: var(--app-text); background: var(--app-surface); border-color: var(--app-border-strong); }
.hp-toolbar__toggle i { font-size: 14px; }

/* -----------------------------------------------------------
   LIST + ROW
   ----------------------------------------------------------- */
.hp-list {
  border-top: 1px solid var(--app-border);
  border-bottom: 1px solid var(--app-border);
}
.hp-row { border-top: 1px solid var(--app-border); position: relative; }
.hp-row:first-child { border-top: 0; }

.hp-barline { position: relative; }

.hp-bar {
  width: 100%; padding: 0; border: 0; background: transparent; text-align: left;
  cursor: pointer; font: inherit; color: inherit; display: block;
}
.hp-row.is-empty .hp-bar { cursor: default; }
.hp-bar:focus-visible { outline: 2px solid var(--orbit); outline-offset: -2px; }

.hp-band {
  display: grid;
  grid-template-columns: var(--hp-city) minmax(0, 1fr) var(--hp-dial) var(--hp-hide) 24px;
  gap: var(--hp-gap);
  align-items: center;
  padding: 13px var(--hp-pad);
  background: transparent;
}
.hp-bar:hover .hp-band { background: color-mix(in oklab, var(--orbit) 4%, var(--app-surface)); }
.hp-row.is-empty .hp-bar:hover .hp-band { background: transparent; }
.hp-row.is-expanded .hp-bar:hover .hp-band { background: linear-gradient(to bottom, color-mix(in oklab, var(--orbit) 4%, var(--app-surface)) 80%, transparent); }
.hp-row.is-expanded .hp-bar:hover .wx-dial__bead-bg { background: color-mix(in oklab, var(--orbit) 4%, var(--app-surface)); }

/* City (col 1) */
.hp-city { display: flex; align-items: center; gap: 11px; min-width: 0; }
.hp-city__flag { flex-shrink: 0; display: inline-flex; align-items: center; }
.hp-city__name { font-size: 15.5px; font-weight: 600; color: var(--app-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-city__here { display: inline-grid; place-items: center; width: 16px; height: 16px; color: var(--orbit); flex-shrink: 0; }
.hp-city__here i { font-size: 13px; }

/* Lead cell (col 2) */
.hp-lead-cell { min-width: 0; display: flex; align-items: center; }
.hp-clead {
  min-width: 0;
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: inherit;
  padding: 3px 8px; margin: -3px 0 -3px -8px; border-radius: var(--radius-sm);
  transition: background var(--fast) var(--ease);
}
.hp-clead:hover { background: color-mix(in oklab, var(--orbit) 4%, var(--app-surface)); }
.hp-clead--quiet { color: var(--app-text-subtle); cursor: default; }
.hp-clead--quiet:hover { background: transparent; }
.hp-clead__icon { flex-shrink: 0; font-size: 16px; color: var(--app-text-subtle); display: inline-grid; place-items: center; }
.hp-clead__text {
  min-width: 0; font-size: 14px; font-weight: 500; color: var(--app-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hp-clead:hover .hp-clead__text { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--app-border-strong); }
.hp-clead--quiet:hover .hp-clead__text { text-decoration: none; }
.hp-clead__when { flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--app-text-subtle); }

.hp-status {
  flex-shrink: 0; margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--app-text-muted);
  border: 1px solid var(--rule); border-radius: 3px;
  padding: 3px 8px; white-space: nowrap;
}
.hp-status i { font-size: 12px; color: var(--app-text-subtle); }

/* Dial (col 3) */
.hp-dial-cell { display: grid; place-items: center; width: var(--hp-dial); }
.hp-dial { position: relative; display: grid; place-items: center; }
.hp .wx-dial__bead-bg { transition: none; }
.hp-bar:hover .wx-dial__bead-bg { background: color-mix(in oklab, var(--orbit) 4%, var(--app-surface)); }
.hp-dial__tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(3px);
  padding: 2px 7px; border-radius: 4px;
  background: var(--app-text); color: var(--app-bg);
  font-size: 10.5px; font-weight: 600; white-space: nowrap;
  opacity: 0; pointer-events: none; z-index: 8;
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.hp-dial:hover .hp-dial__tip { opacity: 1; transform: translateX(-50%) translateY(0); }
.hp-row:first-child .hp-dial__tip {
  bottom: auto; top: calc(100% + 6px);
  transform: translateX(-50%) translateY(-3px);
}
.hp-row:first-child .hp-dial:hover .hp-dial__tip { transform: translateX(-50%) translateY(0); }

/* Chevron (col 5) */
.hp-chev {
  display: grid; place-items: center; width: 24px; height: 24px; color: var(--app-text-subtle);
  transition: transform var(--wing-duration) var(--ease), color var(--fast) var(--ease);
}
.hp-bar:hover .hp-chev { color: var(--app-text-muted); }
.hp-row.is-expanded .hp-chev { transform: rotate(180deg); color: var(--app-text); }
.hp-chev i { font-size: 15px; }

.hp-hide-slot { width: var(--hp-hide); pointer-events: none; }

.hp-row__hide {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  right: calc(var(--hp-pad) + 24px + var(--hp-gap) + (var(--hp-hide) - 28px) / 2);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--app-text-subtle);
  font-size: 15px; cursor: pointer;
  opacity: 0; z-index: 5;
  transition: opacity var(--fast) var(--ease), background var(--fast) var(--ease), color var(--fast) var(--ease);
}
@media (hover: hover) { .hp-row:hover .hp-row__hide { opacity: 1; } }
.hp-row__hide:focus-visible { opacity: 1; }
@media (hover: none) { .hp-row__hide { opacity: .5; } }
.hp-row__hide:hover { background: var(--accent-warm-soft); color: var(--accent-warm); }

.hp-restore {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 12px; padding: 6px 10px;
  border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--app-text-muted); border-radius: var(--radius-sm);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.hp-restore:hover { background: var(--app-surface-2); color: var(--app-text); }
.hp-restore i { font-size: 14px; }

/* -----------------------------------------------------------
   EXPANDED CONTENT
   ----------------------------------------------------------- */
.hp-body { padding: 0 var(--hp-pad) 18px var(--hp-indent); }
.hp-secs { display: grid; grid-template-columns: 1fr; gap: 18px; }
.hp-sec__head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.hp-sec__label {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--app-text-muted); font-weight: 600;
}
.hp-sec__rule { display: none; }
.hp-items { display: flex; flex-direction: column; gap: 2px; }

.hp-item {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 9px 10px;
  border-radius: var(--radius);
  text-decoration: none; color: inherit;
  transition: background var(--fast) var(--ease);
}
.hp-item:hover { background: color-mix(in oklab, var(--orbit) 4%, var(--app-surface)); }
.hp-item__icon {
  flex-shrink: 0; width: 22px; margin-top: 1px;
  display: grid; place-items: center;
  color: var(--app-text-subtle); font-size: 18px;
}
.hp-item__body { min-width: 0; flex: 1 1 auto; }
.hp-item__headline {
  font-size: 14px; font-weight: 600; color: var(--app-text); letter-spacing: -0.005em; text-wrap: pretty;
}
.hp-item:hover .hp-item__headline { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--app-border-strong); }
.hp-item__mean {
  margin-top: 3px; font-size: 12.5px; color: var(--app-text-muted); line-height: 1.5; text-wrap: pretty;
  padding-left: 9px;
  border-left: 1.5px solid var(--rule);
  transition: border-color var(--fast) var(--ease);
}
.hp-item:hover .hp-item__mean { border-left-color: color-mix(in oklab, var(--orbit) 55%, var(--rule)); }
.hp-when {
  flex-shrink: 0; align-self: flex-start; margin-top: 1px;
  font-size: 11.5px; font-weight: 600; color: var(--app-text-muted);
  background: var(--app-surface-2); padding: 3px 9px; border-radius: 3px; white-space: nowrap;
}
.hp-item__go {
  flex-shrink: 0; align-self: center; color: var(--app-text-subtle); font-size: 13px;
  opacity: 0; transform: translateX(-3px); transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.hp-item:hover .hp-item__go { opacity: 1; transform: translateX(0); }

/* -----------------------------------------------------------
   TONE — a whisper, only on the glyph, reserved for trouble
   ----------------------------------------------------------- */
html[data-hp-tone="subtle"] .hp-item[data-tone="disruptive"] .hp-item__icon,
html[data-hp-tone="subtle"] .hp-clead[data-tone="disruptive"] .hp-clead__icon { color: var(--hp-warm); }
html[data-hp-tone="subtle"] .hp-item[data-tone="serious"] .hp-item__icon,
html[data-hp-tone="subtle"] .hp-clead[data-tone="serious"] .hp-clead__icon { color: var(--hp-serious); }

/* -----------------------------------------------------------
   ANIMATED EXPAND
   ----------------------------------------------------------- */
.hp-expand {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--wing-duration) var(--ease);
}
.hp-expand.is-open { grid-template-rows: 1fr; }
.hp-expand__wrap { overflow: hidden; }

/* -----------------------------------------------------------
   CONFIGURE — future/paid teaser popover
   ----------------------------------------------------------- */
.hp-config { position: relative; }
.hp-config__pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 20;
  width: 300px;
  background: var(--app-surface);
  border: 1px solid var(--app-border); border-radius: 3px;
  box-shadow: 0 12px 32px -12px color-mix(in oklab, var(--app-text) 38%, transparent);
  padding: 14px;
}
.hp-config__badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--app-text-muted); background: var(--app-surface-2);
  padding: 3px 8px; border-radius: 3px; margin-bottom: 10px;
}
.hp-config__title { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.hp-config__desc { font-size: 12.5px; color: var(--app-text-muted); margin: 0 0 12px; line-height: 1.5; }
.hp-config__group { opacity: .55; pointer-events: none; }
.hp-config__glabel {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--app-text-subtle); margin: 12px 0 8px;
}
.hp-config__dial { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.hp-config__dial-name { flex: 0 0 76px; font-size: 12px; color: var(--app-text-muted); }
.hp-config__dial-track { flex: 1 1 auto; height: 4px; border-radius: 3px; background: var(--app-surface-2); position: relative; }
.hp-config__dial-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--app-text-subtle); }
.hp-config__dial-knob { position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%; background: var(--app-surface); border: 1.5px solid var(--app-text-subtle); transform: translate(-50%, -50%); }
.hp-config__box {
  margin-bottom: 8px; padding: 8px 10px;
  border: 1px solid var(--app-border); border-radius: var(--radius-sm);
  background: var(--app-bg); font-size: 12px; color: var(--app-text-subtle);
}
.hp-config__box b { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--app-text-muted); margin-bottom: 3px; }
.hp-config__box--never b { color: var(--hp-warm); }

/* -----------------------------------------------------------
   RESPONSIVE
   ----------------------------------------------------------- */
@media (max-width: 760px) {
  .hp-band {
    grid-template-columns: minmax(0, 1fr) var(--hp-dial) var(--hp-hide) 24px;
    grid-template-areas: "city dial hide chev" "lead dial hide chev";
    row-gap: 3px; align-items: center;
  }
  .hp-hide-slot { grid-area: hide; }
  .hp-city { grid-area: city; }
  .hp-lead-cell { grid-area: lead; }
  .hp-dial-cell { grid-area: dial; }
  .hp-chev { grid-area: chev; }
  .hp { --hp-indent: var(--hp-pad); }
}
@media (max-width: 520px) {
  .hp { --hp-pad: 15px; }
}

/* -----------------------------------------------------------
   SKELETON LOADING STATE
   ----------------------------------------------------------- */
@keyframes hp-shimmer {
  0% { opacity: 0.35; }
  50% { opacity: 0.55; }
  100% { opacity: 0.35; }
}
.hp-row--skeleton .hp-bar {
  pointer-events: none;
}
.hp-row--skeleton .hp-city__name {
  animation: hp-shimmer 1.6s ease-in-out infinite;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hp-expand { transition: none; }
  .hp-chev { transition: none; }
  .hp-dial__tip { transition: none; }
  .hp-item__go { transition: none; }
  .hp-toolbar { transition: none; }
  .hp-jchip { transition: none; }
  .hp-row--skeleton .hp-city__name { animation: none; }
}
