/* Layperson wizard — sits alongside style.css/Pico, adds only what the
   advanced page's stylesheet doesn't already cover. */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.advanced-link {
  font-size: 0.8rem;
  color: var(--pico-muted-color);
  white-space: nowrap;
}

/* --- Progress indicator --- */
.progress-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0.5rem 0 1.5rem;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pico-muted-border-color);
  transition: background 0.15s ease;
}

.progress-dot.active {
  background: var(--pico-primary);
}

.progress-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  line-height: 1;
  color: transparent;
  background: var(--pico-muted-border-color);
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.progress-check.active {
  background: var(--pico-primary);
  color: #ffffff;
}

.progress-label {
  font-size: 0.8rem;
  color: var(--pico-muted-color);
  margin-left: 0.25rem;
}

/* --- Wizard cards --- */
.wizard-card {
  display: none;
}

.wizard-card.visible {
  display: block;
}

.wizard-card h2 {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.wizard-card .card-subtitle {
  color: var(--pico-muted-color);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.wizard-nav button {
  width: auto;
  margin-bottom: 0;
}

/* --- Tappable option cards (area picker, date presets) --- */
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.option-card {
  border: 2px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 0.9rem 1rem;
  background: var(--pico-card-background-color);
  cursor: pointer;
  text-align: left;
  font-size: 0.9rem;
  color: var(--pico-color);
}

.option-card:hover {
  border-color: var(--pico-primary);
}

.option-card.selected {
  border-color: var(--pico-primary);
  background: var(--pico-primary-focus);
}

.option-card .option-title {
  font-weight: 600;
  display: block;
}

.option-card .option-sub {
  color: var(--pico-muted-color);
  font-size: 0.8rem;
}

/* --- Card 1: whole-country toggle + revealed selects, as one unified
   control instead of a big block next to a plain form. --- */
.area-toggle-row {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  margin-bottom: 0;
}

.switch-label input[type="checkbox"] {
  margin: 0;
}

.area-toggle-sub {
  font-size: 0.8rem;
  color: var(--pico-muted-color);
  margin: 0.35rem 0 0 0;
}

.area-select-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 1rem 1.25rem;
}

.area-select-row label {
  flex: 1 1 150px;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.area-note,
.offline-note {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
  margin-top: 0.5rem;
}

/* --- Card 2: date presets + custom range --- */
.custom-range-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: flex-end;
  margin-top: 1rem;
}

.custom-range-row label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
}

/* --- Card 3: two responsive views, same underlying data/colors.
   Mobile: bar is pure visual feedback (tiny pill, no text), editing
   happens via the stepper arrows in the legend above it.
   Desktop/tablet: the bar itself is the input — drag a divider. --- */
.card3-desktop {
  display: none;
}

.card3-mobile {
  display: block;
}

.card3-subtitle-desktop {
  display: none;
}

@media (min-width: 768px) {
  .card3-desktop {
    display: block;
  }
  .card3-mobile {
    display: none;
  }
  .card3-subtitle-mobile {
    display: none;
  }
  .card3-subtitle-desktop {
    display: block;
  }
}

.segbar {
  display: flex;
  width: 100%;
  height: 10px;
}

.segbar-wrap {
  margin-bottom: 1.25rem;
}

.segbar-mask {
  border-radius: 999px;
  overflow: hidden;
}

.card3-desktop .segbar-mask {
  border-radius: 10px;
}

.segbar .segment {
  min-width: 0;
  transition: flex-grow 0.15s ease;
}

/* Desktop bar is thicker, its dividers are draggable, and each segment
   shows its live percentage (mobile deliberately has no text on the bar —
   its editing surface is the stepper legend instead). */
.segbar-desktop {
  height: 56px;
}

.segbar-desktop .segment {
  display: flex;
  align-items: center;
  justify-content: center;
}

.segbar-desktop .seg-label {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
}

.segbar-desktop .divider {
  flex: 0 0 10px;
  background: var(--pico-background-color);
  cursor: col-resize;
  position: relative;
}

.segbar-desktop .divider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 24px;
  background: var(--pico-color);
  opacity: 0.35;
  border-radius: 1px;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.legend-row {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  transition: background 0.1s ease;
}

.legend-row:hover {
  background: var(--pico-card-sectioning-background-color, rgba(0, 0, 0, 0.02));
}

.legend-row-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex: 0 0 auto;
}

.legend-name {
  font-weight: 600;
  font-size: 1rem;
  flex: 1 1 auto;
}

/* Fixed-size, always-tappable stepper — deliberately decoupled from the
   bar, so a 2% category is exactly as easy to nudge as a 44% one. Bare
   arrows, no button chrome, so they read as controls, not buttons. */
.stepper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.stepper-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  box-shadow: none;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--pico-muted-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.stepper-btn:hover:not(:disabled) {
  color: var(--pico-primary);
  background: none;
}

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

.legend-pct {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.8rem;
  color: var(--pico-muted-color);
  flex: 0 0 auto;
  min-width: 3.2em;
  text-align: center;
}

.legend-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.25rem 0 0 1.6rem;
}

.legend-sub {
  color: var(--pico-muted-color);
  font-size: 0.78rem;
  margin: 0;
}

.legend-chevron {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--pico-muted-color);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 0;
  padding-bottom: 1px; /* optical nudge: +/− glyphs sit slightly high otherwise */
  border: 1px solid var(--pico-muted-border-color);
}

.legend-chevron.open {
  color: var(--pico-primary);
  border-color: var(--pico-primary);
}

/* Desktop/tablet: chevron reads better right next to the text it toggles,
   not stranded at the far edge of the row — and can afford to be bigger.
   Everything else in the legend scales up proportionally too, since
   desktop has the room and the mobile sizes were tuned for a narrow
   screen. */
@media (min-width: 768px) {
  .legend-sub-row {
    justify-content: flex-start;
  }
  .legend-name {
    font-size: 1.15rem;
  }
  .legend-pct {
    font-size: 0.95rem;
  }
  .legend-swatch {
    width: 16px;
    height: 16px;
  }
  .legend-sub {
    font-size: 0.9rem;
  }
  .legend-chevron {
    width: 22px;
    height: 22px;
    font-size: 0.95rem;
    margin-left: 0.5rem;
  }
  .legend-chip {
    font-size: 0.85rem;
  }
  .legend-row {
    padding: 0.75rem 1rem;
  }
}

.legend-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.6rem 0 0 1.6rem;
}

.legend-chip {
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  color: #ffffff;
}

.result-panel {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  text-align: center;
}

.result-period {
  font-size: 0.8rem;
  color: var(--pico-muted-color);
  margin: 0 0 0.75rem;
}

.result-panel .bignum-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.result-panel .bignum-label {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
  display: block;
  margin-bottom: 0.15rem;
}

.result-panel .bignum {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 1.6rem;
  font-weight: 600;
}

.money-example {
  font-size: 1.05rem;
  margin: 0.5rem 0 0.25rem;
}

.money-example strong {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

.money-example-sub {
  font-size: 0.8rem;
  color: var(--pico-muted-color);
  margin: 0 0 1rem;
}

.result-explainer {
  font-size: 0.9rem;
  color: var(--pico-muted-color);
  max-width: 50ch;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .option-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* iPad-range viewports: Pico caps .container at a fixed max-width at this
   breakpoint (not just padding), which is what was actually causing the
   huge dead margins on both sides — override both. */
@media (min-width: 768px) and (max-width: 1024px) {
  header.container,
  main.container {
    max-width: 100%;
    padding-inline: 1.25rem;
  }
}
