/* ==========================================================================
   Queijada da Sapa — Base Components
   Vintage/classic landing page components for a traditional pastry shop
   ==========================================================================
   File: components.css
   Purpose: All base UI components using tokens from tokens.css.
   Consumption: Import after tokens.css in your global CSS.
   ========================================================================== */

@import './tokens.css';

/* ==========================================================================
   1. BUTTON
   Variants: primary | secondary | outline | ghost
   Sizes:    sm | md | lg
   States:   hover | active | focus-visible | disabled | loading
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-none);
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-base),
              color var(--transition-base),
              border-color var(--transition-base),
              box-shadow var(--transition-base),
              transform var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Sizes */
.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

.btn--md {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

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

/* Variant: Primary (terracotta solid) */
.btn--primary {
  background-color: var(--color-primary-500);
  color: var(--color-text-inverse);
  border-color: var(--color-primary-500);
  box-shadow: var(--shadow-button);
}

.btn--primary:hover {
  background-color: var(--color-primary-600);
  border-color: var(--color-primary-600);
  box-shadow: var(--shadow-button-hover);
  transform: translateY(-1px);
}

.btn--primary:active {
  background-color: var(--color-primary-700);
  border-color: var(--color-primary-700);
  transform: translateY(0);
  box-shadow: var(--shadow-inner);
}

.btn--primary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), var(--shadow-button);
}

.btn--primary:disabled,
.btn--primary[aria-disabled="true"] {
  background-color: var(--color-neutral-300);
  border-color: var(--color-neutral-300);
  color: var(--color-neutral-500);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Variant: Secondary (warm cream bg, brown text) */
.btn--secondary {
  background-color: var(--color-surface-elevated);
  color: var(--color-secondary-700);
  border-color: var(--color-secondary-300);
}

.btn--secondary:hover {
  background-color: var(--color-secondary-100);
  border-color: var(--color-secondary-400);
  color: var(--color-secondary-800);
}

.btn--secondary:active {
  background-color: var(--color-secondary-200);
}

.btn--secondary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn--secondary:disabled,
.btn--secondary[aria-disabled="true"] {
  background-color: var(--color-neutral-150);
  border-color: var(--color-neutral-200);
  color: var(--color-neutral-400);
  cursor: not-allowed;
}

/* Variant: Outline (transparent bg, terracotta border) */
.btn--outline {
  background-color: transparent;
  color: var(--color-primary-600);
  border-color: var(--color-primary-400);
}

.btn--outline:hover {
  background-color: var(--color-primary-50);
  border-color: var(--color-primary-500);
  color: var(--color-primary-700);
}

.btn--outline:active {
  background-color: var(--color-primary-100);
}

.btn--outline:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn--outline:disabled,
.btn--outline[aria-disabled="true"] {
  background-color: transparent;
  border-color: var(--color-neutral-300);
  color: var(--color-neutral-400);
  cursor: not-allowed;
}

/* Variant: Ghost (transparent, shown on hover) */
.btn--ghost {
  background-color: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}

.btn--ghost:hover {
  background-color: var(--color-neutral-100);
  color: var(--color-text-primary);
}

.btn--ghost:active {
  background-color: var(--color-neutral-200);
}

.btn--ghost:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn--ghost:disabled,
.btn--ghost[aria-disabled="true"] {
  background-color: transparent;
  color: var(--color-neutral-400);
  cursor: not-allowed;
}

/* Loading state */
.btn[aria-busy="true"] {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn[aria-busy="true"]::after {
  content: '';
  position: absolute;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: btn-spin 0.6s linear infinite;
  /* Color inherited from parent, but since text is transparent, set explicitly */
}

.btn--primary[aria-busy="true"]::after {
  border-color: var(--color-text-inverse);
  border-right-color: transparent;
}

.btn--secondary[aria-busy="true"]::after,
.btn--outline[aria-busy="true"]::after,
.btn--ghost[aria-busy="true"]::after {
  border-color: var(--color-primary-500);
  border-right-color: transparent;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Full width on small screens */
.btn--full {
  width: 100%;
}

/* Icon support */
.btn__icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
}

.btn--sm .btn__icon {
  width: 1em;
  height: 1em;
}

/* ==========================================================================
   2. FORM FIELD / INPUT
   Label, placeholder, helper text, error state, focus ring
   Sizes consistent with buttons.
   -------------------------------------------------------------------------- */

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-field__label {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  line-height: var(--leading-normal);
}

.form-field__label--required::after {
  content: ' *';
  color: var(--color-error);
}

.form-field__input {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background-color: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  line-height: var(--leading-normal);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
  width: 100%;
}

.form-field__input::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

.form-field__input:hover {
  border-color: var(--color-neutral-400);
}

.form-field__input:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px var(--color-primary-50);
}

.form-field__input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.form-field__input:disabled {
  background-color: var(--color-neutral-100);
  border-color: var(--color-neutral-200);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* Input sizes */
.form-field__input--sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.form-field__input--lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
}

/* Error state */
.form-field--error .form-field__label {
  color: var(--color-error);
}

.form-field--error .form-field__input {
  border-color: var(--color-error);
  box-shadow: 0 0 0 1px var(--color-error);
}

.form-field--error .form-field__input:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px var(--color-error-bg);
}

