/* ---------------------------------------------------------------------------
   TUI CAT — Customer Awareness Tool
   Travel-friendly palette. Swap the values in :root to match exact brand hex.
   --------------------------------------------------------------------------- */

:root {
  /* Brand — replace with your exact TUI hex when ready */
  --brand-blue:        #005ca9;   /* primary deep travel-blue */
  --brand-blue-ink:    #003a6c;   /* hover / pressed */
  --brand-blue-soft:   #e6f0fa;   /* tinted surface */
  --brand-yellow:      #ffd800;   /* warm sun accent */
  --brand-yellow-ink:  #b89800;
  --brand-coral:       #e95a4d;   /* warm secondary accent (matches illustrations) */

  /* Neutrals (warm-cool neutral) */
  --bg:                #f6f8fb;
  --surface:           #ffffff;
  --border:            #e3e7ee;
  --border-strong:     #c9d2df;
  --text:              #0e1b2c;
  --text-muted:        #5a6779;
  --text-faint:        #8a94a6;

  /* Sky / horizon */
  --sky-top:           #d8ecff;
  --sky-mid:           #eaf4ff;
  --sky-bottom:        #f6f8fb;
  --horizon:           #d6dee9;

  /* Status */
  --danger:            #c0392b;
  --danger-soft:       #fdecea;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Shape */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 30, 60, 0.06);
  --shadow:    0 4px 16px rgba(15, 30, 60, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 30, 60, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: var(--bg);
  overflow-x: hidden;
}

/* Soft sky gradient behind everything; sits below content via z-index */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 50% -80px,
      color-mix(in srgb, var(--brand-blue) 12%, transparent), transparent 70%),
    linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-mid) 40%, var(--sky-bottom) 100%);
}
/* A faint sun */
.sky::after {
  content: "";
  position: absolute;
  top: 56px;
  right: 12%;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle,
    color-mix(in srgb, var(--brand-yellow) 70%, white) 0%,
    color-mix(in srgb, var(--brand-yellow) 30%, transparent) 55%,
    transparent 75%);
  filter: blur(2px);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout shell ---------- */

.shell {
  width: 100%;
  max-width: 760px;
  padding: 56px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  z-index: 1;
}

/* ---------- Brand ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: center;
  margin-top: 16px;
}

/* Real logo (when user drops in an <img class="brand__logo">) */
.brand__logo {
  display: block;
  height: 44px;
  width: auto;
  flex-shrink: 0;
}

