/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --black:       #0a0a0a;
  --black-2:     #141414;
  --black-3:     #1e1e1e;
  --gold:        #c9a84c;
  --gold-light:  #e0c070;
  --white:       #ffffff;
  --text:        #e0e0e0;
  --text-light:  #888888;
  --font-body:   'Inter', 'Helvetica Neue', Arial, sans-serif;
  --radius:      6px;
  --shadow:      0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.6);
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--black);
}

a { color: var(--gold); }
a:hover { color: var(--gold-light); }

/* ── Hero ──────────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(160deg, var(--black-3) 0%, var(--black) 100%);
}

.hero__overlay {
  display: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  padding: 48px 24px;
  max-width: 680px;
}

.hero__logo {
  width: 160px;
  margin-bottom: 24px;
}

.hero__title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(28px, 5vw, 48px);
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.hero__subtitle {
  font-size: 18px;
  color: rgba(255,255,255,0.70);
  margin-bottom: 28px;
}

.hero__link {
  display: inline-block;
  padding: 12px 28px;
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  color: var(--gold);
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 0.03em;
  transition: background 0.2s, color 0.2s;
}
.hero__link:hover {
  background: var(--gold);
  color: var(--black);
}

/* ── Main / Cards ──────────────────────────────────────────────────────────── */
.main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 24px 72px;
}

.main__intro {
  text-align: center;
  font-size: 18px;
  max-width: 620px;
  margin: 0 auto 44px;
  color: var(--text);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
}

.card {
  background: var(--black-2);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid #2a2a2a;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card__img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.card__img-fallback {
  display: none;
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--black-3) 0%, #2a2a2a 100%);
}

.card__body {
  padding: 24px;
  flex: 1;
}

.card__title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 20px;
  color: var(--gold);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.card__text {
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.footer {
  background: var(--black-2);
  border-top: 1px solid #2a2a2a;
  text-align: center;
  padding: 20px 24px;
  font-size: 14px;
  color: var(--text-light);
}
.footer a { color: var(--text-light); }
.footer a:hover { color: var(--gold); }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* CHAT WIDGET                                                                 */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ── FAB (floating action button) ─────────────────────────────────────────── */
#chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--black);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(201,168,76,0.40);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow: hidden;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  animation: pulse-fab 2.5s ease-in-out 1s 3;
}
#chat-fab:hover {
  background: var(--gold-light);
  transform: scale(1.10);
  box-shadow: 0 6px 24px rgba(201,168,76,0.55);
}
#chat-fab:active { transform: scale(0.93); }
#chat-fab svg { width: 26px; height: 26px; position: relative; z-index: 1; }

/* Ripple burst (injected via JS) */
.fab-ripple {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transform: scale(0);
  animation: fab-ripple 0.55s ease-out forwards;
  pointer-events: none;
}
@keyframes fab-ripple {
  to { transform: scale(3.2); opacity: 0; }
}

@keyframes pulse-fab {
  0%   { box-shadow: 0 4px 16px rgba(201,168,76,0.40); }
  50%  { box-shadow: 0 4px 28px rgba(201,168,76,0.70), 0 0 0 10px rgba(201,168,76,0.10); }
  100% { box-shadow: 0 4px 16px rgba(201,168,76,0.40); }
}

/* ── Panel ─────────────────────────────────────────────────────────────────── */
#chat-panel {
  position: fixed;
  bottom: 104px;
  right: 28px;
  width: 380px;
  height: 540px;
  background: var(--black-2);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 999;
  overflow: hidden;
  transform: scale(0.6) translateY(60px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.22s ease;
  border: 1px solid #2a2a2a;
}
#chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
  animation: panel-shine 0.6s ease forwards;
}

@keyframes panel-shine {
  0%   { box-shadow: 0 0 0 0 rgba(201,168,76,0.0), var(--shadow-lg); }
  40%  { box-shadow: 0 0 0 6px rgba(201,168,76,0.12), var(--shadow-lg); }
  100% { box-shadow: 0 0 0 0 rgba(201,168,76,0.0), var(--shadow-lg); }
}

/* ── Header ────────────────────────────────────────────────────────────────── */
#chat-header {
  background: var(--black-3);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid #2a2a2a;
}

#chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

#chat-logo {
  height: 28px;
  width: auto;
}

#chat-title {
  color: var(--gold);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
}

#reset-btn {
  background: rgba(201,168,76,0.10);
  border: 1px solid rgba(201,168,76,0.30);
  color: var(--gold);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  transition: background 0.2s;
}
#reset-btn:hover { background: rgba(201,168,76,0.20); }
#reset-btn svg { width: 14px; height: 14px; }

/* ── Messages area ─────────────────────────────────────────────────────────── */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--black);
  scroll-behavior: smooth;
}

/* Welcome */
.chat-welcome {
  background: var(--black-2);
  border-radius: 12px 12px 12px 4px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  max-width: 90%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.30);
  animation: welcome-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s both;
  border: 1px solid #2a2a2a;
}

@keyframes welcome-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Suggestion chips */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.chip {
  background: var(--black-2);
  border: 1.5px solid var(--gold);
  color: var(--gold);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.15s, color 0.15s;
  line-height: 1.3;
}
.chip:hover {
  background: var(--gold);
  color: var(--black);
}

/* Message bubbles */
.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  animation: msg-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes msg-pop {
  from { transform: scale(0.82) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0);        opacity: 1; }
}
.msg--user {
  background: var(--gold);
  color: var(--black);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  font-weight: 500;
}
.msg--assistant {
  background: var(--black-2);
  color: var(--text);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(0,0,0,0.30);
  border: 1px solid #2a2a2a;
}
.msg--error {
  background: #1a0a0a;
  color: #e07070;
  border: 1px solid #3a1515;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Markdown rendering inside assistant bubbles */
.msg--assistant strong { font-weight: bold; color: var(--gold-light); }
.msg--assistant em { font-style: italic; }
.msg--assistant ul { padding-left: 18px; margin: 6px 0; }
.msg--assistant li { margin: 2px 0; }
.msg--assistant a { color: var(--gold); }
.msg--assistant p + p { margin-top: 6px; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: var(--black-2);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(0,0,0,0.30);
  border: 1px solid #2a2a2a;
}
.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #444;
  animation: bounce 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); background: #444; }
  30%            { transform: translateY(-6px); background: var(--gold); }
}

/* ── Input area ────────────────────────────────────────────────────────────── */
#chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #2a2a2a;
  background: var(--black-2);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  border: 1.5px solid #2a2a2a;
  border-radius: 24px;
  padding: 9px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--black);
  outline: none;
  transition: border-color 0.2s;
}
#chat-input:focus { border-color: var(--gold); }
#chat-input::placeholder { color: var(--text-light); }

#send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--black);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
#send-btn:hover { background: var(--gold-light); }
#send-btn:disabled { background: #333; cursor: default; }
#send-btn svg { width: 18px; height: 18px; }

/* ── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 85vh;
    border-radius: 20px 20px 0 0;
    transform-origin: bottom center;
  }
  #chat-fab {
    bottom: 20px;
    right: 20px;
  }
}
