/* ==========================================================================
   Antos Pinnacles — shared components
   ========================================================================== */

/* ---------- Logo: circle mark + wordmark (wordmark is a mask so it follows --logo-text) ---------- */
.logo { display: inline-flex; align-items: center; gap: 0.7rem; flex-shrink: 0; }
.logo__mark { width: 42px; height: 42px; border-radius: 50%; box-shadow: 0 0 0 1px rgb(255 255 255 / 0.12); }
:root[data-theme="light"] .logo__mark { box-shadow: none; }
.logo__word {
  display: block;
  width: 92px;
  aspect-ratio: 471 / 160;
  background-color: var(--logo-text);
  -webkit-mask: url("../img/brand/ap-wordmark.png") center / contain no-repeat;
  mask: url("../img/brand/ap-wordmark.png") center / contain no-repeat;
  transition: background-color 0.3s ease;
}
.logo--lg .logo__mark { width: 64px; height: 64px; }
.logo--lg .logo__word { width: 140px; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--pill-bg);
  --btn-fg: var(--pill-text);
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 46px;
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 0.35s var(--ease), background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.35s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -12px var(--glow-1); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; transition: transform 0.35s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn--accent { --btn-bg: var(--accent); --btn-fg: var(--accent-contrast); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--text); --btn-border: var(--border-strong); }
.btn--ghost:hover { --btn-border: var(--text-muted); }
.btn--sm { min-height: 38px; padding: 0.5rem 1.1rem; font-size: 0.7rem; }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn-row--center { justify-content: center; }

/* Phones: long labels (Malay, Vietnamese) wrap inside the pill instead of overflowing it, and paired
   CTAs share the row or stack full-width rather than sitting at uneven ragged widths */
@media (max-width: 479px) {
  .btn { max-width: 100%; white-space: normal; }
  .btn-row > .btn { flex: 1 1 auto; }
}
@media (max-width: 767px) {
  .btn--sm { font-size: 0.75rem; letter-spacing: 0.08em; }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text);
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
.icon-btn:hover { border-color: var(--text-muted); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
/* Grow the touch target to ~40px without changing the layout */
.text-link { position: relative; }
.text-link::after { content: ""; position: absolute; inset: -10px -6px; }
.text-link svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}
.site-header.is-scrolled,
.site-header.is-open,
.site-header:not(.site-header--overlay) {
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom-color: var(--border);
}
/* Over full-bleed heroes the header starts transparent and sits on top of the hero */
.site-header--overlay { position: fixed; inset: 0 0 auto; }

.site-header__inner { display: flex; align-items: center; gap: 1.5rem; height: 100%; }
.main-nav { margin-inline: auto; height: 100%; }
.main-nav__list { display: flex; align-items: stretch; gap: 0.25rem; height: 100%; margin: 0; padding: 0; list-style: none; }
.main-nav__item { position: relative; display: flex; align-items: center; }
.main-nav__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-muted);
  transition: color 0.2s ease, background-color 0.2s ease;
}
.main-nav__trigger svg { width: 10px; height: 10px; transition: transform 0.3s var(--ease); }
.main-nav__item.is-open .main-nav__trigger,
.main-nav__trigger:hover,
.main-nav__trigger[aria-current="true"] { color: var(--heading); background: var(--surface-2); }
.main-nav__item.is-open .main-nav__trigger svg { transform: rotate(180deg); }

