/* ============================================================================
 * COMPONENTS SYSTEM
 * Standardized component styles using BEM methodology + Utility-First
 * Depends on design-tokens.css - ensure design-tokens.css is imported first
 * ============================================================================ */

/* ============================================================================
 * BUTTONS
 * ============================================================================ */

/* Base button styles - common to all button variants */
.btn-base,
button,
[type="button"],
[type="submit"],
[type="reset"] {
  /* Layout & Sizing */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);

  /* Typography */
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: var(--font-weight-semibold);
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  text-transform: none;

  /* Visual Effects */
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-normal) ease-out;
  box-shadow: none;

  /* Accessibility */
  position: relative;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* Button focus state - Keyboard navigation */
.btn-base:focus-visible,
button:focus-visible,
[type="button"]:focus-visible,
[type="submit"]:focus-visible,
[type="reset"]:focus-visible {
  outline: 1px dotted rgba(194, 142, 90, 0.3);
  outline-offset: 1px;
  box-shadow: none;
}

/* Button hover state - Consistent lifting */
.btn-base:hover,
button:hover,
[type="button"]:hover,
[type="submit"]:hover,
[type="reset"]:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

/* Button active state */
.btn-base:active,
button:active,
[type="button"]:active,
[type="submit"]:active,
[type="reset"]:active {
  transform: translateY(0);
}

/* Button disabled state */
.btn-base:disabled,
button:disabled,
[type="button"]:disabled,
[type="submit"]:disabled,
[type="reset"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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

/* Primary Button - Wood Gradient (CTA) */
.btn-primary,
.wood-gradient-button {
  background: linear-gradient(135deg, var(--color-accent-gold) 0%, var(--color-secondary-walnut) 100%);
  color: var(--color-primary-navy);
  border: 1px solid var(--color-secondary-walnut);
  font-weight: var(--font-weight-bold);
}

.btn-primary:hover,
.wood-gradient-button:hover {
  background: linear-gradient(135deg, #D4A373 0%, var(--color-accent-gold) 100%);
  box-shadow: var(--shadow-wood);
}

.btn-primary:focus-visible,
.wood-gradient-button:focus-visible {
  outline: 1px dotted rgba(194, 142, 90, 0.3);
  outline-offset: 1px;
}

/* Secondary Button - Navy Glass */
.btn-secondary,
.navy-glass-button {
  background: rgba(11, 17, 32, 0.85);
  color: var(--color-neutral-white);
  border: 1px solid rgba(194, 142, 90, 0.3);
  backdrop-filter: blur(12px);
}

.btn-secondary:hover,
.navy-glass-button:hover {
  background: var(--color-primary-navy);
  border-color: var(--color-accent-gold);
  box-shadow: var(--shadow-medium);
}

.btn-secondary:focus-visible,
.navy-glass-button:focus-visible {
  outline: 3px solid var(--color-accent-gold);
  outline-offset: 2px;
}

/* Tertiary Button - Outline */
.btn-tertiary {
  background: transparent;
  color: var(--color-primary-navy);
  border: 2px solid var(--color-primary-navy);
}

.btn-tertiary:hover {
  background: var(--color-primary-navy);
  color: var(--color-neutral-white);
  box-shadow: var(--shadow-medium);
}

.btn-tertiary:focus-visible {
  outline: 3px solid var(--color-primary-navy);
  outline-offset: 3px;
}

/* Ghost Button - Text only */
.btn-ghost {
  background: transparent;
  color: var(--color-primary-navy);
  border: none;
  padding: var(--space-sm) var(--space-md);
  text-decoration: underline;
  text-decoration-color: var(--color-accent-gold);
  text-underline-offset: 4px;
}

.btn-ghost:hover {
  color: var(--color-accent-gold);
  box-shadow: none;
  transform: none;
}

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

.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
}

.btn-md {
  padding: var(--space-md) var(--space-lg);
  font-size: 1rem;
}

.btn-lg {
  padding: var(--space-lg) var(--space-xl);
  font-size: 1.125rem;
}

.btn-full {
  width: 100%;
}

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

.btn-loading {
  pointer-events: none;
  opacity: 0.6;
}

.btn-success {
  background: linear-gradient(135deg, var(--color-success) 0%, #059669 100%);
  color: var(--color-neutral-white);
  border: 1px solid var(--color-success);
}

.btn-success:hover {
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.2);
}

/* -------- Global CTA Button Styles -------- */
.btn-primary,
.page-banner__cta-btn {
  display: inline-block;
  text-align: center;
  padding: 1rem 1.5rem;
  font-weight: 600;
  border-radius: 0.75rem;
  line-height: 1.4;

  /* Overflow handling */
  white-space: normal;       /* allows wrapping */
  word-break: break-word;    /* breaks long words if needed */
  max-width: 100%;           /* prevents overflow outside container */

  /* Responsive sizing */
  width: auto;
  min-width: 200px;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .btn-primary,
  .page-banner__cta-btn {
    width: 100%;             /* full-width buttons on mobile */
    font-size: 1rem;         /* slightly smaller text */
    padding: 0.75rem 1rem;   /* tighter padding */
  }
}

.btn-error {
  background: linear-gradient(135deg, var(--color-error) 0%, #DC2626 100%);
  color: var(--color-neutral-white);
  border: 1px solid var(--color-error);
}

.btn-error:hover {
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.2);
}

/* ============================================================================
 * CARDS
 * ============================================================================ */

/* Base card styles */
.card-base,
.card {
  /* Layout */
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);

  /* Visual */
  background: var(--color-neutral-white);
  border: 1px solid rgba(11, 17, 32, 0.05);
  box-shadow: var(--shadow-medium);

  /* Transitions */
  transition: all var(--transition-normal) ease-out;

  /* Accessibility */
  position: relative;
}

