/* Base/reset */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  font-family: system-ui, Segoe UI, Roboto, Arial, sans-serif;
  color: #111;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
main { max-width: 960px; margin: 2rem auto; padding: 0 1rem; }

/* Accessible focus (keyboard) */
:focus-visible {
  outline: 3px solid #0a84ff;
  outline-offset: 2px;
}

/* HEADER */
.site-header {
  background: #0a0a23;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.navbar {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.navbar a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  padding: .25rem .5rem;
  border-radius: .375rem;
}
.navbar a:hover,
.navbar a:focus-visible { 
  text-decoration: underline; 
}

/* Active page styling with CURVED underline */
.navbar a.active {
  color: #6366f1 !important; /* purple/indigo text */
  font-weight: 700;
  position: relative;
  text-decoration: none !important;
}

/* CURVED purple underline - like in your image! */
.navbar a.active::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 3px;
  background-color: #6366f1;
  border-radius: 50%; /* Makes it curved */
  transform: scaleY(0.6); /* Flattens it to look like a smile curve */
}

.navbar a.active:hover {
  text-decoration: none !important;
}

/* FOOTER */
.site-footer {
  border-top: 1px solid #eee;
  color: #555;
  margin-top: 3rem;
  padding: 1.25rem 1rem;
}
.site-footer .wrap { max-width: 960px; margin: 0 auto; }

/* CHAT STYLES */
.chat-box {
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 1rem;
  min-height: 320px;
  background: #fafafa;
  overflow-wrap: anywhere;
}
.msg { margin: .75rem 0; line-height: 1.5; }
.msg .bubble {
  display: inline-block;
  padding: .6rem .8rem;
  border-radius: 12px;
  max-width: 80%;
}
.msg.user { text-align: right; }
.msg.user .bubble { background: #0a0a23; color: #fff; }
.msg.bot .bubble { background: #fff; border: 1px solid #e5e5e5; }
.chat-form {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
}
.chat-form input {
  flex: 1;
  padding: .65rem .75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
}
.chat-form input:focus-visible { border-color: #0a84ff; }
.chat-form button {
  padding: .65rem 1rem;
  border: none;
  border-radius: 8px;
  background: #0a0a23;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.chat-form button:hover,
.chat-form button:focus-visible { filter: brightness(1.1); }
.chat-form button[disabled] { opacity: .6; cursor: not-allowed; }

/* Small screens */
@media (max-width: 640px) {
  .navbar { gap: .5rem; }
  .navbar a { padding: .25rem .4rem; font-weight: 600; }
  .msg .bubble { max-width: 100%; }
}

/* Reduce motion if user prefers */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; transition: none !important; animation: none !important; }
}

/* Prevent layout shift while header loads */
#header {
  min-height: 64px;
}

/* Smooth page transitions */
body {
  opacity: 0;
  animation: fadeIn 0.3s ease-in forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* External link styling */
a.external-link {
  position: relative;
}

a.external-link::after {
  content: "↗";
  display: inline-block;
  margin-left: 4px;
  font-size: 0.85em;
  opacity: 0.6;
  transition: opacity 0.2s;
}

a.external-link:hover::after {
  opacity: 1;
}