/* Dropdown hangs directly under its menu item; the last items open leftwards so they stay on screen */
.mega {
  position: absolute;
  left: 0;
  top: 100%;
  width: max-content;
  padding-top: 0.75rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.35s var(--ease), visibility 0s linear 0.25s;
}
.main-nav__item:nth-last-child(-n + 2) .mega { left: auto; right: 0; }
.main-nav__item.is-open .mega { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.mega__inner {
  display: flex;
  gap: 1rem;
  max-width: calc(100vw - var(--gutter) * 2);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.mega__group { min-width: 230px; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--surface-2); }
.mega__title { margin: 0 0 0.75rem; font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.mega__list { margin: 0; padding: 0; list-style: none; }
.mega__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  color: var(--text);
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s ease, padding 0.3s var(--ease);
}
.mega__list li:last-child .mega__link { border-bottom: 0; }
.mega__link svg { width: 12px; height: 12px; opacity: 0; transform: translateX(-6px); transition: opacity 0.2s ease, transform 0.3s var(--ease); }
.mega__link:hover { color: var(--accent); padding-left: 0.35rem; }
.mega__link:hover svg { opacity: 1; transform: none; }

.header-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.main-nav + .header-actions { margin-left: 0; }

/* Language picker */
.lang { position: relative; }
.lang__toggle { width: auto; padding: 0 0.7rem; gap: 0.45rem; display: inline-flex; white-space: nowrap; border-radius: var(--radius-pill); font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; }
.lang__toggle img, .lang__menu img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
.lang__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  min-width: 180px;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.lang__menu[hidden] { display: none; }
.lang__option { display: flex; align-items: center; gap: 0.65rem; width: 100%; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); font-size: 0.92rem; text-align: left; }
.lang__option:hover, .lang__option[aria-checked="true"] { background: var(--surface-2); color: var(--heading); }

/* Theme toggle swaps sun/moon icons */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.menu-toggle { display: none; }
/* Plus icon bars; open/rotate behaviour lives in motion.css */
.menu-toggle__bars { display: block; }
.menu-toggle__bars > span { display: block; background: currentColor; }

/* ---------- Mobile drawer (template's full-screen menu) ---------- */
.drawer {
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: 99;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  padding: 1.5rem var(--gutter) 2.5rem;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.3s ease, transform 0.4s var(--ease);
}
.drawer[hidden] { display: block; visibility: hidden; pointer-events: none; }
.drawer.is-open { opacity: 1; transform: none; }
.drawer__label { margin-bottom: 1rem; }
.drawer__group { border-bottom: 1px solid var(--border); }
.drawer__group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.05rem 0;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--heading);
  list-style: none;
  cursor: pointer;
}
.drawer__group summary::-webkit-details-marker { display: none; }
.drawer__group summary svg { width: 14px; height: 14px; transition: transform 0.3s var(--ease); }
.drawer__group[open] summary svg { transform: rotate(45deg); }
.drawer__sub { padding: 0 0 1.25rem; }
.drawer__sub-title { margin: 0.5rem 0 0.35rem; font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.drawer__sub ul { margin: 0; padding: 0; list-style: none; }
.drawer__sub a { display: block; padding: 0.5rem 0; color: var(--text-muted); }
.drawer__sub a:hover { color: var(--heading); }
.drawer__actions { display: grid; gap: 0.75rem; margin-top: 2rem; }
.drawer__langs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.75rem; }
.drawer__langs .lang__option { width: auto; min-height: 40px; border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0.45rem 0.85rem; font-size: 0.85rem; }
.drawer__theme { margin-top: 1.25rem; }
.drawer__sub a { min-height: 40px; display: flex; align-items: center; }
body.menu-open { overflow: hidden; }

@media (max-width: 1199px) {
  .main-nav, .header-actions .hide-lg { display: none; }
  .menu-toggle { display: inline-grid; }
  /* With the nav hidden nothing pushes the actions right, so they would hug the logo */
  .header-actions, .main-nav + .header-actions { margin-left: auto; }
}
@media (min-width: 1200px) {
  .drawer { display: none !important; }
}
/* 1200-1599: full nav plus three CTAs needs ~1280px in English and ~1360px in Malay at the roomy
   spacing; tighten so nothing is clipped or overlaps. Below 1440 the Client Portal button (.hide-xl)
   also steps aside: it stays one click away in the "Featured" side panel. */
