/* The guided first run at /app/start (src/routes/setup.ts), the resume card
   on /app and the "Finish setup" link on new site cards.
   Tokens come from site.css; nothing here sets a color of its own. */

.setup {
  max-width: 760px;
}

/* ---------- progress ---------- */

.setup-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.setup-step > a,
.setup-step > span {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  color: var(--text-dim);
  border-top: 3px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.setup-step > a:hover {
  color: var(--text);
}

.setup-step.is-current > a,
.setup-step.is-current > span {
  color: var(--text);
  border-top-color: var(--accent);
}

.setup-step.is-done > a,
.setup-step.is-done > span {
  border-top-color: var(--chip-ok-fg);
}

.setup-dot {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
}

.setup-step.is-current .setup-dot {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.setup-step.is-done .setup-dot {
  color: var(--chip-ok-fg);
  background: var(--chip-ok-bg);
  border-color: var(--chip-ok-line);
}

.setup-step-label {
  min-width: 0;
}

/* ---------- the card for each step ---------- */

.setup-card {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.setup-title {
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.setup-lead {
  margin-top: -6px;
  color: var(--text-dim);
}

.setup-site {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.setup-site svg {
  width: 18px;
  height: 18px;
  color: var(--chip-ok-fg);
}

.setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.setup-actions .btn svg,
.setup-next .btn svg,
.setup-resume .btn svg {
  width: 16px;
  height: 16px;
}

.setup-more {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.setup-more > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  min-height: 44px;
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
}

.setup-more > summary::-webkit-details-marker {
  display: none;
}

/* The same chevron as the select menus, turned when open. */
.setup-more > summary::after {
  content: '';
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: var(--chevron) center / contain no-repeat;
  mask: var(--chevron) center / contain no-repeat;
  transition: transform 0.15s ease;
}

.setup-more[open] > summary::after {
  transform: rotate(180deg);
}

.setup-more[open] > summary {
  margin-bottom: 6px;
}

.setup-note {
  font-size: 14px;
  color: var(--text-dim);
}

.setup-skip {
  margin-top: 10px;
  text-align: center;
}

/* ---------- step 2: the platform picker ---------- */

.setup-platforms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-platform {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  height: 100%;
  padding: 8px 12px;
  color: var(--text);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.3;
  text-decoration: none;
  background: var(--bg-raised);
  border: 1px solid var(--line-control);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.setup-platform:hover {
  border-color: var(--line-strong);
  text-decoration: none;
}

.setup-platform.is-on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
  background: var(--accent-soft);
}

.setup-mono {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg-panel);
  border: 1px solid var(--line);
}

.setup-mono svg {
  width: 16px;
  height: 16px;
}

.setup-platform.is-on .setup-mono {
  color: var(--accent);
  border-color: var(--accent);
}

.setup-panel {
  display: grid;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 80px;
}

.setup-panel-title {
  font-size: 17px;
  line-height: 1.3;
}

.setup-howto {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: howto;
}

.setup-howto > li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 4px 12px;
  align-items: start;
  counter-increment: howto;
}

.setup-howto > li::before {
  content: counter(howto);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  background: var(--accent-soft);
}

.setup-howto > li > span {
  padding-top: 1px;
}

.setup-howto > li > .setup-tag {
  grid-column: 2;
}

.setup-howto code {
  font-family: var(--mono);
  font-size: 0.9em;
}

/* The tag wraps, so it is easy to see whole and copy on a phone. */
.setup-tag .code {
  white-space: pre-wrap;
  word-break: break-all;
}

.setup-guide .text-link {
  min-height: 44px;
}

/* ---------- step 3: the check and the live wait ---------- */

.setup-live {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.setup-live p {
  margin-top: 2px;
  color: var(--text-dim);
}

.setup-live a svg {
  width: 13px;
  height: 13px;
  margin-left: 3px;
  vertical-align: -1px;
}

.setup-pulse {
  position: relative;
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.setup-pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  animation: setup-pulse 1.6s ease-out infinite;
}

@keyframes setup-pulse {
  from {
    transform: scale(1);
    opacity: 0.6;
  }
  to {
    transform: scale(2.6);
    opacity: 0;
  }
}

.setup-live.is-seen {
  background: var(--chip-ok-bg);
  border-color: var(--chip-ok-line);
}

.setup-live.is-seen strong {
  color: var(--chip-ok-fg);
}

.setup-live.is-seen .setup-pulse {
  background: var(--chip-ok-fg);
}

.setup-live.is-seen .setup-pulse::after {
  animation: none;
  opacity: 0;
}

.setup-check {
  display: grid;
  gap: 12px;
}

.setup-check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.setup-check-row .muted {
  font-size: 14px;
}

.setup-result {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.setup-result p {
  color: var(--text-dim);
}

.setup-result.is-ok {
  background: var(--chip-ok-bg);
  border-color: var(--chip-ok-line);
}

.setup-result.is-ok strong {
  color: var(--chip-ok-fg);
}

.setup-result.is-warn {
  background: var(--chip-warn-bg);
  border-color: var(--chip-warn-line);
}

.setup-result.is-warn strong {
  color: var(--chip-warn-fg);
}

.setup-next {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.setup-next .setup-panel-title {
  flex: 1 1 100%;
}

.setup-next[hidden],
.setup-check[hidden],
.setup-note[hidden],
.setup-skip[hidden] {
  display: none;
}

/* ---------- /app: the resume card and site cards ---------- */

.setup-resume {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  justify-content: space-between;
  border-color: var(--accent);
}

.setup-resume-step {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.scs-action {
  font-size: 13.5px;
  font-weight: 600;
}

.dash-empty {
  margin-top: 18px;
}

@media (max-width: 720px) {
  .setup-card {
    padding: 18px 16px;
  }
  .setup-title {
    font-size: 19px;
  }
  /* Three steps in a row: numbers only beside the current label. */
  .setup-step > a,
  .setup-step > span {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 2px;
    font-size: 12.5px;
    line-height: 1.3;
  }
  .setup-platforms {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .setup-platform {
    font-size: 14px;
  }
  .setup-actions .btn,
  .setup-check-row .btn {
    flex: 1 1 100%;
  }
  .setup-resume .btn,
  .setup-next .btn,
  .setup-next form {
    flex: 1 1 100%;
  }
  .setup-next .btn {
    width: 100%;
  }
}