.form-field__helper {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}

.form-field__error {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-error);
  line-height: var(--leading-normal);
}

.form-field--error .form-field__helper {
  display: none;
}

/* Textarea — same base */
textarea.form-field__input {
  min-height: 6rem;
  resize: vertical;
}

/* Select — same base */
select.form-field__input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235C3A21' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
}

/* ==========================================================================
   3. CARD
   With/without image, with/without hover effect.
   Consistent padding from the spacing scale.
   -------------------------------------------------------------------------- */

.card {
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-base),
              transform var(--transition-base);
}

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

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

.card__image--tall {
  aspect-ratio: 4 / 5;
}

.card__image--square {
  aspect-ratio: 1 / 1;
}

.card__body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.card__body--compact {
  padding: var(--space-4);
  gap: var(--space-2);
}

.card__heading {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  line-height: var(--heading-line-height);
  margin: 0;
}

.card__text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--body-line-height);
  margin: 0;
}

.card__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Feature card variant (icon + heading + text, no border) */
.card--feature {
  border: none;
  background-color: transparent;
  text-align: center;
}

.card--feature .card__icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto var(--space-4);
  color: var(--color-primary-500);
}

/* ==========================================================================
   4. NAVIGATION
   Header bar, mobile hamburger menu, footer links.
   -------------------------------------------------------------------------- */

/* --- Header / Navbar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-navbar);
  background-color: rgba(244, 250, 255, 0.95);
  background-color: oklch(0.985 0.005 80 / 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-light);
  padding: 0 var(--space-6);
}

.navbar__inner {
  max-width: var(--page-max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text-primary);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-none);
}

.navbar__brand-icon {
  width: auto;
  height: 2rem;
  border-radius: var(--radius-sm);
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar__link {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast),
              background-color var(--transition-fast);
}

.navbar__link:hover,
.navbar__link[aria-current="page"] {
  color: var(--color-text-primary);
  background-color: var(--color-neutral-100);
}

.navbar__link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Mobile hamburger */
.navbar__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  color: var(--color-text-primary);
  border-radius: var(--radius-md);
}

.navbar__toggle:hover {
  background-color: var(--color-neutral-100);
}

.navbar__toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.navbar__toggle-icon {
  width: 1.5rem;
  height: 1.5rem;
}

/* Mobile menu */
.navbar__mobile-menu {
  display: none;
  position: fixed;
  top: 4rem;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-dropdown);
  background-color: var(--color-surface);
  padding: var(--space-6);
  overflow-y: auto;
}

.navbar__mobile-menu--open {
  display: block;
}

.navbar__mobile-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.navbar__mobile-link {
  display: block;
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  text-decoration: none;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}

.navbar__mobile-link:hover {
  background-color: var(--color-neutral-100);
}

/* --- Footer --- */
.footer {
  background-color: var(--color-secondary-800);
  color: var(--color-text-inverse);
  padding: var(--space-16) 0 var(--space-8);
}

