/* ============================================================
   IB THEME — components (buttons, badges, ticker, stats, partner, signal, risk, etc.)
   ============================================================ */

/* reset */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; padding: 0; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

html {
  scroll-behavior: smooth;
  /* Stop horizontal scroll caused by accidental overflow anywhere on the page */
  overflow-x: hidden;
  max-width: 100%;
}
body {
  margin: 0;
  font-family: var(--f-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
  overflow-x: hidden;
  max-width: 100vw;
}
/* Anything that might overflow horizontally on mobile (long URLs, code, etc.) wraps cleanly */
p, li, h1, h2, h3, h4, h5, h6, td, th, div { word-wrap: break-word; overflow-wrap: anywhere; }

/* ===== BUTTONS ===== */
.btn {
  font-family: var(--f-sans); font-weight: 600; font-size: 13px;
  padding: 9px 16px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: all .12s;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; letter-spacing: .01em; line-height: 1.2;
}
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-dark); color: var(--on-brand); }
.btn-cta {
  background: var(--brand); color: var(--on-brand);
  padding: 12px 22px; font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.btn-cta:hover { background: var(--brand-dark); color: var(--on-brand); }
.btn-outline { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand-tint); color: var(--brand); }
.btn-ghost { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-link {
  background: transparent; color: var(--brand); padding: 4px 0; border-radius: 0;
  font-weight: 600; font-size: 13px;
}
.btn-link::after { content: " →"; font-family: var(--f-mono); transition: transform .15s; }
.btn-link:hover::after { transform: translateX(3px); }
[dir="rtl"] .btn-link::after { content: " ←"; }
[dir="rtl"] .btn-link:hover::after { transform: translateX(-3px); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: var(--r-xs);
  font-size: 11px; font-weight: 600;
  font-family: var(--f-sans); letter-spacing: .02em;
}
.b-up      { background: var(--up-bg); color: var(--up); }
.b-down    { background: var(--down-bg); color: var(--down); }
.b-warn    { background: var(--warn-bg); color: var(--warn); }
.b-brand   { background: var(--brand-tint); color: var(--brand); }
.b-solid   { background: var(--brand); color: var(--on-brand); }
.b-outline { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); }
.b-live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--up); box-shadow: 0 0 0 3px var(--up-bg);
  animation: ib-pulse 1.6s ease-out infinite;
}
@keyframes ib-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 30%, transparent); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}

