/**
 * UI Components
 *
 * Buttons, cards, forms, badges, and reusable elements.
 * Lemonal Caribbean theme styling.
 */

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1;
  text-decoration: none;
  border: var(--border-width-2) solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-all);
  white-space: nowrap;
}

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

/* Primary button - Ocean */
.btn--primary {
  background-color: var(--ocean);
  color: var(--white);
  border-color: var(--ocean);
}

.btn--primary:hover {
  background-color: var(--ocean-deep);
  border-color: var(--ocean-deep);
  box-shadow: var(--shadow-ocean);
  transform: translateY(-2px);
}

.btn--primary:active {
  transform: translateY(0);
}

/* Secondary button - Outlined */
.btn--secondary {
  background-color: transparent;
  color: var(--ocean);
  border-color: var(--ocean);
}

.btn--secondary:hover {
  background-color: var(--ocean);
  color: var(--white);
}

/* Accent button - Coral CTA */
.btn--accent {
  background-color: var(--coral);
  color: var(--white);
  border-color: var(--coral);
}

.btn--accent:hover {
  background-color: var(--coral-dark);
  border-color: var(--coral-dark);
  box-shadow: var(--shadow-coral);
  transform: translateY(-2px);
}

/* Ghost button */
.btn--ghost {
  background-color: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}

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

/* Button sizes */
.btn--sm {
  padding: 0.5rem 1rem;
  font-size: var(--text-xs);
}

.btn--lg {
  padding: 1rem 2rem;
  font-size: var(--text-base);
}

/* Button with icon */
.btn svg,
.btn .icon {
  width: 1.25em;
  height: 1.25em;
}

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

.card {
  background-color: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: var(--transition-all);
}

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

.card__image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background-color: var(--sand);
}

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

.card__title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

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

.card__text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* Project card variant */
.card--project {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card--project .card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card--project .card__text {
  flex: 1;
}

.card--project .card__links {
  display: flex;
  gap: var(--space-3);
  margin-top: auto;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  background-color: var(--sand);
  color: var(--color-text-secondary);
}

.tag--ocean {
  background-color: var(--ocean-muted);
  color: var(--ocean-deep);
}

.tag--jungle {
  background-color: var(--jungle-muted);
  color: var(--jungle);
}

.tag--coral {
  background-color: rgba(249, 115, 22, 0.1);
  color: var(--coral-dark);
}

/* Skill tag with hover */
.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  background-color: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: var(--transition-all);
}

.skill-tag:hover {
  border-color: var(--ocean);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.skill-tag__icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* ========================================
   FORMS
   ======================================== */

.form-group {
  margin-bottom: var(--space-5);
}

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

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background-color: var(--white);
  border: var(--border-width-2) solid var(--color-border);
  border-radius: var(--radius-md);
  transition: var(--transition-all);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
  border-color: var(--sand-dark);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--ocean);
  box-shadow: 0 0 0 3px var(--ocean-muted);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
}

.form-textarea {
  min-height: 150px;
  resize: vertical;
}

/* Form validation states */
.form-input.is-error,
.form-textarea.is-error {
  border-color: var(--color-error);
}

.form-input.is-error:focus,
.form-textarea.is-error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-error {
  font-size: var(--text-sm);
  color: var(--color-error);
  margin-top: var(--space-1);
}

.form-success {
  font-size: var(--text-sm);
  color: var(--color-success);
  margin-top: var(--space-1);
}

/* Honeypot field (spam protection) */
.form-hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* ========================================
   CONTACT FORM
   ======================================== */

.contact-form {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-8);
  background-color: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.contact-form__title {
  text-align: center;
  margin-bottom: var(--space-6);
}

.contact-form__row {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 640px) {
  .contact-form__row {
    grid-template-columns: 1fr 1fr;
  }
}

.contact-form__submit {
  width: 100%;
  margin-top: var(--space-4);
}

.contact-form__status {
  text-align: center;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  margin-top: var(--space-4);
}