/* Placeholder shown while no logo is wired up */
.brand__logo--placeholder {
  height: 44px;
  width: 64px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background:
    repeating-linear-gradient(135deg,
      transparent 0 6px,
      rgba(15, 30, 60, 0.04) 6px 12px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand__placeholderLabel {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.wordmark {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}
.wordmark__primary {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--brand-blue);
}
.wordmark__sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.02em;
}

/* ---------- Lede ---------- */

.lede {
  margin: 0 auto;
  text-align: center;
  max-width: 520px;
  font-size: 15px;
  color: var(--text-muted);
  text-wrap: balance;
}

/* ---------- Search ---------- */

.search {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search__field {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 16px;
  height: 56px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.search__field:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.search__field:focus-within {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px var(--brand-blue-soft), var(--shadow);
}

.search__icon {
  width: 20px;
  height: 20px;
  color: var(--text-faint);
  flex-shrink: 0;
  margin-right: 12px;
}

.search__input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  padding: 0;
  min-width: 0;
}
.search__input::placeholder { color: var(--text-faint); }

.search__clear {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
.search__clear:hover { background: var(--brand-blue-soft); color: var(--brand-blue); }
.search__clear svg { width: 16px; height: 16px; }

.search__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ---------- Suggestion chips ---------- */

.suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  appearance: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.chip:hover {
  background: var(--surface);
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 10px 18px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn--primary {
  background: var(--brand-blue);
  color: #fff;
}
.btn--primary:hover:not(:disabled) { background: var(--brand-blue-ink); }

.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { border-color: var(--border-strong); background: #fbfcfe; }

.btn--small {
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn--small:hover { border-color: var(--border-strong); }

/* Spinner inside primary button */
.btn__spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin .8s linear infinite;
}
.btn.is-loading .btn__spinner { display: inline-block; }
.btn.is-loading .btn__label::after { content: "ing…"; }
.btn.is-loading .btn__label { font-variant-numeric: tabular-nums; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Status / error pill ---------- */

.status {
  min-height: 0;
  display: flex;
  justify-content: center;
}
.status:empty { display: none; }

.status__error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  max-width: 100%;
}

/* ---------- Results ---------- */

.results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.results__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, #fbfcfe, var(--surface));
}

.results__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.results__meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.results__metaText {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.results__json {
  margin: 0;
  padding: 18px;
  max-height: 480px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  background: #fbfcfe;
}

/* JSON syntax tokens */
.tok-key   { color: #0a4f8c; }
.tok-str   { color: #166c3b; }
.tok-num   { color: #8a4b00; }
.tok-bool  { color: #7a1fa0; }
.tok-null  { color: #7a1fa0; }
.tok-punct { color: var(--text-faint); }

/* ---------- Scene (empty-state travelers) ---------- */

.scene {
  position: relative;
  margin-top: auto;
  padding-top: 28px;
  min-height: 220px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 24px;
  transition: opacity .35s ease, transform .35s ease;
}

.scene__group {
  display: flex;
  align-items: flex-end;
  min-width: 0;
  grid-row: 2;
}
.scene__group--left  { grid-column: 1; justify-content: flex-end;   padding-right: 8px; }
.scene__group--right { grid-column: 3; justify-content: flex-start; padding-left: 8px; }

.scene__art {
  display: block;
  width: 200px;
  height: auto;
  image-rendering: -webkit-optimize-contrast;
  filter: drop-shadow(0 8px 14px rgba(15, 30, 60, 0.12));
  user-select: none;
  -webkit-user-drag: none;
}
.scene__group--left  .scene__art { transform: translateY(2px); }
.scene__group--right .scene__art { width: 194px; }

/* The ground / horizon line they stand on */
.scene__horizon {
  grid-column: 1 / -1;
  grid-row: 1;
  align-self: end;
  height: 1px;
  background: linear-gradient(to right,
    transparent 0%,
    var(--horizon) 18%,
    var(--horizon) 82%,
    transparent 100%);
  margin-bottom: 0;
  pointer-events: none;
}
/* Soft shadow puddles under each figure */
.scene__group::after {
  content: "";
  width: 160px;
  height: 18px;
  margin-bottom: -2px;
  align-self: flex-end;
  background: radial-gradient(ellipse at center,
    rgba(15, 30, 60, 0.18) 0%,
    rgba(15, 30, 60, 0.06) 45%,
    transparent 70%);
  position: absolute;
  bottom: 6px;
  z-index: -1;
}
.scene__group--left::after  { right: calc(50% + 24px); }
.scene__group--right::after { left:  calc(50% + 24px); }

/* Hide the scene once results or an error are present — keep the UI focused */
body[data-state="results"] .scene,
body[data-state="error"]   .scene {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  min-height: 0;
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}
/* Same for the suggestion chips */
body[data-state="results"] .suggestions {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  height: 0;
  margin: 0;
  overflow: hidden;
}

/* ---------- Foot ---------- */

.foot {
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  padding: 16px 0 24px;
}
.foot code {
  font-family: var(--font-mono);
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .shell { padding: 32px 16px 0; gap: 20px; }
  .brand { flex-direction: column; gap: 8px; margin-top: 8px; }
  .wordmark { align-items: center; text-align: center; }
  .search__field { height: 52px; padding: 0 14px; }
  .search__input { font-size: 16px; }
  .scene { padding-top: 24px; min-height: 220px; }
  .scene__art { width: 130px !important; }
  .sky::after { width: 80px; height: 80px; top: 32px; right: 8%; }
}