.footer__inner {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-10);
}

.footer__brand {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  margin: 0 0 var(--space-3);
  line-height: var(--heading-line-height);
}

.footer__description {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--body-line-height);
  color: #aaaeae;
  color: oklch(0.75 0.01 75);
  max-width: 40ch;
}

.footer__heading {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent-300);
  margin: 0 0 var(--space-4);
}

.footer__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__link {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: #aaaeae;
  color: oklch(0.75 0.01 75);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer__link:hover {
  color: var(--color-text-inverse);
}

.footer__bottom {
  max-width: var(--page-max-width);
  margin: var(--space-12) auto 0;
  padding: var(--space-6) var(--space-6) 0;
  border-top: 1px solid rgba(98, 99, 99, 0.3);
  border-top: 1px solid oklch(0.50 0.01 50 / 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer__copyright {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: #7e8080;
  color: oklch(0.60 0.01 65);
}

/* ==========================================================================
   5. SECTION
   Standard page section with heading + body + optional CTA.
   Responsive padding.
   -------------------------------------------------------------------------- */

.section {
  padding: var(--section-padding-y) var(--space-6);
}

.section__inner {
  max-width: var(--page-max-width);
  margin: 0 auto;
}

/* Section variants */
.section--warm {
  background-color: #edf2f4;
  background-color: oklch(0.96 0.01 75);
}

.section--dark {
  background-color: var(--color-secondary-800);
  color: var(--color-text-inverse);
}

.section--cream {
  background-color: #f3f8fe;
  background-color: oklch(0.98 0.005 80);
}

.section--compact {
  padding: var(--space-8) var(--space-6);
}

.section--flush {
  padding: 0;
}

/* Section header (heading + subheading) */
.section__header {
  text-align: center;
  margin-bottom: var(--space-12);
  max-width: 50ch;
  margin-left: auto;
  margin-right: auto;
}

.section__header--left {
  text-align: left;
  margin-left: 0;
}

.section__preheading {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary-500);
  margin: 0 0 var(--space-3);
  line-height: var(--leading-normal);
}

.section__heading {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  line-height: var(--heading-line-height);
  margin: 0 0 var(--space-4);
}

.section--dark .section__heading {
  color: var(--color-text-inverse);
}

.section__subheading {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  line-height: var(--body-line-height);
  margin: 0;
  max-width: var(--body-max-width);
}

.section--dark .section__subheading {
  color: #aaaeae;
  color: oklch(0.75 0.01 75);
}

.section__cta {
  margin-top: var(--space-8);
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}

.section__cta--left {
  justify-content: flex-start;
}

/* Responsive section */
@media (max-width: 47.9375em) {
  .section {
    padding: var(--section-padding-y-sm) var(--space-4);
  }

  .section--compact {
    padding: var(--space-6) var(--space-4);
  }

  .section__header {
    margin-bottom: var(--space-8);
  }

  .section__heading {
    font-size: var(--text-3xl);
  }

  .section__subheading {
    font-size: var(--text-base);
  }

  .section__cta {
    flex-direction: column;
    align-items: stretch;
  }

  .section__cta .btn {
    width: 100%;
  }
}

/* ==========================================================================
   6. HERO
   Full-width top section with heading, subheading, CTA, and optional media.
   Responsive.
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: min(100dvh, 42rem);
  display: flex;
  align-items: center;
  padding: 6rem var(--space-6) var(--section-padding-y);
  overflow: hidden;
}

/* Hero with background image */
.hero--with-image {
  color: var(--color-text-inverse);
}

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

.hero__background img,
.hero__background picture {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--gradient-hero);
}

/* Optional overlay for darker sections */
.hero__overlay--light {
  background: linear-gradient(180deg, rgba(3, 3, 3, 0.4) 0%, rgba(3, 3, 3, 0.2) 100%);
  background: linear-gradient(180deg, oklch(0.10 0.005 40 / 0.40) 0%, oklch(0.10 0.005 40 / 0.20) 100%);
}

.hero__inner {
  position: relative;
  z-index: 2;
  max-width: var(--page-max-width);
  margin: 0 auto;
  width: 100%;
}

.hero__content {
  max-width: 55ch;
}

.hero__content--centered {
  margin: 0 auto;
  text-align: center;
}

.hero__preheading {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent-300);
  margin: 0 0 var(--space-4);
  line-height: var(--leading-normal);
}