/* ===== TICKER PILL ===== */
.ticker {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg); font-family: var(--f-mono); font-size: 13px;
}
.ticker .pair  { font-weight: 600; color: var(--ink); }
.ticker .px    { font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ticker .delta { font-weight: 600; font-size: 12px; }
.ticker .delta.up   { color: var(--up); }
.ticker .delta.down { color: var(--down); }

/* ===== STAT BLOCK ===== */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .stat-lbl { font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 500; }
.stat .stat-val { font-family: var(--f-mono); font-weight: 600; font-size: 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .stat-chg { font-family: var(--f-mono); font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.stat .stat-chg.up   { color: var(--up); }
.stat .stat-chg.down { color: var(--down); }

/* ===== RISK WARNING ===== */
.risk {
  background: var(--warn-bg);
  border-inline-start: 3px solid var(--warn);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: 12px; color: var(--ink); line-height: 1.55;
  display: flex; gap: 10px; align-items: flex-start;
}
.risk .ic { color: var(--warn); flex-shrink: 0; margin-top: 1px; width: 16px; height: 16px; }
.risk strong { color: var(--warn); font-weight: 700; }

/* ===== INPUTS ===== */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-lbl { font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; }
.input {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--bg); color: var(--ink);
  font-family: var(--f-sans); font-size: 14px;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.input.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

/* ===== BROKER PARTNER CARD ===== */
.partner {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 18px; background: var(--bg);
  transition: all .15s;
}
.partner:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.partner .p-thumb {
  display: block;
  height: 130px;
  width: auto;
  margin: -18px -18px 14px -18px;
  background:
    linear-gradient(135deg, var(--brand-tint), var(--brand-soft)),
    var(--surface-2);
  background-size: cover;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  position: relative;
}
.partner .p-thumb img {
  width: 100%; height: 100%;
  max-width: 100%; max-height: 100%;
  object-fit: cover; object-position: top center;
  display: block; background: var(--surface-2);
}
.partner .p-thumb::after {
  content: "auto";
  position: absolute; bottom: 6px; inset-inline-end: 6px;
  font-family: var(--f-mono); font-size: 9px; color: var(--ink-2);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  padding: 1px 7px; border-radius: 3px;
  letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
}
.partner .p-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
/* Base .p-logo (also used in sidebars + comparisons — size must travel with the class) */
.p-logo {
  width: 40px; height: 40px; min-width: 40px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: var(--on-brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-weight: 700; font-size: 13px;
  flex-shrink: 0; overflow: hidden;
}
.p-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
/* Small variant used in sidebar alternatives list */
.p-logo.sm { width: 32px; height: 32px; min-width: 32px; font-size: 11px; }
.partner .p-name { font-weight: 600; font-size: 15px; color: var(--ink); }
.partner .p-tag  { font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); }
.partner .p-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-bottom: 14px; padding: 10px;
  background: var(--surface); border-radius: var(--r-sm);
}
.partner .p-stats .ps { text-align: center; }
.partner .p-stats .ps-l { font-family: var(--f-mono); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 2px; }
.partner .p-stats .ps-v { font-family: var(--f-mono); font-weight: 600; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.partner .p-review-link {
  display: block; text-align: center; margin-top: 8px;
  color: var(--ink-2); font-size: 12px; font-weight: 500;
}
.partner .p-review-link:hover { color: var(--brand); }

/* gradient classes for logo fallbacks */
.gradient-1 { background: linear-gradient(135deg, #1e40af, #3b82f6) !important; }
.gradient-2 { background: linear-gradient(135deg, #065f46, #10b981) !important; }
.gradient-3 { background: linear-gradient(135deg, #7c2d12, #f97316) !important; }
.gradient-4 { background: linear-gradient(135deg, #581c87, #a855f7) !important; }
.gradient-5 { background: linear-gradient(135deg, #831843, #ec4899) !important; }
.gradient-6 { background: linear-gradient(135deg, #134e4a, #14b8a6) !important; }

/* ===== VERDICT / TL;DR BOX ===== */
.verdict {
  background: var(--brand-tint);
  border: 1px solid var(--brand-soft);
  border-radius: var(--r-md);
  padding: 18px 20px;
}
.verdict .v-head {
  display: flex; align-items: center; gap: 8px;
  color: var(--brand); font-family: var(--f-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  margin-bottom: 12px;
}
.verdict ul { list-style: none; margin: 0; padding: 0; }
.verdict li {
  position: relative; padding-inline-start: 22px;
  font-size: 14px; line-height: 1.6; margin-bottom: 6px; color: var(--ink);
}
.verdict li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 9px;
  width: 13px; height: 2px; background: var(--brand); border-radius: 2px;
}

/* ===== PROS / CONS ===== */
.pc { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.pc-box {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px; background: var(--bg);
}
.pc-box h5 {
  font-family: var(--f-mono); font-size: 11px; font-weight: 700;
  margin: 0 0 10px; text-transform: uppercase; letter-spacing: .06em;
  display: flex; align-items: center; gap: 6px;
}
.pc-box.pos h5 { color: var(--up); }
.pc-box.neg h5 { color: var(--down); }
.pc-box ul { list-style: none; margin: 0; padding: 0; }
.pc-box li {
  font-size: 13px; line-height: 1.5;
  padding: 5px 0; padding-inline-start: 20px;
  position: relative; color: var(--ink);
}
.pc-box li::before { position: absolute; inset-inline-start: 0; top: 5px; font-weight: 700; }
.pc-box.pos li::before { content: "✓"; color: var(--up); }
.pc-box.neg li::before { content: "✕"; color: var(--down); font-size: 11px; }

/* ===== ARTICLE / GUIDE CARD ===== */
.acard {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
  transition: all .15s;
  color: var(--ink); text-decoration: none; display: block;
}
.acard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--ink); }
.acard .cv {
  height: 140px;
  background: linear-gradient(135deg, var(--brand-tint), var(--brand-soft));
  display: flex; align-items: center; justify-content: center;
  color: var(--brand); font-family: var(--f-mono);
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  overflow: hidden;
}
.acard .cv img { width: 100%; height: 100%; object-fit: cover; }
.acard .bd { padding: 16px 18px; }
.acard .mt {
  font-family: var(--f-mono); font-size: 10px;
  color: var(--ink-3); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 7px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.acard .tt { font-weight: 600; font-size: 15px; line-height: 1.35; letter-spacing: -.005em; color: var(--ink); }

/* ===== FAQ / DETAILS ===== */
details.wp-block-details, .article details {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 18px; margin-bottom: 10px;
  transition: border-color .15s, background .15s;
}
details.wp-block-details[open], .article details[open] {
  border-color: var(--brand);
  background: var(--brand-tint);
}
details.wp-block-details > summary, .article details > summary {
  font-weight: 600; cursor: pointer; color: var(--ink);
  list-style: none; position: relative; padding-inline-end: 32px;
  font-size: 14px; line-height: 1.4; outline: none;
}
details.wp-block-details > summary::-webkit-details-marker,
.article details > summary::-webkit-details-marker { display: none; }
details.wp-block-details > summary::after,
.article details > summary::after {
  content: "+"; position: absolute; inset-inline-end: 4px; top: -2px;
  font-family: var(--f-mono); font-size: 22px; font-weight: 400;
  color: var(--brand); transition: transform .15s;
}
details.wp-block-details[open] > summary::after,
.article details[open] > summary::after { content: "−"; }
details.wp-block-details > *:not(summary),
.article details > *:not(summary) { margin-top: 10px; font-size: 14px; line-height: 1.65; color: var(--ink-2); }

/* ============================================================
   SINGLE-BRAND HOMEPAGE VARIANT (parts/front-single.php)
   Drop-in styles. Reuses .hr / .sec / .btn / .ps wherever possible.
   ============================================================ */
.hr-single { padding: 56px 24px 48px; }
.single-hero-inner {
  max-width: 760px; margin: 0 auto; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.single-hero-logo .p-logo {
  width: 84px; height: 84px; border-radius: 18px;
  font-size: 30px; font-weight: 700;
}
.single-hero-logo .p-logo img { width: 84px; height: 84px; object-fit: contain; }
.single-hero-title {
  font-weight: 700; font-size: clamp(34px, 5vw, 54px);
  letter-spacing: -.03em; line-height: 1.05; margin: 4px 0 0; color: var(--ink);
  display: flex; flex-direction: column; gap: 6px;
}
.single-hero-title .hl {
  font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--ink-2);
  font-family: var(--f-mono);
  text-transform: uppercase; opacity: .9;
}
.single-hero-sub {
  font-size: 17px; color: var(--ink-2); margin: 0; max-width: 540px;
  line-height: 1.55;
}
.single-hero-regs {
  font-family: var(--f-mono); font-size: 12px; color: var(--ink-3);
  letter-spacing: .04em; padding: 6px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.single-hero-regs strong { color: var(--ink); font-weight: 600; margin-inline-start: 6px; }
.single-hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; width: 100%; max-width: 640px; margin: 8px 0 4px;
}
.single-hero-stats .ps {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 8px; text-align: center;
}
.single-hero-stats .ps-l {
  font-family: var(--f-mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3); margin-bottom: 4px;
}
.single-hero-stats .ps-v {
  font-family: var(--f-mono); font-weight: 700; font-size: 16px;
  color: var(--ink); font-variant-numeric: tabular-nums;
}

.btn-lg { padding: 14px 28px; font-size: 16px; min-height: 52px; }

/* WHY-THIS-BROKER cards */
.single-why { gap: 16px; }
.single-why-card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 22px;
  display: flex; flex-direction: column; gap: 14px; min-height: 130px;
}
.single-why-num {
  font-family: var(--f-mono); font-weight: 700; font-size: 12px;
  color: var(--brand); letter-spacing: .04em; display: inline-flex;
  align-items: center; gap: 10px;
}
.single-why-num::before {
  content: ""; width: 24px; height: 1px; background: var(--brand);
}
.single-why-text {
  font-size: 15px; line-height: 1.55; color: var(--ink); font-weight: 500;
}

/* HOW-TO STEPS — uses .step but with .step-num / .step-body.
   Force 4 equal columns so all 4 steps sit on ONE row (parent .steps defaults to 3-col). */
.steps.single-steps { grid-template-columns: repeat(4, 1fr); }
.single-steps .step {
  display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
  padding: 22px; min-height: 130px;
}
.single-steps .step-num {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand);
  font-weight: 700; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-mono);
}
.single-steps .step-body {
  font-size: 15px; line-height: 1.55; color: var(--ink);
}
.single-step-cta { text-align: center; margin-top: 28px; }

/* Free-form homepage content (Settings → Reading → Static front page) */
.custom-home-content { padding-top: 0; }
.custom-home-content .article {
  max-width: 760px; margin: 0 auto;
}
.custom-home-content .article > .wp-block-image,
.custom-home-content .article > figure,
.custom-home-content .article > .wp-block-table { max-width: 100%; }

/* Empty-state when no broker exists yet */
.empty-state {
  max-width: 560px; margin: 80px auto; text-align: center;
  padding: 40px 24px; background: var(--surface);
  border: 1px dashed var(--line-2); border-radius: var(--r-md);
}
.empty-state h1 { font-size: 24px; margin: 0 0 12px; color: var(--ink); }
.empty-state p { color: var(--ink-2); line-height: 1.55; margin: 0; }

/* MOBILE — single-brand homepage */
@media (max-width: 920px) {
  /* On narrower viewports drop 4-column steps to 2 so text remains readable */
  .steps.single-steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .single-hero-stats { grid-template-columns: repeat(2, 1fr); }
  .single-hero-title { font-size: 28px; }
  .single-why { grid-template-columns: 1fr 1fr; }
  .btn-lg { padding: 12px 22px; font-size: 15px; min-height: 48px; }
}
@media (max-width: 480px) {
  .single-why { grid-template-columns: 1fr; }
  .steps.single-steps { grid-template-columns: 1fr; }
  .single-hero-logo .p-logo { width: 72px; height: 72px; font-size: 26px; }
  .single-hero-logo .p-logo img { width: 72px; height: 72px; }
}
