/* TRIBICON AI chat – dark industrial, orange accent (matches tribicon.ai). Mobile-first. */

@font-face { font-family: 'Poppins'; font-weight: 600; font-display: swap; src: url(/assets/fonts/poppins-600.woff2) format('woff2'); }
@font-face { font-family: 'DM Sans'; font-weight: 400; font-display: swap; src: url(/assets/fonts/dmsans-400.woff2) format('woff2'); }
@font-face { font-family: 'DM Sans'; font-weight: 500; font-display: swap; src: url(/assets/fonts/dmsans-500.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap; src: url(/assets/fonts/jetbrains-mono-500.woff2) format('woff2'); }

:root {
  --bg: #0A0D12;
  --bg-2: #10151C;
  --bg-3: #171D27;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .15);
  --text: #E9EDF2;
  --muted: rgba(233, 237, 242, .58);
  --orange: #F39300;
  --orange-2: #FFB03A;
  --orange-soft: rgba(243, 147, 0, .16);
  --ink: #0A0D12;
  --danger: #FF6B6B;
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Poppins', var(--font);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 16px;
  --max: 760px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(70% 45% at 50% -10%, rgba(243, 147, 0, .10), transparent 65%), var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
a { color: var(--orange); }
button { font-family: inherit; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; line-height: 1.5; }
.eyebrow { margin: 0 0 12px; font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--orange); }

/* ── Shell ───────────────────────────────────────────────────────────── */

.app { display: flex; flex-direction: column; height: 100dvh; min-height: 100%; }

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px var(--gutter);
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 18, .86);
  backdrop-filter: blur(10px);
}
.bar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bar__mark {
  position: relative; flex: none; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
}
.bar__mark::after {
  content: 'T'; position: absolute; inset: 0; display: grid; place-items: center;
  font: 600 18px/1 var(--font-head); color: var(--ink);
}
.bar__text { min-width: 0; }
.bar__title { font: 600 15px/1.25 var(--font-head); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__sub { font: 500 10.5px/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.bar__status.is-live { color: var(--orange); }
.bar__status.is-live::before {
  content: ''; display: inline-block; width: 6px; height: 6px; margin: 0 6px 1px 0; border-radius: 50%;
  background: var(--orange); animation: pulse 1s ease-in-out infinite;
}
.bar__actions { display: flex; gap: 6px; flex: none; }

.iconbtn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
}
.iconbtn:hover { color: var(--text); border-color: var(--line-2); background: var(--bg-2); }

/* ── Gate ────────────────────────────────────────────────────────────── */

.gate { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px var(--gutter); overflow: auto; }
.gate__card { width: 100%; max-width: 420px; padding: 28px 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg-2); }
.gate__title { margin: 0 0 10px; font: 600 22px/1.2 var(--font-head); letter-spacing: -.015em; }
.gate__intro { margin: 0; }
.gate__form { margin: 0 0 18px; }
.label { display: block; margin: 20px 0 8px; font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--text);
  font: 500 16px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field::placeholder { color: rgba(233, 237, 242, .28); text-transform: none; letter-spacing: .04em; }
.field:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 48px; margin-top: 12px;
  border: 0; border-radius: 12px; background: var(--orange); color: var(--ink);
  font: 600 15px/1 var(--font); cursor: pointer; transition: filter .15s, transform .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn--ghost { width: auto; padding: 0 18px; background: transparent; border: 1px solid var(--line-2); color: var(--text); text-decoration: none; }
.error { margin: 10px 0 0; font-size: 13px; color: var(--danger); }

/* ── Chat ────────────────────────────────────────────────────────────── */

.chat { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }

.messages {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px max(var(--gutter), calc((100% - var(--max)) / 2)) 10px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.msg { display: flex; animation: rise .18s ease-out; }
.msg--user { justify-content: flex-end; }
.msg__bubble {
  max-width: min(86%, 640px); padding: 11px 14px; border-radius: var(--radius);
  font-size: 15px; line-height: 1.55; overflow-wrap: anywhere;
}
.msg--user .msg__bubble { background: var(--orange); color: var(--ink); border-bottom-right-radius: 6px; white-space: pre-wrap; font-weight: 500; }
.msg--assistant .msg__bubble { background: var(--bg-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg--welcome .msg__bubble { border-left: 2px solid var(--orange); color: rgba(233, 237, 242, .8); }

.msg__bubble p { margin: 0 0 .7em; }
.msg__bubble > :last-child { margin-bottom: 0; }
.msg__bubble ul, .msg__bubble ol { margin: .3em 0 .7em; padding-left: 1.3em; }
.msg__bubble li { margin: .2em 0; }
.msg__bubble h3, .msg__bubble h4, .msg__bubble h5, .msg__bubble h6 { margin: .9em 0 .35em; font: 600 15px/1.3 var(--font-head); }
.msg__bubble code { padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, .08); font: 500 13px var(--mono); }
.msg__bubble strong { font-weight: 600; color: #fff; }

.typing { display: inline-flex; align-items: center; gap: 4px; height: 20px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }

.composer-wrap {
  padding: 8px max(var(--gutter), calc((100% - var(--max)) / 2)) calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--bg);
}
.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 6px 6px 6px 14px; border: 1px solid var(--line-2); border-radius: 18px; background: var(--bg-2);
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.composer__input {
  flex: 1; min-height: 38px; max-height: 160px; padding: 8px 0; resize: none; border: 0; outline: none;
  background: transparent; color: var(--text); font: 15px/1.5 var(--font);
}
.composer__input::placeholder { color: rgba(233, 237, 242, .4); }
.composer__input:disabled { opacity: .6; }
.sendbtn {
  flex: none; width: 38px; height: 38px; border: 0; border-radius: 12px; background: var(--orange); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: filter .15s, opacity .15s;
}
.sendbtn:hover { filter: brightness(1.06); }
.sendbtn:disabled { opacity: .35; cursor: default; filter: none; }
.composer__hint { margin: 8px 2px 0; text-align: center; font-size: 11px; }

.toast {
  position: absolute; left: 50%; bottom: 104px; transform: translateX(-50%);
  max-width: calc(100% - 2 * var(--gutter)); padding: 10px 14px; border-radius: 12px;
  background: #2A1518; border: 1px solid rgba(255, 107, 107, .4); color: #FFD9D9;
  font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: rise .18s ease-out;
}

/* ── Index page ──────────────────────────────────────────────────────── */

.index { display: grid; place-items: center; min-height: 100dvh; padding: 24px var(--gutter); }
.index__card { max-width: 460px; text-align: center; }
.index h1 { margin: 0 0 12px; font: 600 26px/1.2 var(--font-head); letter-spacing: -.02em; }

/* ── Embedded (iframe) tweaks ────────────────────────────────────────── */

html.is-embedded body { background: var(--bg); }
html.is-embedded .bar { padding-top: 12px; }
html.is-embedded .gate { padding: 16px var(--gutter); }
html.is-embedded .gate__card { padding: 16px 8px; border: 0; background: transparent; }

/* ── Motion ──────────────────────────────────────────────────────────── */

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

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