:root {
  /* Brand colors */
  --brand-color: #ff3e00;

  /* Text colors */
  --text-primary: #333;
  --text-secondary: #555;
  --text-muted: #999;

  /* Background colors */
  --bg-primary: #f5f5f5;
  --bg-white: #fff;
  --bg-light: #f8f8f8;

  /* Border colors */
  --border-light: #e0e0e0;
  --border-dotted: #ccc;

  /* Heading styles */
  --heading-weight: 100;
  --heading-spacing: 0.06rem;
  --heading-transform: uppercase;

  /* Shadows */
  --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.1);

  /* Transitions */
  --transition-fast: 0.2s ease;
}

html {
  font-size: 16px; /* Explicitly set root font size for rem consistency */
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  line-height: 1.4;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Header and Navigation styles are now handled by the web component */
.bracket {
  color: var(--brand-color);
}

/* Main content - now handled by the web component slot */
main {
  width: 100%;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 2rem 0 3rem;
}

.avatar {
  margin-bottom: 2rem;
}

.avatar img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-white);
  box-shadow: var(--shadow-light);
}

.intro {
  margin-bottom: 2rem;
}

.intro p {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.intro strong {
  color: var(--text-primary);
  font-weight: 600;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.social-icons a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.social-icons a:hover {
  color: var(--brand-color);
}

/* Heading styles */
h1,
h2,
h3,
h4,
h5,
h6 {
  text-transform: var(--heading-transform);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-spacing);
}

/* Works and Projects sections */
.works,
.projects {
  margin-bottom: 3rem;
  text-align: center;
}

.works h2,
.projects h2 {
  font-size: 1.4rem;
  font-weight: var(--heading-weight);
  color: var(--brand-color);
  margin-bottom: 2rem;
  letter-spacing: var(--heading-spacing);
}

.works-list,
.projects-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.work-item,
.project-item {
  text-decoration: none; /* Keep for items that are <a> tags */
  color: var(--text-primary); /* Main text color for the item */
  font-size: 1rem;
  padding: 0.75rem 1rem; /* Adjusted padding for a card-like feel */
  /* border-bottom: 1px dotted var(--border-dotted); */ /* Removed border */
  transition: color var(--transition-fast),
    background-color var(--transition-fast), box-shadow var(--transition-fast);
  min-width: 200px; /* Minimum width */
  max-width: 550px; /* Maximum width to control line length and encourage wrapping */
  width: 100%; /* Take available width up to max-width */
  text-align: left; /* Align text to the left within the card */
  position: relative;
  background-color: var(--bg-white); /* Card background */
  border-radius: 6px; /* Rounded corners */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); /* Subtle shadow */
  margin-bottom: 0.5rem; /* Ensure spacing if flex gap isn't enough */
}

.work-item:hover,
.project-item:hover {
  color: var(--text-primary); /* Keep text color consistent */
  background-color: var(--bg-light); /* Subtle background change on hover */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08); /* Enhanced shadow on hover */
}

/* Styling for links *within* a project or work item (e.g., BiasDetector links) */
.project-item a,
.work-item a {
  color: var(--text-secondary); /* More subtle link color */
  text-decoration: underline; /* Standard subtle link indicator */
  font-weight: normal; /* Ensure not bold by default */
  transition: color var(--transition-fast);
}

.project-item a:hover,
.work-item a:hover {
  color: var(--brand-color); /* Brand color on hover for emphasis */
  text-decoration: none; /* Optionally remove underline on hover */
}

/* Footer styles are now handled by the web component */

/* Individual work/project pages */
.work-detail {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 0;
}

.work-title {
  text-align: center;
  margin-bottom: 3rem;
}

.work-title h1 {
  font-size: 1.5rem;
  color: var(--brand-color);
  font-weight: var(--heading-weight);
  margin-bottom: 1rem;
}

.work-description {
  text-align: center;
  margin-bottom: 3rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.work-description a {
  color: var(--brand-color);
  text-decoration: none;
}

.work-description a:hover {
  text-decoration: underline;
}

.slideshow-section {
  margin-bottom: 3rem;
}

.slideshow-section h2 {
  text-align: center;
  font-size: 1.1rem;
  color: var(--brand-color);
  margin-bottom: 2rem;
  font-weight: var(--heading-weight);
}

.slideshow-container {
  position: relative;
  max-width: 350px; /* Narrower to better fit portrait images */
  max-height: 750px; /* Allow dynamic height up to this limit */
  margin: 0 auto;
  background-color: var(--bg-white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-light);
}

.slide {
  display: none;
  position: relative;
}

.slide.active {
  display: block;
}

.slide img {
  width: 100%;
  height: auto; /* Allow image to determine its own height */
  object-fit: contain; /* Ensure the entire image is visible */
  display: block;
}

.slide-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  padding: 1rem;
  cursor: pointer;
  font-size: 1.2rem;
  transition: background-color 0.2s ease;
}

.slide-nav:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.prev {
  left: 10px;
}

.next {
  right: 10px;
}