@media (min-width: 1200px) and (max-width: 1599px) {
  .site-header__inner { gap: 1rem; }
  .main-nav__list { gap: 0; }
  .main-nav__trigger { padding-inline: 0.6rem; letter-spacing: 0.06em; }
  .header-actions { gap: 0.4rem; }
  .header-actions .btn--sm { padding-inline: 0.8rem; letter-spacing: 0.06em; }
  .lang__toggle span { display: none; }
  .lang__toggle { width: 40px; padding: 0; justify-content: center; }
}
@media (min-width: 1200px) and (max-width: 1439px) {
  .header-actions .hide-xl { display: none; }
}
@media (max-width: 767px) {
  .header-actions .hide-md { display: none; }
  .site-header__inner { gap: 0.75rem; }
  .logo__mark { width: 36px; height: 36px; }
  .logo__word { width: 80px; }
}
@media (max-width: 479px) {
  .site-header__inner { gap: 0.5rem; }
  .header-actions { gap: 0.35rem; }
  .header-actions .icon-btn { width: 36px; height: 36px; }
  .header-actions .btn--sm { min-height: 36px; padding-inline: 0.8rem; font-size: 0.75rem; letter-spacing: 0.04em; white-space: nowrap; }
  .logo { gap: 0.5rem; }
  .logo__mark { width: 34px; height: 34px; }
  .logo__word { width: 70px; }
}
/* Narrowest phones: the header theme toggle moves into the drawer (.drawer__theme) */
.drawer__theme { display: none; }
@media (max-width: 359px) {
  .header-actions .theme-toggle { display: none; }
  .drawer__theme { display: inline-grid; }
}

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3.5rem, 2rem + 6vw, 8rem) 0 clamp(3rem, 2rem + 4vw, 6rem);
  isolation: isolate;
}
.page-hero::before,
.page-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}
.page-hero::before { width: 46vw; height: 46vw; max-width: 620px; max-height: 620px; top: -40%; right: -8%; background: var(--glow-1); opacity: 0.55; }
.page-hero::after { width: 38vw; height: 38vw; max-width: 520px; max-height: 520px; bottom: -55%; left: -10%; background: var(--glow-2); opacity: 0.45; }
.page-hero__grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); align-items: center; gap: clamp(2rem, 1rem + 4vw, 5rem); }
.page-hero__title { font-size: var(--fs-h1); margin-bottom: 0.4em; }
.page-hero__lead { max-width: 640px; }
.page-hero__media img { width: 100%; max-height: 440px; object-fit: contain; }
.page-hero .btn-row { margin-top: 2rem; }
.page-hero--center { text-align: center; }
.page-hero--center .page-hero__lead { margin-inline: auto; }
.page-hero--center .eyebrow, .page-hero--center .breadcrumb, .page-hero--center .btn-row { justify-content: center; }
.page-hero--center .inline-form { margin: 2rem auto 0; }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 1.25rem; padding: 0; list-style: none; font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-subtle); }
.breadcrumb li + li::before { content: "/"; margin-right: 0.5rem; opacity: 0.6; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb [aria-current] { color: var(--text-muted); }

@media (max-width: 991px) {
  .page-hero__grid { grid-template-columns: minmax(0, 1fr); }
  .page-hero__media { max-width: 520px; }
}

/* ---------- Cards ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(1.4rem, 1.1rem + 1vw, 2.2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.3s ease, transform 0.45s var(--ease), background-color 0.3s ease;
}
.card--hover:hover { border-color: var(--border-strong); transform: translateY(-4px); }
.card__index { margin: 0 0 1.4rem; font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.14em; color: var(--text-subtle); }
.card__icon { width: 64px; height: 64px; margin-bottom: 1.4rem; object-fit: contain; }
.card__title { font-size: var(--fs-h4); margin-bottom: 0.6rem; }
.card__text { color: var(--text-muted); }
.card__foot { margin-top: auto; padding-top: 1.5rem; }
.card__media { margin: calc(clamp(1.4rem, 1.1rem + 1vw, 2.2rem) * -1) calc(clamp(1.4rem, 1.1rem + 1vw, 2.2rem) * -1) 1.5rem; overflow: hidden; border-radius: var(--radius-lg) var(--radius-lg) 0 0; aspect-ratio: 16 / 10; background: var(--surface-2); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease); }
.card--hover:hover .card__media img { transform: scale(1.04); }
.card--glow::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(60% 80% at 50% 0%, var(--glow-1), transparent 70%);
  opacity: 0.6;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tag--accent { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
@media (max-width: 767px) { .tag { font-size: var(--fs-label); } }

/* ---------- Check / arrow list ---------- */
.check-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.85rem; }
.check-list li { position: relative; padding-left: 2rem; color: var(--text); }
.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2em;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffa000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 0.7rem no-repeat;
}

