/* Components — buttons, cards, forms, badges, tags, accordion, testimonials, alerts */

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-weight: 600;
  font-size: var(--fs-0);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-4);
  min-height: 44px;
  transition: all .15s ease;
  text-align: center;
  white-space: nowrap;
}
.btn--sm { padding: var(--s-1) var(--s-3); min-height: 36px; font-size: .875rem; }
.btn--lg { padding: var(--s-3) var(--s-5); min-height: 52px; font-size: var(--fs-1); }
.btn--block { width: 100%; }

.btn--primary {
  background: var(--brand-600);
  color: white;
}
.btn--primary:hover { background: #1D4ED8; }

.btn--secondary {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,.3);
}
.btn--secondary:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.5); }

/* On light backgrounds */
.section .btn--secondary,
.page-hero .btn--secondary,
.hero .btn--secondary {
  color: var(--ink-900);
  border-color: var(--line);
}
.section .btn--secondary:hover,
.page-hero .btn--secondary:hover,
.hero .btn--secondary:hover { background: var(--mist); }

.btn--accent {
  background: var(--accent-500);
  color: var(--ink-900);
}
.btn--accent:hover { background: var(--accent-600); color: white; }

.btn--ghost {
  background: transparent;
  color: var(--ink-700);
  border: 1px solid var(--line);
}
.btn--ghost:hover { background: var(--mist); }

.btn--danger {
  background: var(--danger);
  color: white;
}
.btn--danger:hover { background: #a52525; }

.btn--success {
  background: var(--success);
  color: white;
}

/* ===== Link with arrow ===== */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-weight: 600;
  font-size: var(--fs-0);
  color: var(--brand-600);
  transition: gap .15s;
}
.link-arrow:hover { gap: var(--s-2); text-decoration: underline; }

/* ===== Cards ===== */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-4);
  transition: transform .2s, box-shadow .2s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.card__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--r-sm);
  background: var(--brand-100);
  color: var(--brand-600);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s-3);
}
.card__title {
  font-size: var(--fs-1);
  margin-bottom: var(--s-2);
}
.card__text {
  color: var(--ink-500);
  font-size: var(--fs-0);
  margin-bottom: var(--s-3);
}
.card__link {
  display: block;
  color: inherit;
}
.card__link:hover { text-decoration: none; }

/* Project card */
.card--project { padding: 0; overflow: hidden; }
.card--project .card__image {
  position: relative;
  aspect-ratio: 16/10;
  background: var(--mist);
  overflow: hidden;
}
.card--project .card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card--project .card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-300);
}
.card--project .card__body { padding: var(--s-4); }

/* "View details" affordance inside the project card body */
.card__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-0);
  font-weight: 600;
  color: var(--brand-600);
}
.card--project:hover .card__cta svg { transform: translateX(3px); }
.card__cta svg { transition: transform .2s; }
[dir="rtl"] .card__cta svg { transform: scaleX(-1); }
[dir="rtl"] .card--project:hover .card__cta svg { transform: scaleX(-1) translateX(3px); }

/* Direct link to the live site — sits outside .card__link so it is its own
   target rather than a link nested inside a link. */
.card__live {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  padding: var(--s-2) var(--s-4);
  border-top: 1px solid var(--line);
  font-size: var(--fs-0);
  font-weight: 600;
  color: var(--brand-600);
  background: var(--brand-100);
}
.card__live:hover { background: var(--brand-500); color: var(--paper); text-decoration: none; }

/* Post card */
.card--post { padding: 0; overflow: hidden; }
.card--post .card__image {
  aspect-ratio: 16/9;
  background: var(--mist);
  overflow: hidden;
}
.card--post .card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card--post .card__body { padding: var(--s-4); }
.card__meta {
  font-size: var(--fs-0);
  color: var(--ink-500);
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: .75rem;
  font-weight: 600;
  padding: 2px var(--s-2);
  border-radius: 100px;
  background: var(--brand-100);
  color: var(--brand-600);
  margin-bottom: var(--s-2);
}
.badge--sample {
  background: #FEF3C7;
  color: #92400E;
}
.card--project .badge--sample {
  position: absolute;
  top: var(--s-3);
  inset-inline-start: var(--s-3);
  margin-bottom: 0;
}

/* ===== Tags ===== */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-block: var(--s-3);
}
.tag {
  display: inline-flex;
  padding: var(--s-1) var(--s-3);
  background: var(--mist);
  border-radius: 100px;
  font-size: var(--fs-0);
  font-weight: 500;
  color: var(--ink-700);
}

/* ===== Check list ===== */
.check-list {
  margin-block: var(--s-3);
}
.check-list li {
  position: relative;
  padding-inline-start: var(--s-4);
  margin-bottom: var(--s-2);
  color: var(--ink-700);
}
.check-list li::before {
  content: '✓';
  position: absolute;
  inset-inline-start: 0;
  color: var(--accent-500);
  font-weight: 700;
}

/* ===== Accordion ===== */
.accordion {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.accordion__item {
  border-bottom: 1px solid var(--line);
}
.accordion__item:last-child { border-bottom: none; }
.accordion__question {
  padding: var(--s-3) var(--s-4);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  transition: background .15s;
}
.accordion__question:hover { background: var(--mist); }
.accordion__question::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--ink-500);
  transition: transform .2s;
}
.accordion__item[open] .accordion__question::after { transform: rotate(45deg); }
.accordion__answer {
  padding: 0 var(--s-4) var(--s-3);
  color: var(--ink-500);
}

/* ===== Testimonial ===== */
.testimonial {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-4);
}
.testimonial__stars {
  display: flex;
  gap: 2px;
  color: #F59E0B;
  margin-bottom: var(--s-3);
}
.testimonial__quote {
  font-size: var(--fs-0);
  color: var(--ink-700);
  line-height: 1.7;
  margin-bottom: var(--s-3);
  font-style: italic;
}
.testimonial__author {
  font-size: var(--fs-0);
  color: var(--ink-500);
}

/* ===== Forms ===== */
.form-row {
  display: grid;
  gap: var(--s-3);
}
@media (min-width: 640px) {
  .form-row { grid-template-columns: repeat(2, 1fr); }
}

.form-group { margin-bottom: var(--s-3); }
.form-label {
  display: block;
  font-weight: 500;
  font-size: var(--fs-0);
  margin-bottom: var(--s-1);
  color: var(--ink-700);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-0);
  color: var(--ink-900);
  background: var(--paper);
  transition: border-color .15s, box-shadow .15s;
  min-height: 44px;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-input.is-error,
.form-textarea.is-error {
  border-color: var(--danger);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-textarea--code {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: .875rem;
  direction: ltr;
  text-align: left;
}

.form-group--checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
}
.form-label--checkbox {
  font-size: var(--fs-0);
  color: var(--ink-700);
  line-height: 1.5;
  cursor: pointer;
}
.form-group--checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--brand-600);
}

/* Honeypot — hidden */
.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

/* ===== Alerts ===== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm);
  font-size: var(--fs-0);
  font-weight: 500;
  margin-bottom: var(--s-4);
}
.alert--success {
  background: #ECFDF5;
  color: var(--success);
  border: 1px solid #A7F3D0;
}
.alert--error {
  background: #FEF2F2;
  color: var(--danger);
  border: 1px solid #FECACA;
}
.alert svg { flex-shrink: 0; margin-top: 2px; }

/* ===== Reveal animation ===== */
[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s ease, transform .5s ease;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
