/*
 * UI Kit components — Button, Badge, Search field, Section heading,
 * Product card, Article card, Logo.
 */

/* ---- Button ---- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-1);
  flex-shrink: 0;
  padding: var(--spacing-3) var(--spacing-6);
  border-radius: var(--radius);
  background: var(--color-surface-brand-red-normal);
  color: var(--color-text-neutral-white);
  font-size: var(--font-size-base);
  line-height: var(--leading-6);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  transition: background-color 150ms ease;
}

.button:hover {
  background: var(--color-surface-brand-red-hover);
}

.button--outline {
  border: 1px solid var(--color-surface-brand-red-normal);
  background: transparent;
  color: var(--color-surface-brand-red-normal);
}

.button--outline:hover {
  background: var(--color-surface-brand-red-normal);
  color: var(--color-text-neutral-white);
}

/* Phones use the small button variant from the Figma mobile frames. */
@media (max-width: 767px) {
  .button {
    padding: var(--spacing-2) var(--spacing-4);
    font-size: var(--font-size-sm);
    line-height: var(--leading-5);
  }
}

/* ---- Badge / Tag / Chip ---- */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-1) var(--spacing-2-5);
  border: 1px solid;
  border-radius: var(--radius-sm);
  background: var(--color-surface-neutral-primary-normal);
  white-space: nowrap;
}

.badge--red {
  border-color: var(--color-border-brand-red-secondary);
  color: var(--color-text-brand-red-hover);
}

.badge--blue {
  border-color: var(--color-border-brand-blue-secondary);
  color: var(--color-text-brand-blue-hover);
}

/* ---- Search field ---- */

.search-field {
  display: flex;
  align-items: center;
  gap: var(--spacing-2-5);
  flex: 1 1 0;
  min-width: 0;
  padding: var(--spacing-3);
  background: var(--color-surface-neutral-secondary-normal);
  border: var(--border-width) solid var(--color-border-neutral-normal);
  border-radius: var(--radius-base);
  transition: border-color 150ms ease;
}

.search-field:focus-within {
  border-color: var(--color-border-brand-blue-secondary);
}

.search-field .icon {
  color: var(--color-text-neutral-tertiary);
}

.search-field__input {
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  /* The field keeps a light surface in both themes (Figma). */
  color: #0f172a;
  font-size: var(--font-size-base);
  line-height: var(--leading-6);
  text-overflow: ellipsis;
}

.search-field__input::placeholder {
  color: var(--color-text-neutral-tertiary);
  opacity: 1;
}

@media (max-width: 767px) {
  .search-field {
    padding: var(--spacing-2) var(--spacing-3);
  }

  .search-field__input {
    font-size: var(--font-size-sm);
    line-height: var(--leading-5);
  }
}

/* ---- Section heading ---- */

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-6);
}

.section-heading__title {
  /* Width from the Figma frame; controls where the heading wraps. */
  max-width: var(--title-width, 522px);
  color: var(--color-text-neutral-primary);
}

@media (max-width: 767px) {
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-4);
  }

  .section-heading__title {
    font-size: var(--font-size-xl);
    line-height: var(--leading-7);
  }
}

/* ---- Product card ---- */

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
  border-radius: var(--radius-base);
}

.product-card__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 240px;
  overflow: hidden;
  border-radius: var(--radius-base);
  background: var(--color-surface-neutral-secondary-medium);
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 250ms ease;
}

.product-card__tags {
  position: absolute;
  top: var(--spacing-3);
  left: var(--spacing-3);
  display: flex;
  gap: var(--spacing-1-5);
}

.product-card__body,
.article-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.product-card__category,
.article-card__category {
  color: var(--color-text-brand-blue-default);
  text-transform: uppercase;
}

.product-card__info,
.article-card__info {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-1);
}

.product-card__name,
.article-card__title {
  color: var(--color-text-neutral-primary);
  transition: color 150ms ease;
}

/* Stretch the title link over the whole card. */
.product-card__name a::after,
.article-card__title a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.product-card__description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--color-text-neutral-secondary);
}

.product-card__link {
  display: flex;
  align-items: center;
  gap: var(--spacing-1-5);
  color: var(--color-text-neutral-secondary);
  transition: color 150ms ease;
}

/* Hover state (first card in the Figma showcase). */
.product-card:hover .product-card__image {
  transform: scale(1.19);
}

.product-card:hover .product-card__name,
.product-card:hover .product-card__link {
  color: var(--color-text-brand-blue-hover);
}

/* ---- Article card ---- */

.article-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

.article-card__media {
  height: 220px;
  overflow: hidden;
  border-radius: var(--radius-base);
  background: var(--color-surface-neutral-secondary-normal);
}

.article-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 250ms ease;
}

.article-card__excerpt,
.article-card__date {
  color: var(--color-text-neutral-secondary);
}

.article-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-2);
}

.article-card__read-more {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  color: var(--color-text-neutral-primary);
  transition: color 150ms ease;
}

/* Hover state (first card in the Figma article list). */
.article-card:hover .article-card__title,
.article-card:hover .article-card__read-more {
  color: var(--color-text-brand-blue-hover);
}

.article-card:hover .article-card__image {
  transform: scale(1.04);
}

/* ---- Logo ---- */

/* Placeholder wordmark; swap the <svg> for the exported logo <img> when available. */
.logo {
  color: #d81e2c;
}

.logo--inverse {
  color: #ffffff;
}