/* ---------- Spec list (label/value rows) ---------- */
.spec-list { margin: 0; display: grid; }
.spec-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.spec-list dt { color: var(--text-muted); font-size: var(--fs-small); }
.spec-list dd { margin: 0; text-align: right; color: var(--heading); font-weight: 500; }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.table { min-width: 640px; font-size: 0.95rem; }
.table th, .table td { padding: 1rem 1.25rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table thead th { font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 0.2s ease; }
.table tbody tr:hover { background: var(--surface-2); }
.table td:first-child { color: var(--heading); font-weight: 500; }
.table .num { font-variant-numeric: tabular-nums; }
.table-note { margin-top: 0.75rem; font-size: var(--fs-small); color: var(--text-subtle); }

/* Phones/tablets: the table scrolls sideways, so pin the first column (instrument / payment method)
   and show an edge shadow on whichever side has more columns hidden (scroll-driven, no JS) */
@media (max-width: 1023px) {
  .table-wrap {
    --scroll-shade: rgb(255 255 255 / 0.14);
    background:
      linear-gradient(90deg, var(--surface) 40%, transparent) left / 48px 100% no-repeat local,
      linear-gradient(270deg, var(--surface) 40%, transparent) right / 48px 100% no-repeat local,
      radial-gradient(farthest-side at 100% 50%, var(--scroll-shade), transparent) right / 16px 100% no-repeat scroll,
      var(--surface);
  }
  :root[data-theme="light"] .table-wrap { --scroll-shade: rgb(16 27 48 / 0.16); }
  .table th:first-child, .table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: inset -1px 0 0 var(--border); }
  .table thead th:first-child { z-index: 2; background: var(--surface-2); }
  .table tbody tr:hover td:first-child { background: var(--surface-2); }
}
@media (max-width: 767px) {
  .table { min-width: 560px; font-size: 0.9rem; }
  .table th, .table td { padding: 0.85rem 0.95rem; }
}

/* Market tables (Forex / Index CFDs / Stock CFDs, 6 columns): on phones fit the screen width, no sideways scroll.
   Cells wrap, type and padding shrink, and the pinned-column trick is switched off since nothing scrolls. */
@media (max-width: 767px) {
  .table-wrap:has(.table th:nth-child(6)) { overflow-x: visible; background: var(--surface); }
  .table:has(th:nth-child(6)) { width: 100%; min-width: 0; table-layout: fixed; font-size: 0.72rem; }
  .table:has(th:nth-child(6)) th, .table:has(th:nth-child(6)) td { padding: 0.6rem 0.3rem; white-space: normal; overflow-wrap: anywhere; line-height: 1.3; text-align: center; }
  .table:has(th:nth-child(6)) th:first-child, .table:has(th:nth-child(6)) td:first-child { position: static; box-shadow: none; text-align: left; padding-left: 0.5rem; width: 24%; }
  .table:has(th:nth-child(6)) thead th { font-size: 0.56rem; letter-spacing: 0.02em; vertical-align: bottom; }
  .table:has(th:nth-child(6)) td:first-child { font-size: 0.74rem; }
}
@media (max-width: 380px) {
  .table:has(th:nth-child(6)) { font-size: 0.68rem; }
  .table:has(th:nth-child(6)) thead th { font-size: 0.52rem; }
}

/* ---------- Tabs ---------- */
.tabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto clamp(2rem, 1.5rem + 2vw, 3.5rem);
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
}
.tabs__tab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: background-color 0.25s ease, color 0.25s ease;
}
.tabs__tab img { width: 22px; height: 22px; object-fit: contain; }
.tabs__tab:hover { color: var(--heading); }
.tabs__tab[aria-selected="true"] { background: var(--pill-bg); color: var(--pill-text); }
.tabs__panel[hidden] { display: none; }
.tabs__panel { animation: fade-up 0.6s var(--ease); }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (max-width: 767px) {
  .tabs__list { border-radius: var(--radius); width: 100%; }
  .tabs__tab { flex: 1 1 auto; justify-content: center; min-height: 44px; padding: 0.65rem 0.8rem; font-size: var(--fs-label); letter-spacing: 0.06em; white-space: normal; text-align: center; }
}

