/*
 * at-where — hand-written styles, no CSS framework. System font stack, one
 * centered column, plain cards. Colors are defined as custom properties so
 * the prefers-color-scheme block below is the only place dark mode lives.
 */

:root {
  --bg: #fbfaf8;
  --fg: #1c1b19;
  --fg-muted: #6b6660;
  --border: #e3ded6;
  --card-bg: #ffffff;
  --accent: #2f6f4f;
  --accent-fg: #ffffff;
  --error: #a4342c;
  --link: #1f5f8b;
  --avatar-fallback-bg: #d8d2c7;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --fg: #ece9e3;
    --fg-muted: #a6a099;
    --border: #34322d;
    --card-bg: #201f1c;
    --accent: #5cc794;
    --accent-fg: #0c1210;
    --error: #e2867d;
    --link: #7cc0ea;
    --avatar-fallback-bg: #3a382f;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

a {
  color: var(--link);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header,
.site-main,
.site-footer {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  padding-top: 1.5rem;
  padding-bottom: 0.5rem;
}

.site-header__brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--fg);
}

.site-main {
  flex: 1;
  padding-top: 1rem;
  padding-bottom: 3rem;
}

.site-footer {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.85rem;
}

/* --- intro / handle form ------------------------------------------------ */

.intro h1 {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.intro__lede {
  color: var(--fg-muted);
  margin-bottom: 1.5rem;
}

.handle-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 420px;
}

.handle-form label {
  font-weight: 600;
  font-size: 0.9rem;
}

.handle-form input[type="text"] {
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--fg);
}

.handle-form input[type="submit"] {
  margin-top: 0.25rem;
  align-self: flex-start;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
}

.handle-form input[type="submit"]:hover {
  opacity: 0.9;
}

.field-error {
  color: var(--error);
  font-size: 0.9rem;
  margin: 0;
}

/* --- scan card ----------------------------------------------------------- */

.scan-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.scan-card__handle {
  font-size: 1.4rem;
  margin: 0;
  word-break: break-word;
}

.scan-status {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  white-space: nowrap;
}

.scan-status--done {
  color: var(--accent);
}

.scan-status--failed {
  color: var(--error);
}

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

.scan-progress {
  margin-bottom: 1.5rem;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  transition: width 0.4s ease-out;
  animation: progress-shimmer 1.6s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .progress-bar__fill {
    animation: none;
    transition: none;
  }
}

.progress-label {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* --- error state ----------------------------------------------------------- */

.scan-error {
  border: 1px solid var(--error);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.scan-error__message {
  margin: 0 0 0.5rem;
}

/* --- service cards --------------------------------------------------------- */

.service-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.service-card {
  display: flex;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
}

.service-card--unknown {
  border-style: dashed;
}

.service-card__icon {
  font-size: 1.6rem;
  line-height: 1;
  flex: none;
}

.service-card__body {
  flex: 1;
  min-width: 0;
}

.service-card__name {
  font-weight: 700;
  text-decoration: none;
}

.service-card__name:hover {
  text-decoration: underline;
}

.service-card__description {
  margin: 0.15rem 0 0.5rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.service-card__count {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

/* --- avatar group ------------------------------------------------------- */

.avatar-group {
  display: flex;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--card-bg);
  margin-left: -10px;
  object-fit: cover;
  background: var(--avatar-fallback-bg);
}

.avatar:first-child {
  margin-left: 0;
}

.avatar--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--fg-muted);
}

/* --- excluded / footnote / rescan ---------------------------------------- */

.excluded-services {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.excluded-services summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.scan-footnote {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.empty-state {
  color: var(--fg-muted);
}

.rescan-button {
  margin-top: 1rem;
}

.rescan-button input[type="submit"] {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  cursor: pointer;
}

.rescan-button input[type="submit"]:hover {
  border-color: var(--accent);
}
