/* ==========================================================================
   Components — Baiona Natura
   Reusable UI components following the design token system.
   ========================================================================== */

/* -- Hero Banner (pages & categories) -------------------------------------- */

.bn-hero-banner {
  position: relative;
  width: 100%;
  min-height: 280px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: flex-end;
}

.bn-hero-banner__overlay {
  width: 100%;
  padding: var(--bn-space-16) 0 var(--bn-space-10);
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
}

.bn-hero-banner__title {
  color: #fff;
  font-size: var(--bn-text-4xl);
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  margin: 0;
}

.bn-hero-banner__desc {
  color: rgba(255,255,255,0.9);
  font-size: var(--bn-text-lg);
  max-width: 600px;
  margin-inline: auto;
  margin-top: var(--bn-space-3);
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

@media (min-width: 768px) {
  .bn-hero-banner {
    min-height: 360px;
  }
  .bn-hero-banner__title {
    font-size: var(--bn-text-5xl);
  }
}

/* -- Buttons ---------------------------------------------------------------- */
.bn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--bn-space-2);
  padding: var(--bn-space-3) var(--bn-space-6);
  font-family: var(--bn-font-sans);
  font-size: var(--bn-text-sm);
  font-weight: var(--bn-font-weight-semibold);
  line-height: 1;
  border-radius: var(--bn-radius-md);
  border: var(--bn-border-width) solid transparent;
  cursor: pointer;
  transition: all var(--bn-transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.bn-btn:focus-visible {
  outline: 2px solid var(--bn-color-border-focus);
  outline-offset: 2px;
}

.bn-btn--primary {
  background-color: var(--bn-color-primary);
  color: var(--bn-color-text-inverse);
}

.bn-btn--primary:hover {
  background-color: var(--bn-color-primary-hover);
  color: var(--bn-color-text-inverse);
}

.bn-btn--secondary {
  background-color: transparent;
  color: var(--bn-color-primary);
  border-color: var(--bn-color-primary);
}

.bn-btn--secondary:hover {
  background-color: var(--bn-color-primary);
  color: var(--bn-color-text-inverse);
}

.bn-btn--ghost {
  background-color: transparent;
  color: var(--bn-color-primary);
}

.bn-btn--ghost:hover {
  background-color: var(--bn-color-primary-light);
}

.bn-btn--lg {
  padding: var(--bn-space-4) var(--bn-space-8);
  font-size: var(--bn-text-base);
}

.bn-btn--sm {
  padding: var(--bn-space-2) var(--bn-space-4);
  font-size: var(--bn-text-xs);
}

/* -- Cards ------------------------------------------------------------------ */
.bn-card {
  background: var(--bn-color-surface);
  border-radius: var(--bn-radius-xl);
  overflow: hidden;
  box-shadow: var(--bn-shadow-sm);
  transition: box-shadow var(--bn-transition-normal), transform var(--bn-transition-normal);
}

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

.bn-card__image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.bn-card__body {
  padding: var(--bn-space-6);
}

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

.bn-card__title a {
  color: inherit;
  text-decoration: none;
}

.bn-card__title a:hover {
  color: var(--bn-color-primary);
}

a.bn-card--link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
a.bn-card--link:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.bn-card__excerpt {
  color: var(--bn-color-text-muted);
  font-size: var(--bn-text-sm);
  line-height: var(--bn-leading-normal);
  margin-bottom: var(--bn-space-4);
}

.bn-card__meta {
  display: flex;
  align-items: center;
  gap: var(--bn-space-3);
  font-size: var(--bn-text-xs);
  color: var(--bn-color-text-muted);
}

/* -- Badge ------------------------------------------------------------------ */
.bn-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--bn-space-1);
  padding: var(--bn-space-1) var(--bn-space-3);
  font-size: var(--bn-text-xs);
  font-weight: var(--bn-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--bn-tracking-wide);
  border-radius: var(--bn-radius-full);
  background-color: var(--bn-color-primary-muted);
  color: var(--bn-color-primary);
}

/* -- Feature Block ---------------------------------------------------------- */
.bn-feature {
  text-align: center;
  padding: var(--bn-space-8);
}

.bn-feature__icon {
  width: 64px;
  height: 64px;
  margin-inline: auto;
  margin-bottom: var(--bn-space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bn-color-primary-muted);
  color: var(--bn-color-primary);
  border-radius: var(--bn-radius-xl);
  font-size: var(--bn-text-2xl);
}

.bn-feature__title {
  font-family: var(--bn-font-heading);
  font-size: var(--bn-text-xl);
  margin-bottom: var(--bn-space-3);
  color: var(--bn-color-text-heading);
}

.bn-feature__desc {
  color: var(--bn-color-text-muted);
  font-size: var(--bn-text-sm);
  line-height: var(--bn-leading-normal);
}

