/* ============================================
   LANDING PAGE — Editorial Dark Academic
   ============================================ */

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

:root {
  --ink: #0e0e14;
  --paper: #f5f2ed;
  --cream: #ede8df;
  --accent: #c8974a;
  --accent-light: #e8b870;
  --muted: #8a8480;
  --border: rgba(200,151,74,0.2);
  --glass: rgba(14,14,20,0.6);
  --chat-bg: rgba(22,22,32,0.85);
  --radius: 2px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Mono', monospace;
  background: var(--ink);
  color: var(--paper);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ---- Grain ---- */
.grain {
  position: fixed; inset: 0; z-index: 100;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.4;
}

/* ---- Background orbs ---- */
.bg-orbs { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(100px); opacity: 0.12;
  animation: drift 18s ease-in-out infinite alternate;
}
.orb-1 { width: 600px; height: 600px; background: #c8974a; top: -200px; left: -200px; animation-delay: 0s; }
.orb-2 { width: 500px; height: 500px; background: #3d6b8c; bottom: -150px; right: -100px; animation-delay: -6s; }
.orb-3 { width: 400px; height: 400px; background: #8c3d5a; top: 40%; left: 40%; animation-delay: -12s; }

@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.08); }
}

/* ---- MAIN LAYOUT ---- */
.landing {
  position: relative; z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  gap: 0;
}

.visitor-map {
  margin-top: 1.5rem;
  opacity: 0.8;
  filter: brightness(0.9);
}

/* ============ IDENTITY SIDE ============ */
.identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 3rem 3rem 4rem;
  border-right: 1px solid var(--border);
  position: relative;
}

.identity::after {
  content: '';
  position: absolute; right: -1px; top: 15%; bottom: 15%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--accent), transparent);
}

/* Photo */
.photo-frame {
  position: relative;
  width: 180px; height: 180px;
  margin-bottom: 2rem;
  flex-shrink: 0;
}

.photo-border-anim {
  position: absolute; inset: -3px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), transparent, var(--accent-light), transparent, var(--accent));
  animation: spin 8s linear infinite;
  z-index: -1;
}

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

.photo {
  width: 180px; height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--ink);
  display: block;
}

.photo-accent {
  position: absolute;
  bottom: 5px; right: 5px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--ink);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* Identity text */
.identity-text { width: 100%; max-width: 400px; }

.pre-name {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.2s;
}

.name {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(3rem, 5vw, 4.5rem);
  font-weight: 300;
  line-height: 0.9;
  margin-bottom: 1.2rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.4s;
}

.name em {
  font-style: italic;
  color: var(--accent-light);
}

.title-line {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 1.2rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.6s;
  flex-wrap: wrap;
}

.title-badge {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  color: var(--muted);
}

.divider { color: var(--accent); }

.tagline {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.7;
  color: rgba(245,242,237,0.65);
  margin-bottom: 1.8rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.8s;
}

/* Quick links */
.quick-links {
  display: flex; gap: 0.75rem;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 1s;
}

.ql {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 0.25s ease;
  background: rgba(255,255,255,0.02);
}

.ql img, .ql svg {
  width: 14px; height: 14px;
  filter: invert(1) brightness(0.6);
  transition: filter 0.25s;
}

.ql:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(200,151,74,0.06);
}

.ql:hover img, .ql:hover svg {
  filter: invert(1) brightness(1) sepia(1) saturate(5) hue-rotate(5deg);
}

/* Enter button */
.enter-btn {
  display: inline-flex; align-items: center; gap: 0.75rem;
  padding: 0.85rem 2rem;
  background: var(--accent);
  color: var(--ink);
  text-decoration: none;
  font-family: 'Syne', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 0.25s ease;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 1.2s;
}

.enter-btn svg { width: 18px; height: 18px; transition: transform 0.25s; }
.enter-btn:hover { background: var(--accent-light); transform: translateX(4px); }
.enter-btn:hover svg { transform: translateX(4px); }

/* ============ CHAT SIDE ============ */
.chat-section {
  display: flex;
  flex-direction: column;
  padding: 2.5rem;
  position: relative;
  background: linear-gradient(135deg, rgba(20,20,30,0.4), rgba(14,14,20,0.2));
}

.chat-header {
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.5s;
}

.chat-status {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ade80;
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-text {
  font-family: 'Syne', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.chat-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  color: rgba(245,242,237,0.5);
  font-style: italic;
}

/* Chat window */
.chat-window {
  flex: 1;
  overflow-y: auto;
  background: var(--chat-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 0.75rem;
  max-height: calc(100vh - 280px);
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.7s;
  scroll-behavior: smooth;
}

.chat-window::-webkit-scrollbar { width: 4px; }
.chat-window::-webkit-scrollbar-track { background: transparent; }
.chat-window::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.message {
  display: flex; align-items: flex-start; gap: 0.75rem;
  animation: msgAppear 0.3s ease;
}

@keyframes msgAppear {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-message { flex-direction: row-reverse; }

.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 600; color: var(--ink);
  flex-shrink: 0;
  font-family: 'Syne', sans-serif;
}

.user-message .msg-avatar {
  background: rgba(255,255,255,0.1);
  color: var(--paper);
  border: 1px solid var(--border);
}

.msg-bubble {
  max-width: 78%;
  padding: 0.75rem 1rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.65;
  color: rgba(245,242,237,0.85);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 0 8px 8px 8px;
}

.user-message .msg-bubble {
  background: rgba(200,151,74,0.12);
  border-color: rgba(200,151,74,0.3);
  border-radius: 8px 0 8px 8px;
  color: var(--paper);
}

/* Typing indicator */
.typing-bubble {
  display: flex; gap: 4px; align-items: center;
  padding: 0.75rem 1rem;
}

.typing-bubble span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: typing 1.2s infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Suggestions */
.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-bottom: 0.75rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.9s;
}

.suggestion-chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.3rem 0.75rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.suggestion-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(200,151,74,0.06);
}

/* Input */
.chat-input-area {
  display: flex; gap: 0;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 1.1s;
}

#chatInput {
  flex: 1;
  background: transparent;
  border: none; outline: none;
  color: var(--paper);
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  padding: 0.85rem 1rem;
  caret-color: var(--accent);
}

#chatInput::placeholder { color: var(--muted); }

#sendBtn {
  width: 48px; height: 48px;
  background: var(--accent);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
  transition: background 0.2s;
  flex-shrink: 0;
}

#sendBtn:hover { background: var(--accent-light); }
#sendBtn svg { width: 18px; height: 18px; }

/* Scroll hint */
.scroll-hint {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 1.5s;
}

.scroll-hint a {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.scroll-hint a:hover { color: var(--accent); }
.scroll-hint svg { width: 14px; height: 14px; }

/* ---- Animations ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  body { overflow: auto; }
  .landing { grid-template-columns: 1fr; min-height: auto; }
  .identity { border-right: none; border-bottom: 1px solid var(--border); padding: 3rem 2rem; }
  .identity::after { display: none; }
  .chat-section { padding: 2rem; }
  .chat-window { max-height: 400px; }
  .photo-frame { width: 140px; height: 140px; }
  .photo { width: 140px; height: 140px; }
  .name { font-size: 2.8rem; }
}
