/* ==========================================================================
   Flavor Theme - Component Styles
   All components consume design tokens via hsl(var(--token)).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */

.card {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: calc(var(--radius) * 1.4);
  border: 1px solid hsl(var(--border) / 0.5);
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-image {
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .card-image img {
  transform: scale(1.03);
}

.card-image-link {
  display: block;
  text-decoration: none;
}

.card-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.35;
  color: hsl(var(--card-foreground));
  letter-spacing: -0.01em;
}

.card-title a {
  color: inherit;
  text-decoration: none;
}

.card-title a:hover {
  color: hsl(var(--primary));
}

.card-excerpt {
  font-size: 0.875rem;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.5rem;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: auto;
  padding-top: 1rem;
}

.card-meta .post-meta__sep {
  color: hsl(var(--muted-foreground) / 0.5);
  user-select: none;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   Card Grid
   -------------------------------------------------------------------------- */

.card-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}

.card-grid .card {
  display: flex;
  flex-direction: column;
  flex: 1;
}

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card-grid--3col {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .card-grid--3col {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .card-grid--3col {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --------------------------------------------------------------------------
   Badge
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  transition: var(--transition-colors);
}

.badge--default {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.badge--secondary {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.badge--outline {
  border: 1px solid hsl(var(--border));
  background-color: transparent;
  color: hsl(var(--foreground));
}

/* --------------------------------------------------------------------------
   Button
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  height: 2.25rem;
  padding-left: 1rem;
  padding-right: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-colors);
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* Primary */
.btn--primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.btn--primary:hover {
  background-color: hsl(var(--primary) / 0.9);
}

/* Outline */
.btn--outline {
  border-color: hsl(var(--input));
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

.btn--outline:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* Ghost */
.btn--ghost {
  background-color: transparent;
  color: hsl(var(--foreground));
}

.btn--ghost:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* Link */
.btn--link {
  background-color: transparent;
  color: hsl(var(--primary));
  text-decoration: underline;
  text-underline-offset: 4px;
  height: auto;
  padding: 0;
}

.btn--link:hover {
  text-decoration-color: hsl(var(--primary) / 0.6);
}

/* Sizes */
.btn--sm {
  height: 2rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  font-size: 0.8125rem;
}

.btn--lg {
  height: 2.75rem;
  padding-left: 2rem;
  padding-right: 2rem;
  font-size: 1rem;
}

.btn--icon {
  padding: 0;
  width: 2.25rem;
  height: 2.25rem;
  justify-content: center;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Input
   -------------------------------------------------------------------------- */

.input {
  display: flex;
  height: 2.25rem;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--input));
  background-color: transparent;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: hsl(var(--foreground));
  font-family: var(--font-sans);
  transition: var(--transition-colors);
}

.input::placeholder {
  color: hsl(var(--muted-foreground));
}

.input:focus {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-color: transparent;
}

.input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* --------------------------------------------------------------------------
   Avatar
   -------------------------------------------------------------------------- */

.avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--sm {
  width: 1.5rem;
  height: 1.5rem;
}

.avatar--lg {
  width: 2.5rem;
  height: 2.5rem;
}

/* --------------------------------------------------------------------------
   Breadcrumb
   -------------------------------------------------------------------------- */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.breadcrumb a {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: var(--transition-colors);
}

.breadcrumb a:hover {
  color: hsl(var(--foreground));
}

.breadcrumb-separator,
.breadcrumb__sep {
  color: hsl(var(--muted-foreground));
  user-select: none;
}

.breadcrumb-current,
.breadcrumb__current {
  color: hsl(var(--foreground));
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Separator
   -------------------------------------------------------------------------- */

.separator {
  height: 1px;
  width: 100%;
  background-color: hsl(var(--border));
  border: none;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav-link {
  display: inline-flex;
  align-items: center;
  height: 2.25rem;
  padding-left: 1rem;
  padding-right: 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  text-decoration: none;
  transition: var(--transition-colors);
}

.nav-link:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.nav-link--active {
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Progress Bar (reading progress)
   -------------------------------------------------------------------------- */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background-color: hsl(var(--primary));
  z-index: 9999;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Search Overlay
   -------------------------------------------------------------------------- */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgb(0 0 0 / 0.6);
  padding: 1rem;
  transition: opacity 0.2s ease;
}

.search-overlay[hidden] {
  display: none;
}

.search-overlay__inner {
  max-width: 600px;
  width: 100%;
  border-radius: calc(var(--radius) * 2);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}

.search-overlay__inner .input {
  height: 3rem;
  font-size: 1.125rem;
  padding-left: 1rem;
  padding-right: 1rem;
}