.contact-form__status--success {
  background-color: var(--jungle-muted);
  color: var(--jungle);
}

.contact-form__status--error {
  background-color: rgba(220, 38, 38, 0.1);
  color: var(--color-error);
}

/* ========================================
   HERO SECTION
   ======================================== */

.hero__content {
  max-width: 800px;
}

.hero__eyebrow {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--ocean);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-4);
}

.hero__title {
  font-size: var(--text-5xl);
  margin-bottom: var(--space-4);
}

.hero__title span {
  color: var(--ocean);
}

.hero__subtitle {
  font-size: var(--text-xl);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-8);
  max-width: 600px;
}

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

/* ========================================
   ABOUT SECTION
   ======================================== */

.about__image {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1;
  border-radius: var(--radius-xl);
  object-fit: cover;
  box-shadow: var(--shadow-lg);
}

.about__content {
  max-width: 550px;
}

/* ========================================
   SKILLS SECTION
   ======================================== */

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
}

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

.skill-category__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--ocean-deep);
  margin-bottom: var(--space-4);
  text-align: center;
}

/* ========================================
   PROJECT SECTION
   ======================================== */

.projects-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* ========================================
   SOCIAL LINKS
   ======================================== */

.social-links {
  display: flex;
  gap: var(--space-4);
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background-color: var(--sand);
  color: var(--color-text-secondary);
  transition: var(--transition-all);
}

.social-link:hover {
  background-color: var(--ocean);
  color: var(--white);
  transform: translateY(-2px);
}

.social-link svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* ========================================
   DECORATIVE ELEMENTS
   ======================================== */

/* Wave divider */
.wave-divider {
  width: 100%;
  height: 60px;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

.wave-divider--top {
  margin-bottom: -1px;
}

.wave-divider--bottom {
  margin-top: -1px;
  transform: rotate(180deg);
}

/* Gradient text */
.text-gradient {
  background: linear-gradient(135deg, var(--ocean) 0%, var(--ocean-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Decorative dot pattern */
.dot-pattern {
  position: absolute;
  width: 150px;
  height: 150px;
  background-image: radial-gradient(var(--sand-dark) 2px, transparent 2px);
  background-size: 20px 20px;
  opacity: 0.5;
  z-index: var(--z-below);
}

/* ========================================
   LOADING STATES
   ======================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--sand) 25%,
    var(--sand-light) 50%,
    var(--sand) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ========================================
   ICON COMPONENT
   ======================================== */

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon--sm {
  width: 1rem;
  height: 1rem;
}

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

.icon--lg {
  width: 2rem;
  height: 2rem;
}

/* ========================================
   LINK COMPONENTS
   ======================================== */

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--font-medium);
  color: var(--ocean);
  transition: var(--transition-all);
}

.link-arrow:hover {
  gap: var(--space-3);
  color: var(--ocean-deep);
}

.link-arrow svg {
  width: 1.25em;
  height: 1.25em;
  transition: transform var(--duration-normal) var(--ease-out);
}

.link-arrow:hover svg {
  transform: translateX(4px);
}

/* ========================================
   SCROLL REVEAL ANIMATIONS
   ======================================== */

.section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hero section should be visible immediately */
.section--hero {
  opacity: 1;
  transform: none;
}

/* Stagger children animations */
.section.is-visible .card {
  animation: fadeInUp var(--duration-slow) var(--ease-out) backwards;
}

.section.is-visible .card:nth-child(1) { animation-delay: 0ms; }
.section.is-visible .card:nth-child(2) { animation-delay: 100ms; }
.section.is-visible .card:nth-child(3) { animation-delay: 200ms; }
.section.is-visible .card:nth-child(4) { animation-delay: 300ms; }
.section.is-visible .card:nth-child(5) { animation-delay: 400ms; }
.section.is-visible .card:nth-child(6) { animation-delay: 500ms; }

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .section {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .section.is-visible .card {
    animation: none;
  }
}
