/* Theme tokens extracted from https://snotor.pro/ (computed styles + colour histogram).
   Snotor's font is Aeonik Pro (commercial) -> Figtree (free, self-hosted in assets/fonts) stands in. */
:root {
  --color-ink: #1c1c1b;            /* dark sections, body text */
  --color-paper: #f0f1fa;          /* light sections, text on dark */
  --color-surface: #ffffff;        /* cards */
  --color-primary: #b6caff;        /* periwinkle CTA ("Book a meeting") */
  --color-primary-hover: #a3bbff;
  --color-lavender: #d1c6f5;       /* "Why Snotor" section */
  --color-accent: #f5711c;         /* orange (Snotor Studio) */
  --color-indigo: #412db2;         /* Snotor Teams */
  --color-muted: #6d6e71;
  --color-line: #c5c7cd;

  --font-sans: "Figtree", "Aeonik Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-15: 60px;

  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.267);
  --container: 880px;

  font-family: var(--font-sans);
  color: var(--color-ink);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-paper);
  line-height: 1.5;
}

h1, h2 {
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--color-indigo);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------- dark top: bar + hero */

.topbar {
  background: var(--color-ink);
  color: var(--color-paper);
}

.topbar-inner,
.hero,
.page {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.topbar-inner {
  padding-top: var(--space-5);
  padding-bottom: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-paper);
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

.brand-divider {
  width: 2px;
  height: 28px;
  background: var(--color-paper);
}

.brand-app {
  font-size: 1.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-switch {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--color-primary);
}

.lang-switch button {
  border: 0;
  padding: 0.4rem 0.85rem;
  font-size: 0.95rem;
  background: transparent;
  color: var(--color-paper);
}

.lang-switch button:hover:not(.active) {
  background: rgba(182, 202, 255, 0.15);
}

.lang-switch button.active {
  background: var(--color-primary);
  color: var(--color-ink);
}

.hero-band {
  background: var(--color-ink);
  color: var(--color-paper);
}

.hero {
  padding-top: var(--space-10);
  padding-bottom: 120px;
}

.hero h1 {
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  color: var(--color-paper);
}

.hero h1 .hl {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.12em;
}

.lead {
  margin: var(--space-5) 0 0;
  max-width: 560px;
  font-size: 1.25rem;
  line-height: 1.4;
}

/* ---------------------------------------------------------------- input card (overlaps the hero) */

.page {
  margin-top: -88px;
  padding-bottom: var(--space-15);
}

.input-card {
  background: var(--color-surface);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
}

.dropzone {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding: var(--space-10) var(--space-5);
  border: 1px dashed var(--color-muted);
  background: var(--color-paper);
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border: 1px solid var(--color-ink);
  background: #e6e9fb;
}

.dropzone:focus-within {
  outline: 2px solid var(--color-indigo);
  outline-offset: 2px;
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  background: var(--color-primary);
}

.dropzone-icon svg {
  width: 28px;
  height: 28px;
}

.dropzone-title {
  margin-top: var(--space-2);
  font-size: 1.3rem;
}

.dropzone-hint {
  font-size: 0.95rem;
  color: var(--color-muted);
}

.photo-preview {
  margin-top: var(--space-4);
  background: var(--color-paper);
  display: grid;
  place-items: center;
}

.photo-preview img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.or {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0;
  color: var(--color-muted);
}

.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-line);
}

.search-row {
  display: flex;
  gap: var(--space-3);
}

input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 1.1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-line);
  border-radius: 0;
  background: var(--color-surface);
  color: var(--color-ink);
}

input::placeholder {
  color: #999a9f;
}

input:focus {
  border-color: var(--color-ink);
  outline: none;
}

button {
  font-family: inherit;
  font-size: 1.1rem;
  padding: 0.85rem 1.75rem;
  border: 1px solid var(--color-primary);
  border-radius: 0;
  background: var(--color-primary);
  color: var(--color-ink);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

button:hover:not(:disabled) {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

button:disabled {
  background: transparent;
  border-color: var(--color-line);
  color: #999a9f;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  border-color: var(--color-ink);
}

button.secondary:hover:not(:disabled) {
  background: var(--color-ink);
  color: var(--color-paper);
}

.status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
  font-size: 0.95rem;
  color: var(--color-muted);
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-indigo);
  flex-shrink: 0;
}

.status.error::before {
  background: var(--color-accent);
}

/* ---------------------------------------------------------------- answer flow */

.section {
  margin-top: var(--space-8);
  scroll-margin-top: var(--space-6);
}

.section > h2 {
  font-size: 2rem;
  margin-bottom: var(--space-4);
}

.small {
  font-size: 0.95rem;
}

.subtle {
  color: var(--color-muted);
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

.candidate-grid button {
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 1.2rem;
}

.candidate-grid button:hover {
  background: var(--color-surface);
  border-color: var(--color-ink);
  box-shadow: inset 0 0 0 1px var(--color-ink);
}

.candidate-grid strong {
  font-weight: 500;
}

.candidate-grid .meta {
  font-size: 0.95rem;
  color: var(--color-muted);
}

.question-item {
  margin: 0 0 var(--space-3);
  font-size: 1rem;
  color: var(--color-muted);
}

.question-card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  padding: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.question-card p {
  margin: 0;
  font-size: 1.5rem;
}

.actions {
  display: flex;
  gap: var(--space-2);
}

.actions button {
  min-width: 110px;
}

.actions button + button {
  background: transparent;
  border-color: var(--color-ink);
}

.actions button + button:hover {
  background: var(--color-ink);
  border-color: var(--color-ink);
  color: var(--color-paper);
}

.result-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}

