/* =========================================================
   Hallucination-Free GPT
   A deadpan ChatGPT clone. Visual fidelity is the joke; the
   layout, typography, and dark theme are intentionally close
   to the real product so the responses land harder.
   ========================================================= */

[data-page-root].hfg {
  --bg:        #212121;
  --bg-elev:   #2f2f2f;
  --bg-hover:  #3a3a3a;
  --border:    #4a4a4a;
  --text:      #ececec;
  --text-soft: #b4b4b4;
  --text-faint:#7d7d7d;
  --accent:    #ffffff;
  --send-bg:   #ffffff;
  --send-fg:   #212121;
  --send-disabled-bg: #494949;
  --send-disabled-fg: #2b2b2b;
  --max-width: 768px;
  --pad-x:     clamp(1rem, 4vw, 2rem);

  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Reset only what we need to override from main.css; project pages
   set data-no-site-effects so the global CSS reset applies but doesn't
   bring brand colors with it. */
[data-page-root].hfg *,
[data-page-root].hfg *::before,
[data-page-root].hfg *::after { box-sizing: border-box; }

/* ---- Top bar ---- */
.hfg__topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem var(--pad-x);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.hfg__brand {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
}
.hfg__model {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ---- Main column ---- */
.hfg__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  min-height: 0;
}

/* ---- Welcome state (centered before any messages) ---- */
.hfg__welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 0;
  gap: 0.5rem;
}
.hfg__welcome.is-hidden { display: none; }
.hfg__title {
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--text);
}
.hfg__tagline {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

/* ---- Messages list ---- */
.hfg__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-height: 0;
}
.hfg__messages:empty { display: none; }

/* User message: bubble on the right */
.hfg__msg--user {
  align-self: flex-end;
  max-width: 80%;
  background: var(--bg-elev);
  border-radius: 18px;
  padding: 0.6rem 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: hfg-fade-in 200ms ease-out;
}

/* Assistant message: full-width, no bubble (matches ChatGPT) */
.hfg__msg--assistant {
  align-self: stretch;
  padding: 0 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  animation: hfg-fade-in 220ms ease-out;
}
.hfg__avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: -0.02em;
  margin-top: 1px;
}
.hfg__msg-body { flex: 1; min-width: 0; }

@keyframes hfg-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Typing indicator ---- */
.hfg__typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.4rem 0;
}
.hfg__typing span {
  width: 7px;
  height: 7px;
  background: var(--text-soft);
  border-radius: 50%;
  animation: hfg-typing 1.3s infinite ease-in-out;
}
.hfg__typing span:nth-child(2) { animation-delay: 0.18s; }
.hfg__typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes hfg-typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-2px); }
}

/* ---- Input bar (sticks to bottom of column) ---- */
.hfg__inputbar {
  padding: 0.5rem 0 1.25rem;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 0%, var(--bg) 18%);
}
.hfg__inputshell {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 0.55rem 0.55rem 0.55rem 1rem;
  transition: border-color 120ms ease;
}
.hfg__inputshell:focus-within {
  border-color: var(--text-faint);
}
.hfg__textarea {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.45;
  padding: 0.4rem 0;
  max-height: 200px;
  overflow-y: auto;
}
.hfg__textarea::placeholder { color: var(--text-faint); }
.hfg__send {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--send-bg);
  color: var(--send-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 120ms ease, background 120ms ease;
}
.hfg__send:hover:not(:disabled) { opacity: 0.85; }
.hfg__send:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.hfg__send:disabled {
  background: var(--send-disabled-bg);
  color: var(--send-disabled-fg);
  cursor: default;
}
.hfg__footer {
  text-align: center;
  margin: 0.6rem 0 0;
  color: var(--text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
}

/* ---- Mobile ---- */
@media (max-width: 520px) {
  [data-page-root].hfg { font-size: 15px; }
  .hfg__textarea { font-size: 16px; } /* avoid iOS zoom-on-focus */
  .hfg__title { font-size: 1.5rem; }
  .hfg__avatar { width: 24px; height: 24px; font-size: 0.62rem; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hfg__msg--user, .hfg__msg--assistant { animation: none; }
  .hfg__typing span { animation: none; opacity: 0.7; }
}
