/* ============================================================
   COMPONENTS — reusable UI shared by three or more sections:
   layout primitives, eyebrow/head header block, buttons, ripple
   and the scroll-reveal utility. Section-exclusive elements
   (e.g. the navbar's icon buttons, the carousel's round buttons)
   stay in their own section file instead of living here.
   ============================================================ */

/* ---------- Layout primitives ---------- */
/* Adds the device's safe-area inset (notch/rounded-corner/home-
   indicator exclusion zone) on top of the normal fluid gutter — a
   no-op (env() falls back to 0px) on the vast majority of devices
   that don't have one, real extra inset on the ones that do
   (landscape on a notched phone, mainly). Site-wide since every
   section shares this same container. */
.container {
  width: min(100%, var(--maxw));
  margin-inline: auto;
  padding-inline: calc(var(--pad-x) + env(safe-area-inset-left, 0px)) calc(var(--pad-x) + env(safe-area-inset-right, 0px));
}

.section { padding-block: var(--section-y); position: relative; }
/* Any anchor target (not just top-level <section>s — e.g. the hero's
   orbit wrapper) needs this so a jump link doesn't tuck the target
   under the sticky navbar. */
[id] { scroll-margin-top: 96px; }
.section--tight { padding-block: clamp(40px, 5vw, 72px); }

/* ---------- Eyebrow + section header block ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 22px;
}
html[lang="ar"] .eyebrow { letter-spacing: .06em; font-family: var(--font-body); }

.eyebrow .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(244, 196, 48, .16);
  animation: pulse 2.6s var(--ease) infinite;
}

.head { max-width: 720px; margin-bottom: clamp(36px, 5vw, 64px); }
.head--left { margin-bottom: 0; }
.head--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  max-width: none;
}
.head__title {
  font-size: clamp(30px, 4.2vw, 54px);
  font-weight: 700;
  text-wrap: balance;
}
.head__sub {
  margin-top: 20px;
  color: var(--muted);
  font-size: clamp(15px, 1.1vw, 18px);
  max-width: 58ch;
}

@media (max-width: 900px) {
  .head--row { flex-direction: column; align-items: flex-start; gap: 24px; }
}

/* ---------- Buttons ---------- */
/* Mobile-first fluid sizing: padding/font/min-height scale with
   clamp() from a phone-sized floor instead of one fixed desktop size
   with a single small-screen override. white-space is *not* nowrap —
   a long label is allowed to wrap to two lines on a narrow button
   rather than overflow or get clipped. */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(0.5rem, 1.5vw, 0.625rem);
  padding-inline: clamp(1.1rem, 4vw, 1.5rem);
  padding-block: clamp(0.7rem, 2.6vw, 0.8125rem);
  border: 1px solid transparent;
  border-radius: clamp(0.625rem, 1.5vw, 0.75rem);
  background: var(--btn-bg);
  color: var(--btn-fg);
  min-height: clamp(2.75rem, 8vw, 2.875rem);
  font-weight: 700;
  font-size: clamp(0.875rem, 1.4vw + 0.6rem, 0.90625rem);
  line-height: 1.3;
  letter-spacing: -.01em;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease),
              background .3s ease, border-color .3s ease, color .3s ease;
}
.btn--lg {
  min-height: clamp(3rem, 9vw, 3.375rem);
  padding-inline: clamp(1.3rem, 4.5vw, 1.75rem);
  font-size: clamp(0.92rem, 1.4vw + 0.65rem, 0.97rem);
}
.btn--block { width: 100%; }

.btn--gold {
  --btn-bg: linear-gradient(135deg, var(--accent), var(--gold) 62%, #D99F19);
  --btn-fg: #05070F;
  box-shadow: var(--glow-gold);
}
.btn--gold:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 0 1px rgba(244, 196, 48, .4), 0 24px 60px -18px rgba(244, 196, 48, .6);
}
.btn--outline {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  backdrop-filter: blur(10px);
}
.btn--outline:hover {
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 0 1px rgba(244, 196, 48, .18), 0 20px 46px -22px rgba(244, 196, 48, .3);
}
.btn--ghost { color: var(--muted); }
.btn--ghost:hover { color: var(--text); background: var(--surface-hover); }
/* .btn's own display:inline-flex otherwise beats the UA stylesheet's
   [hidden]{display:none} (author declarations always win over UA ones
   regardless of specificity) — without this, a button toggled hidden
   via JS (element.hidden = true) would stay visible. */
.btn[hidden] { display: none; }

/* Ripple (element injected by animations.js) */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, .35);
  pointer-events: none;
  animation: ripple .6s var(--ease) forwards;
  z-index: 0;
}
.btn--gold .ripple { background: rgba(5, 7, 15, .22); }

