/* =============================================================================
   COMPONENTS — The Witchy Room
   Reusable UI components: buttons, cards, badges, section headings, rings.
   Depends on: design-tokens.css, base.css
   ============================================================================= */

/* ---------------------------------------------------------------------------
   BUTTONS — shared base
   --------------------------------------------------------------------------- */
.btn-primary,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding: 0 var(--space-lg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast),
              background var(--transition-fast),
              color var(--transition-fast);
}

/* ---------------------------------------------------------------------------
   .btn-primary — gradient pill with violet glow
   --------------------------------------------------------------------------- */
.btn-primary {
  background: var(--gradient-primary);
  color: var(--color-bg);
  box-shadow: var(--glow-sm);
}

.btn-primary:hover {
  transform: scale(1.02);
  box-shadow: var(--glow-md);
  color: var(--color-bg);
  text-decoration: none;
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 3px;
  box-shadow: var(--glow-md);
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary {
    transition: box-shadow var(--transition-fast);
  }

  .btn-primary:hover {
    transform: none;
  }
}

/* ---------------------------------------------------------------------------
   .btn-secondary — transparent with violet border
   --------------------------------------------------------------------------- */
.btn-secondary {
  background: transparent;
  color: var(--color-violet);
  border: 1px solid var(--color-violet);
}

.btn-secondary:hover {
  background: rgba(157, 123, 255, 0.12);
  color: var(--color-violet);
  text-decoration: none;
  box-shadow: var(--glow-sm);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--color-violet);
  outline-offset: 3px;
  box-shadow: var(--glow-sm);
}

/* ---------------------------------------------------------------------------
   .btn-ghost — text only with right-arrow icon slot
   --------------------------------------------------------------------------- */
.btn-ghost {
  background: transparent;
  color: var(--color-text);
  padding: 0;
  min-height: auto;
  font-weight: 500;
  border-radius: 0;
}

.btn-ghost::after {
  content: '→';
  display: inline-block;
  margin-left: var(--space-xs);
  transition: transform var(--transition-fast);
}

.btn-ghost:hover {
  color: var(--color-violet);
  text-decoration: none;
}

.btn-ghost:hover::after {
  transform: translateX(4px);
}

.btn-ghost:focus-visible {
  outline: 2px solid var(--color-violet);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
  box-shadow: var(--glow-sm);
}

@media (prefers-reduced-motion: reduce) {
  .btn-ghost::after {
    transition: none;
  }

  .btn-ghost:hover::after {
    transform: none;
  }
}

/* ---------------------------------------------------------------------------
   .card — surface tile with violet border, hover glow
   --------------------------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: box-shadow var(--transition-base),
              border-color var(--transition-base),
              transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--glow-sm);
  border-color: var(--color-border-hover);
}

@media (prefers-reduced-motion: no-preference) {
  .card:hover {
    transform: translateY(-2px);
  }
}

/* Card inner padding */
.card__body {
  padding: var(--space-lg);
}

.card__image {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.card__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-sm);
}

.card__meta {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-md);
}

.card__excerpt {
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* ---------------------------------------------------------------------------
   .badge — small pill labels
   --------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Violet variant (default) */
.badge--violet {
  background: rgba(157, 123, 255, 0.15);
  color: var(--color-violet);
  border: 1px solid rgba(157, 123, 255, 0.3);
}

/* Gold variant */
.badge--gold {
  background: rgba(246, 216, 138, 0.15);
  color: var(--color-gold);
  border: 1px solid rgba(246, 216, 138, 0.3);
}

/* Teal variant */
.badge--teal {
  background: rgba(78, 210, 197, 0.15);
  color: var(--color-teal);
  border: 1px solid rgba(78, 210, 197, 0.3);
}

/* Pink variant */
.badge--pink {
  background: rgba(255, 123, 217, 0.15);
  color: var(--color-pink);
  border: 1px solid rgba(255, 123, 217, 0.3);
}

/* ---------------------------------------------------------------------------
   .section-heading — H2 with decorative star motif
   --------------------------------------------------------------------------- */
.section-heading {
  font-family: var(--font-heading);
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  letter-spacing: -0.01em;
}

.section-heading::before,
.section-heading::after {
  content: '✦';
  color: var(--color-violet);
  font-size: 0.6em;
  flex-shrink: 0;
  opacity: 0.8;
}

/* Left-aligned variant */
.section-heading--left {
  text-align: left;
  justify-content: flex-start;
}

.section-heading--left::before {
  display: none;
}

/* Subheading (supporting text below section headings) */
.section-subheading {
  text-align: center;
  color: var(--color-muted);
  font-size: var(--text-lg);
  max-width: 56ch;
  margin: var(--space-md) auto 0;
  line-height: 1.6;
}

/* ---------------------------------------------------------------------------
   .glow-ring — reusable glowing border treatment
   Use on featured/highlighted elements.
   --------------------------------------------------------------------------- */
.glow-ring {
  outline: 1px solid var(--color-violet);
  outline-offset: 3px;
  box-shadow: var(--glow-sm);
  border-radius: inherit;
}

/* Stronger variant */
.glow-ring--md {
  outline: 1px solid var(--color-violet);
  outline-offset: 3px;
  box-shadow: var(--glow-md);
  border-radius: inherit;
}

/* ---------------------------------------------------------------------------
   .tag-list — horizontal scrolling taxonomy tag row
   --------------------------------------------------------------------------- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  list-style: none;
}

/* ---------------------------------------------------------------------------
   .card hover — refined
   Overrides the initial card transition and hover rules above.
   Changes: 200ms timing, -3px lift, border to rgba(157,123,255,0.5).
   prefers-reduced-motion: transform removed, border colour kept.
   --------------------------------------------------------------------------- */

/* Tighter 200ms timing replaces --transition-base (250ms). */
.card {
  transition:
    transform     200ms ease-out,
    border-color  200ms ease-out,
    box-shadow    200ms ease-out;
}

/* Border lands at 0.5 opacity — more restrained than --color-border-hover (0.6). */
.card:hover {
  border-color: rgba(157, 123, 255, 0.5);
}

/* Deeper lift: -3px instead of -2px. Guard: only for no-preference users. */
@media (prefers-reduced-motion: no-preference) {
  .card:hover {
    transform: translateY(-3px);
  }
}

/* Explicit reduce block: zero transform, border colour still transitions. */
@media (prefers-reduced-motion: reduce) {
  .card {
    transition:
      border-color 200ms ease-out,
      box-shadow   200ms ease-out;
  }

  .card:hover {
    transform: none;
  }
}

/* ---------------------------------------------------------------------------
   .divider — visual section separator with gradient
   --------------------------------------------------------------------------- */
.divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--color-border-hover),
    transparent
  );
  margin: var(--space-xl) 0;
}