/* Card hover state */
.card-base:hover,
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-medium);
  border-color: rgba(194, 142, 90, 0.1);
}

/* Card focused state (keyboard navigation) */
.card-base:focus-visible,
.card:focus-visible {
  outline: 1px dotted rgba(194, 142, 90, 0.3);
  outline-offset: 1px;
}

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

/* Default Card */
.card-default {
  background: var(--color-neutral-white);
  border: 1px solid rgba(11, 17, 32, 0.08);
}

/* Elevated Card - Premium feel */
.card-elevated {
  background: var(--color-neutral-white);
  border: none;
  box-shadow: var(--shadow-floating);
}

.card-elevated:hover {
  box-shadow: 0 25px 60px rgba(11, 17, 32, 0.4);
}

/* Glass Card - Subtle glassmorphism */
.card-glass {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: var(--color-primary-navy);
}

.card-glass:hover {
  background: rgba(255, 255, 255, 0.85);
}

/* Dark Glass Card */
.card-glass-dark {
  background: rgba(11, 17, 32, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  color: var(--color-neutral-white);
}

.card-glass-dark:hover {
  background: rgba(11, 17, 32, 0.85);
  border-color: rgba(194, 142, 90, 0.2);
}

/* Bordered Card - Accent accent bottom border */
.card-bordered {
  border-bottom: 4px solid var(--color-accent-gold);
}

.card-bordered:hover {
  border-bottom-color: var(--color-secondary-walnut);
}

/* Landscape Card - Story-focused horizontal layout */
.card-landscape {
  background: var(--color-neutral-white);
  border: 1px solid rgba(11, 17, 32, 0.05);
  box-shadow: var(--shadow-wood);
  margin-bottom: var(--space-xl);
}

.card-landscape:hover {
  transform: scale(1.02);
  box-shadow: 0 25px 60px rgba(194, 142, 90, 0.25);
  border-color: rgba(194, 142, 90, 0.1);
}

/* Minimal Card */
.card-minimal {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: var(--space-md);
}

.card-minimal:hover {
  background: rgba(245, 245, 240, 0.5);
  box-shadow: none;
  transform: translateY(-2px);
}

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

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid rgba(11, 17, 32, 0.08);
}

