:root {
  --primary: #1a1a1a;
  --bg-color: #fafafa;
  --card-bg: #ffffff;
  --text-color: #1a1a1a;
  --muted-text: #666666;
  --border-color: #eaeaea;
  --tag-bg: #f5f5f5;
  --tag-hover: #e5e5e5;
  --tag-active: #1a1a1a;
  --tag-active-text: #ffffff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.header {
  background-color: var(--bg-color);
  padding: 1.5rem 1rem 0.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  /* Blur effect for sticky header */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background-color: rgba(250, 250, 250, 0.85);
}

.search-container {
  max-width: 800px;
  margin: 0 auto;
}

#searchInput {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1.1rem;
  border: none;
  border-radius: 12px;
  outline: none;
  background: var(--card-bg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: box-shadow 0.2s, transform 0.2s;
}

#searchInput:focus {
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.container {
  display: flex;
  max-width: 1000px;
  margin: 2rem auto;
  gap: 3rem;
  padding: 0 1rem;
}

/* Sidebar */
.sidebar {
  flex: 0 0 200px;
  align-self: flex-start;
  position: sticky;
  top: 120px;
}

.sidebar h2 {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-text);
  font-weight: 600;
}

.tags-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tag-btn {
  background-color: transparent;
  border: none;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--muted-text);
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.tag-btn:hover {
  background-color: var(--tag-bg);
  color: var(--text-color);
}

.tag-btn.active {
  background-color: var(--tag-active);
  color: var(--tag-active-text);
  font-weight: 500;
}

.tag-btn .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  line-height: 1;
  opacity: 0.75;
  margin-left: 0.35rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.06);
}

.tag-btn.active .count {
  background: rgba(255, 255, 255, 0.22);
  opacity: 0.95;
}

/* Main Content Area */
.content-area {
  flex: 1;
  min-width: 0; /* Prevents flex flex-child from overflowing */
}

.quotes-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.quote-card {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.quote-card:last-child {
  border-bottom: none;
}

.quote-content {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1.65;
  margin-bottom: 0.8rem;
  color: var(--text-color);
  letter-spacing: 0;
}

.quote-content.has-link {
  color: var(--text-color);
  text-decoration-line: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
  text-decoration-color: rgba(26, 26, 26, 0.28);
  transition: background-color 0.2s, text-decoration-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: inline-block;
  cursor: pointer;
  border-radius: 0.4rem;
  padding: 0.08rem 0.18rem;
  margin: 0 -0.18rem;
}

.quote-content.has-link:hover,
.quote-content.has-link:focus-visible {
  background-color: rgba(26, 26, 26, 0.05);
  text-decoration-color: rgba(26, 26, 26, 0.75);
  transform: translateY(-1px);
  outline: none;
}

.quote-content.has-link:focus-visible {
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.12);
}

/* Add an arrow icon to links */
.quote-content.has-link::after {
  content: ' ↗';
  font-size: 1rem;
  opacity: 0.65;
  vertical-align: middle;
}

.quote-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
  color: var(--muted-text);
}

.quote-author {
  font-weight: 600;
  color: var(--text-color);
}

.quote-comments {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--muted-text);
  line-height: 1.5;
}

.quote-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quote-tag {
  background-color: var(--tag-bg);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--muted-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
/* Responsive */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    margin: 1rem auto;
    gap: 1rem;
  }
  
  .sidebar {
    width: 100%;
    flex: none;
    position: static;
  }

  .sidebar h2 {
    display: none; /* Hide 'Tags' header on mobile */
  }

  .tags-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 1rem;
    margin: 0 -1rem;
    padding: 0 1rem 0.5rem 1rem;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .tags-list::-webkit-scrollbar {
    display: none;
  }

  .tag-btn {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    white-space: nowrap;
    width: auto;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    justify-content: flex-start;
    gap: 0.1rem;
  }

  .tag-btn.active {
    background-color: var(--tag-active);
    border-color: var(--tag-active);
  }

  .quote-content {
    font-size: 1.15rem;
  }
}