/* -- Navigation ------------------------------------------------------------- */
.bn-nav {
  display: flex;
  align-items: center;
  gap: var(--bn-space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.bn-nav .menu-item {
  list-style: none;
}

.bn-nav a,
.bn-nav .menu-item a {
  display: block;
  padding: var(--bn-space-2) var(--bn-space-3);
  font-size: var(--bn-text-sm);
  font-weight: var(--bn-font-weight-medium);
  color: var(--bn-color-neutral-600);
  border-radius: var(--bn-radius-md);
  transition: all var(--bn-transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.bn-nav a:hover,
.bn-nav .menu-item a:hover,
.bn-nav .current-menu-item a,
.bn-nav .current_page_item a {
  color: var(--bn-color-primary);
  background: var(--bn-color-primary-light);
}

/* Sub-menus */
.bn-nav .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bn-color-surface);
  border-radius: var(--bn-radius-lg);
  box-shadow: var(--bn-shadow-lg);
  padding: var(--bn-space-2);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--bn-transition-fast);
  z-index: var(--bn-z-dropdown);
}

.bn-nav .menu-item-has-children {
  position: relative;
}

.bn-nav .menu-item-has-children:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.bn-nav .sub-menu a {
  padding: var(--bn-space-2) var(--bn-space-4);
}

/* -- Hero Section ----------------------------------------------------------- */
.bn-hero {
  position: relative;
  padding-block: var(--bn-space-20);
  overflow: hidden;
}

.bn-hero--full {
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.bn-hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

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

.bn-hero__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(5, 46, 22, 0.85) 0%,
    rgba(21, 128, 61, 0.6) 100%
  );
}

.bn-hero__content {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.bn-hero__content h1 {
  color: var(--bn-color-text-inverse);
  margin-bottom: var(--bn-space-6);
}

.bn-hero__content p {
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--bn-text-lg);
  line-height: var(--bn-leading-normal);
  max-width: 520px;
  margin-bottom: var(--bn-space-8);
}

.bn-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bn-space-4);
}

/* -- Decorative Leaf Divider ------------------------------------------------ */
.bn-divider-leaf {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--bn-space-4);
  margin-block: var(--bn-space-8);
  color: var(--bn-color-green-300);
}

.bn-divider-leaf::before,
.bn-divider-leaf::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--bn-color-border);
}

/* -- Pagination ------------------------------------------------------------- */
.bn-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--bn-space-2);
  padding-top: var(--bn-space-12);
}

.bn-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: var(--bn-text-sm);
  font-weight: var(--bn-font-weight-medium);
  border-radius: var(--bn-radius-md);
  color: var(--bn-color-text);
  transition: all var(--bn-transition-fast);
}

.bn-pagination .page-numbers:hover,
.bn-pagination .page-numbers.current {
  background: var(--bn-color-primary);
  color: var(--bn-color-text-inverse);
}

/* -- WordPress Specific ----------------------------------------------------- */

/* Tame excessive inline padding on block-group containers (WP editor sets
   min(7rem, 10vw) which creates huge gaps in page layouts). */
.wp-block-group.has-background[style] {
  padding-top: 2.5rem !important;
  padding-bottom: 2.5rem !important;
}

.wp-block-group.is-style-default[style] {
  padding: 2rem !important;
}

.wp-block-image img {
  border-radius: var(--bn-radius-lg);
}

/* Vertical rhythm for post/page content */
.entry-content > * + * {
  margin-top: var(--bn-space-6);
}

.entry-content p {
  margin-bottom: var(--bn-space-4);
  line-height: var(--bn-leading-normal);
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  margin-top: var(--bn-space-10);
  margin-bottom: var(--bn-space-4);
}

.entry-content figure {
  margin: var(--bn-space-8) 0;
}

.entry-content figure img {
  border-radius: var(--bn-radius-lg);
  width: 100%;
  height: auto;
}

/* Logo gallery — contain logos without cropping */
.wp-block-gallery.has-nested-images figure.wp-block-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--bn-space-4);
  background: var(--bn-color-bg);
  border-radius: var(--bn-radius-lg);
  border: var(--bn-border-width) solid var(--bn-color-border);
  aspect-ratio: 1;
}

.wp-block-gallery.has-nested-images figure.wp-block-image img {
  width: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0;
}

/* WP columns layout */
.wp-block-columns {
  display: flex;
  gap: var(--bn-space-8);
  align-items: flex-start;
}

.wp-block-column {
  flex: 1;
}

@media (max-width: 768px) {
  .wp-block-columns {
    flex-direction: column;
  }
}

.entry-content figcaption {
  margin-top: var(--bn-space-3);
  font-size: var(--bn-text-sm);
  color: var(--bn-color-text-muted);
  line-height: var(--bn-leading-normal);
}

.entry-content blockquote {
  margin: var(--bn-space-8) 0;
  padding: var(--bn-space-4) var(--bn-space-6);
  border-left: 4px solid var(--bn-color-primary);
  background: var(--bn-color-bg-alt);
  border-radius: 0 var(--bn-radius-md) var(--bn-radius-md) 0;
}

.entry-content hr {
  margin: var(--bn-space-10) 0;
  border: none;
  border-top: var(--bn-border-width) solid var(--bn-color-border);
}

.entry-content ul,
.entry-content ol {
  margin-left: var(--bn-space-6);
  margin-bottom: var(--bn-space-4);
}

