/* Sil web gateway — clean, warm chat UI */

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

:root {
  --bg: #fafaf9;
  --fg: #1c1917;
  --primary: #44403c;
  --primary-hover: #292524;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --border: #e7e5e4;
  --card-bg: #ffffff;
  --muted: #78716c;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */

header {
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

header nav {
  max-width: 800px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

/* Main */

main {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
}

/* Footer */

footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: var(--muted);
}

footer a {
  color: var(--muted);
}

/* Landing */

.hero {
  text-align: center;
  padding: 4rem 0 3rem;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.03em;
}

.hero p {
  color: #57534e;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.subtitle {
  font-size: 0.875rem !important;
  color: var(--muted) !important;
  margin-bottom: 2rem !important;
}

.btn-primary {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  margin-top: 1rem;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

/* Chat */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
}

.chat-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.chat-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent);
}

.turn-counter {
  font-size: 0.8rem;
  color: var(--muted);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  max-width: 85%;
  line-height: 1.5;
}

.message.user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
  white-space: pre-wrap;
}

.message.assistant {
  background: var(--card-bg);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.message.assistant hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0;
}

.message.assistant pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0;
  overflow-x: auto;
  font-size: 0.875rem;
}

.message.assistant code {
  font-family: "SF Mono", "Fira Code",
    "Fira Mono", Menlo, monospace;
  font-size: 0.875em;
}

.message.assistant code:not(pre code) {
  background: var(--bg);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
}

.message.typing {
  color: var(--muted);
  font-style: italic;
}

.message.error {
  background: #fef2f2;
  color: #991b1b;
  align-self: center;
  font-size: 0.875rem;
}

.message.system {
  color: var(--muted);
  align-self: center;
  font-size: 0.875rem;
}

#chat-form {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

#chat-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

#chat-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

#chat-form button {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}

#chat-form button:hover {
  background: var(--accent-hover);
}

#chat-form button:disabled,
#chat-form input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Thank you */

.thankyou {
  text-align: center;
  padding: 4rem 0;
}

.thankyou h1 {
  margin-bottom: 1.5rem;
}

.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 500px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.summary-card p {
  margin-bottom: 0.5rem;
}

/* Mobile responsive */

@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .message {
    max-width: 95%;
  }

  .chat-header {
    flex-direction: column;
    gap: 0.25rem;
  }
}