/* ---------- Icon button ---------- */
/* Small pill/square button for compact actions (navbar's language and
   theme toggles; the auth pages' language toggle). */
.icon-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  /* 2.75rem (44px) is a touch-target accessibility floor, not a
     viewport-driven layout size — held constant in rem (scales with
     user font-size/zoom) rather than clamp()'d down. */
  min-height: 2.75rem;
  border-radius: clamp(0.5rem, 1.2vw, 0.625rem);
  padding-inline: clamp(0.7rem, 2vw, 0.875rem);
  padding-block: clamp(0.4rem, 1.2vw, 0.5rem);
  font-size: clamp(0.75rem, 1vw, 0.78125rem);
  font-weight: 600;
  cursor: pointer;
  transition: color .25s ease, border-color .25s ease, background .25s ease;
}
.icon-btn:hover { color: var(--gold); border-color: rgba(244, 196, 48, .45); }
.icon-btn--square {
  padding: 0;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
}
.icon-btn svg { width: clamp(1rem, 2.2vw, 1.0625rem); height: clamp(1rem, 2.2vw, 1.0625rem); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Form fields ---------- */
/* Generic labeled input, shared by any page with a form (auth pages today;
   contact/settings/admin pages later reuse the same component). */
.field { display: block; margin-bottom: 18px; text-align: start; }
/* Same [hidden]-vs-author-display fix as .btn/.alert above: a plain
   class selector and the browser's built-in [hidden] rule are equal
   CSS specificity, so this authored `display: block` was silently
   beating `hidden` — a field like #qxOtpField (settings.html) stayed
   visibly rendered even with the hidden attribute set. Confirmed live
   (real DOM: hasAttribute('hidden')=true yet computedDisplay="block",
   isVisuallyVisible=true) before this fix. */
.field[hidden] { display: none; }
.field__label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.field__input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  transition: border-color .25s ease, background .25s ease;
}
.field__input::placeholder { color: var(--muted); }
.field__input:focus { outline: none; border-color: rgba(244, 196, 48, .5); background: var(--surface-hover); }
.field__input.is-invalid { border-color: rgba(255, 77, 79, .6); }
.field__hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.field__error { margin-top: 6px; font-size: 12px; color: var(--danger); min-height: 1.2em; }

/* Fixed-width, letter-spaced code input (OTP screens) */
.field__input--code {
  text-align: center;
  letter-spacing: .5em;
  font-family: var(--font-mono);
  font-size: 22px;
  padding-inline-start: 24px; /* balance the trailing letter-spacing gap */
}

/* ---------- Alerts ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: 18px;
}
.alert--error { border-color: rgba(255, 77, 79, .35); background: rgba(255, 77, 79, .08); color: #FF8A8C; }
.alert--success { border-color: rgba(0, 210, 106, .35); background: rgba(0, 210, 106, .08); color: var(--success); }
.alert--warning { border-color: rgba(244, 196, 48, .4); background: rgba(244, 196, 48, .08); color: var(--gold); }
[data-theme="light"] .alert--error { color: #C0272A; }
[data-theme="light"] .alert--success { color: #0A8A4B; }
[data-theme="light"] .alert--warning { color: #8A6A0A; }
/* Same [hidden]-vs-author-display fix as .btn above — matters here once
   an alert has been shown once (formHelpers.hideAlert only toggles
   `hidden`, it never clears the alert/alert--* classes it was given). */
.alert[hidden] { display: none; }

/* Two-line title+description alert body (e.g. the ADMIN APPROVAL
   WORKFLOW's "account pending review" / "account suspended" login
   alerts — pages/login/login.js, assets/js/authModal.js) — wrapped in
   its own column container so it stacks under .alert's own row flex
   layout instead of sitting beside it. */
.alert__body { display: flex; flex-direction: column; gap: 4px; }
.alert__title { font-weight: 800; }
.alert__desc { margin: 0; opacity: .92; }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  filter: blur(6px);
  transition: opacity .8s var(--ease), transform .8s var(--ease), filter .8s var(--ease);
  transition-delay: var(--d, 0ms);
}
.reveal.is-visible { opacity: 1; transform: none; filter: none; }

/* ---------- Offer card grid ---------- */
/* Generic icon/title/text card used by the "What we offer" ecosystem
   sections (strategies, bots, timeframes, …) — one shell, reused
   instead of a bespoke card per section. */
.offer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(14px, 2.4vw, 22px);
}
@media (min-width: 34rem) { .offer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 62rem) { .offer-grid--3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 68rem) { .offer-grid--4 { grid-template-columns: repeat(4, 1fr); } }