.entry-content ul {
  list-style-type: disc;
}

.entry-content ol {
  list-style-type: decimal;
}

.entry-content li {
  margin-bottom: var(--bn-space-2);
  line-height: var(--bn-leading-normal);
}

.entry-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--bn-space-6);
}

.entry-content th,
.entry-content td {
  padding: var(--bn-space-3) var(--bn-space-4);
  border-bottom: var(--bn-border-width) solid var(--bn-color-border);
  text-align: left;
}

.entry-content th {
  font-weight: var(--bn-font-weight-semibold);
  background: var(--bn-color-bg-alt);
}

/* -- Forms ------------------------------------------------------------------- */
.bn-form-group {
  margin-bottom: var(--bn-space-4);
}

.bn-form-group label {
  display: block;
  margin-bottom: var(--bn-space-2);
  font-size: var(--bn-text-sm);
  font-weight: var(--bn-font-weight-medium);
  color: var(--bn-color-text-heading);
}

.bn-input,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="search"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: var(--bn-space-3) var(--bn-space-4);
  font-size: var(--bn-text-base);
  border: var(--bn-border-width) solid var(--bn-color-border);
  border-radius: var(--bn-radius-md);
  background: var(--bn-color-surface);
  transition: border-color var(--bn-transition-fast), box-shadow var(--bn-transition-fast);
}

.bn-input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--bn-color-border-focus);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

/* WP Search Form */
.search-form {
  display: flex;
  gap: var(--bn-space-2);
}

.search-form .search-field {
  flex: 1;
}

.search-form .search-submit {
  background: var(--bn-color-primary);
  color: var(--bn-color-text-inverse);
  border: none;
  padding: var(--bn-space-3) var(--bn-space-6);
  border-radius: var(--bn-radius-md);
  cursor: pointer;
  font-weight: var(--bn-font-weight-semibold);
  transition: background var(--bn-transition-fast);
}

.search-form .search-submit:hover {
  background: var(--bn-color-primary-hover);
}

/* -- Comments --------------------------------------------------------------- */
.bn-comments .comment {
  padding: var(--bn-space-6);
  margin-bottom: var(--bn-space-4);
  background: var(--bn-color-bg-alt);
  border-radius: var(--bn-radius-lg);
}

.bn-comments .comment .children {
  margin-left: var(--bn-space-8);
  margin-top: var(--bn-space-4);
}

.bn-comments .comment-author {
  font-weight: var(--bn-font-weight-semibold);
  margin-bottom: var(--bn-space-2);
}

.bn-comments .comment-meta {
  font-size: var(--bn-text-xs);
  color: var(--bn-color-text-muted);
  margin-bottom: var(--bn-space-3);
}

/* -- Widget Styles ---------------------------------------------------------- */
.widget {
  margin-bottom: var(--bn-space-8);
}

.widget-title {
  font-family: var(--bn-font-heading);
  font-size: var(--bn-text-lg);
  font-weight: var(--bn-font-weight-bold);
  margin-bottom: var(--bn-space-4);
  padding-bottom: var(--bn-space-3);
  border-bottom: 2px solid var(--bn-color-primary-muted);
}

.widget ul li {
  padding: var(--bn-space-2) 0;
  border-bottom: var(--bn-border-width) solid var(--bn-color-border);
}

.widget ul li:last-child {
  border-bottom: none;
}

.widget ul li a {
  font-size: var(--bn-text-sm);
}

/* -- Shortcode Forms -------------------------------------------------------- */
.bn-form {
  max-width: 640px;
  margin: 0 auto;
}

.bn-form__group {
  margin-bottom: var(--bn-space-5);
}

.bn-form__group label {
  display: block;
  margin-bottom: var(--bn-space-2);
  font-size: var(--bn-text-sm);
  font-weight: var(--bn-font-weight-medium);
  color: var(--bn-color-text-heading);
}

.bn-form__group--checkbox label {
  display: flex;
  align-items: flex-start;
  gap: var(--bn-space-2);
  font-size: var(--bn-text-sm);
  cursor: pointer;
}

.bn-form__group--checkbox input[type="checkbox"] {
  width: auto;
  margin-top: 3px;
  flex-shrink: 0;
}

.bn-form__row {
  display: flex;
  gap: var(--bn-space-4);
}

.bn-form__group--half {
  flex: 1;
  min-width: 0;
}

@media (max-width: 600px) {
  .bn-form__row {
    flex-direction: column;
    gap: 0;
  }
}

.bn-form__actions {
  margin-top: var(--bn-space-6);
}

.bn-form__feedback {
  margin-top: var(--bn-space-4);
  padding: var(--bn-space-3) var(--bn-space-4);
  border-radius: var(--bn-radius-md);
  font-size: var(--bn-text-sm);
  font-weight: var(--bn-font-weight-medium);
}

.bn-form__feedback:empty {
  display: none;
}

.bn-form__feedback--success {
  background: var(--bn-color-primary-muted);
  color: var(--bn-color-green-800, #166534);
}

.bn-form__feedback--error {
  background: #fef2f2;
  color: #991b1b;
}
