:root {
  --bg: #0b0d10;
  --bg-2: #12151b;
  --ink: #f2f4f7;
  --muted: rgba(242, 244, 247, 0.72);
  --faint: rgba(242, 244, 247, 0.48);
  --accent: #ff5a36;
  --accent-soft: rgba(255, 90, 54, 0.18);
  --line: rgba(242, 244, 247, 0.12);
  --panel: rgba(18, 21, 27, 0.88);
  --user: rgba(255, 90, 54, 0.14);
  --bot: rgba(242, 244, 247, 0.06);
  --danger: #ffb4a2;
  --display: "Space Grotesk", sans-serif;
  --mono: "IBM Plex Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
}

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

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

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  align-items: end;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 82% 8%, rgba(255, 90, 54, 0.24), transparent 42%),
    linear-gradient(160deg, #15181f 0%, #0b0d10 52%, #171018 100%);
}

.hero__glow {
  position: absolute;
  inset: auto -10% 18% auto;
  width: min(48vw, 28rem);
  height: min(48vw, 28rem);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 90, 54, 0.28), transparent 68%);
  filter: blur(8px);
  animation: pulse 7s ease-in-out infinite alternate;
  pointer-events: none;
}

.hero__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 28% 72%, #000 0%, transparent 70%);
  animation: drift 16s ease-in-out infinite alternate;
  pointer-events: none;
}

.hero__copy {
  position: relative;
  z-index: 1;
  width: min(42rem, calc(100% - 2.5rem));
  margin: 0 auto 12vh;
  animation: rise 800ms var(--ease) both;
}

.hero__brand {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--accent);
}

.hero__title {
  margin: 0 0 1rem;
  max-width: 11ch;
  font-family: var(--display);
  font-size: clamp(2.6rem, 9vw, 5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.hero__lead {
  margin: 0 0 1.6rem;
  max-width: 30rem;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--muted);
}

.hero__cta {
  display: flex;
  gap: 0.75rem;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
  transition: transform 180ms var(--ease), background 180ms ease, border-color 180ms ease;
}

.btn--primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.7rem 1.15rem;
  background: var(--accent);
  color: #140904;
}

.btn--primary:hover {
  transform: translateY(-1px);
  background: #ff714f;
}

.btn--send {
  min-height: 3rem;
  padding: 0.7rem 1.1rem;
  background: var(--accent);
  color: #140904;
  align-self: end;
}

.btn--send:disabled {
  opacity: 0.55;
  cursor: wait;
}

.support {
  position: relative;
  padding: 5rem 1.25rem 4rem;
  background:
    linear-gradient(180deg, #0b0d10 0%, #10131a 45%, #0b0d10 100%);
}

.support__head {
  width: min(42rem, 100%);
  margin: 0 auto 2rem;
  animation: rise 900ms var(--ease) both;
}

.support__eyebrow {
  margin: 0 0 0.65rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.support__head h2 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.support__sub {
  margin: 0;
  max-width: 38rem;
  color: var(--muted);
  line-height: 1.55;
}

.chat {
  width: min(46rem, 100%);
  margin: 0 auto;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
  animation: rise 1000ms var(--ease) both;
}

.chat__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.modes {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}

.mode {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.mode.is-active {
  background: var(--accent-soft);
  color: var(--ink);
}

.skill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  font-size: 0.82rem;
}

.skill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.skill__ui {
  width: 2.4rem;
  height: 1.3rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  position: relative;
  transition: background 160ms ease, border-color 160ms ease;
}

.skill__ui::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--faint);
  transition: transform 180ms var(--ease), background 160ms ease;
}

.skill input:checked + .skill__ui {
  background: var(--accent-soft);
  border-color: rgba(255, 90, 54, 0.55);
}

.skill input:checked + .skill__ui::after {
  transform: translateX(1.05rem);
  background: var(--accent);
}

.skill input:focus-visible + .skill__ui {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chat__status {
  margin-bottom: 0.75rem;
  color: var(--faint);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.chat__log {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 18rem;
  max-height: min(52vh, 28rem);
  overflow-y: auto;
  padding: 0.85rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  scroll-behavior: smooth;
}

.msg {
  max-width: 92%;
  padding: 0.75rem 0.85rem;
  line-height: 1.5;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
  animation: msg-in 280ms var(--ease) both;
}

.msg--bot {
  align-self: flex-start;
  background: var(--bot);
  border-left: 2px solid rgba(255, 90, 54, 0.55);
}

.msg--user {
  align-self: flex-end;
  background: var(--user);
  border-right: 2px solid rgba(255, 90, 54, 0.7);
}

.msg--crisis {
  border-left-color: var(--danger);
  color: #ffe8e1;
}

.msg__who {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 3rem;
  max-height: 9rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.45;
}

.composer textarea:focus {
  outline: 2px solid rgba(255, 90, 54, 0.55);
  outline-offset: 1px;
}

.chat__note {
  margin: 0.85rem 0 0;
  color: var(--faint);
  font-size: 0.75rem;
  line-height: 1.45;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-1.5%, 1%, 0); }
}

@keyframes pulse {
  from { opacity: 0.55; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1.05); }
}

@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 1.2rem, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(0.4rem); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .composer {
    grid-template-columns: 1fr;
  }

  .btn--send {
    width: 100%;
  }

  .chat__toolbar {
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__grid,
  .hero__glow,
  .hero__copy,
  .support__head,
  .chat,
  .msg {
    animation: none;
  }
}