.result-card.not-found {
  grid-template-columns: 1fr;
}

.result-bin {
  /* --bin is the stream colour (yellow, blue, ...) set inline */
  background: color-mix(in srgb, var(--bin) 45%, white);
  display: grid;
  place-items: center;
  padding: var(--space-5);
  min-height: 220px;
}

.result-bin img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.result-bin-icon {
  font-size: 4.5rem;
}

.result-text {
  padding: var(--space-8);
  align-self: center;
}

.result-kicker {
  margin: 0 0 var(--space-2);
  font-size: 1.05rem;
  color: var(--color-muted);
}

.result-text h2 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
}

.result-text p {
  margin: var(--space-4) 0 0;
  font-size: 1.1rem;
}

.result-text .result-kicker {
  margin-top: 0;
}

.not-found .result-kicker {
  font-size: 1.6rem;
  color: var(--color-ink);
}

#resetBtn {
  margin-top: var(--space-6);
}

/* ---------------------------------------------------------------- motion (cosmetic) */

/* Photo being analysed: a periwinkle scan line sweeps over it. */
.photo-preview {
  position: relative;
  overflow: hidden;
}

.photo-preview.scanning img {
  filter: saturate(0.6) brightness(0.95);
  transition: filter 0.3s ease;
}

.photo-preview.scanning::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 30%;
  top: -30%;
  background: linear-gradient(to bottom, rgba(182, 202, 255, 0), rgba(182, 202, 255, 0.55) 85%, var(--color-primary));
  border-bottom: 2px solid var(--color-indigo);
  animation: scan 1.1s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}

@keyframes scan {
  to { top: 100%; }
}

/* "Sorting..." roulette across the bins. */
.sorting {
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  text-align: center;
  animation: rise 0.35s ease-out both;
}

.sorting h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
}

.sorting h2::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.08em;
  margin-left: 0.15em;
  background: var(--color-indigo);
  animation: blink 0.6s steps(2, start) infinite;
}

@keyframes blink {
  to { visibility: hidden; }
}

.sort-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.sort-tile {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  background: color-mix(in srgb, var(--bin) 35%, white);
  border: 1px solid var(--color-line);
  opacity: 0.55;
  transform: scale(0.92);
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.sort-tile.active {
  opacity: 1;
  transform: scale(1.08);
  background: var(--bin);
  border-color: var(--color-ink);
}

.sort-tile.picked {
  animation: picked 0.45s ease-out both;
  box-shadow: 0 0 0 4px var(--color-primary);
}

@keyframes picked {
  0% { transform: scale(1.08); }
  40% { transform: scale(1.3) rotate(-4deg); }
  70% { transform: scale(1.12) rotate(3deg); }
  100% { transform: scale(1.18); }
}

/* Result reveal: card rises, bin drops in with a bounce, text follows. */
.result-card {
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.result-bin img,
.result-bin-icon {
  animation: drop 0.7s cubic-bezier(0.3, 1.5, 0.5, 1) 0.1s both;
}

.result-text > * {
  animation: fade-up 0.4s ease-out both;
}

.result-text > :nth-child(1) { animation-delay: 0.15s; }
.result-text > :nth-child(2) { animation-delay: 0.25s; }
.result-text > :nth-child(3) { animation-delay: 0.38s; }
.result-text > :nth-child(4) { animation-delay: 0.5s; }

.question-card,
.candidate-grid button {
  animation: fade-up 0.3s ease-out both;
}

.candidate-grid button:nth-child(2) { animation-delay: 0.06s; }
.candidate-grid button:nth-child(3) { animation-delay: 0.12s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes drop {
  from { opacity: 0; transform: translateY(-60px) scale(0.85); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 640px) {
  .topbar-inner,
  .hero,
  .page {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .topbar-inner {
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
  }

  .brand-logo,
  .brand-divider {
    height: 22px;
  }

  .brand-app {
    font-size: 1rem;
  }

  .hero {
    padding-top: var(--space-8);
    padding-bottom: 96px;
  }

  .lead {
    font-size: 1.1rem;
  }

  .page {
    margin-top: -64px;
  }

  .input-card {
    padding: var(--space-4);
  }

  .dropzone {
    padding: var(--space-8) var(--space-4);
  }

  .search-row button {
    padding-left: var(--space-5);
    padding-right: var(--space-5);
  }

  .question-card {
    flex-direction: column;
    align-items: stretch;
  }

  .actions button {
    flex: 1;
  }

  .result-card {
    grid-template-columns: 1fr;
  }

  .result-bin {
    min-height: 150px;
  }

  .result-bin img {
    max-height: 150px;
  }

  .result-text {
    padding: var(--space-5);
  }

  .sorting {
    padding: var(--space-5);
  }

  .sort-tile {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
  }
}

@media (max-width: 380px) {
  .brand-divider,
  .brand-app {
    display: none;
  }
}