/* ---------- Accordion (FAQ) ---------- */
.accordion { display: grid; gap: 0.75rem; }
.accordion__item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color 0.3s ease; }
.accordion__item[hidden] { display: none; }
.accordion__item.is-open { border-color: var(--border-strong); }
.accordion__heading { margin: 0; font-size: inherit; line-height: inherit; letter-spacing: 0; }
.accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 1.15rem 1.35rem;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--heading);
}
.accordion__icon {
  position: relative;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  transition: background-color 0.3s ease, transform 0.4s var(--ease);
}
.accordion__icon::before, .accordion__icon::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 1.5px; background: currentColor; transform: translate(-50%, -50%); }
.accordion__icon::after { transform: translate(-50%, -50%) rotate(90deg); transition: transform 0.3s var(--ease); }
.accordion__item.is-open .accordion__icon { background: var(--pill-bg); color: var(--pill-text); }
.accordion__item.is-open .accordion__icon::after { transform: translate(-50%, -50%) rotate(0deg); }
.accordion__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.45s var(--ease); }
.accordion__item.is-open .accordion__panel { grid-template-rows: 1fr; }
.accordion__panel > div { overflow: hidden; }
.accordion__body { padding: 0 1.35rem 1.35rem; color: var(--text-muted); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1rem; }
.form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field { display: grid; gap: 0.45rem; }
.field__label { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.field__input {
  width: 100%;
  min-height: 52px;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--heading);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
textarea.field__input { min-height: 150px; resize: vertical; }
.field__input::placeholder { color: var(--text-subtle); }
.field__input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.form__status { min-height: 1.5em; font-size: var(--fs-small); }
.form__status.is-success { color: var(--positive); }
.form__status.is-error { color: var(--negative); }
.inline-form { display: flex; gap: 0.5rem; padding: 0.4rem; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface); max-width: 520px; }
.inline-form .field__input { min-height: 44px; border: 0; background: transparent; border-radius: var(--radius-pill); }
.inline-form .btn { flex-shrink: 0; }

.choice-group { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; border: 0; }
.choice-group legend { margin-bottom: 0.6rem; padding: 0; }
.choice { position: relative; display: inline-flex; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: inline-flex; align-items: center; padding: 0.55rem 1rem; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); font-size: 0.88rem; color: var(--text-muted); transition: all 0.2s ease; }
.choice input:checked + span { background: var(--pill-bg); color: var(--pill-text); border-color: transparent; }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 767px) {
  .form__row { grid-template-columns: minmax(0, 1fr); }
  .inline-form { flex-direction: column; border-radius: var(--radius); }
  .inline-form .btn { width: 100%; }
}
@media (max-width: 479px) {
  .form > .btn, .form .btn[type="submit"] { width: 100%; }
}

/* ---------- Steps ---------- */
.steps { counter-reset: step; display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; padding: 1.1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.steps li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  padding-top: 0.15rem;
}

/* ---------- Stats band ("0.0 spreads from …") ---------- */
.stats-band { border-block: 1px solid var(--border); background: var(--bg-section); }
.stats-band__inner { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-band__inner > .stat:last-child { border-right: 0; }
.stat { display: flex; align-items: baseline; gap: 0.6rem; padding: 1.75rem clamp(1rem, 0.5rem + 1.5vw, 2rem); border-right: 1px solid var(--border); }
.stat__value { font-family: var(--font-heading); font-size: clamp(1.8rem, 1.3rem + 1.6vw, 2.8rem); font-weight: 500; letter-spacing: -0.03em; color: var(--heading); line-height: 1; }
.stat__label { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); line-height: 1.35; }
.stats-band__cta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.5rem clamp(1rem, 0.5rem + 1.5vw, 2rem); }
.stats-band__cta p { margin: 0; font-family: var(--font-heading); font-size: 1.1rem; line-height: 1.25; color: var(--heading); }
.stats-band__cta strong { display: block; font-weight: 500; color: var(--accent); }

/* Below 1200 the CTA cell gets squeezed (and long translations overflow it): give it its own row */
@media (max-width: 1199px) {
  .stats-band__inner { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-right: 0; }
  .stats-band__cta { grid-column: 1 / -1; border-top: 1px solid var(--border); }
}
@media (max-width: 600px) {
  .stats-band__inner { grid-template-columns: minmax(0, 1fr); }
  .stat { border-right: 0; border-bottom: 1px solid var(--border); padding-block: 1.25rem; justify-content: space-between; }
  .stat__label { text-align: right; }
  .stats-band__inner > .stat:last-child { border-bottom: 0; }
  .stats-band__cta { flex-direction: column; align-items: stretch; text-align: center; border-top: 0; }
}