.slide-indicators {
  text-align: center;
  padding: 1rem;
  background-color: var(--bg-light);
}

.indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--border-dotted);
  margin: 0 5px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.indicator.active {
  background-color: var(--brand-color);
}

.links-section,
.stack-section {
  margin-bottom: 3rem;
  text-align: center;
}

.links-section h2,
.stack-section h2 {
  font-size: 1.1rem;
  color: var(--brand-color);
  margin-bottom: 1.5rem;
  font-weight: var(--heading-weight);
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.link-item {
  max-width: 600px;
  text-align: center;
}

.link-item a {
  color: var(--brand-color);
  text-decoration: none;
  font-weight: 500;
}

.link-item a:hover {
  text-decoration: underline;
}

.link-source {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.stack-info {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Blog page */
.blog-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 4rem 0;
  text-align: center;
}

.blog-container h1 {
  font-size: 1.5rem;
  color: var(--brand-color);
  margin-bottom: 3rem;
  font-weight: var(--heading-weight);
}

.blog-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
}

.blog-item {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  transition: color var(--transition-fast);
  max-width: 600px;
  width: 100%;
  text-align: left;
}

.blog-item:hover {
  color: var(--brand-color);
}

.blog-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.blog-source {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* About page */
.about-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 4rem 0;
}

.about-section {
  margin-bottom: 4rem;
}

.about-section h1 {
  font-size: 1.5rem;
  color: var(--brand-color);
  margin-bottom: 2rem;
  font-weight: var(--heading-weight);
}

.about-content {
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.about-content p {
  margin-bottom: 1.5rem;
}

.about-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.contact-info {
  margin-bottom: 1rem;
}

.contact-info p {
  margin-bottom: 0.5rem;
}

.email {
  font-weight: 600;
  color: var(--text-primary);
}

.toolbox-content a {
  color: var(--brand-color);
  text-decoration: none;
}

.toolbox-content a:hover {
  text-decoration: underline;
}

.toolbox-content h3 {
  font-size: 1.2rem;
  color: var(--brand-color);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-spacing);
  text-transform: var(--heading-transform);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.toolbox-content .skills-list {
  list-style-type: none;
  padding-left: 0;
  margin-bottom: 1.5rem;
}

.toolbox-content .skills-list li {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* Responsive design */
@media (max-width: 768px) {
  .hero {
    padding: 2rem 1rem 4rem 1rem;
  }

  .works,
  .projects {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .avatar img {
    width: 100px;
    height: 100px;
  }

  .intro p {
    font-size: 1.1rem;
  }

  .social-icons {
    gap: 1rem;
  }

  .slideshow-container {
    margin: 0 1rem;
  }

  .slide-nav {
    padding: 0.5rem;
    font-size: 1rem;
  }

  .about-container,
  .blog-container,
  .work-detail {
    padding: 2rem 1rem;
  }
}

@media (max-width: 480px) {
  .intro p {
    font-size: 1rem;
  }

  .works h2,
  .projects h2 {
    font-size: 1rem;
  }

  /* Chat form adjustments for small screens */
  .chat-form button {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  #chat-input {
    font-size: 0.9rem;
    padding: 0.75rem 0.75rem;
  }

  /* Welcome message adjustment for small screens */
  .welcome-message {
    font-size: 1.2rem;
  }
}

/* Chat Page */
#chat-container {
  display: flex;
  justify-content: center;
  padding: 2rem 1rem; /* Add horizontal padding for smaller screens */
}

.chat-window {
  width: 100%;
  max-width: 800px;
  height: calc(100vh - 200px); /* Adjust height to be responsive to viewport */
  background-color: var(--bg-white);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  height: 100%;
}

.welcome-message {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.starter-prompts {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 450px;
}

.starter-prompt {
  background-color: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  color: var(--text-primary);
}

.starter-prompt:hover {
  background-color: #e9e9e9;
  border-color: #ccc;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: var(--bg-light);
  border-bottom: 1px solid var(--border-light);
}

.chat-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
}

.chat-header button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.5rem;
}

.chat-header button:hover {
  color: var(--text-primary);
}

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

.message {
  padding: 0.75rem 1rem;
  border-radius: 18px;
  line-height: 1.4;
  max-width: 80%;
}

.message.user {
  background-color: var(--brand-color);
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.message.bot {
  background-color: var(--bg-light);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.message.bot p + p {
  margin-top: 1rem;
}

.message.bot ul {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
}

.message.bot li {
  margin-bottom: 0.25rem;
}

.message.thinking {
  background-color: var(--bg-light);
  color: var(--text-muted);
  font-style: italic;
  align-self: flex-start;
}

.chat-form {
  display: flex;
  padding: 1rem;
  border-top: 1px solid var(--border-light);
}

#chat-input {
  flex-grow: 1;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease;
}

#chat-input:focus {
  border-color: var(--brand-color);
}

.chat-form button {
  background-color: var(--brand-color);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 0.75rem 1.5rem;
  margin-left: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.chat-form button:hover {
  opacity: 0.9;
}