.offer-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(165deg, var(--surface-soft), transparent 60%), var(--surface);
  overflow: hidden;
  transition: transform .4s var(--ease), border-color .4s ease, box-shadow .4s var(--ease);
}
.offer-card::before {
  content: "";
  position: absolute;
  inset-block-start: -30%;
  inset-inline-end: -30%;
  width: 60%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(201, 162, 77, .14), transparent 70%);
  pointer-events: none;
}
.offer-card__icon {
  position: relative;
  width: clamp(40px, 4.5vw, 46px);
  height: clamp(40px, 4.5vw, 46px);
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(201, 162, 77, .18), transparent 70%);
  transition: transform .4s var(--ease), border-color .4s ease;
}
.offer-card__icon svg { width: 21px; height: 21px; fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.offer-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; position: relative; }
.offer-card__tag {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 5px 10px;
  border: 1px solid rgba(201, 162, 77, .32);
  border-radius: var(--r-pill);
  background: rgba(201, 162, 77, .08);
  white-space: nowrap;
}
.offer-card__title { font-size: clamp(16px, 1.6vw, 19px); font-weight: 700; letter-spacing: -.01em; position: relative; }
.offer-card__text { font-size: 13.5px; color: var(--muted); line-height: 1.65; position: relative; }
.offer-card__list { display: flex; flex-direction: column; gap: 9px; margin-top: auto; padding-top: 4px; position: relative; }
.offer-card__list li { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.offer-card__list li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); margin-top: 6px; flex-shrink: 0; }

@media (hover: hover) and (pointer: fine) {
  .offer-card:hover { transform: translateY(-6px); border-color: rgba(201, 162, 77, .38); box-shadow: 0 26px 60px -34px rgba(0, 0, 0, .85); }
  .offer-card:hover .offer-card__icon { transform: scale(1.08); border-color: rgba(201, 162, 77, .5); }
}

/* ---------- Workflow / step pipeline ---------- */
/* Vertical step list by default (mobile + as a narrow column on
   desktop); add .workflow--row to switch to a horizontal pipeline
   from 900px up (copy-trading, auto-execution, strategy-execution). */
.workflow { display: flex; flex-direction: column; }
.workflow__step { position: relative; display: flex; align-items: flex-start; gap: 16px; padding-block: 16px; }
.workflow__step:first-child { padding-top: 0; }
.workflow__num {
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 77, .4);
  background: radial-gradient(circle at 50% 30%, rgba(201, 162, 77, .18), var(--bg-deep) 75%);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--gold);
}
.workflow__num svg { width: 17px; height: 17px; fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.workflow__connector {
  position: absolute;
  inset-inline-start: 19px;
  top: 40px;
  bottom: -16px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(201, 162, 77, .55) 50%, transparent);
  transform-origin: top;
  transform: scaleY(0);
  transition: transform 1s var(--ease) .15s;
}
.reveal.is-visible .workflow__connector { transform: scaleY(1); }
.workflow__step:last-child .workflow__connector { display: none; }
.workflow__body { padding-top: 7px; }
.workflow__title { font-size: 15.5px; font-weight: 700; margin-bottom: 4px; }
.workflow__text { font-size: 13px; color: var(--muted); line-height: 1.6; max-width: 52ch; }

@media (min-width: 56rem) {
  .workflow--row { flex-direction: row; align-items: flex-start; gap: clamp(6px, 1.4vw, 14px); }
  .workflow--row .workflow__step { flex-direction: column; align-items: center; text-align: center; flex: 1; padding-block: 0; }
  .workflow--row .workflow__connector {
    inset-inline-start: calc(50% + 20px);
    inset-inline-end: calc(-50% + 20px);
    top: 19px; bottom: auto;
    width: auto; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201, 162, 77, .55) 50%, transparent);
    transform-origin: center;
    transform: scaleX(0);
  }
  .workflow--row.reveal.is-visible .workflow__connector,
  .reveal.is-visible .workflow--row .workflow__connector { transform: scaleX(1); }
  .workflow--row .workflow__body { padding-top: 14px; }
  .workflow--row .workflow__text { max-width: 21ch; margin-inline: auto; }
}

/* Checklist accent (strategy-execution): filled check mark instead
   of a plain step index, faint success-tinted ring. */
.workflow--check .workflow__num { border-color: rgba(0, 210, 106, .38); background: radial-gradient(circle at 50% 30%, rgba(0, 210, 106, .16), var(--bg-deep) 75%); }
.workflow--check .workflow__num svg { stroke: var(--success); }
