/* ==========================================================================
   BINEXA — Components
   Static-HTML ports of the design-system React primitives
   (design-system/components/**). Class names map 1:1 to future Blade components.
   ========================================================================== */

/* ---------- Button (core/Button) ---------- */
.btn {
  --btn-h: 46px; --btn-px: 22px; --btn-fs: 15px;
  --btn-bg: var(--gold-500); --btn-fg: var(--ink-900); --btn-bd: transparent;
  --btn-bg-hover: var(--gold-400); --btn-bg-press: var(--gold-600);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--btn-h);
  padding: 0 var(--btn-px);
  font-family: var(--font-arabic);
  font-weight: var(--weight-extra);
  font-size: var(--btn-fs);
  line-height: 1.2;
  white-space: nowrap;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1.5px solid var(--btn-bd);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition:
    background-color var(--dur-base) var(--ease-standard),
    color var(--dur-base) var(--ease-standard),
    border-color var(--dur-base) var(--ease-standard),
    transform var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-base) var(--ease-standard);
}
.btn:hover { background: var(--btn-bg-hover); color: var(--btn-fg); text-decoration: none; }
.btn:active { background: var(--btn-bg-press); transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.btn--primary:hover { box-shadow: var(--shadow-gold-glow); }

.btn--secondary {
  --btn-bg: var(--charcoal-500); --btn-fg: var(--white);
  --btn-bg-hover: var(--charcoal-400); --btn-bg-press: var(--charcoal-600);
}
.btn--outline {
  --btn-bg: transparent; --btn-fg: var(--gold-500); --btn-bd: var(--gold-500);
  --btn-bg-hover: rgba(211,157,53,.12); --btn-bg-press: rgba(211,157,53,.2);
}
.btn--ghost {
  --btn-bg: transparent; --btn-fg: var(--white);
  --btn-bg-hover: rgba(255,255,255,.08); --btn-bg-press: rgba(255,255,255,.14);
}
.btn--light {
  --btn-bg: var(--white); --btn-fg: var(--ink-900);
  --btn-bg-hover: var(--paper); --btn-bg-press: #E4E4E7;
}
.btn--dark {
  --btn-bg: var(--ink-900); --btn-fg: var(--gold-500);
  --btn-bg-hover: var(--ink-750); --btn-bg-press: var(--ink-950);
}

.btn--sm { --btn-h: 36px; --btn-px: 14px; --btn-fs: 13px; }
.btn--lg { --btn-h: 54px; --btn-px: 30px; --btn-fs: 17px; }
.btn--block { display: flex; width: 100%; }

.btn .fa-solid { font-size: .95em; }

/* Directional arrow that nudges forward on hover (flips for LTR) */
.btn__arrow { transition: transform var(--dur-base) var(--ease-out); }
[dir="ltr"] .btn__arrow { transform: scaleX(-1); }
.btn:hover .btn__arrow { transform: translateX(-4px); }
[dir="ltr"] .btn:hover .btn__arrow { transform: scaleX(-1) translateX(-4px); }

/* ---------- Section tab (brand/SectionTab) ---------- */
.section-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 22px;
  background: var(--gold-500);
  color: var(--ink-900);
  font-family: var(--font-arabic);
  font-weight: var(--weight-extra);
  font-size: var(--fs-body);
  line-height: 1.1;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.section-tab--sm { padding: 6px 14px; font-size: 13px; border-radius: 5px; }
.section-tab--lg { padding: 10px 36px; font-size: 20px; border-radius: 8px; }
.section-tab--hanging { padding: 10px 48px 12px; border-radius: 0 0 14px 14px; }
.section-tab__latin { font-family: var(--font-body); font-weight: var(--weight-bold); direction: ltr; }

/* ---------- Section heading block ---------- */
.section-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  max-width: 760px;
  margin-block-end: var(--space-12);
}
.section-head--center { align-items: center; text-align: center; margin-inline: auto; }
.section-head__title { font: var(--weight-extra) var(--fs-h2-fluid)/var(--lh-tight) var(--font-arabic); }
.section-head__lead  { font-size: var(--fs-body-lg); line-height: var(--lh-body); color: var(--text-secondary); }

/* ---------- Accent bar (brand/AccentBar) ---------- */
.accent-bar {
  display: block;
  flex: none;
  width: var(--bar-thickness, 6px);
  height: var(--bar-length, 80px);
  background: var(--gold-500);
  border-radius: 2px;
}
.accent-bar--horizontal { width: var(--bar-length, 80px); height: var(--bar-thickness, 3px); }
.accent-bar--white { background: var(--white); }