.card-header > h3 {
  font-size: var(--text-h3-size);
  font-weight: var(--text-h3-weight);
  color: var(--color-primary-navy);
  margin: 0;
}

/* Card Body */
.card-body {
  flex: 1;
  padding: 0;
}

/* Card Footer */
.card-footer {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(11, 17, 32, 0.08);
}

/* Card Icon Container */
.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, rgba(194, 142, 90, 0.1) 0%, rgba(245, 245, 240, 0.5) 100%);
  border-radius: var(--radius-lg);
  font-size: 1.75rem;
}

.card:hover .card-icon {
  background: linear-gradient(135deg, rgba(194, 142, 90, 0.15) 0%, rgba(194, 142, 90, 0.08) 100%);
  transition: background var(--transition-normal) ease-out;
}

/* ============================================================================
 * FORM INPUTS
 * ============================================================================ */

/* Base input styles */
.input-base,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
  /* Layout */
  display: block;
  width: 100%;
  padding: var(--space-md);
  border-radius: var(--radius-md);

  /* Typography */
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;

  /* Visual */
  border: 1px solid var(--color-neutral-slate-300);
  background: var(--color-neutral-white);
  color: var(--color-primary-navy);
  transition: all var(--transition-normal) ease-out;

  /* Accessibility */
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* Input placeholder */
.input-base::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--color-neutral-slate-400);
}

/* Input focus state */
.input-base:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--color-accent-gold);
  outline-offset: 2px;
  border-color: var(--color-accent-gold);
  box-shadow: 0 0 0 3px rgba(194, 142, 90, 0.1);
}

/* Input error state */
.input-base.error,
input.error,
textarea.error,
select.error {
  border-color: var(--color-error);
  background: rgba(239, 68, 68, 0.02);
}

.input-base.error:focus,
input.error:focus,
textarea.error:focus,
select.error:focus {
  outline-color: var(--color-error);
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Input success state */
.input-base.success,
input.success,
textarea.success,
select.success {
  border-color: var(--color-success);
  background: rgba(16, 185, 129, 0.02);
}

.input-base.success:focus,
input.success:focus,
textarea.success:focus,
select.success:focus {
  outline-color: var(--color-success);
  border-color: var(--color-success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Input disabled state */
.input-base:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.5;
  background: var(--color-neutral-slate-100);
  cursor: not-allowed;
  border-color: var(--color-neutral-slate-200);
}

/* Textarea specific */
textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--font-body);
}

/* Select specific */
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%230B1120' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: 2.5rem;
  appearance: none;
}

/* ============================================================================
 * FORM GROUPS
 * ============================================================================ */

.form-group {
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary-navy);
  margin-bottom: var(--space-sm);
  font-size: 0.95rem;
  display: block;
}

.form-group label .required {
  color: var(--color-error);
  margin-left: 2px;
}

.form-group .help-text {
  font-size: 0.875rem;
  color: var(--color-neutral-slate-500);
  margin-top: var(--space-sm);
}