/* ---------- Prose (long-form CMS content) ---------- */
.prose { color: var(--text-muted); font-size: 1.02rem; overflow-wrap: break-word; }
.prose h1, .prose h2 { font-size: var(--fs-h3); margin-top: 2.2em; }
.prose h3, .prose h4 { font-size: var(--fs-h4); margin-top: 2em; }
.prose h5, .prose h6 { margin-top: 1.8em; font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
/* Imported headings renumbered for a gap-free outline keep their original look (build.js normalizeHeadings) */
.prose .h-look-3, .prose .h-look-4 { margin-top: 2em; font-size: var(--fs-h4); line-height: 1.3; letter-spacing: -0.01em; }
.prose .h-look-5, .prose .h-look-6 { margin-top: 1.8em; font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.4; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
:is(:lang(zh), :lang(ja)) .prose :is(.h-look-3, .h-look-4) { letter-spacing: 0; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--accent); }
.prose strong, .prose b { color: var(--heading); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose img { display: inline-block; margin: 1.25rem 0; border-radius: var(--radius); background: #fff; vertical-align: top; }
.prose iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; margin: 1.5rem 0; border: 0; border-radius: var(--radius); }
.prose table { display: block; overflow-x: auto; margin: 1.5rem 0; border: 1px solid var(--border); border-radius: var(--radius); }
.prose th, .prose td { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); text-align: left; }
.prose blockquote { margin: 1.5rem 0; padding: 1rem 1.25rem; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* Table of contents sidebar for long documents */
.doc-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(2rem, 1rem + 3vw, 5rem); align-items: start; }
.toc { position: sticky; top: calc(var(--header-h) + 1.5rem); max-height: calc(100vh - var(--header-h) - 3rem); overflow: auto; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.15rem; }
.toc a { display: block; padding: 0.45rem 0.6rem; border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--text-muted); }
.toc a:hover, .toc a.is-active { background: var(--surface-2); color: var(--heading); }
@media (max-width: 991px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; max-height: none; }
}

/* ---------- Embeds (third-party widgets) ---------- */
.embed { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; }
.embed iframe { width: 100%; border: 0; }
.embed--calendar iframe { height: 900px; }
.embed--calculator iframe { height: 760px; }
.embed--map iframe { height: 100%; min-height: 360px; }
@media (max-width: 767px) {
  .embed--calendar iframe { height: 760px; }
  .embed--calculator iframe { height: 900px; }
}

/* WebTrader: the terminal fills the viewport under the header (desktop, tablet and phone) */
.page-hero--compact { padding: clamp(2rem, 1.5rem + 2vw, 3rem) 0 clamp(1.25rem, 1rem + 1vw, 2rem); }
.page-hero--compact .breadcrumb { margin-bottom: 0.75rem; }
.webtrader-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.embed--webtrader { position: relative; background: var(--surface); }
.embed--webtrader iframe { display: block; height: calc(100vh - var(--header-h) - 2rem); height: calc(100dvh - var(--header-h) - 2rem); min-height: 640px; }
.embed__status { position: absolute; inset: 0; z-index: 1; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; padding: 1.5rem; text-align: center; color: var(--text-muted); background: var(--surface); }
.js .embed__status:not([hidden]) { display: flex; }
.embed__status .loader { padding: 0; }
.embed__status-text { margin: 0; max-width: 32rem; }

/* Full-screen WebTrader: the terminal fills everything below the header, edge to edge, still in the iframe.
   No title band, card frame, footer or floating side buttons on this page. */
.page-webtrader { --header-h: 0px; }
.page-webtrader .site-header,
.page-webtrader .drawer,
.page-webtrader .drawer-backdrop,
.page-webtrader .site-footer,
.page-webtrader .sticky-cta,
.page-webtrader .side-nav { display: none; }
.webtrader-full .embed--webtrader { border: 0; border-radius: 0; background: #fff; }
.webtrader-full .embed--webtrader iframe { height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); min-height: 0; }