/* Quote rule: bar beside a text block */
.quote-rule { display: flex; gap: var(--space-4); align-items: stretch; }
.quote-rule > .accent-bar { height: auto; }

/* ---------- Hazard stripe (brand/HazardStripe) ---------- */
.hazard {
  --stripe: 10px;
  --hazard-a: var(--ink-900);
  --hazard-b: var(--gold-500);
  --hazard-period: calc(var(--stripe) * 2.828); /* horizontal repeat of the 45° stripes */
  display: block;
  height: var(--hazard-h, 48px);
  background: repeating-linear-gradient(135deg, var(--hazard-a) 0 var(--stripe), var(--hazard-b) var(--stripe) calc(var(--stripe) * 2));
  background-size: var(--hazard-period) var(--hazard-period);
}
.hazard--inverted { --hazard-a: var(--gold-500); --hazard-b: var(--ink-900); }

/* Flowing variant: the stripes live on a wider pseudo-element that slides by exactly one period —
   a composited transform instead of repainting background-position every frame. */
.hazard--flow { position: relative; overflow: hidden; background: none; }
.hazard--flow::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(100% + var(--hazard-period));
  background: repeating-linear-gradient(135deg, var(--hazard-a) 0 var(--stripe), var(--hazard-b) var(--stripe) calc(var(--stripe) * 2));
  background-size: var(--hazard-period) var(--hazard-period);
  animation: bx-hazard-flow 1.6s linear infinite;
}

/* ---------- Photo frame (brand/PhotoFrame) ---------- */
.photo-frame {
  --arm: 60%;
  --frame-inset: 5px;
  position: relative;
  padding: var(--frame-inset);
}
.photo-frame::before,
.photo-frame::after {
  content: "";
  position: absolute;
  width: var(--arm);
  height: var(--arm);
  pointer-events: none;
  border: 0 solid var(--gold-500);
  transition: width var(--dur-slow) var(--ease-out), height var(--dur-slow) var(--ease-out);
}
.photo-frame::before { inset-block-start: 0; inset-inline-start: 0; border-block-start-width: 2px; border-inline-start-width: 2px; }
.photo-frame::after  { inset-block-end: 0;   inset-inline-end: 0;   border-block-end-width: 2px;   border-inline-end-width: 2px; }
.photo-frame--mirror::before { inset-inline-start: auto; inset-inline-end: 0; border-inline-start-width: 0; border-inline-end-width: 2px; }
.photo-frame--mirror::after  { inset-inline-end: auto; inset-inline-start: 0; border-inline-end-width: 0; border-inline-start-width: 2px; }

.photo-frame__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--ratio, 4 / 3);
  background: var(--gradient-card);
}
.photo-frame__media > img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 900ms var(--ease-out);
}
.photo-frame:hover { --arm: 100%; }
.photo-frame:hover .photo-frame__media > img { transform: scale(1.06); }

/* Placeholder shown until a generated/real image is supplied */
.img-placeholder {
  display: grid; place-items: center;
  width: 100%; height: 100%;
  background: var(--gradient-card);
  color: var(--charcoal-200);
  font-size: var(--fs-caption);
  text-align: center;
  padding: var(--space-4);
}

/* ---------- Card (core/Card) ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-card);
  color: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition:
    transform var(--dur-slow) var(--ease-out),
    border-color var(--dur-base) var(--ease-standard),
    box-shadow var(--dur-slow) var(--ease-out);
}
.card__body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-6); }
.card__title { font: var(--weight-extra) 20px/1.3 var(--font-arabic); }

.card--band     { background: var(--surface-band); border: 0; }
.card--gold     { background: var(--gold-500); color: var(--ink-900); border: 0; }
.card--gradient { background: var(--gradient-card); border: 0; }
.card--light    { background: var(--white); color: var(--charcoal-600); border: 0; }

.card--interactive:hover {
  transform: translateY(-6px);
  border-color: rgba(211,157,53,.45);
  box-shadow: var(--shadow-lg);
}

/* Sheen sweep across a card on hover */
.has-sheen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.10) 45%, rgba(235,209,113,.16) 50%, transparent 62%);
  transform: translateX(-120%);
}
.has-sheen:hover::after { animation: bx-sheen 1100ms var(--ease-out); }