.form-group .error-message {
  font-size: 0.875rem;
  color: var(--color-error);
  margin-top: var(--space-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group .error-message::before {
  content: "⚠";
}

.form-group .success-message {
  font-size: 0.875rem;
  color: var(--color-success);
  margin-top: var(--space-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group .success-message::before {
  content: "✓";
}

/* ============================================================================
 * HERO SECTIONS
 * ============================================================================ */

/* Split Layout Hero - 50/50 emotional copy and image */
.hero-split {
  display: flex;
  min-height: 600px;
  background: var(--color-neutral-slate-700);
  position: relative;
  overflow: hidden;
}

.hero-split .hero-content {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 4rem 3rem;
  background: linear-gradient(135deg, var(--color-neutral-beige) 0%, rgba(245, 245, 240, 0.8) 100%);
  position: relative;
}

.hero-split .hero-image {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.hero-split .hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease-out;
}

.hero-split:hover .hero-image img {
  transform: scale(1.05);
}

/* ============================================================================
 * BADGES & TAGS
 * ============================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(194, 142, 90, 0.1);
  color: var(--color-secondary-walnut);
  border: 1px solid rgba(194, 142, 90, 0.2);
}

.badge-primary {
  background: linear-gradient(135deg, rgba(194, 142, 90, 0.15), rgba(194, 142, 90, 0.05));
  color: var(--color-secondary-walnut);
  border: 1px solid var(--color-accent-gold);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #D97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ============================================================================
 * LOGO STYLING
 * ============================================================================ */

.logo-style {
  width: 3rem; /* Tailwind w-12 */
  height: 3rem; /* Tailwind h-12 */
  border-radius: 0.75rem; /* Tailwind rounded-lg */
  overflow: hidden;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1); /* Tailwind shadow-lg */
  transition: transform 0.3s ease;
  border: 2px solid #C28E5A; /* brand-wood */
  box-sizing: border-box;
}

.logo-style:hover {
  transform: scale(1.1);
}

.logo-style img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: #ffffff;
}

/* ============================================================================
 * SVG LOGO STYLING
 * ============================================================================ */

/* Logo container for inline SVG logos */
.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-container svg {
  max-width: 100%;
  height: auto;
  transition: transform var(--transition-normal) ease-out;
}

.logo-container:hover svg {
  transform: scale(1.05);
}

/* ============================================================================
 * PAGE BANNER COMPONENT
 * ============================================================================ */

.page-banner {
  position: relative;
  display: block;
  min-height: 420px; /* consistent height */
  padding: 3rem 1.5rem;
  background-color: var(--color-primary-navy); /* fallback */
  color: var(--color-neutral-white);
  border-bottom: 4px solid var(--color-accent-gold);
}

.page-banner--hero {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.page-banner__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    135deg,
    rgba(11, 17, 32, 0.65),
    rgba(194, 142, 90, 0.25)
  );
}

.page-banner__container {
  position: relative;
  z-index: 1;
  max-width: 80rem; /* 1280px */
  margin: 0 auto;
}

.page-banner__content {
  max-width: 56rem; /* 896px */
}

.page-banner__eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent-gold);
  background: rgba(194, 142, 90, 0.12);
  border: 1px solid rgba(194, 142, 90, 0.25);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-full);
  margin-bottom: 1rem;
}

.page-banner__title {
  font-size: var(--text-h1-size);
  line-height: var(--text-h1-line-height);
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  margin: 0.25rem 0 0.75rem;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
  color: var(--color-neutral-white);
}

.page-banner__subtitle {
  font-size: 1.125rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.85);
  max-width: 48rem;
  margin: 0.25rem 0 1.25rem;
}

.page-banner__cta { margin-top: 1rem; }
.page-banner__cta-btn {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-semibold);
}

.page-banner__status { margin-top: 1rem; }

/* Spacing guardrails against sticky header */
body.has-sticky-header .page-banner { margin-top: 0; }
main { padding-top: 0; }

/* Responsive adjustments */
@media (max-width: 768px) {
  .page-banner { min-height: 360px; padding: 2rem 1rem; }
  .page-banner__title { font-size: clamp(1.75rem, 5.5vw, 2.75rem); }
  .page-banner__subtitle { font-size: 1rem; }
}

/* ============================================================================
 * RESPONSIVE ADJUSTMENTS
 * ============================================================================ */

@media (max-width: 768px) {
  .card-base,
  .card {
    padding: var(--space-md);
  }

  .btn-base,
  button,
  [type="button"],
  [type="submit"],
  [type="reset"] {
    padding: var(--space-md) var(--space-lg);
    font-size: 0.95rem;
  }

  .btn-lg {
    padding: var(--space-lg) var(--space-lg);
  }

  .input-base,
  input,
  textarea,
  select {
    padding: var(--space-md);
  }
}

@media (max-width: 480px) {
  .card-base,
  .card {
    padding: var(--space-md);
  }

  .btn-base,
  button,
  [type="button"],
  [type="submit"],
  [type="reset"] {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.9rem;
    width: 100%;
  }

  .btn-full {
    width: 100%;
  }
}
