/* ============================================================
   card-detail.css — detalle de una carta (card-details.php)

   Mismo lenguaje que las vitrinas (shop.css, se carga antes): fondo papel, líneas finas, títulos en
   Space Grotesk, el rojo de la marca solo en la acción de comprar y el dorado para foil / gradeadas.
   Prefijo dt-  ·  usa las variables de .shp (--ink, --line, --tile, --accent, --gold…)
   También reordena el bloque "Detalles de la carta" (card-extra.css / CardExtraInfo.php).
   ============================================================ */

/* El fondo papel llega hasta el pie de página (sin la franja del margen del footer) */
main:has(> .shp) + .tcg-footer { margin-top: 0; }

/* ---------- Ruta ---------- */
.dt-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 28px; font-size: .86rem; color: var(--mute); }
.dt-crumbs a { color: var(--ink-2); }
.dt-crumbs a:hover { color: var(--accent); }
.dt-crumbs__sep { color: #CFCABD; }
.dt-crumbs [aria-current] { color: var(--mute); }

/* ---------- Estructura ---------- */
.dt-grid { display: grid; grid-template-columns: minmax(300px, 480px) minmax(0, 1fr); gap: 72px; align-items: start; }

/* Escenario de la carta */
.dt-stage {
    position: sticky; top: 98px; display: grid; place-items: center;
    padding: 48px 40px; border-radius: 20px; background: var(--tile);
}
.dt-stage .cd-card-frame { position: relative; top: auto; width: 100%; max-width: 340px; }
.dt-stage .cd-card-frame__inner {
    border-radius: 14px; background: var(--white);
    box-shadow: 0 30px 50px -26px rgba(22,21,26,.6), 0 0 0 1px rgba(22,21,26,.06);
}
.dt-stage .cd-card-frame--graded { max-width: 320px; }
.dt-stage .cd-card-frame--graded .cd-card-frame__inner { background: transparent; box-shadow: none; padding: 0; }
.dt-stage__pills { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.dt-pill {
    display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 11px; border-radius: 999px;
    background: rgba(255,255,255,.94); color: var(--ink); font: 600 .76rem var(--f-body); box-shadow: 0 1px 3px rgba(0,0,0,.14);
}
.dt-pill--foil { background: var(--gold-bg); color: #7A5320; text-transform: capitalize; }
.dt-pill--grade { background: var(--ink); color: #E3B66C; box-shadow: inset 0 0 0 1px var(--gold); }

/* ---------- Información ---------- */
.dt-info { min-width: 0; }
.dt-over { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 9px; font-size: .88rem; color: var(--mute); }
.dt-over a { color: var(--ink-2); font-weight: 500; }
.dt-over a:hover { color: var(--accent); }
.dt-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dt-name { margin: 12px 0 10px; font: 600 clamp(2rem, 3.6vw, 2.9rem)/1.05 var(--f-display); letter-spacing: -.035em; overflow-wrap: anywhere; }
.dt-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0; color: var(--ink-2); font-size: 1rem; }
.dt-sub strong { font-weight: 600; color: var(--ink); }
.dt-sub code { padding: 2px 8px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); font: 500 .84rem var(--f-body); font-variant-numeric: tabular-nums; }

/* Certificación (carta gradeada) */
.dt-cert {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 22px; padding: 14px 18px;
    border: 1px solid #E6D2A8; border-radius: 12px; background: var(--gold-bg); color: #7A5320;
}
.dt-cert .bi { font-size: 1.15rem; color: var(--gold); }
.dt-cert__grade { font: 600 1.1rem var(--f-display); color: #5E3F13; }
.dt-cert__label { padding: 2px 10px; border-radius: 999px; background: rgba(255,255,255,.7); font-size: .78rem; font-weight: 600; }
.dt-cert__num { margin-left: auto; font-size: .8rem; font-variant-numeric: tabular-nums; }

/* ---------- Caja de compra ---------- */
.dt-buy { margin-top: 28px; padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); }
.dt-buy__top { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; }
.dt-sale { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-variant-numeric: tabular-nums; }
.dt-sale__old { color: var(--mute); font-size: 1.02rem; }
.dt-sale__pct { padding: 2px 9px; border-radius: 999px; background: #DC2626; color: #fff; font: 700 .78rem var(--f-body); }
.dt-sale__txt { font-size: .86rem; color: var(--ok, #0F7B5A); font-weight: 600; }
.dt-var__old { color: var(--mute); font-size: .78rem; font-weight: 400; margin-right: 4px; }
.dt-bar__old { color: var(--mute); font-size: .78rem; font-weight: 400; margin-left: 4px; }
.dt-price { font: 600 clamp(2.2rem, 4vw, 2.8rem)/1 var(--f-display); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.dt-stock { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500; color: var(--ok); }
.dt-stock::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dt-stock--low { color: var(--warn); }
.dt-stock--out { color: var(--accent); }
.dt-usd { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 4px 10px; border: 1px dashed #E3B66C; border-radius: 8px; background: var(--gold-bg); color: #7A5320; font-size: .8rem; font-weight: 500; }
.dt-usd small { font-weight: 400; opacity: .8; }

.dt-buy__row { display: flex; gap: 12px; margin-top: 22px; }
.dt-qty { display: inline-flex; align-items: stretch; height: 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); overflow: hidden; flex: none; }
.dt-qty button {
    width: 44px; border: 0; background: var(--white); color: var(--ink); font-size: 1.2rem; line-height: 1;
    cursor: pointer; display: grid; place-items: center; transition: background .12s;
}
.dt-qty button:hover:not(:disabled) { background: var(--tile); }
.dt-qty button:disabled { opacity: .3; cursor: not-allowed; }
.dt-qty input {
    width: 52px; border: 0; border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2); border-radius: 0; padding: 0;
    text-align: center; background: var(--white); color: var(--ink);
    font: 600 1.05rem var(--f-display); font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield;
}
.dt-qty input::-webkit-outer-spin-button, .dt-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dt-qty input:focus { outline: 0; background: var(--paper); }
.dt-qty:focus-within { border-color: var(--ink); }
.dt-add {
    flex: 1; min-width: 0; height: 52px; display: flex; align-items: center; justify-content: center; gap: 9px;
    border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: 600 1rem var(--f-body);
    cursor: pointer; transition: background .15s;
}
.dt-add:hover:not(:disabled) { background: var(--accent-dk); }
.dt-add:disabled { cursor: default; }
.dt-add.is-done { background: var(--ok); }
.dt-add:disabled:not(.is-done) { background: #D9A0A0; }
.dt-qty button:focus-visible, .dt-add:focus-visible, .dt-bar__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.dt-msg { min-height: 0; margin: 0; font-size: .88rem; line-height: 1.45; }
.dt-msg:not(:empty) { margin-top: 14px; }
.dt-msg--ok { color: var(--ok); }
.dt-msg--warn { color: var(--warn); }
.dt-msg--err { color: #B91C1C; }
.dt-msg a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.dt-out { margin: 20px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--tile); color: var(--ink-2); font-size: .92rem; }
.dt-out a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.dt-assure { list-style: none; margin: 22px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); display: grid; gap: 9px; font-size: .82rem; color: var(--mute); }
.dt-assure li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.4; }
.dt-assure .bi { flex: none; color: var(--ink-2); font-size: .95rem; }
.dt-assure a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.dt-assure a:hover { color: var(--accent); text-decoration-color: currentColor; }

/* ---------- Datos de la carta (idioma, condición…) ---------- */
.dt-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 44px; margin: 30px 0 0; padding: 0; border-top: 1px solid var(--line); }
.dt-facts > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.dt-facts dt { color: var(--mute); font-size: .9rem; }
.dt-facts dd { margin: 0; color: var(--ink); font-weight: 500; font-size: .96rem; text-align: right; }
.dt-facts dd .tcgv-lang, .dt-facts dd span { font-weight: inherit; }

/* ---------- Nota de la tienda ---------- */
.dt-note { margin-top: 26px; padding: 14px 18px; border-left: 3px solid #F59E0B; border-radius: 0 10px 10px 0; background: #FFFBEB; color: #92400E; font-size: .92rem; line-height: 1.55; }
.dt-note strong { display: block; margin-bottom: 4px; font-weight: 600; }

/* ---------- Otras versiones ---------- */
.dt-block { margin-top: 44px; padding-top: 30px; border-top: 1px solid var(--line); }
.dt-h2 { margin: 0 0 6px; font: 600 1.3rem var(--f-display); letter-spacing: -.02em; }
.dt-lead { margin: 0 0 14px; color: var(--mute); font-size: .9rem; }
.dt-vars { list-style: none; margin: 0; padding: 0; }
.dt-var {
    display: grid; grid-template-columns: minmax(96px, auto) minmax(0, 1fr) auto 16px; align-items: center; gap: 14px;
    padding: 13px 4px; border-bottom: 1px solid var(--line); color: var(--ink); transition: background .12s;
}
.dt-vars li:first-child .dt-var { border-top: 1px solid var(--line); }
.dt-var:hover { background: rgba(22,21,26,.03); }
.dt-var__lang { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500; }
.dt-var__desc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; font-size: .86rem; color: var(--ink-2); }
.dt-var__price { font: 600 1.02rem var(--f-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dt-var .bi { color: var(--mute); font-size: .8rem; }
.dt-var:hover .bi { color: var(--accent); }
.dt-var:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dt-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); font: 500 .72rem var(--f-body); }
.dt-tag--foil { background: var(--gold-bg); color: #7A5320; text-transform: capitalize; }
.dt-var__low { font-size: .76rem; color: var(--warn); }

/* ---------- Detalles del juego (CardExtraInfo) ---------- */
.dt-info .cd-extra { margin-top: 44px; padding: 30px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.dt-info .cd-extra__header { margin-bottom: 22px; padding-bottom: 0; border: 0; }
.dt-info .cd-extra__icon { display: none; }
.dt-info .cd-extra__header h3 { font: 600 1.3rem var(--f-display); letter-spacing: -.02em; }
.dt-info .cd-stats-grid { gap: 10px; margin-bottom: 22px; }
.dt-info .cd-stat-pill { padding: 13px 8px; border: 1px solid var(--line) !important; border-radius: 12px; background: var(--white); color: var(--ink) !important; }
.dt-info .cd-stat-pill:hover { transform: none; }
.dt-info .cd-stat-pill small { margin-bottom: 5px; color: var(--mute); font-size: .76rem; font-weight: 500; letter-spacing: 0; text-transform: none; }
.dt-info .cd-stat-pill strong { font: 600 1.18rem var(--f-display); }
.dt-info .cd-section { margin-bottom: 22px; }
.dt-info .cd-section h4 { margin: 0 0 10px; color: var(--ink-2); font: 600 .9rem var(--f-body); letter-spacing: 0; text-transform: none; }
.dt-info .cd-type-pill { padding: 4px 12px; font-weight: 500; }
.dt-info .cd-ability { border-left: 3px solid var(--gold); border-radius: 0 12px 12px 0; background: var(--gold-bg); }
.dt-info .cd-ability__head strong { color: #5E3F13; }
.dt-info .cd-ability__tag { background: var(--gold); color: #fff; font-weight: 600; letter-spacing: .02em; text-transform: none; }
.dt-info .cd-ability p { color: var(--ink-2); }
.dt-info .cd-attack { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.dt-info .cd-attack__dmg { border-radius: 8px; background: var(--ink); }
.dt-info .cd-attack p { color: var(--ink-2); }
.dt-info .cd-defense-card { border: 1px solid var(--line) !important; border-radius: 12px; background: var(--white); }
.dt-info .cd-defense-card small { color: var(--mute); font-weight: 500; letter-spacing: 0; text-transform: none; }
.dt-info .cd-oracle { border-radius: 12px; background: var(--tile); color: var(--ink-2); }
.dt-info .cd-oracle--trigger { border-left: 3px solid var(--gold); border-radius: 0 12px 12px 0; background: var(--gold-bg); color: #5E3F13; }
.dt-info .cd-flavor { border-left: 2px solid var(--line); border-radius: 0; background: none; color: var(--mute); }
.dt-info .cd-extras-footer { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.dt-info .cd-extras-item small { color: var(--mute); font-size: .78rem; font-weight: 500; letter-spacing: 0; text-transform: none; }

/* ---------- Cartas relacionadas ---------- */
.dt-rel { margin-top: 84px; }
.dt-rel .shp-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 34px 18px; }
.dt-rel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.dt-rel__head .dt-h2 { margin: 0; font-size: 1.55rem; }
.dt-rel .shp-item__lang { left: 9px; bottom: 9px; }

/* ---------- Barra de compra fija (solo celular) ---------- */
.dt-bar { display: none; }

/* ---------- Escritorio angosto / tablet ---------- */
@media (max-width: 1180px) {
    .dt-rel .shp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
    .dt-grid { gap: 44px; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); }
    .dt-stage { padding: 40px 28px; }
}
@media (max-width: 860px) {
    .dt-grid { grid-template-columns: minmax(0, 1fr); gap: 30px; }
    .dt-stage { position: relative; top: auto; padding: 34px 20px; }
    .dt-stage .cd-card-frame { max-width: 270px; }
    .dt-stage .cd-card-frame--graded { max-width: 250px; }
    .dt-rel { margin-top: 60px; }
    .dt-bar {
        display: flex; align-items: center; justify-content: space-between; gap: 14px;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 11px 16px calc(11px + env(safe-area-inset-bottom));
        background: rgba(255,255,255,.97); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
        border-top: 1px solid var(--line); transform: translateY(105%); transition: transform .22s ease; visibility: hidden;
    }
    .dt-bar.is-visible { transform: none; visibility: visible; }
    .shp-toast { bottom: 88px; }   /* por encima de la barra de compra */
    .dt-bar__price { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
    .dt-bar__price small { font-size: .74rem; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .dt-bar__price strong { font: 600 1.3rem var(--f-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
    .dt-bar__btn {
        display: flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 24px; flex: 0 1 220px;
        border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: 600 .98rem var(--f-body); cursor: pointer; white-space: nowrap;
    }
    .dt-bar__btn:disabled { background: var(--ok); }
}
@media (max-width: 640px) {
    .dt-rel .shp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 12px; }
    .dt-crumbs { margin-bottom: 18px; }
    .dt-buy { padding: 20px; border-radius: 16px; }
    .dt-facts { grid-template-columns: 1fr; }
    .dt-var { grid-template-columns: minmax(0, 1fr) auto 14px; gap: 6px 12px; }
    .dt-var__lang { grid-column: 1; }
    .dt-var__desc { grid-column: 1 / 2; grid-row: 2; }
    .dt-var__price { grid-column: 2; grid-row: 1 / span 2; }
    .dt-var .bi { grid-column: 3; grid-row: 1 / span 2; }
    .dt-rel__head .dt-h2 { font-size: 1.3rem; }
}
@media (max-width: 480px) {
    .dt-add__more { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .dt-bar { transition: none; }
}
