/* Cabecera de compra-btc.html: ruta euros → exchange o P2P → tu Trezor.
   Se carga después de db.css. Solo afecta a compra-btc.html. */
:root { --cbh-ease: cubic-bezier(.2,.7,.2,1); --cbh-ok: #3FE0A0; }

html body .page-hero.cbh-hero {
  max-width: 1200px; margin: 0 auto; min-height: 0;
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 56px; align-items: center;
  text-align: left; padding: 132px 28px 84px; isolation: isolate;
}
html body .page-hero.cbh-hero::after { display: none; }
html body .page-hero.cbh-hero::before {
  content: ''; position: absolute; z-index: -1; inset: 70px 0 0 28%; pointer-events: none;
  background:
    radial-gradient(closest-side at 70% 50%, rgba(247,147,26,.2), transparent 72%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.045) 0 1px, transparent 1px 64px);
  -webkit-mask-image: radial-gradient(60% 70% at 62% 50%, #000 25%, transparent 78%);
  mask-image: radial-gradient(60% 70% at 62% 50%, #000 25%, transparent 78%);
}
.cbh-text { min-width: 0; }
html body .page-hero.cbh-hero h1 {
  max-width: none; margin: 14px 0 22px; font-size: clamp(2.6rem, 4.8vw, 4.4rem); line-height: 1; font-stretch: 112%;
  background: linear-gradient(180deg, #fff 45%, #F7931A 170%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
html body .page-hero.cbh-hero h1 span { -webkit-text-fill-color: #F7931A; }
html body .page-hero.cbh-hero p { margin: 0; max-width: 32em; font-size: clamp(1.02rem, 1.35vw, 1.18rem); color: #B4B4B9; }
.cbh-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; padding: 0; list-style: none; }
.cbh-chips li {
  display: inline-flex; align-items: center; gap: 9px; padding: 8px 15px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04); font-size: .86rem; color: #D2D2D6;
}
.cbh-chips li::before { content: ''; width: 7px; height: 7px; border-radius: 2px; transform: rotate(45deg); background: #F7931A; box-shadow: 0 0 8px rgba(247,147,26,.8); }

/* ---------- Panel ---------- */
.cbh-art {
  position: relative; margin: 0; min-width: 0; border-radius: 22px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(165deg, rgba(255,255,255,.07), rgba(255,255,255,.012) 50%), rgba(6,6,7,.86);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 40px 80px -30px rgba(0,0,0,.95), 0 0 80px -30px rgba(247,147,26,.4);
}
.cbh-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 13px 16px 13px 18px; border-bottom: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.025); }
.cbh-title { font: 500 .76rem/1.2 'JetBrains Mono', ui-monospace, monospace; color: #A1A1A6; letter-spacing: .03em; }
.cbh-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: #000; border: 1px solid rgba(255,255,255,.14); }
.cbh-seg button {
  min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer; background: transparent; color: #B4B4B9;
  font: 600 .8rem/1 'Archivo', system-ui, sans-serif; transition: background .25s, color .25s;
}
.cbh-seg button:hover { color: #fff; }
.cbh-seg button[aria-pressed="true"] { background: #F7931A; color: #000; }
.cbh-seg button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Modo exchange / P2P */
.cbh-art[data-mode="kyc"] .m-p2p, .cbh-art[data-mode="p2p"] .m-kyc { display: none !important; }

/* Ruta */
.cbh-flow { display: grid; grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr) 54px minmax(0, 1fr); align-items: start; gap: 0; list-style: none; margin: 0; padding: 26px 18px 18px; }
.cbh-st { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; min-width: 0; }
.cbh-ico {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; position: relative;
  background: #0C0C0D; border: 1px solid rgba(255,255,255,.18); color: #E6E6E8;
  transition: border-color .35s, box-shadow .35s, transform .35s var(--cbh-ease);
}
.cbh-ico svg { width: 30px; height: 30px; fill: currentColor; }
.cbh-eur { font: 700 1.9rem/1 'Archivo', system-ui, sans-serif; }
.cbh-txt { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.cbh-txt b { font-size: .98rem; color: #F5F5F7; font-stretch: 108%; }
.cbh-txt small { font-size: .78rem; line-height: 1.4; color: #A1A1A6; }
.cbh-badge {
  margin-top: 6px; font-style: normal; font: 600 .7rem/1 'Archivo', system-ui, sans-serif; letter-spacing: .02em;
  padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.2); color: #E6E6E8; background: rgba(255,255,255,.05);
  opacity: .55; transition: opacity .4s, transform .4s var(--cbh-ease);
}
.cbh-badge.warn { color: #FFB25C; border-color: rgba(247,147,26,.45); background: rgba(247,147,26,.1); }
.cbh-badge.ok { color: var(--cbh-ok); border-color: rgba(63,224,160,.45); background: rgba(63,224,160,.08); }

/* Conectores con fichas que viajan */
.cbh-link { position: relative; height: 64px; }
.cbh-link::before {
  content: ''; position: absolute; left: 4px; right: 4px; top: 31px; height: 2px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.28) 0 6px, transparent 6px 11px);
  background-size: 22px 2px; animation: cbhFlow 1.2s linear infinite;
}
@keyframes cbhFlow { to { background-position: 22px 0; } }
.cbh-tok {
  position: absolute; top: 20px; left: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font: 700 .82rem/1 'Archivo', system-ui, sans-serif; font-style: normal; color: #000; background: #E6E6E8;
  box-shadow: 0 0 0 4px rgba(255,255,255,.08), 0 0 18px rgba(255,255,255,.5); opacity: 0;
}
.cbh-tok-btc { background: #F7931A; box-shadow: 0 0 0 4px rgba(247,147,26,.15), 0 0 20px rgba(247,147,26,.8); }
@keyframes cbhX { 0% { left: -6px; opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: none; } 85% { opacity: 1; transform: none; } 100% { left: calc(100% - 18px); opacity: 0; transform: scale(.6); } }
@keyframes cbhY { 0% { top: -8px; opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: none; } 85% { opacity: 1; transform: none; } 100% { top: calc(100% - 16px); opacity: 0; transform: scale(.6); } }
@keyframes cbhPop { 0% { box-shadow: 0 0 0 0 rgba(247,147,26,.55); } 100% { box-shadow: 0 0 0 16px rgba(247,147,26,0); } }
.cbh-art[data-phase="1"] .cbh-l1 .cbh-tok { animation: cbhX 1.25s var(--cbh-ease) forwards; }
.cbh-art[data-phase="4"] .cbh-l2 .cbh-tok { animation: cbhX 1.25s var(--cbh-ease) forwards; }

/* Estado de cada estación */
.cbh-art[data-phase="1"] .cbh-st0 .cbh-ico { border-color: #F7931A; }
.cbh-art[data-phase="2"] .cbh-st1 .cbh-ico, .cbh-art[data-phase="3"] .cbh-st1 .cbh-ico {
  border-color: #F7931A; color: #F7931A; transform: translateY(-3px); animation: cbhPop 1s ease-out;
}
.cbh-art[data-phase="2"] .cbh-st1 .cbh-badge, .cbh-art[data-phase="3"] .cbh-st1 .cbh-badge { opacity: 1; transform: translateY(-1px); }
.cbh-art[data-phase="4"] .cbh-st2 .cbh-badge { opacity: 1; transform: translateY(-1px); }

/* Hardware wallet (dibujo genérico) */
.cbh-dev {
  width: 74px; height: 64px; border-radius: 14px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(180deg, #2A2A2E, #121214 60%); border: 1px solid rgba(255,255,255,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 10px 22px -10px rgba(0,0,0,.9); transition: box-shadow .4s, border-color .4s;
}
.cbh-scr {
  width: 60px; height: 34px; border-radius: 5px; background: #000; border: 1px solid rgba(255,255,255,.12); position: relative; overflow: hidden;
  font: 600 8.5px/1.15 'JetBrains Mono', ui-monospace, monospace; color: #fff; text-align: center;
}
.cbh-scr > span { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: opacity .3s; }
.cbh-scr .scr-idle { letter-spacing: .14em; color: #D2D2D6; opacity: 1; }
.cbh-scr .scr-hex { color: #F7931A; }
.cbh-scr .scr-ok { color: var(--cbh-ok); font-size: 9px; }
.cbh-btns { display: flex; gap: 22px; }
.cbh-btns i { width: 12px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.3); }
.cbh-art[data-phase="3"] .scr-idle, .cbh-art[data-phase="4"] .scr-idle { opacity: 0; }
.cbh-art[data-phase="3"] .scr-addr { opacity: 1; animation: cbhBlink 1s steps(2) infinite; }
.cbh-art[data-phase="4"] .scr-ok { opacity: 1; }
.cbh-art[data-phase="3"] .cbh-dev { border-color: #F7931A; box-shadow: 0 0 0 1px rgba(247,147,26,.4), 0 0 28px -4px rgba(247,147,26,.7); }
.cbh-art[data-phase="4"] .cbh-dev { border-color: var(--cbh-ok); box-shadow: 0 0 0 1px rgba(63,224,160,.35), 0 0 30px -4px rgba(63,224,160,.6); }
@keyframes cbhBlink { 50% { opacity: .55; } }

/* Pasos (versión legible y accesible de la animación) */
.cbh-steps { list-style: none; margin: 0; padding: 4px 18px 16px; counter-reset: cbh; display: grid; gap: 6px; }
.cbh-steps li {
  counter-increment: cbh; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 9px 12px; border-radius: 12px; font-size: .9rem; line-height: 1.45; color: #B4B4B9;
  border: 1px solid transparent; transition: background .3s, border-color .3s, color .3s;
}
.cbh-steps li::before {
  content: counter(cbh); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font: 600 .8rem/1 'JetBrains Mono', ui-monospace, monospace; color: #A1A1A6; border: 1px solid rgba(255,255,255,.2); transition: all .3s;
}
.cbh-steps li.on { color: #F5F5F7; background: rgba(247,147,26,.08); border-color: rgba(247,147,26,.3); }
.cbh-steps li.on::before { color: #000; background: #F7931A; border-color: #F7931A; }
.cbh-steps li.done { color: #D2D2D6; }
.cbh-steps li.done::before { content: '✓'; color: #000; background: var(--cbh-ok); border-color: var(--cbh-ok); }

.cbh-foot { padding: 12px 18px 16px; border-top: 1px solid rgba(255,255,255,.09); }
.cbh-foot small { font-size: .8rem; line-height: 1.5; color: #A1A1A6; }

@media (max-width: 900px) {
  html body .page-hero.cbh-hero { grid-template-columns: minmax(0, 1fr); gap: 34px; padding: 108px 16px 52px; }
  html body .page-hero.cbh-hero::before { inset: 40% -10% 0 -10%; }
}
@media (max-width: 560px) {
  .cbh-top { padding: 11px 12px 11px 14px; }
  .cbh-title { display: none; }
  .cbh-seg { width: 100%; }
  .cbh-seg button { flex: 1; }
  .cbh-flow { grid-template-columns: minmax(0, 1fr); padding: 18px 14px 10px; }
  .cbh-st { flex-direction: row; text-align: left; gap: 14px; }
  .cbh-txt { align-items: flex-start; }
  .cbh-ico, .cbh-dev { flex: none; }
  .cbh-ico { width: 56px; height: 56px; margin: 0 9px; }
  .cbh-link { height: 36px; width: 74px; }
  .cbh-link::before { left: 36px; right: auto; top: 2px; bottom: 2px; width: 2px; height: auto; background: repeating-linear-gradient(180deg, rgba(255,255,255,.28) 0 6px, transparent 6px 11px); background-size: 2px 22px; animation-name: cbhFlowY; }
  .cbh-tok { left: 25px; top: 0; }
  .cbh-art[data-phase="1"] .cbh-l1 .cbh-tok, .cbh-art[data-phase="4"] .cbh-l2 .cbh-tok { animation-name: cbhY; }
  .cbh-badge { margin-top: 4px; }
  .cbh-steps { padding: 4px 10px 12px; }
  .cbh-steps li { font-size: .86rem; padding: 8px 10px; gap: 10px; }
  .cbh-foot { padding: 12px 14px 14px; }
}
@keyframes cbhFlowY { to { background-position: 0 22px; } }
@media (prefers-reduced-motion: reduce) {
  .cbh-link::before, .cbh-tok, .cbh-ico, .scr-addr { animation: none !important; }
  .cbh-tok { opacity: 0; }
}
