/* void family: the canvas fills the viewport, one floating translucent card,
   ui fades on idle. density tight; radius 12 card, 8 controls, 6 thumbnails;
   a hairline-bordered glass card with one ambient shadow, flat hairline panes
   inside it. */

#stage {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  background: var(--bg);
}

#stage:active {
  cursor: grabbing;
}

#stage:focus-visible {
  outline-offset: -4px;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 12px;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* identity: ANT set tight in Geologica semibold, one mint dot after it like a
   live-status marker */
.wordmark {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 5;
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  pointer-events: none;
}

.wordmark::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hud {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  gap: var(--gap);
  transition: opacity 0.4s ease;
}

.hud[data-idle="true"] {
  opacity: 0.2;
}

.hud:focus-within {
  opacity: 1;
}

.icon-btn {
  width: var(--target);
  height: var(--target);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.icon-btn[aria-pressed="true"] {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--accent-ink);
}

.panel {
  position: fixed;
  top: 68px;
  right: 12px;
  z-index: 6;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100vh - 68px - 40px);
  max-height: calc(100dvh - 68px - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: var(--pad);
  transition: opacity 0.4s ease;
}

.panel[data-idle="true"] {
  opacity: 0.3;
}

.panel:focus-within {
  opacity: 1;
}

.panel[hidden] {
  display: none;
}

.panel:focus {
  outline: none;
}

.panel h2 {
  margin: 0 0 var(--gap);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.group {
  padding-bottom: var(--pad);
  margin-bottom: var(--pad);
  border-bottom: 1px solid var(--border);
}

.group:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.btn {
  min-height: var(--target);
  min-width: var(--target);
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn[aria-pressed="true"],
.btn.primary {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--accent-ink);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.field {
  display: block;
  margin-bottom: var(--gap);
}

/* label left, live value right (Squarespace and Claude pattern) */
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--gap);
  font-size: 13px;
  margin-bottom: 4px;
}

.label-row .value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

select,
.text-input {
  width: 100%;
  min-height: var(--target);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--ink);
  padding: 0 10px;
  font-size: 14px;
}

input[type="range"] {
  display: block;
  width: 100%;
  min-height: var(--target);
  margin: 0;
  background: transparent;
  accent-color: var(--accent);
}

select option {
  background: var(--surface);
  color: var(--ink);
}

.hint {
  display: block;
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.status {
  margin: var(--gap) 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.status:empty {
  display: none;
}

.ant-list,
.gallery {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ant-row {
  margin-bottom: var(--pad);
}

.ant-head {
  display: flex;
  align-items: center;
  gap: var(--gap);
  margin-bottom: 4px;
}

.ant-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
}

.ant-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: var(--gap);
}

.btn.small {
  padding: 0 10px;
  font-size: 12px;
}

.rule-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field-error {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--danger);
}

.field-error:empty {
  display: none;
}

.gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

/* one tile per famous rule: thumbnail, rule, name, caption, note */
.tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  min-height: var(--target);
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.tile canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-xs);
  margin-bottom: 4px;
  background: var(--bg);
}

/* skeleton: a shimmer holds the thumbnail's place until its run has painted */
.tile canvas.is-loading {
  background: linear-gradient(100deg, var(--skeleton-a) 30%, var(--skeleton-b) 50%, var(--skeleton-a) 70%) var(--bg);
  background-size: 250% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

.tile-rule {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tile-name {
  font-size: 12px;
}

.tile-caption,
.tile-note {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.tile-caption {
  font-variant-numeric: tabular-nums;
}

/* the readout tile: the step count as a stat tile in a hairline pane, with a
   legend row of coloured ant dots and their rules beneath it */
.hero {
  display: grid;
  gap: 2px;
  margin-bottom: var(--pad);
  padding: 10px 12px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field);
}

.hero-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.hero-number {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  min-width: 0;
}

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 6px 0 0;
  padding: 6px 0 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.legend .swatch {
  width: 8px;
  height: 8px;
}

.legend .legend-rule {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmarks {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* name left, actions right (Zillow saved-search rows) */
.bookmark {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "thumb text" "actions actions";
  align-items: center;
  gap: 6px var(--gap);
  padding: var(--gap) 0;
  border-top: 1px solid var(--border);
}

.bookmark img {
  grid-area: thumb;
  display: block;
  border-radius: var(--radius-xs);
  background: var(--bg);
}

.bookmark-text {
  grid-area: text;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bookmark-name {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.bookmark-meta {
  font-size: 12px;
  color: var(--muted);
}

.bookmark-actions {
  grid-area: actions;
  display: flex;
  gap: var(--gap);
}

.bookmark-actions .btn {
  flex: 1;
}

.btn.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.empty h2,
.empty h3 {
  margin: 0 0 4px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.empty p {
  margin: 0 0 var(--gap);
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.notice {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
  text-align: center;
}

.notice[hidden] {
  display: none;
}

.notice-card {
  max-width: 420px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 24px;
}

.notice-card h1 {
  font-size: 18px;
  margin: 0 0 10px;
}

.notice-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 16px;
}

.notice-card p:last-child {
  margin-bottom: 0;
}

/* house footer: one link, muted, no hover styling */
footer.site-footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-size: 12px;
  white-space: nowrap;
}

footer.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  padding: 0 8px;
  color: var(--muted);
  text-decoration: none;
}

.notice-inline {
  margin: 0 0 var(--pad);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--field);
  font-size: 13px;
  line-height: 1.45;
}

.notice-inline[hidden] {
  display: none;
}

/* mobile first: on a phone the card is a bottom sheet so the trail stays visible */
@media (max-width: 560px) {
  .panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 48px;
    width: auto;
    max-height: 46vh;
    max-height: 46dvh;
  }

  .wordmark {
    top: 24px;
    left: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile canvas.is-loading {
    animation: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