/* ---------- Loader / empty states ---------- */
.loader { display: flex; justify-content: center; gap: 0.4rem; padding: 3rem 0; }
.loader span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.loader span:nth-child(2) { animation-delay: 0.15s; }
.loader span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }
.empty-state { padding: 2.5rem 1.5rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); text-align: center; color: var(--text-muted); }

/* ---------- Pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 3rem; }
.pagination button { min-width: 44px; height: 44px; padding: 0 0.9rem; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }
.pagination button[aria-current="page"] { background: var(--pill-bg); color: var(--pill-text); border-color: transparent; }

/* ---------- CTA band (template "Let's build it right") ---------- */
.cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(5rem, 3rem + 8vw, 11rem) 0;
  text-align: center;
}
.cta__bg { position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: center; opacity: 0.35; }
.cta::before {
  content: "";
  position: absolute;
  inset: auto -20% -60% -20%;
  height: 120%;
  z-index: -1;
  background: radial-gradient(50% 50% at 50% 50%, var(--glow-1), transparent 70%), radial-gradient(40% 40% at 30% 60%, var(--glow-2), transparent 70%);
  filter: blur(40px);
}
.cta::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, var(--bg) 0%, transparent 35%, transparent 65%, var(--bg) 100%); }
.cta__title { font-size: var(--fs-hero); line-height: 1; letter-spacing: -0.04em; margin-bottom: 0.4em; }
.cta .eyebrow { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg); }
.footer-main { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr); gap: clamp(2.5rem, 1rem + 5vw, 6rem); padding-block: clamp(3.5rem, 2rem + 4vw, 6rem); }
.footer-brand__tagline { max-width: 360px; margin-top: 1.5rem; font-family: var(--font-heading); font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.75rem); line-height: 1.3; color: var(--heading); }
.footer-licence { display: block; width: 210px; max-width: 100%; height: auto; margin-top: 1.75rem; }
.footer-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem; padding-left: clamp(0rem, -2rem + 5vw, 3rem); border-left: 1px solid var(--border); }
.footer-col__title { margin: 0 0 1rem; font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-subtle); }
.footer-col ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.6rem; }
.footer-col a { color: var(--text); font-size: 0.95rem; }
.footer-col a:hover { color: var(--accent); }
.footer-pay { width: 100%; max-width: 220px; height: auto; padding: 0.75rem; border-radius: var(--radius); background: #fff; }
.footer-legal { padding-block: 2.5rem; border-top: 1px solid var(--border); font-size: 0.82rem; line-height: 1.7; color: var(--text-subtle); }
.footer-legal p { margin-bottom: 0.9em; }
.footer-legal strong { color: var(--text-muted); font-weight: 600; }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.5rem; border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-subtle); }

/* Below 1200 four link columns beside the brand block get too narrow (the pay logos shrink to a sliver) */
@media (max-width: 1199px) {
  .footer-main { grid-template-columns: minmax(0, 1fr); }
  .footer-cols { padding-left: 0; border-left: 0; }
  .footer-brand__tagline { max-width: 520px; }
}
/* Touch screens: taller footer links (WCAG target size) with the same visual rhythm */
@media (max-width: 1199px) {
  .footer-col ul { gap: 0; }
  .footer-col li a { display: inline-flex; align-items: center; min-height: 40px; }
}
@media (max-width: 767px) {
  .footer-main { gap: 2rem; padding-block: 2.5rem; }
  .footer-brand__tagline { margin-top: 1.1rem; font-size: 1.15rem; }
  .footer-licence { width: 170px; margin-top: 1.25rem; }
  .footer-cols { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; padding-top: 1.75rem; border-top: 1px solid var(--border); }
  .footer-col__title { margin-bottom: 0.5rem; }
  .footer-pay { max-width: 200px; }
  .footer-legal { padding-block: 1.75rem; font-size: 0.76rem; line-height: 1.65; }
  .footer-bottom { padding-block: 1.1rem; }
}
@media (max-width: 479px) {
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 0.4rem; font-size: var(--fs-label); }
}
@media (max-width: 380px) {
  .footer-cols { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: clamp(1rem, 0.5rem + 1vw, 1.75rem);
  bottom: clamp(1rem, 0.5rem + 1vw, 1.75rem);
  z-index: 90;
  width: 46px;
  height: 46px;
  background: var(--surface);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.4s var(--ease), visibility 0s linear 0.3s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