/* ---------- Badge (core/Badge) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 10px;
  font-family: var(--font-body);
  font-weight: var(--weight-bold);
  font-size: 12px; line-height: 1;
  white-space: nowrap;
  border-radius: var(--radius-xs);
  background: var(--gold-500); color: var(--ink-900);
}
.badge--dark    { background: var(--ink-900); color: var(--gold-500); }
.badge--neutral { background: var(--charcoal-500); color: var(--white); }

/* ---------- Icon circle (gold-ringed glyph) ---------- */
.icon-circle {
  --size: 56px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  color: var(--gold-500);
  background: rgba(211,157,53,.08);
  font-size: calc(var(--size) * .38);
}
.icon-circle__ring {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}
.icon-circle__ring circle {
  fill: none;
  stroke: var(--gold-500);
  stroke-width: 2;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
}

/* ---------- Tabs (navigation/Tabs) ---------- */
.tabs {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--ink-900);
  border-radius: var(--radius-md);
}
.tabs__btn {
  position: relative;
  z-index: 1;
  border: 0;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-arabic);
  font-weight: var(--weight-extra);
  font-size: var(--fs-small);
  transition: color var(--dur-base) var(--ease-standard), background-color var(--dur-base) var(--ease-standard);
}
.tabs__btn:hover { color: var(--white); }
.tabs__btn[aria-selected="true"],
.tabs__btn[aria-pressed="true"] { color: var(--ink-900); background: var(--gold-500); }
/* When JS drives the sliding indicator, the active fill moves to the indicator */
.tabs.has-indicator .tabs__btn[aria-selected="true"],
.tabs.has-indicator .tabs__btn[aria-pressed="true"] { background: transparent; }
.tabs__indicator {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0; /* physical: positioned by JS from the group's top-left in both directions */
  width: 0;
  height: 0;
  border-radius: var(--radius-sm);
  background: var(--gold-500);
  transition: transform var(--dur-slow) var(--ease-out), width var(--dur-slow) var(--ease-out), height var(--dur-slow) var(--ease-out);
}
.tabs__count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  margin-inline-start: 4px;
  padding-inline: 6px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,.08);
  font-family: var(--font-body);
  font-size: 11px;
  transition: background-color var(--dur-base) var(--ease-standard);
}
.tabs__btn[aria-pressed="true"] .tabs__count,
.tabs__btn[aria-selected="true"] .tabs__count { background: rgba(8,7,14,.16); }

/* ---------- Form fields (forms/Input, forms/Select) ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-family: var(--font-body);
  font-weight: var(--weight-bold);
  font-size: 13px;
  color: var(--text-secondary);
}
.field__req { color: var(--gold-500); margin-inline-start: 2px; }
.field__control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding-inline: 14px;
  background: var(--ink-900);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur-base) var(--ease-standard), box-shadow var(--dur-base) var(--ease-standard);
}
/* Gold line that grows under the field on focus */
.field__control::after {
  content: "";
  position: absolute;
  inset-inline: 10px;
  inset-block-end: -1.5px;
  height: 2px;
  background: var(--gold-500);
  transform: scaleX(0);
  transition: transform var(--dur-slow) var(--ease-out);
}
.field__control:focus-within { border-color: var(--gold-500); box-shadow: var(--focus-ring); }
.field__control:focus-within::after { transform: scaleX(1); }
.field__control > .fa-solid { color: var(--gold-500); font-size: 14px; }

.field__input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
}
.field__input::placeholder { color: var(--charcoal-200); }
textarea.field__input { min-height: 120px; padding-block: 12px; resize: vertical; line-height: 1.7; }
.field__control--textarea { align-items: flex-start; }

select.field__input { appearance: none; -webkit-appearance: none; padding-inline-end: 28px; cursor: pointer; }
select.field__input option { background: var(--ink-900); color: var(--white); }
.field__chevron {
  position: absolute;
  inset-inline-end: 14px;
  pointer-events: none;
  font-size: 12px;
  color: var(--gold-500);
}

.field__hint  { font-size: 12px; color: var(--text-muted); }
.field__error { display: none; align-items: center; gap: 6px; font-size: 12.5px; color: #F08A82; }
.field.is-invalid .field__control { border-color: var(--danger-500); }
.field.is-invalid .field__control::after { background: var(--danger-500); }
.field.is-invalid .field__error { display: flex; }