.hero__heading {
  font-family: var(--font-heading);
  font-size: var(--text-6xl);
  font-weight: var(--weight-bold);
  line-height: var(--heading-line-height);
  margin: 0 0 var(--space-6);
}

.hero__subheading {
  font-family: var(--font-body);
  font-size: var(--text-xl);
  line-height: var(--body-line-height);
  margin: 0 0 var(--space-8);
  color: #c9cecf;
  color: oklch(0.85 0.01 80);
  max-width: var(--body-max-width);
}

.hero__content--centered .hero__subheading {
  margin-left: auto;
  margin-right: auto;
}

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

.hero__cta--centered {
  justify-content: center;
}

/* Hero without image (solid bg) */
.hero--solid {
  background: linear-gradient(135deg, var(--color-secondary-800) 0%, var(--color-secondary-700) 100%);
}

.hero--solid .hero__heading {
  color: var(--color-text-inverse);
}

.hero--solid .hero__subheading {
  color: #babdbc;
  color: oklch(0.80 0.015 75);
}

.hero--cream {
  background: linear-gradient(180deg, #f0f5f8 0%, var(--color-neutral-50) 100%);
  background: linear-gradient(180deg, oklch(0.97 0.01 75) 0%, var(--color-neutral-50) 100%);
}

.hero--cream .hero__heading {
  color: var(--color-text-primary);
}

.hero--cream .hero__subheading {
  color: var(--color-text-secondary);
}

.hero--cream .hero__preheading {
  color: var(--color-primary-500);
}

/* Responsive hero */
@media (max-width: 47.9375em) {
  .hero {
    min-height: min(100dvh, 36rem);
    padding: 5rem var(--space-4) var(--section-padding-y-sm);
  }

  .hero__heading {
    font-size: var(--text-4xl);
  }

  .hero__subheading {
    font-size: var(--text-lg);
  }

  .hero__cta {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__cta .btn {
    width: 100%;
  }
}

/* ==========================================================================
   7. TESTIMONIAL / SOCIAL PROOF
   Quote card with avatar, name, role, and optional logo.
   -------------------------------------------------------------------------- */

.testimonial {
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  transition: box-shadow var(--transition-base);
}

.testimonial:hover {
  box-shadow: var(--shadow-md);
}

.testimonial__quote {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--color-text-primary);
  line-height: var(--body-line-height);
  margin: 0;
  position: relative;
  padding-left: var(--space-6);
}

.testimonial__quote::before {
  content: '"';
  position: absolute;
  left: 0;
  top: -0.2em;
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  color: var(--color-primary-300);
  line-height: 1;
}

.testimonial__author {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.testimonial__avatar {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--color-accent-300);
  flex-shrink: 0;
}

.testimonial__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.testimonial__name {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  line-height: var(--leading-none);
  margin: 0;
}

.testimonial__role {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: var(--leading-none);
  margin: 0;
}

.testimonial__logo {
  height: 1.5rem;
  opacity: 0.6;
  margin-left: auto;
}

/* Featured/large testimonial */
.testimonial--featured {
  padding: var(--space-10);
  background: linear-gradient(135deg, var(--color-primary-50) 0%, var(--color-surface-elevated) 100%);
  border-color: var(--color-primary-200);
}

.testimonial--featured .testimonial__quote {
  font-size: var(--text-xl);
}

/* ==========================================================================
   8. FEATURE GRID
   2/3/4 column responsive grid of feature cards.
   Icons optional.
   -------------------------------------------------------------------------- */

.feature-grid {
  display: grid;
  gap: var(--space-8);
}

.feature-grid--2-cols {
  grid-template-columns: repeat(2, 1fr);
}

.feature-grid--3-cols {
  grid-template-columns: repeat(3, 1fr);
}

.feature-grid--4-cols {
  grid-template-columns: repeat(4, 1fr);
}

.feature-grid__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-border-light);
  transition: box-shadow var(--transition-base),
              transform var(--transition-base);
}

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

.feature-grid__icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--color-primary-500);
  flex-shrink: 0;
}

.feature-grid__icon--accent {
  color: var(--color-accent-500);
}

.feature-grid__heading {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  line-height: var(--heading-line-height);
  margin: 0;
}

.feature-grid__text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--body-line-height);
  margin: 0;
}

/* Responsive feature grid */
@media (max-width: 47.9375em) {
  .feature-grid--2-cols,
  .feature-grid--3-cols,
  .feature-grid--4-cols {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 48em) and (max-width: 63.9375em) {
  .feature-grid--3-cols,
  .feature-grid--4-cols {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   9. UTILITY CLASSES
   -------------------------------------------------------------------------- */

/* Max width container */
.container {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 47.9375em) {
  .container {
    padding: 0 var(--space-4);
  }
}

/* Visually hidden (accessible) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Text alignment */
.text-center { text-align: center; }
.text-left   { text-align: left; }

/* Spacing helpers */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* Responsive images */
.img-responsive {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==========================================================================
   10. RESPONSIVE NAVBAR (mobile toggle visibility)
   -------------------------------------------------------------------------- */
@media (max-width: 47.9375em) {
  .navbar__links {
    display: none;
  }

  .navbar__toggle {
    display: block;
  }
}

@media (min-width: 48em) {
  .navbar__mobile-menu {
    display: none !important;
  }
}

/* ==========================================================================
   11. LANGUAGE SWITCHER
   Language selector component for the navbar.
   -------------------------------------------------------------------------- */

.lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-2);
}

.lang-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--color-neutral-100);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: var(--leading-none);
}

.lang-switcher-btn:hover {
  background: var(--color-neutral-150);
  border-color: var(--color-neutral-300);
  color: var(--color-text-primary);
}

.lang-switcher-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.lang-switcher-btn[aria-expanded="true"] .lang-switcher__arrow {
  transform: rotate(180deg);
}

.lang-switcher__current {
  min-width: 2ch;
  text-align: center;
}

.lang-switcher__arrow {
  width: 0.625rem;
  height: 0.375rem;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.lang-switcher__dropdown {
  display: none;
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  z-index: var(--z-dropdown);
  min-width: 8rem;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-1);
  list-style: none;
  margin: 0;
}

.lang-switcher__dropdown--open {
  display: block;
}

.lang-switcher__item {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--transition-fast);
  white-space: nowrap;
}

.lang-switcher__item:hover {
  background: var(--color-neutral-100);
}

.lang-switcher__item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.lang-switcher__item--active {
  color: var(--color-primary-600);
  font-weight: var(--weight-bold);
}

.lang-switcher__item--active::before {
  content: '✓ ';
}

/* Mobile: language switcher in mobile menu */
.lang-switcher--mobile {
  margin: var(--space-6) var(--space-4) 0;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border-light);
}

.lang-switcher--mobile .lang-switcher__label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  display: block;
}

.lang-switcher--mobile .lang-switcher__options {
  display: flex;
  gap: var(--space-2);
}

.lang-switcher--mobile .lang-switcher__item {
  flex: 1;
  text-align: center;
  padding: var(--space-3);
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
}

.lang-switcher--mobile .lang-switcher__item:hover {
  border-color: var(--color-primary-300);
}

.lang-switcher--mobile .lang-switcher__item--active {
  background: var(--color-primary-50);
  border-color: var(--color-primary-400);
  color: var(--color-primary-600);
}

/* ==========================================================================
   12. REDUCED MOTION
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .card,
  .navbar,
  .testimonial,
  .feature-grid__item,
  .footer__link {
    transition: none;
  }

  .card--hoverable:hover,
  .feature-grid__item:hover {
    transform: none;
  }

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

  .lang-switcher__arrow {
    transition: none;
  }
}
